Commit 5e7d7b83 authored by YannGarcia's avatar YannGarcia
Browse files

Add TPlan2 examples

parent 07510dfd
Loading
Loading
Loading
Loading
+95 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) ETSI 2018-2022.
 * Released under BSD 3-clause license. For more information visit https://forge.etsi.org/legal-matters
 */

Package CISE {

  import all from CISE_Common;

  Test Purpose {
     TP Id "TC_CISE_NODE_BV_01"

     Test objective
       "Check that the IUT sends a PullResponse when recieving a PullRequest with no Acknowledgement"

    Reference 
      "ETSI GS CDM 004 Clause 5.4.2 Pull"

    Config Id Config_CISE_1

    PICS Selection PICS_IUT_NODE and not PICS_CISE_SECURITY

    Initial conditions  with {
      the IUT entity being_in idle_state, 
      the IUT is configured with security
      ;
    }

    Expected behaviour
      ensure that {
        when {
          the IUT entity receives a vGET containing
            uri indicating value "xxx"
            query_parameters containing
              vPullRequest indicating value PX_PULL_REQUEST // TODO To be refined
            ;
          ;
          from the LS entity
        }
        then {
          the IUT entity sends a HTTP_RESPONSE containing
            status_code set to "200 OK"
            body containing
              vPullRequest indicating value PX_PULL_REQUEST // TODO To be refined
            ;
          ;
          to the LS entity
        }
      }
  } // End of TP "TC_CISE_NODE_BV_01"

  Test Purpose {
     TP Id "TC_CISE_NODE_BV_02"

     Test objective
       "Check that the IUT sends a PullResponse when recieving a PullRequest with no Acknowledgement, with security"

    Reference 
      "ETSI GS CDM 004 Clause 5.4.2 Pull"

    Config Id Config_CISE_1

    PICS Selection PICS_IUT_NODE and PICS_CISE_SECURITY

    Initial conditions  with {
      the IUT entity being_in idle_state and, 
      the IUT is configured with security
      ;
    }

    Expected behaviour
      ensure that {
        when {
          the IUT entity receives a vGET containing
            uri indicating value "xxx"
            query_parameters containing
              vPullRequest containing
                vSignature  // TODO To be refined
            ;
          ;
          from the LS entity
        }
        then {
          the IUT entity sends a HTTP_RESPONSE containing
            status_code set to "200 OK"
            body containing
              vPullRequest indicating value PX_PULL_REQUEST // TODO To be refined
            ;
          ;
          to the LS entity
        }
      }
  } // End of TP "TC_CISE_NODE_BV_02"

} // End of package CISE
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
[1] ETSI GS CDM 003 Common Information sharing environment service and Data Model (CDM); CDM Architecture
[2] ETSI GS CDM 004 Common Information sharing environment service and Data Model (CDM); Service Model
 No newline at end of file
+131 −0
Original line number Diff line number Diff line
Package CISE_Common {
  
  Domain {
    pics:
    - PICS_IUT_NODE      // Set to true if the IUT is acting as a CISE node
    - PICS_IUT_ADAPTOR   // Set to true if the IUT is acting as a CISE adaptor
    - PICS_CISE_SECURITY // Set to true if security (signature and cyphering) is supported
    - PICS_ROOT_API      // CISE root API URL
    ;

    entities:
    - LS      // Legacy System
    - NODE    // 
    - ADAPTER //
    - IUT     // Implementation Under Test
    ;

    events:
    - started       // component is up and running
    - authorised    // component is authenticated and authorised to use services
    - consume_services  // component is can use services
    - receives      // component receives an HTTP request
    - sends       // component sends an HTTP response
    - having
    - idle_state 
    ;
  }
  
  Data {
    type STRING;
    type XML;
    type string with s of type STRING

    type HttpHeaders with
        // content_type is optional, since not present in GET and DELETE
        content_type of type STRING,   
        authorization of type STRING,
        accept of type STRING
    ;

    type HTTP_REQUEST with
        uri of type STRING
    ;
    
    type HttpMsg with
        uri of type  STRING,
        headers of type HttpHeaders,
        status_code of type STRING,
        // body is optional, since not present in GET and DELETE 
        body of type JSON  
    ;

    STRING "application/xml;charset=utf-8";
    string CONTENT_XML containing s set to "application/xml;charset=utf-8";
    STRING VALID_TOKEN;
    STRING NOT_VALID_TOKEN;
    STRING "application/xml";
    STRING "application/octet-stream";

    HttpHeaders vHeadersInvalidToken containing
        authorization set to NOT_VALID_TOKEN
    ;

    HttpHeaders vHeadersGet containing
        accept set to "application/json",
        authorization set to VALID_TOKEN
    ;

    HttpHeaders vHeadersAcceptKO containing
        accept set to "application/octet-stream",
        authorization set to VALID_TOKEN
    ;

    HttpHeaders vHeaders containing
        accept set to CONTENT_XML,
        content_type set to CONTENT_XML,
        authorization set to VALID_TOKEN
    ;

    HttpHeaders vHeadersResponse containing
        content_type set to CONTENT_XML
    ;

    HttpMsg vGET containing
        headers set to vHeadersGet
    ;

    HttpMsg vPOST containing
        headers set to vHeaders
    ;

    HttpMsg vPUT containing
        headers set to vHeaders
    ;

    HttpMsg vDELETE containing
        headers set to vHeadersGet
    ;

    HttpMsg HTTP_RESPONSE containing
        headers set to vHeadersResponse
    ;

    PullRequest vPullRequest
    ;660855792

    Signature vSignature
    ;

  }

  const {
    PX_CISE_PULL_REQUEST_URI,
    PX_CISE_SERVICE_ID
  }

  Configuration {

    Interface Type apiPort accepts string;

    Component Type CiseNodeComponent with gate p of type apiPort; 
    Component Type CiseLisComponent with gate p of type apiPort;

    Test Configuration Config_CISE_1 containing
        Tester component LIS of type CiseLisComponent
        SUT component IUT of type CiseNodeComponent
        connection between LIS.p and IUT.p
    ;

  }
} // End of package CISE_Common
+8 −8
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ module AtsCise_TestCases {
     * @desc Check that the IUT sends a PullResponse when recieving a PullRequest with no Acknowledgement
     * @see ETSI GS CDM 004 Clause 5.4.2 Pull
     */
    testcase TC_CISE_xxx_BV_01() runs on HttpComponent system HttpTestAdapter {
    testcase TC_CISE_NODE_BV_01() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;
@@ -38,8 +38,8 @@ module AtsCise_TestCases {
      var charstring v_correlation_id := f_generate_uuid();

      // Test control
      if (not(PICS_IUT_ADAPTOR) or PICS_CISE_SECURITY) {
        log("*** " & testcasename() & ": PICS_IUT_ADAPTOR and not PICS_CISE_SECURITY required for executing the TC ***");
      if (not(PICS_IUT_NODE) or PICS_CISE_SECURITY) {
        log("*** " & testcasename() & ": PICS_IUT_NODE and not PICS_CISE_SECURITY required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
@@ -139,7 +139,7 @@ module AtsCise_TestCases {
     * @desc Check that the IUT sends a PullResponse when recieving a PullRequest with no Acknowledgement, with security
     * @see ETSI GS CDM 004 Clause 5.4.2 Pull
     */
    testcase TC_CISE_xxx_BV_02() runs on HttpComponent system HttpTestAdapter {
    testcase TC_CISE_NODE_BV_02() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;
@@ -148,8 +148,8 @@ module AtsCise_TestCases {
      var charstring v_correlation_id := f_generate_uuid();

      // Test control
      if (not(PICS_IUT_ADAPTOR) or not(PICS_CISE_SECURITY)) {
        log("*** " & testcasename() & ": PICS_IUT_ADAPTOR and PICS_CISE_SECURITY required for executing the TC ***");
      if (not(PICS_IUT_NODE) or not(PICS_CISE_SECURITY)) {
        log("*** " & testcasename() & ": PICS_IUT_NODE and PICS_CISE_SECURITY required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
@@ -276,8 +276,8 @@ module AtsCise_TestCases {
      var HttpMessage v_request;

      // Test control
      if (not(PICS_IUT_ADAPTOR)) {
        log("*** " & testcasename() & ": PICS_IUT_ADAPTOR required for executing the TC ***");
      if (not(PICS_IUT_NODE)) {
        log("*** " & testcasename() & ": PICS_IUT_NODE required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
+6 −2
Original line number Diff line number Diff line
@@ -7,8 +7,12 @@ module AtsCise_TestControl {
  import from AtsCise_TestCases all;

  control {
    if (PICS_IUT_ADAPTOR) {
      execute(TC_CISE_xxx_BV_01());
    if (PICS_IUT_NODE) {
      if (not PICS_CISE_SECURITY) {
        execute(TC_CISE_NODE_BV_01());
      } else {
        execute(TC_CISE_NODE_BV_02());
      }
    }

  } // End of 'control' statement