AtsMec_AppLifecycleManagement_TestCases.ttcn 58.6 KB
Newer Older
Elian Kraja's avatar
Elian Kraja committed
          					)
          				)
                	)
          )) -> value v_response {
          tc_ac.stop;
          log("*** " & testcasename() & ": PASS: IUT successfully responds with App LCM Operation Occurrencies info and 200 status 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
    } // End of testcase TC_MEC_MEC010p2_MEX_LCM_008_OK
Elian Kraja's avatar
Elian Kraja committed

    /**
    * @desc: Check that MEC API provider service retrieves info about LCM Operation Occurrency on an App Instance when requested
    *        ETSI GS MEC 010-2 2.0.10, clause 7.5.9.3.2
    *		 ETSI GS MEC 010-2 2.0.10, table 6.2.2.14.2-1" 	//AppLcmOpOcc 
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_009_OK() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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_MEX_LCM_OP_OCC_URI & oct2char(unichar2oct(PX_APP_LCM_OP_OCC_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_lifecycle_op_occ(
                             mw_lifecycle_management_op_occ(
                             	PX_APP_LCM_OP_OCC_ID
                             )
          					)
          				)
                	)
          )) -> value v_response {
          tc_ac.stop;
          log("*** " & testcasename() & ": PASS: IUT successfully responds with the requested App LCM Operation Occurrency and 200 status 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
    } // End of testcase TC_MEC_MEC010p2_MEX_LCM_009_OK
Elian Kraja's avatar
Elian Kraja committed

    /**
    * @desc:Check that MEC API provider service sends an error when it receives a query for a not existing LCM Operation Occurrency
    *        ETSI GS MEC 010-2 2.0.10, clause 7.5.9.3.2
    *		 ETSI GS MEC 010-2 2.0.10, table 6.2.2.14.2-1" 	//AppLcmOpOcc 
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_009_NF() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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_MEX_LCM_OP_OCC_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_LCM_OP_OCC_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(
                	)
          )) -> value v_response {
          tc_ac.stop;
          log("*** " & testcasename() & ": PASS: IUT successfully responds with 404 not found status 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
    } // End of testcase TC_MEC_MEC010p2_MEX_LCM_009_NF
Elian Kraja's avatar
Elian Kraja committed


     
} // End of App_lifecycle_management




group app_lcm_subscriptions {
  
	/**
    * @desc: Check that MEC API provider service creates a LCM Subscription when requested, 
  	*		 where the subscription request can have SUBSCRIPTION_TYPE:
	*			- AppInstanceStateChangeSubscription
    *           - AppLcmOpOccStateChangeSubscription
    *        ETSI GS MEC 010-2 2.0.10, clause 7.5.3.3.1
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.13.2-1   //AppInstSubscriptionRequest
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.10.2-1   //AppInstSubscriptionInfo
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_010_OK() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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_MEX_LCM_SUBS,
                        v_headers,
                        m_http_message_body_json(
                        	m_body_json_lcm_subscribe(
                        		m_app_lcm_subscribe_request(
									PX_SUBSCRIPTION_TYPE,
                        			PX_CALLBACK_URI
								)
                        	)
                        )
                  )
            ));
                
        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_lcm_subscription(
								mw_app_lcm_subscription_info(
									-,
									PX_SUBSCRIPTION_TYPE,
									PX_CALLBACK_URI)
									
          ))))) -> value v_response {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with the new created 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
    } // End of testcase TC_MEC_MEC010p2_MEX_LCM_010_OK
Elian Kraja's avatar
Elian Kraja committed



	/**
    * @desc: Check that MEC API providerservice sends an error when it receives a 
	*		 malformed request to create a LCM Subscription
    *        ETSI GS MEC 010-2 2.0.10, clause 7.5.3.3.1
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.13.2-1   //AppInstSubscriptionRequest
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_010_BR() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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_MEX_LCM_SUBS,
                        v_headers,
                        m_http_message_body_json(
                        	m_body_json_lcm_subscribe_with_error(
                        		m_app_lcm_subscribe_request_with_error(
									PX_SUBSCRIPTION_TYPE,
                        			PX_CALLBACK_URI
								)
                        	)
                        )
                  )
            ));
                
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);

        // Test Body
        tc_ac.start;
        alt {
            [] httpPort.receive(
                mw_http_response(
                    mw_http_response_400_bad_request(
			))) -> value v_response {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds a 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_MEC010p2_MEX_LCM_010_BR
Elian Kraja's avatar
Elian Kraja committed


	/**
    * @desc: Check that MEC API provider service sends the list of LCM Subscriptions when requested
    *        ETSI GS MEC 010-2 2.0.10, clause 7.5.3.3.2
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.13.2-1   // AppInstSubscriptionRequest
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.15.2-1   // AppLcmOpOccSubscriptionRequest
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.10.2-1   // AppInstSubscriptionInfo
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.16.2-1   // AppLcmOpOccSubscriptionInfo
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_011_OK() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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_MEX_LCM_SUBS,
                        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_lcm_subscription_list({
                                *,
								mw_app_lcm_subscription_info(
									-,
									PX_SUBSCRIPTION_TYPE,
									PX_CALLBACK_URI
								),
                                *
                            }
									
          ))))) -> value v_response {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with the list of available 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
    } // End of testcase TC_MEC_MEC010p2_MEX_LCM_011_OK
Elian Kraja's avatar
Elian Kraja committed
 
 
 	/**
    * @desc: Check that MEC API provider service sends the information about an existing LCM subscription when requested
    *        ETSI GS MEC 010-2 2.0.10, clause 7.5.4.3.2
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.10.2-1   // AppInstSubscriptionInfo
    *        ETSI GS MEC 010-2 2.0.10, table 6.2.2.16.2-1   // AppLcmOpOccSubscriptionInfo
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_012_OK() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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_MEX_LCM_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_lcm_subscription(
								mw_app_lcm_subscription_info(
									PX_SUBSCRIPTION_ID,
									PX_SUBSCRIPTION_TYPE,
									PX_CALLBACK_URI
								)
          ))))) -> value v_response {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with the subscription requested ***");
          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_MEC010p2_MEX_LCM_012_OK
Elian Kraja's avatar
Elian Kraja committed
 
 
  	/**
    * @desc: Check that MEC API provider service sends an error when it receives a query for a not existing LCM Subscription
    *        ETSI GS MEC 010-2 2.0.10, clause 7.5.4.3.2
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_012_NF() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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_MEX_LCM_SUBS & oct2char(unichar2oct(PX_NON_ESISTENT_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(
                    )
            )) -> value v_response {
          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
    } // End of testcase TC_MEC_MEC010p2_MEX_LCM_012_NF
Elian Kraja's avatar
Elian Kraja committed
 
 	/**
    * @desc: Check that MEC API provider service delete an existing LCM Subscription when requested
    *        ETSI GS MEC 010-2 2.0.10, clause 7.3.4.3.4
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_013_OK() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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 & PX_MEX_LCM_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()
          )) -> value v_response {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds 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
    } // End of testcase TC_MEC_MEC010p2_MEX_LCM_013_OK
Elian Kraja's avatar
Elian Kraja committed
 
 
  	/**
    * @desc: Check that MEC API provider service delete an existing LCM Subscription when requested
    *        ETSI GS MEC 010-2 2.0.10, clause 7.3.4.3.4
    */
    testcase TC_MEC_MEC010p2_MEX_LCM_013_NF() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        var HttpMessage v_response;

        // Test control
        if (not(PIC_APP_LCM_MANAGEMENT)){
            log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT 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 & PX_MEX_LCM_SUBS & oct2char(unichar2oct(PX_NON_ESISTENT_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(
                    )
            )) -> value v_response {
          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
    } // End of testcase TC_MEC_MEC010p2_MEX_LCM_013_NF
Elian Kraja's avatar
Elian Kraja committed
 

} // end of group app_lcm_subscriptions

group app_lcm__notification {
  
     /**
     * @desc Check that MEC API provider sends a notification to the subscriber 
	 *		 when an application lcm change event occurs
     * @see  ETSI GS MEC 010-2 2.0.10, clause 7.5.5.3.1
     *       ETSI GS MEC 010-2 2.0.10, table 6.2.2.18.2-1	 // AppLcmOpOccNotification
     *       ETSI GS MEC 010-2 2.0.10, table 6.2.2.12.2-1  	 // AppInstNotification 
     */  
  testcase TC_MEC_MEC010p2_MEX_LCM_014_OK() runs on HttpComponent system HttpTestAdapter {
Elian Kraja's avatar
Elian Kraja committed
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
Elian Kraja's avatar
Elian Kraja committed
        
        // Test control
        if (not(PIC_APP_PACKAGE_NOTIFICATIONS)) {
            log("*** " & testcasename() & ": PIC_APP_PACKAGE_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(
						unichar2char(PX_CALLBACK_URI),
                        -,
                    	mw_http_message_body_json(
                        	mw_body_json_lcm_notification(
								mw_app_lcm_notification(
Elian Kraja's avatar
Elian Kraja committed
									PX_NOTIFICATION_ID, 
Elian Kraja's avatar
Elian Kraja committed
									PX_NOTIFICATION_TYPE
								)
                        	)
                        )
                    )
                )
            ) {
            tc_wait.stop;
            log("*** " & testcasename() & ": INFO: IUT successfully sends 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 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 app_lcm__notification


} // End of module AtsMec_PkgMgmt_mm1_TestCases