Commit a3bec823 authored by Yann Garcia's avatar Yann Garcia
Browse files

Implement QoSLookup TPs

parent e301aee6
Loading
Loading
Loading
Loading
+507 −0
Original line number Diff line number Diff line
@@ -11,6 +11,513 @@ module AtsMec_QoSMeasurementAPI_TestCases {
  import from LibHttp_TestSystem all;
  
  // LibMec/QoSMeasurementAPI
  import from QoSMeasurementAPI_TypesAndValues all;
  import from QoSMeasurementAPI_Templates all;
  import from QoSMeasurementAPI_Pics all;
  import from QoSMeasurementAPI_Pixits all;

  // LibMec
  import from LibMec_Functions all;
  import from LibMec_Pics all;
  import from LibMec_Pixits all;
  
  group qos {

    group qos_lookup {

      /**
       * @desc Check that the IUT responds with the list of QoS measurement subscriptions when queried by a MEC Application
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_001_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_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_qos_notification_subscription_list(
                                                                                                                                             mw_notification_subscription_list
                               ))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a Notification subscription list ***");
            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_MEC045_SRV_QOSLOOKUP_001_OK

      /**
       * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_001_BR() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_SUBS & "/?subscriptionType=UnknownType", // Wrong URL structure: Invalid URI query parameters supported
                                                        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
                               )) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT responds with 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_cf_01_http_down();
      } // End of testcase TC_MEC_MEC045_SRV_QOSLOOKUP_001_BR2

      /**
       * @desc Check that the IUT responds with an error when no subscription are created
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_001_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_SUBS,
                                                        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
                               )) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a 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
        
        // Postamble
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC045_SRV_QOSLOOKUP_001_NF

      /**
       * @desc Check that the IUT responds with the list of QoS measurement subscriptions when queried by a MEC Application - Filter on subscriptionId
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_002_OK_01() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var QoSMeasureSubscription v_qo_s_measure_subscription;
        var charstring v_subscription_id;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_SUBS & "?subscriptionId=" & oct2char(unichar2oct(v_qo_s_measure_subscription.subscriptionType, "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_qos_notification_subscription_list(
                                                                                                                                             mw_notification_subscription_list(
                                                                                                                                                                               { href := pattern "http?+" & PICS_ROOT_API & PX_QOS_API_LIST_SUBS },
                                                                                                                                                                               superset(
                                                                                                                                                                                        mw_subscription(
                                                                                                                                                                                                        v_qo_s_measure_subscription.links.subscription.href,
                                                                                                                                                                                                        v_qo_s_measure_subscription.subscriptionType
                               )))))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a Notification subscription list ***");
            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_MEC045_SRV_QOSLOOKUP_002_OK_01

      /**
       * @desc Check that the IUT responds with the list of QoS measurement subscriptions when queried by a MEC Application - Filter on subscriptionType
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_002_OK_02() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var QoSMeasureSubscription v_qo_s_measure_subscription;
        var charstring v_subscription_id;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_SUBS & "?subscriptionType=" & oct2char(unichar2oct(v_qo_s_measure_subscription.subscriptionType, "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_qos_notification_subscription_list(
                                                                                                                                             mw_notification_subscription_list(
                                                                                                                                                                               { href := pattern "http?+" & PICS_ROOT_API & PX_QOS_API_LIST_SUBS },
                                                                                                                                                                               superset(
                                                                                                                                                                                        mw_subscription(
                                                                                                                                                                                                        v_qo_s_measure_subscription.links.subscription.href,
                                                                                                                                                                                                        v_qo_s_measure_subscription.subscriptionType
                               )))))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a Notification subscription list ***");
            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_MEC045_SRV_QOSLOOKUP_002_OK_02

      /**
       * @desc Check that the IUT responds with with an error when no subscription matches with the filter - Filter on subscriptionType
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_002_NF_01() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var QoSMeasureSubscription v_qo_s_measure_subscription;
        var charstring v_subscription_id;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_SUBS & "?subscriptionType=" & oct2char(unichar2oct(PX_UNKNOWN_SUBSCRIPTION_TYPE, "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
                               )) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a 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
        
        // Postamble
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC045_SRV_QOSLOOKUP_002_NF_01

      /**
       * @desc Check that the IUT responds with with an error when no subscription matches with the filter - Filter on subscriptionId
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_002_NF_02() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var QoSMeasureSubscription v_qo_s_measure_subscription;
        var charstring v_subscription_id;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_SUBS & "?subscriptionId=" & oct2char(unichar2oct(PX_UNKNOWN_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
                               )) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a 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
        
        // Postamble
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC045_SRV_QOSLOOKUP_002_NF_02

      /**
       * @desc Check that the IUT responds with a QoS measurement subscription when queried by a MEC Application
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_003_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var QoSMeasureSubscription v_qos_measure_subscription;
        var charstring v_subscription_id;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_SUBS & "/" & v_subscription_id,
                                                        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_qos_measure_subscription(
                                                                                                                                   v_qos_measure_subscription
                               ))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a QoS measurement 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
        
        // Postamble
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC045_SRV_QOSLOOKUP_003_OK

      /**
       * @desc Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
       */
      testcase TC_MEC_MEC045_SRV_QOSLOOKUP_003_OK_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_QOS_API_SUPPORTED)) {
          log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PICS_ROOT_API & PX_QOS_API_LIST_SUBS & "/" & oct2char(unichar2oct(PX_UNKNOWN_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
                               )) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a 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
        
        // Postamble
        f_cf_01_http_down();
      } // End of testcase TC_MEC_MEC045_SRV_QOSLOOKUP_003_NF

    } // End of group qos_lookup

  } // End of group qos

} // End of module AtsMec_QoSMeasurementAPI_TestCases
 No newline at end of file
+23 −0
Original line number Diff line number Diff line
module AtsMec_QoSMeasurementAPI_TestControl {

  // LibMec/QoSMeasurementAPI
  import from QoSMeasurementAPI_Pics all;
  
  // LibMec
  import from LibMec_Pics all;
  
  // AtsMec_QoSMeasurementAPI
  import from AtsMec_QoSMeasurementAPI_TestCases all;
  
  control {

    if (PICS_MEC_PLAT and PICS_SERVICES and PICS_QOS_API_SUPPORTED) {
      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_001_OK());
      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_001_BR());
      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_001_NF());

      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_002_OK_01());
      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_002_OK_02());
      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_002_NF_01());
      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_002_NF_02());

      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_003_OK());
      execute(TC_MEC_MEC045_SRV_QOSLOOKUP_003_NF());

    }
  }

} // End of module AtsMec_QoSMeasurementAPI_TestControl
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
module QoSMeasurementAPI_Pics {
  
  /**
   * @desc Does the IUT support MEC QoS Measurment API?
   */
  modulepar boolean PICS_QOS_API_SUPPORTED := true;
  
} // End of module QoSMeasurementAPI_Pics
+11 −0

File changed.

Preview size limit exceeded, changes collapsed.

+66 −66

File changed.

Preview size limit exceeded, changes collapsed.

Loading