Remove use of deprecated and now removed QueueBase::MaxPackets

Change-Id: I6aa6d2af4e6189ecd6bac774b2b846b18a0f9dd2
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index f25f060..37a7f44 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -14,8 +14,9 @@
 find . -name '*.pyc' | sudo xargs rm -f
 
 # Configure/build in debug mode
-./waf -j${WAF_JOBS:-1} configure -d debug --enable-modules=ndnSIM --enable-examples --enable-tests $EXTRA_FLAGS
-./waf -j${WAF_JOBS:-1}  build
+export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libxml2/lib/pkgconfig"
+./waf -j${WAF_JOBS:-1} configure -d debug --enable-examples --enable-tests $EXTRA_FLAGS
+./waf -j${WAF_JOBS:-1} build
 
 # Install
 sudo ./waf -j${WAF_JOBS:-1} install
diff --git a/examples/ndn-csma.cpp b/examples/ndn-csma.cpp
index a30b0e5..5e0ccfd 100644
--- a/examples/ndn-csma.cpp
+++ b/examples/ndn-csma.cpp
@@ -55,7 +55,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::CsmaChannel::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::CsmaChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-different-strategy-per-prefix.cpp b/examples/ndn-different-strategy-per-prefix.cpp
index 808124d..631674e 100644
--- a/examples/ndn-different-strategy-per-prefix.cpp
+++ b/examples/ndn-different-strategy-per-prefix.cpp
@@ -64,7 +64,7 @@
   // Setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(10));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("10p"));
 
   // Read optional command-line parameters
   CommandLine cmd;
diff --git a/examples/ndn-grid-multiple-strategies.cpp b/examples/ndn-grid-multiple-strategies.cpp
index a97c3d0..474feb0 100644
--- a/examples/ndn-grid-multiple-strategies.cpp
+++ b/examples/ndn-grid-multiple-strategies.cpp
@@ -64,7 +64,7 @@
   // Setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(10));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("10p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-grid.cpp b/examples/ndn-grid.cpp
index bf4d566..6027a0d 100644
--- a/examples/ndn-grid.cpp
+++ b/examples/ndn-grid.cpp
@@ -57,7 +57,7 @@
   // Setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(10));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("10p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-grid.py b/examples/ndn-grid.py
index c13c405..b7884e7 100644
--- a/examples/ndn-grid.py
+++ b/examples/ndn-grid.py
@@ -51,7 +51,7 @@
 
 Config.SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"))
 Config.SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"))
-Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20))
+Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"))
 
 import sys; cmd = CommandLine(); cmd.Parse(sys.argv);
 
diff --git a/examples/ndn-simple-for-nrt-helper.cpp b/examples/ndn-simple-for-nrt-helper.cpp
index eb320a9..a43ab13 100644
--- a/examples/ndn-simple-for-nrt-helper.cpp
+++ b/examples/ndn-simple-for-nrt-helper.cpp
@@ -61,7 +61,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-simple-mpi.cpp b/examples/ndn-simple-mpi.cpp
index f15af34..6be5e5c 100644
--- a/examples/ndn-simple-mpi.cpp
+++ b/examples/ndn-simple-mpi.cpp
@@ -74,7 +74,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Gbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("1ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(10));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("10p"));
 
   bool nullmsg = false;
 
diff --git a/examples/ndn-simple-with-content-freshness.cpp b/examples/ndn-simple-with-content-freshness.cpp
index 5f0130d..48b3c79 100644
--- a/examples/ndn-simple-with-content-freshness.cpp
+++ b/examples/ndn-simple-with-content-freshness.cpp
@@ -48,7 +48,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-simple-with-different-sizes-content-store.cpp b/examples/ndn-simple-with-different-sizes-content-store.cpp
index 921f32e..355d37d 100644
--- a/examples/ndn-simple-with-different-sizes-content-store.cpp
+++ b/examples/ndn-simple-with-different-sizes-content-store.cpp
@@ -49,7 +49,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-simple-with-link-failure.cpp b/examples/ndn-simple-with-link-failure.cpp
index 0afab4a..29ad00e 100644
--- a/examples/ndn-simple-with-link-failure.cpp
+++ b/examples/ndn-simple-with-link-failure.cpp
@@ -55,7 +55,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-simple-with-pcap.cpp b/examples/ndn-simple-with-pcap.cpp
index e58348e..bda9208 100644
--- a/examples/ndn-simple-with-pcap.cpp
+++ b/examples/ndn-simple-with-pcap.cpp
@@ -67,7 +67,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-simple.cpp b/examples/ndn-simple.cpp
index 74a9131..913c16f 100644
--- a/examples/ndn-simple.cpp
+++ b/examples/ndn-simple.cpp
@@ -52,7 +52,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-simple.py b/examples/ndn-simple.py
index 108406a..7aeebce 100644
--- a/examples/ndn-simple.py
+++ b/examples/ndn-simple.py
@@ -47,7 +47,7 @@
 # Set default parameters for PointToPoint links and channels
 Config.SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"))
 Config.SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"))
-Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20))
+Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"))
 
 # Read optional command-line parameters (e.g., enable visualizer with ./waf --pyrun=<> --visualize
 import sys; cmd = CommandLine(); cmd.Parse(sys.argv);
diff --git a/examples/ndn-triangle-calculate-routes.cpp b/examples/ndn-triangle-calculate-routes.cpp
index 41a830b..869d443 100644
--- a/examples/ndn-triangle-calculate-routes.cpp
+++ b/examples/ndn-triangle-calculate-routes.cpp
@@ -33,7 +33,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/ndn-zipf-mandelbrot.cpp b/examples/ndn-zipf-mandelbrot.cpp
index 8ebeccd..7fd8d54 100644
--- a/examples/ndn-zipf-mandelbrot.cpp
+++ b/examples/ndn-zipf-mandelbrot.cpp
@@ -58,7 +58,7 @@
   // Setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("1ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(10));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("10p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/examples/wscript b/examples/wscript
index c1eb9c3..5dc6b4b 100644
--- a/examples/wscript
+++ b/examples/wscript
@@ -11,7 +11,7 @@
         examples += bld.path.ant_glob(['*-mpi.cpp'])
 
     for i in examples:
-        name = str(i)[:-len(".cpp")]
+        name = i.change_ext('').path_from(bld.path.get_bld())
         obj = bld.create_ns3_program(name, all_modules)
         obj.source = [i] + bld.path.ant_glob(['%s/**/*.cpp' % name])
 
diff --git a/model/ndn-net-device-transport.cpp b/model/ndn-net-device-transport.cpp
index 17880d2..a8565fb 100644
--- a/model/ndn-net-device-transport.cpp
+++ b/model/ndn-net-device-transport.cpp
@@ -56,7 +56,15 @@
   if (m_netDevice->GetAttributeFailSafe("TxQueue", txQueueAttribute)) {
     Ptr<ns3::QueueBase> txQueue = txQueueAttribute.Get<ns3::QueueBase>();
     // must be put into bytes mode queue
-    this->setSendQueueCapacity(txQueue->GetMaxBytes());
+
+    auto size = txQueue->GetMaxSize();
+    if (size.GetUnit() == BYTES) {
+      this->setSendQueueCapacity(size.GetValue());
+    }
+    else {
+      // don't know the exact size in bytes, guessing based on "standard" packet size
+      this->setSendQueueCapacity(size.GetValue() * 1500);
+    }
   }
 
   NS_LOG_FUNCTION(this << "Creating an ndnSIM transport instance for netDevice with URI"
diff --git a/tests/other/ndn-test.cpp b/tests/other/ndn-test.cpp
index 4095f54..c720bd6 100644
--- a/tests/other/ndn-test.cpp
+++ b/tests/other/ndn-test.cpp
@@ -159,7 +159,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10000Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("20"));
+  Config::SetDefault("ns3::DropTailQueue::MaxSize", StringValue("20p"));
 
   // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
   CommandLine cmd;
diff --git a/tests/unit-tests/NFD/ncc.t.cpp b/tests/unit-tests/NFD/ncc.t.cpp
index b7bd801..e53e00e 100644
--- a/tests/unit-tests/NFD/ncc.t.cpp
+++ b/tests/unit-tests/NFD/ncc.t.cpp
@@ -33,7 +33,7 @@
   {
     Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
     Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("1ms"));
-    Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(500));
+    Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("500p"));
 
       //            Creating a 3 node topology                //
       //                                                      //
diff --git a/tests/unit-tests/helper/ndn-link-control-helper.t.cpp b/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
index 6abcf43..1e59f14 100644
--- a/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
@@ -32,7 +32,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   createTopology({
       {"1", "2"},
@@ -77,7 +77,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Connecting nodes in 6 node topology:                        //
   //                                                             //
diff --git a/tests/unit-tests/helper/ndn-stack-helper.t.cpp b/tests/unit-tests/helper/ndn-stack-helper.t.cpp
index 04d5bba..2fc98b6 100644
--- a/tests/unit-tests/helper/ndn-stack-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-stack-helper.t.cpp
@@ -32,7 +32,7 @@
   // setting default parameters for PointToPoint links and channels
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   // Creating nodes
   NodeContainer nodes;
diff --git a/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp b/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
index e06a93d..a539141 100644
--- a/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
@@ -33,7 +33,7 @@
   {
     Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
     Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("1ms"));
-    Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(500));
+    Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("500p"));
 
     // Creating two 3 node topologies:                      //
     //                                                      //
diff --git a/tests/unit-tests/model/ndn-old-content-store.t.cpp b/tests/unit-tests/model/ndn-old-content-store.t.cpp
index a2919f4..c2e9c43 100644
--- a/tests/unit-tests/model/ndn-old-content-store.t.cpp
+++ b/tests/unit-tests/model/ndn-old-content-store.t.cpp
@@ -29,7 +29,7 @@
 {
   Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
   Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-  Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+  Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
   getStackHelper().SetOldContentStore("ns3::ndn::cs::Random", "MaxSize", "10");
 
diff --git a/tests/unit-tests/ndn-cxx/face.t.cpp b/tests/unit-tests/ndn-cxx/face.t.cpp
index df84a30..f062728 100644
--- a/tests/unit-tests/ndn-cxx/face.t.cpp
+++ b/tests/unit-tests/ndn-cxx/face.t.cpp
@@ -38,7 +38,7 @@
   {
     Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
     Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-    Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+    Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
     createTopology({{"A", "B"}});
     addRoutes({{"A", "B", "/test", 1}});
diff --git a/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp b/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
index b981cee..953eec1 100644
--- a/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
+++ b/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
@@ -39,7 +39,7 @@
     // setting default parameters for PointToPoint links and channels
     Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
     Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-    Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+    Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
     createTopology({
         {"1", "2"},
diff --git a/tests/unit-tests/utils/tracers/ndn-l3-rate-tracer.t.cpp b/tests/unit-tests/utils/tracers/ndn-l3-rate-tracer.t.cpp
index ae2dc8e..ef000de 100644
--- a/tests/unit-tests/utils/tracers/ndn-l3-rate-tracer.t.cpp
+++ b/tests/unit-tests/utils/tracers/ndn-l3-rate-tracer.t.cpp
@@ -39,7 +39,7 @@
     // setting default parameters for PointToPoint links and channels
     Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
     Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
-    Config::SetDefault("ns3::QueueBase::MaxPackets", UintegerValue(20));
+    Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"));
 
     createTopology({
         {"1"},
diff --git a/utils/topology/annotated-topology-reader.cpp b/utils/topology/annotated-topology-reader.cpp
index 23abc84..3a451de 100644
--- a/utils/topology/annotated-topology-reader.cpp
+++ b/utils/topology/annotated-topology-reader.cpp
@@ -346,10 +346,10 @@
       NS_LOG_INFO("MaxPackets = " + link.GetAttribute("MaxPackets"));
 
       try {
-        uint32_t maxPackets = boost::lexical_cast<uint32_t>(link.GetAttribute("MaxPackets"));
+        std::string maxPackets = link.GetAttribute("MaxPackets");
 
         // compatibility mode. Only DropTailQueue is supported
-        p2p.SetQueue("ns3::DropTailQueue<Packet>", "MaxPackets", UintegerValue(maxPackets));
+        p2p.SetQueue("ns3::DropTailQueue<Packet>", "MaxSize", StringValue(maxPackets + "p"));
       }
       catch (...) {
         typedef boost::tokenizer<boost::escaped_list_separator<char>> tokenizer;