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

Implementation od MEC 033/iotpltf TPs

parent d2b4d942
Loading
Loading
Loading
Loading
+1765 −875

File changed.

Preview size limit exceeded, changes collapsed.

+14 −0
Original line number Diff line number Diff line
@@ -31,6 +31,20 @@ module AtsMec_IoTAPI_TestControl {
       
        execute(TC_MEC_MEC033_IOTS_IOTDEV_005_OK());
        execute(TC_MEC_MEC033_IOTS_IOTDEV_005_NF());

        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_001_OK());

        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_002_OK());
        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_002_BR());

        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_003_OK());
        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_003_NF());

        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_004_OK());
        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_004_NF());

        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_005_OK());
        execute(TC_MEC_MEC033_MEX_IOTS_IOTPLAT_005_NF());
      }
    }

+115 −3
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@ module IoTAPI_Functions {
  import from LibHttp_JsonTemplates all;
  import from LibHttp_TestSystem all;

  // LibMec/FixedAccessInformationServiceAPI
  // LibMec/EdgePlatformApplicationEnablementAPI
  import from EdgePlatformApplicationEnablementAPI_Templates all;

  // LibMec/IoTAPI
  import from IoTAPI_TypesAndValues all;
  import from IoTAPI_Templates all;
  import from IoTAPI_Pixits all;
@@ -40,7 +43,7 @@ module IoTAPI_Functions {
                                                     PICS_ROOT_API & PX_IOT_API_SUB,
                                                     v_headers,
                                                     m_http_message_body_json(
                                                                              m_body_json_fed_device_info(
                                                                              m_body_json_iot_device_info(
                                                                                                          m_device_info(
                                                                                                                        PX_IOT_DEVICE_ID_1, 
                                                                                                                        PX_IOT_DEVICE_AUTH_1, 
@@ -54,7 +57,7 @@ module IoTAPI_Functions {
                          mw_http_response(
                                          mw_http_response_201_created(
                                                                      mw_http_message_body_json(
                                                                                                mw_body_json_fed_device_info(
                                                                                                mw_body_json_iot_device_info(
                                                                                                                             mw_device_info(
                                                                                                                                            PX_IOT_DEVICE_ID_1, 
                                                                                                                                            PX_IOT_DEVICE_AUTH_1, 
@@ -120,4 +123,113 @@ module IoTAPI_Functions {
    }
  } // End of function f_delete_device_info_list

  function f_create_iot_platform_info(
                                      out IotPlatformInfo p_iot_platform_info
                                      ) 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_IOT_API_LIST_PLTF_SUB,
                                                     v_headers,
                                                     m_http_message_body_json(
                                                                              m_body_json_iot_iot_platform_info(
                                                                                                                m_iot_platform_info(
                                                                                                                                    PX_IOT_PLTF_ID_1,
                                                                                                                                    {
                                                                                                                                      m_mb_transport_info(
                                                                                                                                                          PX_MB_TRANSPORTINFO_ID_1,
                                                                                                                                                          PX_MB_TRANSPORTINFO_NAME_1,
                                                                                                                                                          PX_MB_TRANSPORTINFO_TYPE_1,
                                                                                                                                                          PX_MB_TRANSPORTINFO_PROTOCOL_1,
                                                                                                                                                          PX_MB_TRANSPORTINFO_VERSION_1,
                                                                                                                                                          m_end_point_uris({ PX_IOT_ENDPOINT_URI_1 }),
                                                                                                                                                          m_security_info,
                                                                                                                                                          m_impl_specific_info
                                                                                                                                                          )
                                                                                                                                     }
                  ))))));
    tc_ac.start;
    alt {
      [] httpPort.receive(
                          mw_http_response(
                                          mw_http_response_201_created(
                                                                      mw_http_message_body_json(
                                                                                                mw_body_json_iot_iot_platform_info(
                                                                                                                                   mw_iot_platform_info(
                                                                                                                                                        PX_IOT_PLTF_ID_1,
                                                                                                                                                        {
                                                                                                                                                          m_mb_transport_info(
                                                                                                                                                                              PX_MB_TRANSPORTINFO_ID_1,
                                                                                                                                                                              PX_MB_TRANSPORTINFO_NAME_1,
                                                                                                                                                                              PX_MB_TRANSPORTINFO_TYPE_1,
                                                                                                                                                                              PX_MB_TRANSPORTINFO_PROTOCOL_1,
                                                                                                                                                                              PX_MB_TRANSPORTINFO_VERSION_1,
                                                                                                                                                                              m_end_point_uris({ PX_IOT_ENDPOINT_URI_1 }),
                                                                                                                                                                              m_security_info,
                                                                                                                                                                              m_impl_specific_info
                                                                                                                                                                              )
                                                                                                                                                        }
                          )))))) -> value v_response {
        tc_ac.stop;

        p_iot_platform_info := v_response.response.body.json_body.iotPlatformInfo;
        log("f_create_iot_platform_info: INFO: IUT successfully responds to the subscription: ", p_iot_platform_info);
      }
      [] tc_ac.timeout {
        log("f_create_iot_platform_info: INCONC: Expected message not received");
      }
    } // End of 'alt' statement
  
  } // End of function f_create_iot_platform_info

  function f_delete_iot_platform_info(
                                      in IotPlatformInfo p_iot_platform_info
                                      ) 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_delete(
                                                       PICS_ROOT_API & PX_IOT_API_LIST_PLTF_SUB & "/" & oct2char(unichar2oct(p_iot_platform_info.iotPlatformId, "UTF-8")),
                                                       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_iot_platform_info: INCONC: Expected message not received");
        }
    } // End of 'alt' statement
  
  } // End of function f_delete_iot_platform_info

  function f_create_iot_platform_info_list(
                                           out IotPlatformInfoList p_iot_platform_info_list
                                           ) runs on HttpComponent {
    for (var integer i := 0; i < lengthof(p_iot_platform_info_list); i := i + 1) {
      f_create_iot_platform_info(p_iot_platform_info_list[i]);
    }
  } // End of function f_create_iot_platform_info_list

  function f_delete_iot_platform_info_list(
                                           in IotPlatformInfoList p_iot_platform_info_list
                                           ) runs on HttpComponent {
    for (var integer i := 0; i < lengthof(p_iot_platform_info_list); i := i + 1) {
      if (p_iot_platform_info_list[i].iotPlatformId != "") {
        f_delete_iot_platform_info(p_iot_platform_info_list[i]);
      }
    }
  } // End of function f_delete_iot_platform_info_list

} // End of modue IoTAPI_Functions
 No newline at end of file
+44 −3
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@ module IoTAPI_Pixits {
  // LibCommon
  import from LibCommon_BasicTypesAndValues all;

  // LibMec/FixedAccessInformationServiceAPI
  import from FederationEnablementAPI_TypesAndValues all;
  // LibMec/EdgePlatformApplicationEnablementAPI
  import from EdgePlatformApplicationEnablementAPI_TypesAndValues all;

  modulepar Json.String PX_IOT_DEVICE_ID_1       := "";

@@ -43,4 +43,45 @@ module IoTAPI_Pixits {

  modulepar Json.String PX_REQUESTED_PLTF_ID     := "";

} // End of IoTAPI_Pixits
  modulepar Json.String PX_IOT_PLTF_ID_1         := "";

  modulepar Json.String PX_IOT_PLTF_ID_2         := "";

  modulepar Json.String PX_IOT_PLTF_ID_3         := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_ID_1       := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_NAME_1     := "";

  modulepar EdgePlatformApplicationEnablementAPI_TypesAndValues.TransportType PX_MB_TRANSPORTINFO_TYPE_1
                                                       := REST_HTTP;

  modulepar Json.String PX_MB_TRANSPORTINFO_PROTOCOL_1 := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_VERSION_1  := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_ID_2       := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_NAME_2     := "";

  modulepar EdgePlatformApplicationEnablementAPI_TypesAndValues.TransportType PX_MB_TRANSPORTINFO_TYPE_2
                                                       := REST_HTTP;

  modulepar Json.String PX_MB_TRANSPORTINFO_PROTOCOL_2 := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_VERSION_2  := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_ID_3       := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_NAME_3     := "";

  modulepar EdgePlatformApplicationEnablementAPI_TypesAndValues.TransportType PX_MB_TRANSPORTINFO_TYPE_3 
                                                       := REST_HTTP;

  modulepar Json.String PX_MB_TRANSPORTINFO_PROTOCOL_3 := "";

  modulepar Json.String PX_MB_TRANSPORTINFO_VERSION_3  := "";

  modulepar Json.String PX_IOT_PLTF_ID_UNKNOWN         := "";

} // End of module IoTAPI_Pixits
 No newline at end of file
+102 −0
Original line number Diff line number Diff line
@@ -87,4 +87,106 @@ module IoTAPI_Templates {
    enabled                      := p_enabled
  } // End of template mw_device_info

  template (omit) IotPlatformInfo m_iot_platform_info(
                                                      in Json.String p_iotPlatformId,
                                                      in template (value) MBTransportInfoList p_userTransportInfo,
                                                      in Json.Bool p_enabled := false,
                                                      in template (omit) EdgePlatformApplicationEnablementAPI_TypesAndValues.TransportInfoList p_customServicesTransportInfo := omit
    
  ) := {
    iotPlatformId               := p_iotPlatformId,
    userTransportInfo           := p_userTransportInfo,
    customServicesTransportInfo := p_customServicesTransportInfo,
    enabled                     := p_enabled
  } // End of template m_iot_platform_info

  template (omit) IotPlatformInfo m_iot_platform_info_error(
                                                            in Json.String p_iotPlatformId,
                                                            in Json.Bool p_enabled := false,
                                                            in template (omit) EdgePlatformApplicationEnablementAPI_TypesAndValues.TransportInfoList p_customServicesTransportInfo := omit
    
  ) := {
    iotPlatformId               := p_iotPlatformId,
    userTransportInfo           := omit,
    customServicesTransportInfo := p_customServicesTransportInfo,
    enabled                     := p_enabled
  } // End of template m_iot_platform_info_error

  template (present) IotPlatformInfo mw_iot_platform_info(
                                                          template (present) Json.String p_iotPlatformId := ?,
                                                          template (present) MBTransportInfoList p_userTransportInfo := ?,
                                                          template (present) Json.Bool p_enabled := ?,
                                                          template EdgePlatformApplicationEnablementAPI_TypesAndValues.TransportInfoList p_customServicesTransportInfo := *
    
  ) := {
    iotPlatformId               := p_iotPlatformId,
    userTransportInfo           := p_userTransportInfo,
    customServicesTransportInfo := p_customServicesTransportInfo,
    enabled                     := p_enabled
  } // End of template mw_iot_platform_info

  template (omit) MBTransportInfo m_mb_transport_info(
                                                      in Json.String p_id,
                                                      in Json.String p_name,
                                                      in EdgePlatformApplicationEnablementAPI_TypesAndValues.TransportType p_type,
                                                      in Json.String p_protocol,
                                                      in Json.String p_version,
                                                      in template (value) EdgePlatformApplicationEnablementAPI_TypesAndValues.EndPointInfo p_endpoint,
                                                      in template (value) EdgePlatformApplicationEnablementAPI_TypesAndValues.SecurityInfo p_security,
                                                      in template (value) ImplSpecificInfo p_implSpecificInfo,
                                                      in template (omit) Json.String p_description := omit
                                                      ) := {
    id               := p_id,
    name             := p_name,
    description      := p_description,
    type_            := p_type,
    protocol         := p_protocol,
    version          := p_version,
    endpoint         := p_endpoint,
    security         := p_security,
    implSpecificInfo := p_implSpecificInfo
  } // End of template m_mb_transport_info

  template (present) MBTransportInfo mw_mb_transport_info(
                                                          template (present) Json.String p_id := ?,
                                                          template (present) Json.String p_name := ?,
                                                          template (present) EdgePlatformApplicationEnablementAPI_TypesAndValues.TransportType p_type := ?,
                                                          template (present) Json.String p_protocol := ?,
                                                          template (present) Json.String p_version := ?,
                                                          template (present) EdgePlatformApplicationEnablementAPI_TypesAndValues.EndPointInfo p_endpoint := ?,
                                                          template (present) EdgePlatformApplicationEnablementAPI_TypesAndValues.SecurityInfo p_security := ?,
                                                          template (present) ImplSpecificInfo p_implSpecificInfo := ?,
                                                          template Json.String p_description := *
                                                          ) := {
    id               := p_id,
    name             := p_name,
    description      := p_description,
    type_            := p_type,
    protocol         := p_protocol,
    version          := p_version,
    endpoint         := p_endpoint,
    security         := p_security,
    implSpecificInfo := p_implSpecificInfo
  } // End of template mw_mb_transport_info

  template (omit) ImplSpecificInfo m_impl_specific_info(
                                                        in template (omit) EventTopics p_eventTopics := omit,
                                                        in template (omit) UplinkTopics p_uplinkTopics := omit,
                                                        in template (omit) DownlinkTopics p_downlinkTopics := omit
  ) := {
    eventTopics    := p_eventTopics,
    uplinkTopics   := p_uplinkTopics,
    downlinkTopics := p_downlinkTopics
  } // End of template m_impl_specific_info

  template ImplSpecificInfo mw_impl_specific_info(
                                                  template EventTopics p_eventTopics := *,
                                                  template UplinkTopics p_uplinkTopics := *,
                                                  template DownlinkTopics p_downlinkTopics := *
  ) := {
    eventTopics    := p_eventTopics,
    uplinkTopics   := p_uplinkTopics,
    downlinkTopics := p_downlinkTopics
  } // End of template mw_impl_specific_info

} // End of IoTAPI_Templates
Loading