ItsSecurity_TestCases.ttcn 1.59 MB
Newer Older
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload(
                                                mw_ieee1609Dot2Data(
                                                    mw_ieee1609Dot2Data_unsecured
                                            )),
                                            mw_headerInfo_denm
                                        )
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: DENM received with a well formated payload");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_11_BV
            
            /**
             * @desc    Check that the IUT sends the secured DENM signed with the certificate containing appPermisions 
             *          allowing to sign DEN messages
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured DENM
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              containing signer
             *                 containing certificate
             *                     containing appPermissions
             *                         containing an item of type PsidSsp
             *                             containing psid = AID_DENM 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_12_BV
             * @reference    ETSI TS 103 097 [1] Clauses 7.1.2
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_12_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                   [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_certificate( // containing certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    { mw_appPermissions(c_its_aid_DENM) }
                        log("*** " & testcasename() & ": PASS: DEN message received with a well formated certificate ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                        log("*** " & testcasename() & ": INFO: DEN message with digest was received ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: DEN message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_12_BV
            
            /**
             * @desc    Check that IUT sends the secured DENM containing signature;
             *          Check that the signature is calculated over the right fields 
             *          and using right hash algorythm by cryptographically verifying the signature
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (X_CERTIFICATE) 
             *          containing verifyKeyIndicator
             *              containing verificationKey
             *                  containing X_KEY
             *                      indicating KEY
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured DENM
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              containing signedData
             *                  containing signer
             *                       containing certificate
             *                           indicating X_CERTIFICATE
             *                               containing verifyKeyIndicator
             *                                   containing verificationKey
             *                                       containing X_KEY
             *                                           indicating KEY
             *                  and containing signature
             *                      containing X_SIGNATURE
             *                          verifiable using KEY 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_13_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.2
             * @reference    IEEE 1609.2 [2], Clauses 5.3.1, 6.3.4, 6.3.29, 6.3.30, 6.3.31

             */
            testcase TC_SEC_ITSS_SND_DENM_13_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var EtsiTs103097Certificate v_certificate;
                var Signature               v_signature;
                var GeoNetworkingInd        v_geoNwInd;
                var ItsDenm                 v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_readCertificate(vc_hashedId8ToBeUsed, v_certificate);
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        PICS_CERTFICATES_FOI[PICS_CERTFICATES_VAR].hashAlgorithm, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_certificate( // or containing containing certificate indicating X_CERTIFICATE
                                            v_certificate
                                        )
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: DEN message with certificate received ***");
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: DEN message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                // Check that the signature is calculated over the right fields and using right hash algorythm by cryptographically verifying the signature
                if (f_verifyGnSecuredMessageSignatureWithCertificate(f_getSecuredMessage(v_geoNwInd.msgIn), v_certificate)) {
                    log("*** " & testcasename() & ": PASS: Signature verified successfully ***");
                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                } else {
                    log("*** " & testcasename() & ": FAIL: Signature not verified successfully ***");
                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                }
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_13_BV
                            
            /**
             * @desc    Check that IUT doesn't send secured DENMs if IUT doesn't possess an AT certificate allowing 
             *          sending messages in this location. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_C1_AT)
             *         containing region
             *             indicating rectangular region
             *                 not containing current IUT position
             *         and the IUT has no other installed AT certificates
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_14_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_14_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_C1_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_14_BV
            
            /**
             * @desc    Check that IUT doesn't send the secured DENM if IUT is configured to use an AT certificate 
             *          without region validity restriction and generation location is outside of the region of the 
             *          issuing AA certificate. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_C3_AT)
             *         not containing region
             *         and issued by the AA certificate (CERT_IUT_C3_AA)
             *             containing region
             *                 indicating rectangular region
             *                     not containing current IUT position
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_15_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_15_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_C3_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_15_BV
            
            /**
             * @desc    Check that IUT doesn't send secured DENMs if all AT certificates installed on the IUT are expired. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A1_AT)
             *         containing validityPeriod
             *             indicating start + duration < CURRENT_TIME
             *         and the IUT has no other installed AT certificates
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_16_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_16_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_A1_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_16_BV
            
            /**
             * @desc    Check that IUT doesn't send secured DENMs if all AT certificates installed on the IUT have the starting time in the future. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A2_AT)
             *         containing validityPeriod
             *             indicating start > CURRENT_TIME
             *         and the IUT has no other installed AT certificates
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_17_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_17_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_A2_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_17_BV
            
            /**
             * @desc    Check that IUT doesn't send secured DENMs if IUT doesn't possess an AT certificate allowing 
             *          sending DENM by its appPermissions. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A4_AT)
             *         containing appPermissions
             *             not containing PsidSSP
             *                 containing psid
             *                     indicating AID_CAM
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_18_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_18_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_A4_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_18_BV
            
        } // End of group denmProfile
         * @desc Sending behaviour test cases for DENM profile
garciay's avatar
garciay committed
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.6 Generic signed message profile
        group genericSignedMessageProfile {
            
            /**
             * @desc    Check that IUT sends the secured message 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)
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured Beacon
             *     } then {
             *         the IUT sends a message of type EtsiTs103097Data
             *             containing content 
             *                 containing signedData 
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_01_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             */
            testcase TC_SEC_ITSS_SND_GENMSG_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // 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_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(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: The GN message is secured ***");
                        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_GENMSG_01_BV
            
            /**
             * @desc    Check that the sent Secured Message contains HeaderField its_aid that is set to other value then AID_CAM and AID_DENM.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT)
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured Beacon
             *     } then {
             *         the IUT sends a Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing tbsData
             *                         containing headerInfo
             *                             containing psid
             *                                 indicating 'AID_GNMGMT'
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_02_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             */
            testcase TC_SEC_ITSS_SND_GENMSG_02_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' required for executing the TC ***");
                    stop;
                }
                
                // 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_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(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: The GN message is secured ***");
                        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_GENMSG_02_BV
            
            /**
             * @desc    Check that IUT sends the secured GeoNetworking message with the headerInfo containing generationTime.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT)
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured Beacon
             *     } then {
             *         the IUT sends a Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing tbsData
             *                         containing headerInfo
             *                             containing generationTime
             *                             and not containing expiryTime
             *                             and not containing generationLocation, 
             *                             and not containing encryptionKey
             *                             and not containing p2pcdLearningRequest
             *                             and not containing missingCrlIdentifier
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_03_BV
             * @reference   ETSI TS 103 097 [1] Clauses 5.2 & 7.1.3
             */
            testcase TC_SEC_ITSS_SND_GENMSG_03_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' required for executing the TC ***");
                    stop;
                }
                
                // 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_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(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: The GN message is secured ***");
                        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_GENMSG_03_BV
            
            /**
             * @desc    Check that IUT sends the secured GeoNetworking message containing certificate or digest as a signer.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT)
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured Beacon
             *     } then {
             *         the IUT sends a Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing signer
             *                         containing digest
             *                         or containing certificate
             *                             containing toBeSigned
             *                                 containing appPermissions
             *                                     containing the item of type PsidSsp
             *                                         containing psid
             *                                             indicating AID_GNMGMT
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_04_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             * @reference   IEEE 1609.2 [2] Clause 6.3.4
             */
            testcase TC_SEC_ITSS_SND_GENMSG_04_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' required for executing the TC ***");
                    stop;
                }
                
                // 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