Commit 99dfd91d authored by Yann Garcia's avatar Yann Garcia
Browse files

Validation MEC 011 ATS against MEC Sanbox

parent 3ed089ef
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -52,25 +52,22 @@ int json_codec::encode (const LibHttp__JsonMessageBodyTypes::JsonBody& msg, OCTE
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceInfo& service_info = msg.serviceInfo();
    service_info.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = /*char2oct(CHARSTRING("{\"ServiceInfo\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
  } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_appInfo__regapps)) {
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::AppInfo& app_info = msg.appInfo__regapps();
    app_info.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::AppInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = /*char2oct(CHARSTRING("{\"AppInfo\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
  } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_appTerminationNotificationSubscription)) {
    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);
@@ -375,14 +372,18 @@ int json_codec::decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes
    RnisAPI__TypesAndValues::SubscriptionLinkList subscription_link_list;
    subscription_link_list.decode(RnisAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.subscriptionLinkList() = subscription_link_list;
  } else if (it->second.find("\"AppContext\"") != std::string::npos) {
  } else if (it->second.find("\"associateDevAppId\"") != std::string::npos) {
    UEAppInterfaceAPI__TypesAndValues::AppContext appContext;
    appContext.decode(UEAppInterfaceAPI__TypesAndValues::AppContext_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.appContext() = appContext;
  } else if (it->second.find("\"AppInfo\"") != std::string::npos) {
  } else if (it->second.find("\"appInfo\"") != std::string::npos) {
    UEAppInterfaceAPI__TypesAndValues::AppInfo appInfo;
    appInfo.decode(UEAppInterfaceAPI__TypesAndValues::AppInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.appInfo() = appInfo;
  } else if (it->second.find("\"appName\"") != std::string::npos) {
    EdgePlatformApplicationEnablementAPI__TypesAndValues::AppInfo appInfo;
    appInfo.decode(EdgePlatformApplicationEnablementAPI__TypesAndValues::AppInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.appInfo__regapps() = appInfo;
  } else if ((it->second.find("\"bwInfo\"") != std::string::npos) || (it->second.find("\"fixedBWPriority\"") != std::string::npos)) {
    // Need to change some enumerated string not supported by TTCN-3 language
    while (true) {
+98 −85

File changed.

Preview size limit exceeded, changes collapsed.

+27 −15
Original line number Diff line number Diff line
@@ -199,7 +199,8 @@ module EdgePlatformApplicationEnablementAPI_Functions {
  } // End of function f_delete_app_termination_notif_subscription

  function f_create_ser_availability_notification_subscription(
                                                               out SerAvailabilityNotificationSubscription p_ser_availability_notification_subscription
                                                               out SerAvailabilityNotificationSubscription p_ser_availability_notification_subscription,
                                                               out charstring p_subscription_id
                                                               ) runs on HttpComponent {
    var Headers v_headers;
    var HttpMessage v_response;
@@ -208,7 +209,7 @@ 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")) & "/subscriptions",
                                                     PICS_ROOT_API & PX_ME_APP_REG_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(
@@ -227,8 +228,18 @@ module EdgePlatformApplicationEnablementAPI_Functions {
                          )))))) -> 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")) & "/subscriptions" & "/(?*)",
                                    0
                                    );
        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);
        log("f_create_service_info: INFO: Resource URI: ", p_subscription_id);
      }
      [] tc_ac.timeout {
        log("f_create_ser_availability_notification_subscription: INCONC: Expected message not received");
@@ -237,20 +248,15 @@ module EdgePlatformApplicationEnablementAPI_Functions {
  } // End of function f_create_ser_availability_notification_subscription
  
  function f_delete_ser_availability_notification_subscription(
                                                               in SerAvailabilityNotificationSubscription p_ser_availability_notification_subscription
                                                               in charstring p_subscription_id
                                                               ) 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,
                                                       PICS_ROOT_API & PX_ME_APP_REG_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions/" & p_subscription_id,
                                                       v_headers
                  )));
    tc_ac.start;
@@ -283,7 +289,10 @@ module EdgePlatformApplicationEnablementAPI_Functions {
                                                     m_http_message_body_json(
                                                                              m_body_json_app_info_regapps(
                                                                                                           m_app_info(
                                                                                                                      PX_APP_NAME
                                                                                                                      PX_APP_NAME,
                                                                                                                      -, -, -,
                                                                                                                      PX_APP_INSTANCE_ID,
                                                                                                                      m_end_point_uris({PX_APP_ENDPOINT_URI})
                  ))))));

      tc_ac.start;
@@ -294,7 +303,10 @@ module EdgePlatformApplicationEnablementAPI_Functions {
                                                                          mw_http_message_body_json(
                                                                                                    mw_body_json_app_info_regapps(
                                                                                                                                  mw_app_info(
                                                                                                                                              PX_APP_NAME                                                                                                    
                                                                                                                                              PX_APP_NAME,
                                                                                                                                              -, -, -,
                                                                                                                                              PX_APP_INSTANCE_ID,
                                                                                                                                              mw_end_point_uris({PX_APP_ENDPOINT_URI})                                                                                                    
                            )))))) -> value v_response {
          tc_ac.stop;

+5 −3
Original line number Diff line number Diff line
@@ -6,15 +6,17 @@ module EdgePlatformApplicationEnablementAPI_Pixits {
  // LibMec/EdgePlatformApplicationEnablementAPI
  import from EdgePlatformApplicationEnablementAPI_TypesAndValues all;
  
  modulepar Json.String PX_APP_NAME := "appName";
  modulepar Json.String PX_APP_NAME := "appName01";
  
  modulepar Json.String PX_APP_D_ID := "appName";
  modulepar Json.String PX_APP_D_ID := "appName01";
  
  modulepar AppInstanceId PX_APP_INSTANCE_ID := "appInst01";
  
  modulepar AppInstanceId PX_NON_EXISTENT_APP_INSTANCE_ID := "appInst99";

  modulepar SerName PX_SERVICE_NAME := "serName";
  modulepar Json.String PX_APP_ENDPOINT_URI := "http://example.com:12345";
  
  modulepar SerName PX_SERVICE_NAME := "serName01";
  
  modulepar SerName PX_NON_EXISTENT_SERVICE_NAME := "unknownSerName";