ItsSecurity_TestCases.ttcn3 987 KB
Newer Older
garciay's avatar
garciay committed
             *                  indicating length > 0
             *          and containing trailer_fields 
             *              containing single instance of type TrailerField 
             *                  containing type
             *                      indicating 'signature'
             *                  containing signature
             *                      verifiable using KEY
             *   } then {
             *     the IUT accepts the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_01_02_BV
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_01_02_BV() runs on ItsMtc system ItsSecSystem {
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_B));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_02_BV
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT accepts a well-formed Secured GN Beacon signed with the certificate with a rectangular region validity restriction
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_C_AT
             *   and the IUT current location is inside the region validity period of CERT_TS_C_AT
             * }
             * ensure that {
             *   when {
             *     the IUT is receiving a SecuredMessage
             *         containing protocol_version 
             *             indicating value '2'
             *         and containing header_fields[0]
             *              containing type 
             *                  indicating 'signer_info'
             *              and containing signer
             *                  containing type
             *                      indicating 'certificate'
             *                  and containing certificate (CERT_TS_C_AT)
             *                      containing subject_info.subject_type
             *                          indicating 'authorization_ticket' (2)
             *                      and containing subject_attributes['verification key'] (KEY)
             *                      and containing validity_restrictions['time_start_and_end']
             *                          indicating CERT_TS_AT_TIME_VALIDITY
             *                      and containing validity_restrictions['region']
             *                          containing region
             *                              containing region_type
             *                                  indicating 'rectangle'
             *                              and containing rectangular_region
             *                                  indicating REGION
             *       and containing header_fields [1]
             *         containing type 
             *           indicating 'generation_time'
             *              containing generation_time
             *                  indicating CURRENT_TIME
             *       and containing header_fields [2]
             *           containing type 
             *               indicating 'generation_location'
             *           and containing generation_location
             *       and containing header_fields[3]
             *           containing type 
             *               indicating 'its_aid'
             *           and containing its_aid
             *               indicating 'AID_BEACON'
             *          and containing payload_field 
             *               containing type
             *                  indicating 'signed'
             *              containing data
             *                  indicating length > 0
             *          and containing trailer_fields 
             *              containing single instance of type TrailerField 
             *                  containing type
             *                      indicating 'signature'
             *                  containing signature
             *                      verifiable using KEY
             *   } then {
             *     the IUT accepts the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_01_03_BV
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_01_03_BV() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_C));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_03_BV
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT accepts a well-formed Secured GN Beacon signed with the certificate with a rectangular region validity restriction
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_D_AT
             *   and the IUT current location is inside the region validity period of CERT_TS_D_AT
             * }
             * ensure that {
             *   when {
             *     the IUT is receiving a SecuredMessage
             *         containing protocol_version 
             *             indicating value '2'
             *         and containing header_fields[0]
             *              containing type 
             *                  indicating 'signer_info'
             *              and containing signer
             *                  containing type
             *                      indicating 'certificate'
             *                  and containing certificate (CERT_TS_D_AT)
             *                      containing subject_info.subject_type
             *                          indicating 'authorization_ticket' (2)
             *                      and containing subject_attributes['verification key'] (KEY)
             *                      and containing validity_restrictions['time_start_and_end']
             *                          indicating CERT_TS_AT_TIME_VALIDITY
             *                      and containing validity_restrictions['region']
             *                          containing region
             *                              containing region_type
             *                                  indicating 'polygon'
             *                              and containing polygonal_region
             *                                  indicating REGION
             *       and containing header_fields [1]
             *         containing type 
             *           indicating 'generation_time'
             *              containing generation_time
             *                  indicating CURRENT_TIME
             *       and containing header_fields [2]
             *           containing type 
             *               indicating 'generation_location'
             *           and containing generation_location
             *       and containing header_fields[3]
             *           containing type 
             *               indicating 'its_aid'
             *           and containing its_aid
             *               indicating 'AID_BEACON'
             *          and containing payload_field 
             *               containing type
             *                  indicating 'signed'
             *              containing data
             *                  indicating length > 0
             *          and containing trailer_fields 
             *              containing single instance of type TrailerField 
             *                  containing type
             *                      indicating 'signature'
             *                  containing signature
             *                      verifiable using KEY
             *   } then {
garciay's avatar
garciay committed
             *     the IUT accepts the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_01_04_BV
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_01_04_BV() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_D));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_04_BV
            
            /**
             * @desc    Check that IUT accepts a well-formed Secured GN Beacon signed with the certificate with a rectangular region validity restriction
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_E_AT
             *   and the IUT current location is inside the region validity period of CERT_TS_E_AT
             * }
             * ensure that {
             *   when {
             *     the IUT is receiving a SecuredMessage
             *         containing protocol_version 
             *             indicating value '2'
             *         and containing header_fields[0]
             *              containing type 
             *                  indicating 'signer_info'
             *              and containing signer
             *                  containing type
             *                      indicating 'certificate'
             *                  and containing certificate (CERT_TS_E_AT)
             *                      containing subject_info.subject_type
             *                          indicating 'authorization_ticket' (2)
             *                      and containing subject_attributes['verification key'] (KEY)
             *                      and containing validity_restrictions['time_start_and_end']
             *                          indicating CERT_TS_AT_TIME_VALIDITY
             *                      and containing validity_restrictions['region']
             *                          containing region
             *                              containing region_type
             *                                  indicating 'id_region'
             *                              and containing id_region
             *                                  indicating REGION
             *       and containing header_fields [1]
             *         containing type 
             *           indicating 'generation_time'
             *              containing generation_time
             *                  indicating CURRENT_TIME
             *       and containing header_fields [2]
             *           containing type 
             *               indicating 'generation_location'
             *           and containing generation_location
             *       and containing header_fields[3]
             *           containing type 
             *               indicating 'its_aid'
             *           and containing its_aid
             *               indicating 'AID_BEACON'
             *          and containing payload_field 
             *               containing type
             *                  indicating 'signed'
             *              containing data
             *                  indicating length > 0
             *          and containing trailer_fields 
             *              containing single instance of type TrailerField 
             *                  containing type
             *                      indicating 'signature'
             *                  containing signature
             *                      verifiable using KEY
             *   } then {
             *     the IUT accepts the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_01_05_BV
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_01_05_BV() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_E));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_05_BV
            
            group g_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV {
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                 */
                function f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(
                                                                 in charstring p_taCert
                ) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
                    
                    // Preamble
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    v_securedGnPdu := f_sendSecuredBeacon(p_taCert, omit, e_certificate);
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    
                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV
            
            /**
             * @desc    Check that IUT discards a Secured GN Message containing protocol version set to a value less than 2
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *     the IUT is receiving a SecuredMessage
             *         containing protocol_version 
             *             indicating 1
             *   } then {
             *     the IUT discards the message
             *   }
             * }
             * </pre>
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_02_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.2
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_02_01_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO_nodeB(c_protocol_version - 1));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_02_01_BO
            
            /**
             * @desc    Check that IUT discards a Secured GN Message containing protocol version set to a value greater than 2
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *     the IUT is receiving a SecuredMessage
             *         containing protocol_version 
             *             indicating 3
             *   } then {
             *     the IUT discards the message
garciay's avatar
garciay committed
             *   }
             * }
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_02_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_GENMSG_02_02_BO() runs on ItsMtc system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO_nodeB(c_protocol_version + 1));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
garciay's avatar
garciay committed
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_02_02_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO {
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                 */
                function f_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO_nodeB(
                                                                 in integer p_protocolVersion
                ) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
                    
                    // Preamble
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    v_securedGnPdu := f_sendSecuredBeacon_Bo(cc_taCert_A, p_protocolVersion);
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    
                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO_nodeB
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_02_0x_BV
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured GN Message if the header_fields contains more than one header field of type 'signer_info'
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *    the IUT being in the 'authorized' state 
             *    and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *          and containing header_fields[1].type
             *              indicating 'signer_info'
             *          and containing header_fields[2].type
             *              indicating 'generation_time'
             *          and containing header_fields[3].type
             *              indicating ''generation_location''
             *          and containing header_fields[4].type
             *              containing its_aid
             *                  indicating 'AID_BEACON'
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             *
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_04_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.1
garciay's avatar
garciay committed
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_GENMSG_04_01_BO() runs on ItsMtc system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_01_BO());
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
garciay's avatar
garciay committed
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_01_BO
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            group g_TC_SEC_ITSS_RCV_GENMSG_04_01_BO {
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_04_01_BO() runs on ItsGeoNetworking {
garciay's avatar
garciay committed
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
garciay's avatar
garciay committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                    
                    //  Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
garciay's avatar
garciay committed
                    
                    // Preamble
garciay's avatar
garciay committed
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                    
                    // Test Body
garciay's avatar
garciay committed
                    v_securedGnPdu := f_prepareSecuredBeacon(
                        cc_taCert_A, 
                        {
                            m_header_field_signer_info(
                                m_signerInfo_digest(
                                    vc_atCertificate.signer_info.signerInfo.digest
                            )), 
                            m_header_field_signer_info(
                                m_signerInfo_certificate(
                                    vc_aaCertificate
                            )), 
                            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_Other
                        }, 
                        e_certificate_digest_with_sha256,
                        false
                    ); 
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    
garciay's avatar
garciay committed
                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_01_BO
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_01_BO 
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured GN Message if the header_fields does not contain the header field of type 'signer_info'
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *    the IUT being in the 'authorized' state 
             *    and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          and containing header_fields[0].type
             *              indicating 'generation_time'
             *          and containing header_fields[1].type
             *              indicating 'generation_location'
             *          and containing header_fields[2].type
             *              indicating 'signer_info'
             *          and containing header_fields[3].type
             *              containing its_aid
             *                  indicating 'AID_BEACON'
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             *
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_04_02_BO
             * @reference    ETSI TS 103 097 [1], clause 7.1
garciay's avatar
garciay committed
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_GENMSG_04_02_BO() runs on ItsMtc system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_02_BO());
garciay's avatar
garciay committed
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_02_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_04_02_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_04_02_BO() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                    
                    //  Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    // Test Body
                    v_securedGnPdu := f_prepareSecuredBeacon(
                        cc_taCert_A, 
                        {
                            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_Other
                        }, 
                        e_certificate_digest_with_sha256,
                        false
                    ); 
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    
                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_02_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_02_BO 
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT is able to receive a secured GN Message if the signer_info header field is not encoded first.
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *    the IUT being in the 'authorized' state 
             *    and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          and containing header_fields[0].type
             *              indicating 'generation_time'
             *          and containing header_fields[1].type
             *              indicating 'generation_location'
             *          and containing header_fields[2].type
             *              containing its_aid
             *                  indicating 'AID_BEACON'
             *          and containing header_fields[3].type
             *              indicating 'signer_info'
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             * </pre>
garciay's avatar
garciay committed
             *
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_04_03_BO
             * @reference    ETSI TS 103 097 [1], clause 7.1
garciay's avatar
garciay committed
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_GENMSG_04_03_BO() runs on ItsMtc system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_03_BO());
garciay's avatar
garciay committed
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_03_BO
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            group g_TC_SEC_ITSS_RCV_GENMSG_04_03_BO {
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_04_03_BO() runs on ItsGeoNetworking {
garciay's avatar
garciay committed
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
garciay's avatar
garciay committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                    
                    //  Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
garciay's avatar
garciay committed
                    
                    // Preamble
garciay's avatar
garciay committed
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
garciay's avatar
garciay committed
                    
                    // Test Body
garciay's avatar
garciay committed
                    v_securedGnPdu := f_prepareSecuredBeacon(
                        cc_taCert_A, 
                        {
                            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_Other,
                            m_header_field_signer_info(
                                m_signerInfo_digest(
                                    vc_atCertificate.signer_info.signerInfo.digest
                            ))
                        }, 
                        e_certificate_digest_with_sha256,
                        false
                    ); 
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    
garciay's avatar
garciay committed
                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_03_BO
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_03_BO 
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured GN Message if the message contains more than one header field of type 'generation_time'
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * 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_GENMSG_A) 
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *          and containing header_fields[1].type
garciay's avatar
garciay committed
             *              indicating 'generation_time'
garciay's avatar
garciay committed
             *          and containing header_fields[2].type
             *              indicating 'generation_time'
             *          and containing header_fields[3].type
garciay's avatar
garciay committed
             *              indicating 'generation_time'
garciay's avatar
garciay committed
             *          and containing header_fields[4].type
             *              containing its_aid
             *                  indicating 'AID_BEACON'
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_04_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_GENMSG_04_04_BO() runs on ItsMtc system ItsSecSystem {
garciay's avatar
garciay committed
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY' and 'PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_04_BO());
garciay's avatar
garciay committed
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_04_BO
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            group g_TC_SEC_ITSS_RCV_GENMSG_04_04_BO {
garciay's avatar
garciay committed
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
garciay's avatar
garciay committed
                function f_TC_SEC_ITSS_RCV_GENMSG_04_04_BO() runs on ItsGeoNetworking {
garciay's avatar
garciay committed
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                    
                    //  Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    // Test Body
                    v_securedGnPdu := f_prepareSecuredBeacon(
                        cc_taCert_A, 
                        {
                            m_header_field_signer_info(
                                m_signerInfo_digest(
                                    vc_atCertificate.signer_info.signerInfo.digest
garciay's avatar
garciay committed
                            )),
garciay's avatar
garciay committed
                            m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
garciay's avatar
garciay committed
                            m_header_field_generation_time(1000 * f_getCurrentTime() - 1), // In us
garciay's avatar
garciay committed
                            m_header_field_generation_location(
                                valueof(m_threeDLocation(
                                    v_longPosVectorNodeB.latitude,
                                    v_longPosVectorNodeB.longitude,
                                    '0000'O
                                ))
                            ),
                            m_header_field_its_aid_Other
                        }, 
                        e_certificate_digest_with_sha256,
                        false
                    ); 
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    
garciay's avatar
garciay committed
                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_04_BO
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_04_BO 
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured GN Message if the message does not contain the header field of type 'generation_time'
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * 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_GENMSG_A) 
             *          containing header_fields[0].type
             *              indicating 'signer_info'
garciay's avatar
garciay committed
             *          and containing header_fields[1].type
garciay's avatar
garciay committed
             *              indicating 'generation_time'
garciay's avatar
garciay committed
             *          and containing header_fields[2].type
             *              containing its_aid
             *                  indicating 'AID_BEACON'
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.2.2 TP_SEC_ITSS_RCV_GENMSG_04_05_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1