AtsMec_IoTAPI_TestCases.ttcn 129 KB
Newer Older
module AtsMec_IoTAPI_TestCases {
  
  // Libcommon
  import from LibCommon_Sync all;
  
  // LibHttp
  import from LibHttp_TypesAndValues all;
  import from LibHttp_Functions all;
  import from LibHttp_Templates all;
  import from LibHttp_JsonTemplates all;
  import from LibHttp_TestSystem all;
  
  // LibMec/LibMec_ApplicationPackageLifecycleAndOperationGrantingAPI
  import from ApplicationPackageLifecycleAndOperationGrantingAPI_TypesAndValues all;
  import from ApplicationPackageLifecycleAndOperationGrantingAPI_Templates all;
  import from ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits all;

  // LibMec/EdgePlatformApplicationEnablementAPI
  import from EdgePlatformApplicationEnablementAPI_Templates all;

  // LibMec/IoTAPI
  import from IoTAPI_TypesAndValues all;
  import from IoTAPI_Templates all;
  import from IoTAPI_Functions all;
  import from IoTAPI_Pics all;
  import from IoTAPI_Pixits all;
  
  // LibMec
  import from LibMec_Functions all;
  import from LibMec_Pics all;
  import from LibMec_Pixits all;
  
  group iotdev {

    group lookup {

      /**
       * @desc Check that the IUT responds with the list of registered IoT devices when queried by a Service Consumer
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_001_OK_01() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_IOT_API_LIST_DEVICE_INFO,
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok(
                                                                   mw_http_message_body_json(
                                                                                             mw_body_json_iot_device_info_list(
                                                                                                                               {
                                                                                                                                  mw_device_info(
                                                                                                                                                PX_IOT_DEVICE_ID_1, 
                                                                                                                                                PX_IOT_DEVICE_AUTH_1, 
                                                                                                                                                -, 
                                                                                                                                                PX_IOT_DEVICE_SUPI_1, 
                                                                                                                                                PX_IOT_DEVICE_IMSI_1
                                                                                                                                                ),
                                                                                                                                  mw_device_info(
                                                                                                                                                PX_IOT_DEVICE_ID_2, 
                                                                                                                                                PX_IOT_DEVICE_AUTH_2, 
                                                                                                                                                -, 
                                                                                                                                                PX_IOT_DEVICE_SUPI_2, 
                                                                                                                                                PX_IOT_DEVICE_IMSI_2
                                                                                                                                                ),
                                                                                                                                  mw_device_info(
                                                                                                                                                PX_IOT_DEVICE_ID_3, 
                                                                                                                                                PX_IOT_DEVICE_AUTH_3, 
                                                                                                                                                -, 
                                                                                                                                                PX_IOT_DEVICE_SUPI_3, 
                                                                                                                                                PX_IOT_DEVICE_IMSI_3
                                                                                                                                                )
                               ))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a DeviceInfoList ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_001_OK_01

      /**
       * @desc Check that the IUT responds with the list of registered IoT devices when queried using a filter by a Service Consumer
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_001_OK_02() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_IOT_API_LIST_DEVICE_INFO & "?filter=(eq,enabled,false)",
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok(
                                                                   mw_http_message_body_json(
                                                                                             mw_body_json_iot_device_info_list(
                                                                                                                               {
                                                                                                                                  mw_device_info(
                                                                                                                                                 PX_IOT_DEVICE_ID_2, 
                                                                                                                                                 PX_IOT_DEVICE_AUTH_2, 
                                                                                                                                                 -, 
                                                                                                                                                 PX_IOT_DEVICE_SUPI_2, 
                                                                                                                                                 PX_IOT_DEVICE_IMSI_2
                                                                                                                                                 )
                              ))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a DeviceInfoList ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_001_OK_02

      /**
       * @desc Check that the IUT responds with the list of registered IoT devices when queried by a Service Consumer filtering one field
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_001_OK_03() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_IOT_API_LIST_DEVICE_INFO & "?fields=deviceId",
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                              mw_http_response_ok(
                                                                  mw_http_message_body_json(
                                                                                            mw_body_json_iot_device_info_list(
                                                                                                                              {
                                                                                                                                 mw_device_info(
                                                                                                                                                PX_IOT_DEVICE_ID_3, 
                                                                                                                                                PX_IOT_DEVICE_AUTH_3, 
                                                                                                                                                -, 
                                                                                                                                                PX_IOT_DEVICE_SUPI_3, 
                                                                                                                                                PX_IOT_DEVICE_IMSI_3
                                                                                                                                                )
                                                                                                                              }
                              ))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a DeviceInfoList ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_001_OK_03

      /**
       * @desc Check that the IUT responds with the list of registered IoT devices when queried by a Service Consumer filtering the number of fields and applying a filter to a specific field
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_001_OK_04() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_IOT_API_LIST_DEVICE_INFO & "?fields=deviceId&filter=(eq,enabled,false)",
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok(
                                                                   mw_http_message_body_json(
                                                                                             mw_body_json_iot_device_info_list(
                                                                                                                               {
                                                                                                                                  mw_device_info(
                                                                                                                                                 PX_IOT_DEVICE_ID_2, 
                                                                                                                                                 PX_IOT_DEVICE_AUTH_2, 
                                                                                                                                                 -, 
                                                                                                                                                 PX_IOT_DEVICE_SUPI_2, 
                                                                                                                                                 PX_IOT_DEVICE_IMSI_2
                                                                                                                                                 )
                               ))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a DeviceInfoList ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_001_OK_04

    } // End of group lookup

    group subscription {

      /**
       * @desc Check that the IUT registers the information of an IoT device when requested by a Service Consumer
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_002_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_post(
                                                         PICS_ROOT_API & PX_IOT_API_SUB,
                                                         v_headers,
                                                         m_http_message_body_json(
                                                                                  m_body_json_iot_device_info(
                                                                                                              m_device_info(
                                                                                                                            PX_IOT_DEVICE_ID_1, 
                                                                                                                            PX_IOT_DEVICE_AUTH_1, 
                                                                                                                            -, 
                                                                                                                            PX_IOT_DEVICE_SUPI_1, 
                                                                                                                            PX_IOT_DEVICE_IMSI_1
                      ))))));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_201_created(
                                                                            mw_http_message_body_json(
                                                                                                      mw_body_json_iot_device_info(
                                                                                                                                   mw_device_info(
                                                                                                                                                  PX_IOT_DEVICE_ID_1, 
                                                                                                                                                  PX_IOT_DEVICE_AUTH_1, 
                                                                                                                                                  false, 
                                                                                                                                                  PX_IOT_DEVICE_SUPI_1, 
                                                                                                                                                  PX_IOT_DEVICE_IMSI_1
                              )))))) -> value v_response {
            tc_ac.stop;

            if (f_check_headers(valueof(v_response.response.header)) == false) {
              log("*** " & testcasename() & ": FAIL: Header 'Location' was not present in the response headers ***");
              f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
            } else {
              log("*** " & testcasename() & ": PASS: IUT successfully create DeviceInfo entry ***");
              f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info(v_response.response.body.json_body.deviceInfo_iot);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_002_OK

      /**
       * @desc Check that the IUT returns an error when Service Consumer request to register an IoT device with incorrect parameters
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_002_BR() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                    m_http_request_post(
                                                        PICS_ROOT_API & PX_IOT_API_SUB,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                  m_body_json_iot_device_info(
                                                                                                              m_device_info(
                                                                                                                            PX_IOT_DEVICE_ID_1, 
                                                                                                                            PX_IOT_DEVICE_AUTH_1, 
                                                                                                                            false, 
                                                                                                                            PX_IOT_DEVICE_SUPI_1, 
                                                                                                                            PX_IOT_DEVICE_IMSI_1
                      ))))));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_400_bad_request
                              )) {
            tc_ac.stop;

            log("*** " & testcasename() & ": PASS: IUT responds with the correct error code ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_002_BR

      /**
       * @desc Check that the IUT returns the IoT device information when requested by Service Consumer specifying the device identifier
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_003_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        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")),
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok(
                                                                   mw_http_message_body_json(
                                                                                             mw_body_json_iot_device_info(
                                                                                                                          mw_device_info(
                                                                                                                                         PX_IOT_DEVICE_ID_2, 
                                                                                                                                         PX_IOT_DEVICE_AUTH_2,
                                                                                                                                         true, // According to Note 3 of 6.2.2-1 table, it cannot be set directly by the service consumer
                                                                                                                                         PX_IOT_DEVICE_SUPI_2, 
                                                                                                                                         PX_IOT_DEVICE_IMSI_2
                              )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct DeviceInfo entry ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_003_OK

      /**
       * @desc Check that the IUT returns the IoT device information when requested by Service Consumer specifying the device identifier
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_003_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        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")),
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_404_not_found
                              )) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error code ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_003_NF

    } // End of group subscribe

    group patch {

      /**
       * @desc Check that the IUT updates the information about a registered IoT device when requested by a Service Consumer
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_004_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var HttpMessage v_response;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        var TrafficRuleDescriptor v_traffic_rule_descriptor := valueof(
                                                                       m_traffic_rule_descriptor(
                                                                                                 PX_TRAFFIC_RULE_ID,
                                                                                                 PX_TRAFFIC_FILTERTYPE,
                                                                                                 PX_TRAFFIC_RULE_PRIORITY,
                                                                                                 m_traffic_filter(
                                                                                                                  PX_TRAFFIC_FILTER_SRC_ADDRESS,
                                                                                                                  PX_TRAFFIC_FILTER_DST_ADDRESS,
                                                                                                                  PX_TRAFFIC_FILTER_SRC_PORT,
                                                                                                                  PX_TRAFFIC_FILTER_DST_PORT,
                                                                                                                  PX_TRAFFIC_FILTER_PROTOCOL
                                                                                                                  ),
                                                                                                 PX_TRAFFIC_RULE_ACTION
                                                                        ));
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_patch(
                                                          PICS_ROOT_API & PX_IOT_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_1, "UTF-8")),
                                                          v_headers,
                                                          m_http_message_body_json(
                                                                                   m_body_json_iot_device_info(
                                                                                                               m_device_info(
                                                                                                                             PX_IOT_DEVICE_ID_1, 
                                                                                                                             PX_IOT_DEVICE_AUTH_1, 
                                                                                                                             -, 
                                                                                                                             PX_IOT_DEVICE_SUPI_1, 
                                                                                                                             PX_IOT_DEVICE_IMSI_1,
                                                                                                                             PX_REQUESTED_PLTF_ID,
                                                                                                                             {v_traffic_rule_descriptor}
                      ))))));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok(
                                                                   mw_http_message_body_json(
                                                                                             mw_body_json_iot_device_info(
                                                                                                                          mw_device_info(
                                                                                                                                         PX_IOT_DEVICE_ID_1, 
                                                                                                                                         PX_IOT_DEVICE_AUTH_1, 
                                                                                                                                         -, 
                                                                                                                                         PX_IOT_DEVICE_SUPI_1, 
                                                                                                                                         PX_IOT_DEVICE_IMSI_1,
                                                                                                                                         PX_REQUESTED_PLTF_ID,
                                                                                                                                         {v_traffic_rule_descriptor}
                              )))))) -> value v_response {
            tc_ac.stop;

            log("*** " & testcasename() & ": PASS: IUT successfully updates DeviceInfo entry ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_004_OK

      /**
       * @desc Check that the IUT returns an error when a Service Consumer requests to update a not registered IoT device
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_004_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        var TrafficRuleDescriptor v_traffic_rule_descriptor := valueof(
                                                                      m_traffic_rule_descriptor(
                                                                                                PX_TRAFFIC_RULE_ID,
                                                                                                PX_TRAFFIC_FILTERTYPE,
                                                                                                PX_TRAFFIC_RULE_PRIORITY,
                                                                                                m_traffic_filter(
                                                                                                                  PX_TRAFFIC_FILTER_SRC_ADDRESS,
                                                                                                                  PX_TRAFFIC_FILTER_DST_ADDRESS,
                                                                                                                  PX_TRAFFIC_FILTER_SRC_PORT,
                                                                                                                  PX_TRAFFIC_FILTER_DST_PORT,
                                                                                                                  PX_TRAFFIC_FILTER_PROTOCOL
                                                                                                                  ),
                                                                                                PX_TRAFFIC_RULE_ACTION
                                                                        ));
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_patch(
                                                         PICS_ROOT_API & PX_IOT_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_UNKNOWN, "UTF-8")),
                                                         v_headers,
                                                         m_http_message_body_json(
                                                                                  m_body_json_iot_device_info(
                                                                                                              m_device_info(
                                                                                                                            PX_IOT_DEVICE_ID_1, 
                                                                                                                            PX_IOT_DEVICE_AUTH_1, 
                                                                                                                            -, 
                                                                                                                            PX_IOT_DEVICE_SUPI_1, 
                                                                                                                            PX_IOT_DEVICE_IMSI_1,
                                                                                                                            PX_REQUESTED_PLTF_ID,
                                                                                                                            {v_traffic_rule_descriptor}
                      ))))));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_404_not_found
                              )) {
            tc_ac.stop;

            log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error code ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_004_NF

      /**
       * @desc Check that the IUT returns an error when Service Consumer request to register an IoT device with incorrect parameters
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_004_BR() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        var TrafficRuleDescriptor v_traffic_rule_descriptor := valueof(
                                                                      m_traffic_rule_descriptor(
                                                                                                PX_TRAFFIC_RULE_ID,
                                                                                                PX_TRAFFIC_FILTERTYPE,
                                                                                                PX_TRAFFIC_RULE_PRIORITY,
                                                                                                m_traffic_filter(
                                                                                                                  PX_TRAFFIC_FILTER_SRC_ADDRESS,
                                                                                                                  PX_TRAFFIC_FILTER_DST_ADDRESS,
                                                                                                                  PX_TRAFFIC_FILTER_SRC_PORT,
                                                                                                                  PX_TRAFFIC_FILTER_DST_PORT,
                                                                                                                  PX_TRAFFIC_FILTER_PROTOCOL
                                                                                                                  ),
                                                                                                PX_TRAFFIC_RULE_ACTION
                                                                        ));
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_patch(
                                                          PICS_ROOT_API & PX_IOT_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_UNKNOWN, "UTF-8")),
                                                          v_headers,
                                                          m_http_message_body_json(
                                                                                   m_body_json_iot_device_info(
                                                                                                               m_device_info(
                                                                                                                             PX_IOT_DEVICE_ID_1, 
                                                                                                                             PX_IOT_DEVICE_AUTH_1, 
                                                                                                                             true, // According to Note 3 of 6.2.2-1 table, it cannot be set directly by the service consumer
                                                                                                                             PX_IOT_DEVICE_SUPI_1, 
                                                                                                                             PX_IOT_DEVICE_IMSI_1,
                                                                                                                             PX_REQUESTED_PLTF_ID,
                                                                                                                             {v_traffic_rule_descriptor}
                      ))))));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_404_not_found
                              )) {
            tc_ac.stop;

            log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error code ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_004_BR

    } // End of group patch

    group delete {
      
      /**
       * @desc Check that the IUT deregisters an IoT device information when requested by a Service Consumer specifying the IoT registered device identifier
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_005_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_delete(
                                                           PICS_ROOT_API & PX_IOT_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_2, "UTF-8")),
                                                           v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_204_no_content
                              )) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with 204 code ***");
            v_device_info_list[1].deviceId := "";
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_005_OK

      /**
       * @desc Check that the IUT deregisters an IoT device information when requested by a Service Consumer specifying the IoT registered device identifier
       */
      testcase TC_MEC_MEC033_IOTS_IOTDEV_005_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var DeviceInfoList v_device_info_list := { 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_1, PX_IOT_DEVICE_AUTH_1, -, PX_IOT_DEVICE_SUPI_1, PX_IOT_DEVICE_IMSI_1)),
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_2, PX_IOT_DEVICE_AUTH_2, -, PX_IOT_DEVICE_SUPI_2, PX_IOT_DEVICE_IMSI_2)), 
                                                    valueof(m_device_info(PX_IOT_DEVICE_ID_3, PX_IOT_DEVICE_AUTH_3, -, PX_IOT_DEVICE_SUPI_3, PX_IOT_DEVICE_IMSI_3))
                                                  };
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_IOT_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_IOT_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_device_info_list(v_device_info_list);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_delete(
                                                           PICS_ROOT_API & PX_IOT_API_SUB & "/" & oct2char(unichar2oct(PX_IOT_DEVICE_ID_UNKNOWN, "UTF-8")),
                                                           v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_404_not_found
                              )) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error code ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_device_info_list(v_device_info_list);
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC033_IOTS_IOTDEV_005_NF

    } // End of group delete

  } // End of group iotdev

  group iotpltf {
    
    group lookup {

      /**
       * @desc Check that the IUT responds with the list of registered IoT platforms when queried by a Service Consumer
       */
      testcase TC_MEC_MEC033_MEX_IOTS_IOTPLAT_001_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var IotPlatformInfoList v_iot_platform_list := { 
                                                        valueof(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
                                                                                                          )
                                                                                    }
                                                                )),
                                                        valueof(m_iot_platform_info(PX_IOT_PLTF_ID_2, 
                                                                                    {