Commit b88f04e8 authored by garciay's avatar garciay
Browse files

Validate DENM/CAM decoding from pcap files

parent d74c3a5f
Loading
Loading
Loading
Loading
+67 −23
Original line number Diff line number Diff line
@@ -35,15 +35,15 @@ module TestCodec_CAM {
          basicContainer := {
            stationType := StationType_passengerCar_,
            referencePosition := {
              latitude := 435525985,
              longitude := 103001180,
              latitude := 435524450,
              longitude := 103002416,
              positionConfidenceEllipse := {
                semiMajorConfidence   := 4095,
                semiMinorConfidence   := 4095,
                semiMajorConfidence   := SemiAxisLength_unavailable_,
                semiMinorConfidence   := SemiAxisLength_unavailable_,
                semiMajorOrientation  := 3601
                },
              altitude := {
                altitudeValue := 700,
                altitudeValue := 500,
                altitudeConfidence := unavailable
              }
              }
@@ -51,36 +51,39 @@ module TestCodec_CAM {
          highFrequencyContainer := {
            basicVehicleContainerHighFrequency := {
              heading := {
                headingValue := HeadingValue_wgs84North_, //0
                headingValue := 2343,
                headingConfidence := 127
              },
              speed := {
                speedValue := 5,
                speedConfidence := 127
                speedValue := 1001,
                speedConfidence := 1
              },
              driveDirection := unavailable,
              vehicleLength := {
                vehicleLengthValue := 23,
                vehicleLengthConfidenceIndication := noTrailerPresent
                vehicleLengthValue := 40,
                vehicleLengthConfidenceIndication := unavailable
                },
              vehicleWidth := 12,
              vehicleWidth := 18,
              longitudinalAcceleration := {
                longitudinalAccelerationValue := LongitudinalAccelerationValue_unavailable_,
                longitudinalAccelerationConfidence := AccelerationConfidence_unavailable_
                longitudinalAccelerationValue := 0,
                longitudinalAccelerationConfidence := 1
                },
              curvature := {
                curvatureValue := CurvatureValue_straight_,
                curvatureConfidence := unavailable
                curvatureValue := CurvatureValue_unavailable_, //30001
                curvatureConfidence := onePerMeter_0_00002
              },
              curvatureCalculationMode := yawRateUsed,
              yawRate := {
                yawRateValue := YawRateValue_straight_,
                yawRateConfidence := unavailable
                },
              accelerationControl := omit,
              accelerationControl := '0000000'B,
              lanePosition := 14,
              steeringWheelAngle := omit,
              lateralAcceleration := omit,
              lateralAcceleration := {
                lateralAccelerationValue := 0,
                lateralAccelerationConfidence := 1
                },
              verticalAcceleration := omit, 
              performanceClass := omit,
              cenDsrcTollingZone := omit
@@ -100,12 +103,24 @@ module TestCodec_CAM {
        TestCamReq(
                   m_camReq(
                            m_camMsg(
                                     10152,
                                     62216
                                     10047,
                                     31859
                                     )
                            ), 
                   true,
                   oct2bit('0102000027a8f3080059f3504c2e2dafcb9ffffffc22312b9e20000fc002fe81605a8333a9870fffd1e058ea2167'O)
                   oct2bit('01020000273f7c730059f34f8c4e2db0661ffffffc2231129e48927fc1f48082788a800f53080fffc4014004'O)
                   );
      }
      
      testcase tc_CamInd() runs on TCType system TCType {
        TestCamInd(
                   mw_camInd(
                             m_camMsg(
                                      10047,
                                      31859
                                      )
                            ), 
                   '01020000273f7c730059f34f8c4e2db0661ffffffc2231129e48927fc1f48082788a800f53080fffc40140040102030405060708090a0b0c0d0e0f00000000000000000000000000000000000000000000000000000000000a0a0a0a'O
                   );
      }
      
@@ -772,6 +787,35 @@ module TestCodec_CAM {
            
    } // End of function TestCamReq
        
    function TestCamInd(
                        in template CamInd p_camInd,
                        in octetstring p_expEncMsg 
                        ) runs on TCType {
      var bitstring v_encMsg := oct2bit(p_expEncMsg);
      var CamInd v_decMsg;
      var integer v_res := 0;
      
      // Check decoding
      v_res := decvalue(v_encMsg, v_decMsg);
      select (v_res) {
      case (0) {
        log("v_decMsg: ", v_decMsg);
        if(match(valueof(v_decMsg), p_camInd)) {
          setverdict(pass);
        } else {
          setverdict(fail);
        }
      }
      case (1) {
        setverdict(fail, "Decoding failed.");
      }
      case (2) {
        setverdict(fail, "Not enough bits.");
      }
      } // End of 'select' statement
      
    } // End of function TestCamInd
    
  } // End of group encdec_functions
  
} // End of module TestCodec_CAM 
+44 −4
Original line number Diff line number Diff line
@@ -41,6 +41,17 @@ module TestCodec_DENM {
                    );
      }
      
      testcase tc_DenmInd() runs on TCType system TCType {
        TestDenmInd(
                   mw_denmInd(
                              mw_denmPdu(
                                         mw_denm
                                         )
                            ), 
                   '010100002791e7800013c880010bd463c55862f518f1561cf9ae0e8716e0ba7ffffffe11186a004d46003e70f200c002813f9f80a6338102e4bef4ec6700014f902c2f4cc670fef83fec8c670ff19bfb7ec670fdbabfbd6c670fe87bf914c670228d4d0758800013c88000000013c88000803a7f538a0102030405060708090a0b0c0d0e0f00000000000000000000000000000000000000000000000000000000000a0a0a0a'O
                   );
      }
      
    } // End of group testDenmPrimitiveMessages
        
    group testDenmUpperTester {
@@ -504,6 +515,35 @@ module TestCodec_DENM {
      
    } // End of function TestDenmReq
    
    function TestDenmInd(
                         in template DenmInd p_camInd,
                         in octetstring p_expEncMsg 
                         ) runs on TCType {
      var bitstring v_encMsg := oct2bit(p_expEncMsg);
      var DenmInd v_decMsg;
      var integer v_res := 0;
      
      // Check decoding
      v_res := decvalue(v_encMsg, v_decMsg);
      select (v_res) {
      case (0) {
        log("v_decMsg: ", v_decMsg);
        if(match(valueof(v_decMsg), p_camInd)) {
          setverdict(pass);
        } else {
          setverdict(fail);
        }
      }
      case (1) {
        setverdict(fail, "Decoding failed.");
      }
      case (2) {
        setverdict(fail, "Not enough bits.");
      }
      } // End of 'select' statement
      
    } // End of function TestDenmInd
    
  } // End of group encdec_functions
  
} // End of module TestCodec_DENM