diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..eafc20d5f3bd63eb38b7b3365f894631fc8168dc --- /dev/null +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn @@ -0,0 +1,297 @@ +module ItsRSUsSimulator_Functions { + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_DataStrings all; + import from LibCommon_VerdictControl all; + import from LibCommon_Sync all; + import from LibCommon_Time all; + + // LibIts + import from ITS_Container language "ASN.1:1997" all; + import from CAM_PDU_Descriptions language "ASN.1:1997" all; + import from DENM_PDU_Descriptions language "ASN.1:1997" all; + + // LibItsCommon + import from LibItsCommon_Functions all; + + // LibItsBtp + import from LibItsBtp_TypesAndValues all; + import from LibItsBtp_Templates all; + + // LibItsDenm + import from LibItsDenm_Templates all; + + // LibItsGeoNetworking + import from LibItsGeoNetworking_TestSystem all; + import from LibItsGeoNetworking_Functions all; + import from LibItsGeoNetworking_Templates all; + import from LibItsGeoNetworking_TypesAndValues all; + import from LibItsGeoNetworking_Pixits all; + + // AtsRSUsSimulator + import from ItsRSUsSimulator_TypesAndValues all; + import from ItsRSUsSimulator_TestSystem all; + import from ItsRSUsSimulator_Templates all; + import from ItsRSUsSimulator_Pics all; + import from ItsRSUsSimulator_Pixits all; + + group geoConfigurationFunctions { + + /** + * @desc This configuration features: + * - one ITS node (IUT) + * - two ITS nodes (nodeA, nodeB) + * - Area1 which only includes NodeB and IUT + * - Area2 which only includes NodeB + * NodeB being close to the area center + */ + function f_cf01Up() runs on ItsRSUsSimulator { + + // Local variables + var template (value) DenmParmContainers v_denmParmContainers; + var DENMs v_denms := {}; + var integer v_counter; + + // Map + map(self:acPort, system:acPort); + map(self:utPort, system:utPort); + map(self:geoNetworkingPort, system:geoNetworkingPort); + + // Connect + f_connect4SelfOrClientSync(); + activate(a_cf01Down()); + + // Initialise secured mode + f_initialiseSecuredMode(); + + //Initialze the IUT + f_initialState(); + + // Initialisations + vc_longPosVectorRsu := PICS_RSU_PARAMS[PX_RSU_ID - 1].longPosVector; + // TODO MAPEM + // TODO IVIM + // Build the list of the DENM events + for (v_counter := 0; v_counter < lengthof(PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1]); v_counter := v_counter + 1) { + v_denmParmContainers := m_denmParmContainers( + PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID, + f_getDenmSequenceNumber(), + PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].eventPosition, + PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].causeCodeType, + PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].eventHistory + ); + v_denms[v_counter] := valueof( + m_denmPdu( + m_denm( + v_denmParmContainers.managementContainer, + v_denmParmContainers.situationContainer, + v_denmParmContainers.locationContainer + ))); + } // End of 'for' loop + // Build the messages value list for this RSU + vc_rsuMessagesValueList[PX_RSU_ID - 1] := valueof( + m_rsuProfile( + valueof( + m_camParm( + PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID, + m_rsuPosition( + vc_longPosVectorRsu.latitude, + vc_longPosVectorRsu.longitude + ), + PICS_RSU_PARAMS[PX_RSU_ID - 1].pathHistory + ) + ), + v_denms + )); + if (PICS_RSU_PARAMS[PX_RSU_ID - 1].geoShape == e_geoCircle) { + vc_geoArea := f_computeCircularArea(vc_longPosVectorRsu, PICS_RSU_PARAMS[PX_RSU_ID - 1].geoParms.radius); + } else { + log("*** " & testcasename() & ": INCONC: Wrong PICS_RSU_GEOAREA_FORM event initialisation ***"); + setverdict(inconc); + stop; + } + // Sanity checks + if (not isbound(vc_rsuMessagesValueList[PX_RSU_ID - 1])) { + log("*** " & testcasename() & ": INCONC: Wrong profiles initialisation ***"); + setverdict(inconc); + stop; + } else if (not isbound(vc_rsuMessagesValueList[PX_RSU_ID - 1].cam)) { + log("*** " & testcasename() & ": INCONC: Wrong CAM initialisation ***"); + setverdict(inconc); + stop; + } else if (not isbound(vc_rsuMessagesValueList[PX_RSU_ID - 1].denms)) { + log("*** " & testcasename() & ": INCONC: Wrong DENM initialisation ***"); + setverdict(inconc); + stop; + } + + } // End of function f_cf01Up + + function f_cf01Down() runs on ItsRSUsSimulator { + + f_uninitialiseSecuredMode(); + + // Unmap + unmap(self:acPort, system:acPort); + unmap(self:utPort, system:utPort); + unmap(self:geoNetworkingPort, system:geoNetworkingPort); + + // Disconnect + f_disconnect4SelfOrClientSync(); + + } // End of function f_cf01Down + + } // End of group geoConfigurationFunctions + + function f_prepare_cam( + out template (value) Payload p_payload + ) runs on ItsRSUsSimulator { + + vc_rsuMessagesValueList[PX_RSU_ID - 1].cam.cam.generationDeltaTime := f_getCurrentTime() mod 65536; // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime + p_payload := valueof( + f_adaptPayload( + bit2oct( + encvalue( + valueof( + vc_rsuMessagesValueList[PX_RSU_ID - 1].cam + ))), + PICS_CAM_BTP_DESTINATION_PORT, + PICS_CAM_BTP_SOURCE_PORT + ) + ); + } + + function f_prepare_denm( + out template (value) Payload p_payload + ) runs on ItsRSUsSimulator { + + vc_rsuMessagesValueList[PX_RSU_ID - 1].denms[vc_denmEventCounter].denm.management.referenceTime := f_getCurrentTime(); + p_payload := valueof( + f_adaptPayload( + bit2oct( + encvalue( + valueof(vc_rsuMessagesValueList[PX_RSU_ID - 1].denms[vc_denmEventCounter] + ))), + PICS_DENM_BTP_DESTINATION_PORT, + PICS_DENM_BTP_SOURCE_PORT + ) + ); + vc_denmEventCounter := (vc_denmEventCounter + 1) mod lengthof(vc_rsuMessagesValueList[PX_RSU_ID - 1].denms); + } + + function f_prepare_mapem( + out template (value) Payload p_payload + ) runs on ItsRSUsSimulator { + + p_payload := {}; // FIXME To be developped + + } + + function f_prepare_spatem( + out template (value) Payload p_payload + ) runs on ItsRSUsSimulator { + + p_payload := {}; // FIXME To be developped + + } + + function f_prepare_ivim( + out template (value) Payload p_payload + ) runs on ItsRSUsSimulator { + + p_payload := {}; // FIXME To be developped + + } + + function f_adaptPayload( + in template (value) octetstring p_finalPayload, + in template (value) BtpPortId p_destPort, + in template (value) BtpPortId p_srcPort := 0 + ) return template (value) Payload { + var template (value) Payload v_payload; + + if(PX_GN_UPPER_LAYER == e_any) { + v_payload := { decodedPayload := omit, rawPayload := p_finalPayload}; + return v_payload; + } + + if(PX_GN_UPPER_LAYER == e_ipv6) { + log("*** " & testcasename() & ": INCONC: Layer IPv6 not supported ***"); + setverdict(inconc); + stop; + } + + if(PX_GN_UPPER_LAYER == e_btpA) { + v_payload := { + decodedPayload := { + btpPacket := m_btpAWithPorts( + p_destPort, + p_srcPort, + { + decodedPayload := omit, + rawPayload := p_finalPayload + } + ) + }, + rawPayload := ''O + }; + return v_payload; + } + + if(PX_GN_UPPER_LAYER == e_btpB) { + v_payload := { + decodedPayload := { + btpPacket := m_btpBWithPorts( + p_destPort, + p_srcPort, + { + decodedPayload := omit, + rawPayload := p_finalPayload + } + ) + }, + rawPayload := ''O + }; + return v_payload; + } + + return v_payload; + } + + function f_send( + in template (value) Payload p_payload + ) runs on ItsRSUsSimulator { + var GeoNetworkingPdu v_geoNetworkingPdu; + + v_geoNetworkingPdu := valueof(m_geoNwPdu( // FIXME Use PIXIT parameter to get a fully configurable template + m_geoNwBroadcastPacket_payload( // TODO modifes 'template (value) GnNonSecuredPacket m_geoNwBroadcastPacket' to set the field + vc_longPosVectorRsu, + f_incLocalSeqNumber(), + f_geoArea2GeoBroadcastArea(vc_geoArea), + -, + -, + valueof(p_payload) + ), + m_defaultLifetime, + c_defaultHopLimit + )); + f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_geoNetworkingPdu))); + } + + function f_processSrem( + in GeoNetworkingPdu p_geoNetworkingPdu + ) runs on ItsRSUsSimulator { + // TODO Process message, and send SSEM + } + + function f_incLocalSeqNumber() runs on ItsRSUsSimulator return UInt16 { + vc_localSeqNumber := (vc_localSeqNumber + 1) mod 65536; + return vc_localSeqNumber; + } + + function f_getDenmSequenceNumber() runs on ItsRSUsSimulator return SequenceNumber { + return 12345; // FIXME To be refined + } + +} // End of module ItsRSUsSimulator_Functions \ No newline at end of file diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pics.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pics.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..113222329b9aa47fc4519097951a6adb74bc3d87 --- /dev/null +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pics.ttcn @@ -0,0 +1,317 @@ +module ItsRSUsSimulator_Pics { + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + + // LibIts + import from ITS_Container language "ASN.1:1997" all; + import from CAM_PDU_Descriptions language "ASN.1:1997" all; + import from DENM_PDU_Descriptions language "ASN.1:1997" all; + import from MAPEM_PDU_Descriptions language "ASN.1:1997" all; + import from SPATEM_PDU_Descriptions language "ASN.1:1997" all; + import from IVIM_PDU_Descriptions language "ASN.1:1997" all; + import from SREM_PDU_Descriptions language "ASN.1:1997" all; + import from SSEM_PDU_Descriptions language "ASN.1:1997" all; + + // LibItsBtp + import from LibItsBtp_TypesAndValues all; + import from LibItsBtp_Templates all; + + // LibItsGeoNetworking + import from LibItsGeoNetworking_TypesAndValues all; + + // ItsRSUsSimulator + import from ItsRSUsSimulator_TypesAndValues all; + + group rsuParameters { + + group rsu1 { + + /** + * @desc RSU GN address + */ + modulepar GN_Address PICS_RSU_GN_ADDRESS_RSU1 := { + typeOfAddress := e_manual, + stationType := e_roadSideUnit, + stationCountryCode := 33, + mid := 'AABBCCDDEEFF'O + } // End of PICS_RSU_GN_ADDRESS_RSU1 + + modulepar RsuParm PICS_RSU_1 := { + gnAddress := PICS_RSU_GN_ADDRESS_RSU1, + longPosVector := { + gnAddr := PICS_RSU_GN_ADDRESS_RSU1, + timestamp_ := 0, + latitude := 435517392, + longitude := 103018217, + pai := '0'B, + speed := 0, + heading := 0 + }, + stationID := 1111111, + geoShape := e_geoCircle, + geoParms := { + radius := 500 + }, + pathHistory := PICS_RSU_PATH_HISTORY_RSU1 + } // End of PICS_RSU_1 + + /** + * @desc Path history to approch the RSU + */ + modulepar PathHistory PICS_RSU_PATH_HISTORY_RSU1 := {}; + + } // End of group rsu1 + + group rsu2 { + // TODO To be done + } // End of group rsu1 + + modulepar RsuParmList PICS_RSU_PARAMS := { + PICS_RSU_1 + // TODO To be done + } // End of PICS_RSU_PARAMS + + } // End of group rsuParameters + + group camParams { + + group camCommonParams { + + modulepar BtpPortId PICS_CAM_BTP_DESTINATION_PORT := 2001; + + modulepar BtpPortId PICS_CAM_BTP_SOURCE_PORT := 0; + + } // End of group camCommonParams + + } // End of group rsuParameters + + group denmEvents { + + group denmCommonParams { + + modulepar BtpPortId PICS_DENM_BTP_DESTINATION_PORT := 2002; + + modulepar BtpPortId PICS_DENM_BTP_SOURCE_PORT := 0; + + modulepar PosConfidenceEllipse PICS_DENM_POSITION_CONFIDENCE_ELLIPSE := { + semiMajorConfidence := SemiAxisLength_oneCentimeter_, + semiMinorConfidence := SemiAxisLength_oneCentimeter_, + semiMajorOrientation := HeadingValue_wgs84North_ + } // End of PICS_DENM_POSITION_CONFIDENCE_ELLIPSE + + modulepar Altitude PICS_DENM_ALTITUDE := { + altitudeValue := AltitudeValue_referenceEllipsoidSurface_, + altitudeConfidence := unavailable + } // End of PICS_DENM_ALTITUDE + + } // End of group denmCommonParams + + group denmZone1 { + + modulepar DenmParm PICS_Z1_D1_EP := { + eventPosition := { + latitude := 435517392, + longitude := 103018217, + positionConfidenceEllipse := PICS_DENM_POSITION_CONFIDENCE_ELLIPSE, + altitude := PICS_DENM_ALTITUDE + }, + causeCodeType := CauseCodeType_roadworks_, + eventHistory := { + { + eventPosition := { + deltaLatitude := -3295, + deltaLongitude := -2347, + deltaAltitude := 0 + }, + eventDeltaTime := omit, + informationQuality := 0 + }, + { + eventPosition := { + deltaLatitude := -719, + deltaLongitude := -7055, + deltaAltitude := 0 + }, + eventDeltaTime := omit, + informationQuality := 0 + } + } + } // End of PICS_Z1_D1_EP + + modulepar DenmParm PICS_Z1_D2_EP := { + eventPosition := { + latitude := 435517392, + longitude := 103018217, + positionConfidenceEllipse := PICS_DENM_POSITION_CONFIDENCE_ELLIPSE, + altitude := PICS_DENM_ALTITUDE + }, + causeCodeType := CauseCodeType_roadworks_, + eventHistory := { + { + eventPosition := { + deltaLatitude := -3295, + deltaLongitude := -2347, + deltaAltitude := 0 + }, + eventDeltaTime := omit, + informationQuality := 0 + }, + { + eventPosition := { + deltaLatitude := -719, + deltaLongitude := -7055, + deltaAltitude := 0 + }, + eventDeltaTime := omit, + informationQuality := 0 + } + } + } // End of PICS_Z1_D2_EP + + modulepar DenmParm PICS_Z1_D3_EP := { + eventPosition := { + latitude := 435517392, + longitude := 103018217, + positionConfidenceEllipse := PICS_DENM_POSITION_CONFIDENCE_ELLIPSE, + altitude := PICS_DENM_ALTITUDE + }, + causeCodeType := CauseCodeType_roadworks_, + eventHistory := { + { + eventPosition := { + deltaLatitude := -3295, + deltaLongitude := -2347, + deltaAltitude := 0 + }, + eventDeltaTime := omit, + informationQuality := 0 + }, + { + eventPosition := { + deltaLatitude := -719, + deltaLongitude := -7055, + deltaAltitude := 0 + }, + eventDeltaTime := omit, + informationQuality := 0 + } + } + } // End of PICS_Z1_D3_EP + + } // End of group denmZone1 + + group denmZone2 { + // TODO To be done + } // End of group denmZone2 + + group denmUseCase1 { + + modulepar DenmEventsParmsUseCase PICS_DENM_PARMS_UC1_RWW := { + PICS_Z1_D1_EP, + PICS_Z1_D2_EP, + PICS_Z1_D3_EP + } // End of PICS_DENM_PARMS_UC1_RWW + + } // End of group denmUseCase1 + + group denmUseCase2 { + // TODO To be done + } // End of group denmUseCase2 + + modulepar DenmEventsParmsUseCaseRsu PICS_DENM_EVENTS_RSU := { + PICS_DENM_PARMS_UC1_RWW + } // End of PICS_DENM_EVENTS_RSU + + } // End of group denmEvents + + group mapemEvents { + + group mapemCommonParams { + + modulepar BtpPortId PICS_MAPEM_BTP_DESTINATION_PORT := 2003; + + modulepar BtpPortId PICS_MAPEM_BTP_SOURCE_PORT := 0; + + modulepar BtpPortId PICS_SPATEM_BTP_DESTINATION_PORT := 2004; + + modulepar BtpPortId PICS_SPATEM_BTP_SOURCE_PORT := 0; + + } // End of group mapemCommonParams + + group mapemZone1 { + // TODO To be done + } // End of group mapemZone1 + + group mapemZone2 { + // TODO To be done + } // End of group mapemZone2 + + group mapemUseCase1 { + // TODO To be done + } // End of group mapemUseCase1 + + group mapemUseCase2 { + // TODO To be done + } // End of group mapemUseCase2 + + } // End of group mapemEvents + + group ivimEvents { + + group ivimCommonParams { + + modulepar BtpPortId PICS_IVIM_BTP_DESTINATION_PORT := 2005; + + modulepar BtpPortId PICS_IVIM_BTP_SOURCE_PORT := 0; + + } // End of group ivimCommonParams + + group ivimZone1 { + // TODO To be done + } // End of group ivimZone1 + + group ivimZone2 { + // TODO To be done + } // End of group ivimZone2 + + group ivimUseCase1 { + // TODO To be done + } // End of group ivimUseCase1 + + group ivimUseCase2 { + // TODO To be done + } // End of group ivimUseCase2 + + } // End of group ivimEvents + + group generationFrequencies { + + /** + * @desc CAM frequency timer + */ + modulepar float PICS_CAM_FREQUENY := 0.1; + + /** + * @desc DENM frequency timer + */ + modulepar float PICS_DENM_FREQUENY := 0.1; + + /** + * @desc MAPEM frequency timer + */ + modulepar float PICS_MAPEM_FREQUENY := 0.1; + + /** + * @desc SPATEMM frequency timer + */ + modulepar float PICS_SPATEM_FREQUENY := 5.0; + + /** + * @desc IVIM frequency timer + */ + modulepar float PICS_IVIM_FREQUENY := 1.0; + + } // End of group generationFrequencies + +} // End of module ItsRSUsSimulator_Pics \ No newline at end of file diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pixits.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pixits.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..eaf19854dafd8fb49eaa937bb8d94d46028f344c --- /dev/null +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pixits.ttcn @@ -0,0 +1,27 @@ +/** + * + * @desc + * + * @reference https://wiki.plugtests.net/wiki/ITS-CMS5/index.php/Base_Specs_and_Test_Specs + */ + +module ItsRSUsSimulator_Pixits { + + // LibIts + import from ITS_Container language "ASN.1:1997" all; + import from CAM_PDU_Descriptions language "ASN.1:1997" all; + import from DENM_PDU_Descriptions language "ASN.1:1997" all; + + // LibItsCommon + import from LibItsCommon_Functions all; + + // AtsRSUsSimulator + import from ItsRSUsSimulator_TypesAndValues all; + import from ItsRSUsSimulator_Pics all; + + modulepar integer PX_ETSI_USE_CASE_ID := 0; + + modulepar integer PX_RSU_ID := 1; // 1: D1, 2: D2 + + +} // End of module ItsRSUsSimulator_Pixits diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Templates.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Templates.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..5451a24d99686172ad9ec811ce64c1645c644c8f --- /dev/null +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Templates.ttcn @@ -0,0 +1,227 @@ +module ItsRSUsSimulator_Templates { + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + + // LibIts + import from ITS_Container language "ASN.1:1997" all; + import from CAM_PDU_Descriptions language "ASN.1:1997" all; + import from DENM_PDU_Descriptions language "ASN.1:1997" all; + import from MAPEM_PDU_Descriptions language "ASN.1:1997" all; + import from SPATEM_PDU_Descriptions language "ASN.1:1997" all; + import from IVIM_PDU_Descriptions language "ASN.1:1997" all; + import from SREM_PDU_Descriptions language "ASN.1:1997" all; + import from SSEM_PDU_Descriptions language "ASN.1:1997" all; + import from DSRC language "ASN.1:1997" all; + + // LibItsCommon + import from LibItsCommon_Functions all; + + // LibItsGeoNetworking + import from LibItsGeoNetworking_TestSystem all; + import from LibItsGeoNetworking_Functions all; + import from LibItsGeoNetworking_Templates all; + import from LibItsGeoNetworking_TypesAndValues all; + + // LibItsBtp + import from LibItsBtp_TypesAndValues all; + import from LibItsBtp_Templates all; + + // LibItsCam + import from LibItsCam_Templates all; + + // LibItsDenm + import from LibItsDenm_Templates all; + + // LibItsMapemSpatem + import from LibItsMapemSpatem_Templates all; + + // LibItsIvim + import from LibItsIvim_Templates all; + + // AtsRSUsSimulator + import from ItsRSUsSimulator_TypesAndValues all; + import from ItsRSUsSimulator_Functions all; + import from ItsRSUsSimulator_Pics all; + + template (omit) RsuMessagesValue m_rsuProfile( + in template (value) CAM p_cam, + in template (value) DENMs p_denms, + in template (omit) MAPEM p_mapem := omit, + in template (omit) SPATEM p_spatem := omit, + in template (omit) IVIM p_ivim := omit + ) := { + cam := p_cam, + denms := p_denms, + mapem := p_mapem, + spatem := p_spatem, + ivim := p_ivim + } // End of template RsuMessagesValue + + group geoNetworkingTemplates { + + template (value) GnNonSecuredPacket m_geoNwBroadcastPacket_payload( + in template (value) LongPosVector p_sourceLongPosVec, + in template (value) UInt16 p_seqNumber, + in template (value) GeoBroadcastArea p_broadcastArea, + in template (value) UInt8 p_hopLimit := c_defaultHopLimit, + in template (value) TrafficClass p_trafficClass := m_trafficClass, + in template (value) Payload p_payload + ) modifies m_geoNwBroadcastPacket := { + payload := p_payload + } // End of template m_geoNwBroadcastPacket_payload + + /** + * @desc Receive template for GeoNetworking Unicast Packet + * @param p_destinationShortPosVec Short position vector of destination + * @param p_seqNumber Sequence number of GeoUnicast packet + * @param p_nextHeader Id of next header + */ + template (present) GnNonSecuredPacket mw_geoNwUnicastPacketWithNextHeader_srem( + in template (present) ShortPosVector p_destinationShortPosVec, + in template (present) UInt16 p_seqNumber, + in template (present) NextHeader p_nextHeader + ) modifies mw_geoNwUnicastPacketWithNextHeader := { + payload := { + decodedPayload := { + btpPacket := mw_btpB( + ?, // TODO PICS_SREM_BTP_DESTINATION_PORT + ?, + ? + ) + }, + rawPayload := ? + } + } + + + } // End of group geoNetworkingTemplates + + group positionTemplates { + + /** + * @desc The test system reference position. + */ + template (value) ReferencePosition m_rsuPosition( + in template (value) Latitude p_latitude, + in template (value) Longitude p_longitude + ) := { + latitude := f_integer2Latitude(valueof(p_latitude)), + longitude := f_integer2Latitude(valueof(p_longitude)), + positionConfidenceEllipse := { + semiMajorConfidence := SemiAxisLength_oneCentimeter_, + semiMinorConfidence := SemiAxisLength_oneCentimeter_, + semiMajorOrientation := HeadingValue_wgs84North_ + }, + altitude := { + altitudeValue := AltitudeValue_referenceEllipsoidSurface_, + altitudeConfidence := unavailable + } + } // End of template m_rsuPosition + + } // End of group positionTemplates + + group camTemplates { + + template (value) CAM m_camParm( + in template (value) StationID p_stationID, + in template (value) ReferencePosition p_rsuPosition, + in template (value) PathHistory p_pathHistory + ) := { + header := { + protocolVersion := ItsPduHeader_protocolVersion_currentVersion_, + messageID := ItsPduHeader_messageID_cam_, + stationID := p_stationID + }, + cam := { + generationDeltaTime := 0, // Dynamic parameter + camParameters := { + basicContainer := { + stationType := StationType_roadSideUnit_, + referencePosition := p_rsuPosition + }, + highFrequencyContainer := { + rsuContainerHighFrequency := { + protectedCommunicationZonesRSU := omit/*{ + }*/ + } + }, + lowFrequencyContainer := omit,/*{ + basicVehicleContainerLowFrequency := { + vehicleRole := roadOperator, + exteriorLights := ExteriorLights_daytimeRunningLightsOn_, + pathHistory := p_pathHistory + } + }*/ + specialVehicleContainer := omit + } + } + } // End of template m_camParm + + } // End of group camTemplates + + group mapemTemplates { + + } // End of group mapemTemplates + + group ivimTemplates { + + } // End of group ivimTemplates + + group denmTemplates { + + template (value) DenmParmContainers m_denmParmContainers( + in template (value) StationID p_originatingStationID, + in template (value) SequenceNumber p_sequenceNumber, + in template (value) ReferencePosition p_eventPosition, + in template (value) CauseCodeType p_causeCodeType, + in template (value) EventHistory p_eventHistory, + in template (value) ValidityDuration p_validityDuration := 86400, + in template (value) RelevanceDistance p_relevanceDistance := lessThan200m + ) := { + managementContainer := { + actionID := { + originatingStationID := p_originatingStationID, + sequenceNumber := p_sequenceNumber + }, + detectionTime := f_getCurrentTime(), + referenceTime := 0, + termination := omit, + eventPosition := p_eventPosition, + relevanceDistance := p_relevanceDistance, + relevanceTrafficDirection := omit, + validityDuration := p_validityDuration, + transmissionInterval := omit, + stationType := StationType_roadSideUnit_ + }, // End of field managementContainer + situationContainer := { + informationQuality := 0, + eventType := { + causeCode := p_causeCodeType, + subCauseCode := 0 + }, + linkedCause := omit, + eventHistory := p_eventHistory + }, // End of field situationContainer + locationContainer := { + eventSpeed := omit, + eventPositionHeading := omit, + traces := { + { + { + pathPosition := { + deltaLatitude := 0, + deltaLongitude := 0, + deltaAltitude := 0 + }, + pathDeltaTime := 0 + } + } + }, + roadType := omit + } // End of field locationContainer + + } // End of template m_denmParm + } // End of group denmTemplates + +} // End of module ItsRSUsSimulator_Templates \ No newline at end of file diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestCases.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestCases.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..19a1a770bcf3db70a673bef21a254722e8297e6f --- /dev/null +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestCases.ttcn @@ -0,0 +1,106 @@ +module ItsRSUsSimulator_TestCases { + + // Libcommon + import from LibCommon_VerdictControl all; + import from LibCommon_Sync all; + + // LibItsCommon + import from LibItsCommon_Functions all; + + // LibItsGeoNetworking + import from LibItsGeoNetworking_TestSystem all; + import from LibItsGeoNetworking_TypesAndValues all; + import from LibItsGeoNetworking_Templates all; + + // LibItsDenm + import from LibItsDenm_Templates all; + + // AtsRSUsSimulator + import from ItsRSUsSimulator_TypesAndValues all; + import from ItsRSUsSimulator_Templates all; + import from ItsRSUsSimulator_TestSystem all; + import from ItsRSUsSimulator_Functions all; + import from ItsRSUsSimulator_Pixits all; + + testcase TC_RSUSIMU_BV_01() runs on ItsRSUsSimulator system ItsGeoNetworkingSystem { + // Local variables + var template (value) Payload v_payload; + var GeoNetworkingInd v_gnInd; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + tc_cam.start; + tc_denm.start; + if (isbound(vc_rsuMessagesValueList[PX_RSU_ID - 1].mapem)) { + tc_mapem.start; + } + if (isbound(vc_rsuMessagesValueList[PX_RSU_ID - 1].spatem)) { + tc_spatem.start; + } + if (isbound(vc_rsuMessagesValueList[PX_RSU_ID - 1].ivim)) { + tc_ivim.start; + } + alt { + [] geoNetworkingPort.receive( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader_srem( + ?, + ?, + e_btpB + )))) -> value v_gnInd { // Receive a SREM message + f_processSrem(v_gnInd.msgIn); + repeat; + } + [] geoNetworkingPort.receive(mw_geoNwInd(?)) -> value v_gnInd { // Receive a message + // Nothing to do, just for logging purposes + repeat; + } + [] tc_cam.timeout { + f_prepare_cam(v_payload); + f_send(v_payload); + tc_cam.start; + repeat; + } + [] tc_denm.timeout { + f_prepare_denm(v_payload); + f_send(v_payload); + tc_cam.start; + repeat; + } +// [] tc_spatem.timeout { +// f_prepare_spatem(v_payload); +// f_send(v_payload); +// tc_spatem.start; +// repeat; +// } +// [] tc_mapem.timeout { +// f_prepare_spatem(v_payload); +// f_send(v_payload); +// tc_mapem.start; +// repeat; +// } +// [] tc_ivim.timeout { +// f_prepare_ivim(v_payload); +// f_send(v_payload); +// tc_ivim.start; +// repeat; +// } + } // End of 'alt' statement + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + + // Postamble + f_cf01Down(); + + } + +} // End of module ItsRSUsSimulator_TestCases \ No newline at end of file diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestControl.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestControl.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..066f7933717f3ae5eadadb57726af40a7f2922ca --- /dev/null +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestControl.ttcn @@ -0,0 +1,12 @@ +module ItsRSUsSimulator_TestControl { + + // AtsRSUsSimulator + import from ItsRSUsSimulator_TestCases all; + + control { + + execute(TC_RSUSIMU_BV_01()); + + } + +} // End of module ItsRSUsSimulator_TestControl \ No newline at end of file diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestSystem.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestSystem.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..053771e519c7e58d26f50285fff0606b90fbf6f5 --- /dev/null +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestSystem.ttcn @@ -0,0 +1,29 @@ +module ItsRSUsSimulator_TestSystem { + + // LibItsGeoNetworking + import from LibItsGeoNetworking_TestSystem all; + import from LibItsGeoNetworking_TypesAndValues all; + + // AtsRSUsSimulator + import from ItsRSUsSimulator_TypesAndValues all; + import from ItsRSUsSimulator_Pics all; + + /** + * @desc Test component for ITS Network and Transport layer + */ + type component ItsRSUsSimulator extends ItsGeoNetworking { + + var LongPosVector vc_longPosVectorRsu := {}; + var GeoArea vc_geoArea := {}; + var RsuMessagesValueList vc_rsuMessagesValueList := {}; + var integer vc_denmEventCounter := 0; + + timer tc_cam := PICS_CAM_FREQUENY; + timer tc_denm := PICS_DENM_FREQUENY; + timer tc_mapem := PICS_MAPEM_FREQUENY; + timer tc_spatem := PICS_SPATEM_FREQUENY; + timer tc_ivim := PICS_IVIM_FREQUENY; + + } // End of component ItsRSUsSimulator + +} // End of module ItsRSUsSimulator_TestSystem \ No newline at end of file diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TypesAndValues.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TypesAndValues.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..307431e4f8429e8439d28352a0d5bb33e78b7b8e --- /dev/null +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TypesAndValues.ttcn @@ -0,0 +1,151 @@ +module ItsRSUsSimulator_TypesAndValues { + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + + // LibIts + import from ITS_Container language "ASN.1:1997" all; + import from CAM_PDU_Descriptions language "ASN.1:1997" all; + import from DENM_PDU_Descriptions language "ASN.1:1997" all; + import from MAPEM_PDU_Descriptions language "ASN.1:1997" all; + import from SPATEM_PDU_Descriptions language "ASN.1:1997" all; + import from IVIM_PDU_Descriptions language "ASN.1:1997" all; + import from SREM_PDU_Descriptions language "ASN.1:1997" all; + import from SSEM_PDU_Descriptions language "ASN.1:1997" all; + + // LibItsGeoNetworking + import from LibItsGeoNetworking_TypesAndValues all; + + /** + * @desc Data structures used to build IS messages & event for a specific RSU + */ + group rsiSimulatordataStructures { + + /** + * @desc This is the list of DENM events hosted by a single RSU + */ + type record of DENM DENMs; + + /** + * @desc Defines the list of messages to be sent by a single RSU + * @member cam CAM message that a RSU shall send + * @member denms List of DENM events that a RSU shall send + */ + type record RsuMessagesValue { + CAM cam, + DENMs denms, + MAPEM mapem optional, + SPATEM spatem optional, + IVIM ivim optional + } // End of type RsuMessagesValue + + /** + * @desc List of the RSU settings (for future usage (e.g. dynamic change of the RSU ID) + */ + type record of RsuMessagesValue RsuMessagesValueList; + + type record DenmParmContainers { + ManagementContainer managementContainer, + SituationContainer situationContainer, + LocationContainer locationContainer + } // End of type DenmParm + + /** + * @desc This is the list of DENM dynamic parameters for the different events hosted by a single RSU + */ + type record of DenmParmContainers DenmParmContainersList; + + /** + * @desc This is the list of DENM dynamic parameters for the different events hosted for all RSUs + */ + type record of DenmParmContainersList DenmParmContainersListRsu; + + } // End of group rsiSimulatordataStructures + + /** + * @desc Data structures used to set up IS messages & event according to the track configuration + */ + group picsDataStructures { + + /** + * @desc CAM setup + */ + group camDataStructures { + + /** + * @desc Describe the parameter for each CAM event + */ + type record RsuParm { + GN_Address gnAddress, + LongPosVector longPosVector, + StationID stationID, + GeoShape geoShape, + union { + UInt16 radius + } geoParms, + PathHistory pathHistory + } // End of type CamParm + + /** + * + * @desc List of CAM parms per RSU + *
+             *     vc_longPosVectorRsu := PICS_RSU_PARAMS[PX_RSU_ID - 1].longPosVector;
+             * 
+ */ + type record of RsuParm RsuParmList; + + } // End of group camDataStructures + + /** + * @desc MAPEM setup + */ + group mapemDataStructures { + // TODO To be done + } // End of group mapemDataStructures + + /** + * @desc IVIM setup + */ + group ivimDataStructures { + // TODO To be done + } // End of group ivimDataStructures + + /** + * @desc DENM setup + */ + group denmDataStructures { + + /** + * @desc Describe the parameter for each DENM event + */ + type record DenmParm { + ReferencePosition eventPosition, + CauseCodeType causeCodeType, + EventHistory eventHistory + } // End of type DenmParm + + /** + * @desc List of DENM events per use case + * @see + *
+             *     v_denmParm := PICS_DENM_PARMS_UC1_RWW[vc_eventId];
+             *     vc_eventId := (vc_eventId + 1) mod lengthof(PICS_DENM_PARMS_UC1_RWW)
+             * 
+ */ + type record of DenmParm DenmEventsParmsUseCase; + + /** + * @desc List of DENM events per use case and per RSUs + *
+             *     v_denmParm := PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][PX_ETSI_USE_CASE_ID][vc_eventId];
+             *     vc_eventId := (vc_eventId + 1) mod lengthof(PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][PX_ETSI_USE_CASE_ID])
+             * 
+ */ + type record of DenmEventsParmsUseCase DenmEventsParmsUseCaseRsu; + + } // End of group denmDataStructures + + } // End of group picsDataStructures + +} // End of module ItsRSUsSimulator_TypesAndValues \ No newline at end of file