AtsMec_Ams_TestCases.ttcn 42.9 KB
Newer Older
       * @desc Check that the AMS service sends an AMS notification  about a mobility procedure if the AMS service has an associated subscription and the event is generated
       * @see  ETSI GS MEC 021 2.0.8, clause 7.4.2
       */
      testcase TP_MEC_SRV_AMS_008_OK() runs on HttpComponent system HttpTestAdapter {
          // Local variables
          var HeaderLines v_headers;
          
          // Test control
          if (not(PICS_AMS) or not(PICS_AMS_NOTIFICATIONS)) {
              log("*** " & testcasename() & ": PICS_AMS and PICS_AMS_NOTIFICATIONS 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);
          action("Trigger a mobility procedure event");
          f_selfOrClientSyncAndVerdict(c_prDone, e_success);
          
          // Test Body
          tc_wait.start;
          alt {
            [] httpPort_notif.receive(
            		mw_http_request(
                  	mw_http_request_post(
                      	PX_CALLBACK_URI,
                          -,
                      	mw_http_message_body_json(
                          	mw_body_json_mobility_procedure_notification(
                              	mw_mobility_procedure_notification(
                              		-,
                                  	PX_CALLBACK_REFERENCE,
                                  	-,
                                  	-,
                                  	-
                                  )
                              )
                          )
                      )
                  )
              ) {
              tc_wait.stop;
              log("*** " & testcasename() & ": INFO: IUT successfully sends mobility procedure notification ***");
              
              // Send 204 No Content
              httpPort_notif.send(m_http_response(m_http_response_204_no_content(v_headers)));
              
              log("*** " & testcasename() & ": PASS: IUT successfully sends mobility procedure notification ***");
              f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
            }
            [] tc_wait.timeout {
              log("*** " & testcasename() & ": INCONC: Expected message not received ***");
              f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
            }
          } // End of 'alt' statement
          
          // Postamble
          f_cf_01_http_notif_down();
      } // End of TP_MEC_SRV_AMS_008_OK
      
      /**
       * @desc Check that the AMS service sends an AMS notification about adjacent application instances if the AMS service has an associated subscription and the event is generated
       * @see  ETSI GS MEC 021 2.0.8, clause 7.4.3
       */
    testcase TP_MEC_SRV_AMS_009_OK() runs on HttpComponent system HttpTestAdapter {
          // Local variables
          var HeaderLines v_headers;
          
          // Test control
          if (not(PICS_AMS) or not(PICS_AMS_NOTIFICATIONS)) {
              log("*** " & testcasename() & ": PICS_AMS and PICS_AMS_NOTIFICATIONS 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);
          action("Trigger a adjacent application info event");
          f_selfOrClientSyncAndVerdict(c_prDone, e_success);
          
          // Test Body
          tc_wait.start;
          alt {
            [] httpPort_notif.receive(
            		mw_http_request(
                  	mw_http_request_post(
                      	PX_CALLBACK_URI,
                          -,
                      	mw_http_message_body_json(
                          	mw_body_json_adjacent_application_info_notification(
                              	mw_adjacent_application_info_notification(
                              		-,
                                  	PX_CALLBACK_REFERENCE,
                                  	-,
                                  	-,
                                  	-
                                  )
                              )
                          )
                      )
                  )
              ) {
              tc_wait.stop;
              log("*** " & testcasename() & ": INFO: IUT successfully sends adjacent application info notification ***");
              
              // Send 204 No Content
              httpPort_notif.send(m_http_response(m_http_response_204_no_content(v_headers)));
              
              log("*** " & testcasename() & ": PASS: IUT successfully sends adjacent application info notification ***");
              f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
            }
            [] tc_wait.timeout {
              log("*** " & testcasename() & ": INCONC: Expected message not received ***");
              f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
            }
          } // End of 'alt' statement
          
          // Postamble
          f_cf_01_http_notif_down();
      } 
      
      
     /**
       * @desc Check that the AMS service sends an AMS notification on subscription expiration if the AMS service has an associated subscription and the event is generated
       * @see  ETSI GS MEC 021 2.0.8, clause 7.4.4
       */  
    testcase TP_MEC_SRV_AMS_010_OK() runs on HttpComponent system HttpTestAdapter {
          // Local variables
          var HeaderLines v_headers;
          var UInt64 v_timestamp;
          
          // Test control
          if (not(PICS_AMS) or not(PICS_AMS_NOTIFICATIONS)) {
              log("*** " & testcasename() & ": PICS_AMS and PICS_AMS_NOTIFICATIONS 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);
          action("Trigger a expire notification event");
          v_timestamp := f_get_current_timestamp_utc();
          f_selfOrClientSyncAndVerdict(c_prDone, e_success);
          
          // Test Body
          tc_wait.start;
          alt {
            [] httpPort_notif.receive(
            		mw_http_request(
                  	mw_http_request_post(
                      	PX_CALLBACK_URI,
                          -,
                      	mw_http_message_body_json(
                          	mw_body_json_expire_notification(
                              	mw_expire_notification(
                                  	-,
                                  	-,
                                  	{ seconds := v_timestamp / 1000, nanoSeconds := 1000 * v_timestamp mod 1000 }
                                  )
                              )
                          )
                      )
                  )
              ) {
              tc_wait.stop;
              log("*** " & testcasename() & ": INFO: IUT successfully sends adjacent application info notification ***");
              
              // Send 204 No Content
              httpPort_notif.send(m_http_response(m_http_response_204_no_content(v_headers)));
              
              log("*** " & testcasename() & ": PASS: IUT successfully sends adjacent applicationinfo notification ***");
              f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
            }
            [] tc_wait.timeout {
              log("*** " & testcasename() & ": INCONC: Expected message not received ***");
              f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
            }
          } // End of 'alt' statement
          
          // Postamble
          f_cf_01_http_notif_down();
      } 
  
  
  
    } // End of group ams_notifications 
  
Elian Kraja's avatar
Elian Kraja committed
} // End of module AtsMec_Ams_TestCases