ItsPki_TestCases.ttcn 525 KB
Newer Older
YannGarcia's avatar
YannGarcia committed
       *     }
       * </pre>
       * 
       * @see       ETSI TS 103 525-2 TP RCA_CRLGEN_01_BV
       * @reference ETSI TS 102 941, clause 6.3.3
       */
      testcase TC_RCA_CRLGEN_02_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
YannGarcia's avatar
YannGarcia committed
        var HttpMessage v_response;
        
        // Test control
        if (not PICS_IUT_CA_ROLE) {
          log("*** " & testcasename() & ": PICS_IUT_CA_ROLE required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cfHttpUp_ca();
        
        // Test adapter configuration
        
        // Preamble
YannGarcia's avatar
YannGarcia committed
        f_init_default_headers_list(PICS_HEADER_CRL_CONTENT_TYPE, "ca_request", v_headers);
YannGarcia's avatar
YannGarcia committed
        action("the RootCA is triggered to add new CA certificate (CERT_CA) to the revocation list");
        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
        
        // Test Body
        f_http_send(
                    v_headers,
                    m_http_request(
                                   m_http_request_get(
                                                      PICS_HTTP_GET_URI_CRL,
                                                      v_headers
                                                      )));
        tc_ac.start;
        alt {
          [] httpCaPort.receive(
                                mw_http_response(
                                                 mw_http_response_ok(
                                                                     mw_http_message_body_binary(
                                                                                                 mw_binary_body_ieee1609dot2_data(
                                                                                                                                  mw_etsiTs103097Data_signed(
                                                                                                                                                             mw_signedData(
                                                                                                                                                -,
                                                                                                                                                mw_toBeSignedData(                                                                                                                                                            mw_signedDataPayload                                                                                                                                        ),
                                                                                                                                                mw_signerIdentifier_digest
                                                                                                                                                                           ))))))) -> value v_response {
            var ToBeSignedCrl v_to_be_signed_crl;

            tc_ac.stop;

            if (f_verify_rca_crl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, true, v_to_be_signed_crl) == false) {
              log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
              f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
            } else {
              if (f_verify_full_crl(v_to_be_signed_crl) == true) {
                log("*** " & testcasename() & ": PASS: ToBeSignedCrl received ***");
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
              } else {
                log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
              }
            }
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement

        // Postamble
        f_cfHttpDown_ca();

      } // End of testcase TC_RCA_CRLGEN_02_BV

    } // End of group crl

YannGarcia's avatar
YannGarcia committed
  } // End of group ca_behavior

YannGarcia's avatar
YannGarcia committed
  group tlm_behavior {
    
    group ctl {

      /**
       * @desc Check that the TLM generates the ECTL when new RootCA is about to be added
       * <pre>
       * Pics Selection: PICS_IUT_CA_ROLE
       * Initial conditions: 
       *     }
       * Expected behaviour:
       *     ensure that {
       *         when {
       *             the TLM is triggered to add new RootCA certificate (CERT_RCA) in the CTL
       *         }
       *         then {
       *             the IUT issue a new CTL of type CtlFormat
       *                 containing isFullCtl
       *                     indicating TRUE
       *                 and containing ctlCommands
       *                     containing CtlCommand
       *                         containing add
       *                             containing rca
       *                                 containing selfsignedRootCa
       *                                     indicating CERT_RCA
       *         }
       *     }
       * </pre>
       * 
       * @see       ETSI TS 103 525-2 TP TLM_ECTLGEN_01_BV
       * @reference ETSI TS 102 941, clause 6.3.1
       */
      testcase TC_TLM_ECTLGEN_01_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
        // Local variables
Yann Garcia's avatar
Yann Garcia committed
        var Headers v_headers;
YannGarcia's avatar
YannGarcia committed
        var HttpMessage v_response;
        
        // Test control
        if (not PICS_IUT_CA_ROLE) {
          log("*** " & testcasename() & ": PICS_IUT_CA_ROLE required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cfHttpUp_tlm();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(PICS_HEADER_CTL_CONTENT_TYPE, "tlm_request", v_headers);
        action("The TLM is triggered to add new RootCA certificate (CERT_RCA) in the CTL");
        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
        
        // Test Body
        f_http_send(
                    v_headers,
                    m_http_request(
                                   m_http_request_get(
                                                      PICS_HTTP_GET_URI_ECTL,
                                                      v_headers
                                                      )));
        tc_ac.start;
        alt {
          [] httpTlmPort.receive(
                                 mw_http_response(
                                                  mw_http_response_ok(
                                                                      mw_http_message_body_binary(
                                                                                                  mw_binary_body_ieee1609dot2_data(
                                                                                                                                   mw_etsiTs103097Data_signed(
                                                                                                                                                              mw_signedData(
                                                                                                                                                                            -,
                                                                                                                                                                            mw_toBeSignedData(                                                                                                                                                            mw_signedDataPayload                                                                                                                                        ),
Yann Garcia's avatar
Yann Garcia committed
                                                                                                                                                                            mw_signerIdentifier_certificate(mw_etsiTs103097Certificate(mw_issuerIdentifier_self))
YannGarcia's avatar
YannGarcia committed
                                                                                                                                                                            ))))))) -> value v_response {
Yann Garcia's avatar
Yann Garcia committed
            var ToBeSignedTlmCtl v_to_be_signed_tlm_ectl;
YannGarcia's avatar
YannGarcia committed

            tc_ac.stop;

Yann Garcia's avatar
Yann Garcia committed
            // FIXME Can not verify signature, to be checked
            if (f_verify_tlm_ectl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, false, v_to_be_signed_tlm_ectl) == false) {
YannGarcia's avatar
YannGarcia committed
              log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
              f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
            } else {
              if (f_verify_full_ectl(v_to_be_signed_tlm_ectl) == true) {
                log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
              } else {
                log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
              }
            }
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement

        // Postamble
        f_cfHttpDown_tlm();

      } // End of testcase TC_TLM_ECTLGEN_01_BV

    } // End of group ctl

  } // End of group tlm_behavior

garciay's avatar
garciay committed
} // End of module ItsPki_TestCases