Adding necessary patches to run NDN module
diff --git a/README b/README
new file mode 100644
index 0000000..d0bf73d
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+NDN module requires a number of patches to be applied on NS-3.
+Patches are in patches/ folder
diff --git a/patches/0001-point-to-point-Add-support-of-PPP-Ethernet-and-Ether.patch b/patches/0001-point-to-point-Add-support-of-PPP-Ethernet-and-Ether.patch
new file mode 100644
index 0000000..2af712e
--- /dev/null
+++ b/patches/0001-point-to-point-Add-support-of-PPP-Ethernet-and-Ether.patch
@@ -0,0 +1,49 @@
+From 4a928511196fd80e9e9c43646d916e2d6fbc3190 Mon Sep 17 00:00:00 2001
+From: Ilya Moiseenko <iliamo@ucla.edu>
+Date: Thu, 1 Sep 2011 17:41:00 -0700
+Subject: [PATCH] point-to-point: Add support of PPP->Ethernet and
+ Ethernet->PPP frame type conversion for CCNx protocol
+
+point-to-point: Adding support for CCNx payload in PppHeader::Print method
+---
+ src/point-to-point/model/point-to-point-net-device.cc | 2 ++
+ src/point-to-point/model/ppp-header.cc | 3 +++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/src/point-to-point/model/point-to-point-net-device.cc b/src/point-to-point/model/point-to-point-net-device.cc
+index ca81c53..775ef00 100644
+--- a/src/point-to-point/model/point-to-point-net-device.cc
++++ b/src/point-to-point/model/point-to-point-net-device.cc
+@@ -607,6 +607,7 @@ PointToPointNetDevice::PppToEther (uint16_t proto)
+ {
+ case 0x0021: return 0x0800; //IPv4
+ case 0x0057: return 0x86DD; //IPv6
++ case 0x0077: return 0x7777; //CCNx
+ default: NS_ASSERT_MSG (false, "PPP Protocol number not defined!");
+ }
+ return 0;
+@@ -619,6 +620,7 @@ PointToPointNetDevice::EtherToPpp (uint16_t proto)
+ {
+ case 0x0800: return 0x0021; //IPv4
+ case 0x86DD: return 0x0057; //IPv6
++ case 0x7777: return 0x0077; //CCNx
+ default: NS_ASSERT_MSG (false, "PPP Protocol number not defined!");
+ }
+ return 0;
+diff --git a/src/point-to-point/model/ppp-header.cc b/src/point-to-point/model/ppp-header.cc
+index 4650fb0..7e000bd 100644
+--- a/src/point-to-point/model/ppp-header.cc
++++ b/src/point-to-point/model/ppp-header.cc
+@@ -66,6 +66,9 @@ PppHeader::Print (std::ostream &os) const
+ case 0x0057: /* IPv6 */
+ proto = "IPv6 (0x0057)";
+ break;
++ case 0x0077: /* CCNx */
++ proto = "CCNx (0x0077)";
++ break;
+ default:
+ NS_ASSERT_MSG (false, "PPP Protocol number not defined!");
+ }
+--
+1.7.10.2
+
diff --git a/patches/0001-point-to-point-netanim-Adding-ChannelID-to-PointToPo.patch b/patches/0001-point-to-point-netanim-Adding-ChannelID-to-PointToPo.patch
new file mode 100644
index 0000000..f327f6a
--- /dev/null
+++ b/patches/0001-point-to-point-netanim-Adding-ChannelID-to-PointToPo.patch
@@ -0,0 +1,72 @@
+From 9ed23508a72afd3780b041b2fd00a50e1ff91b4c Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Mon, 23 Apr 2012 13:49:37 -0700
+Subject: [PATCH] point-to-point, netanim: Adding ChannelID to
+ PointToPointChannel trace
+
+---
+ src/netanim/model/animation-interface.cc | 4 +++-
+ src/netanim/model/animation-interface.h | 3 ++-
+ src/point-to-point/model/point-to-point-channel.cc | 2 +-
+ src/point-to-point/model/point-to-point-channel.h | 3 ++-
+ 4 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc
+index d6a3551..9215abf 100644
+--- a/src/netanim/model/animation-interface.cc
++++ b/src/netanim/model/animation-interface.cc
+@@ -676,7 +676,9 @@ void AnimationInterface::WriteDummyPacket ()
+
+
+ }
+-void AnimationInterface::DevTxTrace (std::string context, Ptr<const Packet> p,
++void AnimationInterface::DevTxTrace (std::string context,
++ uint32_t, // channel
++ Ptr<const Packet> p,
+ Ptr<NetDevice> tx, Ptr<NetDevice> rx,
+ Time txTime, Time rxTime)
+ {
+diff --git a/src/netanim/model/animation-interface.h b/src/netanim/model/animation-interface.h
+index 4a3ffb9..db58d89 100644
+--- a/src/netanim/model/animation-interface.h
++++ b/src/netanim/model/animation-interface.h
+@@ -288,7 +288,8 @@ private:
+ bool ServerPortSet;
+
+ void DevTxTrace (std::string context,
+- Ptr<const Packet> p,
++ uint32_t,
++ Ptr<const Packet> p,
+ Ptr<NetDevice> tx,
+ Ptr<NetDevice> rx,
+ Time txTime,
+diff --git a/src/point-to-point/model/point-to-point-channel.cc b/src/point-to-point/model/point-to-point-channel.cc
+index d6a6938..5bc4c9c 100644
+--- a/src/point-to-point/model/point-to-point-channel.cc
++++ b/src/point-to-point/model/point-to-point-channel.cc
+@@ -98,7 +98,7 @@ PointToPointChannel::TransmitStart (
+ m_link[wire].m_dst, p);
+
+ // Call the tx anim callback on the net device
+- m_txrxPointToPoint (p, src, m_link[wire].m_dst, txTime, txTime + m_delay);
++ m_txrxPointToPoint (GetId (), p, src, m_link[wire].m_dst, txTime, txTime + m_delay);
+ return true;
+ }
+
+diff --git a/src/point-to-point/model/point-to-point-channel.h b/src/point-to-point/model/point-to-point-channel.h
+index 4b0b777..a364ab9 100644
+--- a/src/point-to-point/model/point-to-point-channel.h
++++ b/src/point-to-point/model/point-to-point-channel.h
+@@ -137,7 +137,8 @@ private:
+ *
+ * @see class CallBackTraceSource
+ */
+- TracedCallback<Ptr<const Packet>, // Packet being transmitted
++ TracedCallback<uint32_t, // channel ID
++ Ptr<const Packet>, // Packet being transmitted
+ Ptr<NetDevice>, // Transmitting NetDevice
+ Ptr<NetDevice>, // Receiving NetDevice
+ Time, // Amount of time to transmit the pkt
+--
+1.7.10.2
+
diff --git a/patches/0002-core-openflow-Moving-boost-related-configuration-to-.patch b/patches/0002-core-openflow-Moving-boost-related-configuration-to-.patch
new file mode 100644
index 0000000..0e226e3
--- /dev/null
+++ b/patches/0002-core-openflow-Moving-boost-related-configuration-to-.patch
@@ -0,0 +1,73 @@
+From 63e2f7d75601540169f62dea0b8aa17fda34812a Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Wed, 29 Feb 2012 10:07:08 -0800
+Subject: [PATCH] core+openflow: Moving `boost`-related configuration to main
+ wscript.
+
+There is a problem when two different modules require different boost
+libs. Only requirements of the last module are actually picked up by
+the build system.
+---
+ src/openflow/wscript | 10 +---------
+ wscript | 9 +++++++++
+ 2 files changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/src/openflow/wscript b/src/openflow/wscript
+index b18d2c1..21c483a 100644
+--- a/src/openflow/wscript
++++ b/src/openflow/wscript
+@@ -2,23 +2,15 @@
+
+ import os
+ import Options
++import Logs
+ from waflib.Errors import WafError
+
+ def options(opt):
+ opt.add_option('--with-openflow',
+ help=('Path to OFSID source for NS-3 OpenFlow Integration support'),
+ default='', dest='with_openflow')
+- opt.tool_options('boost', tooldir=["waf-tools"])
+
+ def configure(conf):
+- try:
+- conf.check_tool('boost')
+- conf.check_boost(lib='signals filesystem')
+- if not conf.env.LIB_BOOST:
+- conf.check_boost(lib='signals filesystem', libpath="/usr/lib64")
+- except WafError:
+- conf.env['LIB_BOOST'] = []
+-
+ if not conf.env.LIB_BOOST:
+ conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
+ "Required boost libraries not found")
+diff --git a/wscript b/wscript
+index 05440fa..c60fd18 100644
+--- a/wscript
++++ b/wscript
+@@ -125,6 +125,7 @@ def options(opt):
+ opt.load('compiler_cxx')
+ opt.load('cflags')
+ opt.load('gnu_dirs')
++ opt.tool_options('boost', tooldir=["waf-tools"])
+
+ opt.add_option('--cwd',
+ help=('Set the working directory for a program.'),
+@@ -364,6 +365,14 @@ def configure(conf):
+ conf.report_optional_feature("static", "Static build", False,
+ "Link flag -Wl,--whole-archive,-Bstatic does not work")
+
++ try:
++ conf.check_tool('boost')
++ conf.check_boost(lib='signals filesystem iostreams regex')
++ if not conf.env.LIB_BOOST:
++ conf.check_boost(lib='signals filesystem iostreams regex', libpath="/usr/lib64")
++ except WafError:
++ conf.env['LIB_BOOST'] = []
++
+ # Set this so that the lists won't be printed at the end of this
+ # configure command.
+ conf.env['PRINT_BUILT_MODULES_AT_END'] = False
+--
+1.7.10.2
+
diff --git a/patches/0003-internet-Making-rtt-estimator.h-of-the-Internet-modu.patch b/patches/0003-internet-Making-rtt-estimator.h-of-the-Internet-modu.patch
new file mode 100644
index 0000000..67072de
--- /dev/null
+++ b/patches/0003-internet-Making-rtt-estimator.h-of-the-Internet-modu.patch
@@ -0,0 +1,25 @@
+From 55b3eea8f073c83e1dfccdf7e43c5746aea0af68 Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Mon, 9 Jan 2012 18:39:26 -0800
+Subject: [PATCH] internet: Making rtt-estimator.h of the Internet module
+ accessible to other modules
+
+---
+ src/internet/wscript | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/internet/wscript b/src/internet/wscript
+index e250a1e..0090ae3 100644
+--- a/src/internet/wscript
++++ b/src/internet/wscript
+@@ -279,6 +279,7 @@ def build(bld):
+ 'helper/ipv6-interface-container.h',
+ 'helper/ipv6-routing-helper.h',
+ 'model/ipv6-address-generator.h',
++ 'model/rtt-estimator.h',
+ ]
+
+ if bld.env['NSC_ENABLED']:
+--
+1.7.10.2
+
diff --git a/patches/0004-visualizer-Adding-plugin-to-display-a-CCNx-FIB-state.patch b/patches/0004-visualizer-Adding-plugin-to-display-a-CCNx-FIB-state.patch
new file mode 100644
index 0000000..450c374
--- /dev/null
+++ b/patches/0004-visualizer-Adding-plugin-to-display-a-CCNx-FIB-state.patch
@@ -0,0 +1,108 @@
+From 84d6db685c4ee5cbce89b4424c68f5d40c2b976b Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Wed, 29 Feb 2012 16:59:59 -0800
+Subject: [PATCH] visualizer: Adding plugin to display a CCNx FIB state
+
+---
+ src/visualizer/visualizer/plugins/ccnx_fib.py | 89 +++++++++++++++++++++++++
+ 1 file changed, 89 insertions(+)
+ create mode 100644 src/visualizer/visualizer/plugins/ccnx_fib.py
+
+diff --git a/src/visualizer/visualizer/plugins/ccnx_fib.py b/src/visualizer/visualizer/plugins/ccnx_fib.py
+new file mode 100644
+index 0000000..3f09212
+--- /dev/null
++++ b/src/visualizer/visualizer/plugins/ccnx_fib.py
+@@ -0,0 +1,89 @@
++import gtk
++
++import ns.core
++import ns.network
++import ns.internet
++import ns.NDNabstraction
++
++from visualizer.base import InformationWindow
++
++class ShowCcnxFib(InformationWindow):
++ (
++ COLUMN_PREFIX,
++ COLUMN_FACE
++ ) = range(2)
++
++ def __init__(self, visualizer, node_index):
++ InformationWindow.__init__(self)
++ self.win = gtk.Dialog(parent=visualizer.window,
++ flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
++ buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
++ self.win.connect("response", self._response_cb)
++
++ self.node = ns.network.NodeList.GetNode (node_index)
++ node_name = ns.core.Names.FindName (self.node)
++
++ title = "CCNx FIB for node %i" % node_index
++ if len(node_name) != 0:
++ title += " (" + str(node_name) + ")"
++
++ self.win.set_title (title)
++ self.visualizer = visualizer
++ self.node_index = node_index
++
++ self.table_model = gtk.ListStore(str, str, int)
++
++ treeview = gtk.TreeView(self.table_model)
++ treeview.show()
++ sw = gtk.ScrolledWindow()
++ sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
++ vscrollbar_policy=gtk.POLICY_AUTOMATIC)
++ sw.show()
++ sw.add(treeview)
++ self.win.vbox.add(sw)
++ self.win.set_default_size(600, 300)
++
++ # Dest.
++ column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(),
++ text=self.COLUMN_PREFIX)
++ treeview.append_column(column)
++
++ # Interface
++ column = gtk.TreeViewColumn('faceType[nodeId](routingCost,status,metric)', gtk.CellRendererText(),
++ text=self.COLUMN_FACE)
++ treeview.append_column(column)
++
++ self.visualizer.add_information_window(self)
++ self.win.show()
++
++ def _response_cb(self, win, response):
++ self.win.destroy()
++ self.visualizer.remove_information_window(self)
++
++ def update(self):
++ ccnxFib = self.node.GetObject(ns.NDNabstraction.CcnxFib.GetTypeId())
++
++ if ccnxFib is None:
++ return
++
++ self.table_model.clear()
++
++ for fibI in range(ccnxFib.GetCcnxFibEntryCount()):
++ entry = ccnxFib.GetCcnxFibEntry(fibI)
++ tree_iter = self.table_model.append()
++ self.table_model.set(tree_iter,
++ self.COLUMN_PREFIX, str(entry.GetPrefix()),
++ self.COLUMN_FACE, str(entry))
++
++def populate_node_menu(viz, node, menu):
++ menu_item = gtk.MenuItem("Show CCNx FIB")
++ menu_item.show()
++
++ def _show_ccnx_fib(dummy_menu_item):
++ ShowCcnxFib(viz, node.node_index)
++
++ menu_item.connect("activate", _show_ccnx_fib)
++ menu.add(menu_item)
++
++def register(viz):
++ viz.connect("populate-node-menu", populate_node_menu)
+--
+1.7.10.2
+
diff --git a/patches/0005-visualizer-temporary-fix-for-the-visualizer-related-.patch b/patches/0005-visualizer-temporary-fix-for-the-visualizer-related-.patch
new file mode 100644
index 0000000..b30ac72
--- /dev/null
+++ b/patches/0005-visualizer-temporary-fix-for-the-visualizer-related-.patch
@@ -0,0 +1,44 @@
+From ebfeccd51ba1259e01a5bef3925719a88c3ac040 Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Mon, 23 Apr 2012 13:45:51 -0700
+Subject: [PATCH] visualizer: temporary fix for the visualizer-related bugs
+ (asserts)
+
+---
+ src/core/model/type-id.cc | 3 ++-
+ src/visualizer/model/pyviz.cc | 5 +++--
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/model/type-id.cc b/src/core/model/type-id.cc
+index e51e1e9..1368b85 100644
+--- a/src/core/model/type-id.cc
++++ b/src/core/model/type-id.cc
+@@ -149,7 +149,8 @@ IidManager::AddConstructor (uint16_t uid, ns3::Callback<ns3::ObjectBase *> callb
+ struct IidInformation *information = LookupInformation (uid);
+ if (information->hasConstructor)
+ {
+- NS_FATAL_ERROR (information->name<<" already has a constructor.");
++ return;
++ // NS_FATAL_ERROR (information->name<<" already has a constructor.");
+ }
+ information->hasConstructor = true;
+ information->constructor = callback;
+diff --git a/src/visualizer/model/pyviz.cc b/src/visualizer/model/pyviz.cc
+index 1e500b2..739d8c4 100644
+--- a/src/visualizer/model/pyviz.cc
++++ b/src/visualizer/model/pyviz.cc
+@@ -317,8 +317,9 @@ PyViz::SimulatorRunUntil (Time time)
+ // events just appear to "jump" big chunks of time.
+ NS_LOG_LOGIC ("Schedule dummy callback to be called in " << (time - Simulator::Now ()));
+ m_stop = false;
+- Simulator::Cancel (m_stopCallbackEvent);
+- m_stopCallbackEvent = Simulator::Schedule (time - Simulator::Now (), &PyViz::CallbackStopSimulation, this);
++ // Simulator::Cancel (m_stopCallbackEvent);
++ // m_stopCallbackEvent =
++ Simulator::ScheduleWithContext (-1, time - Simulator::Now (), &PyViz::CallbackStopSimulation, this);
+
+ Ptr<SimulatorImpl> impl = Simulator::GetImplementation ();
+ Ptr<VisualSimulatorImpl> visualImpl = DynamicCast<VisualSimulatorImpl> (impl);
+--
+1.7.10.2
+
diff --git a/test/basic-regression-test.cc b/test/basic-regression-test.cc
index 2edac36..8d3c661 100644
--- a/test/basic-regression-test.cc
+++ b/test/basic-regression-test.cc
@@ -19,7 +19,6 @@
*/
#include "ns3/test.h"
-#include "ns3/annotated-topology-reader.h"
#include "ns3/ccnx-interest-header.h"
#include "ns3/uinteger.h"
#include "ns3/random-variable.h"
@@ -41,7 +40,7 @@
#include "ns3/application.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/ipv4-list-routing-helper.h"
-#include "ns3/annotated-topology-reader.h"
+
#include <list>
@@ -54,15 +53,15 @@
{
public:
- BasicRegressionTest ();
- virtual ~BasicRegressionTest ();
+ BasicRegressionTest ();
+ virtual ~BasicRegressionTest ();
private:
- virtual void DoRun (void);
+ virtual void DoRun (void);
};
BasicRegressionTest::BasicRegressionTest ()
-: TestCase ("Basic regression test")
+ : TestCase ("Basic regression test")
{
}
@@ -73,83 +72,83 @@
void
BasicRegressionTest::DoRun(void)
{
- //string input ("/Users/iliamo/ns3-abstract-ndn/ns-3.11/src/NDNabstraction/examples/simpletopology.txt");
+ //string input ("/Users/iliamo/ns3-abstract-ndn/ns-3.11/src/NDNabstraction/examples/simpletopology.txt");
- // Set up command line parameters used to control the experiment.
- //CommandLine cmd;
- //cmd.AddValue ("input", "Name of the input file.",
- // input);
- //cmd.Parse (argc, argv);
+ // Set up command line parameters used to control the experiment.
+ //CommandLine cmd;
+ //cmd.AddValue ("input", "Name of the input file.",
+ // input);
+ //cmd.Parse (argc, argv);
- // ------------------------------------------------------------
- // -- Read topology data.
- // --------------------------------------------
+ // ------------------------------------------------------------
+ // -- Read topology data.
+ // --------------------------------------------
- // string input = NS_TEST_SOURCEDIR;
- // input += "/testtopology.txt";
+ // string input = NS_TEST_SOURCEDIR;
+ // input += "/testtopology.txt";
- // Ptr<AnnotatedTopologyReader> reader = CreateObject<AnnotatedTopologyReader> ();
- // reader->SetFileName (input);
+ // Ptr<AnnotatedTopologyReader> reader = CreateObject<AnnotatedTopologyReader> ();
+ // reader->SetFileName (input);
- // NodeContainer nodes;
- // if (reader != 0)
- // {
- // nodes = reader->Read ();
- // }
- // else
- // {
- // NS_TEST_ASSERT_MSG_EQ (true, false, "file not found");
- // }
+ // NodeContainer nodes;
+ // if (reader != 0)
+ // {
+ // nodes = reader->Read ();
+ // }
+ // else
+ // {
+ // NS_TEST_ASSERT_MSG_EQ (true, false, "file not found");
+ // }
- // NS_TEST_ASSERT_MSG_EQ (7, reader->LinksSize (), "link count is wrong");
+ // NS_TEST_ASSERT_MSG_EQ (7, reader->LinksSize (), "link count is wrong");
- // // ------------------------------------------------------------
- // // -- Create nodes and network stacks
- // // --------------------------------------------
- // NS_LOG_INFO ("creating internet stack");
- // InternetStackHelper stack;
+ // // ------------------------------------------------------------
+ // // -- Create nodes and network stacks
+ // // --------------------------------------------
+ // NS_LOG_INFO ("creating internet stack");
+ // InternetStackHelper stack;
- // //routing
- // /*Ipv4StaticRoutingHelper staticRouting;
- // Ipv4ListRoutingHelper listRH;
- // listRH.Add (staticRouting, 0);
- // stack.SetRoutingHelper (listRH); // has effect on the next Install ()
- // stack.Install (nodes);
+ // //routing
+ // /*Ipv4StaticRoutingHelper staticRouting;
+ // Ipv4ListRoutingHelper listRH;
+ // listRH.Add (staticRouting, 0);
+ // stack.SetRoutingHelper (listRH); // has effect on the next Install ()
+ // stack.Install (nodes);
- // NS_LOG_INFO ("creating ip4 addresses");
- // Ipv4AddressHelper address;
- // address.SetBase ("10.0.0.0", "255.255.255.252");*/
+ // NS_LOG_INFO ("creating ip4 addresses");
+ // Ipv4AddressHelper address;
+ // address.SetBase ("10.0.0.0", "255.255.255.252");*/
- // int totlinks = reader->LinksSize ();
+ // int totlinks = reader->LinksSize ();
- // /// applying settings
- // NS_LOG_INFO ("creating node containers");
- // NodeContainer* nc = new NodeContainer[totlinks];
- // TopologyReader::ConstLinksIterator iter;
- // int i = 0;
- // for ( iter = reader->LinksBegin (); iter != reader->LinksEnd (); iter++, i++ )
- // {
- // nc[i] = NodeContainer (iter->GetFromNode (), iter->GetToNode ());
- // }
+ // /// applying settings
+ // NS_LOG_INFO ("creating node containers");
+ // NodeContainer* nc = new NodeContainer[totlinks];
+ // TopologyReader::ConstLinksIterator iter;
+ // int i = 0;
+ // for ( iter = reader->LinksBegin (); iter != reader->LinksEnd (); iter++, i++ )
+ // {
+ // nc[i] = NodeContainer (iter->GetFromNode (), iter->GetToNode ());
+ // }
- // NetDeviceContainer* ndc = new NetDeviceContainer[totlinks];
- // reader->ApplySettings(ndc,nc);
- // /// settings applied
+ // NetDeviceContainer* ndc = new NetDeviceContainer[totlinks];
+ // reader->ApplySettings(ndc,nc);
+ // /// settings applied
- // it creates little subnets, one for each couple of nodes.
- /*NS_LOG_INFO ("creating ipv4 interfaces");
+ // it creates little subnets, one for each couple of nodes.
+ /*NS_LOG_INFO ("creating ipv4 interfaces");
Ipv4InterfaceContainer* ipic = new Ipv4InterfaceContainer[totlinks];
for (int i = 0; i < totlinks; i++)
{
- ipic[i] = address.Assign (ndc[i]);
- address.NewNetwork ();
+ ipic[i] = address.Assign (ndc[i]);
+ address.NewNetwork ();
}
// ------------------------------------------------------------
@@ -166,20 +165,20 @@
NS_LOG_INFO ("Done.");
- */
+ */
}
class BasicRegressionTestSuite : public TestSuite
{
public:
- BasicRegressionTestSuite ();
+ BasicRegressionTestSuite ();
};
BasicRegressionTestSuite::BasicRegressionTestSuite ()
-: TestSuite ("ccnx-basic-regression-test-suite", UNIT)
+ : TestSuite ("ccnx-basic-regression-test-suite", UNIT)
{
- SetDataDir (NS_TEST_SOURCEDIR);
- AddTestCase (new BasicRegressionTest);
+ SetDataDir (NS_TEST_SOURCEDIR);
+ AddTestCase (new BasicRegressionTest);
}
static BasicRegressionTestSuite suite;
diff --git a/test/content-object-test.cc b/test/content-object-test.cc
index cbb5811..44f881c 100644
--- a/test/content-object-test.cc
+++ b/test/content-object-test.cc
@@ -19,7 +19,6 @@
*/
#include "ns3/test.h"
-#include "ns3/annotated-topology-reader.h"
#include "ns3/ccnx-interest-header.h"
#include "ns3/uinteger.h"
#include "ns3/random-variable.h"
@@ -44,15 +43,15 @@
class ContentObjectTest : public TestCase
{
public:
- ContentObjectTest ();
- virtual ~ContentObjectTest ();
+ ContentObjectTest ();
+ virtual ~ContentObjectTest ();
private:
- virtual void DoRun (void);
+ virtual void DoRun (void);
};
ContentObjectTest::ContentObjectTest ()
-: TestCase ("Content Obejct Serialization Test")
+ : TestCase ("Content Obejct Serialization Test")
{
}
@@ -63,49 +62,49 @@
void
ContentObjectTest::DoRun(void)
{
- Packet::EnablePrinting ();
- Packet::EnableChecking ();
- Packet packet (10);
+ Packet::EnablePrinting ();
+ Packet::EnableChecking ();
+ Packet packet (10);
- CcnxContentObjectHeader header;
- CcnxContentObjectTail trailer;
+ CcnxContentObjectHeader header;
+ CcnxContentObjectTail trailer;
- Ptr<CcnxNameComponents> testname = Create<CcnxNameComponents> ();
- (*testname) ("iwant")("icecream");
- header.SetName(testname);
+ Ptr<CcnxNameComponents> testname = Create<CcnxNameComponents> ();
+ (*testname) ("iwant")("icecream");
+ header.SetName(testname);
- NS_LOG_INFO ("Source: \n" << header << trailer);
+ NS_LOG_INFO ("Source: \n" << header << trailer);
- packet.AddHeader (header);
- packet.AddTrailer (trailer);
+ packet.AddHeader (header);
+ packet.AddTrailer (trailer);
- // NS_LOG_INFO ("Deserialized packet: \n" << packet);
+ // NS_LOG_INFO ("Deserialized packet: \n" << packet);
- NS_LOG_INFO ("Removing and deserializing individual headers");
+ NS_LOG_INFO ("Removing and deserializing individual headers");
- CcnxContentObjectHeader targetHeader;
- CcnxContentObjectTail targetTrailer;
+ CcnxContentObjectHeader targetHeader;
+ CcnxContentObjectTail targetTrailer;
- packet.RemoveHeader (targetHeader);
- packet.RemoveTrailer (targetTrailer);
+ packet.RemoveHeader (targetHeader);
+ packet.RemoveTrailer (targetTrailer);
- NS_TEST_ASSERT_MSG_EQ (targetHeader.GetName(), *testname, "Content Object name deserialization failed");
+ NS_TEST_ASSERT_MSG_EQ (targetHeader.GetName(), *testname, "Content Object name deserialization failed");
- NS_TEST_ASSERT_MSG_EQ (packet.GetSize(), 10, "Content Object size inequality");
+ NS_TEST_ASSERT_MSG_EQ (packet.GetSize(), 10, "Content Object size inequality");
}
class ContentObjectTestSuite : public TestSuite
{
public:
- ContentObjectTestSuite ();
+ ContentObjectTestSuite ();
};
ContentObjectTestSuite::ContentObjectTestSuite ()
-: TestSuite ("content-object-test-suite", UNIT)
+ : TestSuite ("content-object-test-suite", UNIT)
{
- SetDataDir (NS_TEST_SOURCEDIR);
- AddTestCase (new ContentObjectTest);
+ SetDataDir (NS_TEST_SOURCEDIR);
+ AddTestCase (new ContentObjectTest);
}
static ContentObjectTestSuite suite;
diff --git a/test/interest-header-serialization-test.cc b/test/interest-header-serialization-test.cc
index 5c73bfc..81b7972 100644
--- a/test/interest-header-serialization-test.cc
+++ b/test/interest-header-serialization-test.cc
@@ -19,7 +19,6 @@
*/
#include "ns3/test.h"
-#include "ns3/annotated-topology-reader.h"
#include "ns3/ccnx-interest-header.h"
#include "ns3/uinteger.h"
#include "ns3/random-variable.h"
@@ -44,15 +43,15 @@
class InterestHeaderSerializationTest : public TestCase
{
public:
- InterestHeaderSerializationTest ();
- virtual ~InterestHeaderSerializationTest ();
+ InterestHeaderSerializationTest ();
+ virtual ~InterestHeaderSerializationTest ();
private:
- virtual void DoRun (void);
+ virtual void DoRun (void);
};
InterestHeaderSerializationTest::InterestHeaderSerializationTest ()
-: TestCase ("Interest Header Serialization Test")
+ : TestCase ("Interest Header Serialization Test")
{
}
@@ -63,64 +62,64 @@
void
InterestHeaderSerializationTest::DoRun(void)
{
- Packet packet (0);
+ Packet packet (0);
- uint32_t randomNonce = UniformVariable().GetInteger(1, std::numeric_limits<uint32_t>::max ());
- Ptr<CcnxNameComponents> testname = Create<CcnxNameComponents> ();
- (*testname) ("test") ("test2");
+ uint32_t randomNonce = UniformVariable().GetInteger(1, std::numeric_limits<uint32_t>::max ());
+ Ptr<CcnxNameComponents> testname = Create<CcnxNameComponents> ();
+ (*testname) ("test") ("test2");
- Ptr<CcnxNameComponents> exclude = Create<CcnxNameComponents> ();
- (*exclude) ("exclude") ("exclude2");
+ Ptr<CcnxNameComponents> exclude = Create<CcnxNameComponents> ();
+ (*exclude) ("exclude") ("exclude2");
- Time lifetime = Seconds(4.0);
- bool child = true;
+ Time lifetime = Seconds(4.0);
+ bool child = true;
- uint32_t maxSuffixComponents = 40;
- uint32_t minSuffixComponents = 20;
+ uint32_t maxSuffixComponents = 40;
+ uint32_t minSuffixComponents = 20;
- CcnxInterestHeader interestHeader;
- interestHeader.SetNonce(randomNonce);
- interestHeader.SetName(testname);
- interestHeader.SetInterestLifetime(lifetime);
- interestHeader.SetChildSelector(child);
- interestHeader.SetExclude(exclude);
- interestHeader.SetMaxSuffixComponents(maxSuffixComponents);
- interestHeader.SetMinSuffixComponents(minSuffixComponents);
+ CcnxInterestHeader interestHeader;
+ interestHeader.SetNonce(randomNonce);
+ interestHeader.SetName(testname);
+ interestHeader.SetInterestLifetime(lifetime);
+ interestHeader.SetChildSelector(child);
+ interestHeader.SetExclude(exclude);
+ interestHeader.SetMaxSuffixComponents(maxSuffixComponents);
+ interestHeader.SetMinSuffixComponents(minSuffixComponents);
- //serialization
- packet.AddHeader (interestHeader);
+ //serialization
+ packet.AddHeader (interestHeader);
- //deserialization
- CcnxInterestHeader target;
- packet.RemoveHeader (target);
+ //deserialization
+ CcnxInterestHeader target;
+ packet.RemoveHeader (target);
- NS_TEST_ASSERT_MSG_EQ (target.GetNonce(), randomNonce, "Interest Header nonce deserialization failed");
+ NS_TEST_ASSERT_MSG_EQ (target.GetNonce(), randomNonce, "Interest Header nonce deserialization failed");
- NS_TEST_ASSERT_MSG_EQ (target.GetName(), *testname, "Interest Header name deserialization failed");
+ NS_TEST_ASSERT_MSG_EQ (target.GetName(), *testname, "Interest Header name deserialization failed");
- NS_TEST_ASSERT_MSG_EQ (target.GetInterestLifetime(), lifetime, "Interest Header lifetime deserialization failed");
+ NS_TEST_ASSERT_MSG_EQ (target.GetInterestLifetime(), lifetime, "Interest Header lifetime deserialization failed");
- NS_TEST_ASSERT_MSG_EQ (target.IsEnabledChildSelector(), child, "Interest Header childselector deserialization failed");
+ NS_TEST_ASSERT_MSG_EQ (target.IsEnabledChildSelector(), child, "Interest Header childselector deserialization failed");
- NS_TEST_ASSERT_MSG_EQ (target.GetExclude(), *exclude, "Interest Header exclude deserialization failed");
+ NS_TEST_ASSERT_MSG_EQ (target.GetExclude(), *exclude, "Interest Header exclude deserialization failed");
- NS_TEST_ASSERT_MSG_EQ (target.GetMaxSuffixComponents(), (int)maxSuffixComponents, "Interest Header maxSuffixComponents deserialization failed");
+ NS_TEST_ASSERT_MSG_EQ (target.GetMaxSuffixComponents(), (int)maxSuffixComponents, "Interest Header maxSuffixComponents deserialization failed");
- NS_TEST_ASSERT_MSG_EQ (target.GetMinSuffixComponents(), (int)minSuffixComponents, "Interest Header minSuffixComponents deserialization failed");
+ NS_TEST_ASSERT_MSG_EQ (target.GetMinSuffixComponents(), (int)minSuffixComponents, "Interest Header minSuffixComponents deserialization failed");
}
class InterestHeaderSerializationTestSuite : public TestSuite
{
public:
- InterestHeaderSerializationTestSuite ();
+ InterestHeaderSerializationTestSuite ();
};
InterestHeaderSerializationTestSuite::InterestHeaderSerializationTestSuite ()
-: TestSuite ("interest-header-serialization-test-suite", UNIT)
+ : TestSuite ("interest-header-serialization-test-suite", UNIT)
{
- SetDataDir (NS_TEST_SOURCEDIR);
- AddTestCase (new InterestHeaderSerializationTest);
+ SetDataDir (NS_TEST_SOURCEDIR);
+ AddTestCase (new InterestHeaderSerializationTest);
}
static InterestHeaderSerializationTestSuite suite;