AtsMec_AppEnablementAPI_TestCases.ttcn 146 KB
Newer Older
                                   m_http_request_put(
                                                      PX_ME_APP_SUPPORT_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/traffic_rules/" & oct2char(unichar2oct(PX_NON_EXISTENT_TRAFFIC_RULE_ID, "UTF-8")),
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_traffic_rule(
                                                                                                                 m_traffic_rule(
                                                                                                                                PX_TRF_RULE_DROP // action
                                                                                                                               )
                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
      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 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

      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_APPSAQ_004_NF

    /**
     * @desc Check that the IUT responds with an error when a request sent by a MEC Application doesn't comply with a required condition
     * @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/TRAF/PlatTrafficRules.tplan2
     */
    testcase TP_MEC_SRV_TRAF_003_PF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;

      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }

      // Test component configuration
      f_cf_01_http_up();

      // Test adapter configuration

      // Preamble
      // TODO If-Match header needs to have an INVALID_ETAG
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
                                                      PX_ME_APP_SUPPORT_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/traffic_rules/" & oct2char(unichar2oct(PX_NON_EXISTENT_TRAFFIC_RULE_ID, "UTF-8")),
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_traffic_rule(
                                                                                                                 m_traffic_rule(
                                                                                                                                PX_TRF_RULE_DROP // action
                                                                                                                               )
                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);

      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_412_precondition_failed()
                                             )) {
          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 412 Precondition Failed ***");
          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 TP_MEC_SRV_TRAF_003_PF
  } // End of group trafficRules



   /*
    * Transport (TRANS)
    */
  group transportRules {

    /**
     * @desc Check that the IUT responds with a list of available transportswhen queried by a MEC Application
     * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/TRANS/PlatTransport.tplan2
     */
    testcase TP_MEC_SRV_TRANS_001_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;

      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_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(
                                                      PX_ME_TRANSPORTS_MNGMT_URI,
                                                      v_headers
                                                      )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);

      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_ok(
                                                                 mw_body_json_transport_info_list(
                                                                                                mw_transport_info_list(*) // TODO don't care about the content
                                                                                                                  )))))) {
          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a TransportInfoList ***");
          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 TP_MEC_SRV_TRANS_001_OK
  } // End of group transportRules

}

} // End of module AtsMec_AppEnablementAPI_TestCases
YannGarcia's avatar
YannGarcia committed
        
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TC_MEC_SRV_TRAF_001_NF
    
  } // End of group traffic_rules
  
YannGarcia's avatar
YannGarcia committed
} // End of module AtsMec_AppEnablementAPI_TestCases