diff --git a/ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn b/ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn index 4b325b345f279a91f47c41f7a2d924452d3b04db..519f7d42790c01365bdb1df1f9fdc1d4f146343d 100644 --- a/ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn @@ -31,125 +31,132 @@ import from LibMec_Functions all; import from LibMec_Pics all; import from LibMec_Pixits all; - -group appMobilityServices { - - testcase TP_MEC_SRV_AMS_001_OK() runs on HttpComponent system HttpTestAdapter { - var HeaderLines v_headers; - if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)){ - log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***"); - setverdict(inconc); - stop; - } - - // Test component configuration - f_cf_01_http_up(); - - - // Preamble - f_init_default_headers_list(-, -, v_headers); - httpPort.send( - m_http_request( - m_http_request_get( - "/" & PICS_ROOT_API & PX_ME_APP_AMS_URI, - v_headers - ) - ) - ); - f_selfOrClientSyncAndVerdict(c_prDone, e_success); - - // Test Body - tc_ac.start; - alt { - [] httpPort.receive( - mw_http_response( - mw_http_response_ok( - mw_http_message_body_json( - mw_body_json_app_mobility_service_info( - mw_app_mobility_service_info( - { - *, - mw_app_mobility_service_info(PX_APP_MOBILITY_SERVICE_ID) - } - ) - ) - ) - ) - ) - ) - { - tc_ac.stop; - - log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppMobilityServiceInfo ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_success); - } - [] tc_ac.timeout { - log("*** " & testcasename() & ": INCONC: Expected message not received ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + group appMobilityServices { + + testcase TP_MEC_SRV_AMS_001_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)){ + log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***"); + setverdict(inconc); + stop; } - } // End of 'alt' statement - - } - - - - - testcase TP_MEC_SRV_AMS_001_BR() runs on HttpComponent system HttpTestAdapter { - var HeaderLines v_headers; - if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)){ - log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***"); - setverdict(inconc); - stop; - } - - // Test component configuration - f_cf_01_http_up(); - - - // Preamble - f_init_default_headers_list(-, -, v_headers); - httpPort.send( - m_http_request( - m_http_request_get( - "/" & PICS_ROOT_API & PX_ME_APP_AMS_URI & "?appMobilityService=" & oct2char(unichar2oct(PX_APP_MOBILITY_SERVICE_ID, "UTF-8")), - v_headers - ) - ) - ); - f_selfOrClientSyncAndVerdict(c_prDone, e_success); - - // Test Body - tc_ac.start; - alt { - [] httpPort.receive( - mw_http_response( - mw_http_response_400_bad_request( - mw_http_message_body_json( - mw_body_json_ams_problem_details( - mw_problem_details( - { - -, -, 400 - } - ) - ) - ) - ) - ) - ) - { - tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 400 Bad Request ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_ME_APP_AMS_URI, + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_ok( + mw_http_message_body_json( + mw_body_json_app_mobility_service_info( + mw_app_mobility_service_info( + { + mw_app_mobility_registration_info( + mw_service_consumer_id( + PX_APP_INS_ID, + PX_MEP_ID + ) + ) + } + )))))) -> value v_response { + // TODO Need to check Location header + var boolean v_header_matched := false; + + tc_ac.stop; + + v_headers := v_response.response.header; + for (var integer v_idx := 0; v_idx < lengthof(v_headers); v_idx := v_idx + 1) { + if (v_headers[v_idx].header_name == "Location") { + if (match(v_headers[v_idx].header_value[0], "") == true) { + v_header_matched := true; + } // else, nothing to do + break; + } + } // End of 'for' statement + + if (v_header_matched == true) { + log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppTerminationNotificationSubscription ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } else { + log("*** " & testcasename() & ": FAIL: Header 'Location' was not present in the response headers ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + } // End of testcase TP_MEC_SRV_AMS_001_OK + + testcase TP_MEC_SRV_AMS_001_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)){ + log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***"); + setverdict(inconc); + stop; } - [] tc_ac.timeout { - log("*** " & testcasename() & ": INCONC: Expected message not received ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); - } - } // End of 'alt' statement - - } + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_ME_APP_AMS_URI & "?appMobilityService=" & oct2char(unichar2oct(PX_APP_MOBILITY_SERVICE_ID, "UTF-8")), + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + mw_http_message_body_json( + mw_body_json_ams_problem_details( + mw_problem_details( + -, + -, + 400 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 400 Bad Request ***"); + 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 + + } // End of testcase TP_MEC_SRV_AMS_001_BR + +/* testcase TP_MEC_SRV_AMS_002_OK() runs on HttpComponent system HttpTestAdapter { var HeaderLines v_headers; @@ -310,7 +317,7 @@ group appMobilityServicesSubscriptions { httpPort.send( m_http_request( m_http_request_get( - "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "?subscriptionType=" & oct2char(unichar2oct(PX_SUBSCRIPTION_TYPE, "UTF-8")), + "/" & PICS_ROOT_API & PX_ME_APP_AMS_SUBS & "?subscriptionType=" & oct2char(unichar2oct(PX_SUBSCRIPTION_TYPE, "UTF-8")), v_headers ) ) @@ -363,7 +370,7 @@ group appMobilityServicesSubscriptions { httpPort.send( m_http_request( m_http_request_get( - "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "?subscriptionTyp=" & oct2char(unichar2oct(PX_SUBSCRIPTION_TYPE, "UTF-8")), + "/" & PICS_ROOT_API & PX_ME_APP_AMS_SUBS & "?subscriptionTyp=" & oct2char(unichar2oct(PX_SUBSCRIPTION_TYPE, "UTF-8")), v_headers ) ) @@ -420,18 +427,15 @@ group appMobilityServicesSubscriptions { httpPort.send( m_http_request( m_http_request_post( - "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS, + "/" & PICS_ROOT_API & PX_ME_APP_AMS_SUBS, v_headers, m_http_message_body_json( - m_body_json_ams_subscriptions({ + m_body_json_ams_subscriptions({*, m_ams_subscription( PX_SUBSCRIPTION_TYPE, - PX_CALLBACK_REFERENCE, - *, - *, - * + PX_CALLBACK_REFERENCE ) - }) + }, *) ) ) ) @@ -446,13 +450,12 @@ group appMobilityServicesSubscriptions { mw_http_response_201_created( mw_http_message_body_json( mw_body_json_ams_subscriptions( - mw_ams_subscription( + { *, mw_ams_subscription( PX_SUBSCRIPTION_TYPE, - PX_CALLBACK_REFERENCE, - *, - *, - * - ) + PX_CALLBACK_REFERENCE + ), + * + } ) ) ) @@ -490,13 +493,12 @@ testcase TP_MEC_SRV_AMS_004_BR() runs on HttpComponent system HttpTestAdapter { httpPort.send( m_http_request( m_http_request_post( - "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS, + "/" & PICS_ROOT_API & PX_ME_APP_AMS_SUBS, v_headers, m_http_message_body_json( m_body_json_ams_subscriptions( - m_ams_subscription_error({ - PX_SUBSCRIPTION_TYPE, PX_CALLBACK_REFERENCE, *, *, * - } + m_ams_subscription_error( + PX_SUBSCRIPTION_TYPE, PX_CALLBACK_REFERENCE ) ) ) @@ -514,9 +516,7 @@ testcase TP_MEC_SRV_AMS_004_BR() runs on HttpComponent system HttpTestAdapter { mw_http_message_body_json( mw_body_json_ams_problem_details( mw_problem_details( - { -, -, 400 - } ) ) ) @@ -535,10 +535,9 @@ testcase TP_MEC_SRV_AMS_004_BR() runs on HttpComponent system HttpTestAdapter { } } // End of 'alt' statement - } - + }*/ -} + } // End of group appMobilityServices } // End of module AtsMec_Ams_TestCases diff --git a/ttcn/AtsMec/AtsMec_AppEnablementAPI_TestCases.ttcn b/ttcn/AtsMec/AtsMec_AppEnablementAPI_TestCases.ttcn index 1719b34c9d79935be550b61214c2cfbad91f02c5..0cd833d2b605d7b5e9f83a1292e085da89cb2762 100644 --- a/ttcn/AtsMec/AtsMec_AppEnablementAPI_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_AppEnablementAPI_TestCases.ttcn @@ -42,7 +42,7 @@ module AtsMec_AppEnablementAPI_TestCases { testcase TC_MEC_SRV_TRANS_001_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - + // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_ENABLE_APP_API_SUPPORTED)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_APP_API_SUPPORTED required for executing the TC ***"); diff --git a/ttcn/AtsMec/AtsMec_RnisAPI_TestCases.ttcn b/ttcn/AtsMec/AtsMec_RnisAPI_TestCases.ttcn index 268d3d95f86b471542695753bd7242d693e32bf9..99d78efb2e333cb615d59d9fa3f0423b467674be 100644 --- a/ttcn/AtsMec/AtsMec_RnisAPI_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_RnisAPI_TestCases.ttcn @@ -18,6 +18,7 @@ module AtsMec_RnisAPI_TestCases { // LibHttp import from LibItsHttp_TypesAndValues all; + import from LibItsHttp_JsonMessageBodyTypes all; import from LibItsHttp_Functions all; import from LibItsHttp_Templates all; import from LibItsHttp_JsonTemplates all; @@ -1025,12 +1026,15 @@ module AtsMec_RnisAPI_TestCases { group rnis_notifications { /** - * @desc Check that the RNIS service sends an RNIS notification about cell change if the RNIS service has an associated subscription and the event is generated. + * @desc Check that the RNIS service sends an RNIS notification about cell change if the RNIS service has an associated subscription and the event is generated. * @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/RNIS/RnisNotifications.tplan2 */ testcase TC_MEC_SRV_RNIS_001_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; + var integer v_result; + var JsonBody v_json_body; + var charstring v_subscription_id; // Test control if (not(PICS_RNIS) or not(PICS_RNIS_NOTIFICATIONS)) { @@ -1046,6 +1050,36 @@ module AtsMec_RnisAPI_TestCases { // Preamble f_init_default_headers_list(-, -, v_headers); + v_result := f_register_for_notification( + "/" & PICS_ROOT_API & PX_RNIS_SUBSCRITIONS_URI, + v_headers, + m_body_json_cell_change_subscription( + m_cell_change_subscription( + PX_CALLBACK_REFERENCE, + PX_LINKS_SELF, + m_filter_criteria_ho( + "01", + { m_associate_id(UE_IPV4_ADDRESS, PX_ASSOCIATE_ID_VALUE) }, + m_plmn("01", "001"), + PX_CELL_ID, + COMPLETED + ) + ) + ), + v_json_body + ); + if (v_result == 0) { + // Extract subscription ID for de-registration + if (ispresent(v_json_body.cellChangeSubscription)) { + v_subscription_id := oct2char(unichar2oct(v_json_body.cellChangeSubscription.links.self_, "UTF-8")); + } else { + log("*** " & testcasename() & ": INCONC: Unexpected JSON message ***"); + f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); // Fail with incoclusive verdict, testcase execution will terminate here + } + } else { + log("*** " & testcasename() & ": INCONC: Failed to register subsciption ***"); + f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); // Fail with incoclusive verdict, testcase execution will terminate here + } action("Trigger a cell change event"); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -1078,6 +1112,10 @@ module AtsMec_RnisAPI_TestCases { } // End of 'alt' statement // Postamble + f_unregister_for_notification( + "/" & PICS_ROOT_API & PX_RNIS_SUBSCRITIONS_URI & "/cell_change/" & v_subscription_id, + v_headers + ); f_cf_01_http_notif_down(); } // End of testcase TC_MEC_SRV_RNIS_001_OK diff --git a/ttcn/LibMec/Ams/ttcn/Ams_Pixits.ttcn b/ttcn/LibMec/Ams/ttcn/Ams_Pixits.ttcn index 42134f7af6d87eaf2f1a59561a20eced48113a3a..2f25a5be8e576138ce0746b60654a8fa7fb21990 100644 --- a/ttcn/LibMec/Ams/ttcn/Ams_Pixits.ttcn +++ b/ttcn/LibMec/Ams/ttcn/Ams_Pixits.ttcn @@ -1,21 +1,23 @@ module Ams_Pixits { - // LibCommon - import from LibCommon_BasicTypesAndValues all; + // JSON + import from JSON all; // LibMec/LocationAPI import from Ams_TypesAndValues all; - modulepar charstring PX_APP_MOBILITY_SERVICE_ID := "KtRGymNQ84dG3mQfRepa" + modulepar JSON.String PX_APP_MOBILITY_SERVICE_ID := "KtRGymNQ84dG3mQfRepa" - modulepar charstring PX_APP_INS_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f" + modulepar JSON.String PX_APP_INS_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f" - modulepar charstring PX_SUBSCRIPTION_TYPE := "MobilityProcedureSubscription" + modulepar JSON.String PX_SUBSCRIPTION_TYPE := "MobilityProcedureSubscription" - modulepar charstring PX_SUBSCRIPTION_ID := "e0deee2b-6e50-4f33-ab09-8bf0585025d3" + modulepar JSON.String PX_SUBSCRIPTION_ID := "e0deee2b-6e50-4f33-ab09-8bf0585025d3" - modulepar charstring PX_NON_EXISTENT_SUBSCRIPTION_ID := "NON_EXISTENT_SUBSCRIPTION_ID" + modulepar JSON.String PX_NON_EXISTENT_SUBSCRIPTION_ID := "NON_EXISTENT_SUBSCRIPTION_ID" - modulepar charstring PX_CALLBACK_REFERENCE := "http://127.0.0.1/callback" + modulepar JSON.String PX_CALLBACK_REFERENCE := "http://127.0.0.1/callback" + + modulepar JSON.String PX_MEP_ID := ""; } // End of module LocationAPI_Pixits diff --git a/ttcn/LibMec/Ams/ttcn/Ams_Templates.ttcn b/ttcn/LibMec/Ams/ttcn/Ams_Templates.ttcn index e50246d412ed1bfc3b73191b83ff14da0a292f5f..f08fa331efc00500261971c9a759d0d3334a3bc6 100644 --- a/ttcn/LibMec/Ams/ttcn/Ams_Templates.ttcn +++ b/ttcn/LibMec/Ams/ttcn/Ams_Templates.ttcn @@ -27,9 +27,45 @@ module Ams_Templates { appMobilityServiceId := p_app_mobility_service_id } + template (omit) RegistrationInfo m_app_mobility_registration_info( + in template (value) ServiceConsumerId p_serviceConsumerId, + in template (omit) DeviceInformations p_deviceInformation := omit, + in template (omit) UInt32 p_expiryTime := omit + ) := { + serviceConsumerId := p_serviceConsumerId, + deviceInformation := p_deviceInformation, + expiryTime := p_expiryTime + } + + template RegistrationInfo mw_app_mobility_registration_info( + template (present) ServiceConsumerId p_serviceConsumerId := ?, + template DeviceInformations p_deviceInformation := *, + template UInt32 p_expiryTime := * + ) := { + serviceConsumerId := p_serviceConsumerId, + deviceInformation := p_deviceInformation, + expiryTime := p_expiryTime + } + + template (omit) ServiceConsumerId m_service_consumer_id( + in template (omit) String p_appInstanceId := omit, + in template (omit) String p_mepId := omit + ) := { + appInstanceId := p_appInstanceId, + mepId := p_mepId + } + + template ServiceConsumerId mw_service_consumer_id( + template String p_appInstanceId := *, + template String p_mepId := * + ) := { + appInstanceId := p_appInstanceId, + mepId := p_mepId + } + template (omit) RegistrationRequest m_registration_request ( in template (omit) ServiceConsumerId p_service_consumer_id := omit, - in template (omit) DeviceInformations p_device_info := omit, + in template (omit) DeviceInformations p_device_info := omit, in UInt32 p_expire_time ) := { serviceConsumerId := p_service_consumer_id, @@ -39,121 +75,105 @@ module Ams_Templates { template RegistrationRequest mw_registration_request( template ServiceConsumerId p_service_consumer_id := ?, - template DeviceInformations p_device_info := omit, + template DeviceInformations p_device_info := omit, template UInt32 p_expire_time := omit ) := { serviceConsumerId := p_service_consumer_id, deviceInformation := p_device_info, - expiryTime := p_expire_time + expiryTime := p_expire_time } template (value) RegistrationInfo m_registration_info ( - in template (omit) ServiceConsumerId p_service_consumer_id := omit, - in template (omit) DeviceInformations p_device_info := omit, - in UInt32 p_expire_time + in template (omit) ServiceConsumerId p_service_consumer_id := omit, + in template (omit) DeviceInformations p_device_info := omit, + in UInt32 p_expire_time ) := { serviceConsumerId := p_service_consumer_id, deviceInformation := p_device_info, - expiryTime := p_expire_time + expiryTime := p_expire_time } template (present) RegistrationInfo mw_registration_info( template (present) ServiceConsumerId p_service_consumer_id := ?, - template (present) DeviceInformations p_device_info := ?, + template (present) DeviceInformations p_device_info := ?, template (present) UInt32 p_expire_time ) := { serviceConsumerId := p_service_consumer_id, deviceInformation := p_device_info, - expiryTime := p_expire_time + expiryTime := p_expire_time } template (value) ServiceConsumer m_service_consumer ( - in String p_app_instance, - in String p_mep_id + in String p_app_instance, + in String p_mep_id ) := { appInstance := p_app_instance, mepId := p_mep_id } - - template (value) ServiceConsumerId m_service_consumer_id ( - in String p_app_instance_id, - in String p_mep_id - ) := { - appInstanceId := p_app_instance_id, - mepId := p_mep_id - } - - - - template ServiceConsumerId mw_service_consumer_id( - template (present) String p_app_instance_id := ?, - template (present) String p_mep_id := ? - ) := { - appInstanceId := p_app_instance_id, - mepId := p_mep_id - } - - - template (value) DeviceInformation m_device_info ( - in String p_associate_id + in String p_associate_id ) := { associateId := p_associate_id } template (omit) DeviceInformation mw_device_info ( - in String p_associate_id + in String p_associate_id ) := { associateId := p_associate_id } + type record AmsSubscriptionLinkList { + JSON.AnyURI links, + Subscription subscription + } + template (value) MobilityProcedureSubscription m_ams_subscription ( - in SubscriptionType p_subscriptionType, - in JSON.AnyURI p_callbackReference, - in JSON.AnyURI p_links, - in FilterCriteria p_filterCriteria, - in TimeStamp p_expiryDeadline - + in SubscriptionType p_subscriptionType, + in JSON.AnyURI p_callbackReference, + in JSON.AnyURI p_links, + in FilterCriteria p_filterCriteria, + in TimeStamp p_expiryDeadline + ) := { subscriptionType := p_subscriptionType , - callbackReference := p_callbackReference, - links := p_links, - filterCriteria := p_filterCriteria, - expiryDeadline := p_expiryDeadline + callbackReference := p_callbackReference, + links := p_links, + filterCriteria := p_filterCriteria, + expiryDeadline := p_expiryDeadline } template (value) MobilityProcedureSubscriptionError m_ams_subscription_error ( - in SubscriptionTyp p_subscriptionType, - in JSON.AnyURI p_callbackReference, - in JSON.AnyURI p_links, - in FilterCriteria p_filterCriteria, - in TimeStamp p_expiryDeadline - + in SubscriptionType p_subscriptionType, + in JSON.AnyURI p_callbackReference, + in JSON.AnyURI p_links, + in FilterCriteria p_filterCriteria, + in TimeStamp p_expiryDeadline + ) := { subscriptionType := p_subscriptionType, - callbackReference := p_callbackReference, - links := p_links, - filterCriteria := p_filterCriteria, - expiryDeadline := p_expiryDeadline + callbackReference := p_callbackReference, + links := p_links, + filterCriteria := p_filterCriteria, + expiryDeadline := p_expiryDeadline } template (present) MobilityProcedureSubscription mw_ams_subscription ( - in SubscriptionType p_subscriptionType, - in JSON.AnyURI p_callbackReference, - in JSON.AnyURI p_links, - in FilterCriteria p_filterCriteria, - in TimeStamp p_expiryDeadline + in SubscriptionType p_subscriptionType, + in JSON.AnyURI p_callbackReference, + in JSON.AnyURI p_links, + in FilterCriteria p_filterCriteria, + in TimeStamp p_expiryDeadline ) := { subscriptionType := p_subscriptionType , - callbackReference := p_callbackReference, - links := p_links, - filterCriteria := p_filterCriteria, - expiryDeadline := p_expiryDeadline + callbackReference := p_callbackReference, + links := p_links, + filterCriteria := p_filterCriteria, + expiryDeadline := p_expiryDeadline } diff --git a/ttcn/LibMec/Ams/ttcn/Ams_TypesAndValues.ttcn b/ttcn/LibMec/Ams/ttcn/Ams_TypesAndValues.ttcn index 1799989d8875c2bcb2e0bf11dea8378eac27b883..9b636df8e380f684d545c857abcf9c1a66fc253c 100644 --- a/ttcn/LibMec/Ams/ttcn/Ams_TypesAndValues.ttcn +++ b/ttcn/LibMec/Ams/ttcn/Ams_TypesAndValues.ttcn @@ -54,13 +54,6 @@ type enumerated SubscriptionType { ADJACENT_APPINFO } - -type enumerated SubscriptionTyp { - RESERVED, - MOBILITY_PROCEDURE, - ADJACENT_APPINFO -} - type record Subscription { JSON.AnyURI href, SubscriptionType subscriptionType @@ -75,7 +68,7 @@ type record AmsSubscriptionLinkList { type record MobilityProcedureSubscriptionError { - SubscriptionTyp subscriptionType, + SubscriptionType subscriptionType, JSON.AnyURI callbackReference, JSON.AnyURI links optional, FilterCriteria filterCriteria, diff --git a/ttcn/LibMec/ttcn/LibMec_Functions.ttcn b/ttcn/LibMec/ttcn/LibMec_Functions.ttcn index 4af1ec42eca23ddd6c44940cd8cef5f81a55bcf7..1969d84cef299b5e663b7d211aa7b680621e4685 100644 --- a/ttcn/LibMec/ttcn/LibMec_Functions.ttcn +++ b/ttcn/LibMec/ttcn/LibMec_Functions.ttcn @@ -14,6 +14,7 @@ module LibMec_Functions { // LibHttp import from LibItsHttp_TypesAndValues all; + import from LibItsHttp_JsonMessageBodyTypes all; import from LibItsHttp_Templates all; import from LibItsHttp_TestSystem all; import from LibItsHttp_Templates all; @@ -125,6 +126,7 @@ module LibMec_Functions { var HttpMessage v_response; var integer v_result := -1; + // Send request httpPort.send( m_http_request( m_http_request_get( @@ -133,8 +135,7 @@ module LibMec_Functions { ) ) ); - - // Test Body + // Await for the response tc_ac.start; alt { [] httpPort.receive( @@ -172,6 +173,85 @@ module LibMec_Functions { } // End of group helpers + group registration { + + function f_register_for_notification( + in charstring p_uri, + in HeaderLines p_headers, + in template (value) JsonBody p_json_body, + out JsonBody p_notification + ) runs on HttpComponent return integer { + var integer v_result := -1; + var HttpMessage v_response; + + // Send the request + httpPort.send( + m_http_request( + m_http_request_get( + p_uri, + p_headers, + m_http_message_body_json(p_json_body) + ))); + // Await for the response + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json + ))) -> value v_response { + tc_ac.stop; + + p_notification := v_response.response.body.json_body; + v_result := 0; + log("*** f_register_for_notification: INFO: Regustration for notification succeed ***"); + } + [] tc_ac.timeout { + log("*** f_register_for_notification: INCONC: Expected message not received ***"); + } + } // End of 'alt' statement + + //log("<<< f_register_for_notification: v_result: ", v_result); + return v_result; + } // End of fiunction f_register_for_notification + + function f_unregister_for_notification( + in charstring p_uri, + in HeaderLines p_headers + ) runs on HttpComponent return integer { + var HttpMessage v_response; + var integer v_result := -1; + + // Send the request + httpPort.send( + m_http_request( + m_http_request_delete( + p_uri, + p_headers + ))); + // Await for the response + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_ok + )) -> value v_response { + tc_ac.stop; + + v_result := 0; + log("*** f_unregister_for_notification: INFO: Regustration for notification succeed ***"); + } + [] tc_ac.timeout { + log("*** f_unregister_for_notification: INCONC: Expected message not received ***"); + } + } // End of 'alt' statement + + //log("<<< f_unregister_for_notification: v_result: ", v_result); + return v_result; + } // End of fiunction f_unregister_for_notification + + } // End of group registration + group altsteps { altstep a_default_requests() runs on HttpComponent { diff --git a/ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn b/ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn index f99256b7d5029e3382b412cfa046fdccd006d8bc..b1706fc182f707366d41a9f00e52a76d73f6c4d6 100644 --- a/ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn +++ b/ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn @@ -50,13 +50,13 @@ import from Ams_Templates all; group ams_api { template (value) JsonBody m_body_json_app_mobility_service_info( - in template (value) AppMobilityServiceInfo p_app_mobility_service_info + in template (value) AppMobilityServiceInfo p_app_mobility_service_info ) := { appMobilityServiceInfo := p_app_mobility_service_info } // End of template mw_body_json_app_mobility_service_info template (present) JsonBody mw_body_json_app_mobility_service_info( - template (present) AppMobilityServiceInfo p_app_mobility_service_info := ? + template (present) AppMobilityServiceInfo p_app_mobility_service_info := ? ) := { appMobilityServiceInfo := p_app_mobility_service_info } // End of template mw_body_json_app_mobility_service_info