Commit d4d66f28 authored by YannGarcia's avatar YannGarcia
Browse files

Add support of userTracking

parent 1cdc329a
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -20,6 +20,10 @@ int json_codec::encode (const LibItsHttp__JsonMessageBodyTypes::JsonBody& msg, O
    const UEidentityAPI__TypesAndValues::UeIdentityTagInfo& ue_identity_tag_info = msg.ueIdentityTagInfo();
    ue_identity_tag_info.encode(UEidentityAPI__TypesAndValues::UeIdentityTagInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
  } else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_userTrackingSubscription)) {
    const LocationAPI__TypesAndValues::UserTrackingSubscription& user_tracking_subscription = msg.userTrackingSubscription();
    user_tracking_subscription.encode(LocationAPI__TypesAndValues::UserTrackingSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = char2oct(CHARSTRING("{\"userTrackingSubscription\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}"));
  } else {
    loggers::get_instance().error("json_codec::encode: Not supported");
  }
@@ -69,6 +73,10 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
    RnisAPI__TypesAndValues::SubscriptionLinkList subscription_link_list;
    subscription_link_list.decode(RnisAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.subscriptionLinkList() = subscription_link_list;
  } else if (it->second.find("\"userTrackingSubscription\"") != std::string::npos) {
    LocationAPI__TypesAndValues::UserTrackingSubscription user_tracking_subscription;
    user_tracking_subscription.decode(LocationAPI__TypesAndValues::UserTrackingSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.userTrackingSubscription() = user_tracking_subscription;
  } else if (it->second.find("\"userInfo\"") != std::string::npos) {
    LocationAPI__TypesAndValues::UserInfo user_info;
    user_info.decode(LocationAPI__TypesAndValues::UserInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ LocationAPI_Pics.PICS_LOCATION_API_SUPPORTED := true

UEidentityAPI_Pics.PICS_UE_IDENTITY_API_SUPPORTED    := true

BwManagementAPI_Pics.PICS_BWMANAGEMENT_API_SUPPORTED := false
BwManagementAPI_Pics.PICS_BWMANAGEMENT_API_SUPPORTED := true

[LOGGING]
# In this section you can specify the name of the log file and the classes of events
+131 −5
Original line number Diff line number Diff line
@@ -34,14 +34,14 @@ module AtsMec_LocationAPI_TestCases {
  import from LibMec_Pics all;
  import from LibMec_Pixits all;
  
  group me_app_role {
  group location {
    
    /**
     * @desc Check that the IUT responds with a list for the location of User Equipments when queried by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeLocation/PlatUeLocation.tplan2
     * @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml
     * @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/UserInfo
     */
    testcase TC_MEC_PLAT_MP1_LOC_BV_001() runs on HttpComponent system HttpTestAdapter {
    testcase TC_MEC_PLAT_LOC_001_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
@@ -96,8 +96,134 @@ module AtsMec_LocationAPI_TestCases {
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_LOC_BV_001
    } // End of testcase TC_MEC_PLAT_LOC_001_OK
    
  } // End of group me_app_role 
  } // End of group location 
  
  group subscription {
    
    /**
     * @desc Check that the IUT acknowledges the UE location change subscription request when commanded by a MEC Application and notifies it when the location changes
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeLocation/PlatUeLocation.tplan2
     * @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/UserTrackingSubscription
     */
    testcase TC_MEC_PLAT_LOCSUB_001_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT 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(
                                                         PX_ME_APP_Q_USERS_SUB_URI,
                                                         v_headers,
                                                         m_http_message_body_json(
                                                                                  m_body_json_user_tracking_subscription(
                                                                                                                         m_user_tracking_subscription(
                                                                                                                                                      PX_CLIENT_ID,
                                                                                                                                                      PX_CALLBACK_REF_URL,
                                                                                                                                                      PX_USER
                                                                                                                                                      )
                                                                                                                         )
                                                                                  )
                                                         )
                                      )
                      );
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_201_created(
                                                                            mw_http_message_body_json(
                                                                                                      mw_body_json_user_tracking_subscription(
                                                                                                                                              mw_user_tracking_subscription_response(
                                                                                                                                                                                     PX_CLIENT_ID,
                                                                                                                                                                                     PX_CALLBACK_REF_URL,
                                                                                                                                                                                     PX_USER
                                                                                                                                              )))))) -> value v_response {
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a ressourceURL ***");
            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_PLAT_LOCSUB_001_OK
    
    /**
     * @desc Check that the IUT acknowledges the cancellation of UE location change notifications when commanded by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeLocation/PlatUeLocation.tplan2
     */
    testcase TC_MEC_PLAT_LOCSUB_002_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT 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(
                                                        PX_ME_APP_Q_USERS_SUB_URI & "/" & PX_SUBSCRIPTION_ID, // TODO Shall be extract from Subscription request
                                                        v_headers
                                                        )
                                     )
                      );
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok
                                               )) -> value v_response {
            log("*** " & testcasename() & ": PASS: IUT successfully cancel subscription ***");
            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_PLAT_LOCSUB_002_OK
    
  } // End of group subscription
  
} // End of module AtsMec_LocationAPI_TestCases 
+2 −2
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/RadioNode/PlatRadioNodeLocation.tplan2
     * @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/AccessPointList
     */
    testcase TC_MEC_PLAT_MP1_RLOC_BV_001() runs on HttpComponent system HttpTestAdapter {
    testcase TC_MEC_PLAT_RLOC_001_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
@@ -92,7 +92,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_RLOC_BV_001
    } // End of testcase TC_MEC_PLAT_RLOC_001_OK
    
  } // End of group me_app_role 
  
+5 −7
Original line number Diff line number Diff line
@@ -24,7 +24,11 @@ module AtsMec_TestControl {
    
    if (PICS_MEC_PLAT) {
      if (PICS_LOCATION_API_SUPPORTED) {
        execute(TC_MEC_PLAT_MP1_LOC_BV_001());
        execute(TC_MEC_PLAT_LOC_001_OK());
        execute(TC_MEC_PLAT_INFLOOK_001_OK());
        execute(TC_MEC_PLAT_LOCSUB_001_OK());
        execute(TC_MEC_PLAT_LOCSUB_002_OK());
        execute(TC_MEC_PLAT_RLOC_001_OK());
      }
      if (PICS_UE_IDENTITY_API_SUPPORTED) {
        execute(TC_MEC_PLAT_UETAG_001_OK());
@@ -35,12 +39,6 @@ module AtsMec_TestControl {
        execute(TP_MEC_PLAT_UETAG_003_BI());
        execute(TP_MEC_PLAT_UETAG_004_BI());
      }
      if (PICS_LOCATION_API_SUPPORTED) {
        execute(TC_MEC_PLAT_INFLOOK_001_OK());
      }
      if (PICS_LOCATION_API_SUPPORTED) {
        execute(TC_MEC_PLAT_MP1_RLOC_BV_001());
      }
    }

    if (PICS_RNIS) {
Loading