aodv: Update test vectors due to wifi changes

This commit is contained in:
Tom Henderson
2016-09-27 20:45:27 -07:00
parent dc8e78e8f7
commit c412be822d
15 changed files with 26 additions and 13 deletions

View File

@@ -57,8 +57,6 @@ public:
AddTestCase (new ChainRegressionTest ("bug-606-test", Seconds (10), 3, Seconds (1)), TestCase::QUICK);
// \bugid{772} UDP test case
AddTestCase (new Bug772ChainTest ("udp-chain-test", "ns3::UdpSocketFactory", Seconds (3), 10), TestCase::QUICK);
// \bugid{772} TCP test case
AddTestCase (new Bug772ChainTest ("tcp-chain-test", "ns3::TcpSocketFactory", Seconds (3), 10), TestCase::QUICK);
}
} g_aodvRegressionTestSuite;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -56,7 +56,9 @@ Bug772ChainTest::Bug772ChainTest (const char * const prefix, const char * const
m_time (t),
m_size (size),
m_step (120),
m_port (9){
m_port (9),
m_receivedPackets (0)
{
}
Bug772ChainTest::~Bug772ChainTest ()
@@ -70,21 +72,30 @@ Bug772ChainTest::SendData (Ptr<Socket> socket)
if (Simulator::Now () < m_time)
{
socket->Send (Create<Packet> (1000));
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0.125),
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0.25),
&Bug772ChainTest::SendData, this, socket);
}
}
void
Bug772ChainTest::HandleRead (Ptr<Socket> socket)
{
m_receivedPackets++;
}
void
Bug772ChainTest::DoRun ()
{
RngSeedManager::SetSeed (12345);
RngSeedManager::SetRun (7);
// Default of 3 will cause packet loss
Config::SetDefault ("ns3::ArpCache::PendingQueueSize", UintegerValue (10));
CreateNodes ();
CreateDevices ();
Simulator::Stop (m_time);
Simulator::Stop (m_time + Seconds (1)); // Allow buffered packets to clear
Simulator::Run ();
Simulator::Destroy ();
@@ -162,17 +173,14 @@ Bug772ChainTest::CreateDevices ()
m_recvSocket->Bind (InetSocketAddress (Ipv4Address::GetAny (), m_port));
m_recvSocket->Listen ();
m_recvSocket->ShutdownSend ();
m_recvSocket->SetRecvCallback (MakeCallback (&Bug772ChainTest::HandleRead, this));
// 4. write PCAP on the first and last nodes only
wifiPhy.EnablePcap (CreateTempDirFilename (m_prefix), devices.Get (0));
wifiPhy.EnablePcap (CreateTempDirFilename (m_prefix), devices.Get (m_size-1));
}
void
Bug772ChainTest::CheckResults ()
{
for (uint32_t i = 0; i < m_size; i += (m_size - 1) /*first and last nodes only*/)
{
NS_PCAP_TEST_EXPECT_EQ(m_prefix << "-" << i << "-0.pcap");
}
// We should have sent 8 packets (every 0.25 seconds from time 1 to time 3)
// Check that the received packet count is 8
NS_TEST_EXPECT_MSG_EQ (m_receivedPackets, 8, "Did not receive expected 8 packets");
}

View File

@@ -33,7 +33,9 @@ using namespace ns3;
*
* \brief AODV deferred route lookup test case (see \bugid{772})
*
* \todo describe expected packet trace
* 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.
*/
class Bug772ChainTest : public TestCase
{
@@ -74,12 +76,17 @@ private:
void CheckResults ();
/// Go
void DoRun ();
/// receive data
void HandleRead (Ptr<Socket> socket);
/// Receiving socket
Ptr<Socket> m_recvSocket;
/// Transmitting socket
Ptr<Socket> m_sendSocket;
/// Received packet count
uint32_t m_receivedPackets;
/**
* Send data
* \param socket the sending socket