AtsMec_RadioNodeLocationAPI_TestCases.ttcn 89 KB
Newer Older
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_post(
                                                       "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_ZONAL_TRAF_SUB_URI, "UTF-8")),
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_zonal_traffic_subscription(
                                                                                                                       m_zonal_traffic_subscription(
                                                                                                                                                    PX_CLIENT_ID, //clientCorrelator
                                                                                                                                                    PX_TRAFFIC_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                    PX_ZONE_ID // zoneId
                                                                                                                                                    )
                                                                                                                       )
                                                                                )
                                                       )
                                   )
                    );
      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_zonal_traffic_subscription(
                                                                                                                                            mw_zonal_traffic_subscription(
                                                                                                                                                                          PX_CLIENT_ID, //clientCorrelator
                                                                                                                                                                          PX_TRAFFIC_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                                          PX_ZONE_ID // zoneId
                                                                                                                                                                          )))))) -> value v_response {
          // TODO how to send this when the UE enters the area? The TP has the IUT doing this immediately. Do we want this or will it be discarded as part of the test?
               // MEC 013, clause 7.3.5.3
//               the IUT entity sends a vPOST containing
//                  Uri set to CALLBACK_URL
//                  body containing
//                     zonalPresenceNotification containing
//                        clientCorrelator set to CLIENT_ID,
//                        zoneId indicating value ZONE_ID
//                     ;
//                  ;
//               ;
//               to the MEC_APP entity

          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a circleNotificationSubscription ***");
          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_SRV_UEINFOSUB_001_OK

    /**
     * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
     */
    testcase TC_MEC_SRV_UEINFOSUB_001_BR() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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 & oct2char(unichar2oct(PX_UE_ZONAL_TRAF_SUB_URI, "UTF-8")),
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_circle_notification_subscription(
                                                                                                                      m_circle_notification_subscription(
                                                                                                                                                  PX_CLIENT_ID, //clientCorrelator
            // TODO the TP uses a wrong field name to trigger an error response. Do we create a new data structure just for this or
            // change the test to use another trigger?
                                                                                                                                                  PX_TRAFFIC_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                  PX_ZONE_ID // zoneId
                                                                                                                                                  )
                                                                                                                      )
                                                                                )
                                                       )
                                   )
                    );
      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 successfully responds with 400 Bad Request ***");
          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_SRV_UEINFOSUB_001_BR

    /**
     * @desc Check that the IUT acknowledges the cancellation of UE information change notifications when commanded by a MEC Application
     */
    testcase TC_MEC_SRV_UEINFOSUB_002_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_delete(
                                                         "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_ZONAL_TRAF_SUB_URI, "UTF-8")) & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "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 no content ***");
          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_SRV_UEINFOSUB_002_OK

    /**
     * @desc Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
     */
    testcase TC_MEC_SRV_UEINFOSUB_002_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_delete(
                                                         "/" & PICS_ROOT_API & oct2char(unichar2oct(PX_UE_ZONAL_TRAF_SUB_URI, "UTF-8")) & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "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 no 404 Not Found ***");
          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_SRV_UEINFOSUB_002_NF

  } // End of group ueInformationSubscription

   /*
    * UE Location Lookup (UELOCLOOK)
    */
  group ueLocationLookup {

    /**
     * @desc Check that the IUT responds with a list for the location of User Equipments when queried by a MEC Application
     */
    testcase TC_MEC_SRV_UELOCLOOK_001_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var HeaderLines v_headers;

        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_get(
                                                      "/" & PICS_ROOT_API & PX_UE_LOC_USERS_URI & "?zoneId=" & oct2char(unichar2oct(PX_ZONE_ID, "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_user_info(
                                                                                                                  mw_user_info(
                                                                                                                               PX_ZONE_ID // zoneId
                                                                                                                               )))))) {

          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a 200 OK ***");
          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_SRV_UELOCLOOK_001_OK

    /**
     * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
     */
    testcase TC_MEC_SRV_UELOCLOOK_001_BR() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_get(
                                                      "/" & PICS_ROOT_API & PX_UE_LOC_USERS_URI & "?zone=" & oct2char(unichar2oct(PX_ZONE_ID, "UTF-8")),
                                                      v_headers
                                                      )
                                   )
                    );
      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 successfully responds with a 400 Bad Request ***");
          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_SRV_UELOCLOOK_001_BR

    /**
     * @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
     */
    testcase TC_MEC_SRV_UELOCLOOK_001_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var HeaderLines v_headers;

        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_get(
                                                      "/" & PICS_ROOT_API & PX_UE_LOC_USERS_URI & "?zoneId=" & oct2char(unichar2oct(PX_NON_EXISTENT_ZONE_ID, "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 a 404 Not Found ***");
          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_SRV_UELOCLOOK_001_NF

  } // End of group ueLocationLookup

  /*
   * UE Location Subscription (UELOCSUB)
   */
  group ueLocationSubscription {

    /**
     * @desc Check that the IUT acknowledges the UE location change subscription request when commanded by a MEC Application and notifies it when the location changes
     */
    testcase TC_MEC_SRV_UELOCSUB_001_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_UE_LOC_USERTRACK_SUB_URI,
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_user_tracking_subscription(
                                                                                                                       m_user_tracking_subscription(
                                                                                                                                                    PX_CLIENT_ID, //clientCorrelator
                                                                                                                                                    PX_USERTRACK_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                    PX_IP_ADDRESS // address
                                                                                                                                                    )
                                                                                                                       )
                                                                                )
                                                       )
                                   )
                    );
      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_user_tracking_subscription(
                                                                                                                                            mw_user_tracking_subscription(
                                                                                                                                                                          PX_CLIENT_ID, //clientCorrelator
                                                                                                                                                                          PX_USERTRACK_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                                          PX_IP_ADDRESS // address
                                                                                                                                                                          )))))) -> value v_response {
          // TODO how to send this when the UE enters the area? The TP has the IUT doing this immediately. Do we want this or will it be discarded as part of the test?
               // MEC 013, clause 7.3.4.3
//               the IUT entity sends a vPOST containing
//                  Uri set to CALLBACK_URL
//                  body containing
//                     zonalPresenceNotification containing
//                        clientCorrelator set to CLIENT_ID,
//                        address set to IP_ADDRESS
//                     ;
//                  ;
//               ;
//               to the MEC_APP entity

          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a userTrackingSubscription ***");
          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_SRV_UELOCSUB_001_OK

    /**
     * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
     */
    testcase TC_MEC_SRV_UELOCSUB_001_BR() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_UE_LOC_USERTRACK_SUB_URI,
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_user_tracking_subscription(
                                                                                                                       m_user_tracking_subscription(
                                                                                                                                                    PX_CLIENT_ID, //clientCorrelator
            // TODO the TP uses a wrong field name to trigger an error response. Do we create a new data structure just for this or
            // change the test to use another trigger?
                                                                                                                                                    PX_USERTRACK_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                    PX_IP_ADDRESS // address
                                                                                                                                                    )
                                                                                                                       )
                                                                                )
                                                       )
                                   )
                    );
      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 successfully responds with 400 Bad Request ***");
          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_SRV_UELOCSUB_001_BR

    /**
     * @desc Check that the IUT acknowledges the cancellation of UE location change notifications when commanded by a MEC Application
     */
    testcase TC_MEC_SRV_UELOCSUB_002_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_delete(
                                                         "/" & PICS_ROOT_API & PX_UE_LOC_USERTRACK_SUB_URI & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
                                   )
                    );
      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 no content ***");
          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_SRV_UELOCSUB_002_OK

    /**
     * @desc Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
     */
    testcase TC_MEC_SRV_UELOCSUB_002_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_delete(
                                                         "/" & PICS_ROOT_API & PX_UE_LOC_USERTRACK_SUB_URI & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")),
                                   )
                    );
      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 no 404 Not Found ***");
          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_SRV_UELOCSUB_002_NF

  } // End of group ueLocationSubscription

   /*
    * UE Tracking Subscribe (UETRACKSUB)
    */
  group ueTrackingSubscribe {

    /**
     * @desc Check that the IUT acknowledges the UE location change subscription request when commanded by a MEC Application and notifies it when the UE changes location
     */
    testcase TC_MEC_SRV_UETRACKSUB_001_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_UE_PERIODIC_SUB_URI,
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_periodic_notification_subscription(
                                                                                                                               m_periodic_notification_subscription(
                                                                                                                                                                    PX_CLIENT_ID, //clientCorrelator
                                                                                                                                                                    PX_USERTRACK_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                                    PX_IP_ADDRESS // address
                                                                                                                                                                    )
                                                                                                                               )
                                                                                )
                                                       )
                                   )
                    );
      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_periodic_notification_subscription(
                                                                                                                                                    mw_periodic_notification_subscription(
                                                                                                                                                                                          PX_CLIENT_ID, //clientCorrelator
                                                                                                                                                                                          PX_USERTRACK_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                                                          PX_IP_ADDRESS // address
                                                                                                                                                                                          )))))) -> value v_response {
          // TODO how to send this when the UE enters the area? The TP has the IUT doing this immediately. Do we want this or will it be discarded as part of the test?
//               // MEC 013, clause 7.3.8.3
//               the IUT entity sends a vPOST containing
//                  uri indicating value CALLBACK_URL
//                  body containing
//                     subscriptionNotification containing
//                        terminalLocation containing
//                           address set to IP_ADDRESS
//                        ;
//                     ;
//                  ;
//               ;
//               to the MEC_APP entity
          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a periodicNotificationSubscription ***");
          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_SRV_UETRACKSUB_001_OK

    /**
     * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
     */
    testcase TC_MEC_SRV_UETRACKSUB_001_BR() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_UE_PERIODIC_SUB_URI,
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_user_tracking_subscription(
                                                                                                                       m_user_tracking_subscription(
                                                                                                                                                    PX_CLIENT_ID, //clientCorrelator
            // TODO the TP uses a wrong field name to trigger an error response. Do we create a new data structure just for this or
            // change the test to use another trigger?
                                                                                                                                                    PX_UE_PERIODIC_SUB_CALLBACK_URI, // callbackReference
                                                                                                                                                    PX_IP_ADDRESS // address
                                                                                                                                                    )
                                                                                                                       )
                                                                                )
                                                       )
                                   )
                    );
      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 successfully responds with 400 Bad Request ***");
          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_SRV_UETRACKSUB_001_BR

    /**
     * @desc Check that the IUT acknowledges the cancellation of UE tracking notifications when commanded by a MEC Application
     */
    testcase TC_MEC_SRV_UETRACKSUB_002_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_delete(
                                                         "/" & PICS_ROOT_API & PX_UE_PERIODIC_SUB_URI & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
                                   )
                    );
      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 no content ***");
          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_SRV_UETRACKSUB_002_OK

    /**
     * @desc Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
     */
    testcase TC_MEC_SRV_UETRACKSUB_002_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_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_delete(
                                                         "/" & PICS_ROOT_API & PX_UE_LOC_USERTRACK_SUB_URI & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")),
                                   )
                    );
      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 no 404 Not Found ***");
          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_SRV_UETRACKSUB_002_NF

  } // End of group ueTrackingSubscribe

} // End of module AtsMec_RadioNodeLocationAPI_TestCases