ItsSecurity_TestCases.ttcn3 1.4 MB
Newer Older
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *                  containing signer.type
             *                      indicating 'self'
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_05_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_DENM_05_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                
                // Test adapter configuration
                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_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_signer_info(
                            m_signerInfo_self
                        ), 
garciay's avatar
garciay committed
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_generation_location(
                            valueof(m_threeDLocation(
                                v_longPosVectorNodeB.latitude,
                                v_longPosVectorNodeB.longitude,
                                '0000'O
                            ))
                        ),
                        m_header_field_its_aid_DENM
                    }, 
                    e_self,
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // 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);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_05_01_BO
            
            /**
             * @desc    Check that IUT discards a Secured DENM if the header_fields contains a signer of type 'certificate_digest_with_other_algorithm'
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * 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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *                  containing signer.type
             *                      indicating 'certificate_digest_with_other_algorithm'
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_05_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_DENM_05_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
garciay's avatar
garciay committed
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_signer_info(
                            m_signerInfo_other_certificates(
                                m_certificateWithAlgo_ecdsa(
                                    PX_OTHER_CERT_DIGEST
                        ))), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_generation_location(
                            valueof(m_threeDLocation(
                                v_longPosVectorNodeB.latitude,
                                v_longPosVectorNodeB.longitude,
                                '0000'O
                            ))
                        ),
                        m_header_field_its_aid_DENM
                    }, 
                    e_certificate_digest_with_other_algorithm,
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // 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);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_05_02_BO
            
            /**
             * @desc    Check that IUT discards a Secured DENM if the header_fields contains a signer of type certificate_chain
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * 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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *                  containing signer.type
             *                      indicating 'certificate_digest_with_other_algorithm'
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_05_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_DENM_05_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
garciay's avatar
garciay committed
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_signer_info(
                            m_signerInfo_certificates(
                                { vc_aaCertificate, vc_atCertificate }
                        )), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_generation_location(
                            valueof(m_threeDLocation(
                                v_longPosVectorNodeB.latitude,
                                v_longPosVectorNodeB.longitude,
                                '0000'O
                            ))
                        ),
                        m_header_field_its_aid_DENM
                    }, 
                    e_certificate_chain,
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // 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);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_05_03_BO
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT discards a secured DENM if the header_fields contains a signer info of unknown or reserved type
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * 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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *                  containing signer.type
             *                      indicating X_UNKNOWN_SIGNERINFO_TYPE
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_05_04_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_DENM_05_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                
                // Test adapter configuration
                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_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_signer_info(
                            m_signerInfo_unknown(
                                'CAFFEEDECA'O
                        )), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_generation_location(
                            valueof(m_threeDLocation(
                                v_longPosVectorNodeB.latitude,
                                v_longPosVectorNodeB.longitude,
                                '0000'O
                            ))
                        ),
                        m_header_field_its_aid_DENM
                    }, 
                    e_unknown,
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // 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);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_05_04_BO
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT discards a Secured DENM containing generation_time before the certificate validity period
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * 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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          containing header_fields['signer_info'].signer 
garciay's avatar
garciay committed
             *              containing certificate (CERT_TS_MSG_06_01_BO_AT)
garciay's avatar
garciay committed
             *                  containing validity_restrictions['time_start_and_end']
             *                      containing start_validity
             *                          indicating START_VALIDITY_AT
             *                      and containing end_validity
             *                          indicating END_VALIDITY_AT
             *          and containing header_fields ['generation_time']
             *              containing generation_time
             *                  indicating GEN_TIME < START_VALIDITY_AT
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_06_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 5.4 and 7.2
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_06_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
garciay's avatar
garciay committed
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
garciay's avatar
garciay committed
                var ValidityRestriction v_timeValidity;
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_timeValidity);
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredDenm(
garciay's avatar
garciay committed
                    cc_taCert0601_BO, 
garciay's avatar
garciay committed
                    {
garciay's avatar
garciay committed
                        m_header_field_generation_time(
                            (v_timeValidity.validity.time_start_and_end.start_validity - 3600) * 1000
garciay's avatar
garciay committed
                        ) // In us
                    }, 
                    e_certificate
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
garciay's avatar
garciay committed
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
garciay's avatar
garciay committed
                else {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_DENM_06_01_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a Secured DENM containing generation_time before the certificate validity period
             * Pics Selection: PICS_GN_SECURITY
             * 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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A)
garciay's avatar
garciay committed
             *          containing header_fields['signer_info'].signer 
garciay's avatar
garciay committed
             *              containing certificate (CERT_TS_MSG_06_02_BO_AT)
garciay's avatar
garciay committed
             *                  containing validity_restrictions['time_start_and_end']
             *                      containing start_validity
             *                          indicating START_VALIDITY_AT
             *                      and containing end_validity
             *                          indicating END_VALIDITY_AT
             *          and containing header_fields ['generation_time']
garciay's avatar
garciay committed
             *              containing generation_time
garciay's avatar
garciay committed
             *                  indicating GEN_TIME > END_VALIDITY_AT
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_06_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 5.4 and 7.2
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_06_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
garciay's avatar
garciay committed
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
garciay's avatar
garciay committed
                var ValidityRestriction v_validity;
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_validity);
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredDenm(
garciay's avatar
garciay committed
                    cc_taCert0602_BO, 
garciay's avatar
garciay committed
                    {
garciay's avatar
garciay committed
                        m_header_field_generation_time(
                            (v_validity.validity.time_start_and_end.end_validity + 3600) * 1000
garciay's avatar
garciay committed
                        ) // In us
                    }, 
                    e_certificate
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
garciay's avatar
garciay committed
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
garciay's avatar
garciay committed
                }
                else {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_DENM_06_02_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a Secured DENM if the generation_time is more than 10 minute in the past (C2C only)
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
garciay's avatar
garciay committed
             * 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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          containing header_fields ['generation_time']
             *              containing generation_time
             *                  indicating GEN_TIME ( CURRENT_TIME - 11min )
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_06_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 5.4 and 7.2
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_DENM_06_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
garciay's avatar
garciay committed
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
garciay's avatar
garciay committed
                // Test adapter configuration
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
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_generation_time( 
                            (1000 * f_getCurrentTime() - 660) * 1000
                        ) // In us
                    }, 
                    e_certificate
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // 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);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_06_03_BO
            
            /**
             * @desc    Check that IUT discards a Secured DENM if the generation_time is more than 10 minute in the future(C2C only)
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
             * 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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          containing header_fields ['generation_time']
             *              containing generation_time
             *                  indicating GEN_TIME ( CURRENT_TIME + 11min )
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_06_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 5.4 and 7.2
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_DENM_06_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                
                // Test adapter configuration
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;
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_generation_time( 
                            (1000 * f_getCurrentTime() + 660) * 1000
                        ) // In us
                    }, 
                    e_certificate
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
garciay's avatar
garciay committed
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
garciay's avatar
garciay committed
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_DENM_06_04_BO
garciay's avatar
garciay committed
             * @desc  Check that IUT discards secured DENM when its_aid value is not equal to AID_DENM
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *  }
             *  ensure that {
             *      when { 
garciay's avatar
garciay committed
             *          the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A)
garciay's avatar
garciay committed
             *              containing header_fields['its_aid']
garciay's avatar
garciay committed
             *                  indicating 'AID_CAM'
garciay's avatar
garciay committed
             *              and containing payload_field 
garciay's avatar
garciay committed
             *                  containing type    
garciay's avatar
garciay committed
             *                    indicating 'signed' 
garciay's avatar
garciay committed
             *                  containing data    
garciay's avatar
garciay committed
             *                    containing DENM payload
garciay's avatar
garciay committed
             *      } then {
garciay's avatar
garciay committed
             *          the IUT discards the DENM
garciay's avatar
garciay committed
             *      }
             *  }
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_07_01_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_07_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
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
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_its_aid_CAM
                    }
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
garciay's avatar
garciay committed
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
garciay's avatar
garciay committed
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_DENM_07_01_BO
garciay's avatar
garciay committed
             * @desc  Check that IUT discards a Secured DENM when its_aid value is undefined
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *  }
             *  ensure that {
             *      when { 
garciay's avatar
garciay committed
             *          the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A)
garciay's avatar
garciay committed
             *             containing header_fields['its_aid'] 
             *                 indicating 'AID_UNDEFINED' 
             *             and containing payload_field { 
             *                 containing type 
             *                     indicating 'signed' 
             *                 containing data 
             *                     containing DENM payload 
garciay's avatar
garciay committed
             *      } then {
             *          the IUT discards the DENM
             *      }
             *  }
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_07_02_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_07_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
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
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
garciay's avatar
garciay committed
                        m_header_field_its_aid_Other
garciay's avatar
garciay committed
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // 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);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_DENM_07_02_BO
garciay's avatar
garciay committed
             * @desc   Check that IUT discards Secured DENM if the HeaderField generation_location is outside of the circular validity region of the signing certificate
             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with {
             *   the IUT being in the 'authorized' state
garciay's avatar
garciay committed
             * }
             * ensure that {
             *   when {
             *     the IUT is requested to send DENM
garciay's avatar
garciay committed
             *     the IUT is receiving a SecuredMessage
garciay's avatar
garciay committed
             *          containing header_fields['signer_info'].type
             *              indicating 'certificate'
             *          and containing  header_fields ['signer_info'].certificate (CERT_AT_B)
garciay's avatar
garciay committed
             *              containing validity_restrictions['region']
             *                  containing region
garciay's avatar
garciay committed
             *                      containing region_type
             *                          indicating 'circle'
             *                      and containing circular_region
             *                          indicating REGION
             *          and containing header_fields ['generation_location']
             *              containing generation_location
             *                  indicating position outside the REGION
             *          and containing header_fields['its_aid']
             *              indicating 'AID_DENM'
garciay's avatar
garciay committed
             *      } then {
             *          the IUT discards the DENM
             *      }
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_01_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_08_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                if (not(PICS_GN_SECURITY) or not(PICS_USE_CIRCULAR_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' required for executing the TC ***");
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_sendSecuredDenm(cc_taCert_B_BO, omit, e_certificate);
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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
garciay's avatar
garciay committed
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
garciay's avatar
garciay committed
                else {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_DENM_08_01_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards Secured DENM if the HeaderField generation_location is outside of the rectangilar validity region of the signing certificate
             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with {
             *   the IUT being in the 'authorized' state
garciay's avatar
garciay committed
             * }
             * ensure that {
             *   when {
             *     the IUT is requested to send DENM
garciay's avatar
garciay committed
             *     the IUT is receiving a SecuredMessage
garciay's avatar
garciay committed
             *          containing header_fields['signer_info'].type
             *              indicating 'certificate'
             *          and containing  header_fields ['signer_info'].certificate (CERT_AT_C)
garciay's avatar
garciay committed
             *              containing validity_restrictions['region']
             *                  containing region
garciay's avatar
garciay committed
             *                      containing region_type
             *                          indicating 'rectangle'
             *                      and containing rectangular_regions
             *                          indicating REGION
             *          and containing header_fields ['generation_location']
             *              containing generation_location
             *                  indicating position outside the REGION
             *          and containing header_fields['its_aid']
             *              indicating 'AID_DENM'
garciay's avatar
garciay committed
             *      } then {
             *          the IUT discards the DENM
             *      }
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_02_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_08_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                if (not(PICS_GN_SECURITY) or not(PICS_USE_RECTANGULAR_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' required for executing the TC ***");
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_sendSecuredDenm(cc_taCert_C_BO, omit, e_certificate);
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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
garciay's avatar
garciay committed
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
garciay's avatar
garciay committed
                }
                else {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_DENM_08_02_BO