Commit 98d91682 authored by YannGarcia's avatar YannGarcia
Browse files

Finalyze first AtsMBR test case

parent f9908ac6
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -61,6 +61,9 @@ module ItsMbr_TestCases {

    group class1 {

      /**
       * @desc 
       */
      testcase TC_MRS_ITSS_MESSAGES_CLASS1_CAM_001() runs on ItsMtc system ItsMbrItssSystem {
        // Local variables
        var ItsMbrItss v_itss;
@@ -126,7 +129,9 @@ module ItsMbr_TestCases {
          } // End of 'alt' statement
          
          // Test Body
          // TODO Send CAM message with incosistent speed value
          // Send CAM message with incosistent speed value
          f_send_inconsistent_cam();
          //f_prepareSecuredCam();
          log("*** " & testcasename() & ": PASS: MR triggered ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          
@@ -178,8 +183,8 @@ module ItsMbr_TestCases {
                f_send_500_Internal_Error(v_headers);
              }
              // Validate MR content
              log("Validate MR content :", match(v_etsiTs103759_data.report, mw_cam_specific_report));
              if (not(match(v_etsiTs103759_data.report, mw_cam_specific_report))) { // FIXME To be continued
              log("Validate MR content :", match(v_etsiTs103759_data.report, (mw_cam_specific_report(mw_asr_cam_report_speed(m_mb_obs_cam_speed_change_too_large, {mw_v2x_pdu_stream}, {})))));
              if (not(match(v_etsiTs103759_data.report, mw_cam_specific_report(mw_asr_cam_report_speed(m_mb_obs_cam_speed_change_too_large, {mw_v2x_pdu_stream}, {}))))) {
                log("*** " & testcasename() & ": FAIL: MR content mismatch ***");
                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
              }
+70 −37
Original line number Diff line number Diff line
@@ -168,55 +168,88 @@ module LibItsMbr_Templates {

  group camObservation { // FIXME To be checked

    template (value) AidSpecificReportCam m_cam_specific_report(
                                                                in template (value) AidSpecificReportCam.content p_content
    template (value) AidSpecificReport m_cam_specific_report(
                                                             in template (value) AsrCam p_content
                                                             ) := {
      aid     := c_AsrCam,
      content := p_content
      content := { asrCam := p_content}
    } // End of template m_cam_specific_report

    template (present) AidSpecificReportCam mw_cam_specific_report(
                                                                   template (present) AidSpecificReportCam.content p_content := ?
    template (present) AidSpecificReport mw_cam_specific_report(
                                                                template (present) AsrCam p_content := ?
                                                                ) := {
      aid     := c_AsrCam,
      content := p_content
      content := { asrCam := p_content}
    } // End of template mw_cam_specific_report

    template (value) AsrCam m_asr_cam_report(
                                             in template (value) AsrCam.observations p_observations, 
    template (omit) V2xPduStream m_v2x_pdu_stream(
                                                  in template (value) Uint8 p_type,
                                                  in template (value) octetstring  p_v2xPdu,
                                                  in template (value) Uint8 p_subjectPduIndex := 0,
                                                  in template (omit) Certificate p_certificate := omit
                                                  ) := {
      type_           := p_type,
      v2xPdus	        := { { obsPduEtsiGn := p_v2xPdu } },
      certificate     := p_certificate,
      subjectPduIndex := p_subjectPduIndex
    } // End of template m_v2x_pdu_stream

    template (present) V2xPduStream mw_v2x_pdu_stream(
                                                    template (present) Uint8 p_type := ?,
                                                    template (present) octetstring p_v2xPdu := ?,
                                                    template (present) Uint8 p_subjectPduIndex := ?,
                                                    template Certificate p_certificate := *
                                                    ) := {
      type_           := p_type,
      v2xPdus	        := { { obsPduEtsiGn := p_v2xPdu } },
      certificate     := p_certificate,
      subjectPduIndex := p_subjectPduIndex
    } // End of template mw_v2x_pdu_stream

    group speed {

      template (value) AsrCam m_asr_cam_report_speed(
                                                     in template (value) MbObsCamSpeed p_observations, 
                                                     in template (value) V2xPduStreamList p_v2xPduEvidence,
                                             in template (value) AsrCam.nonV2xPduEvidence p_nonV2xPduEvidence
                                                     in template (value) AsrCam.nonV2xPduEvidence p_nonV2xPduEvidence := {}
                                                     ) := {
      observations       := p_observations, 
        //observations       := { p_observations }, 
        observations       := { 
                                {  tgtId := c_CamTgt_SpeedCommon, 
                                  observations := { { mbObsCamSpeed := p_observations}  }
                                } // Record ObservationsByTarget
                              }, // Record of ObservationsByTargetSequence
        v2xPduEvidence     := p_v2xPduEvidence,
        nonV2xPduEvidence  := p_nonV2xPduEvidence
    } // End of template m_asr_cam_speed_report
      } // End of template m_asr_cam_speed_report_speed

    template (present) AsrCam mw_asr_cam_report(
                                                template (present) AsrCam.observations p_observations := ?, 
      template (present) AsrCam mw_asr_cam_report_speed(
                                                        template (present) MbObsCamSpeed p_observations := ?, 
                                                        template (present) V2xPduStreamList p_v2xPduEvidence := ?,
                                                        template (present) AsrCam.nonV2xPduEvidence p_nonV2xPduEvidence := ?
                                                        ) := {
      observations       := p_observations, 
        observations       := { 
                                {  tgtId := c_CamTgt_SpeedCommon, 
                                  observations := { { mbObsCamSpeed := p_observations}  }
                                } // Record ObservationsByTarget
                              }, // Record of ObservationsByTargetSequence 
        v2xPduEvidence     := p_v2xPduEvidence,
        nonV2xPduEvidence  := p_nonV2xPduEvidence
    } // End of template mw_asr_cam_report

    group speed {
      } // End of template mw_asr_cam_report_speed

      template (value) ObservationsByTargetSpeed m_obsrvation_speed(
                                                                    in template (value) ObservationsByTargetSpeed.observations p_observations
      /*template (value) ObservationsByTargetSpeed m_observation_speed(
                                                                     in template (value) MbObsCamSpeed p_observations
                                                                     ) := {
        tgtId         := c_CamTgt_SpeedCommon,
        observations  := p_observations
      } // End of template mw_obsrvation_speed
        observations  := { { mbObsCamSpeed := p_observations} }
      } // End of template m_observation_speed

      template (present) ObservationsByTargetSpeed mw_obsrvation_speed(
                                                                       template (present) ObservationsByTargetSpeed.observations p_observations := ?
      template (present) ObservationsByTargetSpeed mw_observation_speed(
                                                                        template (present) MbObsCamSpeed p_observations := ?
                                                                        ) := {
        tgtId         := c_CamTgt_SpeedCommon,
        observations  := p_observations
      } // End of template mw_obsrvation_speed
        observations  := { { mbObsCamSpeed := p_observations} }
      }*/ // End of template mw_observation_speed

      template (value) MbObsCamSpeed m_mb_obs_cam_speed_vehicle_type := {
        obsId  := c_ObsSpeed_ValueTooLarge_VehicleType,
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ module LibItsMbr_TypesAndValues {

  group constants {

    const integer MbrProtocolVersion := 1;
    const integer c_mbrProtocolVersion := 1;

  } // End of group constants

Compare 9c63e59a to d8de5275
Original line number Diff line number Diff line
Subproject commit 9c63e59a2de8563f63453a54638fe617abf2f024
Subproject commit d8de52753f47a99cc393ea17ed8caaab79e35357
+101 −9
Original line number Diff line number Diff line
@@ -25,8 +25,18 @@ module LibItsMbr_Functions {
  import from LibItsCommon_ASN1_NamedNumbers all;
  import from LibItsCommon_Pixits all;
  
  // LibItsCam
  import from LibItsCam_Templates all;
  //import from LibItsCam_Functions all;
  //import from LibItsCam_TestSystem all;
  
  // LibItsBtp
  import from LibItsBtp_Templates all;
  
  // LibItsGeoNetworking
  import from LibItsGeoNetworking_TypesAndValues all;
  import from LibItsGeoNetworking_Templates all;
  import from LibItsGeoNetworking_Functions all;
  import from LibItsGeoNetworking_TestSystem all;
  import from LibItsGeoNetworking_Pixits all;
  
@@ -88,7 +98,7 @@ module LibItsMbr_Functions {
    function f_cfUp_itss() runs on ItsMbrItss system ItsMbrItssSystem {
      
      map(self:geoNetworkingPort, system:geoNetworkingPort);
      map(self:utPort, system:utPort);
      map(self:utMbrPort, system:utMbrPort);
      //map(self:acPort, system:acPort);
      
      f_initializeState();
@@ -127,7 +137,7 @@ module LibItsMbr_Functions {
     */
    function f_cfDown_itss() runs on ItsMbrItss system ItsMbrItssSystem {
      unmap(self:geoNetworkingPort, system:geoNetworkingPort);
      unmap(self:utPort, system:utPort);
      unmap(self:utMbrPort, system:utMbrPort);
      //unmap(self:acPort, system:acPort);
      
    } // End of function f_cfDown
@@ -175,14 +185,14 @@ module LibItsMbr_Functions {
  group ut_port {

    function f_utInitializeIut(template (value) UtMbrInitialize p_init) runs on ItsMbrItss {
      utPort.send(p_init);
      utMbrPort.send(p_init);
      tc_wait.start;
      alt {
        [] utPort.receive(UtMbrResults: { utMbrInitializeResult := true }) {
        [] utMbrPort.receive(UtMbrResults: { utMbrInitializeResult := true }) {
          tc_wait.stop;
          log("*** f_utInitializeIut: INFO: IUT initialized ***");
        }
        [] utPort.receive {
        [] utMbrPort.receive {
          tc_wait.stop;
          log("*** f_utInitializeIut: INFO: IUT could not be initialized ***");
          f_selfOrClientSyncAndVerdict("error", e_error);
@@ -200,13 +210,13 @@ module LibItsMbr_Functions {
                                in UInt8 p_cause
                                ) runs on ItsMbrItss {

      utPort.send(UtMbrTrigger: { p_targetId, p_cause });
      utMbrPort.send(UtMbrTrigger: { p_targetId, p_cause });
      tc_ac.start;
      alt {
        [] utPort.receive(UtMbrResults: { utMbrTriggerResult := true }) {
        [] utMbrPort.receive(UtMbrResults: { utMbrTriggerResult := true }) {
          tc_ac.stop;
        }
        [] utPort.receive(UtMbrResults: { utMbrTriggerResult := false }) {
        [] utMbrPort.receive(UtMbrResults: { utMbrTriggerResult := false }) {
          tc_ac.stop;
          log("*** f_sendUtMbrTrigger: ERROR: Received unexpected message ***");
          f_selfOrClientSyncAndVerdict("error", e_error);
@@ -341,7 +351,7 @@ module LibItsMbr_Functions {
      if (decvalue(v_msg_bit, p_etsiTs103759_data) != 0) {
        return false;
      }
      if (p_etsiTs103759_data.version != MbrProtocolVersion) {
      if (p_etsiTs103759_data.version != c_mbrProtocolVersion) {
        return false;
      }

@@ -389,6 +399,88 @@ module LibItsMbr_Functions {

  } // End of group helpers

  group send_cam {

    function f_prepare_inconsistent_cam(
                                        in charstring p_configId,
                                        in HeaderInfo p_headerInfo,
                                        in SignerIdentifier p_signerIdentifier
                                        ) runs on ItsMbrItss return GeoNetworkingPdu {
      // Local variables
      var GnNonSecuredPacket v_gnNonSecuredPacket;
      var octetstring v_gnPayload;
      var EtsiTs103097Data v_securedMessage;
      
      log(">>> f_prepare_inconsistent_cam");
      v_gnNonSecuredPacket := valueof(m_geoNwShbPacket(f_getPosition(c_compNodeC)));
      // Encode CAM payload
      v_gnPayload := valueof(
                              bit2oct(
                                      encvalue(
                                              m_camReq(
                                                        m_camMsg_vehicle_HF_BV(
                                                                              f_getTsStationId(),
                                                                              f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                                                                              LibItsCam_Templates.m_tsPosition
                                                                              )))));
      
      // Add BTP/CAM payload
      if (PX_GN_UPPER_LAYER == e_btpA) {
        v_gnNonSecuredPacket.payload := valueof(
                                                bit2oct(
                                                        encvalue(
                                                                  m_btpA(
                                                                        v_gnPayload))));
      } else {
        v_gnNonSecuredPacket.payload := valueof(
                                                bit2oct(
                                                        encvalue(
                                                                  m_btpB(
                                                                        v_gnPayload))));
      }
      // Encode it
      log("f_prepare_inconsistent_cam: v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
      v_gnPayload := bit2oct(
                              encvalue(
                                      v_gnNonSecuredPacket
                                      )
                              );
      log("f_prepare_inconsistent_cam: v_gnPayload= ", v_gnPayload);
      f_buildGnSecuredCam(
                          v_securedMessage,
                          valueof(m_toBeSignedData(
                                                    m_signedDataPayload(
                                                                        m_etsiTs103097Data_unsecured(
                                                                                                    v_gnPayload
                                                                                                    )), 
                                                    p_headerInfo
                                                    )),
                          p_signerIdentifier,
                          p_configId
                          );
      // Return secured Gn packet
      return valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
    } // End of function f_prepare_inconsistent_cam

    function f_send_inconsistent_cam() runs on ItsMbrItss {
      // Local variables
      var GnNonSecuredPacket v_gnNonSecuredPacket;
      var octetstring v_gnPayload;
      var EtsiTs103097Data v_securedMessage;
      var GeoNetworkingPdu v_securedGnPdu;

      log(">>> f_send_inconsistent_cam");
      v_securedGnPdu := f_prepare_inconsistent_cam(
                                                   cc_taCert_A,
                                                   valueof(m_headerInfo_cam(-, (f_getCurrentTime() * 1000)/*us*/)),
                                                   valueof(m_signerIdentifier_certificate(vc_atCertificate))
                                                   );
      log("f_send_inconsistent_cam: v_securedGnPdu= ", v_securedGnPdu);
      f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
    }

  } // End of group send_cam

  group altsteps {
    
    altstep a_default_mbr_http() runs on ItsMbrHttp {
Loading