AtsMec_WlanInformationAPI_TestCases.ttcn 64.1 KB
Newer Older
        // Local variables
        var AssocStaSubscription v_assoc_sta_subscription;
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_WLAN_INFORMATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_WLAN_INFORMATION_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_assoc_sta_subscription(v_assoc_sta_subscription);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_put(
                                                        PICS_ROOT_API & v_assoc_sta_subscription.links.self_.href,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_assoc_sta_subscription(
                                                                                                                    m_assoc_sta_subscription(
                                                                                                                                             v_assoc_sta_subscription.callbackReference,
                                                                                                                                             m_ap_identity(
                                                                                                                                                           PX_MAC_ID
                                                                                                                                                           ),
YannGarcia's avatar
YannGarcia committed
                                                                                                                                             -, -,
                                                                                                                                             v_assoc_sta_subscription.links
                                                                                                                                             ))))));
        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_assoc_sta_subscription(
                                                                                                                                 mw_assoc_sta_subscription(
                                                                                                                                                           v_assoc_sta_subscription.callbackReference,
                                                                                                                                                           ?,
YannGarcia's avatar
YannGarcia committed
                                                                                                                                                           -, -,
                                                                                                                                                           v_assoc_sta_subscription.links                                                                                                                              )))))) -> value v_response {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds to the AssocStatSubscription update ***");
            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_delete_assoc_sta_subscription(v_response.response.body.json_body.assocStaSubscription);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC028_SRV_WAI_009_OK

    /**
     * @desc Check that the IUT responds with an error when an invalid field is set in the subscription modification request 
     * @see https://forge.etsi.org/rep/mec/gs028-wai-api/blob/master/WlanInformationApi.json
     * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/v2.2.1-dev/Test%20Purposes/MEC028/SRV/WAI/ApInfo.tplan2
     */
    testcase TC_MEC_MEC028_SRV_WAI_009_BR() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var AssocStaSubscription v_assoc_sta_subscription;
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_WLAN_INFORMATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_WLAN_INFORMATION_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_assoc_sta_subscription(v_assoc_sta_subscription);
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_put(
                                                        PICS_ROOT_API & v_assoc_sta_subscription.links.self_.href,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_assoc_sta_subscription(
                                                                                                                    m_assoc_sta_subscription_invalid(
                                                                                                                                                     v_assoc_sta_subscription.callbackReference,
                                                                                                                                                     m_ap_identity(
                                                                                                                                                                   PX_MAC_ID
                                                                                                                                                                   ),
YannGarcia's avatar
YannGarcia committed
                                                                                                                                                     -, -,
                                                                                                                                                     v_assoc_sta_subscription.links
                                                                                                                                                     ))))));
        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 the correct error 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
        
        // Postamble
        f_delete_assoc_sta_subscription(v_response.response.body.json_body.assocStaSubscription);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC028_SRV_WAI_009_BR

    /**
     * @desc Check that the IUT responds with 204 when an existing subscription is correctly deleted
     * @see https://forge.etsi.org/rep/mec/gs028-wai-api/blob/master/WlanInformationApi.json
     * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/v2.2.1-dev/Test%20Purposes/MEC028/SRV/WAI/ApInfo.tplan2
     */
    testcase TC_MEC_MEC028_SRV_WAI_010_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var AssocStaSubscription v_assoc_sta_subscription;
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_WLAN_INFORMATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_WLAN_INFORMATION_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_create_assoc_sta_subscription(v_assoc_sta_subscription);
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_delete(
                                                           PICS_ROOT_API & v_assoc_sta_subscription.links.self_.href,
                                                           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 with an AssocStaSubscription ***");
            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_MEC028_SRV_WAI_010_OK

    /**
     * @desc Check that the IUT responds with an error when an not existing subscription cannot be deleted
     * @see https://forge.etsi.org/rep/mec/gs028-wai-api/blob/master/WlanInformationApi.json
     * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/v2.2.1-dev/Test%20Purposes/MEC028/SRV/WAI/ApInfo.tplan2
     */
    testcase TC_MEC_MEC028_SRV_WAI_010_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var AssocStaSubscription v_assoc_sta_subscription;
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_WLAN_INFORMATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_WLAN_INFORMATION_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_create_assoc_sta_subscription(v_assoc_sta_subscription);
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_delete(
                                                           PICS_ROOT_API & v_assoc_sta_subscription.links.self_.href & "_Invalid",
                                                           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 an AssocStaSubscription ***");
            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_delete_assoc_sta_subscription(v_assoc_sta_subscription);
        f_cf_01_http_down();
    } // End of testcase TC_MEC_MEC028_SRV_WAI_010_NF

    /**
     * @desc Check that the IUT sends a notification about WLAN event notification if the MEC service has an associated subscription and the event is generated
     * @see https://forge.etsi.org/rep/mec/gs028-wai-api/blob/master/WlanInformationApi.json
     * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/v2.2.1-dev/Test%20Purposes/MEC028/SRV/WAI/ApInfo.tplan2
     */
    testcase TC_MEC_MEC028_SRV_WAI_011_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var AssocStaSubscription v_assoc_sta_subscription;
        var Headers v_headers;
        var HttpMessage v_response;
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_WLAN_INFORMATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_WLAN_INFORMATION_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_cf_01_http_notif_up();
        
        // Test adapter configuration
        
        // Preamble
        f_create_assoc_sta_subscription(v_assoc_sta_subscription);
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);

        // Test Body
        tc_wait.start;
        alt {
          [] httpPort_notif.receive(
                                    mw_http_request(
                                    mw_http_request_post(
                                                         -,
                                                         -,
                                                         mw_http_message_body_json(
                                                                                   mw_body_json_assoc_sta_subscription(
                                                                                                                       mw_assoc_sta_subscription(
                                                                                                                                                 PX_ASSOC_STA_SUBSCRIPTION_CALLBACK,
                                                                                                                                                 -,
                                                                                                                                                 ?
                                                                                                                                                 )))))) -> value v_response {
            tc_wait.stop;
            
            f_init_default_headers_list(-, -, v_headers);
            httpPort_notif.send(
                                m_http_response(
                                                m_http_response_ok_no_body(
                                                                           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_delete_assoc_sta_subscription(v_assoc_sta_subscription);
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_delete_assoc_sta_subscription(v_assoc_sta_subscription);
        f_cf_01_http_notif_down();
    } // End of testcase TC_MEC_MEC028_SRV_WAI_011_OK

  } // End of group me_app_role

YannGarcia's avatar
YannGarcia committed
} // End of module AtsMec_WlanInformationAPI_TestCases