Mesh: added regression tests: peer management, reactive and proactive HWMP
This commit is contained in:
@@ -985,8 +985,7 @@ HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry)
|
||||
m_preqTimeouts.erase (i);
|
||||
return;
|
||||
}
|
||||
numOfRetry++;
|
||||
if (numOfRetry >= m_dot11MeshHWMPmaxPREQretries)
|
||||
if (numOfRetry > m_dot11MeshHWMPmaxPREQretries)
|
||||
{
|
||||
QueuedPacket packet = DequeueFirstPacketByDst (dst);
|
||||
//purge queue and delete entry from retryDatabase
|
||||
@@ -1002,6 +1001,7 @@ HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry)
|
||||
m_preqTimeouts.erase (i);
|
||||
return;
|
||||
}
|
||||
numOfRetry++;
|
||||
uint32_t originator_seqno = GetNextHwmpSeqno ();
|
||||
uint32_t dst_seqno = m_rtable->LookupReactiveExpired (dst).seqnum;
|
||||
for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i ++)
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
#include "ns3/test.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "dot11s-mac-header.h"
|
||||
#include "hwmp-rtable.h"
|
||||
#include "peer-link-frame.h"
|
||||
#include "ie-dot11s-peer-management.h"
|
||||
#include "../dot11s-mac-header.h"
|
||||
#include "../hwmp-rtable.h"
|
||||
#include "../peer-link-frame.h"
|
||||
#include "../ie-dot11s-peer-management.h"
|
||||
|
||||
namespace ns3 {
|
||||
namespace dot11s {
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
144
src/devices/mesh/dot11s/test/hwmp-proactive-regression.cc
Normal file
144
src/devices/mesh/dot11s/test/hwmp-proactive-regression.cc
Normal file
@@ -0,0 +1,144 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#include "ns3/mesh-helper.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-interface-container.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/abort.h"
|
||||
#include "ns3/udp-echo-helper.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
#include <sstream>
|
||||
#include "hwmp-proactive-regression.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/// Set to true to rewrite reference traces, leave false to run regression test
|
||||
const bool WRITE_VECTORS = false;
|
||||
/// Unique PCAP file name prefix
|
||||
const char * const PREFIX = "hwmp-proactive-regression-test";
|
||||
|
||||
|
||||
HwmpProactiveRegressionTest::HwmpProactiveRegressionTest () : TestCase ("HWMP proactive regression test"),
|
||||
m_nodes (0),
|
||||
m_time (Seconds (5))
|
||||
{
|
||||
}
|
||||
|
||||
HwmpProactiveRegressionTest::~HwmpProactiveRegressionTest ()
|
||||
{
|
||||
delete m_nodes;
|
||||
}
|
||||
bool
|
||||
HwmpProactiveRegressionTest::DoRun ()
|
||||
{
|
||||
SeedManager::SetSeed(12345);
|
||||
CreateNodes ();
|
||||
CreateDevices ();
|
||||
InstallApplications ();
|
||||
|
||||
Simulator::Stop (m_time);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
if (!WRITE_VECTORS) CheckResults ();
|
||||
|
||||
delete m_nodes, m_nodes = 0;
|
||||
return false;
|
||||
}
|
||||
void
|
||||
HwmpProactiveRegressionTest::CreateNodes ()
|
||||
{
|
||||
m_nodes = new NodeContainer;
|
||||
m_nodes->Create (5);
|
||||
MobilityHelper mobility;
|
||||
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
|
||||
"MinX", DoubleValue (0.0),
|
||||
"MinY", DoubleValue (0.0),
|
||||
"DeltaX", DoubleValue (100),
|
||||
"DeltaY", DoubleValue (0),
|
||||
"GridWidth", UintegerValue (5),
|
||||
"LayoutType", StringValue ("RowFirst"));
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (*m_nodes);
|
||||
}
|
||||
void
|
||||
HwmpProactiveRegressionTest::InstallApplications ()
|
||||
{
|
||||
UdpEchoServerHelper echoServer (9);
|
||||
ApplicationContainer serverApps = echoServer.Install (m_nodes->Get (0));
|
||||
serverApps.Start (Seconds (0.0));
|
||||
serverApps.Stop (m_time);
|
||||
UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9);
|
||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (300));
|
||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds(0.5)));
|
||||
echoClient.SetAttribute ("PacketSize", UintegerValue (100));
|
||||
ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (4));
|
||||
clientApps.Start (Seconds (2.5));
|
||||
clientApps.Stop (m_time);
|
||||
}
|
||||
void
|
||||
HwmpProactiveRegressionTest::CreateDevices ()
|
||||
{
|
||||
// 1. setup WiFi
|
||||
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
|
||||
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
|
||||
wifiPhy.SetChannel (wifiChannel.Create ());
|
||||
// 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);
|
||||
// 3. setup TCP/IP
|
||||
InternetStackHelper internetStack;
|
||||
internetStack.Install (*m_nodes);
|
||||
Ipv4AddressHelper address;
|
||||
address.SetBase ("10.1.1.0", "255.255.255.0");
|
||||
m_interfaces = address.Assign (meshDevices);
|
||||
// 4. write PCAP if needed
|
||||
std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX;
|
||||
wifiPhy.EnablePcapAll (prefix);
|
||||
}
|
||||
|
||||
void
|
||||
HwmpProactiveRegressionTest::CheckResults ()
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
std::ostringstream os1, os2;
|
||||
// File naming conventions are hard-coded here.
|
||||
os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap";
|
||||
os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap";
|
||||
|
||||
uint32_t sec(0), usec(0);
|
||||
bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here
|
||||
NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str()
|
||||
<< " differ starting from " << sec << " s " << usec << " us");
|
||||
}
|
||||
}
|
||||
|
||||
78
src/devices/mesh/dot11s/test/hwmp-proactive-regression.h
Normal file
78
src/devices/mesh/dot11s/test/hwmp-proactive-regression.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#include "ns3/test.h"
|
||||
#include "ns3/node-container.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ipv4-interface-container.h"
|
||||
#include "ns3/pcap-file.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup dot11s
|
||||
* \brief There are 5 stations set into a column, the center station is root.
|
||||
* Regression test indicates, that traffic goes from the first to the
|
||||
* last stations without reactive route discovery procedure
|
||||
* \verbatim
|
||||
* Src Root Dst
|
||||
* | |<--------|-------->| | Proactive PREQ
|
||||
* | |-------->| | | PREP
|
||||
* | | |<--------| | PREP
|
||||
* |<--------|-------->|<--------|-------->| Proactive PREQ
|
||||
* |-------->| | |<--------| PREP
|
||||
* | |-------->| | | PREP
|
||||
* | | |<--------| | PREP
|
||||
* <--------|-------->| | |<--------|--------> Proactive PREQ
|
||||
* Note, that at this moment all routes are known, and no reactive
|
||||
* path discovery procedure shall be initiated
|
||||
* <--------|-------->| | | | ARP request
|
||||
* |.........|.........|.........|.........|
|
||||
* | | |<--------|-------->| ARP request
|
||||
* | | | |<--------| ARP reply
|
||||
* |.........|.........|.........|.........|
|
||||
* |<--------| | | | ARP reply
|
||||
* |-------->| | | | DATA
|
||||
* ^ Further data is forwarded by proactive path
|
||||
* \endverbatim
|
||||
*
|
||||
*/
|
||||
class HwmpProactiveRegressionTest : public TestCase
|
||||
{
|
||||
public:
|
||||
HwmpProactiveRegressionTest ();
|
||||
virtual ~HwmpProactiveRegressionTest();
|
||||
|
||||
virtual bool DoRun ();
|
||||
void CheckResults ();
|
||||
|
||||
private:
|
||||
/// XXX It is important to have pointers here
|
||||
NodeContainer * m_nodes;
|
||||
/// Simulation time
|
||||
Time m_time;
|
||||
Ipv4InterfaceContainer m_interfaces;
|
||||
|
||||
void CreateNodes ();
|
||||
void CreateDevices ();
|
||||
void InstallApplications ();
|
||||
void ResetPosition ();
|
||||
};
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
154
src/devices/mesh/dot11s/test/hwmp-reactive-regression.cc
Normal file
154
src/devices/mesh/dot11s/test/hwmp-reactive-regression.cc
Normal file
@@ -0,0 +1,154 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#include "ns3/mesh-helper.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/abort.h"
|
||||
#include "ns3/udp-echo-helper.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "hwmp-reactive-regression.h"
|
||||
|
||||
/// Set to true to rewrite reference traces, leave false to run regression test
|
||||
const bool WRITE_VECTORS = false;
|
||||
/// Unique PCAP file name prefix
|
||||
const char * const PREFIX = "hwmp-reactive-regression-test";
|
||||
|
||||
HwmpReactiveRegressionTest::HwmpReactiveRegressionTest () : TestCase ("HWMP on-demand regression test"),
|
||||
m_nodes (0),
|
||||
m_time (Seconds (10))
|
||||
{
|
||||
}
|
||||
HwmpReactiveRegressionTest::~HwmpReactiveRegressionTest ()
|
||||
{
|
||||
delete m_nodes;
|
||||
}
|
||||
bool
|
||||
HwmpReactiveRegressionTest::DoRun ()
|
||||
{
|
||||
SeedManager::SetSeed(12345);
|
||||
CreateNodes ();
|
||||
CreateDevices ();
|
||||
InstallApplications ();
|
||||
|
||||
Simulator::Stop (m_time);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
if (!WRITE_VECTORS) CheckResults ();
|
||||
delete m_nodes, m_nodes = 0;
|
||||
return false;
|
||||
}
|
||||
void
|
||||
HwmpReactiveRegressionTest::CreateNodes ()
|
||||
{
|
||||
m_nodes = new NodeContainer;
|
||||
m_nodes->Create (6);
|
||||
MobilityHelper mobility;
|
||||
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
|
||||
positionAlloc->Add(Vector( 0, 0, 0));
|
||||
positionAlloc->Add(Vector( 0, 150, 0));
|
||||
positionAlloc->Add(Vector( 0, 300, 0));
|
||||
positionAlloc->Add(Vector( 0, 450, 0));
|
||||
positionAlloc->Add(Vector( 0, 600, 0));
|
||||
positionAlloc->Add(Vector( 0, 750, 0));
|
||||
mobility.SetPositionAllocator(positionAlloc);
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (*m_nodes);
|
||||
Simulator::Schedule (Seconds(5.0), &HwmpReactiveRegressionTest::ResetPosition, this);
|
||||
}
|
||||
void
|
||||
HwmpReactiveRegressionTest::InstallApplications ()
|
||||
{
|
||||
UdpEchoServerHelper echoServer (9);
|
||||
ApplicationContainer serverApps = echoServer.Install (m_nodes->Get (0));
|
||||
serverApps.Start (Seconds (0.0));
|
||||
serverApps.Stop (m_time);
|
||||
UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9);
|
||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (300));
|
||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds(0.5)));
|
||||
echoClient.SetAttribute ("PacketSize", UintegerValue (20));
|
||||
ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (5));
|
||||
clientApps.Start (Seconds (2.0));
|
||||
clientApps.Stop (m_time);
|
||||
}
|
||||
void
|
||||
HwmpReactiveRegressionTest::CreateDevices ()
|
||||
{
|
||||
// 1. setup WiFi
|
||||
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
|
||||
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
|
||||
wifiPhy.SetChannel (wifiChannel.Create ());
|
||||
// 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);
|
||||
// 3. setup TCP/IP
|
||||
InternetStackHelper internetStack;
|
||||
internetStack.Install (*m_nodes);
|
||||
Ipv4AddressHelper address;
|
||||
address.SetBase ("10.1.1.0", "255.255.255.0");
|
||||
m_interfaces = address.Assign (meshDevices);
|
||||
// 4. write PCAP if needed
|
||||
std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX;
|
||||
wifiPhy.EnablePcapAll (prefix);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
HwmpReactiveRegressionTest::CheckResults ()
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
std::ostringstream os1, os2;
|
||||
// File naming conventions are hard-coded here.
|
||||
os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap";
|
||||
os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap";
|
||||
|
||||
uint32_t sec(0), usec(0);
|
||||
bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here
|
||||
NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str()
|
||||
<< " differ starting from " << sec << " s " << usec << " us");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HwmpReactiveRegressionTest::ResetPosition ()
|
||||
{
|
||||
Ptr<Object> object = m_nodes->Get(3);
|
||||
Ptr<MobilityModel> model = object->GetObject<MobilityModel> ();
|
||||
if (model == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
model->SetPosition (Vector(9000, 0, 0));
|
||||
|
||||
}
|
||||
91
src/devices/mesh/dot11s/test/hwmp-reactive-regression.h
Normal file
91
src/devices/mesh/dot11s/test/hwmp-reactive-regression.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
#include "ns3/test.h"
|
||||
#include "ns3/node-container.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ipv4-interface-container.h"
|
||||
#include "ns3/pcap-file.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup dot11s
|
||||
* \brief test for multihop path establishing and path error
|
||||
* procedures
|
||||
* Initiate scenario with 6 stations. Procedure of opening peer link
|
||||
* is the following: (PMP routines are not shown)
|
||||
* \verbatim
|
||||
* 1 2 3 4 5 6
|
||||
* | | | | |<---|---> ARP request (first attempt has failed!)
|
||||
* |....|....|....|....|....| ARP reauest
|
||||
* |<---|--->| | | | ARP request
|
||||
* <---|--->| | | | | PREQ } This order is broken
|
||||
* <---|--->| | | | | ARP request} due to BroadcastDca
|
||||
* |<---|--->| | | | PREQ
|
||||
* |....|....|....|....|....| ARP request
|
||||
* | | | |<---|--->| PREQ
|
||||
* | | | | |<---| PREP
|
||||
* |....|....|....|....|....| PREP
|
||||
* |<---| | | | | PREP
|
||||
* |--->| | | | | ARP response
|
||||
* |....|....|....|....|....| ARP response
|
||||
* | | | | |--->| ARP response
|
||||
* | | | | |<---| Data
|
||||
* |....|....|....|....|....| Data
|
||||
* |<---| | | | | Data
|
||||
* <---|--->| | | | | ARP request
|
||||
* |....|....|....|....|....| ARP reauest
|
||||
* | | | | |<---|---> ARP request
|
||||
* | | | | |<---| ARP response
|
||||
* |....|....|....|....|....| ARP response
|
||||
* |<---| | | | | ARP response
|
||||
* |--->| | | | | Data
|
||||
* At 5 station number 4 dissapears, and PERR is forwarded from 3 to 1
|
||||
* and from 5 to 6, and station 6 starts path discovery procedure
|
||||
* again:
|
||||
* | |<---| |--->| PERR (one due to beacon loss and one due to TX error)
|
||||
* |<---| | | | PERR
|
||||
* | | | |<---|---> PREQ
|
||||
* | | | <---|--->| PREQ
|
||||
* |....|....|.........|....| Repeated attempts of PREQ
|
||||
* \endverbatim
|
||||
*/
|
||||
|
||||
class HwmpReactiveRegressionTest : public TestCase
|
||||
{
|
||||
public:
|
||||
HwmpReactiveRegressionTest ();
|
||||
virtual ~HwmpReactiveRegressionTest();
|
||||
|
||||
virtual bool DoRun ();
|
||||
void CheckResults ();
|
||||
private:
|
||||
/// XXX It is important to have pointers here
|
||||
NodeContainer * m_nodes;
|
||||
/// Simulation time
|
||||
Time m_time;
|
||||
Ipv4InterfaceContainer m_interfaces;
|
||||
|
||||
void CreateNodes ();
|
||||
void CreateDevices ();
|
||||
void InstallApplications ();
|
||||
void ResetPosition ();
|
||||
};
|
||||
|
||||
Binary file not shown.
Binary file not shown.
155
src/devices/mesh/dot11s/test/hwmp-simplest-regression.cc
Normal file
155
src/devices/mesh/dot11s/test/hwmp-simplest-regression.cc
Normal file
@@ -0,0 +1,155 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#include "ns3/mesh-helper.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/abort.h"
|
||||
#include "ns3/udp-echo-helper.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
#include <sstream>
|
||||
#include "hwmp-simplest-regression.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/// Set to true to rewrite reference traces, leave false to run regression test
|
||||
const bool WRITE_VECTORS = false;
|
||||
/// Unique PCAP file name prefix
|
||||
const char * const PREFIX = "hwmp-simplest-regression-test";
|
||||
|
||||
|
||||
HwmpSimplestRegressionTest::HwmpSimplestRegressionTest () : TestCase ("Simplest HWMP regression test"),
|
||||
m_nodes (0),
|
||||
m_time (Seconds (15))
|
||||
{
|
||||
}
|
||||
|
||||
HwmpSimplestRegressionTest::~HwmpSimplestRegressionTest ()
|
||||
{
|
||||
delete m_nodes;
|
||||
}
|
||||
bool
|
||||
HwmpSimplestRegressionTest::DoRun ()
|
||||
{
|
||||
SeedManager::SetSeed(12345);
|
||||
CreateNodes ();
|
||||
CreateDevices ();
|
||||
InstallApplications ();
|
||||
|
||||
Simulator::Stop (m_time);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
if (!WRITE_VECTORS) CheckResults ();
|
||||
|
||||
delete m_nodes, m_nodes = 0;
|
||||
return false;
|
||||
}
|
||||
void
|
||||
HwmpSimplestRegressionTest::CreateNodes ()
|
||||
{
|
||||
m_nodes = new NodeContainer;
|
||||
m_nodes->Create (2);
|
||||
MobilityHelper mobility;
|
||||
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
|
||||
"MinX", DoubleValue (0.0),
|
||||
"MinY", DoubleValue (0.0),
|
||||
"DeltaX", DoubleValue (1 /*meter*/),
|
||||
"DeltaY", DoubleValue (0),
|
||||
"GridWidth", UintegerValue (2),
|
||||
"LayoutType", StringValue ("RowFirst"));
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (*m_nodes);
|
||||
Simulator::Schedule (Seconds(10.0), &HwmpSimplestRegressionTest::ResetPosition, this);
|
||||
}
|
||||
void
|
||||
HwmpSimplestRegressionTest::ResetPosition ()
|
||||
{
|
||||
Ptr<Object> object = m_nodes->Get(1);
|
||||
Ptr<MobilityModel> model = object->GetObject<MobilityModel> ();
|
||||
if (model == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
model->SetPosition (Vector(9000, 0, 0));
|
||||
}
|
||||
void
|
||||
HwmpSimplestRegressionTest::InstallApplications ()
|
||||
{
|
||||
UdpEchoServerHelper echoServer (9);
|
||||
ApplicationContainer serverApps = echoServer.Install (m_nodes->Get (0));
|
||||
serverApps.Start (Seconds (0.0));
|
||||
serverApps.Stop (m_time);
|
||||
UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9);
|
||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (300));
|
||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds(0.05)));
|
||||
echoClient.SetAttribute ("PacketSize", UintegerValue (100));
|
||||
ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (1));
|
||||
clientApps.Start (Seconds (2.0));
|
||||
clientApps.Stop (m_time);
|
||||
}
|
||||
void
|
||||
HwmpSimplestRegressionTest::CreateDevices ()
|
||||
{
|
||||
// 1. setup WiFi
|
||||
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
|
||||
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
|
||||
wifiPhy.SetChannel (wifiChannel.Create ());
|
||||
// 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);
|
||||
// 3. setup TCP/IP
|
||||
InternetStackHelper internetStack;
|
||||
internetStack.Install (*m_nodes);
|
||||
Ipv4AddressHelper address;
|
||||
address.SetBase ("10.1.1.0", "255.255.255.0");
|
||||
m_interfaces = address.Assign (meshDevices);
|
||||
// 4. write PCAP if needed
|
||||
std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX;
|
||||
wifiPhy.EnablePcapAll (prefix);
|
||||
}
|
||||
|
||||
void
|
||||
HwmpSimplestRegressionTest::CheckResults ()
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
std::ostringstream os1, os2;
|
||||
// File naming conventions are hard-coded here.
|
||||
os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap";
|
||||
os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap";
|
||||
|
||||
uint32_t sec(0), usec(0);
|
||||
bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here
|
||||
NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str()
|
||||
<< " differ starting from " << sec << " s " << usec << " us");
|
||||
}
|
||||
}
|
||||
|
||||
89
src/devices/mesh/dot11s/test/hwmp-simplest-regression.h
Normal file
89
src/devices/mesh/dot11s/test/hwmp-simplest-regression.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#include "ns3/test.h"
|
||||
#include "ns3/node-container.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ipv4-interface-container.h"
|
||||
#include "ns3/pcap-file.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup dot11s
|
||||
* \brief Peering Management & HWM Protocol regression test
|
||||
* Initiate scenario with 2 stations. Procedure of opening peer link
|
||||
* is the following:
|
||||
* \verbatim
|
||||
* <-----------|-----------> Broadcast frame
|
||||
* |----------->| Unicast frame
|
||||
*
|
||||
* !!! PMP routines:
|
||||
* <-----------|----------->| Beacon
|
||||
* |<-----------| Peer Link Open frame
|
||||
* |----------->| Peer Link Open frame
|
||||
* |----------->| Peer Link Confirm frame
|
||||
* |<-----------| Peer Link Confirm frame
|
||||
* |............| !!! Data started:
|
||||
* |<-----------|-----------> Arp Request
|
||||
* <-----------|----------->| Arp Request (fwd)
|
||||
* <-----------|----------->| PREQ
|
||||
* |<-----------| PREP
|
||||
* |----------->| ARP reply
|
||||
* |<-----------| Data
|
||||
* |----------->| Data
|
||||
* |............| Some other beacons
|
||||
* |<-----------| Data
|
||||
* |----------->| Data
|
||||
* |............| !!! Route expiration routines:
|
||||
* |<-----------|-----------> PREQ (route expired)
|
||||
* |----------->| PREP
|
||||
* |<-----------| Data
|
||||
* |----------->| Data
|
||||
* |............|
|
||||
* \endverbatim
|
||||
* At 10 seconds stations become unreachable, so UDP client tries to
|
||||
* close peer link due to TX-fail, and UDP-srver tries to close link
|
||||
* due to beacon loss
|
||||
|
||||
|
||||
*/
|
||||
class HwmpSimplestRegressionTest : public TestCase
|
||||
{
|
||||
public:
|
||||
HwmpSimplestRegressionTest ();
|
||||
virtual ~HwmpSimplestRegressionTest();
|
||||
|
||||
virtual bool DoRun ();
|
||||
void CheckResults ();
|
||||
|
||||
private:
|
||||
/// XXX It is important to have pointers here
|
||||
NodeContainer * m_nodes;
|
||||
/// Simulation time
|
||||
Time m_time;
|
||||
Ipv4InterfaceContainer m_interfaces;
|
||||
|
||||
void CreateNodes ();
|
||||
void CreateDevices ();
|
||||
void InstallApplications ();
|
||||
void ResetPosition ();
|
||||
};
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
160
src/devices/mesh/dot11s/test/hwmp-target-flags-regression.cc
Normal file
160
src/devices/mesh/dot11s/test/hwmp-target-flags-regression.cc
Normal file
@@ -0,0 +1,160 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#include "ns3/mesh-helper.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/abort.h"
|
||||
#include "ns3/udp-echo-helper.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
#include <sstream>
|
||||
#include "hwmp-target-flags-regression.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/// Set to true to rewrite reference traces, leave false to run regression test
|
||||
const bool WRITE_VECTORS = false;
|
||||
/// Unique PCAP file name prefix
|
||||
const char * const PREFIX = "hwmp-target-flags-regression-test";
|
||||
|
||||
|
||||
HwmpDoRfRegressionTest::HwmpDoRfRegressionTest () : TestCase ("HWMP proactive regression test"),
|
||||
m_nodes (0),
|
||||
m_time (Seconds (5))
|
||||
{
|
||||
}
|
||||
|
||||
HwmpDoRfRegressionTest::~HwmpDoRfRegressionTest ()
|
||||
{
|
||||
delete m_nodes;
|
||||
}
|
||||
bool
|
||||
HwmpDoRfRegressionTest::DoRun ()
|
||||
{
|
||||
SeedManager::SetSeed(12345);
|
||||
CreateNodes ();
|
||||
CreateDevices ();
|
||||
InstallApplications ();
|
||||
|
||||
Simulator::Stop (m_time);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
if (!WRITE_VECTORS) CheckResults ();
|
||||
|
||||
delete m_nodes, m_nodes = 0;
|
||||
return false;
|
||||
}
|
||||
void
|
||||
HwmpDoRfRegressionTest::CreateNodes ()
|
||||
{
|
||||
m_nodes = new NodeContainer;
|
||||
m_nodes->Create (4);
|
||||
MobilityHelper mobility;
|
||||
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
|
||||
"MinX", DoubleValue (0.0),
|
||||
"MinY", DoubleValue (0.0),
|
||||
"DeltaX", DoubleValue (100),
|
||||
"DeltaY", DoubleValue (0),
|
||||
"GridWidth", UintegerValue (4),
|
||||
"LayoutType", StringValue ("RowFirst"));
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (*m_nodes);
|
||||
}
|
||||
void
|
||||
HwmpDoRfRegressionTest::InstallApplications ()
|
||||
{
|
||||
UdpEchoServerHelper echoServer (9);
|
||||
ApplicationContainer serverApps = echoServer.Install (m_nodes->Get (0));
|
||||
serverApps.Start (Seconds (0.0));
|
||||
serverApps.Stop (m_time);
|
||||
UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9);
|
||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (300));
|
||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds(1.0)));
|
||||
echoClient.SetAttribute ("PacketSize", UintegerValue (100));
|
||||
//Install first client
|
||||
ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (1));
|
||||
clientApps.Start (Seconds (2.2));
|
||||
clientApps.Stop (m_time);
|
||||
//Install second client
|
||||
clientApps = echoClient.Install (m_nodes->Get (2));
|
||||
clientApps.Start (Seconds (2.0));
|
||||
clientApps.Stop (m_time);
|
||||
//Install second server and attach client to it:
|
||||
UdpEchoServerHelper echoServer1 (10);
|
||||
serverApps = echoServer1.Install (m_nodes->Get (3));
|
||||
serverApps.Start (Seconds (0.0));
|
||||
serverApps.Stop (m_time);
|
||||
UdpEchoClientHelper echoClient1 (m_interfaces.GetAddress (3), 10);
|
||||
echoClient1.SetAttribute ("MaxPackets", UintegerValue (300));
|
||||
echoClient1.SetAttribute ("Interval", TimeValue (Seconds(1.0)));
|
||||
echoClient1.SetAttribute ("PacketSize", UintegerValue (100));
|
||||
clientApps = echoClient1.Install (m_nodes->Get (0));
|
||||
clientApps.Start (Seconds (2.4));
|
||||
clientApps.Stop (m_time);
|
||||
}
|
||||
void
|
||||
HwmpDoRfRegressionTest::CreateDevices ()
|
||||
{
|
||||
// 1. setup WiFi
|
||||
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
|
||||
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
|
||||
wifiPhy.SetChannel (wifiChannel.Create ());
|
||||
// 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);
|
||||
// 3. setup TCP/IP
|
||||
InternetStackHelper internetStack;
|
||||
internetStack.Install (*m_nodes);
|
||||
Ipv4AddressHelper address;
|
||||
address.SetBase ("10.1.1.0", "255.255.255.0");
|
||||
m_interfaces = address.Assign (meshDevices);
|
||||
// 4. write PCAP if needed
|
||||
std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX;
|
||||
wifiPhy.EnablePcapAll (prefix);
|
||||
}
|
||||
|
||||
void
|
||||
HwmpDoRfRegressionTest::CheckResults ()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
std::ostringstream os1, os2;
|
||||
// File naming conventions are hard-coded here.
|
||||
os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap";
|
||||
os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap";
|
||||
|
||||
uint32_t sec(0), usec(0);
|
||||
bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here
|
||||
NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str()
|
||||
<< " differ starting from " << sec << " s " << usec << " us");
|
||||
}
|
||||
}
|
||||
|
||||
88
src/devices/mesh/dot11s/test/hwmp-target-flags-regression.h
Normal file
88
src/devices/mesh/dot11s/test/hwmp-target-flags-regression.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#include "ns3/test.h"
|
||||
#include "ns3/node-container.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ipv4-interface-container.h"
|
||||
#include "ns3/pcap-file.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup dot11s
|
||||
* \brief This is a test for intermediate reply and saving routing
|
||||
* information about neighbour. 4 stations and 3 UDP ping streams are initiated.
|
||||
* \verbatim
|
||||
* <-----------|-----------> Broadcast frame
|
||||
* |----------->| Unicast frame
|
||||
* 10 11 12 13
|
||||
* | |<-----------|----------->| ARP request (12 asks who has 10)
|
||||
* | | |<-----------|-----------> ARP request
|
||||
* |<-----------|----------->| | ARP request
|
||||
* <-----------|----------->| | | PREQ
|
||||
* |<-----------|----------->| | PREQ
|
||||
* | |<-----------| | PREP
|
||||
* |<-----------| | | PREP
|
||||
* |----------->| | | ARP reply
|
||||
* | |----------->| | ARP REPLY
|
||||
* | |<-----------| | Data
|
||||
* |............|............|............|
|
||||
* |<-----------|----------->| | ARP request (11 asks who has 10)
|
||||
* |............|............|............|
|
||||
* |----------->| | | ARP reply
|
||||
* ^ Note, that this arp reply goes without route
|
||||
* discovery procedure, because route is known from
|
||||
* previous PREQ/PREP exchange
|
||||
* |<-----------| | | DATA
|
||||
* |............|............|............|
|
||||
* <-----------|----------->| | | ARP request (10 asks who has 13)
|
||||
* |............|............|............|
|
||||
* | | |<-----------|-----------> PREQ (13 asks about 10) DO=0 RF=1
|
||||
* | | |----------->| PREP (intermediate reply - 12 knows about 10)
|
||||
* | |<-----------|----------->| PREQ DO=1 RF=0
|
||||
* |............|............|............|
|
||||
* |----------->| | | PREP
|
||||
* | |----------->| | PREP
|
||||
* | | |----------->| PREP
|
||||
* \endverbatim
|
||||
*/
|
||||
class HwmpDoRfRegressionTest : public TestCase
|
||||
{
|
||||
public:
|
||||
HwmpDoRfRegressionTest ();
|
||||
virtual ~HwmpDoRfRegressionTest();
|
||||
|
||||
virtual bool DoRun ();
|
||||
void CheckResults ();
|
||||
|
||||
private:
|
||||
/// XXX It is important to have pointers here
|
||||
NodeContainer * m_nodes;
|
||||
/// Simulation time
|
||||
Time m_time;
|
||||
Ipv4InterfaceContainer m_interfaces;
|
||||
|
||||
void CreateNodes ();
|
||||
void CreateDevices ();
|
||||
void InstallApplications ();
|
||||
void ResetPosition ();
|
||||
};
|
||||
|
||||
BIN
src/devices/mesh/dot11s/test/pmp-regression-test-0-1.pcap
Normal file
BIN
src/devices/mesh/dot11s/test/pmp-regression-test-0-1.pcap
Normal file
Binary file not shown.
BIN
src/devices/mesh/dot11s/test/pmp-regression-test-1-1.pcap
Normal file
BIN
src/devices/mesh/dot11s/test/pmp-regression-test-1-1.pcap
Normal file
Binary file not shown.
121
src/devices/mesh/dot11s/test/pmp-regression.cc
Normal file
121
src/devices/mesh/dot11s/test/pmp-regression.cc
Normal file
@@ -0,0 +1,121 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Pavel Boyko <boyko@iitp.ru>
|
||||
*/
|
||||
#include "ns3/mesh-helper.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
#include "ns3/pcap-file.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "pmp-regression.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/// Set to true to rewrite reference traces, leave false to run regression test
|
||||
const bool WRITE_VECTORS = false;
|
||||
/// Unique PCAP file name prefix
|
||||
const char * const PREFIX = "pmp-regression-test";
|
||||
|
||||
PeerManagementProtocolRegressionTest::PeerManagementProtocolRegressionTest () : TestCase ("PMP regression test"),
|
||||
m_nodes (0),
|
||||
m_time (Seconds (1))
|
||||
{
|
||||
}
|
||||
|
||||
PeerManagementProtocolRegressionTest::~PeerManagementProtocolRegressionTest ()
|
||||
{
|
||||
delete m_nodes;
|
||||
}
|
||||
|
||||
bool
|
||||
PeerManagementProtocolRegressionTest::DoRun ()
|
||||
{
|
||||
SeedManager::SetSeed(12345);
|
||||
CreateNodes ();
|
||||
CreateDevices ();
|
||||
|
||||
Simulator::Stop (m_time);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
if (!WRITE_VECTORS) CheckResults ();
|
||||
|
||||
delete m_nodes, m_nodes = 0;
|
||||
return GetErrorStatus ();
|
||||
}
|
||||
|
||||
void
|
||||
PeerManagementProtocolRegressionTest::CreateNodes ()
|
||||
{
|
||||
m_nodes = new NodeContainer;
|
||||
m_nodes->Create (2);
|
||||
MobilityHelper mobility;
|
||||
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
|
||||
"MinX", DoubleValue (0.0),
|
||||
"MinY", DoubleValue (0.0),
|
||||
"DeltaX", DoubleValue (1 /*meter*/),
|
||||
"DeltaY", DoubleValue (0),
|
||||
"GridWidth", UintegerValue (2),
|
||||
"LayoutType", StringValue ("RowFirst"));
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install (*m_nodes);
|
||||
}
|
||||
|
||||
void
|
||||
PeerManagementProtocolRegressionTest::CreateDevices ()
|
||||
{
|
||||
// 1. setup WiFi
|
||||
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
|
||||
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
|
||||
wifiPhy.SetChannel (wifiChannel.Create ());
|
||||
// 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);
|
||||
// 3. write PCAP if needed
|
||||
std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX;
|
||||
wifiPhy.EnablePcapAll (prefix);
|
||||
}
|
||||
|
||||
void
|
||||
PeerManagementProtocolRegressionTest::CheckResults ()
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
std::ostringstream os1, os2;
|
||||
// File naming conventions are hard-coded here.
|
||||
os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap";
|
||||
os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap";
|
||||
|
||||
uint32_t sec(0), usec(0);
|
||||
bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here
|
||||
NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str()
|
||||
<< " differ starting from " << sec << " s " << usec << " us");
|
||||
}
|
||||
}
|
||||
|
||||
62
src/devices/mesh/dot11s/test/pmp-regression.h
Normal file
62
src/devices/mesh/dot11s/test/pmp-regression.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Pavel Boyko <boyko@iitp.ru>
|
||||
*/
|
||||
#ifndef PMP_REGRESSION_H
|
||||
#define PMP_REGRESSION_H
|
||||
#include "ns3/test.h"
|
||||
#include "ns3/node-container.h"
|
||||
#include "ns3/nstime.h"
|
||||
|
||||
using namespace ns3;
|
||||
/**
|
||||
* \ingroup dot11s
|
||||
*
|
||||
* \brief Peering Management Protocol regression test
|
||||
*
|
||||
* Initiate scenario with 2 stations. Procedure of opening peer link
|
||||
* is the following:
|
||||
* \verbatim
|
||||
* |----------->| Beacon
|
||||
* |<-----------| Peer Link Open frame
|
||||
* |----------->| Peer Link Open frame
|
||||
* |----------->| Peer Link Confirm frame
|
||||
* |<-----------| Peer Link Confirm frame
|
||||
* |............|
|
||||
* |<---------->| Other beacons
|
||||
* \endverbatim
|
||||
*/
|
||||
class PeerManagementProtocolRegressionTest : public TestCase
|
||||
{
|
||||
public:
|
||||
PeerManagementProtocolRegressionTest ();
|
||||
~PeerManagementProtocolRegressionTest ();
|
||||
|
||||
private:
|
||||
/// XXX It is important to have pointers here
|
||||
NodeContainer * m_nodes;
|
||||
/// Simulation time
|
||||
Time m_time;
|
||||
|
||||
void CreateNodes ();
|
||||
void CreateDevices ();
|
||||
void CheckResults ();
|
||||
bool DoRun ();
|
||||
};
|
||||
#endif // PMP_REGRESSION_H
|
||||
|
||||
40
src/devices/mesh/dot11s/test/regression.cc
Normal file
40
src/devices/mesh/dot11s/test/regression.cc
Normal file
@@ -0,0 +1,40 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Authors: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#include "ns3/test.h"
|
||||
#include "pmp-regression.h"
|
||||
#include "hwmp-reactive-regression.h"
|
||||
#include "hwmp-proactive-regression.h"
|
||||
#include "hwmp-simplest-regression.h"
|
||||
#include "hwmp-target-flags-regression.h"
|
||||
|
||||
using namespace ns3;
|
||||
class Dot11sRegressionSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
Dot11sRegressionSuite () : TestSuite ("devices-mesh-dot11s-regression", SYSTEM)
|
||||
{
|
||||
AddTestCase (new PeerManagementProtocolRegressionTest);
|
||||
AddTestCase (new HwmpSimplestRegressionTest);
|
||||
AddTestCase (new HwmpReactiveRegressionTest);
|
||||
AddTestCase (new HwmpProactiveRegressionTest);
|
||||
AddTestCase (new HwmpDoRfRegressionTest);
|
||||
}
|
||||
} g_dot11sRegressionSuite;
|
||||
@@ -23,7 +23,14 @@ def build(bld):
|
||||
'hwmp-protocol-mac.cc',
|
||||
'hwmp-protocol.cc',
|
||||
'airtime-metric.cc',
|
||||
'dot11s-test-suite.cc',
|
||||
'test/dot11s-test-suite.cc',
|
||||
'test/pmp-regression.cc',
|
||||
'test/hwmp-reactive-regression.cc',
|
||||
'test/hwmp-proactive-regression.cc',
|
||||
'test/hwmp-simplest-regression.cc',
|
||||
'test/hwmp-target-flags-regression.cc',
|
||||
'test/regression.cc',
|
||||
|
||||
]
|
||||
headers = bld.new_task_gen('ns3header')
|
||||
headers.module = 'dot11s'
|
||||
|
||||
Reference in New Issue
Block a user