Skip to content
AtsMec_ApplicationMobiltyServiceAPI_TestCases.ttcn 62.4 KiB
Newer Older
/**
*    @author   ETSI / STF569
*    @version  $URL:$
*              $ID:$
*    @desc     This module provides the MEC test cases.
*    @copyright   ETSI Copyright Notification
*                 No part may be reproduced except as authorized by written permission.
*                 The copyright and the foregoing restriction extend to reproduction in all media.
*                 All rights reserved.
*    @see      ETSI GS MEC 003, Draft ETSI GS MEC 021 V2.1.1
*/
  module AtsMec_ApplicationMobiltyServiceAPI_TestCases {
  
  // Libcommon
  import from LibCommon_BasicTypesAndValues all;
  import from LibCommon_Sync all;
  
  // LibHttp
  import from LibHttp_TypesAndValues all;
  import from LibHttp_Functions all;
  import from LibHttp_Templates all;
  import from LibHttp_JsonTemplates all;
  import from LibHttp_TestSystem all;
  
  // LibMec_ApplicationMobiltyServiceAPI
  import from ApplicationMobilityServiceAPI_Templates all;
  import from ApplicationMobilityServiceAPI_Pics all;
  import from ApplicationMobilityServiceAPI_Pixits all;
  
  // LibMec
  import from LibMec_TypesAndValues all;
  import from LibMec_Templates all;
  import from LibMec_Functions all;
  import from LibMec_Pics all;
  import from LibMec_Pixits all;
  
  group appMobilityServices {
  
   	/**
       * @desc Check that the AMS service returns information about the registered application mobility services when requested
       * @see  ETSI GS MEC 021 2.1.1, clause 8.3.3.1
       */
      // testcase TC_MEC_MEC012_SRV_AMS_001_OK() runs on HttpComponent system HttpTestAdapter {
      //   // Local variables
      //   var Headers v_headers;
      //   var HttpMessage v_response;
  
      //   // Test control
      //   if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)) {
      //     log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***");
      //     setverdict(inconc);
      //     stop;
      //   }
  
      //   // Test component configuration
      //   f_cf_01_http_up();
  
      //   // Preamble
      //   f_init_default_headers_list(-, -, v_headers);
      //   httpPort.send(
      //                 m_http_request(
      //                                m_http_request_get(
      //                                                   "/" & PICS_ROOT_API & PX_ME_APP_AMS_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_app_mobility_service_info(
      //                                                                                                                               mw_app_mobility_service_info(
      //                                                                                                                                                            {
      //                                                                                                                                                              mw_app_mobility_registration_info(
      //                                                                                                                                                                                                mw_service_consumer_id(
      //                                                                                                                                                                                                                       PX_APP_INS_ID,
      //                                                                                                                                                                                                                       PX_MEP_ID
      //                                                                                                                                                                                                                       )
      //                                                                                                                                                                                                )
      //                                                                                                                                                              }
      //                         )))))) -> value v_response {
      //       tc_ac.stop;
            
      //       if (f_check_headers(valueof(v_response.response.header)) == true) {
      //         log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppTerminationNotificationSubscription ***");
      //         f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
      //       } else {
      //         log("*** " & testcasename() & ": FAIL: Header 'Location' was not present in the response headers ***");
      //         f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
      //       }
      //     }
      //     [] tc_ac.timeout {
      //       log("*** " & testcasename() & ": INCONC: Expected message not received ***");
      //       f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
      //     }
      //   } // End of 'alt' statement
      // } // End of testcase TC_MEC_MEC012_SRV_AMS_001_OK
  
  	/**
       * @desc Check that the AMS service returns an error when receives a query about a registered application mobility service with wrong parameters
       * @see  ETSI GS MEC 021 2.1.1, clause 8.3.3.1
       */
      testcase TC_MEC_MEC012_SRV_AMS_001_BR() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
  
        // Test control
        if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
  
        // Test component configuration
        f_cf_01_http_up();
  
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        "/" & PICS_ROOT_API & PX_ME_APP_AMS_URI & "?appMobilityService=" & oct2char(unichar2oct(PX_APP_MOBILITY_SERVICE_ID, "UTF-8")),
                                                        v_headers
                                                        )));
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
  
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_400_bad_request(
                                                                                mw_http_message_body_json(
                                                                                                          mw_body_json_problem_details(
                                                                                                                                       mw_problem_details(
                                                                                                                                                          -, 
                                                                                                                                                          -, 
                                                                                                                                                          400
                                                                                                                                                          )))))) {
            tc_ac.stop;
  
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 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
  
      }  // End of testcase TC_MEC_MEC012_SRV_AMS_001_BR
      
      
  	/**
       * @desc Check that the AMS service creates a new application mobility services when requested
       * @see  ETSI GS MEC 021 2.1.1, clause 8.3.3.4
       */
  	testcase TC_MEC_MEC012_SRV_AMS_002_OK() runs on HttpComponent system HttpTestAdapter {
      	var Headers v_headers;
      	if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)) {
      		log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***");
        		setverdict(inconc);
        		stop;
      	}
  
      	// Test component configuration
      	f_cf_01_http_up();
  
  
      	// Preamble
      	f_init_default_headers_list(-, -, v_headers);
      	httpPort.send(
        		m_http_request(
          		m_http_request_post(
            			"/" & PICS_ROOT_API & PX_ME_APP_AMS_URI,
            			v_headers,
            			m_http_message_body_json(
              			m_body_json_ams_registration_info(
                				m_registration_info(
                            PX_APP_MOBILITY_SERVICE_ID,
                    				m_service_consumer_id(
                    					PX_APP_INS_ID, 
                    					-
                    				),
                    			-,
                    			-
                				)
              			)
            			)
          		)
        		)
      	);
      	f_selfOrClientSyncAndVerdict(c_prDone, e_success);
  
      	// Test Body
      	tc_ac.start;
Loading full blame...