Commit ad709a1c authored by garciay's avatar garciay
Browse files

Update AtsRsuSimulator

parent a6f0fc7b
Loading
Loading
Loading
Loading
+13 −12
Original line number Original line Diff line number Diff line
@@ -2,10 +2,10 @@
[MODULE_PARAMETERS]
[MODULE_PARAMETERS]
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {
LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {
  typeOfAddress := e_initial,
  typeOfAddress := e_manual,
  stationType := e_unknown, #e_passengerCar,
  stationType := e_passengerCar, #e_unknown
  stationCountryCode := 0,
  stationCountryCode := 0,
  mid := '4C5E0C14D2EA'O
  mid := '00000000000B'O #'4C5E0C14D2EA'O
}
}


# GeoNetwoking only, no facility layer
# GeoNetwoking only, no facility layer
@@ -35,18 +35,19 @@ ItsRSUsSimulator_Pixits.PICS_GENERATE_MAPEM := false
ItsRSUsSimulator_Pixits.PICS_GENERATE_SPATEM   := false
ItsRSUsSimulator_Pixits.PICS_GENERATE_SPATEM   := false
ItsRSUsSimulator_Pixits.PICS_GENERATE_SSEM     := false
ItsRSUsSimulator_Pixits.PICS_GENERATE_SSEM     := false


ItsRSUsSimulator_Pics.PICS_BEACON_FREQUENCY    := 0.5
ItsRSUsSimulator_Pics.PICS_BEACON_FREQUENCY    := 1.0
ItsRSUsSimulator_Pics.PICS_CAM_FREQUENCY       := 0.5
ItsRSUsSimulator_Pics.PICS_CAM_FREQUENCY       := 1.0
ItsRSUsSimulator_Pics.PICS_DENM_FREQUENCY      := 0.5
ItsRSUsSimulator_Pics.PICS_DENM_FREQUENCY      := 1.0


ItsRSUsSimulator_Pics.PICS_SEND_CAM_INDICATION := false
[LOGGING]
[LOGGING]
# In this section you can specify the name of the log file and the classes of events
# In this section you can specify the name of the log file and the classes of events
# you want to log into the file or display on console (standard error).
# you want to log into the file or display on console (standard error).
LogFile := "../logs/%e.%h-%r.%s"
LogFile := "../logs/%e.%h-%r.%s"
FileMask := LOG_ALL | USER | DEBUG | MATCHING
#FileMask := LOG_ALL | USER | DEBUG | MATCHING
ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
LogSourceInfo := Stack
LogSourceInfo := Stack
LogEntityName:= Yes
LogEntityName:= Yes
LogEventTypes:= Yes
LogEventTypes:= Yes
@@ -121,10 +122,10 @@ LogEventTypes:= Yes
#     save_mode   : Set to 1 to save sent packet, 0 otherwise
#     save_mode   : Set to 1 to save sent packet, 0 otherwise


# Single GeoNetworking component port
# Single GeoNetworking component port
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,beaconing=0,device_mode=0,expiry=500,its_aid=37,secured_mode=0,encrypted_mode=0,certificate=CERT_IUT_F_AT,peer_certificate=CERT_TS_F_AT,sec_db_path=/home/ubuntu/tmp/test_01)/ETH(mac_src=0800275e8e00,mac_bc=FFFFFFFFFFFF,eth_type=8947)/PCAP(mac_src=0800275e8e00,nic=enp0s8,filter=and ether proto 0x8947)"
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,beaconing=0,device_mode=0,expiry=500,its_aid=37,secured_mode=0,encrypted_mode=0,certificate=CERT_IUT_F_AT,peer_certificate=CERT_TS_F_AT,sec_db_path=/home/ubuntu/tmp/test_01)/ETH(mac_src=080027f44e7d,mac_bc=FFFFFFFFFFFF,eth_type=8947)/PCAP(mac_src=080027f44e7d,nic=eth2,filter=and ether proto 0x8947)"


# Config port based on UDP
# Config port based on UDP
system.cfPort.params := "CF(ut=gn)/UDP(dst_ip=192.168.1.253,dst_port=12345,src_ip=192.168.1.250,src_port=12345)/ETH(mac_src=0800275e8e00,mac_dst=dc536045af7e,eth_type=0800)/PCAP(mac_src=0800275e8e00,nic=enp0s8,filter=and udp port 12345)"
system.cfPort.params := "CF(ut=cam)/UDP(dst_ip=192.168.2.2,dst_port=12345)"


[EXECUTE]
[EXECUTE]
ItsRSUsSimulator_TestCases.TC_RSUSIMU_BV_01
ItsRSUsSimulator_TestCases.TC_RSUSIMU_BV_01
+4 −5
Original line number Original line Diff line number Diff line
@@ -87,11 +87,10 @@ LogEventTypes:= Yes
#   source_port : Test System port
#   source_port : Test System port
#   interface_id: Interface id, used to discard packets
#   interface_id: Interface id, used to discard packets
#   tx_power    : TX power (dB)
#   tx_power    : TX power (dB)
# UDP layer (IP/UDP based on Pcap)
# UDP layer (UDP based on Socket)
#   dst_ip  : Destination IPv4 address (aa.bb.cc.dd)
#   dst_ip  : Destination IPv4 address (aa.bb.cc.dd)
#   dst_port: Destination port
#   dst_port: Destination port. Default: 12345
#   src_ip  : Source IPv4 address (aa.bb.cc.dd)
#   src_port: Source port. Default: 12345
#   src_port: Source port
# Pcap layer
# Pcap layer
#   mac_src    : Source MAC address, used to exclude from capture the acket sent by the Test System
#   mac_src    : Source MAC address, used to exclude from capture the acket sent by the Test System
#   filter     : Pcap filter (compliant with tcpdump syntax) 
#   filter     : Pcap filter (compliant with tcpdump syntax) 
@@ -135,7 +134,7 @@ system.denmPort.params := "DENM(next_header=btpB,header_type=gbc)/BTP(type=btpB,
system.ivimPort.params := "IVIM/BTP(type=btpB,dst_port=2005,src_port=0,device_mode=1)/GN(ll_address=F8CAB8083918,latitude=43551050,longitude=10298730,expiry=1000,device_mode=1,its_aid=141)/ETH(mac_src=F8CAB8083918,mac_bc=FFFFFFFFFFFF,eth_type=8947)/PCAP(mac_src=F8CAB8083918,nic=,file=../../../testdata/test_1_ivim.pcap,save_mode=1,filter=and ether proto 0x8947,frame_offset=0)"
system.ivimPort.params := "IVIM/BTP(type=btpB,dst_port=2005,src_port=0,device_mode=1)/GN(ll_address=F8CAB8083918,latitude=43551050,longitude=10298730,expiry=1000,device_mode=1,its_aid=141)/ETH(mac_src=F8CAB8083918,mac_bc=FFFFFFFFFFFF,eth_type=8947)/PCAP(mac_src=F8CAB8083918,nic=,file=../../../testdata/test_1_ivim.pcap,save_mode=1,filter=and ether proto 0x8947,frame_offset=0)"


# GeoNetworking UpperTester port based on UDP 
# GeoNetworking UpperTester port based on UDP 
system.utPort.params := "UT_GN/UDP(dst_ip=192.168.56.1,dst_port=12346,src_ip=192.168.156.4,src_port=12345)/ETH(mac_src=026f8338c1e5,mac_dst=0A0027000011,eth_type=0800)/PCAP(mac_src=0800275c4959,nic=eth1,filter=and udp port 12346)"
system.utPort.params := "UT_GN/UDP(dst_ip=192.168.56.1)"


[EXECUTE]
[EXECUTE]
# GeoNetworking Req
# GeoNetworking Req
+79 −6
Original line number Original line Diff line number Diff line
@@ -347,6 +347,16 @@ module ItsRSUsSimulator_Functions {
                            }
                            }
                        }
                        }
                );
                );
            } else if (PX_ETSI_USE_CASE_ID == 6) { // FIXME To be removed only for test
                v_cam := 
                    m_camMsg_vehicle(
                      PICS_RSU_PARAMS[p_rsu_id].stationID,
                      f_getCurrentTime() mod 65536,    // Shall be updated in function f_prepare_vehicle_cam
                      m_rsuPosition(
                          vc_longPosVectorRsu.latitude,
                          vc_longPosVectorRsu.longitude
                      )
                 );
            } else if (PX_ETSI_USE_CASE_ID == 9) {
            } else if (PX_ETSI_USE_CASE_ID == 9) {
                v_cam := 
                v_cam := 
                    m_camParm(
                    m_camParm(
@@ -828,6 +838,26 @@ module ItsRSUsSimulator_Functions {
        f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_geoNetworkingPdu, p_its_aid)));
        f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_geoNetworkingPdu, p_its_aid)));
    } // End of function f_send
    } // End of function f_send


    function f_processCam(
                           in GeoNetworkingPdu p_geoNetworkingPdu
    ) runs on ItsRSUsSimulator {
        var bitstring v_enc_msg;
        log("CAM=", p_geoNetworkingPdu);
        if (PICS_SEND_CAM_INDICATION) {
          var UtCamEventInd v_utCamEventInd;
          var integer v_result;
          // Extract CAM message
          var octetstring v_payload := p_geoNetworkingPdu.gnPacket.packet.payload;
          // Remove BTP layer
          v_payload := substr(v_payload, 4, lengthof(v_payload) - 4);
          // Send UtEventCamIndication
          v_enc_msg := oct2bit(v_payload);
          if (decvalue(v_enc_msg, v_utCamEventInd.camMsg) == 0) {
            cfPort.send(v_utCamEventInd);
          }
        }
    }
    
    function f_processSrem(
    function f_processSrem(
                           in GeoNetworkingPdu p_geoNetworkingPdu
                           in GeoNetworkingPdu p_geoNetworkingPdu
    ) runs on ItsRSUsSimulator {
    ) runs on ItsRSUsSimulator {
@@ -889,6 +919,7 @@ module ItsRSUsSimulator_Functions {
                                in integer p_dest_port, 
                                in integer p_dest_port, 
                                in integer p_src_port
                                in integer p_src_port
    ) return template (present) octetstring {
    ) return template (present) octetstring {
      log(">>> f_payload_template: ", p_dest_port, " - ", p_src_port);
        var template (present) Oct2 v_t1 := int2oct(PICS_SREM_BTP_DESTINATION_PORT, 2);
        var template (present) Oct2 v_t1 := int2oct(PICS_SREM_BTP_DESTINATION_PORT, 2);
        var template (present) Oct2 v_t2 := int2oct(PICS_SREM_BTP_SOURCE_PORT, 2);
        var template (present) Oct2 v_t2 := int2oct(PICS_SREM_BTP_SOURCE_PORT, 2);
        var template (present) octetstring v_t3 := ? length (5 .. 65535);
        var template (present) octetstring v_t3 := ? length (5 .. 65535);
@@ -907,6 +938,7 @@ module ItsRSUsSimulator_Functions {
          repeat;
          repeat;
        }
        }
        [] cfPort.receive(UtGnTrigger:?) -> value v_utGnTrigger {
        [] cfPort.receive(UtGnTrigger:?) -> value v_utGnTrigger {
          cfPort.send(UtGnResults: { utGnTriggerResult := true } );
          log("v_utGnTrigger = ", v_utGnTrigger);
          log("v_utGnTrigger = ", v_utGnTrigger);
          if (ischosen(v_utGnTrigger.geoUnicast)) {
          if (ischosen(v_utGnTrigger.geoUnicast)) {
            var GnNonSecuredPacket v_geoNwUnicastPacket := valueof(
            var GnNonSecuredPacket v_geoNwUnicastPacket := valueof(
@@ -925,10 +957,40 @@ module ItsRSUsSimulator_Functions {
                                                                  c_defaultHopLimit
                                                                  c_defaultHopLimit
                                                                 )
                                                                 )
                                                      );
                                                      );
            // FIXME Check what to do with GN_Address v_geoNwPdu.gnPacket.packet.extendedHeader.geoUnicastHeader. := v_utGnTrigger.geoUnicast.gnAddress;
            v_geoNwPdu.gnPacket.packet.commonHeader.nextHeader := e_any;
            v_geoNwPdu.gnPacket.packet.extendedHeader.geoUnicastHeader.dstPosVector.gnAddr := v_utGnTrigger.geoUnicast.gnAddress;
            geoNetworkingPort.send(m_geoNwReq_linkLayerBroadcast(v_geoNwPdu));
            geoNetworkingPort.send(m_geoNwReq_linkLayerBroadcast(v_geoNwPdu));
          } else if (ischosen(v_utGnTrigger.geoBroadcast)) {
            var GeoBroadcastArea v_broadcastArea;
            var GnNonSecuredPacket v_geoNwBroadcastPacket;
            var GeoNetworkingPdu v_geoNwPdu;

            if (v_utGnTrigger.geoBroadcast.shape == e_geoCircle) {
              v_broadcastArea.geoBroadcastSubType := e_geoBroadcastCircle;
            } else if (v_utGnTrigger.geoBroadcast.shape == e_geoRect) {
              v_broadcastArea.geoBroadcastSubType := e_geoBroadcastRect;
            } else if (v_utGnTrigger.geoBroadcast.shape == e_geoElip) {
              v_broadcastArea.geoBroadcastSubType := e_geoBroadcastElip;
            } else {
              v_broadcastArea.geoBroadcastSubType := e_reserved;
            }
            v_broadcastArea.geoBroadcastArea := v_utGnTrigger.geoBroadcast.area;
            v_geoNwBroadcastPacket := valueof(
                                              m_geoNwBroadcastPacket_payload(
                                                                             vc_longPosVectorRsu,
                                                                             f_incLocalSeqNumber(),
                                                                             v_broadcastArea,
                                                                             c_defaultHopLimit,
                                                                             v_utGnTrigger.geoBroadcast.trafficClass,
                                                                             v_utGnTrigger.geoBroadcast.payload
                                                                             ));
            v_geoNwPdu := valueof(
                                  m_geoNwPdu(
                                             v_geoNwBroadcastPacket,
                                             m_lifetimeBase1s(v_utGnTrigger.geoBroadcast.lifetime),
                                             c_defaultHopLimit
                                             ));
          }
          }
          cfPort.send(UtGnResults: { utGnTriggerResult := true } );
          repeat;
          repeat;
        }
        }
        [vc_cam == true] cfPort.receive(UtCamInitialize:?) {
        [vc_cam == true] cfPort.receive(UtCamInitialize:?) {
@@ -937,19 +999,30 @@ module ItsRSUsSimulator_Functions {
        }
        }
        [vc_cam == true] cfPort.receive(UtCamTrigger: { changeSpeed := ? }) {
        [vc_cam == true] cfPort.receive(UtCamTrigger: { changeSpeed := ? }) {
          cfPort.send(UtCamResults: { utCamTriggerResult := true } );
          cfPort.send(UtCamResults: { utCamTriggerResult := true } );
          vc_cam_timer_value := vc_cam_timer_value / 4.0;
          vc_cam_timer_value := vc_cam_timer_value / 2.0;
          repeat;
        }
        [vc_cam == true] cfPort.receive(UtCamTrigger: { changeCurvature := ? }) -> value v_utCamTrigger {
          log("v_utCamTrigger = ", v_utCamTrigger);
          if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency)) {
            cfPort.send(UtCamResults: { utCamTriggerResult := true } );
            vc_rsuMessagesValueList[vc_rsu_id].cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.curvature.curvatureValue := v_utCamTrigger.changeCurvature;
          } else {
            cfPort.send(UtCamResults: { utCamTriggerResult := false } );
          }
          repeat;
          repeat;
        }
        }
        /*[vc_cam == true] cfPort.receive(UtCamTrigger: { changeCurvature := ? }) -> value v_utCamTrigger {
        [vc_cam == true] cfPort.receive(UtCamTrigger: { changeHeading := ? }) -> value v_utCamTrigger {
          log("v_utCamTrigger = ", v_utCamTrigger);
          if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency)) {
          if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency)) {
            cfPort.send(UtCamResults: { utCamTriggerResult := true } );
            cfPort.send(UtCamResults: { utCamTriggerResult := true } );
            //            vc_rsuMessagesValueList[vc_rsu_id].cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.curvature := v_utCamTrigger.changeCurvature;
            vc_rsuMessagesValueList[vc_rsu_id].cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.heading.headingValue := valueof(vc_rsuMessagesValueList[vc_rsu_id].cam.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.heading.headingValue) + v_utCamTrigger.changeHeading;
          } else {
          } else {
            cfPort.send(UtCamResults: { utCamTriggerResult := false } );
            cfPort.send(UtCamResults: { utCamTriggerResult := false } );
          }
          }
          repeat;
          repeat;
        }
        }
        [vc_cam == true] cfPort.receive(UtCamTrigger: { changePosition := ? }) {
        /*[vc_cam == true] cfPort.receive(UtCamTrigger: { changePosition := ? }) {
          cfPort.send(UtCamResults: { utCamTriggerResult := true } );
          cfPort.send(UtCamResults: { utCamTriggerResult := true } );
          //TODO vc_cam_timer_value := vc_cam_timer_value / 4.0;
          //TODO vc_cam_timer_value := vc_cam_timer_value / 4.0;
          repeat;
          repeat;
+14 −0
Original line number Original line Diff line number Diff line
@@ -5705,6 +5705,20 @@ module ItsRSUsSimulator_Pics {
    
    
    } // End of group sremEvents
    } // End of group sremEvents


    group indications {

      /**
       * @desc Set to true to send CAM UT event indication
       */
      modulepar boolean PICS_SEND_BEACON_INDICATION := false;
      
      /**
       * @desc Set to true to send CAM UT event indication
       */
      modulepar boolean PICS_SEND_CAM_INDICATION := false;
      
    } // End of group indications
    
    group generationFrequencies {
    group generationFrequencies {
    
    
        /**
        /**
+12 −0
Original line number Original line Diff line number Diff line
@@ -104,6 +104,18 @@ module ItsRSUsSimulator_TestCases {
                // Nothing to do, just for logging purposes
                // Nothing to do, just for logging purposes
                repeat;
                repeat;
                }*/
                }*/
            /*[] geoNetworkingPort.receive(
                mw_geoNwInd(
                    mw_geoNwPdu(
                        mw_geoNwShbPacketWithNextHeader_cam(
                            ?,
                            ?,
                            e_btpB
            )))) -> value v_gnInd { // Receive a SREM message
                log("*** " & testcasename() & ": DEBUG: Processing CAM ***");
                f_processCam(v_gnInd.msgIn);
                repeat;
                }*/
            [] geoNetworkingPort.receive(mw_geoNwInd(?)) -> value v_gnInd { // Receive a message
            [] geoNetworkingPort.receive(mw_geoNwInd(?)) -> value v_gnInd { // Receive a message
                log("*** " & testcasename() & ": DEBUG: Recieving unsollicited message ***");
                log("*** " & testcasename() & ": DEBUG: Recieving unsollicited message ***");
                // Nothing to do, just for logging purposes
                // Nothing to do, just for logging purposes
Loading