AtsMec_LocationAPI_TestCases.ttcn 257 KB
Newer Older
        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(
                                                                                                                                                                           -, // FIXME
                                                                                                                                                                           {
                                                                                                                                                                              *,
                                                                                                                                                                              mw_subscription(
                                                                                                                                                                                              v_user_location_event_notification.notificationType,
                                                                                                                                                                                              v_user_location_event_notification.links_.self_.href
                                                                                                                                                                                              ),
                                                                                                                                                                              *
                                                                                                                                                                           }
                              )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of notification subscriptions ***");
            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_user_location_event_subscription_id);
        f_delete_user_location_periodic_subscription(v_user_location_periodic_subscription_id);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCLOOK_002_OK_01
    
    /**
     * @desc Check that the IUT responds with the subscription when queried by a MEC Application - UE location Periodic
     */
    testcase TC_MEC_MEC013_SRV_UELOCLOOK_002_OK_02() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var UserLocationEventNotification v_user_location_event_notification;
        var charstring v_user_location_event_subscription_id;
        var UserLocationPeriodicNotification v_user_location_periodic_notification;
        var charstring v_user_location_periodic_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_user_location_event_subscription_id);
        f_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_user_location_periodic_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "?periodic",
                                                        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(
                                                                                                                                                                           -, // FIXME
                                                                                                                                                                           {
                                                                                                                                                                              *,
                                                                                                                                                                              mw_subscription(
                                                                                                                                                                                              v_user_location_periodic_notification.notificationType,
                                                                                                                                                                                              v_user_location_periodic_notification.links_.self_.href
                                                                                                                                                                                              ),
                                                                                                                                                                              *
                                                                                                                                                                           }
                              )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of notification subscriptions ***");
            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_user_location_event_subscription_id);
        f_delete_user_location_periodic_subscription(v_user_location_periodic_subscription_id);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCLOOK_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_UELOCLOOK_002_OK_03() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var UserLocationEventNotification v_user_location_event_notification_1;
        var charstring v_user_location_event_subscription_id_1;
        var UserLocationEventNotification v_user_location_event_notification_2;
        var charstring v_user_location_event_subscription_id_2;
        var UserLocationPeriodicNotification v_user_location_periodic_notification;
        var charstring v_user_location_periodic_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_1, v_user_location_event_subscription_id_1);
        f_create_user_location_event_subscription(v_user_location_event_notification_2, v_user_location_event_subscription_id_2, PX_USER_2);
        f_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_user_location_periodic_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "?event&adress=" & 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(
                                                                                                                                                                           -, // FIXME
                                                                                                                                                                           {
                                                                                                                                                                              *,
                                                                                                                                                                              mw_subscription(
                                                                                                                                                                                              v_user_location_periodic_notification.notificationType,
                                                                                                                                                                                              v_user_location_periodic_notification.links_.self_.href
                                                                                                                                                                                              ),
                                                                                                                                                                              *
                                                                                                                                                                           }
                              )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of notification subscriptions ***");
            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_user_location_event_subscription_id_1);
        f_delete_user_location_event_subscription(v_user_location_event_subscription_id_2);
        f_delete_user_location_periodic_subscription(v_user_location_periodic_subscription_id);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCLOOK_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_UELOCLOOK_002_BR() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var UserLocationEventNotification v_user_location_event_notification;
        var charstring v_user_location_event_subscription_id;
        var UserLocationPeriodicNotification v_user_location_periodic_notification;
        var charstring v_user_location_periodic_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 ***");
YannGarcia's avatar
YannGarcia committed
            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_user_location_event_subscription_id);
        f_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_user_location_periodic_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "?dummy",
                                                        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 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_event_subscription(v_user_location_event_subscription_id);
        f_delete_user_location_periodic_subscription(v_user_location_periodic_subscription_id);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCLOOK_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_UELOCLOOK_002_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var UserLocationEventNotification v_user_location_event_notification;
        var charstring v_user_location_event_subscription_id;
        var UserLocationPeriodicNotification v_user_location_periodic_notification;
        var charstring v_user_location_periodic_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_user_location_event_subscription_id);
        f_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_user_location_periodic_subscription_id);
YannGarcia's avatar
YannGarcia committed
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "?event&adress=" & PX_USER_2,
                                                        v_headers
                      )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
YannGarcia's avatar
YannGarcia committed
        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_user_location_event_subscription(v_user_location_event_subscription_id);
        f_delete_user_location_periodic_subscription(v_user_location_periodic_subscription_id);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCLOOK_002_NF

    /**
     * @desc Check that the IUT responds with the subscription when queried by a MEC Application - UE location Event
     */
    testcase TC_MEC_MEC013_SRV_UELOCLOOK_003_OK_01() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var UserLocationEventNotification v_user_location_event_notification;
        var charstring v_user_location_event_subscription_id;
        var UserLocationPeriodicNotification v_user_location_periodic_notification;
        var charstring v_user_location_periodic_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_user_location_event_subscription_id);
        f_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_user_location_periodic_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & v_user_location_event_subscription_id,
                                                        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_location_event_subscription(
                                                                                                                                           mw_user_location_event_subscription(
                                                                                                                                                                               v_user_location_event_notification.links_.self_.href
                              )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct userLocationEventSubscription ***");
            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_user_location_event_subscription_id);
        f_delete_user_location_periodic_subscription(v_user_location_periodic_subscription_id);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCLOOK_003_OK_01
    
    /**
     * @desc Check that the IUT responds with the subscription when queried by a MEC Application - UE location Periodoc
     */
    testcase TC_MEC_MEC013_SRV_UELOCLOOK_003_OK_02() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var UserLocationEventNotification v_user_location_event_notification;
        var charstring v_user_location_event_subscription_id;
        var UserLocationPeriodicNotification v_user_location_periodic_notification;
        var charstring v_user_location_periodic_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_user_location_event_subscription_id);
        f_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_user_location_periodic_subscription_id);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & v_user_location_periodic_subscription_id,
                                                        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_location_periodic_subscription(
                                                                                                                                              mw_user_location_periodic_subscription(
                                                                                                                                                                                     v_user_location_periodic_notification.links_.self_.href
                              )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct userLocationEventSubscription ***");
            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_user_location_event_subscription_id);
        f_delete_user_location_periodic_subscription(v_user_location_periodic_subscription_id);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCLOOK_003_OK_02

    /**
     * @desc Check that the IUT responds with the subscription when queried by a MEC Application - UE location Event
     */
    testcase TC_MEC_MEC013_SRV_UELOCLOOK_003_NF() 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_USERS_SUB_URI & "/" & PX_NON_EXISTENT_SUBSCRIPTION_ID,
                                                        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 userLocationEventSubscription ***");
            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_UELOCLOOK_003_NF
    
  } // End of group ueLocationLookup 
  
  group ueLocSub {
    
    /**
     * @desc Check that the IUT acknowledges the subscription by a MEC Application to notifications user location event
     */
    testcase TC_MEC_MEC013_SRV_UELOCSUB_001_OK_01_01() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var HttpMessage v_response;
        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_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
                      ))))));
        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
                                                                                                                                                                                        )))))) -> 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() & ": PASS: IUT successfully responds with a userLocationEventSubscription, 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_event_subscription(v_subscription_id);
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_001_OK_01_01
     * @desc Check that the IUT acknowledges the subscription by a MEC Application to notifications user location event
    testcase TC_MEC_MEC013_SRV_UELOCSUB_001_OK_01_02() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      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_notif_up();
      
      // Test adapter configuration
      
      // Preamble
      f_create_user_location_event_subscription(v_user_location_event_notification, v_subscription_id);
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort_notif.receive(
                                  mw_http_request(
                                                  mw_http_request_post(
                                                                        -, -,
                                                                        mw_http_message_body_json(
                                                                                                  mw_body_json_user_location_event_notification(
                                                                                                                                                mw_user_location_event_notification(
                                                                                                                                                                                    -, -,
                                                                                                                                                                                    v_user_location_event_notification.links_
                                  )))))) {
          tc_ac.stop;
          
          // Send response
          var Headers v_headers;
          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 userLocationEventNotification  ***");
          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_UELOCSUB_001_OK_01_02

    /**
     * @desc Check that the IUT acknowledges the subscription by a MEC Application to notifications user location periodic
     */
    testcase TC_MEC_MEC013_SRV_UELOCSUB_001_OK_02_01() runs on HttpComponent system HttpTestAdapter {
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
        var HttpMessage v_response;
        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_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_periodic_subscription(
                                                                                                                               m_user_location_periodic_subscription(
                                                                                                                                                                     PX_CALLBACK_REF_URL,
                                                                                                                                                                     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_201_created(
                                                                            mw_http_message_body_json(
                                                                                                      mw_body_json_user_location_periodic_subscription(
                                                                                                                                                       mw_user_location_periodic_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() & ": PASS: IUT successfully responds with a userLocationPeriodicSubscription, SubscriptionId: ", v_subscription_id," ***");
              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
        
        // Postamble
        f_delete_user_location_periodic_subscription(v_subscription_id);
YannGarcia's avatar
YannGarcia committed
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_001_OK_02_01
     * @desc Check that the IUT acknowledges the subscription by a MEC Application to notifications user location periodic
    testcase TC_MEC_MEC013_SRV_UELOCSUB_001_OK_02_02() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      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_notif_up();
      
      // Test adapter configuration
      
      // Preamble
      f_create_user_location_periodic_subscription(v_user_location_periodic_notification, v_subscription_id);
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort_notif.receive(
                                  mw_http_request(
                                                  mw_http_request_post(
                                                                        -, -,
                                                                        mw_http_message_body_json(
                                                                                                  mw_body_json_user_location_periodic_notification(
                                                                                                                                                  mw_user_location_periodic_notification(
                                                                                                                                                                                          -, -,
                                                                                                                                                                                          v_user_location_periodic_notification.links_
                                  )))))) {
          tc_ac.stop;
          
          // Send response
          var Headers v_headers;
          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 userLocationPeriodicNotification  ***");
          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_notif_down();
    } // End of testcase TC_MEC_MEC013_SRV_UELOCSUB_001_OK_02_02

    /**
     * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - Neither callbackReference nor websockNotifConfig provided
     */
    testcase TC_MEC_MEC013_SRV_UELOCSUB_001_BR_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_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_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 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_MEC013_SRV_UELOCSUB_001_BR_01
     * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - Neither callbackReference nor websockNotifConfig provided
    testcase TC_MEC_MEC013_SRV_UELOCSUB_001_BR_02() 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_post(
                                                         PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI,
                                                         v_headers,
                                                         m_http_message_body_json(
                                                                                  m_body_json_user_location_periodic_subscription(
                                                                                                                                  m_user_location_periodic_subscription(
        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 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_MEC013_SRV_UELOCSUB_001_BR_02
     * @desc Check that the IUT acknowledges the cancellation of UE location change notifications when commanded by a MEC Application
    testcase TC_MEC_MEC013_SRV_UELOCSUB_002_OK() 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_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_delete(
                                                           PICS_ROOT_API & PX_LOC_API_USERS_SUB_URI & "/" & v_subscription_id,
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_204_no_content
YannGarcia's avatar
YannGarcia committed
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with 204 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_MEC013_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_MEC013_SRV_UELOCSUB_002_NF() 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_delete(
                                                           PICS_ROOT_API & PX_LOC_API_USERS_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
YannGarcia's avatar
YannGarcia committed
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with 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_MEC013_SRV_UELOCSUB_002_NF
     * @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_01() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        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