Skip to content
ItsSecurity_TestCases.ttcn3 1.4 MiB
Newer Older
garciay's avatar
garciay committed
             * @desc    Check that IUT discards Secured DENM if the HeaderField generation_location is outside of the polygonal validity region of the signing certificate    
             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_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_D)
garciay's avatar
garciay committed
             *              containing validity_restrictions['region']
             *                  containing region
garciay's avatar
garciay committed
             *                      containing region_type
             *                          indicating 'polygon'
             *                      and containing polygonal_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_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_08_03_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_POLYGONAL_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_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_D_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_03_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards Secured DENM if the HeaderField generation_location is outside of the identified validity region of the signing certificate 
             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_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_E)
garciay's avatar
garciay committed
             *              containing validity_restrictions['region']
             *                  containing region
garciay's avatar
garciay committed
             *                      containing region_type
             *                          indicating 'id_region'
             *                      and containing identified_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_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_08_04_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_IDENTIFIED_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_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_E_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_04_BO
            
garciay's avatar
garciay committed
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT accepts a Secured DENM if the distance between the current position of IUT and the value of optional HeaderField generation_location is 29.9 km (C2C only)
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY and PICS_ITS_C2C_MODE
garciay's avatar
garciay committed
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
garciay's avatar
garciay committed
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
             * }
             * ensure that {
             *   when {
garciay's avatar
garciay committed
             *     the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A)
             *          containing header_fields[generation_location].type 
             *              indicating 'generation_location'
             *          and containing generation_location
             *              indicating position in 29.9 km from the current position of IUT
garciay's avatar
garciay committed
             *   } then {
             *     the IUT accepts the message
             *   }
             * }
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_05_BV
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_05_BV() 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;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                var Int32 v_latitude;
                var Int32 v_longitude;
                
garciay's avatar
garciay committed
                
                // Test control
garciay's avatar
garciay committed
                if (not(PICS_GN_SECURITY) or not(PICS_ITS_C2C_MODE)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_ITS_C2C_MODE' 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
                fx_computePositionUsingDistance(
                    v_longPosVectorNodeB.latitude,
                    v_longPosVectorNodeB.longitude,
garciay's avatar
garciay committed
                    0,
                    v_latitude,
                    v_longitude
                );
                v_securedGnPdu := f_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_generation_location(
                            valueof(m_threeDLocation(
                                v_latitude,
                                v_longitude,
                                '0000'O
                            ))
                        )
                    }, 
                    e_certificate_digest_with_sha256
                ); 
                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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                else {
                    log("*** " & testcasename() & ": FAIL: DENM was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_DENM_08_05_BV
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards Secured DENM if the distance between the current position of IUT and the value of optional HeaderField generation_location is more than 30 km
garciay's avatar
garciay committed
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY and PICS_ITS_C2C_MODE
garciay's avatar
garciay committed
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
garciay's avatar
garciay committed
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
             * }
             * ensure that {
             *   when {
garciay's avatar
garciay committed
             *     the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A)
             *          containing header_fields[generation_location].type 
             *              indicating 'generation_location'
             *          and containing generation_location
             *              indicating position in 31 km from the current position of IUT
garciay's avatar
garciay committed
             *   } then {
garciay's avatar
garciay committed
             *     the IUT discards the message
garciay's avatar
garciay committed
             *   }
             * }
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_06_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_06_BO() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Local variables
garciay's avatar
garciay committed
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                var Int32 v_latitude;
                var Int32 v_longitude;
                
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test control
garciay's avatar
garciay committed
                if (not(PICS_GN_SECURITY) or not (PICS_ITS_C2C_MODE)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_ITS_C2C_MODE' 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
                fx_computePositionUsingDistance(
                    v_longPosVectorNodeB.latitude,
                    v_longPosVectorNodeB.longitude,
garciay's avatar
garciay committed
                    0,
                    v_latitude,
                    v_longitude
                );
                v_securedGnPdu := f_prepareSecuredDenm(
                    cc_taCert_A, 
                    {
                        m_header_field_generation_location(
                            valueof(m_threeDLocation(
                                v_latitude,
                                v_longitude,
                                '0000'O
                            ))
                        )
                    }, 
                    e_certificate_digest_with_sha256
                ); 
                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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
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);
                }
                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_08_06_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 empty payload of type 'signed'
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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          containing payload_field
             *              containing type
             *                  indicating 'signed'
             *              and containing data
             *                  indicating length 0
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_09_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_09_02_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(
                        ''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) {
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);
                }
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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          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
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.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) {
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);
                }
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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          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
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.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) {
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 ***");
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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          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
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.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) {
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);
                }
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 { 
garciay's avatar
garciay committed
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A) 
garciay's avatar
garciay committed
             *          containing payload_field
             *              containing type
             *                  indicating 'signed_and_encrypted'
             *              and containing data
             *                  indicating length > 0
             *  } 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_09_06_BO
garciay's avatar
garciay committed
             * @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) {
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 ***");
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 {
garciay's avatar
garciay committed
             *     the IUT is receiving a SecuredMessage (MSG_SEC_RCV_DENM_A)
garciay's avatar
garciay committed
            *            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.3.2 TP_SEC_ITSS_RCV_DENM_10_01_BO
garciay's avatar
garciay committed
             * @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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
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);
                }
                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