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

Implement class1 test cases

parent 4c952bd0
Loading
Loading
Loading
Loading
+1761 −266

File changed.

Preview size limit exceeded, changes collapsed.

+5 −0
Original line number Diff line number Diff line
@@ -11,4 +11,9 @@ module LibItsMbr_Pics {
   */
  modulepar charstring PICS_IUT_MA_CERTIFICATE_ID := "CERT_IUT_A_MA";

  /**
   * @desc Certificate of the Misbehaviour Authority with non MA SSPs
   */
  modulepar charstring PICS_IUT_MA_CERTIFICATE_ID_NO_SSP := "CERT_IUT_A_MA_BO_SSP";

} // End of module LibItsMbr_Pics
 No newline at end of file
+9 −3
Original line number Diff line number Diff line
@@ -14,19 +14,25 @@ module LibItsMbr_Pixits {

  /**
   * @desc Speed threshold value for unknown(0), pedestrian(1), cyclist(2), moped(3), specialVehicles(10) and tram(11)
   * @see ASN.1 Type definition for SetMbObsTgtsCam
   * @see ASN.1 Type definition for MbObsCamSpeed
   */
  modulepar integer PX_MBR_PEDESTRIAN_SPEED_THRESHOLD := 3000;

  /**
   * @desc Speed threshold value for passengerCar(5)
   * @see ASN.1 Type definition for SetMbObsTgtsCam
   * @see ASN.1 Type definition for MbObsCamSpeed
   */
  modulepar integer PX_MBR_PASSENGER_CAR_SPEED_THRESHOLD := 14000;

  /**
   * @desc Longitudinal Acceleration threshold value for passengerCar(5)
   * @see ASN.1 Type definition for MbObsCamLongAcc
   */
  modulepar integer PX_MBR_PASSENGER_CAR_LONG_ACC_THRESHOLD := 820;

  /**
   * @desc Position threshold value for short range communication
   * @see ASN.1 Type definition for SetMbObsTgtsCam
   * @see ASN.1 Type definition for MbObsCamPosition
   */
  modulepar float PX_MBR_PASSENGER_CAR_POSITION_THRESHOLD := 200.0;

+96 −0
Original line number Diff line number Diff line
@@ -268,6 +268,102 @@ module LibItsMbr_Templates {

    } // End of group speed

    group long_acc {
      
      template (value) AsrCam m_asr_cam_report_long_acc(
                                                        in template (value) MbObsCamLongAcc p_observations, 
                                                        in template (value) V2xPduStreamList p_v2xPduEvidence,
                                                        in template (value) AsrCam.nonV2xPduEvidence p_nonV2xPduEvidence := {}
                                                        ) := {
        //observations       := { p_observations }, 
        observations       := { 
                                {  tgtId := c_CamTgt_LongAccCommon, 
                                  observations := { { mbObsCamLongAcc := p_observations}  }
                                } // Record ObservationsByTarget
                              }, // Record of ObservationsByTargetSequence
        v2xPduEvidence     := p_v2xPduEvidence,
        nonV2xPduEvidence  := p_nonV2xPduEvidence
      } // End of template m_asr_cam_report_long_acc

      template (present) AsrCam mw_asr_cam_report_long_acc(
                                                           template (present) MbObsCamLongAcc p_observations := ?, 
                                                           template (present) V2xPduStreamList p_v2xPduEvidence := ?,
                                                           template (present) AsrCam.nonV2xPduEvidence p_nonV2xPduEvidence := ?
                                                           ) := {
        observations       := { 
                                {  tgtId := c_CamTgt_LongAccCommon, 
                                  observations := { { mbObsCamLongAcc := p_observations}  }
                                } // Record ObservationsByTarget
                              }, // Record of ObservationsByTargetSequence 
        v2xPduEvidence     := p_v2xPduEvidence,
        nonV2xPduEvidence  := p_nonV2xPduEvidence
      } // End of template mw_asr_cam_report_long_acc

      template (value) MbObsCamSpeed m_mb_obs_cam_long_acc_value_too_large := {
        obsId  := c_ObsLongAcc_ValueTooLarge,
        obs    := { longAcc_ValueTooLarge := NULL }
      } // End of template m_mb_obs_cam_long_acc_value_too_large

    } // End of group long_acc

    group security {

      template (value) AsrCam m_asr_cam_report_security(
                                                        in template (value) MbObsCamSecurity p_observations, 
                                                        in template (value) V2xPduStreamList p_v2xPduEvidence,
                                                        in template (value) AsrCam.nonV2xPduEvidence p_nonV2xPduEvidence := {}
                                                          ) := {
          //observations       := { p_observations }, 
          observations       := { 
                                  {  tgtId := c_CamTgt_SecurityCommon, 
                                    observations := { { mbObsCamSecurity := p_observations}  }
                                  } // Record ObservationsByTarget
                                }, // Record of ObservationsByTargetSequence
          v2xPduEvidence     := p_v2xPduEvidence,
          nonV2xPduEvidence  := p_nonV2xPduEvidence
        } // End of template m_asr_cam_report_security

        template (present) AsrCam mw_asr_cam_report_security(
                                                            template (present) MbObsCamSecurity p_observations := ?, 
                                                            template (present) V2xPduStreamList p_v2xPduEvidence := ?,
                                                            template (present) AsrCam.nonV2xPduEvidence p_nonV2xPduEvidence := ?
                                                            ) := {
          observations       := { 
                                  {  tgtId := c_CamTgt_SecurityCommon, 
                                    observations := { { mbObsCamSecurity := p_observations}  }
                                  } // Record ObservationsByTarget
                                }, // Record of ObservationsByTargetSequence 
          v2xPduEvidence     := p_v2xPduEvidence,
          nonV2xPduEvidence  := p_nonV2xPduEvidence
        } // End of template mw_asr_cam_report_security

        template (value) MbObsCamSecurity m_mb_obs_cam_security_message_id_inc_with_header_info := {
          obsId  := c_Obs_Security_MessageIdIncWithHeaderInfo,
          obs    := { obs_Position_ChangeTooLarge := NULL }
        } // End of template m_mb_obs_cam_security_message_id_inc_with_header_info

        template (value) MbObsCamSecurity m_mb_obs_cam_security_header_inc_with_security_profile := {
          obsId  := c_Obs_Security_HeaderIncWithSecurityProfile,
          obs    := { obs_Position_ChangeTooLarge := NULL }
        } // End of template m_mb_obs_cam_security_header_inc_with_security_profile

        template (value) MbObsCamSecurity m_mb_obs_cam_security_header_psid_inc_with_certificate := {
          obsId  := c_Obs_Security_HeaderPsidIncWithCertificate,
          obs    := { obs_Position_ChangeTooLarge := NULL }
        } // End of template m_mb_obs_cam_security_header_psid_inc_with_certificate

        template (value) MbObsCamSecurity m_mb_obs_cam_security_message_inc_with_ssp := {
          obsId  := c_Obs_Security_MessageIncWithSsp,
          obs    := { obs_Position_ChangeTooLarge := NULL }
        } // End of template m_mb_obs_cam_security_message_inc_with_ssp

        template (value) MbObsCamSecurity m_mb_obs_cam_security_header_time_outside_certificate_validity := {
          obsId  := c_Obs_Security_MessageIncWithSsp,
          obs    := { obs_Position_ChangeTooLarge := NULL }
        } // End of template m_mb_obs_cam_security_header_time_outside_certificate_validity

    } // End of group security

  } // End of group camObservation

  group security {
+118 −52
Original line number Diff line number Diff line
@@ -29,8 +29,6 @@ module LibItsMbr_Functions {
  
  // LibItsCam
  import from LibItsCam_Templates all;
  //import from LibItsCam_Functions all;
  //import from LibItsCam_TestSystem all;
  
  // LibItsBtp
  import from LibItsBtp_Templates all;
@@ -612,33 +610,6 @@ module LibItsMbr_Functions {
      // 4. Return the MBR message
      log("f_verify_mbr_request_message: v_ieee1609dot2_signed_data.content.signedData.tbsData.payload.data.content.unsecuredData= ", v_ieee1609dot2_signed_data.content.signedData.tbsData.payload.data.content.unsecuredData);
      v_msg_bit := oct2bit(v_ieee1609dot2_signed_data.content.signedData.tbsData.payload.data.content.unsecuredData);
      /****************************************************************
       * Workaround due to TITAN COER decodig issue
       */
      p_etsiTs103759_data := valueof(
                                      m_etsiTs103759Data(
                                                          1,
                                                          0, // us
                                                          m_threeDLocation(
                                                                          0,
                                                                          0,
                                                                          0
                                                                          ),
                                                          m_cam_specific_report(
                                                                                m_asr_cam_report_speed(
                                                                                                      m_mb_obs_cam_speed_change_too_large,
                                                                                                      { 
                                                                                                          m_v2x_pdu_stream(
                                                                                                                          c_ObsPdu_etsiGn,
                                                                                                                          '02020010F43DA2E0405A8B8E450E72E434C00200200030D41E0000012016840310A50733FFE1FFFA001000'O
                                                                                                                          )
                                                                                                        }
                                      )))        
      );
      /*
       * Workaround due to TITAN COER decodig issue
       ****************************************************************/
      
      if (decvalue(v_msg_bit, p_etsiTs103759_data) != 0) {
        return false;
      }
@@ -696,8 +667,13 @@ module LibItsMbr_Functions {
                                         in charstring p_configId,
                                         in HeaderInfo p_headerInfo,
                                         in SignerIdentifier p_signerIdentifier,
                                         in boolean p_alter_cam_speed := false,
                                         in boolean p_alter_cam_position := false
                                         in boolean p_alter_cam_speed_vehicle_type := false,
                                         in boolean p_alter_cam_speed_drive_direction_reverse := false,
                                         in boolean p_alter_cam_long_acc := false,
                                         in boolean p_alter_cam_position := false,
                                         in boolean p_alter_header_info := false,
                                         in boolean p_alter_psid := false,
                                         in boolean p_add_emergency_containers := false
                                         ) runs on ItsMbrItss return GeoNetworkingPdu {
      // Local variables
      var GnNonSecuredPacket v_gnNonSecuredPacket;
@@ -716,13 +692,21 @@ module LibItsMbr_Functions {
                       ));
      // Alter CAM message
      //msgOut := { header := { protocolVersion := 2, messageId := 2, stationId := 111111 }, cam := { generationDeltaTime := 46612, camParameters := { basicContainer := { stationType := 5, referencePosition := { latitude := 436175790, longitude := 70546480, positionConfidenceEllipse := { semiMajorConfidence := 1, semiMinorConfidence := 1, semiMajorOrientation := 0 }, altitude := { altitudeValue := 0, altitudeConfidence := unavailable (15) } } }, highFrequencyContainer := { basicVehicleContainerHighFrequency := { heading := { headingValue := 0, headingConfidence := 10 }, speed := { speedValue := 45, speedConfidence := 5 }, driveDirection := forward (0), vehicleLength := { vehicleLengthValue := 50, vehicleLengthConfidenceIndication := noTrailerPresent (0) }, vehicleWidth := 21, longitudinalAcceleration := { longitudinalAccelerationValue := 161, longitudinalAccelerationConfidence := 102 }, curvature := { curvatureValue := 0, curvatureConfidence := unavailable (7) }, curvatureCalculationMode := yawRateUsed (0), yawRate := { yawRateValue := 0, yawRateConfidence := unavailable (8) }, accelerationControl := omit, lanePosition := omit, steeringWheelAngle := omit, lateralAcceleration := omit, verticalAcceleration := omit, performanceClass := omit, cenDsrcTollingZone := omit } }, lowFrequencyContainer := omit, specialVehicleContainer := omit } } } }
      if (p_alter_cam_speed) {
      if (p_alter_cam_speed_vehicle_type) {
        select (v_cam.cam.camParameters.basicContainer.stationType) { 
          case (5) { // FIXME FSCOM To be continued
            v_cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.speed.speedValue := PX_MBR_PASSENGER_CAR_SPEED_THRESHOLD + 1000;
          }
        } // End of 'select'statement
      } // FIXME FSCOM To be continued
      } else if (p_alter_cam_speed_drive_direction_reverse) {
        v_cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.speed.speedValue := PX_MBR_PASSENGER_CAR_SPEED_THRESHOLD + 1000;
        v_cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.driveDirection := backward1;
      } else if (p_alter_cam_long_acc) {
        v_cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.longitudinalAcceleration := m_longitudinalAcceleration(PX_MBR_PASSENGER_CAR_LONG_ACC_THRESHOLD, );
      }  else if (p_add_emergency_containers) {
        v_cam.cam.camParameters.specialVehicleContainer.emergencyContainer := m_emergencyContainer;
      }

      // Encode CAM payload
      v_gnPayload := valueof(bit2oct(encvalue(m_camReq(v_cam))));
      // Add BTP/CAM payload
@@ -747,6 +731,37 @@ module LibItsMbr_Functions {
                                      )
                              );
      log("f_prepare_inconsistent_cam_: v_gnPayload= ", v_gnPayload);
      if (p_alter_header_info) {
        f_buildGnSecuredCam_Bo(
                               v_securedMessage,
                               valueof(m_toBeSignedData(
                                                        m_signedDataPayload(
                                                                            m_etsiTs103097Data_unsecured(
                                                                                                         v_gnPayload
                                                                                                         )), 
                                                        p_headerInfo
                                                        )),
                              p_signerIdentifier,
                              p_configId,
                              -, -, -, -, -, -, -, -, -, -,
                              true
                              );
      } else if (p_alter_psid == true) {
        f_buildGnSecuredCam_Bo(
                               v_securedMessage,
                               valueof(m_toBeSignedData(
                                                        m_signedDataPayload(
                                                                            m_etsiTs103097Data_unsecured(
                                                                                                         v_gnPayload
                                                                                                         )), 
                                                        p_headerInfo
                                                        )),
                              p_signerIdentifier,
                              p_configId,
                              -,
                              true
                              );
      } else {
        f_buildGnSecuredCam(
                            v_securedMessage,
                            valueof(m_toBeSignedData(
@@ -759,14 +774,20 @@ module LibItsMbr_Functions {
                            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_prepare_inconsistent_cam(
                                        in charstring p_configId := cc_taCert_A,
                                        in boolean p_include_certificate := true,
                                        in boolean p_alter_cam_speed := false,
                                        in boolean p_alter_cam_position := false
                                        in boolean p_alter_cam_speed_vehicule_type := false,
                                        in boolean p_alter_cam_speed_drive_direction_reverse := false,
                                        in boolean p_alter_cam_long_acc := false,
                                        in boolean p_alter_cam_position := false,
                                        in boolean p_alter_header_info := false,
                                        in boolean p_alter_psid := false
                                        ) runs on ItsMbrItss return GeoNetworkingPdu {
      // Local variables
      var GeoNetworkingPdu v_securedGnPdu;
@@ -774,11 +795,15 @@ module LibItsMbr_Functions {
      if (p_include_certificate) {
        log("f_prepare_inconsistent_cam: vc_atCertificate: ", vc_atCertificate);
        v_securedGnPdu := f_prepare_inconsistent_cam_(
                                                      cc_taCert_A,
                                                      p_configId,
                                                      valueof(m_headerInfo_cam(-, (f_getCurrentTime() * 1000)/*us*/)),
                                                      valueof(m_signerIdentifier_certificate(vc_atCertificate)),
                                                      p_alter_cam_speed,
                                                      p_alter_cam_position
                                                      p_alter_cam_speed_vehicule_type,
                                                      p_alter_cam_speed_drive_direction_reverse,
                                                      p_alter_cam_long_acc,
                                                      p_alter_cam_position,
                                                      p_alter_header_info,
                                                      p_alter_psid
                                                      );
      } else {
        var HashedId8 v_hashedId8;
@@ -788,14 +813,55 @@ module LibItsMbr_Functions {
                                                      cc_taCert_A,
                                                      valueof(m_headerInfo_cam(-, (f_getCurrentTime() * 1000)/*us*/)),
                                                      valueof(m_signerIdentifier_digest(v_hashedId8)),
                                                      p_alter_cam_speed,
                                                      p_alter_cam_position
                                                      p_alter_cam_speed_vehicule_type,
                                                      p_alter_cam_speed_drive_direction_reverse,
                                                      p_alter_cam_long_acc,
                                                      p_alter_cam_position,
                                                      p_alter_header_info
                                                      );
      }
      log("f_prepare_inconsistent_cam: v_securedGnPdu= ", v_securedGnPdu);
      return v_securedGnPdu;
    }

    function f_prepare_cam(
                                        in boolean p_include_certificate := true,
                                        in boolean p_alter_cam_speed_vehicule_type := false,
                                        in boolean p_alter_cam_speed_drive_direction_reverse := false,
                                        in boolean p_alter_cam_long_acc := false,
                                        in boolean p_alter_cam_position := false,
                                        in boolean p_alter_header_info := false,
                                        in boolean p_alter_psid := false
                                        ) runs on ItsMbrItss return GeoNetworkingPdu {
      // Local variables
      var GeoNetworkingPdu v_securedGnPdu;

      if (p_include_certificate) {
        log("f_prepare_inconsistent_cam: vc_atCertificate: ", vc_atCertificate);
        v_securedGnPdu := f_prepare_inconsistent_cam_(
                                                      cc_taCert_A,
                                                      valueof(m_headerInfo_cam(-, (f_getCurrentTime() * 1000)/*us*/)),
                                                      valueof(m_signerIdentifier_certificate(vc_atCertificate))
                                                      );
      } else {
        var HashedId8 v_hashedId8;
        f_getCertificateDigest(PX_CERT_FOR_TS, v_hashedId8);
        log("f_prepare_inconsistent_cam: v_hashedId8: ", v_hashedId8);
        v_securedGnPdu := f_prepare_inconsistent_cam_(
                                                      cc_taCert_A,
                                                      valueof(m_headerInfo_cam(-, (f_getCurrentTime() * 1000)/*us*/)),
                                                      valueof(m_signerIdentifier_digest(v_hashedId8)),
                                                      p_alter_cam_speed_vehicule_type,
                                                      p_alter_cam_speed_drive_direction_reverse,
                                                      p_alter_cam_long_acc,
                                                      p_alter_cam_position,
                                                      p_alter_header_info
                                                      );
      }
      log("f_prepare_cam: v_securedGnPdu= ", v_securedGnPdu);
      return v_securedGnPdu;
    }

  } // End of group send_cam

  group altsteps {