Skip to content

Commit

Permalink
networking: fix SecurityEntity setup and add smoke test
Browse files Browse the repository at this point in the history
Change-Id: I05b8ff255e883baa3512917571715878b4031d45
  • Loading branch information
riebl committed Nov 22, 2018
1 parent d0a3ccb commit 699a9a5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions scenarios/artery/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_opp_run(example CONFIG omnetpp.ini)
add_opp_test(example SUFFIX inet CONFIG inet SIMTIME_LIMIT 20s)
add_opp_test(example SUFFIX security CONFIG inet_security SIMTIME_LIMIT 20s)
add_opp_test(example SUFFIX inet-mixed-vehicles CONFIG inet_multiple_vehicle_types SIMTIME_LIMIT 20s)
add_opp_test(example SUFFIX inet-rsu CONFIG inet_rsu SIMTIME_LIMIT 20s)
add_opp_test(example SUFFIX veins CONFIG veins SIMTIME_LIMIT 20s)
Expand Down
6 changes: 6 additions & 0 deletions scenarios/artery/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ network = artery.inet.World
*.node[*].middleware.services = xmldoc("services.xml")


[Config inet_security]
extends = inet

*.node[*].vanetza.security.typename = "SecurityEntity"


[Config inet_multiple_vehicle_types]
extends = inet
# see above for configuration of mapper's random number generator (rng)
Expand Down
5 changes: 5 additions & 0 deletions src/artery/networking/Router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ void Router::initialize(int stage)
mRouter.reset(new vanetza::geonet::Router(*runtime, mMIB));
mRouter->set_address(generateAddress()); // VehicleMiddleware determines station type at first stage

// register security entity if available
if (mSecurityEntity) {
mRouter->set_security_entity(mSecurityEntity);
}

// pass BTP-B messages to middleware which will dispatch them to its services
using vanetza::geonet::UpperProtocol;
mRouter->set_transport_handler(UpperProtocol::BTP_B, &mMiddleware->getTransportInterface());
Expand Down
7 changes: 6 additions & 1 deletion src/artery/networking/SecurityEntity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ namespace artery

Define_Module(SecurityEntity)

int SecurityEntity::numInitStages() const
{
return 2;
}

void SecurityEntity::initialize(int stage)
{
if (stage == 0) {
mRuntime = inet::findModuleFromPar<Runtime>(par("runtimeModule"), this);
mPositionProvider = inet::findModuleFromPar<vanetza::PositionProvider>(par("positionModule"), this);

} else if (stage == 1){
mBackend = createBackend(par("CryptoBackend"));
mCertificateProvider = createCertificateProvider(par("CertificateProvider"));
mCertificateValidator = createCertificateValidator(par("CertificateValidator"));
Expand Down
1 change: 1 addition & 0 deletions src/artery/networking/SecurityEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SecurityEntity : public omnetpp::cSimpleModule, public vanetza::security::
{
public:
// cSimpleModule
int numInitStages() const override;
void initialize(int stage) override;
void finish() override;

Expand Down
2 changes: 1 addition & 1 deletion src/artery/networking/SecurityEntity.ned
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package artery.networking;

simple SecurityEntity
simple SecurityEntity like ISecurityEntity
{
parameters:
@class(SecurityEntity);
Expand Down

0 comments on commit 699a9a5

Please sign in to comment.