AtsMec_LocationAPI_TestCases.ttcn 257 KB
Newer Older
        
        // Preamble
        f_create_user_location_event_subscription(v_user_location_event_notification, v_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_put(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & v_subscription_id,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_user_location_event_subscription(
                                                                                                                              m_user_location_event_subscription(
                                                                                                                                                                 PX_UE_NEW_SUB_CALLBACK_URI,
                                                                                                                                                                 PX_USER,
                                                                                                                                                                 PX_CLIENT_ID
                      ))))));
        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_location_event_subscription(
                                                                                                                                           mw_user_location_event_subscription(
                                                                                                                                                                               PX_UE_NEW_SUB_CALLBACK_URI,
                                                                                                                                                                               PX_USER,
                                                                                                                                                                               -,
                                                                                                                                                                               PX_CLIENT_ID
                              )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully updates userLocationPeriodicSubscription, SubscriptionId: ", v_subscription_id," ***");
            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_user_location_periodic_subscription(v_subscription_id);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_003_OK_01
     * @desc Check that the IUT acknowledges a request to modify an existing subscription by a MEC Application
    testcase TC_MEC_MEC013_SRV_UELOCSUB_003_OK_02() runs on HttpComponent system HttpTestAdapter {
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
        var UserLocationPeriodicNotification v_user_location_periodic_notification;
        var charstring v_subscription_id;
        
        // 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_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_put(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & v_subscription_id,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_user_location_periodic_subscription(
                                                                                                                                 m_user_location_periodic_subscription(
                                                                                                                                                                       PX_UE_NEW_SUB_CALLBACK_URI,
                                                                                                                                                                       PX_USER,
                                                                                                                                                                       PX_CLIENT_ID
                      ))))));
        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_location_periodic_subscription(
                                                                                                                                              mw_user_location_periodic_subscription(
                                                                                                                                                                                     PX_UE_NEW_SUB_CALLBACK_URI,
                                                                                                                                                                                     PX_USER,
                                                                                                                                                                                     -,
                                                                                                                                                                                     PX_CLIENT_ID
                              )))))) {
YannGarcia's avatar
YannGarcia committed
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully updates userLocationPeriodicSubscription, SubscriptionId: ", v_subscription_id," ***");
            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_user_location_periodic_subscription(v_subscription_id);
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_003_OK_02
     * @desc Check that the IUT responds with an error when received an inconsistent request
    testcase TC_MEC_MEC013_SRV_UELOCSUB_003_BR_01() runs on HttpComponent system HttpTestAdapter {
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
        var UserLocationEventNotification v_user_location_event_notification;
        var charstring v_subscription_id;
        
        // 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_create_user_location_event_subscription(v_user_location_event_notification, v_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_put(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & v_subscription_id,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_user_location_event_subscription(
                                                                                                                              m_user_location_event_subscription(
                                                                                                                                                                 "",
                                                                                                                                                                 PX_USER,
                                                                                                                                                                 PX_CLIENT_ID
                      ))))));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_400_bad_request
                              )) {
YannGarcia's avatar
YannGarcia committed
            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
        f_delete_user_location_periodic_subscription(v_subscription_id);
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_003_BR_01
     * @desc Check that the IUT responds with an error when received an inconsistent request
    testcase TC_MEC_MEC013_SRV_UELOCSUB_003_BR_02() runs on HttpComponent system HttpTestAdapter {
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
        var UserLocationPeriodicNotification v_user_location_periodic_notification;
        var charstring v_subscription_id;
        
        // 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_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_put(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & v_subscription_id,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_user_location_periodic_subscription(
                                                                                                                                 m_user_location_periodic_subscription(
                                                                                                                                                                       "",
                                                                                                                                                                       PX_USER,
                                                                                                                                                                       PX_CLIENT_ID
                      ))))));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_400_bad_request
                              )) {
YannGarcia's avatar
YannGarcia committed
            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_user_location_periodic_subscription(v_subscription_id);
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_003_BR_02
     * @desc Check that the IUT acknowledges a request to modify a not existing subscription by a MEC Application
    testcase TC_MEC_MEC013_SRV_UELOCSUB_003_NF_01() runs on HttpComponent system HttpTestAdapter {
Yann Garcia's avatar
Yann Garcia committed
        var Headers 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_put(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & PX_NON_EXISTENT_SUBSCRIPTION_ID,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_user_location_event_subscription(
                                                                                                                              m_user_location_event_subscription(
                                                                                                                                                                 PX_UE_NEW_SUB_CALLBACK_URI,
                                                                                                                                                                 PX_USER,
                                                                                                                                                                 PX_CLIENT_ID
                      ))))));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_404_not_found
                              )) {
YannGarcia's avatar
YannGarcia committed
            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_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_003_NF_01
YannGarcia's avatar
YannGarcia committed
    /**
     * @desc Check that the IUT responds with an error when received an inconsistent request
YannGarcia's avatar
YannGarcia committed
     */
    testcase TC_MEC_MEC013_SRV_UELOCSUB_003_NF_02() runs on HttpComponent system HttpTestAdapter {
YannGarcia's avatar
YannGarcia committed
        // Local variables
        var Headers v_headers;
YannGarcia's avatar
YannGarcia committed
        // 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;
        }
YannGarcia's avatar
YannGarcia committed
        // Test component configuration
        f_cf_01_http_up();
YannGarcia's avatar
YannGarcia committed
        // Test adapter configuration
YannGarcia's avatar
YannGarcia committed
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_put(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & PX_NON_EXISTENT_SUBSCRIPTION_ID,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_user_location_periodic_subscription(
                                                                                                                                 m_user_location_periodic_subscription(
                                                                                                                                                                       PX_UE_NEW_SUB_CALLBACK_URI,
                                                                                                                                                                       PX_USER,
                                                                                                                                                                       PX_CLIENT_ID
                      ))))));
YannGarcia's avatar
YannGarcia committed
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
YannGarcia's avatar
YannGarcia committed
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_404_not_found
                              )) {
YannGarcia's avatar
YannGarcia committed
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error code ***");
YannGarcia's avatar
YannGarcia committed
            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
YannGarcia's avatar
YannGarcia committed
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_003_NF_02
    
  } // End of group ueLocSub

  group ueTestNot {
     * @desc Check that the IUT provides a test notification when requested by a MEC Application
YannGarcia's avatar
YannGarcia committed
     */
    testcase TC_MEC_MEC013_SRV_UETESTNOT_001_OK() runs on HttpComponent system HttpTestAdapter {
YannGarcia's avatar
YannGarcia committed
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;
      var charstring v_subscription_id;
      
YannGarcia's avatar
YannGarcia committed
      // 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;
YannGarcia's avatar
YannGarcia committed
      }
YannGarcia's avatar
YannGarcia committed
      // Test component configuration
YannGarcia's avatar
YannGarcia committed
      // Test adapter configuration
YannGarcia's avatar
YannGarcia committed
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                    m_http_request_post(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                m_body_json_user_location_event_subscription(
                                                                                                                              m_user_location_event_subscription(
                                                                                                                                                                PX_CALLBACK_REF_URL,
                                                                                                                                                                PX_USER,
                                                                                                                                                                PX_CLIENT_ID,
                                                                                                                                                                true
                    ))))));
YannGarcia's avatar
YannGarcia committed
      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_location_event_subscription(
                                                                                                                                                  mw_user_location_event_subscription(
                                                                                                                                                                                      PX_CALLBACK_REF_URL,
                                                                                                                                                                                      PX_USER,
                                                                                                                                                                                      -,
                                                                                                                                                                                      PX_CLIENT_ID,
                                                                                                                                                                                      true
                            )))))) -> value v_response {
          tc_ac.stop;
          
          // Check HTTP Location header
          if (f_check_headers(v_response.response.header) == false) {
            log("*** " & testcasename() & ": FAIL: IUT failed in Distance subscription  ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
          } else {
            var charstring_list v_header_location;
            f_get_header(v_response.response.header, "Location", v_header_location);
            v_subscription_id := regexp(
                                        v_header_location[0],
                                        "?+" & PX_LOC_API_USERS_SUB_URI & "/(?*)",
                                        0
                                        );

            log("*** " & testcasename() & ": INFO: IUT successfully responds with a userLocationEventSubscription, SubscriptionId: ", v_subscription_id," ***");
            repeat; // Wait for test notification
          }
        }
        [] httpPort_notif.receive(
                                  mw_http_request(
                                                  mw_http_request_post(
                                                                      -,
                                                                      -,
                                                                      mw_http_message_body_json(
                                                                                                mw_body_json_test_notification(
                                                                                                                               mw_test_notification(
                                                                                                                                                    v_response.response.body.json_body.userLocationEventNotification.links_
                                  )))))) {
          tc_ac.stop;

          // Send response
          f_init_default_headers_list(-, -, v_headers);
          httpPort_notif.send(m_http_response(m_http_response_ok_no_body(v_headers)));

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a userAreaNotification  ***");
          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_user_location_event_subscription(v_subscription_id);
      f_cf_01_http_notif_down();
    } // End of testcase TC_MEC_MEC013_SRV_UETESTNOT_001_OK
    /**
     * @desc Check that the IUT terminates notifications after time expiration
     */
    testcase TC_MEC_MEC013_SRV_UETESTNOT_002_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;
      var charstring v_subscription_id;
      var boolean v_notification_received_after_expiry := false;
      timer tc_expiry := PX_NOTIF_EXPIRY;
      timer tc_expiry_guard := PX_NOTIF_EXPIRY / 2.0;
      
      // 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_notif_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_LOC_API_USERS_SUB_URI,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_user_location_event_subscription(
                                                                                                                              m_user_location_event_subscription(
                                                                                                                                                                PX_CALLBACK_REF_URL,
                                                                                                                                                                PX_USER,
                                                                                                                                                                PX_CLIENT_ID,
                                                                                                                                                                -, -, -, -,
                                                                                                                                                                m_time_stamp(
                                                                                                                                                                             float2int(PX_NOTIF_EXPIRY)
                    )))))));
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
YannGarcia's avatar
YannGarcia committed
      // Test Body
      tc_ac.start;
YannGarcia's avatar
YannGarcia committed
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                              mw_http_response_201_created(
                                                                          mw_http_message_body_json(
                                                                                                    mw_body_json_user_location_event_subscription(
                                                                                                                                                  mw_user_location_event_subscription(
                                                                                                                                                                                      PX_CALLBACK_REF_URL,
                                                                                                                                                                                      PX_USER,
                                                                                                                                                                                      -,
                                                                                                                                                                                      PX_CLIENT_ID
                            )))))) -> value v_response {
YannGarcia's avatar
YannGarcia committed
          tc_ac.stop;
          
          // Check HTTP Location header
          if (f_check_headers(v_response.response.header) == false) {
            log("*** " & testcasename() & ": FAIL: IUT failed in Distance subscription  ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
          } else {
            var charstring_list v_header_location;
            f_get_header(v_response.response.header, "Location", v_header_location);
            v_subscription_id := regexp(
                                        v_header_location[0],
                                        "?+" & PX_LOC_API_USERS_SUB_URI & "/(?*)",
                                        0
                                        );
            log("*** " & testcasename() & ": INFO: IUT successfully responds with a userLocationEventSubscription, SubscriptionId: ", v_subscription_id," ***");
            tc_ac.start;
            repeat; // Wait for test notification
          }
        }
        [] httpPort_notif.receive(
                                  mw_http_request(
                                                  mw_http_request_post(
                                                                      -,
                                                                      -,
                                                                      mw_http_message_body_json(
                                                                                                mw_body_json_test_notification(
                                                                                                                               mw_test_notification(
                                                                                                                                                    v_response.response.body.json_body.userLocationEventNotification.links_
                                  )))))) {
          tc_ac.stop;

          // Send response
          f_init_default_headers_list(-, -, v_headers);
          httpPort_notif.send(m_http_response(m_http_response_ok_no_body(v_headers)));

          log("*** " & testcasename() & ": INFO: Receive new notification  ***");

          v_notification_received_after_expiry := true;
          tc_ac.start;
          repeat;
        }
        [] tc_expiry.timeout {
          v_notification_received_after_expiry := false;
          tc_expiry_guard.start;
          repeat;
        }
        [] tc_expiry_guard.timeout {
          if (v_notification_received_after_expiry) {
            log("*** " & testcasename() & ": FAIL: Received notification after expiration time ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
          } else {
            log("*** " & testcasename() & ": PASS: No more notification received  ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);            
          }
YannGarcia's avatar
YannGarcia committed
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
YannGarcia's avatar
YannGarcia committed
      // Postamble
      f_delete_user_location_event_subscription(v_subscription_id);
      f_cf_01_http_notif_down();
    } // End of testcase TC_MEC_MEC013_SRV_UETESTNOT_002_OK
  } // End of group ueTestNot
3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000

    /**
     * @desc Check that the IUT responds with a list zones when queried by a MEC Application
     */
    testcase TC_MEC_MEC013_SRV_UEZONELOOK_001_OK() 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_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_LOC_API_ZONES_SUB_URI,
                                                        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_notification_subscription_list(
                                                                                                                                       mw_notification_subscription_list
                            ))))) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of ZoneSubscription ***");
          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_MEC013_SRV_UEZONELOOK_001_OK
    
    /**
     * @desc Check that the IUT responds with the subscription when queried by a MEC Application - Zone location Event
     */
    testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_OK_01() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var ZoneLocationEventNotification v_zone_location_event_notification;
      var charstring v_subscription_id;
      
      // 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_create_zone_location_event_subscription(v_zone_location_event_notification, v_subscription_id);
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                    m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_ZONES_SUB_URI & "?event",
                                                        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_notification_subscription_list(
                                                                                                                                       mw_notification_subscription_list(
                                                                                                                                                                         -,
                                                                                                                                                                         {
                                                                                                                                                                            *, 
                                                                                                                                                                            mw_subscription(
                                                                                                                                                                                            "ZoneLocationEventSubscription", 
                                                                                                                                                                                            v_zone_location_event_notification.links_.self_.href
                                                                                                                                                                                            ), 
                                                                                                                                                                            *
                                                                                                                                                                         }
                            )))))) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of ZoneSubscription ***");
          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_zone_location_event_subscription(v_subscription_id);
      f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_OK_01
    
    /**
     * @desc Check that the IUT responds with the subscription when queried by a MEC Application - Zone Status
     */
    testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_OK_02() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var ZoneStatusNotification v_zone_status_notification;
      var charstring v_subscription_id;
      
      // 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_create_zone_status_subscription(v_zone_status_notification, v_subscription_id);
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                    m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_ZONES_SUB_URI & "?status",
                                                        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_notification_subscription_list(
                                                                                                                                       mw_notification_subscription_list(
                                                                                                                                                                         -,
                                                                                                                                                                         {
                                                                                                                                                                            *, 
                                                                                                                                                                            mw_subscription(
                                                                                                                                                                                            "ZoneStatusSubscription", 
                                                                                                                                                                                            v_zone_status_notification.links_.self_.href
                                                                                                                                                                                            ), 
                                                                                                                                                                            *
                                                                                                                                                                         }
                            )))))) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of ZoneSubscription ***");
          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_zone_status_subscription(v_subscription_id);
      f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_OK_02
    
    /**
     * @desc Check that the IUT responds with the subscription when queried by a MEC Application - UE location Event and address
     */
    testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_OK_03() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var ZoneLocationEventNotification v_zone_location_event_notification_1, v_zone_location_event_notification_2;
      var ZoneStatusNotification v_zone_status_notification;
      var charstring v_subscription_id_event_1, v_subscription_id_event_2;
      var charstring v_subscription_id_status;
      
      // 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_create_zone_location_event_subscription(v_zone_location_event_notification_1, v_subscription_id_event_1);
      f_create_zone_location_event_subscription(v_zone_location_event_notification_2, v_subscription_id_event_2, PX_USER_2);
      f_create_zone_status_subscription(v_zone_status_notification, v_subscription_id_status);
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                    m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_ZONES_SUB_URI & "?event&address=" & PX_USER_2,
                                                        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_notification_subscription_list(
                                                                                                                                       mw_notification_subscription_list(
                                                                                                                                                                         -,
                                                                                                                                                                         {
                                                                                                                                                                            *, 
                                                                                                                                                                            mw_subscription(
                                                                                                                                                                                            "ZoneLocationEventSubscription.", 
                                                                                                                                                                                            v_zone_location_event_notification_2.links_.self_.href
                                                                                                                                                                                            ), 
                                                                                                                                                                            *
                                                                                                                                                                         }
                            )))))) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of ZoneSubscription ***");
          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_zone_location_event_subscription(v_subscription_id_event_1);
      f_delete_zone_location_event_subscription(v_subscription_id_event_2);
      f_delete_zone_status_subscription(v_subscription_id_status);
      f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_OK_03
    
    /**
     * @desc Check that the IUT responds with an error when inconsistent request was sent by a MEC Application - Invalid filter
     */
    testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_BR() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var ZoneLocationEventNotification v_zone_location_event_notification_1, v_zone_location_event_notification_2;
      var ZoneStatusNotification v_zone_status_notification;
      var charstring v_subscription_id_event_1, v_subscription_id_event_2;
      var charstring v_subscription_id_status;
      
      // 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_create_zone_location_event_subscription(v_zone_location_event_notification_1, v_subscription_id_event_1);
      f_create_zone_location_event_subscription(v_zone_location_event_notification_2, v_subscription_id_event_2, PX_USER_2);
      f_create_zone_status_subscription(v_zone_status_notification, v_subscription_id_status);
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                    m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_ZONES_SUB_URI & "?event&address", // Invalid filter
                                                        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 list of ZoneSubscription ***");
          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_zone_location_event_subscription(v_subscription_id_event_1);
      f_delete_zone_location_event_subscription(v_subscription_id_event_2);
      f_delete_zone_status_subscription(v_subscription_id_status);
      f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_BR
    
    /**
     * @desc Check that the IUT responds with an error when inconsistent request was sent by a MEC Application
     */
    testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var ZoneLocationEventNotification v_zone_location_event_notification;
      var ZoneStatusNotification v_zone_status_notification;
      var charstring v_subscription_id_event;
      var charstring v_subscription_id_status;
      
      // 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_create_zone_location_event_subscription(v_zone_location_event_notification, v_subscription_id_event);
      f_create_zone_status_subscription(v_zone_status_notification, v_subscription_id_status);
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                    m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_ZONES_SUB_URI & "?event&address=" & PX_USER_2,
                                                        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_zone_location_event_subscription(v_subscription_id_event);
      f_delete_zone_status_subscription(v_subscription_id_status);
      f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UEZONELOOK_002_NF
    
    /**
     * @desc Check that the IUT responds with the subscription when queried by a MEC Application - Zone location Event
     */
    testcase TC_MEC_MEC013_SRV_UEZONELOOK_003_OK_01() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var ZoneLocationEventNotification v_zone_location_event_notification;
      var charstring v_subscription_id;
      
      // 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_create_zone_location_event_subscription(v_zone_location_event_notification, v_subscription_id);
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                    m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_ZONES_SUB_URI & "/" & v_subscription_id,
                                                        v_headers
                    )));
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);