Update mesh test traces due to random variable perturbations

This commit is contained in:
Tom Henderson
2012-08-24 19:11:51 -07:00
parent 385b134dcb
commit a3b094bbf4
29 changed files with 64 additions and 24 deletions

View File

@@ -22,6 +22,7 @@
#include "ns3/simulator.h"
#include "ns3/mesh-point-device.h"
#include "ns3/wifi-net-device.h"
#include "ns3/minstrel-wifi-manager.h"
#include "ns3/mesh-wifi-interface-mac.h"
namespace ns3
{
@@ -225,6 +226,18 @@ MeshHelper::AssignStreams (NetDeviceContainer c, int64_t stream)
for (std::vector<Ptr<NetDevice> >::iterator i = ifaces.begin (); i != ifaces.end (); i++)
{
wifi = DynamicCast<WifiNetDevice> (*i);
// Handle any random numbers in the PHY objects.
currentStream += wifi->GetPhy ()->AssignStreams (currentStream);
// Handle any random numbers in the station managers.
Ptr<WifiRemoteStationManager> manager = wifi->GetRemoteStationManager ();
Ptr<MinstrelWifiManager> minstrel = DynamicCast<MinstrelWifiManager> (manager);
if (minstrel)
{
currentStream += minstrel->AssignStreams (currentStream);
}
// Handle any random numbers in the mesh mac and plugins
mac = DynamicCast<MeshWifiInterfaceMac> (wifi->GetMac ());
if (mac)
{

View File

@@ -104,21 +104,26 @@ HwmpProactiveRegressionTest::InstallApplications ()
void
HwmpProactiveRegressionTest::CreateDevices ()
{
int64_t streamsUsed = 0;
// 1. setup WiFi
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
// This test suite output was originally based on YansErrorRateModel
wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
Ptr<YansWifiChannel> chan = wifiChannel.Create ();
wifiPhy.SetChannel (chan);
// 2. setup mesh
MeshHelper mesh = MeshHelper::Default ();
mesh.SetStackInstaller ("ns3::Dot11sStack", "Root", Mac48AddressValue (Mac48Address ("00:00:00:00:00:0d")));
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");
// Five devices, 4 streams per device
streamsUsed += mesh.AssignStreams (meshDevices, streamsUsed);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream mismatch");
// No streams used here, by default
streamsUsed += wifiChannel.AssignStreams (chan, streamsUsed);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream mismatch");
// 3. setup TCP/IP
InternetStackHelper internetStack;

View File

@@ -101,21 +101,26 @@ HwmpReactiveRegressionTest::InstallApplications ()
void
HwmpReactiveRegressionTest::CreateDevices ()
{
int64_t streamsUsed = 0;
// 1. setup WiFi
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
// This test suite output was originally based on YansErrorRateModel
wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
Ptr<YansWifiChannel> chan = wifiChannel.Create ();
wifiPhy.SetChannel (chan);
// 2. setup mesh
MeshHelper mesh = MeshHelper::Default ();
mesh.SetStackInstaller ("ns3::Dot11sStack");
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");
// Six devices, 4 streams per device
streamsUsed += mesh.AssignStreams (meshDevices, streamsUsed);
NS_TEST_EXPECT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream assignment mismatch");
streamsUsed += wifiChannel.AssignStreams (chan, streamsUsed);
NS_TEST_EXPECT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream assignment mismatch");
// 3. setup TCP/IP
InternetStackHelper internetStack;

View File

@@ -115,19 +115,23 @@ HwmpSimplestRegressionTest::InstallApplications ()
void
HwmpSimplestRegressionTest::CreateDevices ()
{
int64_t streamsUsed = 0;
// 1. setup WiFi
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
Ptr<YansWifiChannel> chan = wifiChannel.Create ();
wifiPhy.SetChannel (chan);
// 2. setup mesh
MeshHelper mesh = MeshHelper::Default ();
mesh.SetStackInstaller ("ns3::Dot11sStack");
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");
// Two devices, four streams per mesh device
streamsUsed += mesh.AssignStreams (meshDevices, streamsUsed);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream assignment mismatch");
streamsUsed += wifiChannel.AssignStreams (chan, streamsUsed);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream assignment mismatch");
// 3. setup TCP/IP
InternetStackHelper internetStack;

View File

@@ -120,21 +120,26 @@ HwmpDoRfRegressionTest::InstallApplications ()
void
HwmpDoRfRegressionTest::CreateDevices ()
{
int64_t streamsUsed = 0;
// 1. setup WiFi
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
// This test suite output was originally based on YansErrorRateModel
wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
Ptr<YansWifiChannel> chan = wifiChannel.Create ();
wifiPhy.SetChannel (chan);
// 2. setup mesh
MeshHelper mesh = MeshHelper::Default ();
mesh.SetStackInstaller ("ns3::Dot11sStack");
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");
// Four devices, four streams per mac
streamsUsed += mesh.AssignStreams (meshDevices, streamsUsed);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream assignment mismatch");
streamsUsed += wifiChannel.AssignStreams (chan, streamsUsed);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream assignment mismatch");
// 3. setup TCP/IP
InternetStackHelper internetStack;
internetStack.Install (*m_nodes);

View File

@@ -87,19 +87,23 @@ PeerManagementProtocolRegressionTest::CreateNodes ()
void
PeerManagementProtocolRegressionTest::CreateDevices ()
{
int64_t streamsUsed = 0;
// 1. setup WiFi
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
Ptr<YansWifiChannel> chan = wifiChannel.Create ();
wifiPhy.SetChannel (chan);
// 2. setup mesh
MeshHelper mesh = MeshHelper::Default ();
mesh.SetStackInstaller ("ns3::Dot11sStack");
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");
// Two devices, four streams per device (one for mac, one for phy,
// two for plugins)
streamsUsed += mesh.AssignStreams (meshDevices, 0);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 4), "Stream assignment mismatch");
wifiChannel.AssignStreams (chan, streamsUsed);
// 3. write PCAP if needed
wifiPhy.EnablePcapAll (CreateTempDirFilename (PREFIX));
}

View File

@@ -91,21 +91,25 @@ FlameRegressionTest::CreateNodes ()
void
FlameRegressionTest::CreateDevices ()
{
int64_t streamsUsed = 0;
// 1. setup WiFi
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
// This test suite output was originally based on YansErrorRateModel
wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
Ptr<YansWifiChannel> chan = wifiChannel.Create ();
wifiPhy.SetChannel (chan);
// 2. setup mesh
MeshHelper mesh = MeshHelper::Default ();
mesh.SetStackInstaller ("ns3::FlameStack");
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");
// Three devices, two streams per device
streamsUsed += mesh.AssignStreams (meshDevices, streamsUsed);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 2), "Stream assignment unexpected value");
streamsUsed += wifiChannel.AssignStreams (chan, streamsUsed);
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (meshDevices.GetN () * 2), "Stream assignment unexpected value");
// 3. setup TCP/IP
InternetStackHelper internetStack;
internetStack.Install (*m_nodes);