Skip to content
ItsSecurity_TestCases.ttcn 1.6 MiB
Newer Older
 *  @author   ETSI / STF481 / STF507 / STF517 / STF538
 *  @version  $URL$
 *            $Id$
 *  @desc     Testcases  file for Security Protocol
filatov's avatar
filatov committed
 *  @reference   ETSI TS 103 097 v1.2.1
garciay's avatar
garciay committed
 *  @copyright   ETSI Copyright Notification
 *               No part may be reproduced except as authorized by written permission.
 *               The copyright and the foregoing restriction extend to reproduction in all media.
 *               All rights reserved.
module ItsSecurity_TestCases {
    
    // Libcommon
    import from LibCommon_Time all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    import from LibCommon_BasicTypesAndValues all;
    
    // LibIts
    //import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from IEEE1609dot2BaseTypes language "ASN.1:1997" all;
    import from IEEE1609dot2 language "ASN.1:1997" all;
    import from EtsiTs103097Module language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_ASN1_NamedNumbers all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_TypesAndValues all;
    import from LibItsGeoNetworking_Pics all;

    // LibItsCam
    import from LibItsCam_Templates all;
    import from LibItsCam_Functions all;
    import from LibItsCam_Templates all;
    import from LibItsCam_Functions all;
    import from LibItsCam_TestSystem all;
    
    // LibItsDenm
    import from LibItsDenm_Templates all;
    import from LibItsDenm_TestSystem all;
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_Templates all;
    import from LibItsSecurity_Functions all;
    import from LibItsSecurity_Pixits all;
    import from LibItsSecurity_Pics all;
    
    // AtsSecurity
    import from ItsSecurity_TestSystem all;
    import from ItsSecurity_Functions all;
    import from ItsSecurity_Templates all;
    import from ItsSecurity_Pics all;
garciay's avatar
garciay committed
    testcase TC_TEST_1() runs on ItsGeoNetworking system ItsSecSystem { // TODO To be rremoved, for debug purpose only
      
      // Local variables
      var GeoNetworkingInd v_geoNwInd;
      
      // Test component configuration
      f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
      
      // Test adapter configuration
      
      // Preamble
      f_sendSecuredCam(cc_taCert_B, valueof(m_headerInfo_cam(-, f_computeGnTimestamp())), valueof(m_signerIdentifier_digest));
      
      // Postamble
      f_cf01Down();
    } // End of testcase TC_TEST_1
    
garciay's avatar
garciay committed
    testcase TC_TEST_2() runs on ItsGeoNetworking system ItsSecSystem { // TODO To be rremoved, for debug purpose only
      
      // Local variables
      var LongPosVector v_longPosVectorIut;
      var GeoNetworkingInd v_geoNwInd;
      
      // Test component configuration
      f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
      v_longPosVectorIut := f_getPosition(c_compIut);
      
      // Test adapter configuration
      
      // Preamble
      f_sendSecuredDenm(
                        cc_taCert_B, 
                        valueof(
                                m_headerInfo_denm(
                                                  -, 
                                                  f_computeGnTimestamp(), 
                                                  m_threeDLocation(v_longPosVectorIut.latitude, v_longPosVectorIut.longitude, 0))
                                ), 
                        valueof(m_signerIdentifier_digest)
        );
      
      // Postamble
      f_cf01Down();
    } // End of testcase TC_TEST_2
    
    /**
     * @desc Sending behaviour test cases
garciay's avatar
garciay committed
     * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2 Sending behaviour
     */
    group sendingBehavior {

         * @desc    Check that ITS-S sends a Ieee1609Dot2Data containing protocol version set to 3.
         * <pre>
         * Pics Selection: PICS_GN_SECURITY
         * Config Id: CF01
         * Initial conditions:
         *  with {
         *      the IUT being in the 'authorized' state
         *  }
         * Expected behaviour:
         * ensure that {
         *     when { 
         *         the IUT is requested to send a Ieee1609Dot2Data
         *     } then {
         *         the IUT sends a Ieee1609Dot2Data
         *             containing protocol_version 
         *                 indicating value '3'
         *     }
         * }
         * </pre>
         *
garciay's avatar
garciay committed
         * @see         ETSI TS 103 096-2 v1.3.2 TP_TC_SEC_ITSS_SND_MSG_01_BV
         * @reference   ETSI TS 103 097 [1] Clause 5.1 
         * @reference   IEEE1609.2[2] Clause 6.3.2
         */
        testcase TC_SEC_ITSS_SND_MSG_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
            // Local variables
            var LongPosVector v_longPosVectorIut;
                
            // Test control
garciay's avatar
garciay committed
            if (not(PICS_GN_SECURITY)) {
                log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                stop;
            }
            
            // Test component configuration
garciay's avatar
garciay committed
            f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
            v_longPosVectorIut := f_getPosition(c_compIut);
                
            // Test adapter configuration
            
            // Preamble
            f_prNeighbour();
            f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader)); // Authorize the TA to forward the received beacons
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            tc_ac.start;
            alt {
                [] geoNetworkingPort.receive(
                    mw_geoNwInd(
                        mw_geoNwSecPdu(
                            mw_etsiTs103097Data_signed
                ))) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: Security protocol version set to 3 ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            
            // Postamble
            f_acTriggerEvent(m_stopPassBeaconing);
            f_poNeighbour();
            f_cf01Down();
            
        } // End of testcase TC_SEC_ITSS_SND_MSG_01_BV
        
         * @desc Sending behaviour test cases for CAM profile.
garciay's avatar
garciay committed
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.4 CAM profile
        group camProfile {
             * @desc    Check that IUT sends the secured CAM using SignedData container.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             * }
Loading full blame...