Commit 8513dd85 authored by YannGarcia's avatar YannGarcia

Enhance AtsRSUsSimulator

parent e71dfbb9
......@@ -34,11 +34,13 @@ public:
void sendMsg(const ItsRSUsSimulator__TestSystem::CfInitialize&, params& params);
void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnResults& send_par, params& params);
void sendMsg(const LibItsGeoNetworking__TypesAndValues::UtGnEventInd& send_par, params& params);
void sendMsg(const LibItsCam__TypesAndValues::UtCamResults& send_par, params& params);
void sendMsg(const LibItsCam__TypesAndValues::UtCamEventInd& send_par, params& params);
void sendMsg(const LibItsDenm__TypesAndValues::UtDenmResults& send_par, params& params);
void sendMsg(const LibItsDenm__TypesAndValues::UtDenmEventInd& send_par, params& params);
void sendMsg(const LibItsPki__TypesAndValues::UtPkiResults& send_par, params& params);
virtual void send_data(OCTETSTRING& data, params& params);
virtual void receive_data(OCTETSTRING& data, params& params);
......@@ -47,6 +49,10 @@ private:
int process_ut_cam_changespeed_data(const OCTETSTRING& data, params& params);
int process_ut_cam_changecurvature_data(const OCTETSTRING& data, params& params);
int process_ut_cam_changeheading_data(const OCTETSTRING& data, params& params);
int process_ut_cam_setvehiclerole_data(const OCTETSTRING& data, params& params);
int process_ut_denm_trigger(const OCTETSTRING& data, params& params);
int process_ut_denm_update(const OCTETSTRING& data, params& params);
int process_ut_denm_termination(const OCTETSTRING& data, params& params);
int process_ut_geonetworking_trigger(const OCTETSTRING& data, params& params);
int process_ut_pki_trigger(const OCTETSTRING& data, params& params);
......
......@@ -124,6 +124,15 @@ namespace ItsRSUsSimulator__TestSystem {
loggers::get_instance().set_stop_time(_time_key, duration);
}
void ConfigRsuSimulatorPort::outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnEventInd& send_par) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
static_cast<ConfigRsuSimulatorLayer *>(_layer)->sendMsg(send_par, _layer_params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void ConfigRsuSimulatorPort::outgoing_send(const LibItsCam__TypesAndValues::UtCamEventInd& send_par) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par);
......@@ -142,6 +151,16 @@ namespace ItsRSUsSimulator__TestSystem {
loggers::get_instance().set_stop_time(_time_key, duration);
}
void ConfigRsuSimulatorPort::outgoing_send(const LibItsDenm__TypesAndValues::UtDenmEventInd& send_par) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par);
float duration;
loggers::get_instance().set_start_time(_time_key);
static_cast<ConfigRsuSimulatorLayer *>(_layer)->sendMsg(send_par, _layer_params);
loggers::get_instance().set_stop_time(_time_key, duration);
}
void ConfigRsuSimulatorPort::outgoing_send(const LibItsPki__TypesAndValues::UtPkiResults& send_par) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::outgoing_send: payload=", send_par);
......@@ -190,7 +209,7 @@ namespace ItsRSUsSimulator__TestSystem {
incoming_message(p_ind);
}
void ConfigRsuSimulatorPort::receiveMsg (const LibItsCam__TypesAndValues::UtCamTrigger& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind);
// Sanity check
......@@ -210,7 +229,37 @@ namespace ItsRSUsSimulator__TestSystem {
incoming_message(p_ind);
}
void ConfigRsuSimulatorPort::receiveMsg (const LibItsDenm__TypesAndValues::UtDenmTrigger& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
}
void ConfigRsuSimulatorPort::receiveMsg (const LibItsDenm__TypesAndValues::UtDenmUpdate& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
}
void ConfigRsuSimulatorPort::receiveMsg (const LibItsDenm__TypesAndValues::UtDenmTermination& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind);
// Sanity check
if (!p_ind.is_bound()) {
return;
}
incoming_message(p_ind);
}
void ConfigRsuSimulatorPort::receiveMsg (const LibItsPki__TypesAndValues::UtPkiInitialize& p_ind, const params& p_params) {
loggers::get_instance().log_msg(">>> ConfigRsuSimulatorPort::receive_msg: ", p_ind);
// Sanity check
......
......@@ -24,6 +24,9 @@ namespace ItsRSUsSimulator__TestSystem {
void receiveMsg (const LibItsCam__TypesAndValues::UtCamInitialize& p_ind, const params& p_params);
void receiveMsg (const LibItsCam__TypesAndValues::UtCamTrigger& p_ind, const params& p_params);
void receiveMsg (const LibItsDenm__TypesAndValues::UtDenmInitialize& p_ind, const params& p_params);
void receiveMsg (const LibItsDenm__TypesAndValues::UtDenmTrigger& p_ind, const params& p_params);
void receiveMsg (const LibItsDenm__TypesAndValues::UtDenmUpdate& p_ind, const params& p_params);
void receiveMsg (const LibItsDenm__TypesAndValues::UtDenmTermination& p_ind, const params& p_params);
void receiveMsg (const LibItsPki__TypesAndValues::UtPkiInitialize& p_ind, const params& p_params);
void receiveMsg (const LibItsPki__TypesAndValues::UtPkiTrigger& p_ind, const params& p_params);
......@@ -58,9 +61,11 @@ namespace ItsRSUsSimulator__TestSystem {
void outgoing_send(const CfInitialize& send_par);
void outgoing_send(const BOOLEAN& send_par);
void outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnResults& send_par);
void outgoing_send(const LibItsGeoNetworking__TypesAndValues::UtGnEventInd& send_par);
void outgoing_send(const LibItsCam__TypesAndValues::UtCamResults& send_par);
void outgoing_send(const LibItsCam__TypesAndValues::UtCamEventInd& send_par);
void outgoing_send(const LibItsDenm__TypesAndValues::UtDenmResults& send_par);
void outgoing_send(const LibItsDenm__TypesAndValues::UtDenmEventInd& send_par);
void outgoing_send(const LibItsPki__TypesAndValues::UtPkiResults& send_par);
}; // End of class ConfigRsuSimulatorPort
......
......@@ -377,7 +377,7 @@ int geonetworking_codec::decode_extendedHeader(LibItsGeoNetworking__TypesAndValu
} else if (_dc.get_header_sub_type() == LibItsGeoNetworking__TypesAndValues::HeaderSubTypeTSB::e__singleHop) {
decode_(u.shbHeader(), *u.shbHeader().get_descriptor(), decoding_buffer);
} else {
TTCN_error("geonetworking_codec::decode_headerTST: TSB subtype not processed");
TTCN_error("geonetworking_codec::decode_headerTST: TSB subtype not processed, See ETSI EN 302 636-4-1 Clause 9.7.4 Encoding of the HT and HST fields");
}
break;
case LibItsGeoNetworking__TypesAndValues::HeaderType::e__geoBroadcast:
......@@ -395,7 +395,7 @@ int geonetworking_codec::decode_extendedHeader(LibItsGeoNetworking__TypesAndValu
} else if (_dc.get_header_sub_type() == LibItsGeoNetworking__TypesAndValues::HeaderSubTypeLs::e__lsReply) {
decode_(u.lsReplyHeader(), *u.lsReplyHeader().get_descriptor(), decoding_buffer);
} else {
TTCN_error("geonetworking_codec::decode_headerTST: Location service subtype not processed");
TTCN_error("geonetworking_codec::decode_headerTST: Location service subtype not processed, See ETSI EN 302 636-4-1 Clause 9.7.4 Encoding of the HT and HST fields");
}
break;
case LibItsGeoNetworking__TypesAndValues::HeaderType::e__any:
......@@ -408,11 +408,11 @@ int geonetworking_codec::decode_extendedHeader(LibItsGeoNetworking__TypesAndValu
} else if (_dc.get_header_sub_type() == LibItsGeoNetworking__TypesAndValues::HeaderSubTypeSa::e__saEos) {
decode_(u.saEosHeader(), *u.saEosHeader().get_descriptor(), decoding_buffer);
} else {
TTCN_error("geonetworking_codec::decode_headerTST: Service Advertisement subtype not processed");
TTCN_error("geonetworking_codec::decode_headerTST: Service Advertisement subtype not processed, See ETSI EN 302 636-4-1 Clause 9.7.4 Encoding of the HT and HST fields");
}
break;
default:
TTCN_error("geonetworking_codec::decode_headerTST: Not processed, _dc.header_type = %d - _dc.header_sub_type = %d", _dc.get_header_type(), _dc.get_header_sub_type());
TTCN_error("geonetworking_codec::decode_headerTST: Not processed, _dc.header_type = %d - _dc.header_sub_type = %d, See ETSI EN 302 636-4-1 Clause 9.7.4 Encoding of the HT and HST fields", _dc.get_header_type(), _dc.get_header_sub_type());
} // End of 'switch' statement
return 0;
......
......@@ -213,6 +213,10 @@ void geonetworking_layer::receive_data(OCTETSTRING& data, params& params) {
///////////////////
// FIXME Check what to do with this!
if (*static_cast<const unsigned char*>(secured_data) == 0x02) { // This is the old Security version format, discard it
loggers::get_instance().warning("geonetworking_layer::receive_data: Security error");
if (_enable_security_checks) {
return;
}
INTEGER n; int r;
TTCN_Buffer buf(secured_data);
loggers::get_instance().warning("geonetworking_layer::receive_data: Old security format, parse manualy");
......@@ -237,7 +241,7 @@ void geonetworking_layer::receive_data(OCTETSTRING& data, params& params) {
}
unsecured_gn_payload = OCTETSTRING(n, buf.get_read_data());
}
}else{
} else {
///////////////////
if (security_services::get_instance().verify_and_extract_gn_payload(secured_data, _enable_security_checks, ieee_1609dot2_data, unsecured_gn_payload, params) != 0) {
loggers::get_instance().warning("geonetworking_layer::receive_data: Security error");
......@@ -342,7 +346,7 @@ void geonetworking_layer::receive_data(OCTETSTRING& data, params& params) {
// By default incoming beacons are filtered by the test adapter
if (htst.ischosen(LibItsGeoNetworking__TypesAndValues::HeaderTST::ALT_beaconHdr)) {
loggers::get_instance().log_msg("geonetworking_layer::receive_data: Pass beaconing filtering", sopv->gnAddr().mid());
loggers::get_instance().log_msg("geonetworking_layer::receive_data: Pass beaconing filtering: ", sopv->gnAddr().mid());
if (_pass_beacon_table.empty()) { // Discard beacon
loggers::get_instance().log("geonetworking_layer::receive_data: Pass beaconing table empty, discard it");
return;
......@@ -616,7 +620,7 @@ void geonetworking_layer::fill_beacon(const OCTETSTRING& p_ll_address, const INT
0,
h,
TrafficClass(
SCF(SCF::e__scfDisabled),
SCF(SCF::e__scfEnabled),
ChannelOffload(ChannelOffload::e__choffDisabled),
0
),
......
......@@ -160,8 +160,8 @@ int security_services::process_ieee_1609_dot2_signed_data(const IEEE1609dot2::Si
unsigned long long gt = ((INTEGER&)(*v.get_opt_value())).get_long_long_val();
// Get current time timestamp
unsigned long long us = base_time::get_instance().get_its_current_time_us(); // in microsecond
loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: generation time check %ld / %ld, delta = %f", header_info.generationTime(), us, abs((double)gt - (double)us));
if (abs((double)gt - (double)us) >= 500000.0) { // TODO Use a params for generation_time_epsilon, 500ms differences
loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: generation time check %ld / %ld, delta = %f", gt, us, abs((double)gt - (double)us));
if (abs((double)gt - (double)us) >= 5000000.0) { // TODO Use a params for generation_time_epsilon, 5s differences
loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Invalid generation time, discard it");
if (p_verify) {
return -1;
......@@ -169,9 +169,22 @@ int security_services::process_ieee_1609_dot2_signed_data(const IEEE1609dot2::Si
}
}
// Check p2pcdLearningRequest keys if present
if (header_info.p2pcdLearningRequest().is_present()) {
loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: p2pcdLearningRequest not supported yet");
// TODO Not supported by C-ITS Protocol
}
// Check missingCrlIdentifier keys if present
if (header_info.missingCrlIdentifier().is_present()) {
loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: missingCrlIdentifier not supported yet");
// TODO Not supported by C-ITS Protocol
}
// Check encryption keys if present
if (header_info.encryptionKey().is_present()) {
// TODO
loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: encryptionKey not supported yet");
// TODO Not supported by C-ITS Protocol
}
// Check request certificate
......@@ -188,7 +201,7 @@ int security_services::process_ieee_1609_dot2_signed_data(const IEEE1609dot2::Si
// Check requested certificate
if (header_info.requestedCertificate().is_present()) {
loggers::get_instance().error("security_services::process_ieee_1609_dot2_signed_data: requestedCertificate not supported yet");
// TODO
// TODO Not supported by C-ITS Protocol
}
// Check and extract unsecured payload
......@@ -248,14 +261,16 @@ int security_services::process_ieee_1609_dot2_signed_data(const IEEE1609dot2::Si
// Check in the cache
if (_security_cache.get()->get_certificate_id(p_signed_data.signer().digest(), certificate_id) == -1) {
// Unknown certificate, request it
loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: Unknown certificate, request it");
const OCTETSTRING& os = p_signed_data.signer().digest();
_unknown_certificate = OCTETSTRING(3, static_cast<const unsigned char*>(os) + os.lengthof() - 3);
loggers::get_instance().warning("security_services::process_ieee_1609_dot2_signed_data: Unknown certificate, request it");
loggers::get_instance().log_msg("security_services::process_ieee_1609_dot2_signed_data: HashedId3: ", _unknown_certificate);
}
// Reset certificate timer
loggers::get_instance().log("security_services::process_ieee_1609_dot2_signed_data: Set Certificate re-transmission flag and reset timer");
_last_generation_time = 0;
return -1;
}
} else if (p_signed_data.signer().ischosen(IEEE1609dot2::SignerIdentifier::ALT_certificate) && (p_signed_data.signer().certificate().size_of() != 0)) {
// Extract the certificates
......@@ -509,7 +524,7 @@ int security_services::sign_payload(const OCTETSTRING& p_unsecured_gn_payload, O
header_info.generationTime() = OPTIONAL<INTEGER>(i);
loggers::get_instance().log("security_services::sign_payload: Final HeaderInfo timestamp: %ld", us);
// Check if a certificate shall be requested
if (_unknown_certificate.lengthof() == 3) { // HashedId3
if (_unknown_certificate.lengthof() == 3) { // HashedId3 of a requested certificate
IEEE1609dot2BaseTypes::SequenceOfHashedId3 s;
s[0] = _unknown_certificate;
header_info.inlineP2pcdRequest() = OPTIONAL<IEEE1609dot2BaseTypes::SequenceOfHashedId3>(s);
......@@ -583,7 +598,7 @@ int security_services::sign_payload(const OCTETSTRING& p_unsecured_gn_payload, O
loggers::get_instance().warning("security_services::sign_payload: Failed to encode Ieee1609Dot2Data");
return -1;
}
return 0;
}
......@@ -1120,6 +1135,9 @@ int security_services::extract_verification_keys(const IEEE1609dot2::Certificate
p_public_key_y = ecc.public_key_y();
p_public_comp_key_mode = INTEGER(1);
} else if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().ischosen(IEEE1609dot2BaseTypes::EccP256CurvePoint::ALT_uncompressedP256)) {
security_ecc ecc(ec_elliptic_curves::nist_p_256, p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().x(), p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().y());
p_public_comp_key = ecc.public_key_compressed();
p_public_comp_key_mode = INTEGER((int)ecc.public_key_compressed_mode());
p_public_key_x = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().x();
p_public_key_y = p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ecdsaNistP256().uncompressedP256().y();
} else {
......
......@@ -11,7 +11,7 @@
#include <sys/ioctl.h>
#include <net/if.h>
udp_layer::udp_layer(const std::string & p_type, const std::string & param) : layer(p_type), PORT(p_type.c_str()), _params(), _saddr{0}, _daddr{0}, _fd(-1), _time_key("udp_layer::Handle_Fd_Event_Readable") {
udp_layer::udp_layer(const std::string & p_type, const std::string & param) : layer(p_type), PORT(p_type.c_str()), _params(), _saddr{0}, _daddr{0}, _reuse_incoming_source_adddress(false), _fd(-1), _time_key("udp_layer::Handle_Fd_Event_Readable") {
loggers::get_instance().log(">>> udp_layer::udp_layer: %s, %s", to_string().c_str(), param.c_str());
// Setup parameters
......@@ -32,6 +32,11 @@ udp_layer::udp_layer(const std::string & p_type, const std::string & param) : la
if (it == _params.cend()) {
_params.insert(std::pair<std::string, std::string>(std::string("dst_port"), "12345"));
}
it = _params.find("reuse_incoming_source_adddress");
if (it != _params.cend()) {
_reuse_incoming_source_adddress = (boolean)(it->second.compare("1") == 0);
}
loggers::get_instance().log("udp_layer::udp_layer: _reuse_incoming_source_adddress: %d", _reuse_incoming_source_adddress);
// Initialize the socket
_saddr.sin_family = AF_INET;
......@@ -119,6 +124,10 @@ void udp_layer::Handle_Fd_Event_Readable(int fd) {
return;
} else {
std::copy((unsigned char*)buffer, (unsigned char*)((unsigned char*)buffer + result), std::back_inserter(acc));
if (_reuse_incoming_source_adddress) { // Reuse the incoming address/port for sending
memcpy((void*)&_daddr, (const void*)&from, sizeof(struct sockaddr_in));
loggers::get_instance().log("udp_layer::Handle_Fd_Event_Readable: New _daddr: %s:%d", ::inet_ntoa(_daddr.sin_addr), ntohs(_daddr.sin_port));
}
}
params.insert(std::pair<std::string, std::string>(std::string("timestamp"), std::to_string(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count())));
......
......@@ -28,6 +28,8 @@ class udp_layer : public layer, public PORT {
params _params; //! Layer parameters
struct sockaddr_in _saddr; //! Source socket address description
struct sockaddr_in _daddr; //! Destination socket address description
boolean _reuse_incoming_source_adddress;
//! This flag must be set to true if the UpperTester/UDP layer must act as an IUT, not as a Test System. Default value: Test System
int _fd; // Socket file descriptor
std::string _time_key; //! \todo
......
......@@ -70,7 +70,7 @@ system.httpAtPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/
#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV
# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (not containing an item of type PsidSsp)
#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_01
ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_01
# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (containing opaque[0] (version) indicating other value than 1)
#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_02
# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (containing opaque[1] (value) indicating "Enrolment Request" (bit 1) set to 0)
......@@ -172,7 +172,7 @@ system.httpAtPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/
#ItsPki_TestCases.TC_SECPKI_AA_AUTH_RCV_16_BI
# Check that the AA sends AuthorizationValidationRequest after receiving of the AuthorizationRequest
ItsPki_TestCases.TC_SECPKI_AA_AUTHVAL_01_BV
#ItsPki_TestCases.TC_SECPKI_AA_AUTHVAL_01_BV
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
......
......@@ -5,14 +5,17 @@ LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {
typeOfAddress := e_manual,
stationType := e_passengerCar, #e_unknown
stationCountryCode := 0,
mid := '4C5E0C14D2EA'O
mid := '4C5E0C14D2EA'O #'00000000000B'O
}
# GeoNetwoking only, no facility layer
# GeoNetwoking only, no facility layer, used for AtsGenNetworking and AtsSecurity with other profile
#LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_any
# With facility layer
LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB
# Use this certificate if the RSU simulator act as IUT
LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT"
# Indicate which RSU to simulate
ItsRSUsSimulator_Pixits.PX_RSU_ID := 1;
# Indicate which Use Case to simulate
......@@ -24,7 +27,7 @@ ItsRSUsSimulator_Pixits.PX_RSU_ID := 1;
# UC7 (CAM only): PX_ETSI_USE_CASE_ID := 7
# UC8 (EVCSN only): PX_ETSI_USE_CASE_ID := 8
# UC9 (CAM only): PX_ETSI_USE_CASE_ID := 9
ItsRSUsSimulator_Pixits.PX_ETSI_USE_CASE_ID := 1 # 7 PX_RSU_ID := 8 ==> LCWW
ItsRSUsSimulator_Pixits.PX_ETSI_USE_CASE_ID := 6 # 7 PX_RSU_ID := 8 ==> LCWW
# 1 PX_RSU_ID := 1 ==> RWW
# 2 PX_RSU_ID := 1 ==> RHW
# Indicate which zone to simulate
......@@ -33,8 +36,8 @@ ItsRSUsSimulator_Pixits.PX_ETSI_ZONE_ID := 1
ItsRSUsSimulator_Pixits.PX_DENM_PARAM_UC2 := 1; # ==> RHW (1..5)
ItsRSUsSimulator_Pics.PICS_GENERATE_BEACON := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_CAM := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_DENM := true # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_CAM := true # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_DENM := false # Change also its_aid in geoNetworking port setting
ItsRSUsSimulator_Pics.PICS_GENERATE_IVIM := false
ItsRSUsSimulator_Pics.PICS_GENERATE_MAPEM := false
ItsRSUsSimulator_Pics.PICS_GENERATE_SPATEM := false
......@@ -46,7 +49,9 @@ ItsRSUsSimulator_Pics.PICS_BEACON_FREQUENCY := 1.0
ItsRSUsSimulator_Pics.PICS_CAM_FREQUENCY := 1.0
ItsRSUsSimulator_Pics.PICS_DENM_FREQUENCY := 1.0
ItsRSUsSimulator_Pics.PICS_SEND_CAM_INDICATION := false
ItsRSUsSimulator_Pics.PICS_SEND_BEACON_INDICATION := false
ItsRSUsSimulator_Pics.PICS_SEND_CAM_INDICATION := true
ItsRSUsSimulator_Pics.PICS_SEND_DENM_INDICATION := true
# Enable Security support
LibItsGeoNetworking_Pics.PICS_GN_SECURITY := true
......@@ -73,10 +78,10 @@ LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA"
# 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).
LogFile := "../logs/%e.%h-%r.%s"
#FileMask := LOG_ALL | USER | DEBUG | MATCHING
#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
FileMask := LOG_ALL | USER | DEBUG | MATCHING
ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
LogSourceInfo := Stack
LogEntityName:= Yes
LogEventTypes:= Yes
......@@ -151,21 +156,24 @@ LogEventTypes:= Yes
# save_mode : Set to 1 to save sent packet, 0 otherwise
# Single GeoNetworking component port
# its_aid=36: CAM
# its_aid=37: DENM
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=37,secured_mode=0,encrypted_mode=0,certificate=CERT_IUT_A_AT,peer_certifIcate=CERT_TS_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/ETH(mac_src=080027128a53)/PCAP(mac_src=080027128a53,nic=eth0,filter=and ether proto 0x8947)"
# its_aid=36: CAM
# its_aid=37: DENM
# its_aid=141: GeoMet
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=37,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/ETH(mac_src=080027128a53)/PCAP(mac_src=080027128a53,nic=eth1,filter=and ether proto 0x8947)"
# Commsignia
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=37,secured_mode=0,encrypted_mode=0,certificate=CERT_IUT_A_AT,peer_certifIcate=CERT_TS_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/COMMSIGNIA(xport_mode=LTE-V2X,mac_src=080027F44E7D,interface_id=2,target_host=192.168.0.54)/UDP(dst_ip=192.168.0.54,src_port=9091,dst_port=7946)"
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=37,secured_mode=0,encrypted_mode=0,certificate=CERT_IUT_A_AT,peer_certificate=CERT_TS_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/COMMSIGNIA(xport_mode=LTE-V2X,mac_src=080027F44E7D,interface_id=2,target_host=192.168.0.54)/UDP(dst_ip=192.168.0.54,src_port=9091,dst_port=7946)"
# Qualcom
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=36747486,longitude=-4556772,distanceA=25,distanceB=25,its_aid=37,secured_mode=1,encrypted_mode=0,certificate=CERT_MICROSEC_AT_01,peer_certifIcate=CERT_TS_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/QUALCOMM/UDP(dst_ip=10.200.1.113,src_port=9091,dst_port=4041)"
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=36747486,longitude=-4556772,distanceA=25,distanceB=25,its_aid=37,secured_mode=1,encrypted_mode=0,certificate=CERT_MICROSEC_AT_01,peer_certificate=CERT_TS_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/QUALCOMM/UDP(dst_ip=10.200.1.113,src_port=9091,dst_port=4041)"
#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.42.252,port=80)"
system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.252,port=80)"
# Config port based on UDP
#system.cfPort.params := "CF(ut=pki)/UDP(dst_ip=192.168.42.252,src_port=12345)"
system.cfPort.params := "CF(ut=cam)/UDP(dst_ip=192.168.1.252,src_port=12345)"
#system.cfPort.params := "CF(ut=cam)/UDP(dst_ip=192.168.1.39,src_port=12345)"
#system.cfPort.params := "CF(ut=cam)/UDP(dst_ip=172.28.4.87,src_port=12345,reuse_incoming_source_adddress=1)"
system.cfPort.params := "CF(ut=denm)/UDP(dst_ip=172.28.4.87,src_port=12345,reuse_incoming_source_adddress=1)"
#system.cfPort.params := "CF(ut=gn)/UDP(dst_ip=172.28.4.87,src_port=12345,reuse_incoming_source_adddress=1)"
[EXECUTE]
ItsRSUsSimulator_TestCases.TC_RSUSIMU_BV_01
......
......@@ -5765,6 +5765,11 @@ module ItsRSUsSimulator_Pics {
*/
modulepar boolean PICS_SEND_CAM_INDICATION := false;
/**
* @desc Set to true to send DENM UT event indication
*/
modulepar boolean PICS_SEND_DENM_INDICATION := false;
} // End of group indications
group generationFrequencies {
......
......@@ -47,7 +47,7 @@ module ItsRSUsSimulator_Templates {
import from ItsRSUsSimulator_Pics all;
template (omit) RsuMessagesValue m_rsuProfile(
in template (omit) octetstring p_beacon := omit,
in template (omit) GeoNetworkingPdu p_beacon := omit,
in template (omit) CAM p_cam := omit,
in template (omit) DENMs p_denms := omit,
in template (omit) MAPEM p_mapem := omit,
......@@ -67,7 +67,37 @@ module ItsRSUsSimulator_Templates {
} // End of template RsuMessagesValue
group geoNetworkingTemplates {
/**
* @desc Send template for long position vector with specific GN_Address
* @param p_gnAddress GN_Address to be contained in the long position vector
*/
template (value) LongPosVector m_longPosVector(
in template (value) GN_Address p_gnAddress,
in UInt32 p_timestamp_,
in Int32 p_latitude := 0,
in Int32 p_longitude := 0,
in Bit1 p_pai := '0'B,
in Int15 p_speed := 0,
in UInt16 p_heading := 0
) := {
gnAddr := p_gnAddress,
timestamp_ := p_timestamp_,
latitude := p_latitude,
longitude := p_longitude,
pai := p_pai,
speed := p_speed,
heading := p_heading
}
template (value) GnNonSecuredPacket m_geoNwBeaconPacket_payload(
in template (value) LongPosVector p_sourceLongPosVec,
in template (value) GnRawPayload p_gnRawPayload
) modifies m_geoNwBeaconPacket := {
payload := p_gnRawPayload
}
template (value) GnNonSecuredPacket m_geoNwBroadcastPacket_payload(
in template (value) LongPosVector p_sourceLongPosVec,
in template (value) UInt16 p_seqNumber,
......@@ -79,6 +109,17 @@ module ItsRSUsSimulator_Templates {
payload := p_payload
} // End of template m_geoNwBroadcastPacket_payload
template (value) GnNonSecuredPacket m_geoNwAnycastPacket_payload(
in template (value) LongPosVector p_sourceLongPosVec,
in template (value) UInt16 p_seqNumber,
in template (value) GeoAnycastArea p_anycastArea,
in template (value) UInt8 p_hopLimit := c_defaultHopLimit,
in template (value) TrafficClass p_trafficClass := m_trafficClass,
in template (value) GnRawPayload p_payload
) modifies m_geoNwAnycastPacket := {
payload := p_payload
} // End of template m_geoNwAnycastPacket_payload
/**
* @desc Send template for GeoNetworking TSB Packet
* @param p_seqNumber Sequence number of TSB packet
......@@ -152,6 +193,19 @@ module ItsRSUsSimulator_Templates {
payload := f_payload_template(PICS_DENM_BTP_DESTINATION_PORT, PICS_DENM_BTP_SOURCE_PORT)
} // End of template mw_geoNwTsbPacketWithNextHeader_denm
/**
* @desc Receive template for GeoNetworking DENM 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_geoNwBroadcastPacketWithNextHeader_denm(
in template (present) LongPosVector p_sourceLongPosVec := ?,
in template (present) UInt16 p_seqNumber := ?
) modifies mw_geoNwBroadcastPacket := {
payload := f_payload_template(PICS_DENM_BTP_DESTINATION_PORT, PICS_DENM_BTP_SOURCE_PORT)
} // End of template mw_geoNwBroadcastPacketWithNextHeader_denm
/**
* @desc Receive template for GeoNetworking CAM Packet
* @param p_destinationShortPosVec Short position vector of destination
......
......@@ -80,42 +80,38 @@ module ItsRSUsSimulator_TestCases {
geoNetworkingPort.clear;
alt {
/*[] geoNetworkingPort.receive(
[PICS_SEND_BEACON_INDICATION == true] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwPdu(
mw_geoNwTsbPacketWithNextHeader_srem(
?,
?,
e_btpB
)))) -> value v_gnInd { // Receive a SREM message
//log("*** " & testcasename() & ": DEBUG: Processing SREM ***");
f_processSrem(v_gnInd.msgIn);
mw_geoNwShbPacket
))) -> value v_gnInd { // Receive a BEACON
log("*** " & testcasename() & ": DEBUG: Processing Beacon ***");
f_processBeacon(v_gnInd.msgIn);
repeat;
}
[] geoNetworkingPort.receive(
}
[PICS_SEND_DENM_INDICATION == true] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwPdu(
mw_geoNwTsbPacketWithNextHeader_denm(
mw_geoNwBroadcastPacketWithNextHeader_denm( //mw_geoNwTsbPacketWithNextHeader_denm(
?,
?,
e_btpB // TODO Refined to exclude RSU StationID
?
)))) -> value v_gnInd { // Receive a DENM message
//log("*** " & testcasename() & ": DEBUG: Processing DENM ***");
// Nothing to do, just for logging purposes
log("*** " & testcasename() & ": DEBUG: Processing DENM ***");
f_processDenm(v_gnInd.msgIn);
repeat;
}*/
/*[] geoNetworkingPort.receive(
}
[PICS_SEND_CAM_INDICATION == true] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwPdu(
mw_geoNwShbPacketWithNextHeader_cam(
?,
?,
e_btpB
)))) -> value v_gnInd { // Receive a SREM message
)))) -> value v_gnInd { // Receive a CAM message
log("*** " & testcasename() & ": DEBUG: Processing CAM ***");
f_processCam(v_gnInd.msgIn);
repeat;
}*/
}
[] geoNetworkingPort.receive(mw_geoNwInd(?)) -> value v_gnInd { // Receive a message
log("*** " & testcasename() & ": DEBUG: Recieving unsollicited message ***");
// Nothing to do, just for logging purposes
......@@ -128,8 +124,7 @@ module ItsRSUsSimulator_TestCases {
}
}
[vc_beacon == true] tc_beacon.timeout {
log("*** " & testcasename() & ": DEBUG: Processing BEACON ***");
f_prepare_beacon(v_payload);
//log("*** " & testcasename() & ": DEBUG: Processing BEACON ***");
f_send(v_payload, PICS_BEACON_ITS_AID);
tc_beacon.start;
repeat;
......
......@@ -138,7 +138,7 @@ module ItsRSUsSimulator_TestSystem {
var integer vc_at_counter := 0;
var SequenceOfAtData vc_at_certificates := {};
} // End of component ItsRSUsSimulator
/**
* @desc Test system component for ITS Network and Transport layer
*/
......@@ -147,44 +147,44 @@ module ItsRSUsSimulator_TestSystem {
port HttpPort httpPort;
port HttpPort httpPort_notif;
}
type record of record {
boolean detected,
ItsRSUsSimulator component_,
integer stationId,
integer detectionCounter
} VehiclesSimulator;
} VehiclesSimulator;
group configRsuSimulatorTypes {
type record CfInitialize {
integer i
} with {
variant "FIELDORDER(msb)"
}
type charstring CfEvent;
type boolean CfResult;
type union CfEventInd {
anytype empty
}
} with {
variant ""
} // End of group configRsuSimulatorTypes
} // End of group configRsuSimulatorTypes
group configRsuSimulatorPort {
/**
* @desc Configuration RSUsimulator port
*/
type port ConfigRsuSimulatorPort message {
out
CfInitialize, CfResult, UtGnResults, UtCamResults, UtDenmResults, UtCamEventInd, UtPkiResults;
in
CfEvent, CfEventInd, UtGnInitialize, UtCamInitialize, UtDenmInitialize, UtGnTrigger, UtCamTrigger, UtPkiInitialize, UtPkiTrigger
out
CfInitialize, CfResult, UtGnResults, UtCamResults, UtDenmResults, UtGnEventInd, UtCamEventInd, UtDenmEventInd, UtPkiResults;
in
CfEvent, CfEventInd, UtGnInitialize, UtCamInitialize, UtDenmInitialize, UtGnTrigger, UtCamTrigger, UtDenmTrigger, UtDenmUpdate, UtDenmTermination, UtPkiInitialize, UtPkiTrigger
} // End of ConfigRsuSimulatorPort
} // End of group configRsuSimulatorPort
......
......@@ -49,14 +49,14 @@ module ItsRSUsSimulator_TypesAndValues {
* @member denms List of DENM events that a RSU shall send
*/
type record RsuMessagesValue {
octetstring beacon optional,
CAM cam optional,
DENMs denms optional,
MAPEM mapem optional,
SPATEMs spatems optional,
IVIM ivim optional,
GeoNetworkingPdu beacon optional,
CAM cam optional,
DENMs denms optional,
MAPEM mapem optional,
SPATEMs spatems optional,
IVIM ivim optional,
// EvcsnPdu evcsn optional,
SSEM ssem optional
SSEM ssem optional
} // End of type RsuMessagesValue
/**
......