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

Review MEC 040

parent 5fdd0d5c
Loading
Loading
Loading
Loading
+1338 −274

File changed.

Preview size limit exceeded, changes collapsed.

+24 −0
Original line number Diff line number Diff line
@@ -50,6 +50,30 @@ module AtsMec_FederationEnablementAPI_TestControl {

        execute(TC_MEC_MEC040_SRV_MEF_005_OK());
        execute(TC_MEC_MEC040_SRV_MEF_005_NF());

        execute(TC_MEC_MEC040_SRV_MEF_006_OK_01());
        execute(TC_MEC_MEC040_SRV_MEF_006_OK_02());
        execute(TC_MEC_MEC040_SRV_MEF_006_OK_03());
        execute(TC_MEC_MEC040_SRV_MEF_006_BR_01());
        execute(TC_MEC_MEC040_SRV_MEF_006_BR_02());
        execute(TC_MEC_MEC040_SRV_MEF_006_BR_03());
        execute(TC_MEC_MEC040_SRV_MEF_006_NF_01());
        execute(TC_MEC_MEC040_SRV_MEF_006_NF_02());

        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_001_OK_01());
        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_001_OK_02());
        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_001_BR_01());
        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_001_BR_02());

        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_002_OK());
        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_002_NF());

        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_003_OK());
        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_003_NF());

        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_004_OK());
        execute(TC_MEC_MEC040_SRV_MEF_SUB_NOT_004_NF());

      }

    }
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ modules := ../LibCommon \
            ../LibMec/ApplicationMobilityServiceAPI \
            ../LibMec/IoTAPI \
            ../LibMec/FederationEnablementAPI \
            ../LibMec/QoSMeasurementAPI \
            ../LibMec/SensorsSharingService \
            ../../titan-test-system-framework/ccsrc/Framework \
            ../../titan-test-system-framework/ccsrc/loggers \
            ../../titan-test-system-framework/ccsrc/Protocols/Http \
+2 −2
Original line number Diff line number Diff line
@@ -491,7 +491,7 @@ module AtsMec_IoTAPI_TestCases {
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_FED_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_2, "UTF-8")),
                                                        PICS_ROOT_API & PX_IOT_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_2, "UTF-8")),
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
@@ -557,7 +557,7 @@ module AtsMec_IoTAPI_TestCases {
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_FED_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_UNKNOWN, "UTF-8")),
                                                        PICS_ROOT_API & PX_IOT_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_UNKNOWN, "UTF-8")),
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
+94 −6
Original line number Diff line number Diff line
@@ -16,12 +16,13 @@ module FederationEnablementAPI_Functions {
  import from LibHttp_JsonTemplates all;
  import from LibHttp_TestSystem all;

  // LibMec/FixedAccessInformationServiceAPI
  // LibMec/FederationEnablementAPI
  import from FederationEnablementAPI_TypesAndValues all;
  import from FederationEnablementAPI_Templates all;
  import from FederationEnablementAPI_Pixits all;

  // LibMec
  import from LibMec_TypesAndValues all;
  import from LibMec_Templates all;
  import from LibMec_Functions all;
  import from LibMec_Pics all;
@@ -39,7 +40,7 @@ module FederationEnablementAPI_Functions {
    httpPort.send(
                  m_http_request(
                                 m_http_request_post(
                                                     PICS_ROOT_API & PX_FED_API_SUB,
                                                     PICS_ROOT_API & PX_FED_API_SYS_INFO,
                                                     v_headers,
                                                     m_http_message_body_json(
                                                                              m_body_json_fed_system_info(
@@ -76,7 +77,7 @@ module FederationEnablementAPI_Functions {
    httpPort.send(
                  m_http_request(
                                 m_http_request_delete(
                                                       PICS_ROOT_API & PX_FED_API_SUB & "/" & oct2char(unichar2oct(p_system_info.systemId, "UTF-8")),
                                                       PICS_ROOT_API & PX_FED_API_SYS_INFO & "/" & oct2char(unichar2oct(p_system_info.systemId, "UTF-8")),
                                                       v_headers
                  )));
      tc_ac.start;
@@ -114,4 +115,91 @@ module FederationEnablementAPI_Functions {
    }
  } // End of function f_delete_system_info_list

  function f_create_system_update_notification_subscription(
                                                            out SystemUpdateNotificationSubscription p_system_update_notification_subscription,
                                                            out charstring p_subscription_id,
                                                            in template (omit) SystemIds p_system_ids := omit,
                                                            in template (omit) TimeStamp p_expiry_deadline := omit
                                                            ) runs on HttpComponent {
    // Local variables
    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_FED_API_SUB,
                                                    v_headers,
                                                    m_http_message_body_json(
                                                                              m_body_json_system_update_notification_subscription(
                                                                                                                                  m_system_update_notification_subscription(
                                                                                                                                                                            PX_FED_SUB_CALLBACK_URI,
                                                                                                                                                                            -,
                                                                                                                                                                            p_system_ids,
                                                                                                                                                                            p_expiry_deadline

                  ))))));

    // Test Body
    tc_ac.start;
    alt {
      [] httpPort.receive(
                          mw_http_response(
                                           mw_http_response_201_created(
                                                                        mw_http_message_body_json(
                                                                                                  mw_body_json_system_update_notification_subscription(
                                                                                                                                                       mw_system_update_notification_subscription(
                                                                                                                                                                                                  PX_FED_SUB_CALLBACK_URI,
                                                                                                                                                                                                  mw_links_fed
                          )))))) -> 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_FED_API_SUB & "/(?*)",
                                    0
                                    );
        p_system_update_notification_subscription := v_response.response.body.json_body.systemUpdateNotificationSubscription;
        log("f_create_system_update_notification_subscription: INFO: IUT successfully responds to the subscription: ", p_system_update_notification_subscription);
        log("f_create_system_update_notification_subscription: INFO: p_subscription_id: ", p_subscription_id);
      }
      [] tc_ac.timeout {
        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
      }
    } // End of 'alt' statement
  } // End of function f_create_system_update_notification_subscription

  function f_delete_subscription(
                                 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_FED_API_SUB & "/" & 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_sensor_subscription: INCONC: Expected message not received");
      }
    } // End of 'alt' statement

  } // End of function f_delete_subscription

} // End of modue FederationEnablementAPI_Functions
 No newline at end of file
Loading