Commit 32b7eeda authored by YannGarcia's avatar YannGarcia
Browse files

Validate MEC-013 against MEC Sandbox

parent 9f3d6ba6
......@@ -57,9 +57,7 @@ int http_codec::decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::Htt
return -1;
}
loggers::get_instance().log_msg("http_codec::decode: message_id: ", message_id);
if (message_id.lengthof() < 6) { // HTTP/
return -1;
}
// Extract parameters
try {
std::string str(static_cast<const char*>(message_id));
......@@ -538,7 +536,7 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
}
loggers::get_instance().log("http_codec::decode_body: counter=%d", counter);
body = OCTETSTRING(body.lengthof() - counter, static_cast<const unsigned char*>(body));
if (_dc.chunked){
if (_dc.chunked) {
int counter = 0;
int prev = 0;
OCTETSTRING os(0, nullptr);
......@@ -558,6 +556,12 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
loggers::get_instance().log("http_codec::decode_body: str: '%s'", str.c_str());
int len = std::stoi(str, nullptr, 16);//converter::get_instance().string_to_int(str);
loggers::get_instance().log("http_codec::decode_body: Chunk len: %d", len);
if (len > body.lengthof()) { // Missing data :(
loggers::get_instance().warning("http_codec::decode_body: Missing data and chunked mode");
_params->insert(std::pair<std::string, std::string>("missing_data", "1"));
_params->log();
return -1;
}
while (counter < body.lengthof() && ((body[counter].get_octet() == '\r') || (body[counter].get_octet() == '\n'))) { // Skip additional \n
counter += 1;
} // End of 'while' statement
......
......@@ -11,7 +11,7 @@ using namespace std; // Required for isnan()
#include "LibItsHttp_TypesAndValues.hh"
#include "LibItsHttp_TestSystem.hh"
http_layer::http_layer(const std::string & p_type, const std::string & param) : t_layer<LibItsHttp__TestSystem::HttpPort>(p_type), _params(), _device_mode{false}
http_layer::http_layer(const std::string & p_type, const std::string & param) : t_layer<LibItsHttp__TestSystem::HttpPort>(p_type), _params(), _device_mode{false}, _stream_buffer(0, NULL)
{
loggers::get_instance().log(">>> http_layer::http_layer: %s, %s", to_string().c_str(), param.c_str());
// Setup parameters
......@@ -86,9 +86,32 @@ void http_layer::receive_data(OCTETSTRING& data, params& params)
// Decode HTTP message
LibItsHttp__TypesAndValues::HttpMessage http_message;
if (_codec.decode(data, http_message, &params) == -1) {
loggers::get_instance().warning("http_layer::receive_data: Failed to decode data");
return;
if (!_stream_buffer.is_bound()) {
if (data.lengthof() < 6) { // 'HTTP/' or 'GET /'
loggers::get_instance().warning("http_layer::receive_data: Inconsistant buffer length");
return;
}
if (_codec.decode(data, http_message, &params) == -1) {
loggers::get_instance().warning("http_layer::receive_data (0): Failed to decode data");
return;
}
} else {
_stream_buffer += data;
if (_codec.decode(_stream_buffer, http_message, &params) == -1) {
loggers::get_instance().warning("http_layer::receive_data (1): Failed to decode data");
return;
}
}
params::const_iterator it = params.find("missing_data");
if (it != params.cend()) {
// Store data and wait for the next stream
loggers::get_instance().warning("http_layer::receive_data: Missing data, save current stream");
_stream_buffer += data;
return; // Terminate here
} else {
// Reset stream buffer and continue
loggers::get_instance().log("http_layer::receive_data: Reset stream buffer");
_stream_buffer.clean_up();
}
if (_device_mode) {
OCTETSTRING os;
......
......@@ -34,6 +34,7 @@ class http_layer : public t_layer<LibItsHttp__TestSystem::HttpPort> {
params _params;
http_codec _codec;
bool _device_mode;
OCTETSTRING _stream_buffer;
public: //! \publicsection
/*!
......
......@@ -24,18 +24,22 @@ int json_codec::encode (const LibItsHttp__JsonMessageBodyTypes::JsonBody& msg, O
const LocationAPI__TypesAndValues::UserTrackingSubscription& user_tracking_subscription = msg.userTrackingSubscription();
user_tracking_subscription.encode(LocationAPI__TypesAndValues::UserTrackingSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = char2oct(CHARSTRING("{\"userTrackingSubscription\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}"));
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_periodicNotificationSubscription)) {
const LocationAPI__TypesAndValues::PeriodicNotificationSubscription& periodic_notification_subscription = msg.periodicNotificationSubscription();
periodic_notification_subscription.encode(LocationAPI__TypesAndValues::PeriodicNotificationSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = char2oct(CHARSTRING("{\"periodicNotificationSubscription\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}"));
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_zonalTrafficSubscription)) {
const LocationAPI__TypesAndValues::ZonalTrafficSubscription& zonal_traffic_subscription = msg.zonalTrafficSubscription();
zonal_traffic_subscription.encode(LocationAPI__TypesAndValues::ZonalTrafficSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"zonalTrafficSubscription\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
data = char2oct(CHARSTRING("{\"zonalTrafficSubscription\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}"));
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_circleNotificationSubscription)) {
const LocationAPI__TypesAndValues::CircleNotificationSubscription& notif = msg.circleNotificationSubscription();
notif.encode(LocationAPI__TypesAndValues::CircleNotificationSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"circleNotificationSubscription\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
data = char2oct(CHARSTRING("{\"circleNotificationSubscription\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}"));
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_distanceNotificationSubscription)) {
const LocationAPI__TypesAndValues::DistanceNotificationSubscription& notif = msg.distanceNotificationSubscription();
notif.encode(LocationAPI__TypesAndValues::DistanceNotificationSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"distanceNotificationSubscription\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
data = char2oct(CHARSTRING("{\"distanceNotificationSubscription\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}"));
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_cellChangeSubscription)) {
const RnisAPI__TypesAndValues::CellChangeSubscription& cell_change_subscription = msg.cellChangeSubscription();
cell_change_subscription.encode(RnisAPI__TypesAndValues::CellChangeSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
......@@ -135,7 +139,10 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
user_list.decode(LocationAPI__TypesAndValues::UserList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.userList() = user_list;
} else if (it->second.find("\"accessPointList\"") != std::string::npos) { // Be careful to the order
// TODO To be refined, find("\"accessPointList\"") is not optimal
int idx_begin = it->second.find(":");
int idx_end = it->second.rfind("}") - 1; // Remove the last '}'
str = it->second.substr(idx_begin + 1, idx_end - idx_begin);
TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
LocationAPI__TypesAndValues::AccessPointList access_point_list;
access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.accessPointList() = access_point_list;
......@@ -147,6 +154,35 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
LocationAPI__TypesAndValues::UserTrackingSubscription user_tracking_subscription;
user_tracking_subscription.decode(LocationAPI__TypesAndValues::UserTrackingSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.userTrackingSubscription() = user_tracking_subscription;
} else if (it->second.find("\"periodicNotificationSubscription\"") != std::string::npos) {
int idx_begin = it->second.find(":");
int idx_end = it->second.rfind("}") - 1; // Remove the last '}'
str = it->second.substr(idx_begin + 1, idx_end - idx_begin);
TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
LocationAPI__TypesAndValues::PeriodicNotificationSubscription periodic_notification_subscription;
periodic_notification_subscription.decode(LocationAPI__TypesAndValues::PeriodicNotificationSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.periodicNotificationSubscription() = periodic_notification_subscription;
} else if (it->second.find("\"zonalTrafficSubscription\"") != std::string::npos) {
int idx_begin = it->second.find(":");
int idx_end = it->second.rfind("}") - 1; // Remove the last '}'
str = it->second.substr(idx_begin + 1, idx_end - idx_begin);
TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
LocationAPI__TypesAndValues::ZonalTrafficSubscription zonal_traffic_subscription;
zonal_traffic_subscription.decode(LocationAPI__TypesAndValues::ZonalTrafficSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.zonalTrafficSubscription() = zonal_traffic_subscription;
} else if (it->second.find("\"periodicTrackingSubscription\"") != std::string::npos) {
int idx_begin = it->second.find(":");
int idx_end = it->second.rfind("}") - 1; // Remove the last '}'
......@@ -168,10 +204,18 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
terminal_distance.decode(LocationAPI__TypesAndValues::TerminalDistance_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.terminalDistance() = terminal_distance;
} else if (it->second.find("\"enteringLeavingCriteria\"") != std::string::npos) {
int idx_begin = it->second.find(":");
int idx_end = it->second.rfind("}") - 1; // Remove the last '}'
str = it->second.substr(idx_begin + 1, idx_end - idx_begin);
TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
LocationAPI__TypesAndValues::CircleNotificationSubscription notif;
notif.decode(LocationAPI__TypesAndValues::CircleNotificationSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.circleNotificationSubscription() = notif;
} else if (it->second.find("\"distanceNotificationSubscription\"") != std::string::npos) {
int idx_begin = it->second.find(":");
int idx_end = it->second.rfind("}") - 1; // Remove the last '}'
str = it->second.substr(idx_begin + 1, idx_end - idx_begin);
TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
LocationAPI__TypesAndValues::DistanceNotificationSubscription notif;
notif.decode(LocationAPI__TypesAndValues::DistanceNotificationSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.distanceNotificationSubscription() = notif;
......
......@@ -90,17 +90,20 @@ tcp_layer::tcp_layer(const std::string & p_type, const std::string & param) : la
}
}
// Set trusted CA file
it = _params.find(params::mutual_auth);
/*it = _params.find(params::mutual_auth);
if (it == _params.cend()) {
parameter_set(ssl_trustedCAlist_file_name(), it->second.c_str());
_params.insert(std::pair<std::string, std::string>(std::string("mutual_tls"), it->second));
} else {
parameter_set(ssl_trustedCAlist_file_name(), "/usr/share/ca-certificates/mozilla/Amazon_Root_CA_1.crt");
}
}*/
// Set additional certificates
//parameter_set(ssl_trustedCAlist_file_name(), "../certificates/out/certs/CA_dsa.cert.pem"); // FIXME Use a parameter
//parameter_set(ssl_private_key_file_name(), "../certificates/out/privates/e5e11abad8003766e4a7b721afb175a189b5f4cc7046af9b0d8eaebb86f28c40_server_dsa.key.pem");
//parameter_set(ssl_certificate_file_name(), "../certificates/out/certs/e5e11abad8003766e4a7b721afb175a189b5f4cc7046af9b0d8eaebb86f28c40_server_dsa.cert.pem");
parameter_set(ssl_trustedCAlist_file_name(), "../certificates/out/certs/CA_rsa.cert.pem"); // FIXME Use a parameter
parameter_set(ssl_private_key_file_name(), "../certificates/out/privates/96ea9868b49aebca76608fa2579e9c4884c14cc2c867d34423a4841e2225342d_server_rsa.key.pem");
parameter_set(ssl_certificate_file_name(), "../certificates/out/certs/96ea9868b49aebca76608fa2579e9c4884c14cc2c867d34423a4841e2225342d_server_rsa.cert.pem");
} else {
parameter_set(ssl_trustedCAlist_file_name(), "../certificates/out/certs/CA_rsa.cert.pem"); // FIXME Use a parameter
parameter_set(ssl_certificate_file_name(), "../certificates/out/certs/96ea9868b49aebca76608fa2579e9c4884c14cc2c867d34423a4841e2225342d_client_rsa.cert.pem");
}
set_ttcn_buffer_usercontrol(false);
set_handle_half_close(true);
......
......@@ -14,11 +14,9 @@ LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json"
LibItsHttp_Pics.PICS_USE_TOKEN_HEADER := true
#LibItsHttp_Pics.PICS_TOKEN_HEADER := "Basic WrongToken"
LibMec_Pics.PICS_ROOT_API := "/sbx02yz7fl" # Need to sign in on https://try-mec.etsi.org/, section 'Try-it from your MEC application'
LibMec_Pics.PICS_ROOT_API := "/sbxb638qtq/mep1" # Need to sign in on https://try-mec.etsi.org/, section 'Try-it from your MEC application'
# LibMec_Pixits
LibMec_Pixits.PX_ME_APP_Q_ZONE_ID_URI := "/location/v2/queries/zones"
LibMec_Pixits.PX_ME_APP_Q_USERS_LIST_URI := "/location/v2/queries/users"
LibMec_Pixits.PX_RNIS_SUBSCRITIONS_URI := "/rni/v2/subscriptions"
LibMec_Pixits.PX_RNIS_QUERIES_URI := "/rni/v2/queries"
LibMec_Pixits.PX_MEC_SVC_MGMT_APPS_URI := "/mec_service_mgmt/v2/applications"
......@@ -57,12 +55,17 @@ RnisAPI_Pixits.PX_QCI := 0
# Mec-013 LocationAPI
LocationAPI_Pics.PICS_LOCATION_API_SUPPORTED := true
LocationAPI_Pixits.PX_ZONE_ID := "zone02"
LocationAPI_Pixits.PX_ACCESS_POINT_ID := "4g-macro-cell-4"
LocationAPI_Pixits.PX_USER := "10.100.0.1"
LocationAPI_Pixits.PX_ZONE_ID := "zone01"
LocationAPI_Pixits.PX_ACCESS_POINT_ID := "4g-macro-cell-2"
LocationAPI_Pixits.PX_USER := "4005C0A640001"
LocationAPI_Pixits.PX_IP_ADDRESS := "10.100.0.1"
LocationAPI_Pixits.PX_CLIENT_ID := "0123"
LocationAPI_Pixits.PX_SUBSCRIPTION_ID := "subscription0123"
LocationAPI_Pixits.PX_CALLBACK_REF_URL := { notifyURL := "https://yanngarcia.ddns.net/location/v2/notif/1", callbackData := omit, notificationFormat := omit };
LocationAPI_Pixits.PX_SUBSCRIPTION_ID := "1"
LocationAPI_Pixits.PX_CALLBACK_REF_URL := { notifyURL := "https://yanngarcia.ddns.net/location/v2/notif/1", callbackData := omit, notificationFormat := omit }
LocationAPI_Pixits.PX_AREA_SUB_CALLBACK_URI := { notifyURL := "https://yanngarcia.ddns.net/location/v2/notif/1", callbackData := omit, notificationFormat := omit }
LocationAPI_Pixits.PX_UE_DIST_SUB_CALLBACK_URI := { notifyURL := "https://yanngarcia.ddns.net/location/v2/notif/1", callbackData := omit, notificationFormat := omit }
LocationAPI_Pixits.PX_UE_COORD_LAT := 43.729538
LocationAPI_Pixits.PX_UE_COORD_LONG := 7.413819
UEidentityAPI_Pics.PICS_UE_IDENTITY_API_SUPPORTED := false
......@@ -217,32 +220,54 @@ system.httpPort_notif.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UELOCSUB_002_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UELOCSUB_002_NF
# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UETRACKSUB_001_OK
# Check that the IUT acknowledges the UE location change subscription request when commanded by a MEC Application and notifies it when the UE changes location
AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UETRACKSUB_001_OK
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UETRACKSUB_001_BR
# Check that the IUT acknowledges the cancellation of UE location change notifications when commanded by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UETRACKSUB_002_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UETRACKSUB_002_NF
# Check that the IUT responds with the information pertaining to one or more UEs in a particular location when queried by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UEINFLOOK_001_OK
# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UEINFLOOK_001_BR
# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UEINFLOOK_001_NF
# Check that the IUT acknowledges the UE information change subscription request when commanded by a MEC Application and notifies it when the location changes
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UEINFSUB_001_OK
# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UEINFSUB_001_BR
# Check that the IUT acknowledges the cancellation of UE information change notifications when commanded by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UEINFSUB_002_OK
# Check that the IUT acknowledges the cancellation of UE information change notifications when commanded by a MEC Application
#AtsMec_LocationAPI_TestCases.TC_MEC_MEC013_SRV_UEINFSUB_002_NF
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_SRV_RLOCLOOK_001_OK
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_SRV_RLOCLOOK_001_NF
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_SRV_UEAREASUB_001_OK
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_SRV_UEAREASUB_001_BR
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_SRV_UEAREASUB_002_OK
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_SRV_UEAREASUB_002_NF
# heck that the IUT responds with the list of radio nodes currently associated with the MEC host and the location of each radio node when queried by a MEC Application
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_RLOCLOOK_001_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_RLOCLOOK_001_NF
# Check that the IUT acknowledges the UE area change subscription request when commanded by a MEC Application and notifies it when the UE enters the specified circle
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEAREASUB_001_OK
# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEAREASUB_001_BR
# Check that the IUT acknowledges the cancellation of UE area change notifications when commanded by a MEC Application
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEAREASUB_002_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEAREASUB_002_NF
# Check that the IUT responds with the distance to a UE when queried by a MEC Application
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEDISTLOOK_001_OK
# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEDISTLOOK_001_BR
# Check that the IUT acknowledges the UE distance subscription request when commanded by a MEC Application and notifies it when (all) the requested UE(s) is (are) within the specified distance
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEDISTSUB_001_OK
# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEDISTSUB_001_BR
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEDISTSUB_002_OK
#AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEDISTSUB_002_NF
# Check that the IUT acknowledges the cancellation of UE distance notifications when commanded by a MEC Application
AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEDISTSUB_002_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
AtsMec_RadioNodeLocationAPI_TestCases.TC_MEC_MEC013_SRV_UEDISTSUB_002_NF
# ETSI GS MEC 014
#AtsMec_UEidentityAPI_TestCases.TC_MEC_MEC014_SRV_UETAG_001_OK
#AtsMec_UEidentityAPI_TestCases.TC_MEC_MEC014_SRV_UETAG_001_BR
#AtsMec_UEidentityAPI_TestCases.TC_MEC_MEC014_SRV_UETAG_001_NF
......
......@@ -311,7 +311,7 @@ module AtsMec_LocationAPI_TestCases {
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ROOT_API & PX_ME_APP_Q_USERS_LOC_SUB_URI,
PICS_ROOT_API & PX_ME_APP_Q_USERS_LOC_SUB_URI & "_Invalid",
v_headers,
m_http_message_body_json(
m_body_json_user_tracking_subscription(
......@@ -475,9 +475,8 @@ module AtsMec_LocationAPI_TestCases {
*/
testcase TC_MEC_MEC013_SRV_UETRACKSUB_001_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var UserTrackingSubscription v_user_tracking_subscription;
var charstring v_uri;
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
......@@ -492,21 +491,20 @@ module AtsMec_LocationAPI_TestCases {
// Test adapter configuration
// Preamble
f_create_user_tracking_subscription(v_user_tracking_subscription);
v_uri := regexp(
oct2char(unichar2oct(v_user_tracking_subscription.resourceURL)),
"?+" & PX_ME_APP_Q_USERS_LOC_SUB_URI & "/(?*)",
0
);
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ROOT_API & PX_ME_APP_Q_USERS_TRACK_SUB_URI & "/" & v_uri,
v_headers
)
)
);
PICS_ROOT_API & PX_ME_APP_Q_USERS_TRACK_SUB_URI,
v_headers,
m_http_message_body_json(
m_body_json_periodic_notification_subscription(
m_periodic_notification_subscription(
{ PX_IP_ADDRESS },
PX_CALLBACK_REF_URL,
-, -,
PX_USER
))))));
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
......@@ -516,12 +514,14 @@ module AtsMec_LocationAPI_TestCases {
mw_http_response(
mw_http_response_201_created(
mw_http_message_body_json(
mw_body_json_periodic_tracking_subscription(
mw_periodic_tracking_subscription(
PX_CLIENT_ID,
PX_CALLBACK_REF_URL,
PX_USER
)))))) {
mw_body_json_periodic_notification_subscription(
mw_periodic_notification_subscription(
{ PX_IP_ADDRESS },
PX_CALLBACK_REF_URL,
-, -,
PX_USER,
?
)))))) -> value v_response {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a callbackURL ***");
......@@ -534,12 +534,12 @@ module AtsMec_LocationAPI_TestCases {
} // End of 'alt' statement
// Postamble
f_delete_user_tracking_subscription(v_user_tracking_subscription);
f_delete_periodic_notification_subscription(v_response.response.body.json_body.periodicNotificationSubscription);
f_cf_01_http_down();
} // End of testcase TC_MEC_MEC013_SRV_UETRACKSUB_001_OK
/**
* @desc Check that the IUT acknowledges the UE location change subscription request when commanded by a MEC Application and notifies it when the UE changes location
* @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/remove-401s/Test%20Purposes/SRV/UETRACKSUB/PlatUeTrackingSubscription.tplan2
*/
testcase TC_MEC_MEC013_SRV_UETRACKSUB_001_BR() runs on HttpComponent system HttpTestAdapter {
......@@ -563,7 +563,7 @@ module AtsMec_LocationAPI_TestCases {
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ROOT_API & PX_ME_APP_Q_USERS_TRACK_SUB_URI,
PICS_ROOT_API & PX_ME_APP_Q_USERS_TRACK_SUB_URI & "_Invalid",
v_headers,
m_http_message_body_json(
m_body_json_user_tracking_subscription(
......@@ -602,12 +602,14 @@ module AtsMec_LocationAPI_TestCases {
} // End of testcase TC_MEC_MEC013_SRV_UETRACKSUB_001_BR
/**
* @desc Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
* @desc Check that the IUT acknowledges the cancellation of UE location change notifications when commanded by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/remove-401s/Test%20Purposes/SRV/UETRACKSUB/PlatUeTrackingSubscription.tplan2
*/
testcase TC_MEC_MEC013_SRV_UETRACKSUB_002_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var PeriodicNotificationSubscription v_position_notification_subscription;
var charstring v_uri;
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
......@@ -622,11 +624,17 @@ module AtsMec_LocationAPI_TestCases {
// Test adapter configuration
// Preamble
f_create_periodic_notification_subscription(v_position_notification_subscription);
v_uri := regexp(
oct2char(unichar2oct(v_position_notification_subscription.resourceURL)),
"?+" & PX_ME_APP_Q_USERS_TRACK_SUB_URI & "/(?*)",
0
);
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_delete(
PICS_ROOT_API & PX_ME_APP_Q_USERS_TRACK_SUB_URI & "/" & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
PICS_ROOT_API & PX_ME_APP_Q_USERS_TRACK_SUB_URI & "/" & v_uri,
v_headers
)
)
......@@ -692,11 +700,11 @@ module AtsMec_LocationAPI_TestCases {
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_400_bad_request
mw_http_response_404_not_found
)) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds 400 Bad Request ***");
log("*** " & testcasename() & ": PASS: IUT successfully responds 404 Not Found ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
}
[] tc_ac.timeout {
......@@ -876,7 +884,7 @@ module AtsMec_LocationAPI_TestCases {
// Postamble
f_cf_01_http_down();
} // End of testcase TC_MEC_MEC013_SRV_UEINFLOOK_001_NF
} // End of testcase TC_MEC_MEC013_SRV_UEINFLOOK_001_OK_001_NF
} // End of group ueInfLook
......@@ -889,6 +897,7 @@ module AtsMec_LocationAPI_TestCases {
testcase TC_MEC_MEC013_SRV_UEINFSUB_001_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
......@@ -935,7 +944,7 @@ module AtsMec_LocationAPI_TestCases {
PX_CLIENT_ID,
PX_CALLBACK_REF_URL,
PX_ZONE_ID
)))))) {
)))))) -> value v_response {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a callbackURL ***");
......@@ -948,6 +957,7 @@ module AtsMec_LocationAPI_TestCases {
} // End of 'alt' statement
// Postamble
f_delete_zonal_traffic_subscription(v_response.response.body.json_body.zonalTrafficSubscription);
f_cf_01_http_down();
} // End of testcase TC_MEC_MEC013_SRV_UEINFSUB_001_OK
......@@ -1009,7 +1019,6 @@ module AtsMec_LocationAPI_TestCases {
f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_cf_01_http_down();
} // End of testcase TC_MEC_MEC013_SRV_UEINFSUB_001_BR
......@@ -1021,6 +1030,8 @@ module AtsMec_LocationAPI_TestCases {
testcase TC_MEC_MEC013_SRV_UEINFSUB_002_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var ZonalTrafficSubscription v_zonal_traffic_subscription;
var charstring v_uri;
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
......@@ -1035,24 +1046,19 @@ module AtsMec_LocationAPI_TestCases {
// Test adapter configuration
// Preamble
f_create_zonal_traffic_subscription(v_zonal_traffic_subscription);
v_uri := regexp(
oct2char(unichar2oct(v_zonal_traffic_subscription.resourceURL)),
"?+" & PX_ME_APP_Q_USERS_INF_SUB_URI & "/(?*)",
0
);
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_delete(
PICS_ROOT_API & PX_ME_APP_Q_USERS_INF_SUB_URI,
v_headers,
m_http_message_body_json(
m_body_json_zonal_traffic_subscription(
m_zonal_traffic_subscription(
PX_CLIENT_ID,
PX_CALLBACK_REF_URL,
PX_ZONE_ID
)
)
)
)
)
);
PICS_ROOT_API & PX_ME_APP_Q_USERS_INF_SUB_URI & "/" & v_uri,
v_headers
)));
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
......@@ -1133,8 +1139,4 @@ module AtsMec_LocationAPI_TestCases {
} // End of group ueInfSub
group ueDistSub {
} // End of group ueDistSub
} // End of module AtsMec_LocationAPI_TestCases
......@@ -51,7 +51,7 @@ module LocationAPI_Pixits {
modulepar Address PX_UE_ZONAL_TRAF_SUB_URI := "";
modulepar JSON.AnyURI PX_UE_LOC_QRY_URI := "/location/v2/queries";
modulepar JSON.AnyURI PX_UE_LOC_QRY_URI := "/location/v2/queries/distance";
modulepar JSON.Number PX_UE_COORD_LAT := -80.86302;
......
......@@ -213,13 +213,14 @@ module LocationAPI_Templates {
template (value) ZonalTrafficSubscription m_zonal_traffic_subscription(
in ClientCorrelator p_client_correlator,
in CallbackReference p_callback_reference,
in ZoneId p_zone_id
in ZoneId p_zone_id,
in UserEventCriteria p_user_event_criteria := { Entering }
) := {
clientCorrelator := p_client_correlator,
callbackReference := p_callback_reference,
zoneId := p_zone_id,
interestRealm := omit,
userEventCriteria := omit,
userEventCriteria := p_user_event_criteria,
duration := omit,
resourceURL := omit
} // End of template m_zonal_traffic_subscription
......@@ -244,11 +245,11 @@ module LocationAPI_Templates {
in template (value) Addresses p_address,
in template (value) JSON.Number p_latitude := PX_UE_COORD_LAT,
in template (value) JSON.Number p_longitude := PX_UE_COORD_LONG,
in template (value) JSON.Number p_radius := 10.0,
in template (value) JSON.Number p_radius := 200.0,
in template (value) JSON.Number p_trackingAccuracy := 10.0,
in template (value) EnteringLeavingCriteria p_enteringLeavingCriteria := Entering,
in template (value) JSON.Bool p_checkImmediate := true,
in template (value) JSON.Number p_frequency := 10.0,
in template (value) UInt32 p_frequency := 10,
in template (omit) ResourceURL p_resourceURL := omit
) := {
address_ := p_address,
......@@ -278,7 +279,7 @@ module LocationAPI_Templates {
template (present) JSON.Number p_trackingAccuracy := ?,
template (present) EnteringLeavingCriteria p_enteringLeavingCriteria := ?,
template (present) JSON.Bool p_checkImmediate := ?,
template (present) JSON.Number p_frequency := ?, </