diff --git a/src/mesh/helper/mesh-helper.cc b/src/mesh/helper/mesh-helper.cc index b4fded099..5c2bc62e4 100644 --- a/src/mesh/helper/mesh-helper.cc +++ b/src/mesh/helper/mesh-helper.cc @@ -207,5 +207,34 @@ MeshHelper::ResetStats (const ns3::Ptr& device) NS_ASSERT (mp != 0); m_stack->ResetStats (mp); } +int64_t +MeshHelper::AssignStreams (NetDeviceContainer c, int64_t stream) +{ + int64_t currentStream = stream; + Ptr netDevice; + for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i) + { + netDevice = (*i); + Ptr mpd = DynamicCast (netDevice); + Ptr wifi; + Ptr mac; + if (mpd) + { + // To access, we need the underlying WifiNetDevices + std::vector > ifaces = mpd->GetInterfaces (); + for (std::vector >::iterator i = ifaces.begin (); i != ifaces.end (); i++) + { + wifi = DynamicCast (*i); + mac = DynamicCast (wifi->GetMac ()); + if (mac) + { + currentStream += mac->AssignStreams (currentStream); + } + } + } + } + return (currentStream - stream); +} + } // namespace ns3 diff --git a/src/mesh/helper/mesh-helper.h b/src/mesh/helper/mesh-helper.h index 50e0ecfd7..c41926383 100644 --- a/src/mesh/helper/mesh-helper.h +++ b/src/mesh/helper/mesh-helper.h @@ -190,6 +190,19 @@ public: * \brief Reset statistics. */ void ResetStats (const ns3::Ptr&); + /** + * Assign a fixed random variable stream number to the random variables + * used by this model. Return the number of streams (possibly zero) that + * have been assigned. The Install() method of this helper + * should have previously been called by the user. + * + * \param stream first stream index to use + * \param c NetDeviceContainer of the set of devices for which the mesh devices + * should be modified to use a fixed stream + * \return the number of stream indices assigned by this helper + */ + int64_t AssignStreams (NetDeviceContainer c, int64_t stream); + private: /** * \internal diff --git a/src/mesh/model/dot11s/hwmp-protocol-mac.cc b/src/mesh/model/dot11s/hwmp-protocol-mac.cc index a4d140d10..19758fce2 100644 --- a/src/mesh/model/dot11s/hwmp-protocol-mac.cc +++ b/src/mesh/model/dot11s/hwmp-protocol-mac.cc @@ -476,5 +476,12 @@ HwmpProtocolMac::ResetStats () m_stats = Statistics (); } +int64_t +HwmpProtocolMac::AssignStreams (int64_t stream) +{ + return m_protocol->AssignStreams (stream); +} + + } // namespace dot11s } // namespace ns3 diff --git a/src/mesh/model/dot11s/hwmp-protocol-mac.h b/src/mesh/model/dot11s/hwmp-protocol-mac.h index 3cb85f9e8..fb8cbe795 100644 --- a/src/mesh/model/dot11s/hwmp-protocol-mac.h +++ b/src/mesh/model/dot11s/hwmp-protocol-mac.h @@ -53,6 +53,7 @@ public: bool UpdateOutcomingFrame (Ptr packet, WifiMacHeader & header, Mac48Address from, Mac48Address to); /// Update beacon is empty, because HWMP does not know anything about beacons void UpdateBeacon (MeshWifiBeacon & beacon) const {}; + int64_t AssignStreams (int64_t stream); //\} private: diff --git a/src/mesh/model/dot11s/hwmp-protocol.cc b/src/mesh/model/dot11s/hwmp-protocol.cc index c0973abfb..9e6f5ba3c 100644 --- a/src/mesh/model/dot11s/hwmp-protocol.cc +++ b/src/mesh/model/dot11s/hwmp-protocol.cc @@ -29,7 +29,7 @@ #include "ns3/wifi-net-device.h" #include "ns3/mesh-point-device.h" #include "ns3/mesh-wifi-interface-mac.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" #include "airtime-metric.h" #include "ie-dot11s-preq.h" #include "ie-dot11s-prep.h" @@ -192,11 +192,7 @@ HwmpProtocol::HwmpProtocol () : m_rfFlag (false) { NS_LOG_FUNCTION_NOARGS (); - - if (m_isRoot) - { - SetRoot (); - } + m_coefficient = CreateObject (); } HwmpProtocol::~HwmpProtocol () @@ -204,6 +200,16 @@ HwmpProtocol::~HwmpProtocol () NS_LOG_FUNCTION_NOARGS (); } +void +HwmpProtocol::DoStart () +{ + m_coefficient->SetAttribute ("Max", DoubleValue (m_randomStart.GetSeconds ())); + if (m_isRoot) + { + SetRoot (); + } +} + void HwmpProtocol::DoDispose () { @@ -1017,8 +1023,7 @@ HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry) void HwmpProtocol::SetRoot () { - UniformVariable coefficient (0.0, m_randomStart.GetSeconds ()); - Time randomStart = Seconds (coefficient.GetValue ()); + Time randomStart = Seconds (m_coefficient->GetValue ()); m_proactivePreqTimer = Simulator::Schedule (randomStart, &HwmpProtocol::SendProactivePreq, this); NS_LOG_DEBUG ("ROOT IS: " << m_address); m_isRoot = true; @@ -1163,6 +1168,15 @@ HwmpProtocol::ResetStats () plugin->second->ResetStats (); } } + +int64_t +HwmpProtocol::AssignStreams (int64_t stream) +{ + NS_LOG_FUNCTION (this << stream); + m_coefficient->SetStream (stream); + return 1; +} + HwmpProtocol::QueuedPacket::QueuedPacket () : pkt (0), protocol (0), diff --git a/src/mesh/model/dot11s/hwmp-protocol.h b/src/mesh/model/dot11s/hwmp-protocol.h index a234d9e2e..63c2cb9a6 100644 --- a/src/mesh/model/dot11s/hwmp-protocol.h +++ b/src/mesh/model/dot11s/hwmp-protocol.h @@ -32,6 +32,7 @@ namespace ns3 { class MeshPointDevice; class Packet; class Mac48Address; +class UniformRandomVariable; namespace dot11s { class HwmpProtocolMac; class HwmpRtable; @@ -85,9 +86,21 @@ public: ///\brief Statistics: void Report (std::ostream &) const; void ResetStats (); + /** + * Assign a fixed random variable stream number to the random variables + * used by this model. Return the number of streams (possibly zero) that + * have been assigned. + * + * \param stream first stream index to use + * \return the number of stream indices assigned by this model + */ + int64_t AssignStreams (int64_t stream); + private: friend class HwmpProtocolMac; + virtual void DoStart (); + HwmpProtocol& operator= (const HwmpProtocol &); HwmpProtocol (const HwmpProtocol &); @@ -267,6 +280,8 @@ private: bool m_doFlag; bool m_rfFlag; ///\} + /// Random variable for random start time + Ptr m_coefficient; Callback , uint32_t> m_neighboursCallback; }; } // namespace dot11s diff --git a/src/mesh/model/dot11s/peer-management-protocol-mac.cc b/src/mesh/model/dot11s/peer-management-protocol-mac.cc index d3a541703..a5248d37e 100644 --- a/src/mesh/model/dot11s/peer-management-protocol-mac.cc +++ b/src/mesh/model/dot11s/peer-management-protocol-mac.cc @@ -316,6 +316,12 @@ PeerManagementProtocolMac::GetLinkMetric (Mac48Address peerAddress) { return m_parent->GetLinkMetric (peerAddress); } +int64_t +PeerManagementProtocolMac::AssignStreams (int64_t stream) +{ + return m_protocol->AssignStreams (stream); +} + } // namespace dot11s } // namespace ns3 diff --git a/src/mesh/model/dot11s/peer-management-protocol-mac.h b/src/mesh/model/dot11s/peer-management-protocol-mac.h index dbffd5337..194df82c2 100644 --- a/src/mesh/model/dot11s/peer-management-protocol-mac.h +++ b/src/mesh/model/dot11s/peer-management-protocol-mac.h @@ -50,6 +50,7 @@ public: bool Receive (Ptr packet, const WifiMacHeader & header); bool UpdateOutcomingFrame (Ptr packet, WifiMacHeader & header, Mac48Address from, Mac48Address to); void UpdateBeacon (MeshWifiBeacon & beacon) const; + int64_t AssignStreams (int64_t stream); // \} ///\name Statistics // \{ @@ -57,6 +58,7 @@ public: void ResetStats (); uint32_t GetLinkMetric (Mac48Address peerAddress); // \} + private: PeerManagementProtocolMac& operator= (const PeerManagementProtocolMac &); PeerManagementProtocolMac (const PeerManagementProtocolMac &); @@ -118,6 +120,7 @@ private: Statistics (); void Print (std::ostream & os) const; }; + private: struct Statistics m_stats; ///\} diff --git a/src/mesh/model/dot11s/peer-management-protocol.cc b/src/mesh/model/dot11s/peer-management-protocol.cc index 95a447388..fd5a8ba99 100644 --- a/src/mesh/model/dot11s/peer-management-protocol.cc +++ b/src/mesh/model/dot11s/peer-management-protocol.cc @@ -27,7 +27,7 @@ #include "ns3/simulator.h" #include "ns3/assert.h" #include "ns3/log.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" #include "ns3/mesh-wifi-interface-mac.h" #include "ns3/mesh-wifi-interface-mac-plugin.h" #include "ns3/wifi-net-device.h" @@ -85,6 +85,7 @@ PeerManagementProtocol::GetTypeId (void) PeerManagementProtocol::PeerManagementProtocol () : m_lastAssocId (0), m_lastLocalLinkId (1), m_enableBca (true), m_maxBeaconShift (15) { + m_beaconShift = CreateObject (); } PeerManagementProtocol::~PeerManagementProtocol () { @@ -436,14 +437,10 @@ PeerManagementProtocol::CheckBeaconCollisions (uint32_t interface) void PeerManagementProtocol::ShiftOwnBeacon (uint32_t interface) { - // If beacon interval is equal to the neighbor's one and one o more beacons received - // by my neighbor coincide with my beacon - apply random uniformly distributed shift from - // [-m_maxBeaconShift, m_maxBeaconShift] except 0. - UniformVariable beaconShift (-m_maxBeaconShift, m_maxBeaconShift); int shift = 0; do { - shift = (int) beaconShift.GetValue (); + shift = (int) m_beaconShift->GetValue (); } while (shift == 0); // Apply beacon shift parameters: @@ -581,6 +578,24 @@ PeerManagementProtocol::ResetStats () } } +int64_t +PeerManagementProtocol::AssignStreams (int64_t stream) +{ + NS_LOG_FUNCTION (this << stream); + m_beaconShift->SetStream (stream); + return 1; +} + +void +PeerManagementProtocol::DoStart () +{ + // If beacon interval is equal to the neighbor's one and one o more beacons received + // by my neighbor coincide with my beacon - apply random uniformly distributed shift from + // [-m_maxBeaconShift, m_maxBeaconShift] except 0. + m_beaconShift->SetAttribute ("Min", DoubleValue (-m_maxBeaconShift)); + m_beaconShift->SetAttribute ("Max", DoubleValue (m_maxBeaconShift)); +} + void PeerManagementProtocol::SetBeaconCollisionAvoidance (bool enable) { diff --git a/src/mesh/model/dot11s/peer-management-protocol.h b/src/mesh/model/dot11s/peer-management-protocol.h index 094b3c21c..8c5e402c4 100644 --- a/src/mesh/model/dot11s/peer-management-protocol.h +++ b/src/mesh/model/dot11s/peer-management-protocol.h @@ -34,6 +34,7 @@ #include namespace ns3 { class MeshPointDevice; +class UniformRandomVariable; namespace dot11s { class PeerManagementProtocolMac; class PeerLink; @@ -149,7 +150,18 @@ public: ///\brief: Report statistics void Report (std::ostream &) const; void ResetStats (); + /** + * Assign a fixed random variable stream number to the random variables + * used by this model. Return the number of streams (possibly zero) that + * have been assigned. + * + * \param stream first stream index to use + * \return the number of stream indices assigned by this model + */ + int64_t AssignStreams (int64_t stream); + private: + virtual void DoStart (); /** * \name Private structures * \{ @@ -261,6 +273,8 @@ private: }; struct Statistics m_stats; // \} + /// Add randomness to beacon shift + Ptr m_beaconShift; }; } // namespace dot11s diff --git a/src/mesh/model/flame/flame-protocol-mac.h b/src/mesh/model/flame/flame-protocol-mac.h index 8c9d81c93..90b055c55 100644 --- a/src/mesh/model/flame/flame-protocol-mac.h +++ b/src/mesh/model/flame/flame-protocol-mac.h @@ -43,6 +43,8 @@ public: bool UpdateOutcomingFrame (Ptr packet, WifiMacHeader & header, Mac48Address from, Mac48Address to); /// Update beacon is empty, because HWMP does not know anything about beacons void UpdateBeacon (MeshWifiBeacon & beacon) const {}; + /// AssignStreams is empty, because this model doesn't use random variables + int64_t AssignStreams (int64_t stream) { return 0; } //\} uint16_t GetChannelId () const; /// Report statistics diff --git a/src/mesh/model/mesh-wifi-interface-mac-plugin.h b/src/mesh/model/mesh-wifi-interface-mac-plugin.h index f51bb552f..3539c1343 100644 --- a/src/mesh/model/mesh-wifi-interface-mac-plugin.h +++ b/src/mesh/model/mesh-wifi-interface-mac-plugin.h @@ -65,6 +65,16 @@ public: * TODO define when MAC call this */ virtual void UpdateBeacon (MeshWifiBeacon & beacon) const = 0; + /** + * Assign a fixed random variable stream number to the random variables + * used by this model. Return the number of streams (possibly zero) that + * have been assigned. + * + * \param stream first stream index to use + * \return the number of stream indices assigned by this model + */ + virtual int64_t AssignStreams (int64_t stream) = 0; + }; } // namespace ns3 diff --git a/src/mesh/model/mesh-wifi-interface-mac.cc b/src/mesh/model/mesh-wifi-interface-mac.cc index 1f46d3e18..b0ace9736 100644 --- a/src/mesh/model/mesh-wifi-interface-mac.cc +++ b/src/mesh/model/mesh-wifi-interface-mac.cc @@ -28,10 +28,11 @@ #include "ns3/mac-rx-middle.h" #include "ns3/mac-low.h" #include "ns3/dca-txop.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" #include "ns3/simulator.h" #include "ns3/yans-wifi-phy.h" #include "ns3/pointer.h" +#include "ns3/double.h" #include "ns3/trace-source-accessor.h" #include "ns3/qos-tag.h" @@ -79,6 +80,7 @@ MeshWifiInterfaceMac::MeshWifiInterfaceMac () : // Let the lower layers know that we are acting as a mesh node SetTypeOfStation (MESH); + m_coefficient = CreateObject (); } MeshWifiInterfaceMac::~MeshWifiInterfaceMac () { @@ -124,6 +126,38 @@ MeshWifiInterfaceMac::DoDispose () RegularWifiMac::DoDispose (); } +void +MeshWifiInterfaceMac::DoStart () +{ + m_coefficient->SetAttribute ("Max", DoubleValue (m_randomStart.GetSeconds ())); + if (m_beaconEnable) + { + Time randomStart = Seconds (m_coefficient->GetValue ()); + // Now start sending beacons after some random delay (to avoid collisions) + NS_ASSERT (!m_beaconSendEvent.IsRunning ()); + m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this); + m_tbtt = Simulator::Now () + randomStart; + } + else + { + // stop sending beacons + m_beaconSendEvent.Cancel (); + } +} + +int64_t +MeshWifiInterfaceMac::AssignStreams (int64_t stream) +{ + NS_LOG_FUNCTION (this << stream); + int64_t currentStream = stream; + m_coefficient->SetStream (currentStream++); + for (PluginList::const_iterator i = m_plugins.begin (); i < m_plugins.end (); i++) + { + currentStream += (*i)->AssignStreams (currentStream); + } + return (currentStream - stream); +} + //----------------------------------------------------------------------------- // Plugins //----------------------------------------------------------------------------- @@ -329,20 +363,7 @@ void MeshWifiInterfaceMac::SetBeaconGeneration (bool enable) { NS_LOG_FUNCTION (this << enable); - UniformVariable coefficient (0.0, m_randomStart.GetSeconds ()); - if (enable) - { - Time randomStart = Seconds (coefficient.GetValue ()); - // Now start sending beacons after some random delay (to avoid collisions) - NS_ASSERT (!m_beaconSendEvent.IsRunning ()); - m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this); - m_tbtt = Simulator::Now () + randomStart; - } - else - { - // stop sending beacons - m_beaconSendEvent.Cancel (); - } + m_beaconEnable = enable; } bool MeshWifiInterfaceMac::GetBeaconGeneration () const diff --git a/src/mesh/model/mesh-wifi-interface-mac.h b/src/mesh/model/mesh-wifi-interface-mac.h index 248f008d3..77e596623 100644 --- a/src/mesh/model/mesh-wifi-interface-mac.h +++ b/src/mesh/model/mesh-wifi-interface-mac.h @@ -39,6 +39,7 @@ namespace ns3 { class WifiMacHeader; class DcaTxop; +class UniformRandomVariable; /** * \ingroup mesh * @@ -134,6 +135,15 @@ public: void SetBeaconGeneration (bool enable); WifiPhyStandard GetPhyStandard () const; virtual void FinishConfigureStandard (enum WifiPhyStandard standard); + /** + * Assign a fixed random variable stream number to the random variables + * used by this model. Return the number of streams (possibly zero) that + * have been assigned. + * + * \param stream first stream index to use + * \return the number of stream indices assigned by this model + */ + int64_t AssignStreams (int64_t stream); private: /// Frame receive handler void Receive (Ptr packet, WifiMacHeader const *hdr); @@ -151,8 +161,12 @@ private: private: typedef std::vector > PluginList; + virtual void DoStart (); + ///\name Mesh timing intervals // \{ + /// whether beaconing is enabled + bool m_beaconEnable; /// Beaconing interval. Time m_beaconInterval; /// Maximum delay before first beacon @@ -186,6 +200,9 @@ private: // \} /// Current PHY standard: needed to configure metric WifiPhyStandard m_standard; + + /// Add randomness to beacon generation + Ptr m_coefficient; }; } // namespace ns3 diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap index 9d06e7c1e..1761ec571 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap index 115ddb908..23d82eca9 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap index 081d79b29..e54a635f9 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap index f94fe75aa..54c565168 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap index 1c07b009d..92375fd08 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression.cc b/src/mesh/test/dot11s/hwmp-proactive-regression.cc index b98ea3d50..1c44d2b3b 100644 --- a/src/mesh/test/dot11s/hwmp-proactive-regression.cc +++ b/src/mesh/test/dot11s/hwmp-proactive-regression.cc @@ -20,7 +20,8 @@ #include "ns3/mesh-helper.h" #include "ns3/simulator.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" +#include "ns3/rng-seed-manager.h" #include "ns3/mobility-helper.h" #include "ns3/double.h" #include "ns3/uinteger.h" @@ -55,7 +56,8 @@ HwmpProactiveRegressionTest::~HwmpProactiveRegressionTest () void HwmpProactiveRegressionTest::DoRun () { - SeedManager::SetSeed (12345); + RngSeedManager::SetSeed (12345); + RngSeedManager::SetRun (7); CreateNodes (); CreateDevices (); InstallApplications (); @@ -114,6 +116,10 @@ HwmpProactiveRegressionTest::CreateDevices () mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); + // Five nodes, one device per node, 3 streams per mac + int64_t streamsUsed = mesh.AssignStreams (meshDevices, 0); + NS_TEST_EXPECT_MSG_EQ (streamsUsed, (3*5), "Stream assignment unexpected value"); + // 3. setup TCP/IP InternetStackHelper internetStack; internetStack.Install (*m_nodes); diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap index 8cd494873..eb87c31c1 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap index 2a1064460..fcdb52227 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap index 9cbb4daa6..0904156bd 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap index 8ba4772ae..d509ad2b0 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap index 0ad29faee..4e87ebf8f 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap index f5e33ee77..485495037 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression.cc b/src/mesh/test/dot11s/hwmp-reactive-regression.cc index 1c6ced3ac..ad2d014f7 100644 --- a/src/mesh/test/dot11s/hwmp-reactive-regression.cc +++ b/src/mesh/test/dot11s/hwmp-reactive-regression.cc @@ -20,7 +20,8 @@ #include "ns3/mesh-helper.h" #include "ns3/simulator.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" +#include "ns3/rng-seed-manager.h" #include "ns3/mobility-helper.h" #include "ns3/double.h" #include "ns3/uinteger.h" @@ -51,7 +52,8 @@ HwmpReactiveRegressionTest::~HwmpReactiveRegressionTest () void HwmpReactiveRegressionTest::DoRun () { - SeedManager::SetSeed (12345); + RngSeedManager::SetSeed (12345); + RngSeedManager::SetRun (7); CreateNodes (); CreateDevices (); InstallApplications (); @@ -111,6 +113,10 @@ HwmpReactiveRegressionTest::CreateDevices () mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); + // Six nodes, one device per node, 3 streams per mac + int64_t streamsUsed = mesh.AssignStreams (meshDevices, 0); + NS_TEST_EXPECT_MSG_EQ (streamsUsed, (6*3), "Stream assignment unexpected value"); + // 3. setup TCP/IP InternetStackHelper internetStack; internetStack.Install (*m_nodes); diff --git a/src/mesh/test/dot11s/hwmp-simplest-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-simplest-regression-test-0-1.pcap index 1952060f6..6287d979e 100644 Binary files a/src/mesh/test/dot11s/hwmp-simplest-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-simplest-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-simplest-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-simplest-regression-test-1-1.pcap index 994774f52..08adc5c94 100644 Binary files a/src/mesh/test/dot11s/hwmp-simplest-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-simplest-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-simplest-regression.cc b/src/mesh/test/dot11s/hwmp-simplest-regression.cc index 59c6c9fe5..166c53fde 100644 --- a/src/mesh/test/dot11s/hwmp-simplest-regression.cc +++ b/src/mesh/test/dot11s/hwmp-simplest-regression.cc @@ -20,7 +20,8 @@ #include "ns3/mesh-helper.h" #include "ns3/simulator.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" +#include "ns3/rng-seed-manager.h" #include "ns3/mobility-helper.h" #include "ns3/double.h" #include "ns3/uinteger.h" @@ -54,7 +55,8 @@ HwmpSimplestRegressionTest::~HwmpSimplestRegressionTest () void HwmpSimplestRegressionTest::DoRun () { - SeedManager::SetSeed (12345); + RngSeedManager::SetSeed (12345); + RngSeedManager::SetRun (7); CreateNodes (); CreateDevices (); InstallApplications (); @@ -123,6 +125,10 @@ HwmpSimplestRegressionTest::CreateDevices () mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); + // Two nodes, one device per node, three streams per device + int64_t streamsUsed = mesh.AssignStreams (meshDevices, 0); + NS_TEST_EXPECT_MSG_EQ (streamsUsed, (2*3), "Stream assignment unexpected value"); + // 3. setup TCP/IP InternetStackHelper internetStack; internetStack.Install (*m_nodes); diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap index 2d4172ba6..f0a7e31ba 100644 Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap index 045cc0da5..5493318f5 100644 Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap index d8313fa77..deb3d25e7 100644 Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap index 6ccffceb9..f9c992c6c 100644 Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc index b7f32f562..1ef53f375 100644 --- a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc +++ b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc @@ -20,7 +20,8 @@ #include "ns3/mesh-helper.h" #include "ns3/simulator.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" +#include "ns3/rng-seed-manager.h" #include "ns3/mobility-helper.h" #include "ns3/double.h" #include "ns3/uinteger.h" @@ -54,7 +55,8 @@ HwmpDoRfRegressionTest::~HwmpDoRfRegressionTest () void HwmpDoRfRegressionTest::DoRun () { - SeedManager::SetSeed (12345); + RngSeedManager::SetSeed (12345); + RngSeedManager::SetRun (7); CreateNodes (); CreateDevices (); InstallApplications (); @@ -130,6 +132,9 @@ HwmpDoRfRegressionTest::CreateDevices () mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); + // Four nodes, one device per node, three streams per mac + int64_t streamsUsed = mesh.AssignStreams (meshDevices, 0); + NS_TEST_EXPECT_MSG_EQ (streamsUsed, (4*3), "Stream assignment unexpected value"); // 3. setup TCP/IP InternetStackHelper internetStack; internetStack.Install (*m_nodes); diff --git a/src/mesh/test/dot11s/pmp-regression-test-0-1.pcap b/src/mesh/test/dot11s/pmp-regression-test-0-1.pcap index 5433424ae..1e4f6787b 100644 Binary files a/src/mesh/test/dot11s/pmp-regression-test-0-1.pcap and b/src/mesh/test/dot11s/pmp-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/pmp-regression-test-1-1.pcap b/src/mesh/test/dot11s/pmp-regression-test-1-1.pcap index 8b26ad764..1614b6f0a 100644 Binary files a/src/mesh/test/dot11s/pmp-regression-test-1-1.pcap and b/src/mesh/test/dot11s/pmp-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/pmp-regression.cc b/src/mesh/test/dot11s/pmp-regression.cc index 6f99aea6d..7ff8f3754 100644 --- a/src/mesh/test/dot11s/pmp-regression.cc +++ b/src/mesh/test/dot11s/pmp-regression.cc @@ -19,7 +19,8 @@ */ #include "ns3/mesh-helper.h" #include "ns3/simulator.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" +#include "ns3/rng-seed-manager.h" #include "ns3/mobility-helper.h" #include "ns3/double.h" #include "ns3/uinteger.h" @@ -52,7 +53,8 @@ PeerManagementProtocolRegressionTest::~PeerManagementProtocolRegressionTest () void PeerManagementProtocolRegressionTest::DoRun () { - SeedManager::SetSeed (12345); + RngSeedManager::SetSeed (12345); + RngSeedManager::SetRun (7); CreateNodes (); CreateDevices (); @@ -95,6 +97,9 @@ PeerManagementProtocolRegressionTest::CreateDevices () mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); + // Three nodes, one device per node, two streams (one for mac, one for plugin) + int64_t streamsUsed = mesh.AssignStreams (meshDevices, 0); + NS_TEST_EXPECT_MSG_EQ (streamsUsed, (3*2), "Stream assignment unexpected value"); // 3. write PCAP if needed wifiPhy.EnablePcapAll (CreateTempDirFilename (PREFIX)); } diff --git a/src/mesh/test/flame/flame-regression-test-0-1.pcap b/src/mesh/test/flame/flame-regression-test-0-1.pcap index 20872c095..66572ed1e 100644 Binary files a/src/mesh/test/flame/flame-regression-test-0-1.pcap and b/src/mesh/test/flame/flame-regression-test-0-1.pcap differ diff --git a/src/mesh/test/flame/flame-regression-test-1-1.pcap b/src/mesh/test/flame/flame-regression-test-1-1.pcap index 4cb07cc7d..c1bf48b78 100644 Binary files a/src/mesh/test/flame/flame-regression-test-1-1.pcap and b/src/mesh/test/flame/flame-regression-test-1-1.pcap differ diff --git a/src/mesh/test/flame/flame-regression-test-2-1.pcap b/src/mesh/test/flame/flame-regression-test-2-1.pcap index 5b5d9079f..d4295d792 100644 Binary files a/src/mesh/test/flame/flame-regression-test-2-1.pcap and b/src/mesh/test/flame/flame-regression-test-2-1.pcap differ diff --git a/src/mesh/test/flame/flame-regression.cc b/src/mesh/test/flame/flame-regression.cc index 25174036a..baeaec72b 100644 --- a/src/mesh/test/flame/flame-regression.cc +++ b/src/mesh/test/flame/flame-regression.cc @@ -19,7 +19,8 @@ */ #include "ns3/mesh-helper.h" #include "ns3/simulator.h" -#include "ns3/random-variable.h" +#include "ns3/random-variable-stream.h" +#include "ns3/rng-seed-manager.h" #include "ns3/mobility-helper.h" #include "ns3/double.h" #include "ns3/uinteger.h" @@ -55,7 +56,8 @@ FlameRegressionTest::~FlameRegressionTest () void FlameRegressionTest::DoRun () { - SeedManager::SetSeed (12345); + RngSeedManager::SetSeed (12345); + RngSeedManager::SetRun (7); CreateNodes (); CreateDevices (); InstallApplications (); @@ -101,6 +103,9 @@ FlameRegressionTest::CreateDevices () mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); + // Three nodes, one device per node + int64_t streamsUsed = mesh.AssignStreams (meshDevices, 0); + NS_TEST_EXPECT_MSG_EQ (streamsUsed, 3, "Stream assignment unexpected value"); // 3. setup TCP/IP InternetStackHelper internetStack; internetStack.Install (*m_nodes);