Commit dabe77e2 authored by Yann Garcia's avatar Yann Garcia
Browse files

Finalyse validation of CAPIF

parent 3cc3e7fa
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -60,6 +60,18 @@ int json_codec_mec011::encode (const LibHttp__JsonMessageBodyTypes::JsonBody& ms
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceAPIDescriptionPatch& service_api_description_patch = msg.service__api__description__patch();
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceAPIDescriptionPatch& service_api_description_patch = msg.service__api__description__patch();
    service_api_description_patch.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceAPIDescriptionPatch_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    service_api_description_patch.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceAPIDescriptionPatch_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
    data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
  } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_capif__event__subscription)) {
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::EventSubscription& capif_event_subscription = msg.capif__event__subscription();
    capif_event_subscription.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::EventSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
  } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_capif__event__subscription__patch)) {
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::EventSubscriptionPatch& capif_event_subscription_patch = msg.capif__event__subscription__patch();
    capif_event_subscription_patch.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::EventSubscriptionPatch_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
  } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_capif__event__notification)) {
    const EdgePlatformApplicationEnablementAPI__TypesAndValues::EventNotification& capif_event_notification = msg.capif__event__notification();
    capif_event_notification.encode(EdgePlatformApplicationEnablementAPI__TypesAndValues::EventNotification_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
  } else {
  } else {
    return json_codec::encode(msg, data);
    return json_codec::encode(msg, data);
  }
  }
@@ -205,6 +217,19 @@ int json_codec_mec011::decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBo
    EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceAPIDescriptionPatch service_api_description_patch;
    EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceAPIDescriptionPatch service_api_description_patch;
    service_api_description_patch.decode(EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceAPIDescriptionPatch_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    service_api_description_patch.decode(EdgePlatformApplicationEnablementAPI__TypesAndValues::ServiceAPIDescriptionPatch_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.service__api__description__patch() = service_api_description_patch;
    msg.service__api__description__patch() = service_api_description_patch;
  } else if (it->second.find("\"notificationDestination\"") != std::string::npos) {
    EdgePlatformApplicationEnablementAPI__TypesAndValues::EventSubscription capif_event_subscription;
    capif_event_subscription.decode(EdgePlatformApplicationEnablementAPI__TypesAndValues::EventSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.capif__event__subscription() = capif_event_subscription;
  } else if (it->second.find("\"events\"") != std::string::npos) { // FIXME FSCOM The data structures EventSubscription & EventSubscriptionPatch are simular
                                                                   //             There is a high potentail bug here
    EdgePlatformApplicationEnablementAPI__TypesAndValues::EventSubscriptionPatch capif_event_subscription_patch;
    capif_event_subscription_patch.decode(EdgePlatformApplicationEnablementAPI__TypesAndValues::EventSubscriptionPatch_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.capif__event__subscription__patch() = capif_event_subscription_patch;
  } else if (it->second.find("\"subscriptionId\"") != std::string::npos) {
    EdgePlatformApplicationEnablementAPI__TypesAndValues::EventNotification capif_event_notification;
    capif_event_notification.decode(EdgePlatformApplicationEnablementAPI__TypesAndValues::EventNotification_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.capif__event__notification() = capif_event_notification;
  } else {
  } else {
    return json_codec::decode(p_data, msg, p_params);
    return json_codec::decode(p_data, msg, p_params);
  }
  }
+19 −3
Original line number Original line Diff line number Diff line
@@ -19,12 +19,13 @@ LibMec_Pics.PICS_ROOT_API := "/sbxykqjr17/mep1/" # Need to sign i
LibMec_Pics.PICS_MEC_PLAT := true
LibMec_Pics.PICS_MEC_PLAT := true


# Application Instance ID
# Application Instance ID
EdgePlatformApplicationEnablementAPI_Pixits.PX_APP_INSTANCE_ID := "52bd535e-7a3e-4fef-8678-b2c832c9be95" # Copied from ETSI MEC Sandbox GUI
EdgePlatformApplicationEnablementAPI_Pixits.PX_APP_INSTANCE_ID := "81c51643-8c6f-4781-ad45-f8a457ca549b" # Copied from ETSI MEC Sandbox GUI
# MEC APIs
# MEC APIs
EdgePlatformApplicationEnablementAPI_Pixits.PX_API_NAME        := "mec015-1"                              # Pickup from MEC Sandbox logs console 
EdgePlatformApplicationEnablementAPI_Pixits.PX_API_NAME        := "mec015-1"                              # Pickup from MEC Sandbox logs console 
EdgePlatformApplicationEnablementAPI_Pixits.PX_API_ID          := "a6612a80-85f2-41e0-8565-4bf477483fb7"
EdgePlatformApplicationEnablementAPI_Pixits.PX_API_ID          := "a6612a80-85f2-41e0-8565-4bf477483fb7"


# Callbacks
# Callbacks
EdgePlatformApplicationEnablementAPI_Pixits.PX_CAPIF_NOTIF_CALLBACK_URI := "https://yanngarcia.ddns.net:36001/capif-events/v1"


[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
@@ -199,7 +200,7 @@ system.httpPort_notif.params := "HTTP(codecs=json:json_codec_mec011)/TCP(debug=1
# Check that the IUT responds with all service APIs when queried by a MEC Application - No filter
# Check that the IUT responds with all service APIs when queried by a MEC Application - No filter
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_001_OK_01
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_001_OK_01
# Check that the IUT responds with all service APIs when queried by a MEC Application - Filter on apiName
# Check that the IUT responds with all service APIs when queried by a MEC Application - Filter on apiName
AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_001_OK_02
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_001_OK_02
# Check that the IUT responds with all service APIs when queried by a MEC Application - Filter on apiId
# Check that the IUT responds with all service APIs when queried by a MEC Application - Filter on apiId
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_001_OK_03
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_001_OK_03
# Check that the IUT responds with all service APIs when queried by a MEC Application - Filter on apiId and apiName
# Check that the IUT responds with all service APIs when queried by a MEC Application - Filter on apiId and apiName
@@ -234,7 +235,22 @@ AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROF
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_007_OK
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_007_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_007_NF
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_007_NF

# Check that the IUT acknowledges the creation of a CAPIF subscription request when requested by a MEC Application
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_008_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_008_NF
# Check that the IUT acknowledges the update of a CAPIF subscription request when requested by a MEC Application
AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_009_OK
# Check that the IUT acknowledges the update of a CAPIF subscription request when requested by a MEC Application
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_009_NF
# Check that the IUT acknowledges the changes of a CAPIF subscription request when requested by a MEC Application
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_010_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_010_NF
# Check that the IUT acknowledges the cancellation of a CAPIF subscription when requested by a MEC Application
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_011_OK
# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
#AtsMec_EdgePlatformApplicationEnablementAPI_TestCases.TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_011_NF


[GROUPS]
[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
# In this section you can specify groups of hosts. These groups can be used inside the
+541 −37

File changed.

Preview size limit exceeded, changes collapsed.

+11 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,17 @@ module AtsMec_EdgePlatformApplicationEnablementAPI_TestControl {
        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_007_OK());
        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_007_OK());
        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_007_NF());
        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_007_NF());


        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_008_OK());
        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_008_NF());

        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_009_OK());
        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_009_NF());

        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_010_OK());
        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_010_NF());

        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_011_OK());
        execute(TC_MEC_MEC011_SRV_MEC_PROFILE_FOR_CAPIF_011_NF());
      }
      }
    }
    }


+85 −0
Original line number Original line Diff line number Diff line
@@ -571,4 +571,89 @@ module EdgePlatformApplicationEnablementAPI_Functions {


  } // End of function f_delete_published_api
  } // End of function f_delete_published_api


  function f_create_subscription(
                                 in Json.String p_app_instance_id := PX_APP_INSTANCE_ID,
                                 out EventSubscription p_event_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_CAPIF_SUBSCRIBE_URI & "/" & oct2char(unichar2oct(p_app_instance_id, "UTF-8")) & "/subscriptions",
                                                     v_headers,
                                                     m_http_message_body_json(
                                                                              m_body_json_capif_event_subscription(
                                                                                                                   m_event_subscription(
                                                                                                                                          {
                                                                                                                                            SERVICE_API_AVAILABLE,
                                                                                                                                            SERVICE_API_UPDATE
                                                                                                                                          },
                                                                                                                                          PX_CAPIF_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_capif_event_subscription(
                                                                                                                                        mw_event_subscription(
                                                                                                                                                               {
                                                                                                                                                                 SERVICE_API_AVAILABLE,
                                                                                                                                                                 SERVICE_API_UPDATE
                                                                                                                                                               },
                                                                                                                                                               PX_CAPIF_NOTIF_CALLBACK_URI
                          )))))) -> 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_CAPIF_SUBSCRIBE_URI & "/" & oct2char(unichar2oct(p_app_instance_id, "UTF-8")) & "/subscriptions" & "/(?*)",
                                    0
                                    );
        p_event_subscription := v_response.response.body.json_body.capif_event_subscription;
        log("f_create_subscrition: INFO: IUT successfully responds to the subscrition creation: p_event_subscription=", p_event_subscription);
        log("f_create_subscrition: INFO: IUT successfully responds to the subscrition creation: p_subscription_id=", p_subscription_id);
      }
      [] tc_ac.timeout {
        log("f_create_subscrition: INCONC: Expected message not received");
      }
    } // End of 'alt' statement
  } // End of function f_create_subscription
  
  function f_delete_subscription(
                                 in Json.String p_app_instance_id := PX_APP_INSTANCE_ID,
                                 in charstring p_subscription_id
                                 ) 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_ME_CAPIF_SUBSCRIBE_URI & "/" & oct2char(unichar2oct(p_app_instance_id, "UTF-8")) & "/subscriptions/" & p_subscription_id,
                                                       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_subscription: INCONC: Expected message not received");
      }
    } // End of 'alt' statement
  } // End of function f_delete_subscription

} // End of module EdgePlatformApplicationEnablementAPI_Functions
} // End of module EdgePlatformApplicationEnablementAPI_Functions
Loading