Commit d4d66f28 authored by YannGarcia's avatar YannGarcia
Browse files

Add support of userTracking

parent 1cdc329a
...@@ -20,6 +20,10 @@ int json_codec::encode (const LibItsHttp__JsonMessageBodyTypes::JsonBody& msg, O ...@@ -20,6 +20,10 @@ int json_codec::encode (const LibItsHttp__JsonMessageBodyTypes::JsonBody& msg, O
const UEidentityAPI__TypesAndValues::UeIdentityTagInfo& ue_identity_tag_info = msg.ueIdentityTagInfo(); const UEidentityAPI__TypesAndValues::UeIdentityTagInfo& ue_identity_tag_info = msg.ueIdentityTagInfo();
ue_identity_tag_info.encode(UEidentityAPI__TypesAndValues::UeIdentityTagInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); ue_identity_tag_info.encode(UEidentityAPI__TypesAndValues::UeIdentityTagInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
} else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_userTrackingSubscription)) {
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 { } else {
loggers::get_instance().error("json_codec::encode: Not supported"); loggers::get_instance().error("json_codec::encode: Not supported");
} }
...@@ -64,11 +68,15 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy ...@@ -64,11 +68,15 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
LocationAPI__TypesAndValues::AccessPointList access_point_list; LocationAPI__TypesAndValues::AccessPointList access_point_list;
access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.accessPointList() = access_point_list; msg.accessPointList() = access_point_list;
} else if (it->second.find("\"SubscriptionLinkList\"") != std::string::npos) { // Be carefull to the order } else if (it->second.find("\"SubscriptionLinkList\"") != std::string::npos) { // Be carefull to the order
// TODO To be refined, find("\"accessPointList\"") is not optimal // TODO To be refined, find("\"accessPointList\"") is not optimal
RnisAPI__TypesAndValues::SubscriptionLinkList subscription_link_list; RnisAPI__TypesAndValues::SubscriptionLinkList subscription_link_list;
subscription_link_list.decode(RnisAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); subscription_link_list.decode(RnisAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.subscriptionLinkList() = subscription_link_list; msg.subscriptionLinkList() = subscription_link_list;
} else if (it->second.find("\"userTrackingSubscription\"") != std::string::npos) {
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("\"userInfo\"") != std::string::npos) { } else if (it->second.find("\"userInfo\"") != std::string::npos) {
LocationAPI__TypesAndValues::UserInfo user_info; LocationAPI__TypesAndValues::UserInfo user_info;
user_info.decode(LocationAPI__TypesAndValues::UserInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); user_info.decode(LocationAPI__TypesAndValues::UserInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
......
...@@ -19,7 +19,7 @@ LocationAPI_Pics.PICS_LOCATION_API_SUPPORTED := true ...@@ -19,7 +19,7 @@ LocationAPI_Pics.PICS_LOCATION_API_SUPPORTED := true
UEidentityAPI_Pics.PICS_UE_IDENTITY_API_SUPPORTED := true UEidentityAPI_Pics.PICS_UE_IDENTITY_API_SUPPORTED := true
BwManagementAPI_Pics.PICS_BWMANAGEMENT_API_SUPPORTED := false BwManagementAPI_Pics.PICS_BWMANAGEMENT_API_SUPPORTED := true
[LOGGING] [LOGGING]
# In this section you can specify the name of the log file and the classes of events # In this section you can specify the name of the log file and the classes of events
......
...@@ -34,14 +34,14 @@ module AtsMec_LocationAPI_TestCases { ...@@ -34,14 +34,14 @@ module AtsMec_LocationAPI_TestCases {
import from LibMec_Pics all; import from LibMec_Pics all;
import from LibMec_Pixits all; import from LibMec_Pixits all;
group me_app_role { group location {
/** /**
* @desc Check that the IUT responds with a list for the location of User Equipments when queried by a MEC Application * @desc Check that the IUT responds with a list for the location of User Equipments when queried by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeLocation/PlatUeLocation.tplan2 * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeLocation/PlatUeLocation.tplan2
* @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml * @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/UserInfo
*/ */
testcase TC_MEC_PLAT_MP1_LOC_BV_001() runs on HttpComponent system HttpTestAdapter { testcase TC_MEC_PLAT_LOC_001_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables // Local variables
var HeaderLines v_headers; var HeaderLines v_headers;
var HttpMessage v_response; var HttpMessage v_response;
...@@ -96,8 +96,134 @@ module AtsMec_LocationAPI_TestCases { ...@@ -96,8 +96,134 @@ module AtsMec_LocationAPI_TestCases {
// Postamble // Postamble
f_cf_01_http_down(); f_cf_01_http_down();
} // End of testcase TC_MEC_PLAT_MP1_LOC_BV_001 } // End of testcase TC_MEC_PLAT_LOC_001_OK
} // End of group me_app_role } // End of group location
group subscription {
/**
* @desc Check that the IUT acknowledges the UE location change subscription request when commanded by a MEC Application and notifies it when the location changes
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeLocation/PlatUeLocation.tplan2
* @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/UserTrackingSubscription
*/
testcase TC_MEC_PLAT_LOCSUB_001_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var HeaderLines v_headers;
var HttpMessage v_response;
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Test adapter configuration
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PX_ME_APP_Q_USERS_SUB_URI,
v_headers,
m_http_message_body_json(
m_body_json_user_tracking_subscription(
m_user_tracking_subscription(
PX_CLIENT_ID,
PX_CALLBACK_REF_URL,
PX_USER
)
)
)
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_201_created(
mw_http_message_body_json(
mw_body_json_user_tracking_subscription(
mw_user_tracking_subscription_response(
PX_CLIENT_ID,
PX_CALLBACK_REF_URL,
PX_USER
)))))) -> value v_response {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ressourceURL ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_cf_01_http_down();
} // End of testcase TC_MEC_PLAT_LOCSUB_001_OK
/**
* @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/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeLocation/PlatUeLocation.tplan2
*/
testcase TC_MEC_PLAT_LOCSUB_002_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var HeaderLines v_headers;
var HttpMessage v_response;
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Test adapter configuration
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_get(
PX_ME_APP_Q_USERS_SUB_URI & "/" & PX_SUBSCRIPTION_ID, // TODO Shall be extract from Subscription request
v_headers
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok
)) -> value v_response {
log("*** " & testcasename() & ": PASS: IUT successfully cancel subscription ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_cf_01_http_down();
} // End of testcase TC_MEC_PLAT_LOCSUB_002_OK
} // End of group subscription
} // End of module AtsMec_LocationAPI_TestCases } // End of module AtsMec_LocationAPI_TestCases
...@@ -41,7 +41,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { ...@@ -41,7 +41,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/RadioNode/PlatRadioNodeLocation.tplan2 * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/RadioNode/PlatRadioNodeLocation.tplan2
* @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/AccessPointList * @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/AccessPointList
*/ */
testcase TC_MEC_PLAT_MP1_RLOC_BV_001() runs on HttpComponent system HttpTestAdapter { testcase TC_MEC_PLAT_RLOC_001_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables // Local variables
var HeaderLines v_headers; var HeaderLines v_headers;
var HttpMessage v_response; var HttpMessage v_response;
...@@ -92,7 +92,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases { ...@@ -92,7 +92,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
// Postamble // Postamble
f_cf_01_http_down(); f_cf_01_http_down();
} // End of testcase TC_MEC_PLAT_MP1_RLOC_BV_001 } // End of testcase TC_MEC_PLAT_RLOC_001_OK
} // End of group me_app_role } // End of group me_app_role
......
...@@ -24,7 +24,11 @@ module AtsMec_TestControl { ...@@ -24,7 +24,11 @@ module AtsMec_TestControl {
if (PICS_MEC_PLAT) { if (PICS_MEC_PLAT) {
if (PICS_LOCATION_API_SUPPORTED) { if (PICS_LOCATION_API_SUPPORTED) {
execute(TC_MEC_PLAT_MP1_LOC_BV_001()); execute(TC_MEC_PLAT_LOC_001_OK());
execute(TC_MEC_PLAT_INFLOOK_001_OK());
execute(TC_MEC_PLAT_LOCSUB_001_OK());
execute(TC_MEC_PLAT_LOCSUB_002_OK());
execute(TC_MEC_PLAT_RLOC_001_OK());
} }
if (PICS_UE_IDENTITY_API_SUPPORTED) { if (PICS_UE_IDENTITY_API_SUPPORTED) {
execute(TC_MEC_PLAT_UETAG_001_OK()); execute(TC_MEC_PLAT_UETAG_001_OK());
...@@ -35,12 +39,6 @@ module AtsMec_TestControl { ...@@ -35,12 +39,6 @@ module AtsMec_TestControl {
execute(TP_MEC_PLAT_UETAG_003_BI()); execute(TP_MEC_PLAT_UETAG_003_BI());
execute(TP_MEC_PLAT_UETAG_004_BI()); execute(TP_MEC_PLAT_UETAG_004_BI());
} }
if (PICS_LOCATION_API_SUPPORTED) {
execute(TC_MEC_PLAT_INFLOOK_001_OK());
}
if (PICS_LOCATION_API_SUPPORTED) {
execute(TC_MEC_PLAT_MP1_RLOC_BV_001());
}
} }
if (PICS_RNIS) { if (PICS_RNIS) {
......
LibCommon @ 8f0b6280
Subproject commit 8f0b6280029f2b786f289ee6cf671553a4806b17
LibIts @ 903d7d1c
Subproject commit 903d7d1c3b8273c13bddb07568a4c038072e2b94
...@@ -8,6 +8,10 @@ module LocationAPI_Pixits { ...@@ -8,6 +8,10 @@ module LocationAPI_Pixits {
modulepar Address PX_USER := "acr:192.0.0.1"; modulepar Address PX_USER := "acr:192.0.0.1";
modulepar ClientCorrelator PX_CLIENT_ID := "0123";
modulepar charstring PX_SUBSCRIPTION_ID := "subscription0123";
modulepar AccessPointId PX_ACCESS_POINT_ID := "001010000000000000000000000000001"; modulepar AccessPointId PX_ACCESS_POINT_ID := "001010000000000000000000000000001";
modulepar ZoneId PX_ZONE_ID := "zone01"; modulepar ZoneId PX_ZONE_ID := "zone01";
...@@ -22,4 +26,6 @@ module LocationAPI_Pixits { ...@@ -22,4 +26,6 @@ module LocationAPI_Pixits {
modulepar UInt32 PX_NB_USERS := 10; modulepar UInt32 PX_NB_USERS := 10;
modulepar CallbackReference PX_CALLBACK_REF_URL := { "http://clientApp.example.com/location_notifications/123456" };
} // End of module LocationAPI_Pixits } // End of module LocationAPI_Pixits
...@@ -126,4 +126,31 @@ module LocationAPI_Templates { ...@@ -126,4 +126,31 @@ module LocationAPI_Templates {
resourceURL := p_resourceURL resourceURL := p_resourceURL
} // End of template mw_access_point_list } // End of template mw_access_point_list
template (value) UserTrackingSubscription m_user_tracking_subscription(
in ClientCorrelator p_clientCorrelator,
in CallbackReference p_callbackReference,
in Address p_address := PX_USER,
in UserEventCriteria p_userEventCriteria := { Transferring }
) := {
clientCorrelator := p_clientCorrelator,
callbackReference := p_callbackReference,
address_ := p_address,
userEventCriteria := p_userEventCriteria,
resourceURL := omit
} // End of template m_user_tracking_subscription
template (present) UserTrackingSubscription mw_user_tracking_subscription_response(
template (present) ClientCorrelator p_clientCorrelator := ?,
template (present) CallbackReference p_callbackReference := ?,
template (present) Address p_address := PX_USER,
template (present) UserEventCriteria p_userEventCriteria := { Transferring },
template (present) ResourceURL p_resourceURL := ?
) := {
clientCorrelator := p_clientCorrelator,
callbackReference := p_callbackReference,
address_ := p_address,
userEventCriteria := p_userEventCriteria,
resourceURL := p_resourceURL
} // End of template mw_user_tracking_subscription
} // End of module LocationAPI_Templates } // End of module LocationAPI_Templates
...@@ -6,6 +6,8 @@ module LibMec_Pixits { ...@@ -6,6 +6,8 @@ module LibMec_Pixits {
modulepar charstring PX_ME_APP_Q_DIST_URI := "/exampleAPI/location/v2/subscriptions/distance"; modulepar charstring PX_ME_APP_Q_DIST_URI := "/exampleAPI/location/v2/subscriptions/distance";
modulepar charstring PX_ME_APP_Q_USERS_SUB_URI := "/exampleAPI/location/v2/subscriptions/userTracking";
modulepar charstring PX_ME_APP_Q_UE_IDENTITY_ID_URI := "/exampleAPI/ui/v2/"; modulepar charstring PX_ME_APP_Q_UE_IDENTITY_ID_URI := "/exampleAPI/ui/v2/";
modulepar charstring PX_RNIS_SUBSCRITIONS_URI := "/exampleAPI/rni/v2/subscriptions/"; modulepar charstring PX_RNIS_SUBSCRITIONS_URI := "/exampleAPI/rni/v2/subscriptions/";
......
...@@ -21,6 +21,7 @@ module LibItsHttp_JsonMessageBodyTypes { ...@@ -21,6 +21,7 @@ module LibItsHttp_JsonMessageBodyTypes {
UserList userList, UserList userList,
ZoneInfo zoneInfo, ZoneInfo zoneInfo,
AccessPointList accessPointList, AccessPointList accessPointList,
UserTrackingSubscription userTrackingSubscription,
UEidentityAPI_TypesAndValues.ProblemDetails problemDetails_ue_identity, UEidentityAPI_TypesAndValues.ProblemDetails problemDetails_ue_identity,
UeIdentityTagInfo ueIdentityTagInfo, UeIdentityTagInfo ueIdentityTagInfo,
SubscriptionLinkList subscriptionLinkList, SubscriptionLinkList subscriptionLinkList,
......
...@@ -91,6 +91,18 @@ module LibItsHttp_JsonTemplates { ...@@ -91,6 +91,18 @@ module LibItsHttp_JsonTemplates {
accessPointList := p_access_point_list accessPointList := p_access_point_list
} // End of template mw_body_json_access_point_list } // End of template mw_body_json_access_point_list
template (value) JsonBody m_body_json_user_tracking_subscription(
in template (value) UserTrackingSubscription p_user_tracking_subscription
) := {
userTrackingSubscription := p_user_tracking_subscription
} // End of template m_body_json_user_tracking_subscription
template (present) JsonBody mw_body_json_user_tracking_subscription(
template (present) UserTrackingSubscription p_user_tracking_subscription := ?
) := {
userTrackingSubscription := p_user_tracking_subscription
} // End of template mw_body_json_user_rtracking_subscription
} // End of group locarion_api } // End of group locarion_api
group ue_identity_api { group ue_identity_api {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment