module EdgePlatformApplicationEnablementAPI_Functions { // JSON import from JSON all; // LibCommon import from LibCommon_BasicTypesAndValues all; import from LibCommon_Time all; import from LibCommon_VerdictControl all; import from LibCommon_Sync all; // LibHttp import from LibItsHttp_TypesAndValues all; import from LibItsHttp_Functions all; import from LibItsHttp_Templates all; import from LibItsHttp_JsonTemplates all; import from LibItsHttp_TestSystem all; // LibMec/EdgePlatformApplicationEnablementAPI import from EdgePlatformApplicationEnablementAPI_TypesAndValues all; import from EdgePlatformApplicationEnablementAPI_Templates all; import from EdgePlatformApplicationEnablementAPI_Pixits all; // LibMec import from LibMec_Templates all; import from LibMec_Functions all; import from LibMec_Pics all; import from LibMec_Pixits all; function f_create_service_info( out ServiceInfo p_service_info, out Headers p_headers ) runs on HttpComponent { var Headers v_headers; var HttpMessage v_response; var universal charstring v_service_name := oct2unichar(char2oct("service_" & int2str(f_get_current_timestamp_utc()))); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_post( PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services", v_headers, m_http_message_body_json( m_body_json_service_info( m_service_info( v_service_name, -, -, -, m_service_info_link("m_service_info_link"), -, -, //-, m_transport_info( "transportId1", "ETSI MEC-011 Conformance test", REST_HTTP, "HTTP", "2.0", m_end_point_uris({"/meMp1/service/MyEntryPoint"}), m_security_info ))))))); tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_201_created( mw_http_message_body_json( mw_body_json_service_info( mw_service_info( v_service_name //serName )))))) -> value v_response { tc_ac.stop; p_service_info := v_response.response.body.json_body.serviceInfo; p_headers := v_response.response.header; log("f_create_service_info: INFO: IUT successfully responds to the subscription: ", p_service_info); } [] tc_ac.timeout { log("f_create_service_info: INCONC: Expected message not received"); } } // End of 'alt' statement } // End of function f_create_service_info function f_delete_service_info( in ServiceInfo p_service_info ) runs on HttpComponent { var Headers v_headers; f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_delete( PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(p_service_info.serName)), v_headers ))); tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_204_no_content )) { tc_ac.stop; } [] tc_ac.timeout { log("f_delete_service_info: INCONC: Expected message not received"); } } // End of 'alt' statement } // End of function f_delete_service_info function f_create_ser_availability_notification_subscription( out SerAvailabilityNotificationSubscription p_ser_availability_notification_subscription ) runs on HttpComponent { var Headers v_headers; var HttpMessage v_response; f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_post( PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions", v_headers, m_http_message_body_json( m_body_json_srv_avail_notif_subscription( m_srv_avail_notif_subscription( PX_SRV_AVAIL_NOTIF_CALLBACK_URI )))))); tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_201_created( mw_http_message_body_json( mw_body_json_srv_avail_notif_subscription( mw_srv_avail_notif_subscription( PX_SRV_AVAIL_NOTIF_CALLBACK_URI )))))) -> value v_response { tc_ac.stop; p_ser_availability_notification_subscription := v_response.response.body.json_body.serAvailabilityNotificationSubscription log("f_create_ser_availability_notification_subscription: INFO: IUT successfully responds to the subscription: ", p_ser_availability_notification_subscription); } [] tc_ac.timeout { log("f_create_ser_availability_notification_subscription: INCONC: Expected message not received"); } } // End of 'alt' statement } // End of function f_create_ser_availability_notification_subscription function f_delete_ser_availability_notification_subscription( in SerAvailabilityNotificationSubscription p_ser_availability_notification_subscription ) runs on HttpComponent { var Headers v_headers; var charstring v_uri := regexp( oct2char(unichar2oct(p_ser_availability_notification_subscription.links.self_.href)), "?+(" & PX_MEC_SVC_MGMT_APPS_URI & "/?*)", 0 ); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_delete( PICS_ROOT_API & v_uri, v_headers ))); tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_204_no_content )) { tc_ac.stop; } [] tc_ac.timeout { log("f_delete_ser_availability_notification_subscription: INCONC: Expected message not received"); } } // End of 'alt' statement } // End of function f_delete_ser_availability_notification_subscription } // End of module EdgePlatformApplicationEnablementAPI_Functions