ItsSecurity_TestCases.ttcn3 1.39 MB
Newer Older
garciay's avatar
garciay committed
20001 20002 20003 20004 20005 20006 20007 20008 20009 20010 20011 20012 20013 20014 20015 20016 20017 20018 20019 20020 20021 20022 20023 20024 20025 20026 20027 20028 20029 20030 20031 20032 20033 20034 20035 20036 20037 20038 20039 20040 20041 20042 20043 20044 20045 20046 20047 20048 20049 20050 20051 20052 20053 20054 20055 20056 20057 20058 20059 20060 20061 20062 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 20075 20076 20077 20078 20079 20080 20081 20082 20083 20084 20085 20086 20087 20088 20089 20090 20091 20092 20093 20094 20095 20096 20097 20098 20099 20100 20101 20102 20103 20104 20105 20106 20107 20108 20109 20110 20111 20112 20113 20114 20115 20116 20117 20118 20119 20120 20121 20122 20123 20124 20125 20126 20127 20128 20129 20130 20131 20132 20133 20134 20135 20136 20137 20138 20139 20140 20141 20142 20143 20144 20145 20146 20147 20148 20149 20150 20151 20152 20153 20154 20155 20156 20157 20158 20159 20160 20161 20162 20163 20164 20165 20166 20167 20168 20169 20170 20171 20172 20173 20174 20175 20176 20177 20178 20179 20180 20181 20182 20183 20184 20185 20186 20187 20188 20189 20190 20191 20192 20193 20194 20195 20196 20197 20198 20199 20200 20201 20202 20203 20204 20205 20206 20207 20208 20209 20210 20211 20212 20213 20214 20215 20216 20217 20218 20219 20220 20221 20222 20223 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 20239 20240 20241 20242 20243 20244 20245 20246 20247 20248 20249 20250 20251 20252 20253 20254 20255 20256 20257 20258 20259 20260 20261 20262 20263 20264 20265 20266 20267 20268 20269 20270 20271 20272 20273 20274 20275 20276 20277 20278 20279 20280 20281 20282 20283 20284 20285 20286 20287 20288 20289 20290 20291 20292 20293 20294 20295 20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 20306 20307 20308 20309 20310 20311 20312 20313 20314 20315 20316 20317 20318 20319 20320 20321 20322 20323 20324 20325 20326 20327 20328 20329 20330 20331 20332 20333 20334 20335 20336 20337 20338 20339 20340 20341 20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 20352 20353 20354 20355 20356 20357 20358 20359 20360 20361 20362 20363 20364 20365 20366 20367 20368 20369 20370 20371 20372 20373 20374 20375 20376 20377 20378 20379 20380 20381 20382 20383 20384 20385
                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_05_01_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_05_01_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_05_01_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_signer_info(
                                m_signerInfo_self
                            ), 
                            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_self,
                        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_05_01_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_05_01_BO 
            
            /**
             * @desc    Check that IUT discards a secured GN Beacon if the header_fields contains a signer of type 'certificate_digest_with_other_algorithm'
             * <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 { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          containing header_fields['signer_info']
             *              containing signer.type
             *                  indicating 'certificate_digest_with_other_algorithm'
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_05_02_BO
             * @reference    ETSI TS 103 097 [1], clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_05_02_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_05_02_BO());
                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_05_02_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_05_02_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_05_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_signer_info(
                                m_signerInfo_other_certificates(
                                    m_certificateWithAlgo_ecdsa(
                                        PX_OTHER_CERT_DIGEST
                            ))), 
                            m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                            m_header_field_generation_location(
                                valueof(m_threeDLocation(
                                    v_longPosVectorNodeB.latitude,
                                    v_longPosVectorNodeB.longitude,
                                    '0000'O
                                ))
                            ),
                            m_header_field_its_aid_Other
                        }, 
                        e_certificate_digest_with_other_algorithm,
                        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_05_02_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_05_02_BO 
            
            /**
             * @desc    Check that IUT discards a secured GN Beacon if the header_fields contains a signer of type 'certificate_chain'
             * <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 { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          containing header_fields['signer_info']
             *              containing signer.type
             *                  indicating 'certificate_chain'
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_05_03_BO
             * @reference    ETSI TS 103 097 [1], clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_05_03_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_05_03_BO());
                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_05_03_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_05_03_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_05_03_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_signer_info(
                                m_signerInfo_certificates(
                                    { vc_atCertificate }
                            )), 
                            m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                            m_header_field_generation_location(
                                valueof(m_threeDLocation(
                                    v_longPosVectorNodeB.latitude,
                                    v_longPosVectorNodeB.longitude,
                                    '0000'O
                                ))
                            ),
                            m_header_field_its_aid_Other
                        }, 
                        e_certificate_chain,
                        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_05_03_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_05_03_BO 
            
            /**
             * @desc    Check that IUT discards a Secured Messageif the header_fields contains a signer info of unknown or reserved type
             * @remark  Values to be used as X_UNKNOWN_SIGNERINFO_TYPE are 5, 239, 240 and 255
             * <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 { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          containing header_fields['signer_info']
             *              containing signer.type
             *                  indicating X_UNKNOWN_SIGNERINFO_TYPE
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_05_04_BO
             * @reference    ETSI TS 103 097 [1], clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_05_04_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_05_04_BO());
                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_05_04_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_05_04_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_05_04_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_signer_info(
                                m_signerInfo_unknown(
                                    'CAFFEEDECA'O
                            )), 
                            m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                            m_header_field_generation_location(
                                valueof(m_threeDLocation(
                                    v_longPosVectorNodeB.latitude,
                                    v_longPosVectorNodeB.longitude,
                                    '0000'O
                                ))
                            ),
                            m_header_field_its_aid_Other
                        }, 
                        e_unknown,
                        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_05_04_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_05_04_BO 
garciay's avatar
garciay committed
            
            /**
             * @desc    Check that IUT discards a secured GN Message containing generation_time before the message signing certificate validity period
             * <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 { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
             *          containing header_fields['signer_info'].type
             *              indicating 'signer_info'
             *                  containing certificate (CERT_TS_MSG_06_01_BO_AT)
garciay's avatar
garciay committed
             *                      containing validity_restrictions['time_start_and_end']
             *                          containing start_validity
             *                              indicating START_VALIDITY_AT
             *                          and containing end_validity
             *                              indicating END_VALIDITY_AT
             *                  and containing header_fields ['generation_time']
             *                      containing generation_time
             *                          indicating GEN_TIME < TIME_CERT_TS_AT_START
             *  } 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_GENMSG_06_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 5.4 and 7.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_06_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)) {
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_06_01_BO());
                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_06_01_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_06_01_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_06_01_BO() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
garciay's avatar
garciay committed
                    var ValidityRestriction v_validity;
garciay's avatar
garciay committed
                    
                    // Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    // Test Body
garciay's avatar
garciay committed
                    f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_validity);
garciay's avatar
garciay committed
                    v_securedGnPdu := f_prepareSecuredBeacon(
garciay's avatar
garciay committed
                        cc_taCert0601_BO, 
garciay's avatar
garciay committed
                        {
                            m_header_field_signer_info(
                                m_signerInfo_digest(
                                    vc_atCertificate.signer_info.signerInfo.digest
                            )), 
garciay's avatar
garciay committed
                            m_header_field_generation_time( 
                                (v_validity.validity.time_start_and_end.start_validity - 3600) * 1000
garciay's avatar
garciay committed
                            ), // 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_06_01_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_06_01_BO 
            
            /**
             * @desc    Check that IUT discards the secured GN Message containing generation_time after the message signing certificate validity period
             * <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 { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          containing header_fields['signer_info'].type
             *              indicating 'signer_info'
garciay's avatar
garciay committed
             *                  containing certificate (CERT_TS_MSG_06_02_BO_AT)
garciay's avatar
garciay committed
             *                      containing validity_restrictions['time_start_and_end']
             *                          containing start_validity
             *                              indicating START_VALIDITY_AT
             *                          and containing end_validity
             *                              indicating END_VALIDITY_AT
             *                  and containing header_fields ['generation_time']
             *                      containing generation_time
             *                          indicating GEN_TIME > TIME_CERT_TS_E_ATND
             *  } 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_GENMSG_06_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 5.4 & 7.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_06_02_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)) {
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_06_02_BO());
                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_06_02_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_06_02_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_06_02_BO() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
garciay's avatar
garciay committed
                    var ValidityRestriction v_validity;
garciay's avatar
garciay committed
                    
                    // Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    // Test Body
garciay's avatar
garciay committed
                    f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_validity);
garciay's avatar
garciay committed
                    v_securedGnPdu := f_prepareSecuredBeacon(
garciay's avatar
garciay committed
                        cc_taCert0602_BO, 
garciay's avatar
garciay committed
                        {
                            m_header_field_signer_info(
                                m_signerInfo_digest(
                                    vc_atCertificate.signer_info.signerInfo.digest
                            )), 
garciay's avatar
garciay committed
                            m_header_field_generation_time(
                                (v_validity.validity.time_start_and_end.end_validity + 3600) * 1000
garciay's avatar
garciay committed
                            ), // In us
                            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_06_02_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_06_02_BO 
            
            /**
             * @desc    Check that IUT discards Secured GN Message if the generation_time is more than 10 minute in the past (C2C only)
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_ITS_C2C_MODE
             * 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 { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          containing header_fields ['generation_time']
             *              containing generation_time
             *                  indicating TIME_1 (TIME_1 < CUR_TIME - 10min)
             *  } 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_GENMSG_06_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_06_03_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) or not(PICS_ITS_C2C_MODE)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_ITS_C2C_MODE' 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_06_03_BO());
                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_06_03_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_06_03_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_06_03_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() - 600) * 1000
                            ) // In us
                        }, 
                        e_certificate
                    ); 
                    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_06_03_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_06_03_BO 
            
            /**
             * @desc    Check that IUT discards Secured GN Message if the generation_time is more than 10 minute in the future(C2C only)
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_ITS_C2C_MODE
             * 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 { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A) 
             *          containing header_fields ['generation_time']
             *              containing generation_time
             *                  indicating TIME_1 (TIME_1 > CUR_TIME + 10min)
             *  } 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_GENMSG_06_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_06_04_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) or not(PICS_ITS_C2C_MODE)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_ITS_C2C_MODE' 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_06_04_BO());
                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_06_04_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_06_04_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_06_04_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() + 600) * 1000
                            ) // In us
                        }, 
                        e_certificate
                    ); 
                    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_06_04_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_06_04_BO 
            
            /**
             * @desc    Check that IUT discards SecuredMessage when its_aid value is undefined
             * <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 { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
             *          containing header_fields['its_aid']
             *              indicating indicating 'AID_UNDEFINED'
             *  } 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_GENMSG_07_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_07_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)) {
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_07_01_BO());
                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_07_01_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_07_01_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_07_01_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_its_aid_Other
                        }, 
                        e_certificate_digest_with_sha256
                    ); 
                    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_07_01_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_07_01_BO 
            
            /**
             * @desc    Check that IUT discards Secured GN Message if the HeaderField generation_location is outside of the circular validity region of the signing certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_CERTIFICATE_SELECTION and PICS_USE_CIRCULAR_REGION
garciay's avatar
garciay committed
             * Config Id: CF01
             * Initial conditions:
             * with { 
             *    the IUT being in the 'authorized' state 
             *    and the IUT current time is inside the time validity period of CERT_TS_B_AT
garciay's avatar
garciay committed
             *    and the IUT current location is inside the validity region of CERT_TS_B_AT
garciay's avatar
garciay committed
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage ((MSG_SEC_RCV_GENMSG_B)) 
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *                  containing certificate (CERT_TS_B_AT)
             *                      containing validity_restrictions ['region']
             *                          containing region
             *                              containing region_type
             *                                  indicating 'circle'
             *                              and containing circular_region
             *                                  indicating REGION
             *          and containing header_fields ['generation_location']
             *              indicating location outside of the REGION
             *  } 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_GENMSG_08_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_08_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) or not(PICS_CERTIFICATE_SELECTION) or not(PICS_USE_CIRCULAR_REGION)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_CERTIFICATE_SELECTION and PICS_USE_CIRCULAR_REGION' 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_08_xx_BO(cc_taCert_B));
                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_08_01_BO
            
            /**
             * @desc    Check that IUT discards Secured GN Message if the HeaderField generation_location is outside of the rectangular validity region of the signing certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_CERTIFICATE_SELECTION and PICS_USE_RECTANGULAR_REGION
garciay's avatar
garciay committed
             * Config Id: CF01
             * Initial conditions:
             * with { 
             *    the IUT being in the 'authorized' state 
             *    and the IUT current time is inside the time validity period of CERT_TS_C_AT
garciay's avatar
garciay committed
             *    and the IUT current location is inside the validity region of CERT_TS_C_AT
garciay's avatar
garciay committed
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage ((MSG_SEC_RCV_GENMSG_C)) 
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *                  containing certificate (CERT_TS_C_AT)
             *                      containing validity_restrictions ['region']
             *                          containing region
             *                              containing region_type