From 6c5dad7368e9a51dcc3e0ee1ee7e3fe3cc249ff0 Mon Sep 17 00:00:00 2001 From: Pavel Boyko Date: Fri, 20 Nov 2009 13:06:15 +0300 Subject: [PATCH] [olsr] Two basic trace based OLSR regression tests added together with reference traces --- .../olsr/test/hello-regression-test.cc | 111 ++++++++++++++ src/routing/olsr/test/hello-regression-test.h | 69 +++++++++ .../test/olsr-hello-regression-test-0-1.pcap | Bin 0 -> 420 bytes .../test/olsr-hello-regression-test-1-1.pcap | Bin 0 -> 420 bytes .../test/olsr-tc-regression-test-0-1.pcap | Bin 0 -> 2024 bytes .../test/olsr-tc-regression-test-1-1.pcap | Bin 0 -> 3024 bytes .../test/olsr-tc-regression-test-2-1.pcap | Bin 0 -> 2024 bytes .../olsr/test/regression-test-suite.cc | 38 +++++ src/routing/olsr/test/tc-regression-test.cc | 135 ++++++++++++++++++ src/routing/olsr/test/tc-regression-test.h | 96 +++++++++++++ src/routing/olsr/wscript | 3 + 11 files changed, 452 insertions(+) create mode 100644 src/routing/olsr/test/hello-regression-test.cc create mode 100644 src/routing/olsr/test/hello-regression-test.h create mode 100644 src/routing/olsr/test/olsr-hello-regression-test-0-1.pcap create mode 100644 src/routing/olsr/test/olsr-hello-regression-test-1-1.pcap create mode 100644 src/routing/olsr/test/olsr-tc-regression-test-0-1.pcap create mode 100644 src/routing/olsr/test/olsr-tc-regression-test-1-1.pcap create mode 100644 src/routing/olsr/test/olsr-tc-regression-test-2-1.pcap create mode 100644 src/routing/olsr/test/regression-test-suite.cc create mode 100644 src/routing/olsr/test/tc-regression-test.cc create mode 100644 src/routing/olsr/test/tc-regression-test.h diff --git a/src/routing/olsr/test/hello-regression-test.cc b/src/routing/olsr/test/hello-regression-test.cc new file mode 100644 index 000000000..5b50ff432 --- /dev/null +++ b/src/routing/olsr/test/hello-regression-test.cc @@ -0,0 +1,111 @@ +/* -*- 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 + */ + +#include "hello-regression-test.h" +#include "ns3/simulator.h" +#include "ns3/random-variable.h" +#include "ns3/double.h" +#include "ns3/uinteger.h" +#include "ns3/string.h" +#include "ns3/pcap-file.h" +#include "ns3/olsr-helper.h" +#include "ns3/internet-stack-helper.h" +#include "ns3/point-to-point-helper.h" +#include "ns3/ipv4-address-helper.h" +#include "ns3/abort.h" + +/// Set to true to rewrite reference traces, leave false to run regression tests +const bool WRITE_VECTORS = false; + +namespace ns3 +{ +namespace olsr +{ + +const char * const HelloRegressionTest::PREFIX = "olsr-hello-regression-test"; + +HelloRegressionTest::HelloRegressionTest() : + TestCase ("Test OLSR Hello messages generation"), + m_time (Seconds (5)) +{ +} + +HelloRegressionTest::~HelloRegressionTest() +{ +} + +bool +HelloRegressionTest::DoRun () +{ + SeedManager::SetSeed(12345); + CreateNodes (); + + Simulator::Stop (m_time); + Simulator::Run (); + Simulator::Destroy (); + + if (!WRITE_VECTORS) CheckResults (); + return GetErrorStatus (); +} + +void +HelloRegressionTest::CreateNodes () +{ + // create 2 nodes + NodeContainer c; + c.Create (2); + // install TCP/IP & OLSR + OlsrHelper olsr; + InternetStackHelper internet; + internet.SetRoutingHelper (olsr); + internet.Install (c); + // create p2p channel & devices + PointToPointHelper p2p; + p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); + p2p.SetChannelAttribute ("Delay", StringValue ("2ms")); + NetDeviceContainer nd = p2p.Install (c); + // setup IP addresses + Ipv4AddressHelper ipv4; + ipv4.SetBase ("10.1.1.0", "255.255.255.0"); + ipv4.Assign (nd); + // setup PCAP traces + std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : GetTempDir ()) + PREFIX; + p2p.EnablePcapAll (prefix); +} + +void +HelloRegressionTest::CheckResults () +{ + for (uint32_t 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); + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + << " differ starting from " << sec << " s " << usec << " us"); + } +} + +} +} diff --git a/src/routing/olsr/test/hello-regression-test.h b/src/routing/olsr/test/hello-regression-test.h new file mode 100644 index 000000000..e43f1890b --- /dev/null +++ b/src/routing/olsr/test/hello-regression-test.h @@ -0,0 +1,69 @@ +/* -*- 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 + */ + +#ifndef HELLOREGRESSIONTEST_H_ +#define HELLOREGRESSIONTEST_H_ +#include "ns3/test.h" +#include "ns3/nstime.h" +#include "ns3/node-container.h" + +namespace ns3 +{ +namespace olsr +{ +/** + * \ingroup olsr + * \brief Trivial (still useful) test of OLSR operation + * + * This test creates 2 stations with point-to-point link and runs OLSR without any extra traffic. + * It is expected that only HELLO messages will be sent. + * + * Expected trace (5 seconds): + \verbatim + 1 2 + |------>| HELLO (empty) src = 10.1.1.1 + |<------| HELLO (empty) src = 10.1.1.2 + |------>| HELLO (Link type: Asymmetric link, Neighbor address: 10.1.1.2) src = 10.1.1.1 + |<------| HELLO (Link type: Asymmetric link, Neighbor address: 10.1.1.1) src = 10.1.1.2 + |------>| HELLO (Link type: Symmetric link, Neighbor address: 10.1.1.2) src = 10.1.1.1 + |<------| HELLO (Link type: Symmetric link, Neighbor address: 10.1.1.1) src = 10.1.1.2 + \endverbatim + */ +class HelloRegressionTest : public TestCase +{ +public: + HelloRegressionTest (); + ~HelloRegressionTest (); +private: + /// Unique PCAP files prefix for this test + static const char * const PREFIX; + /// Total simulation time + const Time m_time; + /// Create & configure test network + void CreateNodes (); + /// Compare traces with reference ones + void CheckResults (); + /// Go + bool DoRun (); +}; + +} +} +#endif /* HELLOREGRESSIONTEST_H_ */ diff --git a/src/routing/olsr/test/olsr-hello-regression-test-0-1.pcap b/src/routing/olsr/test/olsr-hello-regression-test-0-1.pcap new file mode 100644 index 0000000000000000000000000000000000000000..d100c17dbcc0e923292aa712447735c54462a1bf GIT binary patch literal 420 zcmca|c+)~A1{MYw`2U}QffLFRp3T5u1Z0CSgQ6<~g8_))AjrVL#mLAA#Q&LgG3{cI z0SbyRFfg_;2!O;HL5djKm_ei_7dvhfm~fcD1T%pNXu|&=Oz0*6rE$1{5y=feRc*{5 z6JAL&<2C`^4KNcxZUCDA3YqS9R&*192IFu86OtQ%s@j-ACNSM#!)*e(8(=1Y+yFKK E0FuTkPyhe` literal 0 HcmV?d00001 diff --git a/src/routing/olsr/test/olsr-hello-regression-test-1-1.pcap b/src/routing/olsr/test/olsr-hello-regression-test-1-1.pcap new file mode 100644 index 0000000000000000000000000000000000000000..4e4d5f5b28c15efc6b269299d3d5cfbe1d1e70e1 GIT binary patch literal 420 zcmaKoF$%&!5JmsYsv%YeECtC8LcBm4uePmc5KBADw01T&p1_N2<_8zT!niQY?Cj_9 zn9uWZRjiOtN#Ex@e2r=-kwekt-5Hu6i z2uBGe!M+^_SvXiK1`=M)A42Jn33QkV+|2#5E*%W)IOxK`QZbP5eQ$h1>5vI@mFbz0?c6piMqGAW~B*9+N|*y#vV)t9*w|*tBi**2A_~&Js>0Xa18PA zj5agYR%SNve2iibZZPo30uQb-9>Ta^!pyA)WTYOBAs(L5WybLlT)UPrjy;;*BV{y$ z`QR$!A&g!Q^Qe{`Wss51hhxZmc*Z(2PQKvUwT#QygBJ?OBM0Xa18PAj16Y|-a>}W<1zN=K#xw~!BxgX7!OZ%|AUZ`dN_u7 Gc*Z{uwJ0?J literal 0 HcmV?d00001 diff --git a/src/routing/olsr/test/olsr-tc-regression-test-1-1.pcap b/src/routing/olsr/test/olsr-tc-regression-test-1-1.pcap new file mode 100644 index 0000000000000000000000000000000000000000..4886ba15d41acef6f17b9ef18fe59a8bbd26d5d7 GIT binary patch literal 3024 zcmai$ziSjx5XayCy1PV?OAsL-A}IwSm0)EM0+tdiQ`m{v*w|Re5#$gn8?gz9m5@fT zyeJqfgjCA;&sd%Fy*KmN8ThhGZn^Bv?dRt6o%guEKfiveQ=9Bqtx|fb|14iN>5;t0 zYcfk|wLaE2^9SU7dfMP_I!I{`clNhZ+N`QtUaNXhFVc0ncr~SJo~F27p(xGqq4n`$ zMj73@K+c5G5JnRjcW#YXANhO8nJ_BCsQQdrzUaLt)c|Aa8S(&i6&aPf0z>|?D=^+4 zQ-->tjOfZ3aOD`!zO<|l&73k~=Egwgg@K3cY}Esdo8FZ)Pv)xb&6QMTS75yPP3KB8 zr;M0~F_4F2?Eav0rFl?B%)=PSqcBF&$Jt>w;A+pilJ1DBrsqnkvMVr7zEOs{qKxRu z7;xnnZ(k3&qKxRu7;se>6Y1l4nfEHbU+sHWGAP7V+jAvV*%cVuf9UM0E6Rwji~(1U zacMMWnd@9pMs#HixGIcI>Em#Rx>CkN?@F$!tH|io6&O;LU4gNDK=%@LMH$hRG2qHE z<{h0~=~s@HGU9$^4D45haakU5qaE6JAA47_sEDgk&y`eVS72Oxr~8%mK^d_RW1tVm zxVsq2gEC?s#y}p0aYgz#*`@14`*`kMjf<<;$GEo!r7F7uWAbWfFQJS$yT-umI>z~o zu0fq$%80Iv0at}Fl|DWn(KV>9X5N)-KxDs~^jt|*b_K?-3z~=aK^d_RW1tVm_;;Jm zm8>He6%M-RlVwq<_4VS z^Ng?3A<>Ypj0Qwqr8JI8FZ6=8vAId4rqt(s#X&UXo9eYb5gBG*^znx$+Et$ZVh+7(1~C{+Lh?9n=F+ z#)BCzABDuQxe^&^t{j7N9_SXqBMUqbWjvUn9-BNwM(W`h?BN-0 zFjkgkHstvj#U8K|JX(PVqKpSK9`aJkm92-!NIe{bJv^fe#@CkUVHroU2X=+|$baV-<{Nm~k!ssE749k3G;Rf=3Z}Aj)_!WBe|@uWav%jMT$1 z*uyh=VC?NS&G}{QQF@P*Q3id5DC5D5yW6Ju5E*G-IR^KYXY|1so{4>Bb2W)Q(D1^1 zv;z-B84qS$?ThbSTXT_-dN>Aqc*X`83xNLbtEbqb<2_PFC+I6g84qTBUpLiUWTZ8B J4DKt>_yzQDCJz7r literal 0 HcmV?d00001 diff --git a/src/routing/olsr/test/regression-test-suite.cc b/src/routing/olsr/test/regression-test-suite.cc new file mode 100644 index 000000000..3d5e7b1fb --- /dev/null +++ b/src/routing/olsr/test/regression-test-suite.cc @@ -0,0 +1,38 @@ +/* -*- 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 + */ + +#include "hello-regression-test.h" +#include "tc-regression-test.h" + +namespace ns3 { +namespace olsr { + +class RegressionTestSuite : public TestSuite +{ +public: + RegressionTestSuite () : TestSuite ("routing-olsr-regression", SYSTEM) + { + AddTestCase (new HelloRegressionTest); + AddTestCase (new TcRegressionTest); + } +} g_olsrRegressionTestSuite; + +} +} diff --git a/src/routing/olsr/test/tc-regression-test.cc b/src/routing/olsr/test/tc-regression-test.cc new file mode 100644 index 000000000..c3286919c --- /dev/null +++ b/src/routing/olsr/test/tc-regression-test.cc @@ -0,0 +1,135 @@ +/* -*- 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 + */ + +#include "tc-regression-test.h" +#include "ns3/simulator.h" +#include "ns3/random-variable.h" +#include "ns3/double.h" +#include "ns3/uinteger.h" +#include "ns3/string.h" +#include "ns3/pcap-file.h" +#include "ns3/olsr-helper.h" +#include "ns3/internet-stack-helper.h" +#include "ns3/point-to-point-helper.h" +#include "ns3/ipv4-address-helper.h" +#include "ns3/abort.h" +#include "ns3/yans-wifi-helper.h" +#include "ns3/mobility-helper.h" +#include "ns3/nqos-wifi-mac-helper.h" + +/// Set to true to rewrite reference traces, leave false to run regression tests +const bool WRITE_VECTORS = false; + +namespace ns3 +{ +namespace olsr +{ + +const char * const TcRegressionTest::PREFIX = "olsr-tc-regression-test"; + +TcRegressionTest::TcRegressionTest() : + TestCase ("Test OLSR Topology Control message generation"), + m_time (Seconds (20)), + m_step (120) +{ +} + +TcRegressionTest::~TcRegressionTest() +{ +} + +bool +TcRegressionTest::DoRun () +{ + SeedManager::SetSeed(12345); + CreateNodes (); + + Simulator::Stop (m_time); + Simulator::Run (); + Simulator::Destroy (); + + if (!WRITE_VECTORS) CheckResults (); + return GetErrorStatus (); +} + +void +TcRegressionTest::CreateNodes () +{ + // create 3 nodes + NodeContainer c; + c.Create (3); + + // place nodes in the chain + MobilityHelper mobility; + mobility.SetPositionAllocator ("ns3::GridPositionAllocator", + "MinX", DoubleValue (0.0), + "MinY", DoubleValue (0.0), + "DeltaX", DoubleValue (m_step), + "DeltaY", DoubleValue (0), + "GridWidth", UintegerValue (3), + "LayoutType", StringValue ("RowFirst")); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); + mobility.Install (c); + + // install TCP/IP & OLSR + OlsrHelper olsr; + InternetStackHelper internet; + internet.SetRoutingHelper (olsr); + internet.Install (c); + + // create wifi channel & devices + NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); + wifiMac.SetType ("ns3::AdhocWifiMac"); + YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); + YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); + wifiPhy.SetChannel (wifiChannel.Create ()); + WifiHelper wifi = WifiHelper::Default (); + wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-6mbs"), "RtsCtsThreshold", StringValue ("2200")); + NetDeviceContainer nd = wifi.Install (wifiPhy, wifiMac, c); + + // setup IP addresses + Ipv4AddressHelper ipv4; + ipv4.SetBase ("10.1.1.0", "255.255.255.0"); + ipv4.Assign (nd); + + // setup PCAP traces + std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : GetTempDir ()) + PREFIX; + wifiPhy.EnablePcapAll (prefix); +} + +void +TcRegressionTest::CheckResults () +{ + for (uint32_t i = 0; i < 3; ++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); + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + << " differ starting from " << sec << " s " << usec << " us"); + } +} + +} +} diff --git a/src/routing/olsr/test/tc-regression-test.h b/src/routing/olsr/test/tc-regression-test.h new file mode 100644 index 000000000..db6610a13 --- /dev/null +++ b/src/routing/olsr/test/tc-regression-test.h @@ -0,0 +1,96 @@ +/* -*- 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 + */ + +#ifndef TCREGRESSIONTEST_H_ +#define TCREGRESSIONTEST_H_ +#include "ns3/test.h" +#include "ns3/nstime.h" +#include "ns3/node-container.h" + +namespace ns3 +{ +namespace olsr +{ +/** + * \ingroup olsr + * \brief Less trivial test of OLSR Topology Control message generation + * + * This test creates 3 WiFi stations with chain topology and runs OLSR without any extra traffic. + * It is expected that only second station will send TC messages. + * + * Expected trace (20 seconds, note random b-cast jitter): + \verbatim + 1 2 3 + |<------|------>| HELLO (empty) src = 10.1.1.2 + | |<------|------> HELLO (empty) src = 10.1.1.3 + <------|------>| | HELLO (empty) src = 10.1.1.1 + <------|------>| | HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src = 10.1.1.1 + | |<------|------> HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src = 10.1.1.3 + |<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + |<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + <------|------>| | HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src = 10.1.1.1 + | |<------|------> HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src = 10.1.1.3 + |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1 + | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3 + |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1 + | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3 + |<======|======>| TC (10.1.1.3; 10.1.1.1) + HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3 + <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1 + |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1 + | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3 + <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1 + | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3 + |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + |<======|======>| TC (10.1.1.3; 10.1.1.1) src = 10.1.1.2 + | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3 + <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1 + |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1 + | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3 + |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 + \endverbatim + */ +class TcRegressionTest : public TestCase +{ +public: + TcRegressionTest(); + ~TcRegressionTest(); +private: + /// Unique PCAP files prefix for this test + static const char * const PREFIX; + /// Total simulation time + const Time m_time; + /// Distance between nodes in meters, 0.8 of RX range is recommended + const double m_step; + /// Create & configure test network + void CreateNodes (); + /// Compare traces with reference ones + void CheckResults (); + /// Go + bool DoRun (); +}; + +} +} +#endif /* TCREGRESSIONTEST_H_ */ diff --git a/src/routing/olsr/wscript b/src/routing/olsr/wscript index 7170e4478..83f821fbe 100644 --- a/src/routing/olsr/wscript +++ b/src/routing/olsr/wscript @@ -7,6 +7,9 @@ def build(bld): 'olsr-header.cc', 'olsr-state.cc', 'olsr-routing-protocol.cc', + 'test/regression-test-suite.cc', + 'test/hello-regression-test.cc', + 'test/tc-regression-test.cc', ] headers = bld.new_task_gen('ns3header')