Commit 0b7b85fa authored by Yann Garcia's avatar Yann Garcia
Browse files

TTF T027: Review MEC 010-2/MEX/LCM - Step1

parent fb21ff14
Loading
Loading
Loading
Loading
+976 −24

File changed.

Preview size limit exceeded, changes collapsed.

+21 −0
Original line number Diff line number Diff line
@@ -121,6 +121,27 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestControl {
            }
          }
        }

        if (PICS_IUT_MEX) {
          if (PIC_APP_LCM_MANAGEMENT) {
            execute(TC_MEC_MEC010p2_MEX_LCM_001_OK());
            execute(TC_MEC_MEC010p2_MEX_LCM_001_BR());
            execute(TC_MEC_MEC010p2_MEX_LCM_002_OK());
            execute(TC_MEC_MEC010p2_MEX_LCM_003_OK());
            execute(TC_MEC_MEC010p2_MEX_LCM_003_NF());
            execute(TC_MEC_MEC010p2_MEX_LCM_004_OK());
            execute(TC_MEC_MEC010p2_MEX_LCM_004_NF());
            execute(TC_MEC_MEC010p2_MEX_LCM_005_OK());
            execute(TC_MEC_MEC010p2_MEX_LCM_005_BR());
            execute(TC_MEC_MEC010p2_MEX_LCM_005_NF());
            execute(TC_MEC_MEC010p2_MEX_LCM_006_OK());
            execute(TC_MEC_MEC010p2_MEX_LCM_006_BR());
            execute(TC_MEC_MEC010p2_MEX_LCM_006_NF());
            execute(TC_MEC_MEC010p2_MEX_LCM_007_OK());
            execute(TC_MEC_MEC010p2_MEX_LCM_007_BR());
            execute(TC_MEC_MEC010p2_MEX_LCM_007_NF());
          }
        }
      }
    }
  } // End of 'control' statement
+172 −2
Original line number Diff line number Diff line
@@ -237,7 +237,6 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Functions {
                                         ) runs on HttpComponent {
    // Local variables
    var Headers v_headers;
    var HttpMessage v_response;

    f_init_default_headers_list(-, -, v_headers);
    httpPort.send(
@@ -252,7 +251,7 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Functions {
      [] httpPort.receive(
                          mw_http_response(
                                            mw_http_response_204_no_content
                          )) -> value v_response {
                          )) {
        tc_ac.stop;
      }
      [] tc_ac.timeout {
@@ -262,4 +261,175 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Functions {

  } // End of function f_delete_app_pkg_subscription

  function f_create_app_instance(
                                 out AppPkgInfo p_app_pkg_info,
                                 out AppInstanceInfo p_app_instanceInfo
                                 ) runs on HttpComponent {
    // Local variables
    var Headers v_headers;
    var HttpMessage v_response;

    f_create_package_management(p_app_pkg_info);
    if (not(isbound(p_app_pkg_info))) {
      log("f_create_app_instance: Failed to create pkg");
      return;
    }

    f_init_default_headers_list(-, -, v_headers);
    httpPort.send(
                  m_http_request(
                                 m_http_request_post(
                                                     PICS_ROOT_API & PX_APP_LCM_URI,
                                                     v_headers,
                                                     m_http_message_body_json(
                                                                              m_body_json_create_app_instance_request(
                                                                                                                      m_create_app_instance_request(
                                                                                                                                                    p_app_pkg_info.appDId,
                                                                                                                                                    p_app_pkg_info.appName & "_1"
                    ))))));

    // 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_instance_info(
                                                                                                                                  mw_app_instance_info(
                                                                                                                                                        -, 
                                                                                                                                                        p_app_pkg_info.appDId
                          )))))) -> value v_response {
        tc_ac.stop;
        p_app_instanceInfo := v_response.response.body.json_body.appInstanceInfo;
        log("f_create_app_pkg_subscription: INFO: IUT responds to the AppInstanceInfo: ", p_app_instanceInfo);
      }
      [] tc_ac.timeout {
        log("f_create_app_pkg_subscription: : INCONC: Expected message not received ***");
      }
    } // End of 'alt' statement

  } // End of function f_create_app_instance

  function f_delete_app_instance(
                                 in Json.String p_app_pkg_info_id,
                                 in Json.String p_app_instance_info_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_APP_LCM_URI & oct2char(unichar2oct(p_app_instance_info_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_instance: : INCONC: Expected message not received ***");
      }
    } // End of 'alt' statement

    f_delete_package_management(p_app_pkg_info_id);
  } // End of function f_delete_app_instance

  function f_instanciate_app_instance(
                                      out AppPkgInfo p_app_pkg_info,
                                      out AppInstanceInfo p_app_instanceInfo,
                                      out charstring p_app_lcm_op_occ_id
                                      ) runs on HttpComponent {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;
      var AppPkgInfo v_app_pkg_info;
      var AppInstanceInfo v_app_instanceInfo;

      f_create_app_instance(v_app_pkg_info, v_app_instanceInfo);
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_post(
                                                       PICS_ROOT_API & PX_APP_LCM_URI & oct2char(unichar2oct(v_app_instanceInfo.id)) & "instantiate",
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_instantiate_app_request(
                                                                                                                    m_instantiate_app_request(
                                                                                                                                              m_selected_mec_host_info(
                                                                                                                                                                       { 
                                                                                                                                                                          { key_name := PX_ONBOARD_HOSTID_NAME, key_value := {  universal charstring := PX_ONBOARD_HOSTID_VALUE } }
                                                                                                                                                                       }
                     )))))));

      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_202_accepted
                            )) -> value v_response {
          tc_ac.stop;

          var charstring_list v_header_value;
          if (f_check_headers(v_response.response.header)) {
            f_get_header(v_response.response.header, "Location", v_header_value);
            p_app_lcm_op_occ_id := regexp(
                                          v_header_value[0],
                                          PX_MEX_LCM_OP_OCC_URI & "/(?*)",
                                          0
                                          );
            log("f_instanciate_app_instance: IUT successfully responds with the correct header Location ", p_app_lcm_op_occ_id);
          }
        }
        [] tc_ac.timeout {
          log("f_instanciate_app_instance: INCONC: Expected message not received ***");
        }
      } // End of 'alt' statement

  } // End of function f_instanciate_app_instance

  function f_terminate_app_instance(
                                    in Json.String p_app_pkg_info_id,
                                    in Json.String p_app_instance_info_id
                                    ) runs on HttpComponent {
      // Local variables
      var Headers v_headers;
      var AppPkgInfo v_app_pkg_info;
      var AppInstanceInfo v_app_instanceInfo;

      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_post(
                                                       PICS_ROOT_API & PX_APP_LCM_URI & oct2char(unichar2oct(v_app_instanceInfo.id)) & "instantiate",
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_terminate_app_request(
                                                                                                                  m_terminate_app_request
                    )))));

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

      f_delete_app_instance(p_app_pkg_info_id, p_app_instance_info_id);
  } // End of function f_terminate_app_instance

} // End of ApplicationPackageLifecycleAndOperationGrantingAPI_Functions
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Pics {
  
  modulepar boolean PICS_IUT_MEPM := false;
  
  modulepar boolean PICS_IUT_MEX := false;
  
  /**
   * @desc Does the IUT support GRANT?
   */
+5 −1
Original line number Diff line number Diff line
@@ -72,4 +72,8 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits {
  
  modulepar Json.AnyURI PX_APP_PKG_HREF := "";

  modulepar Json.String PX_ONBOARD_HOSTID_NAME := "";

  modulepar Json.String PX_ONBOARD_HOSTID_VALUE := "";

} // End of module ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits
Loading