From c2575024a047482d8478f48255ad91e3b8e34785 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Tue, 15 Dec 2020 15:50:28 +0100 Subject: [PATCH] test failure fix for #45. On NS3 < 3.30 there was a constraint on NSS value vs MCS value, which was lifted since. Add an explicit message and bail out before crashing. And use a supported value for the example file, in order not to fail tests. This does not seem to affect tests. --- examples/platforms/wifi_ns3.xml | 2 +- src/surf/network_ns3.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/platforms/wifi_ns3.xml b/examples/platforms/wifi_ns3.xml index b737608dfd..4e633b6e42 100644 --- a/examples/platforms/wifi_ns3.xml +++ b/examples/platforms/wifi_ns3.xml @@ -8,7 +8,7 @@ - + diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 999e63e3e3..21698f75ad 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -91,6 +91,10 @@ static void zoneCreation_cb(simgrid::s4u::NetZone const& zone) { const char* nss = wifizone->get_property("nss"); int mcs_value = mcs ? atoi(mcs) : 3; int nss_value = nss ? atoi(nss) : 1; +#if NS3_MINOR_VERSION < 30 + if(nss_value != 1+(mcs_value/8)) + xbt_die("On NS3 < 3.30, NSS value has to satisfy NSS == 1+(MCS/8) constraint. Bailing out"); +#endif wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "ControlMode", ns3::StringValue("HtMcs0"), "DataMode", ns3::StringValue("HtMcs" + std::to_string(mcs_value))); -- 2.20.1