Commit 9abaecc7 authored by Yann Garcia's avatar Yann Garcia
Browse files

Adding TC_MIM_PRVH_BV_01/02

parent 5d6f6d90
Loading
Loading
Loading
Loading
+96 −27
Original line number Diff line number Diff line
@@ -317,6 +317,75 @@ module ItsAvm_TestCases {

            } // End of group mimMessageFormat

            group mimProtocolersionHandling {

                /**
                 * @desc Check that the protocolVerrsion is defined in the ItsPduHeader
                 * <pre>
                 * Pics Selection: PICS_RO_ROLE and PICS_MIM_GENERATION
                 * Initial conditions:
                 *     with {
                 *         AVM entity is active
                 *     }
                 * Expected behaviour:
                 *     ensure that {
                 *         when {
                 *             MIM generation is requested
                 *         }
                 *         then {
                 *             the IUT sends a valid MIM
                 *                 containing ITS PDU header
                 *                     containing protocolVersion
                 *         }
                 *     }
                 * </pre>
                 *
                 * @see       ETSI TS 104 202-2 v2.2.1 TP/MIM/PRVH/BV-01
                 * @reference ETSI TS 103 882 v2.2.1, Annex B
                 */
                testcase TC_MIM_PRVH_BV_01() runs on ItsAvm system ItsAvmSystem {

                    f_TC_MIM_DISS_BV_01();

                } // End of TC_MIM_PRVH_BV_01

                /**
                 * @desc Check that the protocolVerrsion in a MIM matches the protocolVersion in a MVM
                 * <pre>
                 * Pics Selection: PICS_RO_ROLE and PICS_MIM_GENERATION
                 * Initial conditions:
                 *     with {
                 *         AVM entity is active
                 *         MVM has been received 
                 *             containing header
                 *                 containing protocolVersion
                 *                     indicating value PV
                 *     }
                 * Expected behaviour:
                 *     ensure that {
                 *         when {
                 *             MIM generation is requested
                 *         }
                 *         then {
                 *             the IUT sends a valid MIM
                 *                 containing ITS PDU header
                 *                     containing protocolVersion
                 *                         indicating value PV
                 *         }
                 *     }
                 * </pre>
                 *
                 * @see       ETSI TS 104 202-2 v2.2.1 TP/MIM/PRVH/BV-02
                 * @reference ETSI TS 103 882 v2.2.1, Annex B
                 */
                testcase TC_MIM_PRVH_BV_02() runs on ItsAvm system ItsAvmSystem {

                    f_TC_MIM_PRVH_BV_02();

                } // End of TC_MIM_PRVH_BV_02

            } // End of group mimProtocolersionHandling

            group mimLowerLayerParameters {

                /**
+3 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ module ItsAvm_TestControl {
            execute(TC_MIM_MSGF_BV_01());
            execute(TC_MIM_MSGF_BV_02());
            execute(TC_MIM_MSGF_BV_04());

            execute(TC_MIM_PRVH_BV_01());
            execute(TC_MIM_PRVH_BV_02());
      }
    
        if (PICS_VO_ROLE) {
+94 −0
Original line number Diff line number Diff line
@@ -588,6 +588,97 @@ module ItsAvm_TpFunctions {

            } // End of group mimMessageFormat

            group mimProtocolVersionHandling {

                /**
                 * @desc    TP Function for TC_MIM_PRVH_BV_02
                 */
                function f_TC_MIM_PRVH_BV_02() runs on ItsAvm {

                    // Local variables

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

                    // Test component configuration
                    f_cfUp();

                    // Test adapter configuration
                    // Preamble
                    f_prInitialState();
                    // TODO FSCOM f_prepare_initial_mim_message(v_mimReq);
                    var MimReq v_mimReq := valueof(
                                                   m_mimReq(
                                                            m_mimMsg(
                                                                     f_getTsStationId(),
                                                                     m_avm_e2e_protection(
                                                                                          0,
                                                                                          f_getAvmRollingCounter(),
                                                                                          f_getAvmDataID(), 
                                                                                          0
                                                                                          ),
                                                                     m_mim(
                                                                           m_mim_data_control_field(
                                                                                                    -, -, 
                                                                                                    f_getCurrentTime()
                                                                                                    ),
                                                                           m_system_management_data(
                                                                                                    "ETSI-SESSION-2024-001",
                                                                                                    "PARKING-TASK-0005",
                                                                                                    -,
                                                                                                    "ETSI-650-Route-des-Lucioles"
                                                                           )
                                                                     )
                                 
                    )));
                    // Encode MIM message to compute its length and checksums
                    var octetstring v_os := bit2oct(encvalue(v_mimReq.msgOut));
                    log("processVoStateMachine: v_os: ", v_os);
                    // Compute checksums
                    f_avm_e2e_compute_checksum(v_os);
                    log("processVoStateMachine: v_os: ", v_os);
                    var bitstring v_bs := oct2bit(v_os);
                    var integer v_result := decvalue(v_bs, v_mimReq.msgOut);
                    avmPort.send(v_mimReq);
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

                    // Test Body
                    tc_ac.start;
                    alt {
                        [] avmPort.receive(
                                           mw_mvmInd(
                                                     MVM: {
                                                           header := {
                                                                      protocolVersion := v_mimReq.msgOut.header.protocolVersion, // The protocol version in the received MIM message should be the same as the one in the sent MIMReq message
                                                                      messageId := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_mvm_,
                                                                      stationId := ?
                                                           },
                                                           e2eProtection  := ?,
                                                           mvm := ?
                                                     }
                                           )) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Expected MV message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: MV message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }

                    // Postamble
                    f_poDefault();
                    f_cfDown();

                } // End of function f_TC_MVM_DISS_BV_01

            } // End of group mimProtocolVersionHandling

            group mimLowerLayerParameters {

                /**
@@ -1153,6 +1244,9 @@ module ItsAvm_TpFunctions {

            } // End of group mvmMessageFormat




            group mvmLowerLayerParameters {

                /**
+29 −12
Original line number Diff line number Diff line
@@ -320,6 +320,23 @@ module LibItsAvm_Templates {
        e2eProtection  := p_e2eProtection
    }

    /**
     * @desc    Default Receive template for MIM PDU
     */
    template (value) MIM m_mimMsg(
                                  in template (value) StationId p_station_id,
                                  in template (value) AvmE2EProtection p_e2eProtection,
                                  in template (value) Mim p_mim
                                  ) := {
        header := {
            protocolVersion := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_protocolVersion_currentVersion_,
            messageId := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_mim_,
            stationId := p_station_id
        },
        e2eProtection  := p_e2eProtection,
        mims := { p_mim }
    }

    /**
     * @desc    Default Receive template for MVM PDU
     */