Commit 3ed089ef authored by Yann Garcia's avatar Yann Garcia
Browse files

Validation MEC 011 ATS against MEC Sanbox; Bug fixed in virtualization

parent c9bb0d8f
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -56,6 +56,21 @@ int json_codec::encode (const LibHttp__JsonMessageBodyTypes::JsonBody& msg, OCTE
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::AppTerminationNotificationSubscription& app = msg.appTerminationNotificationSubscription();
    app.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::AppTerminationNotificationSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = /*char2oct(CHARSTRING("{\"AppTerminationNotificationSubscription\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;



  } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_appTerminationConfirmation)) {
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::AppTerminationConfirmation& app = msg.appTerminationConfirmation();
    app.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::AppTerminationConfirmation_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = /*char2oct(CHARSTRING("{\"AppTerminationConfirmation\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;

  } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_appReadyConfirmation)) {
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::AppReadyConfirmation& app = msg.appReadyConfirmation();
    app.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::AppReadyConfirmation_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = /*char2oct(CHARSTRING("{\"AppTerminationConfirmation\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;



  } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_dnsRule)) {
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::DnsRule& dns_rule = msg.dnsRule();
    dns_rule.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::DnsRule_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
@@ -248,7 +263,11 @@ int json_codec::decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes
        std::size_t it_stop = it_start + 4;
        loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
        loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
        if ((str[it_start - 3] == 'n') || (str[it_start - 3] == 's')) { // fqdn or uris or addresses
          str = str.substr(0, it_start) + "[]" + str.substr(it_stop);
        } else {
          str = str.substr(0, it_start) + "{}" + str.substr(it_stop);
        }
        loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
      } // End of 'while' statement
      decoding_buffer.clear();
+312 −227

File changed.

Preview size limit exceeded, changes collapsed.

+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ module AtsMec_EdgePlatformApplicationEnablementAPI_TestControl {
      if (PICS_APP_ENABLEMENT_API_SUPPORTED) {
        execute(TC_MEC_MEC011_SRV_APPSAQ_001_OK());
        execute(TC_MEC_MEC011_SRV_APPSAQ_001_BR());
        execute(TC_MEC_MEC011_SRV_APPSAQ_001_NF());
        execute(TC_MEC_MEC011_SRV_APPSAQ_002_OK());
        execute(TC_MEC_MEC011_SRV_APPSAQ_002_BR());
        execute(TC_MEC_MEC011_SRV_APPSAQ_002_NF());
@@ -24,6 +25,8 @@ module AtsMec_EdgePlatformApplicationEnablementAPI_TestControl {
        execute(TC_MEC_MEC011_SRV_APPSAQ_004_BR());
        execute(TC_MEC_MEC011_SRV_APPSAQ_004_NF());
        execute(TC_MEC_MEC011_SRV_APPSAQ_004_PF());
        execute(TC_MEC_MEC011_SRV_APPSAQ_005_OK());
        execute(TC_MEC_MEC011_SRV_APPSAQ_005_NF());

        execute(TC_MEC_MEC011_SRV_APPSUB_001_OK());
        execute(TC_MEC_MEC011_SRV_APPSUB_001_NF());
+108 −15
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ module EdgePlatformApplicationEnablementAPI_Functions {

  function f_create_service_info(
                                 out ServiceInfo p_service_info,
                                 out Headers p_headers
                                 out charstring p_subscription_id
                                 ) runs on HttpComponent {
    var Headers v_headers;
    var HttpMessage v_response;
@@ -39,18 +39,16 @@ module EdgePlatformApplicationEnablementAPI_Functions {
    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",
                                                     PICS_ROOT_API & PX_ME_APP_REG_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",
                                                                                                                                       "REST_HTTP",
                                                                                                                                       REST_HTTP,
                                                                                                                                       "HTTP",
                                                                                                                                       "2.0",
@@ -65,13 +63,22 @@ module EdgePlatformApplicationEnablementAPI_Functions {
                                                                        mw_http_message_body_json(
                                                                                                  mw_body_json_service_info(
                                                                                                                            mw_service_info(
                                                                                                                                            v_service_name //serName
                                                                                                                                            v_service_name
                          )))))) -> value v_response {
        tc_ac.stop;
        
        // Extract HTTP Location header
        var charstring_list v_subscription_id;
        f_get_header(v_response.response.header, "Location", v_subscription_id);
        // Extract HTTP subssription id
        p_subscription_id := regexp(
                                    v_subscription_id[0],
                                    "?+" & PX_ME_APP_REG_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services" & "/(?*)",
                                    0
                                    );
        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);
        log("f_create_service_info: INFO: IUT successfully responds to the service creation: ", p_service_info);
        log("f_create_service_info: INFO: Resource URI: ", p_subscription_id);
      }
      [] tc_ac.timeout {
        log("f_create_service_info: INCONC: Expected message not received");
@@ -80,7 +87,7 @@ module EdgePlatformApplicationEnablementAPI_Functions {
  } // End of function f_create_service_info
  
  function f_delete_service_info(
                                 in ServiceInfo p_service_info
                                 in charstring p_subscription_id
                                 ) runs on HttpComponent {
    var Headers v_headers;

@@ -88,7 +95,7 @@ module EdgePlatformApplicationEnablementAPI_Functions {
    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)),
                                                       PICS_ROOT_API & PX_ME_APP_REG_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & p_subscription_id,
                                                       v_headers
                                                       )));
    tc_ac.start;
@@ -105,6 +112,92 @@ module EdgePlatformApplicationEnablementAPI_Functions {
    } // End of 'alt' statement
  } // End of function f_delete_service_info

  function f_create_app_termination_notif_subscription(
                                                       out AppTerminationNotificationSubscription p_app_termination_notification_subscription,
                                                       out charstring p_subscription_id
                                                       ) 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_ME_APP_SUPPORT_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions",
                                                      v_headers,
                                                      m_http_message_body_json(
                                                                              m_body_json_app_termination_notif_subscription(
                                                                                                                              m_app_termination_notif_subscription(
                                                                                                                                                                  PX_APP_TERM_NOTIF_CALLBACK_URI,
                                                                                                                                                                  -,
                                                                                                                                                                  PX_APP_INSTANCE_ID
                  ))))));

    // Test Body
    tc_ac.start;
    alt {
      [] httpPort.receive(
                          mw_http_response(
                                            mw_http_response_201_created(
                                                                        mw_http_message_body_json(
                                                                                                  mw_body_json_app_termination_notif_subscription(
                                                                                                                                                  mw_app_termination_notif_subscription(
                                                                                                                                                                                        PX_APP_TERM_NOTIF_CALLBACK_URI,
                                                                                                                                                                                        mw_self,
                                                                                                                                                                                        PX_APP_INSTANCE_ID
                          )))))) -> value v_response {
        tc_ac.stop;

        // Extract HTTP Location header
        var charstring_list v_subscription_id;
        f_get_header(v_response.response.header, "Location", v_subscription_id);
        // Extract HTTP subssription id
        p_subscription_id := regexp(
                                    v_subscription_id[0],
                                    "?+" & PX_ME_APP_SUPPORT_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions" & "/(?*)",
                                    0
                                    );
        p_app_termination_notification_subscription := v_response.response.body.json_body.appTerminationNotificationSubscription;
        log("f_create_app_termination_notif_subscription: INFO: IUT successfully responds with a AppTerminationNotificationSubscription: ", p_app_termination_notification_subscription);
        log("f_create_app_termination_notif_subscription: INFO: Resource URI: ", p_subscription_id);
      }
      [] tc_ac.timeout {
        log("f_create_app_termination_notif_subscription: INCONC: Expected message not received");
      }
    } // End of 'alt' statement

  } // End of function f_create_app_termination_notif_subscription

  function f_delete_app_termination_notif_subscription(
                                                       in charstring p_subscription_id
                                                       ) runs on HttpComponent {
    // Local variables
    var Headers v_headers;

    f_init_default_headers_list(-, -, v_headers);
    httpPort.send(
                  m_http_request(
                                  m_http_request_delete(
                                                        PICS_ROOT_API & PX_ME_APP_SUPPORT_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions/" & p_subscription_id,
                                                        v_headers
                  )));

    // Test Body
    tc_ac.start;
    alt {
      [] httpPort.receive(
                          mw_http_response(
                                            mw_http_response_204_no_content
                          )) {
        tc_ac.stop;
      }
      [] tc_ac.timeout {
        log("f_delete_app_termination_notif_subscription: INCONC: Expected message not received");
      }
    } // End of 'alt' statement

  } // End of function f_delete_app_termination_notif_subscription

  function f_create_ser_availability_notification_subscription(
                                                               out SerAvailabilityNotificationSubscription p_ser_availability_notification_subscription
                                                               ) runs on HttpComponent {
+7 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ module EdgePlatformApplicationEnablementAPI_Templates {
                                             in ServiceInfo_Version p_version := PX_SERVICE_INFO_VERSION,
                                             in ServiceState p_state := PX_SERVICE_INFO_STATE,
                                             in EdgePlatformApplicationEnablementAPI_TypesAndValues.SerializerType p_serializer := PX_SERIALIZER,
                                             in template (value) ServiceInfo_Link p_links,
                                             in template (omit) ServiceInfo_Link p_links := omit,
                                             in template (omit) SerInstanceId p_serInstanceId := omit,
                                             in template (omit) TransportId p_transportId := omit,
                                             in template (omit) TransportInfo p_transportInfo := omit,
@@ -143,6 +143,12 @@ module EdgePlatformApplicationEnablementAPI_Templates {
    self_    := p_self_
  } // End of template m_self

  template (present) Self mw_self(
                                  template (present) EdgePlatformApplicationEnablementAPI_TypesAndValues.LinkType p_self_ := ?
  ) := {
    self_    := p_self_
  } // End of template mw_self

  template (omit) AppTerminationNotificationSubscription m_app_termination_notif_subscription(
                                                                                              in template (value) AppTerminationNotificationSubscription_CallbackReference p_callbackReference,
                                                                                              in template (omit) Self p_links := omit,
Loading