ItsSecurity_TestCases.ttcn3 1.4 MB
Newer Older
garciay's avatar
garciay committed
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    // Test Body
                    v_securedGnPdu := f_prepareSecuredBeacon(
                        cc_taCert_A, 
                        {
                            m_header_field_signer_info(
garciay's avatar
garciay committed
                                m_signerInfo_digest(
                                    vc_atCertificate.signer_info.signerInfo.digest
                            )),
garciay's avatar
garciay committed
                            m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
garciay's avatar
garciay committed
                            m_header_field_expiry_time(
                                1000 * (3600 + f_getCurrentTime()) // 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
                        }, 
garciay's avatar
garciay committed
                        e_certificate_digest_with_sha256,
garciay's avatar
garciay committed
                        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_11_BO
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_11_BO 
garciay's avatar
garciay committed
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT accepts the Secured GN Message containing additional non-standard HeaderField
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
             *              indicating 'generation_time'
             *          and containing header_fields[2].type
             *          and containing header_fields[3].type
             *              indicating 'its_aid'
             *          and containing header_fields[4]
             *              containing type
             *                  indicating non-standard header field type (1000)
             *              and containing other_header
             *                  indicating non-empty data
             *          and not containing other header fields
garciay's avatar
garciay committed
             *  } 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_04_12_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_04_12_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_12_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_12_BO
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            group g_TC_SEC_ITSS_RCV_GENMSG_04_12_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_12_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(
garciay's avatar
garciay committed
                                m_signerInfo_digest(
                                    vc_atCertificate.signer_info.signerInfo.digest
                            )),
garciay's avatar
garciay committed
                            m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
garciay's avatar
garciay committed
                            m_header_field_expiry_time(
                                1000 * (3600 + f_getCurrentTime()) // In us
                            ),
garciay's avatar
garciay committed
                            m_header_field_generation_location(
                                valueof(m_threeDLocation(
                                    v_longPosVectorNodeB.latitude,
                                    v_longPosVectorNodeB.longitude,
                                    '0000'O
                                ))
                            ),
garciay's avatar
garciay committed
                            m_header_field_its_aid_Other,
                            m_header_field_unspecify
garciay's avatar
garciay committed
                        }, 
garciay's avatar
garciay committed
                        e_certificate_digest_with_sha256,
garciay's avatar
garciay committed
                        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_12_BO
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
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 20386 20387 20388 20389 20390 20391 20392 20393 20394 20395 20396 20397 20398 20399 20400 20401 20402 20403 20404 20405 20406 20407 20408 20409 20410 20411 20412 20413 20414 20415 20416 20417 20418 20419 20420 20421 20422 20423 20424 20425 20426 20427 20428 20429 20430 20431 20432 20433 20434 20435 20436 20437 20438 20439 20440 20441 20442 20443 20444 20445 20446 20447 20448 20449 20450 20451 20452 20453 20454 20455 20456 20457 20458 20459 20460 20461 20462 20463 20464 20465 20466 20467 20468 20469 20470 20471 20472 20473 20474 20475 20476 20477 20478 20479 20480 20481 20482 20483 20484 20485 20486 20487 20488 20489 20490 20491 20492 20493 20494 20495 20496 20497 20498 20499 20500 20501 20502 20503 20504 20505 20506 20507 20508 20509 20510 20511 20512 20513 20514 20515 20516 20517 20518 20519 20520 20521 20522 20523 20524 20525 20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 20611 20612 20613 20614 20615 20616 20617 20618 20619 20620 20621 20622 20623 20624 20625 20626 20627 20628 20629 20630 20631 20632 20633 20634 20635 20636 20637 20638 20639 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 20655 20656 20657 20658 20659 20660 20661 20662 20663 20664 20665 20666 20667 20668 20669 20670 20671 20672 20673 20674 20675 20676 20677 20678 20679 20680 20681 20682 20683 20684 20685 20686 20687 20688 20689 20690 20691 20692 20693 20694 20695 20696 20697 20698 20699 20700 20701 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 20718 20719 20720 20721 20722 20723 20724 20725 20726 20727 20728 20729 20730 20731 20732 20733 20734 20735 20736 20737 20738 20739 20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 20751 20752 20753
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_12_BO 
            
            /**
             * @desc    Check that IUT accepts the Secured GN Message containing additional non-standard HeaderField
             * <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[0].type
             *              indicating 'signer_info'
             *          and containing header_fields[1].type
             *              indicating 'generation_time'
             *          and containing header_fields[2].type
             *          and containing header_fields[3].type
             *              indicating 'its_aid'
             *          and containing header_fields[4]
             *              containing type
             *                  indicating 'encryption_parameters'
             *              and containing enc_params
             *                  containing symm_algorithm
             *                      indicating 'aes_128_ccm'
             *                  and containing nonce
             *              and containing header_fields[4]
             *                  containing type
             *                      indicating 'recipient_info'
             *                  and containing recipients
             *                      containing recipients[0]
             *                          containing cert_id
             *                              referencing to CERT_IUT_A_AT
             *                          and containing pk_encryption
             *                              indicating 'ecies_nistp256'
             *                          and containing enc_key
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_04_13_BO
             * @reference    ETSI TS 103 097 [1], clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_04_13_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_04_13_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_04_13_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_04_13_BO {
                
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                     */
                function f_TC_SEC_ITSS_RCV_GENMSG_04_13_BO() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
                    var Certificate v_iutATCertificate;
                    var SubjectAttribute v_encryption_key;
                    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
                    if (
                        (f_readCertificate(cc_iutCert_A, v_iutATCertificate) == false) or 
                        (f_getCertificateSubjectAttribute(v_iutATCertificate, e_encryption_key, v_encryption_key) == false)
                    ) {
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout); // Set verdict to inconc
                    } else {
                        v_securedGnPdu := f_prepareSecuredBeacon(
                            cc_taCert_A, 
                            {
                                m_header_field_signer_info(
                                    m_signerInfo_digest(
                                        vc_atCertificate.signer_info.signerInfo.digest
                                )),
                                m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                                m_header_field_expiry_time(
                                    1000 * (3600 + 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_enc_params(                                  // containing header_fields[3].type.enc_params
                                    m_encryptionParameters_aes_128_ccm(                     //      indicating 'aes_128_ccm'
                                        PX_ENCRYPTIONPARAMETERS_AES_128_CCM_NONCE           // and containing nonce
                                    )
                                ),
                                m_header_field_multiple_recipients(                         // containing header_fields[4].type
                                    {                                                       //     indicating 'encryption_parameters'
                                        m_recipientInfo_ecies_enc_key(
                                            v_iutATCertificate.signer_info.signerInfo.digest,
                                            e_ecies_nistp256,                               // containing symm_algorithm
                                                                                            //     indicating 'aes_128_ccm'
                                            m_eciesEncryptedKey_aesccm(
                                                v_encryption_key.attribute.rv,
                                                '00000000000000000000000000000000'O, // FIXME Where to find these values
                                                '00000000000000000000000000000000'O
                                            )
                                        )
                                    }
                                )
                            }, 
                            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_13_BO
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_13_BO 
            
            /**
             * @desc    Check that IUT discards a secured GN Beacon if the header_fields contains a signer of type 'self'
             * <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 'self''
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_05_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_05_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_05_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_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: