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/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_;
};
};