Commit 92c3d6f2 authored by Elian Kraja's avatar Elian Kraja
Browse files

Added support for notification on AMS

parent e3c32662
Loading
Loading
Loading
Loading
+598 −6
Original line number Original line Diff line number Diff line
@@ -127,9 +127,7 @@ group appMobilityServices {
            mw_http_message_body_json(
            mw_http_message_body_json(
              mw_body_json_ams_problem_details(
              mw_body_json_ams_problem_details(
                mw_problem_details(
                mw_problem_details(
                  {
                    -, -, 400
                    -, -, 400
                  }
                )
                )
              )
              )
            )
            )
@@ -346,7 +344,7 @@ group appMobilityServicesSubscriptions {
  }
  }
  
  


  testcase TP_MEC_SRV_AMS_002_BR() runs on HttpComponent system HttpTestAdapter {
  testcase TP_MEC_SRV_AMS_003_BR() runs on HttpComponent system HttpTestAdapter {
    var HeaderLines v_headers;
    var HeaderLines v_headers;
    if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)){
    if (not(PICS_AMS) or not(PICS_AMS_API_SUPPORTED)){
      log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***");
      log("*** " & testcasename() & ": PICS_AMS required for executing the TC ***");
@@ -494,14 +492,123 @@ testcase TP_MEC_SRV_AMS_004_BR() runs on HttpComponent system HttpTestAdapter {
          v_headers,
          v_headers,
          m_http_message_body_json(
          m_http_message_body_json(
            m_body_json_ams_subscriptions(
            m_body_json_ams_subscriptions(
              m_ams_subscription_error({
              m_ams_subscription_error(
                PX_SUBSCRIPTION_TYPE, PX_CALLBACK_REFERENCE, *, *, *
                PX_SUBSCRIPTION_TYPE, PX_CALLBACK_REFERENCE, *, *, *
              )
            )
          )
        )
      )
    );
    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_ams_problem_details(
                mw_problem_details(
                  {
                    -, -, 400
                  }
                  }
                )
                )
              )
              )
            )
            )
          )
          )
        )
        )
      ) 
      {
        tc_ac.stop;

        log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppMobilityServiceInfo ***");
        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

  }
  
  
  testcase TP_MEC_SRV_AMS_005_OK() runs on HttpComponent system HttpTestAdapter {
    var HeaderLines 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_get(
          "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "/" & oct2char(unichar2oct(PX_SUBSCRIPTION_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_ok(
            mw_http_message_body_json(
              mw_body_json_ams_subscriptions(
                            mw_ams_subscription(PX_SUBSCRIPTION_TYPE, *, *, *, *)
              )
            )
          )
        )
      ) 
      {
        tc_ac.stop;

        log("*** " & testcasename() & ": PASS: IUT successfully responds with the list of subscriptions type MobilityProcedureSubscription ***");
        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

  }
  

  testcase TP_MEC_SRV_AMS_005_NF() runs on HttpComponent system HttpTestAdapter {
    var HeaderLines 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_get(
          "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")),
          v_headers
        )
      )
    );
    );
    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
    f_selfOrClientSyncAndVerdict(c_prDone, e_success);


@@ -514,14 +621,175 @@ testcase TP_MEC_SRV_AMS_004_BR() runs on HttpComponent system HttpTestAdapter {
            mw_http_message_body_json(
            mw_http_message_body_json(
              mw_body_json_ams_problem_details(
              mw_body_json_ams_problem_details(
                mw_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

  }
  
  
  testcase TP_MEC_SRV_AMS_006_OK() runs on HttpComponent system HttpTestAdapter {
    var HeaderLines 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_delele(
          "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "/" & oct2char(unichar2oct(PX_SUBSCRIPTION_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_204_no_content(
          )
        )
      ) 
      {
        tc_ac.stop;

        log("*** " & testcasename() & ": PASS: IUT successfully responds with the list of subscriptions type MobilityProcedureSubscription ***");
        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

  }
  

  testcase TP_MEC_SRV_AMS_006_NF() runs on HttpComponent system HttpTestAdapter {
    var HeaderLines 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_delete(
          "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_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_404_not_found(
            mw_http_message_body_json(
              mw_body_json_ams_problem_details(
                mw_problem_details(
                    -, -, 400
                    -, -, 400
                )
              )
            )
          )
        )
      ) 
      {
        tc_ac.stop;

        log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 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

  }  
  }  


  testcase TP_MEC_SRV_AMS_007_OK() runs on HttpComponent system HttpTestAdapter {
    var HeaderLines 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_put(
          "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "/" & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
          v_headers,
          m_http_message_body_json(
            m_body_json_ams_subscriptions(
				m_ams_subscription(
					PX_SUBSCRIPTION_TYPE, PX_CALLBACK_REFERENCE, *, *, *
				)
				)
            )
            )
          )
          )
        )
        )
      )
      )
    );
    f_selfOrClientSyncAndVerdict(c_prDone, e_success);

    // Test Body
    tc_ac.start;
    alt {
      [] httpPort.receive(
        mw_http_response(
          mw_http_response_200_ok(
            mw_http_message_body_json(
              mw_body_json_ams_subscriptions(
              	mw_ams_subscription(PX_SUBSCRIPTION_TYPE, *, *, *, *)
              )
            )
          )
        )
      ) 
      ) 
      {
      {
        tc_ac.stop;
        tc_ac.stop;
@@ -538,7 +806,331 @@ testcase TP_MEC_SRV_AMS_004_BR() runs on HttpComponent system HttpTestAdapter {
  }
  }




  testcase TP_MEC_SRV_AMS_007_BR() runs on HttpComponent system HttpTestAdapter {
    var HeaderLines 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_put(
          "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "/" & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
          v_headers,
          m_http_message_body_json(
            m_body_json_ams_registration_request(
              m_registration_request({
                  m_service_consumer(PX_APP_INS_IP, *),
                  *,
                  *
                }
              )
            )
          )
        )
      )
    );
    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_ams_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

  }


  testcase TP_MEC_SRV_AMS_007_NF() runs on HttpComponent system HttpTestAdapter {
    var HeaderLines 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_put(
          "/" & PICS_ROOT_API & X_ME_APP_AMS_SUBS & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")),
          v_headers,
          m_http_message_body_json(
            m_body_json_ams_subscriptions(
				m_ams_subscription(
					PX_SUBSCRIPTION_TYPE, PX_CALLBACK_REFERENCE, *, *, *
				)
            )
          )
        )
      )
    );
    f_selfOrClientSyncAndVerdict(c_prDone, e_success);

    // Test Body
    tc_ac.start;
    alt {
      [] httpPort.receive(
        mw_http_response(
          mw_http_response_404_not_found(
            mw_http_message_body_json(
              mw_body_json_ams_problem_details(
                mw_problem_details(
                  {
                    -, -, 404
                  }
                )
              )
            )
          )
        )
      ) 
      {
        tc_ac.stop;

        log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 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

  }


}
}


  group ams_notifications {
    
    /**
     * @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();
    } 
    
    /**
     * @desc Check that the AMS service sends an AMS notification about adjacent application instances f 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;
        
        // 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");
        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(
                                	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 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 
  


} // End of module AtsMec_Ams_TestCases 
} // End of module AtsMec_Ams_TestCases 
+2 −0
Original line number Original line Diff line number Diff line
@@ -32,6 +32,8 @@ module LibMec_Pics {
  
  
  modulepar boolean PICS_AMS := true;
  modulepar boolean PICS_AMS := true;
  
  
  modulepar boolean PICS_AMS_NOTIFICATIONS := false;
    
  modulepar charstring PICS_ROOT_API := "exampleAPI";
  modulepar charstring PICS_ROOT_API := "exampleAPI";
  
  
} // End of module LibMec_Pics 
} // End of module LibMec_Pics