aodv: Fix various Doxygen and coding style issues
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup aodv-examples
|
||||
* \ingroup examples
|
||||
* \brief Test script.
|
||||
*
|
||||
* This script creates 1-dimensional grid topology and then ping last node from the first one:
|
||||
@@ -46,7 +48,12 @@ class AodvExample
|
||||
{
|
||||
public:
|
||||
AodvExample ();
|
||||
/// Configure script parameters, \return true on successful configuration
|
||||
/**
|
||||
* \brief Configure script parameters
|
||||
* \param argc is the command line argument count
|
||||
* \param argv is the command line arguments
|
||||
* \return true on successful configuration
|
||||
*/
|
||||
bool Configure (int argc, char **argv);
|
||||
/// Run simulation
|
||||
void Run ();
|
||||
@@ -68,14 +75,21 @@ private:
|
||||
bool printRoutes;
|
||||
|
||||
// network
|
||||
/// nodes used in the example
|
||||
NodeContainer nodes;
|
||||
/// devices used in the example
|
||||
NetDeviceContainer devices;
|
||||
/// interfaces used in the example
|
||||
Ipv4InterfaceContainer interfaces;
|
||||
|
||||
private:
|
||||
/// Create the nodes
|
||||
void CreateNodes ();
|
||||
/// Create the devices
|
||||
void CreateDevices ();
|
||||
/// Create the network
|
||||
void InstallInternetStack ();
|
||||
/// Create the simulation applications
|
||||
void InstallApplications ();
|
||||
};
|
||||
|
||||
|
||||
@@ -28,27 +28,39 @@
|
||||
#include "ns3/aodv-id-cache.h"
|
||||
#include "ns3/test.h"
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
namespace aodv
|
||||
{
|
||||
namespace ns3 {
|
||||
namespace aodv {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Tests
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Unit test for id cache
|
||||
/**
|
||||
* \ingroup aodv
|
||||
* \defgroup aodv-test AODV module tests
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for id cache
|
||||
*/
|
||||
class IdCacheTest : public TestCase
|
||||
{
|
||||
public:
|
||||
IdCacheTest () : TestCase ("Id Cache"), cache (Seconds (10))
|
||||
{}
|
||||
IdCacheTest () : TestCase ("Id Cache"),
|
||||
cache (Seconds (10))
|
||||
{
|
||||
}
|
||||
virtual void DoRun ();
|
||||
|
||||
private:
|
||||
/// Timeout test function #1
|
||||
void CheckTimeout1 ();
|
||||
/// Timeout test function #2
|
||||
void CheckTimeout2 ();
|
||||
/// Timeout test function #3
|
||||
void CheckTimeout3 ();
|
||||
|
||||
/// ID cache
|
||||
IdCache cache;
|
||||
};
|
||||
|
||||
@@ -92,7 +104,13 @@ IdCacheTest::CheckTimeout3 ()
|
||||
{
|
||||
NS_TEST_EXPECT_MSG_EQ (cache.GetSize (), 0, "All records expire");
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Id Cache Test Suite
|
||||
*/
|
||||
class IdCacheTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -100,7 +118,7 @@ public:
|
||||
{
|
||||
AddTestCase (new IdCacheTest, TestCase::QUICK);
|
||||
}
|
||||
} g_idCacheTestSuite;
|
||||
} g_idCacheTestSuite; ///< the test suite
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace aodv
|
||||
} // namespace ns3
|
||||
|
||||
@@ -42,13 +42,16 @@
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Test suite
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief AODV regression test suite
|
||||
*/
|
||||
class AodvRegressionTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
AodvRegressionTestSuite () : TestSuite ("routing-aodv-regression", SYSTEM)
|
||||
AodvRegressionTestSuite () : TestSuite ("routing-aodv-regression", SYSTEM)
|
||||
{
|
||||
SetDataDir (NS_TEST_SOURCEDIR);
|
||||
// General RREQ-RREP-RRER test case
|
||||
@@ -58,21 +61,24 @@ public:
|
||||
// \bugid{772} UDP test case
|
||||
AddTestCase (new Bug772ChainTest ("udp-chain-test", "ns3::UdpSocketFactory", Seconds (3), 10), TestCase::QUICK);
|
||||
}
|
||||
} g_aodvRegressionTestSuite;
|
||||
|
||||
} g_aodvRegressionTestSuite; ///< the test suite
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ChainRegressionTest
|
||||
//-----------------------------------------------------------------------------
|
||||
ChainRegressionTest::ChainRegressionTest (const char * const prefix, Time t, uint32_t size, Time arpAliveTimeout) :
|
||||
TestCase ("AODV chain regression test"),
|
||||
m_nodes (0),
|
||||
m_prefix (prefix),
|
||||
m_time (t),
|
||||
m_size (size),
|
||||
m_step (120),
|
||||
m_arpAliveTimeout (arpAliveTimeout),
|
||||
m_seq (0)
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Chain Regression Test
|
||||
*/
|
||||
ChainRegressionTest::ChainRegressionTest (const char * const prefix, Time t, uint32_t size, Time arpAliveTimeout)
|
||||
: TestCase ("AODV chain regression test"),
|
||||
m_nodes (0),
|
||||
m_prefix (prefix),
|
||||
m_time (t),
|
||||
m_size (size),
|
||||
m_step (120),
|
||||
m_arpAliveTimeout (arpAliveTimeout),
|
||||
m_seq (0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -165,17 +171,17 @@ ChainRegressionTest::CreateDevices ()
|
||||
wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
|
||||
wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
|
||||
// This test suite output was originally based on YansErrorRateModel
|
||||
wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
|
||||
wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200"));
|
||||
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, *m_nodes);
|
||||
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, *m_nodes);
|
||||
|
||||
// Assign fixed stream numbers to wifi and channel random variables
|
||||
streamsUsed += wifi.AssignStreams (devices, streamsUsed);
|
||||
// Assign 6 streams per device
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (devices.GetN () * 6), "Stream assignment mismatch");
|
||||
streamsUsed += wifiChannel.AssignStreams (chan, streamsUsed);
|
||||
// Assign 0 streams per channel for this configuration
|
||||
// Assign 0 streams per channel for this configuration
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (devices.GetN () * 6), "Stream assignment mismatch");
|
||||
|
||||
// 2. Setup TCP/IP & AODV
|
||||
@@ -188,7 +194,7 @@ ChainRegressionTest::CreateDevices ()
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (devices.GetN () * 8) + m_size, "Stream assignment mismatch");
|
||||
streamsUsed += aodv.AssignStreams (*m_nodes, streamsUsed);
|
||||
// AODV uses m_size more streams
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, ((devices.GetN () * 8) + (2*m_size)), "Stream assignment mismatch");
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, ((devices.GetN () * 8) + (2 * m_size)), "Stream assignment mismatch");
|
||||
|
||||
Ipv4AddressHelper address;
|
||||
address.SetBase ("10.1.1.0", "255.255.255.0");
|
||||
|
||||
@@ -30,7 +30,7 @@ using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup aodv
|
||||
*
|
||||
*
|
||||
* \brief AODV chain regression test
|
||||
*
|
||||
* This script creates 1-dimensional grid topology and then ping last node from the first one:
|
||||
@@ -42,7 +42,7 @@ using namespace ns3;
|
||||
* We want to demonstrate in this script
|
||||
* 1) route establishing
|
||||
* 2) broken link detection both from layer 2 information and hello messages.
|
||||
*
|
||||
*
|
||||
* \verbatim
|
||||
Expected packets time diagram.
|
||||
1 2 3 4 5
|
||||
@@ -155,7 +155,7 @@ class ChainRegressionTest : public TestCase
|
||||
public:
|
||||
/**
|
||||
* Create test case
|
||||
*
|
||||
*
|
||||
* \param prefix Unique file names prefix
|
||||
* \param size Number of nodes in the chain
|
||||
* \param time Simulation time
|
||||
|
||||
@@ -24,20 +24,34 @@
|
||||
#include "ns3/aodv-rtable.h"
|
||||
#include "ns3/ipv4-route.h"
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
namespace aodv
|
||||
{
|
||||
namespace ns3 {
|
||||
namespace aodv {
|
||||
|
||||
/// Unit test for neighbors
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for neighbors
|
||||
*/
|
||||
struct NeighborTest : public TestCase
|
||||
{
|
||||
NeighborTest () : TestCase ("Neighbor"), neighbor (0) { }
|
||||
NeighborTest () : TestCase ("Neighbor"),
|
||||
neighbor (0)
|
||||
{
|
||||
}
|
||||
virtual void DoRun ();
|
||||
/**
|
||||
* Handler test function
|
||||
* \param addr the IPv4 address of the neighbor
|
||||
*/
|
||||
void Handler (Ipv4Address addr);
|
||||
/// Check timeout function 1
|
||||
void CheckTimeout1 ();
|
||||
/// Check timeout function 2
|
||||
void CheckTimeout2 ();
|
||||
/// Check timeout function 3
|
||||
void CheckTimeout3 ();
|
||||
/// The Neighbors
|
||||
Neighbors * neighbor;
|
||||
};
|
||||
|
||||
@@ -94,10 +108,16 @@ NeighborTest::DoRun ()
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Type header test case
|
||||
*/
|
||||
struct TypeHeaderTest : public TestCase
|
||||
{
|
||||
TypeHeaderTest () : TestCase ("AODV TypeHeader")
|
||||
TypeHeaderTest () : TestCase ("AODV TypeHeader")
|
||||
{
|
||||
}
|
||||
virtual void DoRun ()
|
||||
@@ -114,11 +134,16 @@ struct TypeHeaderTest : public TestCase
|
||||
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Unit test for RREQ
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for RREQ
|
||||
*/
|
||||
struct RreqHeaderTest : public TestCase
|
||||
{
|
||||
RreqHeaderTest () : TestCase ("AODV RREQ")
|
||||
RreqHeaderTest () : TestCase ("AODV RREQ")
|
||||
{
|
||||
}
|
||||
virtual void DoRun ()
|
||||
@@ -162,11 +187,18 @@ struct RreqHeaderTest : public TestCase
|
||||
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Unit test for RREP
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for RREP
|
||||
*/
|
||||
struct RrepHeaderTest : public TestCase
|
||||
{
|
||||
RrepHeaderTest () : TestCase ("AODV RREP") {}
|
||||
RrepHeaderTest () : TestCase ("AODV RREP")
|
||||
{
|
||||
}
|
||||
virtual void DoRun ()
|
||||
{
|
||||
RrepHeader h (/*prefixSize*/ 0, /*hopCount*/ 12, /*dst*/ Ipv4Address ("1.2.3.4"), /*dstSeqNo*/ 2,
|
||||
@@ -207,8 +239,13 @@ struct RrepHeaderTest : public TestCase
|
||||
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Unit test for RREP-ACK
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for RREP-ACK
|
||||
*/
|
||||
struct RrepAckHeaderTest : public TestCase
|
||||
{
|
||||
RrepAckHeaderTest () : TestCase ("AODV RREP-ACK")
|
||||
@@ -225,8 +262,13 @@ struct RrepAckHeaderTest : public TestCase
|
||||
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Unit test for RERR
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for RERR
|
||||
*/
|
||||
struct RerrHeaderTest : public TestCase
|
||||
{
|
||||
RerrHeaderTest () : TestCase ("AODV RERR")
|
||||
@@ -253,15 +295,54 @@ struct RerrHeaderTest : public TestCase
|
||||
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Unit test for AODV routing table entry
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for AODV routing table entry
|
||||
*/
|
||||
struct QueueEntryTest : public TestCase
|
||||
{
|
||||
QueueEntryTest () : TestCase ("QueueEntry") {}
|
||||
void Unicast (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header) {}
|
||||
void Error (Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno) {}
|
||||
void Unicast2 (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header) {}
|
||||
void Error2 (Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno) {}
|
||||
QueueEntryTest () : TestCase ("QueueEntry")
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Unicast test function
|
||||
* \param route the IPv4 route
|
||||
* \param packet the packet
|
||||
* \param header the IPv4 header
|
||||
*/
|
||||
void Unicast (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Error test function
|
||||
* \param p The packet
|
||||
* \param h The header
|
||||
* \param e the socket error
|
||||
*/
|
||||
void Error (Ptr<const Packet> p, const Ipv4Header & h, Socket::SocketErrno e)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Unicast 2 testfunction
|
||||
* \param route The IPv4 route
|
||||
* \param packet The packet
|
||||
* \param header The header
|
||||
*/
|
||||
void Unicast2 (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Error2 test function
|
||||
* \param p The packet
|
||||
* \param h The header
|
||||
* \param e the socket error
|
||||
*/
|
||||
void Error2 (Ptr<const Packet> p, const Ipv4Header & h, Socket::SocketErrno e)
|
||||
{
|
||||
}
|
||||
virtual void DoRun ()
|
||||
{
|
||||
Ptr<const Packet> packet = Create<Packet> ();
|
||||
@@ -295,13 +376,35 @@ struct QueueEntryTest : public TestCase
|
||||
/// Unit test for RequestQueue
|
||||
struct AodvRqueueTest : public TestCase
|
||||
{
|
||||
AodvRqueueTest () : TestCase ("Rqueue"), q (64, Seconds (30)) {}
|
||||
AodvRqueueTest () : TestCase ("Rqueue"),
|
||||
q (64, Seconds (30))
|
||||
{
|
||||
}
|
||||
virtual void DoRun ();
|
||||
void Unicast (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header) {}
|
||||
void Error (Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno) {}
|
||||
/**
|
||||
* Unicast test function
|
||||
* \param route the IPv4 route
|
||||
* \param packet the packet
|
||||
* \param header the IPv4 header
|
||||
*/
|
||||
void Unicast (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Error test function
|
||||
* \param p The packet
|
||||
* \param h The header
|
||||
* \param e the socket error
|
||||
*/
|
||||
void Error (Ptr<const Packet> p, const Ipv4Header & h, Socket::SocketErrno e)
|
||||
{
|
||||
}
|
||||
/// Check size limit function
|
||||
void CheckSizeLimit ();
|
||||
/// Check timeout function
|
||||
void CheckTimeout ();
|
||||
|
||||
/// Request queue
|
||||
RequestQueue q;
|
||||
};
|
||||
|
||||
@@ -374,11 +477,15 @@ AodvRqueueTest::CheckSizeLimit ()
|
||||
QueueEntry e1 (packet, header, ucb, ecb, Seconds (1));
|
||||
|
||||
for (uint32_t i = 0; i < q.GetMaxQueueLen (); ++i)
|
||||
q.Enqueue (e1);
|
||||
{
|
||||
q.Enqueue (e1);
|
||||
}
|
||||
NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 2, "trivial");
|
||||
|
||||
for (uint32_t i = 0; i < q.GetMaxQueueLen (); ++i)
|
||||
q.Enqueue (e1);
|
||||
{
|
||||
q.Enqueue (e1);
|
||||
}
|
||||
NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 2, "trivial");
|
||||
}
|
||||
|
||||
@@ -387,11 +494,18 @@ AodvRqueueTest::CheckTimeout ()
|
||||
{
|
||||
NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 0, "Must be empty now");
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Unit test for AODV routing table entry
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for AODV routing table entry
|
||||
*/
|
||||
struct AodvRtableEntryTest : public TestCase
|
||||
{
|
||||
AodvRtableEntryTest () : TestCase ("RtableEntry") {}
|
||||
AodvRtableEntryTest () : TestCase ("RtableEntry")
|
||||
{
|
||||
}
|
||||
virtual void DoRun ()
|
||||
{
|
||||
Ptr<NetDevice> dev;
|
||||
@@ -466,11 +580,18 @@ struct AodvRtableEntryTest : public TestCase
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Unit test for AODV routing table
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Unit test for AODV routing table
|
||||
*/
|
||||
struct AodvRtableTest : public TestCase
|
||||
{
|
||||
AodvRtableTest () : TestCase ("Rtable") {}
|
||||
AodvRtableTest () : TestCase ("Rtable")
|
||||
{
|
||||
}
|
||||
virtual void DoRun ()
|
||||
{
|
||||
RoutingTable rtable (Seconds (2));
|
||||
@@ -519,7 +640,13 @@ struct AodvRtableTest : public TestCase
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief AODV test suite
|
||||
*/
|
||||
class AodvTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -536,7 +663,7 @@ public:
|
||||
AddTestCase (new AodvRtableEntryTest, TestCase::QUICK);
|
||||
AddTestCase (new AodvRtableTest, TestCase::QUICK);
|
||||
}
|
||||
} g_aodvTestSuite;
|
||||
} g_aodvTestSuite; ///< the test suite
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace aodv
|
||||
} // namespace ns3
|
||||
|
||||
@@ -48,16 +48,16 @@ using namespace ns3;
|
||||
//-----------------------------------------------------------------------------
|
||||
// UdpChainTest
|
||||
//-----------------------------------------------------------------------------
|
||||
Bug772ChainTest::Bug772ChainTest (const char * const prefix, const char * const proto, Time t, uint32_t size) :
|
||||
TestCase ("Bug 772 UDP and TCP chain regression test"),
|
||||
m_nodes (0),
|
||||
m_prefix (prefix),
|
||||
m_proto (proto),
|
||||
m_time (t),
|
||||
m_size (size),
|
||||
m_step (120),
|
||||
m_port (9),
|
||||
m_receivedPackets (0)
|
||||
Bug772ChainTest::Bug772ChainTest (const char * const prefix, const char * const proto, Time t, uint32_t size)
|
||||
: TestCase ("Bug 772 UDP and TCP chain regression test"),
|
||||
m_nodes (0),
|
||||
m_prefix (prefix),
|
||||
m_proto (proto),
|
||||
m_time (t),
|
||||
m_size (size),
|
||||
m_step (120),
|
||||
m_port (9),
|
||||
m_receivedPackets (0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ Bug772ChainTest::DoRun ()
|
||||
RngSeedManager::SetSeed (12345);
|
||||
RngSeedManager::SetRun (7);
|
||||
|
||||
// Default of 3 will cause packet loss
|
||||
Config::SetDefault ("ns3::ArpCache::PendingQueueSize", UintegerValue (10));
|
||||
// Default of 3 will cause packet loss
|
||||
Config::SetDefault ("ns3::ArpCache::PendingQueueSize", UintegerValue (10));
|
||||
|
||||
CreateNodes ();
|
||||
CreateDevices ();
|
||||
@@ -138,14 +138,14 @@ Bug772ChainTest::CreateDevices ()
|
||||
wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200"));
|
||||
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, *m_nodes);
|
||||
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, *m_nodes);
|
||||
|
||||
// Assign fixed stream numbers to wifi and channel random variables
|
||||
streamsUsed += wifi.AssignStreams (devices, streamsUsed);
|
||||
// Assign 6 streams per device
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (devices.GetN () * 6), "Stream assignment mismatch");
|
||||
streamsUsed += wifiChannel.AssignStreams (chan, streamsUsed);
|
||||
// Assign 0 streams per channel for this configuration
|
||||
// Assign 0 streams per channel for this configuration
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, (devices.GetN () * 6), "Stream assignment mismatch");
|
||||
|
||||
// 2. Setup TCP/IP & AODV
|
||||
@@ -155,10 +155,10 @@ Bug772ChainTest::CreateDevices ()
|
||||
internetStack.Install (*m_nodes);
|
||||
streamsUsed += internetStack.AssignStreams (*m_nodes, streamsUsed);
|
||||
// Expect to use (3*m_size) more streams for internet stack random variables
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, ((devices.GetN () * 6) + (3*m_size)), "Stream assignment mismatch");
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, ((devices.GetN () * 6) + (3 * m_size)), "Stream assignment mismatch");
|
||||
streamsUsed += aodv.AssignStreams (*m_nodes, streamsUsed);
|
||||
// Expect to use m_size more streams for AODV
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, ((devices.GetN () * 6) + (3*m_size) + m_size), "Stream assignment mismatch");
|
||||
NS_TEST_ASSERT_MSG_EQ (streamsUsed, ((devices.GetN () * 6) + (3 * m_size) + m_size), "Stream assignment mismatch");
|
||||
Ipv4AddressHelper address;
|
||||
address.SetBase ("10.1.1.0", "255.255.255.0");
|
||||
Ipv4InterfaceContainer interfaces = address.Assign (devices);
|
||||
@@ -166,7 +166,7 @@ Bug772ChainTest::CreateDevices ()
|
||||
// 3. Setup UDP source and sink
|
||||
m_sendSocket = Socket::CreateSocket (m_nodes->Get (0), TypeId::LookupByName (m_proto));
|
||||
m_sendSocket->Bind ();
|
||||
m_sendSocket->Connect (InetSocketAddress (interfaces.GetAddress (m_size-1), m_port));
|
||||
m_sendSocket->Connect (InetSocketAddress (interfaces.GetAddress (m_size - 1), m_port));
|
||||
m_sendSocket->SetAllowBroadcast (true);
|
||||
Simulator::ScheduleWithContext (m_sendSocket->GetNode ()->GetId (), Seconds (1.0),
|
||||
&Bug772ChainTest::SendData, this, m_sendSocket);
|
||||
|
||||
@@ -30,9 +30,9 @@ using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup aodv
|
||||
*
|
||||
*
|
||||
* \brief AODV deferred route lookup test case (see \bugid{772})
|
||||
*
|
||||
*
|
||||
* UDP packet transfers are delayed while a route is found and then while
|
||||
* ARP completes. Eight packets should be sent, queued until the path
|
||||
* becomes functional, and then delivered.
|
||||
@@ -42,7 +42,7 @@ class Bug772ChainTest : public TestCase
|
||||
public:
|
||||
/**
|
||||
* Create test case
|
||||
*
|
||||
*
|
||||
* \param prefix Unique file names prefix
|
||||
* \param proto ns3::UdpSocketFactory or ns3::TcpSocketFactory
|
||||
* \param size Number of nodes in the chain
|
||||
|
||||
@@ -41,10 +41,8 @@
|
||||
#include "ns3/names.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
namespace aodv
|
||||
{
|
||||
namespace ns3 {
|
||||
namespace aodv {
|
||||
|
||||
/**
|
||||
* \ingroup aodv
|
||||
@@ -54,14 +52,26 @@ namespace aodv
|
||||
class LoopbackTestCase : public TestCase
|
||||
{
|
||||
uint32_t m_count; //!< number of packet received;
|
||||
Ptr<Socket> m_txSocket;
|
||||
Ptr<Socket> m_echoSocket;
|
||||
Ptr<Socket> m_rxSocket;
|
||||
uint16_t m_echoSendPort;
|
||||
uint16_t m_echoReplyPort;
|
||||
Ptr<Socket> m_txSocket; //!< transmit socket;
|
||||
Ptr<Socket> m_echoSocket; //!< echo socket;
|
||||
Ptr<Socket> m_rxSocket; //!< receive socket;
|
||||
uint16_t m_echoSendPort; //!< echo send port;
|
||||
uint16_t m_echoReplyPort; //!< echo reply port;
|
||||
|
||||
/**
|
||||
* Send data function
|
||||
* \param socket The socket to send data
|
||||
*/
|
||||
void SendData (Ptr<Socket> socket);
|
||||
/**
|
||||
* Receive packet function
|
||||
* \param socket The socket to receive data
|
||||
*/
|
||||
void ReceivePkt (Ptr<Socket> socket);
|
||||
/**
|
||||
* Echo data function
|
||||
* \param socket The socket to echo data
|
||||
*/
|
||||
void EchoData (Ptr<Socket> socket);
|
||||
|
||||
public:
|
||||
@@ -69,8 +79,9 @@ public:
|
||||
void DoRun ();
|
||||
};
|
||||
|
||||
LoopbackTestCase::LoopbackTestCase () :
|
||||
TestCase ("UDP Echo 127.0.0.1 test"), m_count (0)
|
||||
LoopbackTestCase::LoopbackTestCase ()
|
||||
: TestCase ("UDP Echo 127.0.0.1 test"),
|
||||
m_count (0)
|
||||
{
|
||||
m_echoSendPort = 1233;
|
||||
m_echoReplyPort = 1234;
|
||||
@@ -80,7 +91,7 @@ void LoopbackTestCase::ReceivePkt (Ptr<Socket> socket)
|
||||
{
|
||||
Ptr<Packet> receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max (), 0);
|
||||
|
||||
m_count ++;
|
||||
m_count++;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -124,7 +135,7 @@ LoopbackTestCase::DoRun ()
|
||||
wifiPhy.SetChannel (wifiChannel.Create ());
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200"));
|
||||
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, nodes);
|
||||
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, nodes);
|
||||
|
||||
// Setup TCP/IP & AODV
|
||||
AodvHelper aodv; // Use default parameters here
|
||||
@@ -150,7 +161,7 @@ LoopbackTestCase::DoRun ()
|
||||
Simulator::ScheduleWithContext (m_txSocket->GetNode ()->GetId (), Seconds (1.0),
|
||||
&LoopbackTestCase::SendData, this, m_txSocket);
|
||||
|
||||
// Run
|
||||
// Run
|
||||
Simulator::Stop (Seconds (5));
|
||||
Simulator::Run ();
|
||||
|
||||
@@ -164,9 +175,12 @@ LoopbackTestCase::DoRun ()
|
||||
NS_TEST_ASSERT_MSG_EQ (m_count, 4, "Exactly 4 echo replies must be delivered.");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Test suite
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* \ingroup aodv-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief AODV Loopback test suite
|
||||
*/
|
||||
class AodvLoopbackTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -176,8 +190,8 @@ public:
|
||||
// UDP Echo loopback test case
|
||||
AddTestCase (new LoopbackTestCase (), TestCase::QUICK);
|
||||
}
|
||||
} g_aodvLoopbackTestSuite;
|
||||
} g_aodvLoopbackTestSuite; ///< the test suite
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace aodv
|
||||
} // namespace ns3
|
||||
|
||||
Reference in New Issue
Block a user