ItsSecurity_TestCases.ttcn3 1.27 MB
Newer Older
garciay's avatar
garciay committed
                    v_securedMessage,
                    m_payload_signed(
                        ''O
                    ),
                    e_certificate_digest_with_sha256,
                    valueof(m_threeDLocation(
                        v_longPosVectorNodeB.latitude,
                        v_longPosVectorNodeB.longitude,
                        '0000'O
                    ))
                );
                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_09_02_BO
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards the Secured DENM containing payload of type 'unsecured'
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_01) 
             *          containing payload_field
             *              containing type
             *                  indicating 'unsecured'
             *              and containing data
garciay's avatar
garciay committed
             *                  indicating length > 0
garciay's avatar
garciay committed
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             *
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_09_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_09_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
garciay's avatar
garciay committed
                var integer i;
                var GnNonSecuredPacket v_gnNonSecuredPacket;
                var octetstring v_gnPayload;
                var template (value) SecuredMessage v_securedMessage;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test Body
                v_gnNonSecuredPacket := valueof(
                    m_geoNwBroadcastPacket(
                        v_longPosVectorNodeB,
                        vc_localSeqNumber,
                        f_getGeoBroadcastArea(
                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
                )));
                // Add the DENM payload
                v_gnNonSecuredPacket.payload := valueof(
                    f_adaptPayload_m(
                        bit2oct(
                            encvalue(
                                m_denmReq(
                                    m_denmPdu(
                                        m_denm(
                                            m_denmMgmtCon(
                                                m_tsActionId
                                            ),
                                            v_situation,
                                            m_denmLocation_zeroDelta
                )))))));
                
                // Encode it
                v_gnPayload := bit2oct(
                    encvalue(
                        v_gnNonSecuredPacket
                    )
                );
                f_buildGnSecuredDenm(
                    v_securedMessage,
                        m_payload_unsecured(
                            v_gnPayload
                    ),
                    e_certificate_digest_with_sha256,
                    valueof(m_threeDLocation(
                        v_longPosVectorNodeB.latitude,
                        v_longPosVectorNodeB.longitude,
                        '0000'O
                    ))
                );
                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_09_03_BO
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards the Secured DENM containing payload of type 'encrypted'
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_01) 
             *          containing payload_field
             *              containing type
             *                  indicating 'encrypted'
             *              and containing data
garciay's avatar
garciay committed
             *                  indicating length > 0
garciay's avatar
garciay committed
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             *
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_09_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_09_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
garciay's avatar
garciay committed
                var integer i;
                var GnNonSecuredPacket v_gnNonSecuredPacket;
                var octetstring v_gnPayload;
                var template (value) SecuredMessage v_securedMessage;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test Body
                v_gnNonSecuredPacket := valueof(
                    m_geoNwBroadcastPacket(
                        v_longPosVectorNodeB,
                        vc_localSeqNumber,
                        f_getGeoBroadcastArea(
                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
                )));
                // Add the DENM payload
                v_gnNonSecuredPacket.payload := valueof(
                    f_adaptPayload_m(
                        bit2oct(
                            encvalue(
                                m_denmReq(
                                    m_denmPdu(
                                        m_denm(
                                            m_denmMgmtCon(
                                                m_tsActionId
                                            ),
                                            v_situation,
                                            m_denmLocation_zeroDelta
                )))))));
                
                // Encode it
                v_gnPayload := bit2oct(
                    encvalue(
                        v_gnNonSecuredPacket
                    )
                );
                f_buildGnSecuredDenm(
                    v_securedMessage,
                        m_payload_encrypted(
                            v_gnPayload
                    ),
                    e_certificate_digest_with_sha256,
                    valueof(m_threeDLocation(
                        v_longPosVectorNodeB.latitude,
                        v_longPosVectorNodeB.longitude,
                        '0000'O
                    ))
                );
                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
garciay's avatar
garciay committed
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_09_04_BO
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards the Secured DENM containing payload of type 'signed_external'
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_01) 
             *          containing payload_field
             *              containing type
             *                  indicating 'signed_external'
             *              and containing data
             *                  indicating length > 0
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             *
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_09_05_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_09_05_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
garciay's avatar
garciay committed
                var integer i;
                var GnNonSecuredPacket v_gnNonSecuredPacket;
                var octetstring v_gnPayload;
                var template (value) SecuredMessage v_securedMessage;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test Body
                v_gnNonSecuredPacket := valueof(
                    m_geoNwBroadcastPacket(
                        v_longPosVectorNodeB,
                        vc_localSeqNumber,
                        f_getGeoBroadcastArea(
                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
                )));
                // Add the DENM payload
                v_gnNonSecuredPacket.payload := valueof(
                    f_adaptPayload_m(
                        bit2oct(
                            encvalue(
                                m_denmReq(
                                    m_denmPdu(
                                        m_denm(
                                            m_denmMgmtCon(
                                                m_tsActionId
                                            ),
                                            v_situation,
                                            m_denmLocation_zeroDelta
                )))))));
                
                // Encode it
                v_gnPayload := bit2oct(
                    encvalue(
                        v_gnNonSecuredPacket
                    )
                );
                f_buildGnSecuredDenm(
                    v_securedMessage,
                        m_payload_signed_external(
                            v_gnPayload
                    ),
                    e_certificate_digest_with_sha256,
                    valueof(m_threeDLocation(
                        v_longPosVectorNodeB.latitude,
                        v_longPosVectorNodeB.longitude,
                        '0000'O
                    ))
                );
                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_09_05_BO
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards the Secured DENM containing exactly one non-empty payload of type 'signed_and_encrypted'
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_01) 
             *          containing payload_field
             *              containing type
             *                  indicating 'signed_and_encrypted'
             *              and containing data
             *                  indicating length > 0
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_09_06_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
garciay's avatar
garciay committed
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_09_06_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
garciay's avatar
garciay committed
                var integer i;
                var GnNonSecuredPacket v_gnNonSecuredPacket;
                var octetstring v_gnPayload;
                var template (value) SecuredMessage v_securedMessage;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test Body
                v_gnNonSecuredPacket := valueof(
                    m_geoNwBroadcastPacket(
                        v_longPosVectorNodeB,
                        vc_localSeqNumber,
                        f_getGeoBroadcastArea(
                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
                )));
                // Add the DENM payload
                v_gnNonSecuredPacket.payload := valueof(
                    f_adaptPayload_m(
                        bit2oct(
                            encvalue(
                                m_denmReq(
                                    m_denmPdu(
                                        m_denm(
                                            m_denmMgmtCon(
                                                m_tsActionId
                                            ),
                                            v_situation,
                                            m_denmLocation_zeroDelta
                )))))));
                
                // Encode it
                v_gnPayload := bit2oct(
                    encvalue(
                        v_gnNonSecuredPacket
                    )
                );
                f_buildGnSecuredDenm(
                    v_securedMessage,
                        m_payload_signed_and_encrypted(
                            v_gnPayload
                    ),
                    e_certificate_digest_with_sha256,
                    valueof(m_threeDLocation(
                        v_longPosVectorNodeB.latitude,
                        v_longPosVectorNodeB.longitude,
                        '0000'O
                    ))
                );
                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
garciay's avatar
garciay committed
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_09_06_BO
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards the Secured DENM if the message does not contain the trailer field of type signature
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
garciay's avatar
garciay committed
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *     the IUT is receiving a SecuredMessage
            *            containing trailer_fields
            *                not containing any instance of type TrailerField
            *                    containing type
            *                        indicating 'signature'
             *   } then {
             *     the IUT discards the message
             *   }
             * }
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_10_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
garciay's avatar
garciay committed
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_10_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
garciay's avatar
garciay committed
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
garciay's avatar
garciay committed
                
                // Test control
garciay's avatar
garciay committed
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test Body
                v_securedGnPdu := f_sendSecuredDenm_Bo(cc_taCert_A, -, 0);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
garciay's avatar
garciay committed
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_10_01_BO
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards the Secured DENM containing more than one instance of TrailerField of type 'signature'
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
garciay's avatar
garciay committed
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *     the IUT is receiving a SecuredMessage
            *          containing trailer_fields[0].type
            *              containing type
            *                  indicating 'signature'
            *          and containing trailer_fields[1].type
            *              containing type
            *                  indicating 'signature'
             *   } then {
             *     the IUT discards the message
             *   }
             * }
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_10_02_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
garciay's avatar
garciay committed
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_10_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
garciay's avatar
garciay committed
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
garciay's avatar
garciay committed
                
                // Test control
garciay's avatar
garciay committed
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test Body
                v_securedGnPdu := f_sendSecuredDenm_Bo(cc_taCert_A, -, 2);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
garciay's avatar
garciay committed
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_10_02_BO
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that the IUT discards Secured DENM containing signature that is not verified using the verification key from the certificate contained in the message's signer info
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
garciay's avatar
garciay committed
             * Expected behavior:
             *   with {
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_A_AT
             *   }
             *   ensure that {
             *     when {
             *         the IUT is receiving a SecuredMessage  (MSG_SEC_RCV_DENM_01)
            *               containing header_fields ['signer_info']
            *                   containing certificate (CERT_TS_A_AT)
            *                       containing subject_attributes['verification key'] (KEY)
            *               and containing trailer_fields[0]
            *                   containing type
            *                       indicating 'signature'
            *                   and containing signature
            *                       NOT verifiable using KEY
             *   } then {
             *     the IUT discards the message
             *   }
             * }
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_11_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
garciay's avatar
garciay committed
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_11_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
garciay's avatar
garciay committed
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
garciay's avatar
garciay committed
                
                // Test control
garciay's avatar
garciay committed
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test Body
                v_securedGnPdu := f_sendSecuredDenm_Bo(
                    cc_taCert_A, 
                    -, 
                    1, 
                    -, 
                    e_certificate
                );
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_11_01_BO
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT discards a Secured DENM if the signer certificate of the message contains the subject type 'enrolment_credential'
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *     when {
             *         the IUT is receiving a SecuredMessage  (MSG_SEC_RCV_DENM_01)
             *          containing header_fields['signer_info']
             *              containing signer
             *                  containing type
             *                      indicating 'certificate'
             *                  containing certificate (CERT_TS_EC_A)
             *                      containing subject_info.subject_type
             *                          indicating 'enrolment_credentials'
             *   } then {
             *       the IUT discards the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_12_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_DENM_12_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredDenm(
                    cc_taCert_EC, 
                    {
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_DENM
                    }, 
                    e_certificate
                ); 
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_12_01_BO
            
            /**
             * @desc    Check that IUT discards a Secured DENM if the signer certificate of the message contains the subject type "authorization_authority"
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *     when {
             *         the IUT is receiving a SecuredMessage  (MSG_SEC_RCV_DENM_01)
             *          containing header_fields['signer_info']
             *              containing signer
             *                  containing type
             *                      indicating 'certificate'
             *                  containing certificate (CERT_TS_A_AA)
             *                      containing subject_info.subject_type
             *                          indicating 'authorization_authority'
             *   } then {
             *       the IUT discards the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_12_02_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_DENM_12_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredDenm(
                    cc_taCert_AA, 
                    {
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_DENM
                    }, 
                    e_certificate
                ); 
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_12_02_BO
            
            /**
             * @desc    Check that IUT discards a Secured DENM if the signer certificate of the message contains the subject type 'enrolment_authority'
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *     when {
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_01)
             *          containing header_fields['signer_info']
             *              containing signer
             *                  containing type
             *                      indicating 'certificate'
             *              and certificate (CERT_TS_EA_A)
             *                  containing subject_info.subject_type
             *                      indicating 'enrolment_authority'
             *   } then {
             *       the IUT discards the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_12_03_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_DENM_12_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredDenm(
                    cc_taCert_EA, 
                    {
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_DENM
                    }, 
                    e_certificate
                ); 
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_12_03_BO
            
            /**
             * @desc    Check that IUT discards a Secured DENM if the signer certificate of the message contains the subject type 'root_ca'
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *     when {
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_01)
             *          containing header_fields['signer_info']
             *              containing signer
             *                  containing type
             *                      indicating 'certificate'
             *              and certificate (CERT_TS_ROOT)
             *                  containing subject_info.subject_type
             *                      indicating 'root_ca'
             *   } then {
             *       the IUT discards the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_DENM_12_04_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_DENM_12_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();