ItsSecurity_TestCases.ttcn3 1.34 MB
Newer Older
garciay's avatar
garciay committed
28001 28002 28003 28004 28005 28006 28007 28008 28009 28010 28011 28012 28013 28014 28015 28016 28017 28018 28019 28020 28021 28022 28023 28024 28025 28026 28027 28028 28029 28030 28031 28032 28033 28034 28035 28036 28037 28038 28039 28040 28041 28042 28043 28044 28045 28046 28047 28048 28049 28050 28051 28052 28053 28054 28055 28056 28057 28058 28059 28060 28061 28062 28063 28064 28065 28066 28067 28068 28069 28070 28071 28072 28073 28074 28075 28076 28077 28078 28079 28080 28081 28082 28083 28084 28085 28086 28087 28088 28089 28090 28091 28092 28093 28094 28095 28096 28097 28098 28099 28100 28101 28102 28103 28104 28105 28106 28107 28108 28109 28110 28111 28112 28113 28114 28115 28116 28117 28118 28119 28120 28121 28122 28123 28124 28125 28126 28127 28128 28129 28130 28131 28132 28133 28134 28135 28136 28137 28138 28139 28140 28141 28142 28143 28144 28145 28146 28147 28148 28149 28150 28151 28152 28153 28154 28155 28156 28157 28158 28159 28160 28161 28162 28163 28164 28165 28166 28167 28168 28169 28170 28171 28172 28173 28174 28175 28176 28177 28178 28179 28180 28181 28182 28183 28184 28185 28186 28187 28188 28189 28190 28191 28192 28193 28194 28195 28196 28197 28198 28199 28200 28201 28202 28203 28204 28205 28206 28207 28208 28209 28210 28211 28212 28213 28214 28215 28216 28217 28218 28219 28220 28221 28222 28223 28224 28225 28226 28227 28228 28229 28230 28231 28232 28233 28234 28235 28236 28237 28238 28239 28240 28241 28242 28243 28244 28245 28246 28247 28248 28249 28250 28251 28252 28253 28254 28255 28256 28257 28258 28259 28260 28261 28262 28263 28264 28265 28266 28267 28268 28269 28270 28271 28272 28273 28274 28275 28276 28277 28278 28279 28280 28281 28282 28283 28284 28285 28286 28287 28288 28289 28290 28291 28292 28293 28294 28295 28296 28297 28298 28299 28300 28301 28302 28303 28304 28305 28306 28307 28308 28309 28310 28311 28312 28313 28314 28315 28316 28317 28318 28319 28320 28321 28322 28323 28324 28325 28326 28327 28328 28329 28330 28331 28332 28333 28334 28335 28336 28337 28338 28339 28340 28341 28342 28343 28344 28345 28346 28347 28348 28349 28350 28351 28352 28353 28354 28355 28356 28357 28358 28359 28360 28361 28362 28363 28364 28365 28366 28367 28368 28369 28370 28371 28372 28373 28374 28375 28376 28377 28378 28379 28380 28381 28382 28383 28384 28385 28386 28387 28388 28389 28390 28391 28392 28393 28394 28395 28396 28397 28398 28399 28400 28401 28402 28403 28404 28405 28406 28407 28408 28409 28410 28411 28412 28413 28414 28415 28416 28417 28418 28419 28420 28421 28422 28423 28424 28425 28426 28427 28428 28429 28430 28431 28432 28433 28434 28435 28436 28437 28438 28439 28440 28441 28442 28443 28444 28445 28446 28447 28448 28449 28450 28451 28452 28453 28454 28455 28456 28457 28458 28459 28460 28461 28462 28463 28464 28465 28466 28467 28468 28469 28470 28471 28472 28473 28474 28475 28476 28477 28478 28479 28480 28481 28482 28483 28484 28485 28486 28487 28488 28489 28490 28491 28492 28493 28494
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_17_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_17_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert1701_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_17_01_BO
            
            /**
             * @desc    Check that IUT discards a SecuredMessage if the subject attribute of type assurance_level is missing in the AA certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_17_02_BO_AT
             *      and the IUT current location is inside the CERT_TS_17_02_BO_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
             *              containing header_fields ['signer_info'].signer.type
             *                  indicating 'certificate'
             *              and containing certificate (CERT_TS_17_02_BO_AT)
             *                  containing signer_info.digest
             *                      referencing to certificate (CERT_TS_17_02_BO_AA)
             *                          not containing subject_attributes['assurance_level']
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_17_02_BO
             * @reference    ETSI TS 103 097 [1], clause 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_17_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert1702_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_17_02_BO
            
            /**
             * @desc    Check that IUT discards a SecuredMessage if the assurance level of issuing certificate is less then assurance level of subordinate certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_17_03_BO_AT
             *      and the IUT current location is inside the CERT_TS_17_03_BO_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
             *              containing header_fields ['signer_info'].signer.type
             *                  indicating 'certificate'
             *              and containing certificate (CERT_TS_17_03_BO_AT)
             *                  containing subject_attributes['assurance_level']
             *                      containing assurance_level
             *                          indicating 0x80 (assurance level=4, confidence=0)
             *                  and containing signer_info.digest
             *                      referencing to certificate (CERT_TS_A_AA)
             *                          containing subject_attributes['assurance_level']
             *                              containing assurance_level
             *                                  indicating 0x60 (assurance level=3, confidence=0)
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_17_03_BO
             * @reference    ETSI TS 103 097 [1], clause 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_17_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert1703_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_17_03_BO
            
            /**
             * @desc    Check that IUT discards a SecuredMessage if the assurance level of issuing certificate is equal to the  assurance level of the subordinate certificate but the confidence of subject assurance of issuing certificate is less then the confidence of the subordinate certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_17_04_BO_AT
             *      and the IUT current location is inside the CERT_TS_17_04_BO_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
             *              containing header_fields ['signer_info'].signer.type
             *                  indicating 'certificate'
             *              and containing certificate (CERT_TS_17_04_BO_AT)
             *                  containing subject_attributes['assurance_level']
             *                      containing assurance_level
             *                          indicating 0x61 (assurance level=3, confidence=1)
             *                  and containing signer_info.digest
             *                      referencing to certificate (CERT_TS_A_AA)
             *                          containing subject_attributes['assurance_level']
             *                              containing assurance_level
             *                                  indicating 0x60 (assurance level=3, confidence=0)
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_17_04_BO
             * @reference    ETSI TS 103 097 [1], clause 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_17_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert1704_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_17_04_BO
            
            /**
             * @desc    Check that IUT discards a SecuredMessage if the subject attribute of type verification_key is missing in the AT certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_18_01_BO_AT
             *      and the IUT current location is inside the CERT_TS_18_01_BO_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
             *              containing header_fields ['signer_info'].signer.type
             *                  indicating 'certificate'
             *              and containing certificate (CERT_TS_18_01_BO_AT)
             *                  not containing subject_attributes['verification_key']
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_18_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_18_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert1801_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_18_01_BO
            
            /**
             * @desc    Check that IUT discards a SecuredMessage if the subject attribute of type verification_key is missing in the AA certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_18_02_BO_AT
             *      and the IUT current location is inside the CERT_TS_18_02_BO_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
             *              containing header_fields ['signer_info'].signer.type
             *                  indicating 'certificate'
             *              and containing certificate (CERT_TS_18_02_BO_AT)
             *                  containing signer_info.digest
             *                      referencing to certificate (CERT_TS_18_02_BO_AA)
             *                          not containing subject_attributes['verification_key']
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_18_02_BO
             * @reference    ETSI TS 103 097 [1], clause 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_18_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert1802_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_18_02_BO
            
            /**
             * @desc    Check that IUT discards a SecuredMessage if the reserved region type has been used in region validity restriction of the AT certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_19_01_BO_AT
             *      and the IUT current location is inside the CERT_TS_19_01_BO_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_19_01_BO_AT)
             *                  containing region_type
             *                      indicating 240
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_19_01_BO
             * @reference    ETSI TS 103 097 [1], clause 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_19_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert1901_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_19_01_BO
            
garciay's avatar
garciay committed
        } // End of group recvCertificatesProfile
garciay's avatar
garciay committed
    } // End of group receiverbehavior
    
} // End of module ItsSecurity_TestCase