model+apps+utils+examples+ci+docs: Update code for changes in ns-2.23

- Replace removed RandomVariable with RandomVariableStream
- Replace deprecated usages of AddTraceSource
- Update changed LogComponent interface

ci: This commit also integrates a script for Jenkins and Travis CI to
clone NS-3 and pybindgen repositories, so the code can be built.

docs: Update to reflect new home of ndnSIM and related sources

Change-Id: Ic14e1269bf15366b0041fd670c577053b6704dc7
Refs: #3122, #3123
diff --git a/.jenkins.d/00-prepare.sh b/.jenkins.d/00-prepare.sh
new file mode 100755
index 0000000..67e579f
--- /dev/null
+++ b/.jenkins.d/00-prepare.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -e
+set -x
+
+git rm -qrf .
+git clone --depth=1 https://github.com/named-data-ndnSIM/ns-3-dev ns-3
+git clone --depth=1 https://github.com/named-data-ndnSIM/pybindgen.git pybindgen
+mkdir -p ns-3/src/ndnSIM
+mv .git ns-3/src/ndnSIM/
+(cd ns-3/src/ndnSIM/ && git reset -q && git checkout . && git submodule update --init)
+
+mv ns-3/src/ndnSIM/.jenkins.d . # move CI scripts back, so the rest of them can be executed
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index da977d5..b0ec560 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -5,10 +5,13 @@
 JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 source "$JDIR"/util.sh
 
+pushd ns-3 >/dev/null
+
 git submodule update --init
 
 # Cleanup
-sudo ./waf -j1 distclean
+sudo rm -Rf build/ .waf-1* .waf3-1*
+find . -name '*.pyc' | sudo xargs rm -f
 
 if has Ubuntu-12.04 $NODE_LABELS; then
     EXTRA_FLAGS=" --boost-libs=/usr/lib/x86_64-linux-gnu"
@@ -26,3 +29,5 @@
 elif has FreeBSD $NODE_LABELS; then
     sudo ldconfig -a
 fi
+
+popd >/dev/null
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index 01ce1a2..cd1d39f 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -5,9 +5,13 @@
 JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 source "$JDIR"/util.sh
 
+pushd ns-3 >/dev/null
+
 # Run unit tests
 if [[ -n "$XUNIT" ]]; then
-    ./build/src/ndnSIM/tests/ns3-dev-ndnSIM-unit-tests-debug --log_format=XML --log_sink=build/xunit-report.xml --log_level=all --report_level=no
+    ./waf --run "ndnSIM-unit-tests --log_format=XML --log_sink=build/xunit-report.xml --log_level=all --report_level=no"
 else
-    ./build/src/ndnSIM/tests/ns3-dev-ndnSIM-unit-tests-debug -l test_suite
+    ./waf --run "ndnSIM-unit-tests -l test_suite"
 fi
+
+popd >/dev/null
diff --git a/.travis.yml b/.travis.yml
index ebfe01a..08fefa0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,13 +14,5 @@
 before_install:
   - travis_retry sudo apt-get install -qq ccache
 script:
-  - |
-    git rm -qrf .
-    git clone --depth=1 https://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
-    git clone --depth=1 https://github.com/cawka/pybindgen.git pybindgen
-    mkdir -p ns-3/src/ndnSIM
-    mv .git ns-3/src/ndnSIM/
-    (cd ns-3/src/ndnSIM/ && git reset -q && git checkout .)
-  - cd ns-3
   - export CXX="ccache $CXX"
-  - ./src/ndnSIM/.jenkins
+  - ./.jenkins
diff --git a/apps/ndn-app.cpp b/apps/ndn-app.cpp
index fdeb4e7..802f697 100644
--- a/apps/ndn-app.cpp
+++ b/apps/ndn-app.cpp
@@ -41,16 +41,20 @@
                         .AddConstructor<App>()
 
                         .AddTraceSource("ReceivedInterests", "ReceivedInterests",
-                                        MakeTraceSourceAccessor(&App::m_receivedInterests))
+                                        MakeTraceSourceAccessor(&App::m_receivedInterests),
+                                        "ns3::ndn::App::InterestTraceCallback")
 
                         .AddTraceSource("ReceivedDatas", "ReceivedDatas",
-                                        MakeTraceSourceAccessor(&App::m_receivedDatas))
+                                        MakeTraceSourceAccessor(&App::m_receivedDatas),
+                                        "ns3::ndn::App::DataTraceCallback")
 
                         .AddTraceSource("TransmittedInterests", "TransmittedInterests",
-                                        MakeTraceSourceAccessor(&App::m_transmittedInterests))
+                                        MakeTraceSourceAccessor(&App::m_transmittedInterests),
+                                        "ns3::ndn::App::InterestTraceCallback")
 
                         .AddTraceSource("TransmittedDatas", "TransmittedDatas",
-                                        MakeTraceSourceAccessor(&App::m_transmittedDatas));
+                                        MakeTraceSourceAccessor(&App::m_transmittedDatas),
+                                        "ns3::ndn::App::DataTraceCallback");
   return tid;
 }
 
diff --git a/apps/ndn-app.hpp b/apps/ndn-app.hpp
index 7d335b3..8ba90d3 100644
--- a/apps/ndn-app.hpp
+++ b/apps/ndn-app.hpp
@@ -80,6 +80,10 @@
   virtual void
   OnData(shared_ptr<const Data> data);
 
+public:
+  typedef void (*InterestTraceCallback)(shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>);
+  typedef void (*DataTraceCallback)(shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>);
+
 protected:
   /**
    * @brief Do cleanup when application is destroyed
diff --git a/apps/ndn-consumer-cbr.cpp b/apps/ndn-consumer-cbr.cpp
index 491051a..fc5be6d 100644
--- a/apps/ndn-consumer-cbr.cpp
+++ b/apps/ndn-consumer-cbr.cpp
@@ -68,7 +68,6 @@
 ConsumerCbr::ConsumerCbr()
   : m_frequency(1.0)
   , m_firstTime(true)
-  , m_random(0)
 {
   NS_LOG_FUNCTION_NOARGS();
   m_seqMax = std::numeric_limits<uint32_t>::max();
@@ -76,8 +75,6 @@
 
 ConsumerCbr::~ConsumerCbr()
 {
-  if (m_random)
-    delete m_random;
 }
 
 void
@@ -99,14 +96,15 @@
 void
 ConsumerCbr::SetRandomize(const std::string& value)
 {
-  if (m_random)
-    delete m_random;
-
   if (value == "uniform") {
-    m_random = new UniformVariable(0.0, 2 * 1.0 / m_frequency);
+    m_random = CreateObject<UniformRandomVariable>();
+    m_random->SetAttribute("Min", DoubleValue(0.0));
+    m_random->SetAttribute("Max", DoubleValue(2 * 1.0 / m_frequency));
   }
   else if (value == "exponential") {
-    m_random = new ExponentialVariable(1.0 / m_frequency, 50 * 1.0 / m_frequency);
+    m_random = CreateObject<ExponentialRandomVariable>();
+    m_random->SetAttribute("Mean", DoubleValue(1.0 / m_frequency));
+    m_random->SetAttribute("Bound", DoubleValue(50 * 1.0 / m_frequency));
   }
   else
     m_random = 0;
diff --git a/apps/ndn-consumer-cbr.hpp b/apps/ndn-consumer-cbr.hpp
index 6e8f6c1..fbf606c 100644
--- a/apps/ndn-consumer-cbr.hpp
+++ b/apps/ndn-consumer-cbr.hpp
@@ -68,7 +68,7 @@
 protected:
   double m_frequency; // Frequency of interest packets (in hertz)
   bool m_firstTime;
-  RandomVariable* m_random;
+  Ptr<RandomVariableStream> m_random;
   std::string m_randomType;
 };
 
diff --git a/apps/ndn-consumer-window.cpp b/apps/ndn-consumer-window.cpp
index d02ea1d..b806190 100644
--- a/apps/ndn-consumer-window.cpp
+++ b/apps/ndn-consumer-window.cpp
@@ -73,9 +73,11 @@
 
       .AddTraceSource("WindowTrace",
                       "Window that controls how many outstanding interests are allowed",
-                      MakeTraceSourceAccessor(&ConsumerWindow::m_window))
+                      MakeTraceSourceAccessor(&ConsumerWindow::m_window),
+                      "ns3::ndn::ConsumerWindow::WindowTraceCallback")
       .AddTraceSource("InFlight", "Current number of outstanding interests",
-                      MakeTraceSourceAccessor(&ConsumerWindow::m_inFlight));
+                      MakeTraceSourceAccessor(&ConsumerWindow::m_inFlight),
+                      "ns3::ndn::ConsumerWindow::WindowTraceCallback");
 
   return tid;
 }
diff --git a/apps/ndn-consumer-window.hpp b/apps/ndn-consumer-window.hpp
index 1f229d8..4e76c50 100644
--- a/apps/ndn-consumer-window.hpp
+++ b/apps/ndn-consumer-window.hpp
@@ -56,6 +56,9 @@
   virtual void
   WillSendOutInterest(uint32_t sequenceNumber);
 
+public:
+  typedef void (*WindowTraceCallback)(uint32_t);
+
 protected:
   /**
    * \brief Constructs the Interest packet and sends it using a callback to the underlying NDN
diff --git a/apps/ndn-consumer-zipf-mandelbrot.cpp b/apps/ndn-consumer-zipf-mandelbrot.cpp
index 2c7f71f..ac83022 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.cpp
+++ b/apps/ndn-consumer-zipf-mandelbrot.cpp
@@ -64,7 +64,7 @@
   : m_N(100) // needed here to make sure when SetQ/SetS are called, there is a valid value of N
   , m_q(0.7)
   , m_s(0.7)
-  , m_SeqRng(0.0, 1.0)
+  , m_seqRng(CreateObject<UniformRandomVariable>())
 {
   // SetNumberOfContents is called by NS-3 object system during the initialization
 }
@@ -174,7 +174,7 @@
   //
 
   shared_ptr<Interest> interest = make_shared<Interest>();
-  interest->setNonce(m_rand.GetValue());
+  interest->setNonce(m_rand->GetValue(0, std::numeric_limits<uint32_t>::max()));
   interest->setName(*nameWithSequence);
 
   // NS_LOG_INFO ("Requesting Interest: \n" << *interest);
@@ -204,9 +204,9 @@
   uint32_t content_index = 1; //[1, m_N]
   double p_sum = 0;
 
-  double p_random = m_SeqRng.GetValue();
+  double p_random = m_seqRng->GetValue();
   while (p_random == 0) {
-    p_random = m_SeqRng.GetValue();
+    p_random = m_seqRng->GetValue();
   }
   // if (p_random == 0)
   NS_LOG_LOGIC("p_random=" << p_random);
diff --git a/apps/ndn-consumer-zipf-mandelbrot.hpp b/apps/ndn-consumer-zipf-mandelbrot.hpp
index d0cd4f1..f973240 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.hpp
+++ b/apps/ndn-consumer-zipf-mandelbrot.hpp
@@ -35,7 +35,7 @@
 #include "ns3/string.h"
 #include "ns3/uinteger.h"
 #include "ns3/double.h"
-#include "ns3/random-variable.h"
+#include "ns3/random-variable-stream.h"
 
 namespace ns3 {
 namespace ndn {
@@ -95,7 +95,7 @@
   double m_s;                 // s in (k+q)^s
   std::vector<double> m_Pcum; // cumulative probability
 
-  UniformVariable m_SeqRng; // RNG
+  Ptr<UniformRandomVariable> m_seqRng; // RNG
 };
 
 } /* namespace ndn */
diff --git a/apps/ndn-consumer.cpp b/apps/ndn-consumer.cpp
index 7350b0f..4d39bea 100644
--- a/apps/ndn-consumer.cpp
+++ b/apps/ndn-consumer.cpp
@@ -66,17 +66,19 @@
 
       .AddTraceSource("LastRetransmittedInterestDataDelay",
                       "Delay between last retransmitted Interest and received Data",
-                      MakeTraceSourceAccessor(&Consumer::m_lastRetransmittedInterestDataDelay))
+                      MakeTraceSourceAccessor(&Consumer::m_lastRetransmittedInterestDataDelay),
+                      "ns3::ndn::Consumer::LastRetransmittedInterestDataDelayCallback")
 
       .AddTraceSource("FirstInterestDataDelay",
                       "Delay between first transmitted Interest and received Data",
-                      MakeTraceSourceAccessor(&Consumer::m_firstInterestDataDelay));
+                      MakeTraceSourceAccessor(&Consumer::m_firstInterestDataDelay),
+                      "ns3::ndn::Consumer::FirstInterestDataDelayCallback");
 
   return tid;
 }
 
 Consumer::Consumer()
-  : m_rand(0, std::numeric_limits<uint32_t>::max())
+  : m_rand(CreateObject<UniformRandomVariable>())
   , m_seq(0)
   , m_seqMax(0) // don't request anything
 {
@@ -185,7 +187,7 @@
 
   // shared_ptr<Interest> interest = make_shared<Interest> ();
   shared_ptr<Interest> interest = make_shared<Interest>();
-  interest->setNonce(m_rand.GetValue());
+  interest->setNonce(m_rand->GetValue(0, std::numeric_limits<uint32_t>::max()));
   interest->setName(*nameWithSequence);
   time::milliseconds interestLifeTime(m_interestLifeTime.GetMilliSeconds());
   interest->setInterestLifetime(interestLifeTime);
diff --git a/apps/ndn-consumer.hpp b/apps/ndn-consumer.hpp
index 665e20f..0906f07 100644
--- a/apps/ndn-consumer.hpp
+++ b/apps/ndn-consumer.hpp
@@ -24,7 +24,7 @@
 
 #include "ndn-app.hpp"
 
-#include "ns3/random-variable.h"
+#include "ns3/random-variable-stream.h"
 #include "ns3/nstime.h"
 #include "ns3/data-rate.h"
 
@@ -89,6 +89,10 @@
   virtual void
   WillSendOutInterest(uint32_t sequenceNumber);
 
+public:
+  typedef void (*LastRetransmittedInterestDataDelayCallback)(Ptr<App> app, uint32_t seqno, Time delay, int32_t hopCount);
+  typedef void (*FirstInterestDataDelayCallback)(Ptr<App> app, uint32_t seqno, Time delay, uint32_t retxCount, int32_t hopCount);
+
 protected:
   // from App
   virtual void
@@ -125,7 +129,7 @@
   GetRetxTimer() const;
 
 protected:
-  UniformVariable m_rand; ///< @brief nonce generator
+  Ptr<UniformRandomVariable> m_rand; ///< @brief nonce generator
 
   uint32_t m_seq;      ///< @brief currently requested sequence number
   uint32_t m_seqMax;   ///< @brief maximum number of sequence number
diff --git a/docs/source/getting-started.rst b/docs/source/getting-started.rst
index 0e15985..9a5d0aa 100644
--- a/docs/source/getting-started.rst
+++ b/docs/source/getting-started.rst
@@ -122,9 +122,9 @@
     mkdir ndnSIM
     cd ndnSIM
     git clone https://github.com/named-data/ndn-cxx.git ndn-cxx
-    git clone https://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
-    git clone https://github.com/cawka/pybindgen.git pybindgen
-    git clone https://github.com/named-data/ndnSIM.git ns-3/src/ndnSIM
+    git clone https://github.com/named-data-ndnSIM/ns-3-dev.git ns-3
+    git clone https://github.com/named-data-ndnSIM/pybindgen.git pybindgen
+    git clone https://github.com/named-data-ndnSIM/ndnSIM.git ns-3/src/ndnSIM
 
 The few modification to the base NS-3 code are necessary to run ndnSIM, and the code is
 periodically synchronized with the official developer branch.  Eventually, all the changes will
@@ -254,9 +254,9 @@
 
         mkdir ndnSIM
         cd ndnSIM
-        git clone https://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
-        git clone https://github.com/cawka/pybindgen.git pybindgen
-        git clone https://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM
+        git clone https://github.com/named-data-ndnSIM/ns-3-dev.git ns-3
+        git clone https://github.com/named-data-ndnSIM/pybindgen.git pybindgen
+        git clone https://github.com/named-data-ndnSIM/ndnSIM.git ns-3/src/ndnSIM
 
         # Build and install NS-3 and ndnSIM
         cd ns-3
@@ -266,7 +266,7 @@
         sudo ./waf install
         cd ..
 
-        git clone https://github.com/cawka/ndnSIM-scenario-template.git scenario
+        git clone https://github.com/named-data-ndnSIM/scenario-template.git scenario
         cd scenario
         export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
         export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
diff --git a/examples/ndn-custom-apps/custom-app.cpp b/examples/ndn-custom-apps/custom-app.cpp
index 9aad485..00e79a5 100644
--- a/examples/ndn-custom-apps/custom-app.cpp
+++ b/examples/ndn-custom-apps/custom-app.cpp
@@ -29,7 +29,7 @@
 #include "ns3/ndnSIM/helper/ndn-stack-helper.hpp"
 #include "ns3/ndnSIM/helper/ndn-fib-helper.hpp"
 
-#include "ns3/random-variable.h"
+#include "ns3/random-variable-stream.h"
 
 NS_LOG_COMPONENT_DEFINE("CustomApp");
 
@@ -76,8 +76,8 @@
 
   // Create and configure ndn::Interest
   auto interest = std::make_shared<ndn::Interest>("/prefix/sub");
-  UniformVariable rand(0, std::numeric_limits<uint32_t>::max());
-  interest->setNonce(rand.GetValue());
+  Ptr<UniformRandomVariable> rand = CreateObject<UniformRandomVariable>();
+  interest->setNonce(rand->GetValue(0, std::numeric_limits<uint32_t>::max()));
   interest->setInterestLifetime(ndn::time::seconds(1));
 
   NS_LOG_DEBUG("Sending Interest packet for " << *interest);
diff --git a/examples/ndn-simple-with-content-freshness/one-interest-requester.cpp b/examples/ndn-simple-with-content-freshness/one-interest-requester.cpp
index 828ae22..3643408 100644
--- a/examples/ndn-simple-with-content-freshness/one-interest-requester.cpp
+++ b/examples/ndn-simple-with-content-freshness/one-interest-requester.cpp
@@ -25,7 +25,7 @@
 #include "ns3/log.h"
 #include "ns3/simulator.h"
 #include "ns3/packet.h"
-#include "ns3/random-variable.h"
+#include "ns3/random-variable-stream.h"
 #include "ns3/string.h"
 
 NS_LOG_COMPONENT_DEFINE("OneInterestRequester");
@@ -85,8 +85,8 @@
 
   // Create and configure ndn::Interest
   auto interest = std::make_shared<ndn::Interest>(m_name);
-  UniformVariable rand(0, std::numeric_limits<uint32_t>::max());
-  interest->setNonce(rand.GetValue());
+  Ptr<UniformRandomVariable> rand = CreateObject<UniformRandomVariable>();
+  interest->setNonce(rand->GetValue(0, std::numeric_limits<uint32_t>::max()));
   interest->setInterestLifetime(ndn::time::seconds(1));
 
   NS_LOG_DEBUG("Sending Interest packet for " << m_name);
diff --git a/model/cs/content-store-impl.hpp b/model/cs/content-store-impl.hpp
index 9c55053..5765120 100644
--- a/model/cs/content-store-impl.hpp
+++ b/model/cs/content-store-impl.hpp
@@ -137,6 +137,9 @@
     return super::getPolicy();
   }
 
+public:
+  typedef void (*CsEntryCallback)(Ptr<const Entry>);
+
 private:
   void
   SetMaxSize(uint32_t maxSize);
@@ -157,8 +160,7 @@
 //////////////////////////////////////////
 
 template<class Policy>
-LogComponent
-  ContentStoreImpl<Policy>::g_log = LogComponent(("ndn.cs." + Policy::GetName()).c_str());
+LogComponent ContentStoreImpl<Policy>::g_log = LogComponent(("ndn.cs." + Policy::GetName()).c_str(), __FILE__);
 
 template<class Policy>
 TypeId
@@ -177,7 +179,8 @@
 
       .AddTraceSource("DidAddEntry",
                       "Trace fired every time entry is successfully added to the cache",
-                      MakeTraceSourceAccessor(&ContentStoreImpl<Policy>::m_didAddEntry));
+                      MakeTraceSourceAccessor(&ContentStoreImpl<Policy>::m_didAddEntry),
+                      "ns3::ndn::cs::ContentStoreImpl::CsEntryCallback");
 
   return tid;
 }
diff --git a/model/cs/content-store-with-freshness.hpp b/model/cs/content-store-with-freshness.hpp
index 3d4d980..4cfa700 100644
--- a/model/cs/content-store-with-freshness.hpp
+++ b/model/cs/content-store-with-freshness.hpp
@@ -78,7 +78,7 @@
 
 template<class Policy>
 LogComponent ContentStoreWithFreshness<Policy>::g_log = LogComponent(("ndn.cs.Freshness."
-                                                                      + Policy::GetName()).c_str());
+                                                                      + Policy::GetName()).c_str(), __FILE__);
 
 template<class Policy>
 TypeId
diff --git a/model/cs/content-store-with-stats.hpp b/model/cs/content-store-with-stats.hpp
index 979a5e5..3b84ac2 100644
--- a/model/cs/content-store-with-stats.hpp
+++ b/model/cs/content-store-with-stats.hpp
@@ -63,6 +63,9 @@
   virtual inline void
   Print(std::ostream& os) const;
 
+public:
+  typedef void (*RemoveCsEntryCallback)(Ptr<const Entry>, Time);
+
 private:
   static LogComponent g_log; ///< @brief Logging variable
 
@@ -77,7 +80,7 @@
 
 template<class Policy>
 LogComponent ContentStoreWithStats<Policy>::g_log = LogComponent(("ndn.cs.Stats."
-                                                                  + Policy::GetName()).c_str());
+                                                                  + Policy::GetName()).c_str(), __FILE__);
 
 template<class Policy>
 TypeId
@@ -91,7 +94,8 @@
 
       .AddTraceSource("WillRemoveEntry",
                       "Trace called just before content store entry will be removed",
-                      MakeTraceSourceAccessor(&ContentStoreWithStats<Policy>::m_willRemoveEntry))
+                      MakeTraceSourceAccessor(&ContentStoreWithStats<Policy>::m_willRemoveEntry),
+                      "ns3::ndn::cs::ContentStoreWithStats::RemoveCsEntryCallback")
 
     // trace stuff here
     ;
diff --git a/model/cs/custom-policies/probability-policy.hpp b/model/cs/custom-policies/probability-policy.hpp
index 7ad6fd0..8bfb1c6 100644
--- a/model/cs/custom-policies/probability-policy.hpp
+++ b/model/cs/custom-policies/probability-policy.hpp
@@ -27,7 +27,7 @@
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/list.hpp>
 
-#include <ns3/random-variable.h>
+#include <ns3/random-variable-stream.h>
 
 namespace ns3 {
 namespace ndn {
@@ -65,6 +65,7 @@
         : base_(base)
         , max_size_(100)
         , probability_(1.0)
+        , ns3_rand_(CreateObject<UniformRandomVariable>())
       {
       }
 
@@ -76,7 +77,7 @@
       inline bool
       insert(typename parent_trie::iterator item)
       {
-        if (ns3_rand_.GetValue() < probability_) {
+        if (ns3_rand_->GetValue() < probability_) {
           policy_container::push_back(*item);
 
           // allow caching
@@ -138,7 +139,7 @@
       Base& base_;
       size_t max_size_;
       double probability_;
-      UniformVariable ns3_rand_;
+      Ptr<UniformRandomVariable> ns3_rand_;
     };
   };
 };
diff --git a/model/cs/ndn-content-store.cpp b/model/cs/ndn-content-store.cpp
index 02a13cb..416bde3 100644
--- a/model/cs/ndn-content-store.cpp
+++ b/model/cs/ndn-content-store.cpp
@@ -38,10 +38,12 @@
       .SetParent<Object>()
 
       .AddTraceSource("CacheHits", "Trace called every time there is a cache hit",
-                      MakeTraceSourceAccessor(&ContentStore::m_cacheHitsTrace))
+                      MakeTraceSourceAccessor(&ContentStore::m_cacheHitsTrace),
+                      "ns3::ndn::ContentStore::CacheHitsCallback")
 
       .AddTraceSource("CacheMisses", "Trace called every time there is a cache miss",
-                      MakeTraceSourceAccessor(&ContentStore::m_cacheMissesTrace));
+                      MakeTraceSourceAccessor(&ContentStore::m_cacheMissesTrace),
+                      "ns3::ndn::ContentStrore::CacheMissesCallback");
 
   return tid;
 }
diff --git a/model/cs/ndn-content-store.hpp b/model/cs/ndn-content-store.hpp
index cdbb1ea..36994f8 100644
--- a/model/cs/ndn-content-store.hpp
+++ b/model/cs/ndn-content-store.hpp
@@ -183,6 +183,10 @@
   static inline Ptr<ContentStore>
   GetContentStore(Ptr<Object> node);
 
+public:
+  typedef void (*CacheHitsCallback)(shared_ptr<const Interest>, shared_ptr<const Data>);
+  typedef void (*CacheMissesCallback)(shared_ptr<const Interest>);
+
 protected:
   TracedCallback<shared_ptr<const Interest>,
                  shared_ptr<const Data>> m_cacheHitsTrace; ///< @brief trace of cache hits
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index dd9f4dc..d45e84a 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -28,7 +28,6 @@
 #include "ns3/object-vector.h"
 #include "ns3/pointer.h"
 #include "ns3/simulator.h"
-#include "ns3/random-variable.h"
 
 #include "ndn-face.hpp"
 
@@ -70,21 +69,27 @@
       .AddConstructor<L3Protocol>()
 
       .AddTraceSource("OutInterests", "OutInterests",
-                      MakeTraceSourceAccessor(&L3Protocol::m_outInterests))
+                      MakeTraceSourceAccessor(&L3Protocol::m_outInterests),
+                      "ns3::ndn::L3Protocol::InterestTraceCallback")
       .AddTraceSource("InInterests", "InInterests",
-                      MakeTraceSourceAccessor(&L3Protocol::m_inInterests))
+                      MakeTraceSourceAccessor(&L3Protocol::m_inInterests),
+                      "ns3::ndn::L3Protocol::InterestTraceCallback")
 
       ////////////////////////////////////////////////////////////////////
 
-      .AddTraceSource("OutData", "OutData", MakeTraceSourceAccessor(&L3Protocol::m_outData))
-      .AddTraceSource("InData", "InData", MakeTraceSourceAccessor(&L3Protocol::m_inData))
+      .AddTraceSource("OutData", "OutData", MakeTraceSourceAccessor(&L3Protocol::m_outData),
+                      "ns3::ndn::L3Protocol::DataTraceCallback")
+      .AddTraceSource("InData", "InData", MakeTraceSourceAccessor(&L3Protocol::m_inData),
+                      "ns3::ndn::L3Protocol::DataTraceCallback")
 
       ////////////////////////////////////////////////////////////////////
 
       .AddTraceSource("SatisfiedInterests", "SatisfiedInterests",
-                      MakeTraceSourceAccessor(&L3Protocol::m_satisfiedInterests))
+                      MakeTraceSourceAccessor(&L3Protocol::m_satisfiedInterests),
+                      "ns3::ndn::L3Protocol::SatisfiedInterestsCallback")
       .AddTraceSource("TimedOutInterests", "TimedOutInterests",
-                      MakeTraceSourceAccessor(&L3Protocol::m_timedOutInterests))
+                      MakeTraceSourceAccessor(&L3Protocol::m_timedOutInterests),
+                      "ns3::ndn::L3Protocol::TimedOutInterestsCallback")
     ;
   return tid;
 }
diff --git a/model/ndn-l3-protocol.hpp b/model/ndn-l3-protocol.hpp
index ffd3bc2..9b63255 100644
--- a/model/ndn-l3-protocol.hpp
+++ b/model/ndn-l3-protocol.hpp
@@ -158,6 +158,13 @@
   static Ptr<L3Protocol>
   getL3Protocol(Ptr<Object> node);
 
+public:
+  typedef void (*InterestTraceCallback)(const Interest&, const Face&);
+  typedef void (*DataTraceCallback)(const Data&, const Face&);
+
+  typedef void (*SatisfiedInterestsCallback)(const nfd::pit::Entry& pitEntry, const Face& inFace, const Data& data);
+  typedef void (*TimedOutInterestsCallback)(const nfd::pit::Entry& pitEntry);
+
 protected:
   virtual void
   DoDispose(void); ///< @brief Do cleanup
diff --git a/utils/topology/annotated-topology-reader.cpp b/utils/topology/annotated-topology-reader.cpp
index c62b7e5..2874616 100644
--- a/utils/topology/annotated-topology-reader.cpp
+++ b/utils/topology/annotated-topology-reader.cpp
@@ -38,9 +38,9 @@
 #include "ns3/pointer.h"
 #include "ns3/uinteger.h"
 #include "ns3/ipv4-address.h"
-#include "ns3/random-variable.h"
 #include "ns3/error-model.h"
 #include "ns3/constant-position-mobility-model.h"
+#include "ns3/double.h"
 
 #include "model/ndn-l3-protocol.hpp"
 #include "model/ndn-net-device-face.hpp"
@@ -66,13 +66,19 @@
 
 AnnotatedTopologyReader::AnnotatedTopologyReader(const std::string& path, double scale /*=1.0*/)
   : m_path(path)
-  , m_randX(0, 100.0)
-  , m_randY(0, 100.0)
+  , m_randX(CreateObject<UniformRandomVariable>())
+  , m_randY(CreateObject<UniformRandomVariable>())
   , m_scale(scale)
   , m_requiredPartitions(1)
 {
   NS_LOG_FUNCTION(this);
 
+  m_randX->SetAttribute("Min", DoubleValue(0));
+  m_randX->SetAttribute("Max", DoubleValue(100.0));
+
+  m_randY->SetAttribute("Min", DoubleValue(0));
+  m_randY->SetAttribute("Max", DoubleValue(100.0));
+
   SetMobilityModel("ns3::ConstantPositionMobilityModel");
 }
 
@@ -81,8 +87,11 @@
 {
   NS_LOG_FUNCTION(this << ulx << uly << lrx << lry);
 
-  m_randX = UniformVariable(ulx, lrx);
-  m_randY = UniformVariable(uly, lry);
+  m_randX->SetAttribute("Min", DoubleValue(ulx));
+  m_randX->SetAttribute("Max", DoubleValue(lrx));
+
+  m_randY->SetAttribute("Min", DoubleValue(uly));
+  m_randY->SetAttribute("Max", DoubleValue(lry));
 }
 
 void
@@ -188,8 +197,8 @@
     if (abs(latitude) > 0.001 && abs(latitude) > 0.001)
       node = CreateNode(name, m_scale * longitude, -m_scale * latitude, systemId);
     else {
-      UniformVariable var(0, 200);
-      node = CreateNode(name, var.GetValue(), var.GetValue(), systemId);
+      Ptr<UniformRandomVariable> var = CreateObject<UniformRandomVariable>();
+      node = CreateNode(name, var->GetValue(0, 200), var->GetValue(0, 200), systemId);
       // node = CreateNode (name, systemId);
     }
   }
diff --git a/utils/topology/annotated-topology-reader.hpp b/utils/topology/annotated-topology-reader.hpp
index 7ae3b3f..343743d 100644
--- a/utils/topology/annotated-topology-reader.hpp
+++ b/utils/topology/annotated-topology-reader.hpp
@@ -23,7 +23,7 @@
 #define __ANNOTATED_TOPOLOGY_READER_H__
 
 #include "ns3/topology-reader.h"
-#include "ns3/random-variable.h"
+#include "ns3/random-variable-stream.h"
 #include "ns3/object-factory.h"
 
 namespace ns3 {
@@ -140,8 +140,8 @@
   AnnotatedTopologyReader&
   operator=(const AnnotatedTopologyReader&);
 
-  UniformVariable m_randX;
-  UniformVariable m_randY;
+  Ptr<UniformRandomVariable> m_randX;
+  Ptr<UniformRandomVariable> m_randY;
 
   ObjectFactory m_mobilityFactory;
   double m_scale;
diff --git a/utils/topology/rocketfuel-map-reader.cpp b/utils/topology/rocketfuel-map-reader.cpp
index b53b03b..969dd6e 100644
--- a/utils/topology/rocketfuel-map-reader.cpp
+++ b/utils/topology/rocketfuel-map-reader.cpp
@@ -40,7 +40,6 @@
 #include "ns3/uinteger.h"
 #include "ns3/ipv4-address.h"
 #include "ns3/node-list.h"
-#include "ns3/random-variable.h"
 
 #include "ns3/mobility-model.h"
 
@@ -64,6 +63,7 @@
 RocketfuelMapReader::RocketfuelMapReader(const std::string& path /*=""*/, double scale /*=1.0*/,
                                          const std::string& referenceOspfRate)
   : AnnotatedTopologyReader(path, scale)
+  , m_randVar(CreateObject<UniformRandomVariable>())
   , m_referenceOspfRate(boost::lexical_cast<DataRate>(referenceOspfRate))
 {
 }
@@ -103,15 +103,15 @@
   Link link(node1, nodeName1, node2, nodeName2);
 
   DataRate randBandwidth(
-    m_randVar.GetInteger(static_cast<uint32_t>(lexical_cast<DataRate>(minBw).GetBitRate()),
-                         static_cast<uint32_t>(lexical_cast<DataRate>(maxBw).GetBitRate())));
+    m_randVar->GetInteger(static_cast<uint32_t>(lexical_cast<DataRate>(minBw).GetBitRate()),
+                          static_cast<uint32_t>(lexical_cast<DataRate>(maxBw).GetBitRate())));
 
   int32_t metric = std::max(1, static_cast<int32_t>(1.0 * m_referenceOspfRate.GetBitRate()
                                                     / randBandwidth.GetBitRate()));
 
   Time randDelay =
-    Time::FromDouble((m_randVar.GetValue(lexical_cast<Time>(minDelay).ToDouble(Time::US),
-                                         lexical_cast<Time>(maxDelay).ToDouble(Time::US))),
+    Time::FromDouble((m_randVar->GetValue(lexical_cast<Time>(minDelay).ToDouble(Time::US),
+                                          lexical_cast<Time>(maxDelay).ToDouble(Time::US))),
                      Time::US);
 
   uint32_t queue = ceil(averageRtt * (randBandwidth.GetBitRate() / 8.0 / 1100.0));
@@ -273,7 +273,6 @@
   ifstream topgen;
   topgen.open(GetFileName().c_str());
   // NodeContainer nodes;
-  UniformVariable var;
 
   istringstream lineBuffer;
   string line;
@@ -708,11 +707,11 @@
     subgraphs[component].push_back(*bb);
   }
 
-  UniformVariable randVar;
+  Ptr<UniformRandomVariable> randVar = CreateObject<UniformRandomVariable>();
 
   for (int i = 1; i < num; i++) {
-    int node1 = randVar.GetInteger(0, subgraphs[i - 1].size() - 1);
-    int node2 = randVar.GetInteger(0, subgraphs[i].size() - 1);
+    int node1 = randVar->GetInteger(0, subgraphs[i - 1].size() - 1);
+    int node2 = randVar->GetInteger(0, subgraphs[i].size() - 1);
 
     Traits::vertex_descriptor v1 = get(vertex_name, bbGraph, subgraphs[i - 1][node1]),
                               v2 = get(vertex_name, bbGraph, subgraphs[i][node2]);
diff --git a/utils/topology/rocketfuel-map-reader.hpp b/utils/topology/rocketfuel-map-reader.hpp
index 3cf5ee2..1c089f0 100644
--- a/utils/topology/rocketfuel-map-reader.hpp
+++ b/utils/topology/rocketfuel-map-reader.hpp
@@ -25,7 +25,6 @@
 #include "annotated-topology-reader.hpp"
 
 #include "ns3/net-device-container.h"
-#include "ns3/random-variable.h"
 #include "ns3/data-rate.h"
 
 #include <set>
@@ -147,7 +146,7 @@
   ConnectBackboneRouters();
 
 private:
-  UniformVariable m_randVar;
+  Ptr<UniformRandomVariable> m_randVar;
 
   NodeContainer m_backboneRouters;
   NodeContainer m_gatewayRouters;
diff --git a/utils/trie/random-policy.hpp b/utils/trie/random-policy.hpp
index 813dae5..1e2aa4a 100644
--- a/utils/trie/random-policy.hpp
+++ b/utils/trie/random-policy.hpp
@@ -22,7 +22,7 @@
 
 /// @cond include_hidden
 
-#include "ns3/random-variable.h"
+#include "ns3/random-variable-stream.h"
 
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/set.hpp>
@@ -89,9 +89,11 @@
 
       type(Base& base)
         : base_(base)
-        , u_rand(0, std::numeric_limits<uint32_t>::max())
+        , u_rand(CreateObject<UniformRandomVariable>())
         , max_size_(100)
       {
+        u_rand->SetAttribute("Min", UintegerValue(0));
+        u_rand->SetAttribute("Max", UintegerValue(std::numeric_limits<uint32_t>::max()));
       }
 
       inline void
@@ -103,7 +105,7 @@
       inline bool
       insert(typename parent_trie::iterator item)
       {
-        get_order(item) = u_rand.GetValue();
+        get_order(item) = u_rand->GetValue();
 
         if (max_size_ != 0 && policy_container::size() >= max_size_) {
           if (MemberHookLess<Container>()(*item, *policy_container::begin())) {
@@ -157,7 +159,7 @@
 
     private:
       Base& base_;
-      ns3::UniformVariable u_rand;
+      Ptr<UniformRandomVariable> u_rand;
       size_t max_size_;
     };
   };