Commit fed91395 authored by Yann Garcia's avatar Yann Garcia
Browse files

Start implementing first TPs for MIM; Validate Test Adapter

parent 28f7ce7a
Loading
Loading
Loading
Loading
+101 −11
Original line number Diff line number Diff line
@@ -27,10 +27,10 @@ module ItsAvm_TestCases {
            group mimMessageFormat {

                /**
                * @desc Check that protocolVersion is set to 2 and messageID is
                *       set to 18.
                * @desc Check that MIM messages are generated upon activation of the AVM entity
                *       Check that protocolVersion is set to 2 and messageID is set to 18
                * <pre>
                * Pics Selection: PICS_MIM_GENERATION
                * Pics Selection: PICS_RO_ROLE and PICS_MIM_GENERATION
                * Initial conditions:
                *     with {
                *         the IUT being in the "initial state"
@@ -54,11 +54,101 @@ module ItsAvm_TestCases {
                * @see       ETSI TS 104 202-2 v2.2.1 TP/AVM/MSD/FMT/BV-01
                * @reference ETSI TS 103 882 v2.2.1, Annex B
                */
                testcase TC_MIM_MSD_FMT_BV_01() runs on ItsAvm system ItsAvmSystem {
                testcase TC_MIM_DISS_BV_01() runs on ItsAvm system ItsAvmSystem {

                    f_MIM_DISS_BV_01();

                } // End of TC_MIM_DISS_BV_01

                /**
                * @desc Check that MIM messages include one or more Mim containers
                * <pre>
                * Pics Selection: PICS_RO_ROLE and PICS_MIM_GENERATION
                * Initial conditions:
                *     with {
                *         a MIM is generated
                *     }
                * Expected behaviour:
                *     ensure that {
                *         when {
                *             a MIM is generated
                *         }
                *         then {
                *             the IUT sends a MIM
                *                 containing mims
                *                     containing at least one Mim

                *         }
                *     }
                * </pre>
                *
                * @see       ETSI TS 104 202-2 v2.2.1 TP/AVM/MSD/FMT/BV-02
                * @reference ETSI TS 103 882 v2.2.1, Annex B
                */
                testcase TC_MIM_DISS_BV_02() runs on ItsAvm system ItsAvmSystem {

                    f_MIM_DISS_BV_02();

                } // End of TC_MIM_DISS_BV_02

                /**
                * @desc Check that Mim containers address exactly one SV ITS-S
                * <pre>
                * Pics Selection: PICS_RO_ROLE and PICS_MIM_GENERATION
                * Initial conditions:
                *     with {
                *         a MIM is generated
                *     }
                * Expected behaviour:
                *     ensure that {
                *         when {
                *             a MIM is generated
                *         }
                *         then {
                *             the IUT sends a MIM
                *                 containing mims
                *                     containing at least one Mim
                *                         addressing exactly one SV ITS-S each
                *         }
                *     }
                * </pre>
                *
                * @see       ETSI TS 104 202-2 v2.2.1 TP/AVM/MSD/FMT/BV-03
                * @reference ETSI TS 103 882 v2.2.1, Annex B
                */
                testcase TC_MIM_DISS_BV_03() runs on ItsAvm system ItsAvmSystem {

                    f_MIM_DISS_BV_03();

                } // End of TC_MIM_DISS_BV_03

                /**
                * @desc Verify that the size of an ASN.1 encoded MIM does not exceed MTU_MIM
                * <pre>
                * Pics Selection: PICS_RO_ROLE and PICS_MIM_GENERATION
                * Initial conditions:
                *     with {
                *         a MIM is generated
                *     }
                * Expected behaviour:
                *     ensure that {
                *         when {
                *             a MIM is generated
                *         }
                *         then {
                *             ASN.1 encoded size of MIM <= MTU_MIM
                *         }
                *     }
                * </pre>
                *
                * @see       ETSI TS 104 202-2 v2.2.1 TP/AVM/MSD/FMT/BV-04
                * @reference ETSI TS 103 882 v2.2.1, Annex B
                */
                testcase TC_MIM_DISS_BV_04() runs on ItsAvm system ItsAvmSystem {

                    f_MIM_MSD_FMT_BV_01();
                    f_MIM_DISS_BV_04();

                } // End of TC_MIM_MSD_FMT_BV_01
                } // End of TC_MIM_DISS_BV_04

                /**
                * @desc Check that the IUT generates e2eProtection CRC properly.
@@ -85,11 +175,11 @@ module ItsAvm_TestCases {
                * @see       ETSI TS 104 202-2 v2.2.1 TP/AVM/MSD/FMT/BV-02
                * @reference ETSI TS 103 882 v2.2.1, Annex B
                */
                testcase TC_MIM_MSD_FMT_BV_02() runs on ItsAvm system ItsAvmSystem {
                testcase TC_MIM_DISS_BV_0x() runs on ItsAvm system ItsAvmSystem {

                    f_MIM_MSD_FMT_BV_02();
                    f_MIM_DISS_BV_0x();

                } // End of TC_MIM_MSD_FMT_BV_02
                } // End of TC_MIM_DISS_BV_0x

            } // End of group mimMessageFormat

@@ -451,7 +541,7 @@ module ItsAvm_TestCases {

        setverdict(pass)

    } // End of TC_MIM_MSD_FMT_BV_01
    } // End of TC_MIM_DISS_BV_01

    testcase TC_CHECKSUMS_BV_02() runs on ItsAvm system ItsAvmSystem {

@@ -482,6 +572,6 @@ module ItsAvm_TestCases {

        setverdict(pass)

    } // End of TC_MIM_MSD_FMT_BV_02
    } // End of TC_MIM_DISS_BV_02

} // End of module ItsAvm_TestCases
+4 −1
Original line number Diff line number Diff line
@@ -21,7 +21,10 @@ module ItsAvm_TestControl {
        if (PICS_RO_ROLE) {

            if (PICS_MIM_GENERATION) {
                execute(TC_MVM_MSD_FMT_BV_01());
                execute(TC_MIM_DISS_BV_01());
                execute(TC_MIM_DISS_BV_02());
                execute(TC_MIM_DISS_BV_03());
                execute(TC_MIM_DISS_BV_04());
            }

            execute(TC_MIM_MSD_PAR_BV_01());
+224 −13
Original line number Diff line number Diff line
@@ -42,14 +42,60 @@ module ItsAvm_TpFunctions {
    // 5.2.1
    group mim {

        group mimHelpers {

            /**
             * @desc    Helper function to check that SV ITS-S are unique in the received MIM message. The SV ITS-S is identified by the combination of sessionID and missionID in the SystemManagementData container of each Mim container. This function assumes that the MIM message has already been checked for the presence of the SystemManagementData container and the sessionID and missionID fields.
             */
            function f_check_mim_uniqueless_sv_its_s(
                                                     in record of Mim p_mims
                                                     ) return boolean {
                // Sanity checks
                if (lengthof(p_mims) == 0) {
                    log("*** " & testcasename() & ": DBG: No Mim container in the MIM message ***");
                    return false;
                } else if (lengthof(p_mims) == 1) {
                    return true;
                }

                var set of charstring v_unique_its_s_set := {};
                for (var integer i := 1; i <= lengthof(p_mims); i := i + 1) {
                    if (not(ispresent(p_mims[i].systemManagementData))) {
                        log("*** " & testcasename() & ": DBG: systemManagementData not present in Mim container ", i, " ***");
                        return false;
                    }
                    var charstring v_sv_its_s := "";
                    if (not(ispresent(p_mims[i].systemManagementData.sessionID)) and not(ispresent(p_mims[i].systemManagementData.missionID))) {
                        log("*** " & testcasename() & ": DBG: Missing sessionID and missionID in SystemManagementData container ", i, " ***");
                        return false;
                    } else { // TODO FSCOM SV ITS-S is the concatenation of the sessionID and the missionID, but this should be clarified in the standard. To be verified.
                        if (ispresent(p_mims[i].systemManagementData.sessionID)) {
                            v_sv_its_s := v_sv_its_s & p_mims[i].systemManagementData.sessionID;
                        }
                        if (ispresent(p_mims[i].systemManagementData.missionID)) {
                            v_sv_its_s := v_sv_its_s & p_mims[i].systemManagementData.missionID;
                        }
                    }
                    log("*** " & testcasename() & ": DBG: Checking SV ITS-S with sessionID " & v_sv_its_s & " ***");
                    if (not(match(v_unique_its_s_set, superset(v_sv_its_s)))) {
                        log("*** " & testcasename() & ": DBG: SV ITS-S with sessionID " & p_mims[i].systemManagementData.sessionID & " and missionID " & p_mims[i].systemManagementData.missionID & " is duplicated in Mim containers ***");
                        return false;
                    } else {
                        v_unique_its_s_set[lengthof(v_unique_its_s_set) - 1] := v_sv_its_s;
                    }
                }
                return true;
            }
        } // End of group mimHelpers

        group mimMessageDissemination {

            group mimMessageFormat {

                /**
                * @desc    TP Function for TC_MIM_MSD_FMT_BV_01
                * @desc    TP Function for TC_MIM_DISS_BV_01
                */
                function f_MIM_MSD_FMT_BV_01() runs on ItsAvm {
                function f_MIM_DISS_BV_01() runs on ItsAvm {

                    // Local variables

@@ -73,11 +119,118 @@ module ItsAvm_TpFunctions {
                    alt {
                        [] avmPort.receive(mw_mimInd(mw_mimMsg_any)) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Expected MV message received ***");
                            log("*** " & testcasename() & ": PASS: Expected MIM received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: MV message not received ***");
                            log("*** " & testcasename() & ": INCONC: MIM not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }

                    // Postamble
                    f_poDefault();
                    f_cfDown();

                } // End of function f_MIM_DISS_BV_01

                /**
                * @desc    TP Function for TC_MIM_DISS_BV_02
                */
                function f_MIM_DISS_BV_02() runs on ItsAvm {

                    // Local variables

                    // Test control
                    if (not PICS_RO_ROLE or not PICS_MIM_GENERATION) {
                        log("*** " & testcasename() & ": PICS_RO_ROLE and PICS_MIM_GENERATION required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }

                    // Test component configuration
                    f_cfUp();

                    // Test adapter configuration
                    // Preamble
                    f_prInitialState();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

                    // Test Body
                    tc_ac.start;
                    alt {
                        [] avmPort.receive(
                                           mw_mimInd(
                                                     mw_mimMsg(
                                                               -, 
                                                               mw_mim(
                                                                      -,
                                                                      mw_system_management_data(
                                                                                                "ETSI-SESSION-2024-001",
                                                                                                "PARKING-TASK-0005",
                                                                                                -,
                                                                                                "ETSI-650-Route-des-Lucioles"
                                           ))))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Expected MIM received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: MIM not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }

                    // Postamble
                    f_poDefault();
                    f_cfDown();

                } // End of function f_MIM_DISS_BV_02

                /**
                * @desc    TP Function for TC_MIM_DISS_BV_03
                */
                function f_MIM_DISS_BV_03() runs on ItsAvm {

                    // Local variables
                    var MimInd v_mimInd;

                    // Test control
                    if (not PICS_RO_ROLE or not PICS_MIM_GENERATION) {
                        log("*** " & testcasename() & ": PICS_RO_ROLE and PICS_MIM_GENERATION required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }

                    // Test component configuration
                    f_cfUp();

                    // Test adapter configuration
                    // Preamble
                    f_prInitialState();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

                    // Test Body
                    tc_ac.start;
                    alt {
                        [] avmPort.receive(
                                           mw_mimInd(
                                                     mw_mimMsg(
                                                               -, 
                                                               mw_mim
                                           ))) -> value v_mimInd {
                            tc_ac.stop;

                            if (f_check_mim_uniqueless_sv_its_s(v_mimInd.msgIn.mims) == false) {
                                log("*** " & testcasename() & ": FAIL: SV ITS-S are not unique***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            } else {
                                log("*** " & testcasename() & ": PASS: Expected MIM received with unique SV ITS-S ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: MIM not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
@@ -86,15 +239,16 @@ module ItsAvm_TpFunctions {
                    f_poDefault();
                    f_cfDown();

                } // End of function f_MIM_MSD_FMT_BV_01
                } // End of function f_MIM_DISS_BV_03

                /**
                * @desc    TP Function for TC_MIM_MSD_FMT_BV_02
                * @desc    TP Function for TC_MIM_DISS_BV_04
                */
                function f_MIM_MSD_FMT_BV_02() runs on ItsAvm {
                function f_MIM_DISS_BV_04() runs on ItsAvm {

                    // Local variables
                    var MimInd  v_mimInd;
                    var integer v_repetition := 0;

                    // Test control
                    if (not PICS_RO_ROLE or not PICS_MIM_GENERATION) {
@@ -114,20 +268,77 @@ module ItsAvm_TpFunctions {
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] avmPort.receive(mw_mimInd_with_raw_message ( mw_mimMsg_any )) -> value v_mimInd {
                        [] avmPort.receive(mw_mimInd(mw_mimMsg_any)) -> value v_mimInd {
                            tc_ac.stop;

                            // Encode message in ASN.1 and check that the size does not exceed the PICS_MIM_MTU value
                            var octetstring v_asn1EncodedMim := bit2oct(encvalue(v_mimInd.msgIn));
                            if (lengthof(v_asn1EncodedMim) <= PICS_MIM_MTU) {
                                v_repetition := v_repetition + 1;
                                if (v_repetition == PX_MAX_REPETITION) {
                                    log("*** " & testcasename() & ": PASS: Expected MIM received with ASN.1 encoded size within the MTU limit ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                } else {
                                    tc_ac.start;
                                    repeat;
                                }
                            } else {
                                log("*** " & testcasename() & ": FAIL: Expected MIM received but with ASN.1 encoded size exceeding the MTU limit ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: MIM not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }

                    // Postamble
                    f_poDefault();
                    f_cfDown();

                } // End of function f_MIM_DISS_BV_04

                /**
                * @desc    TP Function for TC_MIM_DISS_BV_0x
                */
                function f_MIM_DISS_BV_0x() runs on ItsAvm {

                    // Local variables
                    var MimInd v_mimInd;

                    // Test control
                    if (not PICS_RO_ROLE or not PICS_MIM_GENERATION) {
                        log("*** " & testcasename() & ": PICS_RO_ROLE and PICS_MIM_GENERATION required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }

                    // Test component configuration
                    f_cfUp();

                    // Test adapter configuration
                    // Preamble
                    f_prInitialState();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

                    // Test Body
                    tc_ac.start;
                    alt {
                        [] avmPort.receive(mw_mimInd_with_raw_message ( mw_mimMsg )) -> value v_mimInd {
                            tc_ac.stop;
                            // Check e2eProtection CRC32 is correct
                            if (f_avm_e2e_verify_checksum(v_mimInd.raw_message) == true) {
                                 log("*** " & testcasename() & ": PASS: Expected MV message received with correct CRC32 value ***");
                                 log("*** " & testcasename() & ": PASS: Expected MIM message received with correct CRC32 value ***");
                                 f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: Expected MV message received but with incorrect CRC32 value ***");
                                log("*** " & testcasename() & ": FAIL: Expected MIM message received but with incorrect CRC32 value ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: MV message not received ***");
                            log("*** " & testcasename() & ": INCONC: MIM not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
@@ -136,7 +347,7 @@ module ItsAvm_TpFunctions {
                    f_poDefault();
                    f_cfDown();

                } // End of function f_MIM_MSD_FMT_BV_02
                } // End of function f_MIM_DISS_BV_0x

            } // End of group mimMessageFormat

+5 −0
Original line number Diff line number Diff line
@@ -44,6 +44,11 @@ module LibItsAvm_Pics {
         */
        modulepar boolean PICS_MIM_GENERATION := true;

        /**
         * @desc Maximum Transmission Unit for MIM messages
         * @see  ETSI TS 104 202-1 Table A.6
         */
        modulepar integer PICS_MIM_MTU := 1500;
    } // end avmPics

} // end LibItsAvm_Pics
+2 −0
Original line number Diff line number Diff line
@@ -20,4 +20,6 @@ module LibItsAvm_Pixits {

    modulepar UInt32 PX_DATA_ID := 0;

    modulepar integer PX_MAX_REPETITION := 10;

} // End of module LibItsAvm_Pixits
 No newline at end of file
Loading