NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
rocketfuel-map-reader.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 // Based on the code by Hajime Tazaki <tazaki@sfc.wide.ad.jp>
21 
22 #ifndef ROCKETFUEL_MAP_READER_H
23 #define ROCKETFUEL_MAP_READER_H
24 
26 
27 #include "ns3/net-device-container.h"
28 #include "ns3/data-rate.h"
29 
30 #include <set>
31 #include <boost/graph/adjacency_list.hpp>
32 
33 using namespace std;
34 
35 namespace ns3 {
36 
38  double averageRtt;
40 
41  // parameters for links Backbone <->Backbone
43  string minb2bDelay;
44 
46  string maxb2bDelay;
47 
48  // parameters for links Backbone<->Gateway and Gateway <-> Gateway
50  string minb2gDelay;
51 
53  string maxb2gDelay;
54 
55  // parameters for links Gateway <-> Customer
57  string ming2cDelay;
58 
60  string maxg2cDelay;
61 };
62 
81 public:
82  RocketfuelMapReader(const std::string& path = "", double scale = 1.0,
83  const string& referenceOspfRate = "100Mbps");
84  virtual ~RocketfuelMapReader();
85 
90  virtual NodeContainer
91  Read();
92 
109  virtual NodeContainer
110  Read(RocketfuelParams params, bool keepOneComponent = true, bool connectBackbones = true);
111 
112  const NodeContainer&
113  GetBackboneRouters() const;
114 
115  const NodeContainer&
116  GetGatewayRouters() const;
117 
118  const NodeContainer&
119  GetCustomerRouters() const;
120 
121  virtual void
122  SaveTopology(const std::string& file);
123 
124  virtual void
125  SaveGraphviz(const std::string& file);
126 
127 private:
130  operator=(const RocketfuelMapReader&);
131 
132  // NodeContainer
133  void
134  GenerateFromMapsFile(int argc, char* argv[]);
135 
136  void
137  CreateLink(string nodeName1, string nodeName2, double averageRtt, const string& minBw,
138  const string& maxBw, const string& minDelay, const string& maxDelay);
139  void
140  KeepOnlyBiggestConnectedComponent();
141 
142  void
143  AssignClients(uint32_t clientDegree, uint32_t gwDegree);
144 
145  void
146  ConnectBackboneRouters();
147 
148 private:
149  Ptr<UniformRandomVariable> m_randVar;
150 
151  NodeContainer m_backboneRouters;
152  NodeContainer m_gatewayRouters;
153  NodeContainer m_customerRouters;
154 
155  typedef boost::adjacency_list_traits<boost::setS, boost::setS, boost::undirectedS> Traits;
156 
157  enum node_type_t { UNKNOWN = 0, CLIENT = 1, GATEWAY = 2, BACKBONE = 3 };
158 
159  typedef boost::
160  property<boost::vertex_name_t, std::string,
161  boost::property<boost::vertex_index_t, uint32_t,
162  boost::property<boost::vertex_rank_t, node_type_t,
163  boost::property<boost::vertex_color_t, std::string>>>>
164  nodeProperty;
165 
166  typedef boost::no_property edgeProperty;
167 
168  typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, nodeProperty,
169  edgeProperty> Graph;
170 
171  typedef map<string, Traits::vertex_descriptor> node_map_t;
172  node_map_t m_graphNodes;
173 
174  Graph m_graph;
175  uint32_t m_maxNodeId;
176 
177  const DataRate m_referenceOspfRate; // reference rate of OSPF metric calculation
178 
179 private:
180  void
181  assignGw(Traits::vertex_descriptor vertex, uint32_t degree, node_type_t nodeType);
182 }; // end class RocketfuelMapReader
183 
184 } // end namespace ns3
185 
186 #endif /* ROCKETFUEL_MAP_READER_H */
ns3::RocketfuelParams::maxb2bDelay
string maxb2bDelay
Definition: rocketfuel-map-reader.hpp:46
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::RocketfuelParams::maxb2bBandwidth
string maxb2bBandwidth
Definition: rocketfuel-map-reader.hpp:45
ns3::RocketfuelParams::maxg2cBandwidth
string maxg2cBandwidth
Definition: rocketfuel-map-reader.hpp:59
ns3::RocketfuelParams::ming2cDelay
string ming2cDelay
Definition: rocketfuel-map-reader.hpp:57
ns3::RocketfuelParams::minb2bBandwidth
string minb2bBandwidth
Definition: rocketfuel-map-reader.hpp:42
RocketfuelMapReader
RocketfuelMapReader
Definition: rocketfuel-map-reader.cpp:59
ns3::RocketfuelParams::averageRtt
double averageRtt
Definition: rocketfuel-map-reader.hpp:38
ns3::RocketfuelMapReader
Topology file reader and topology estimator (extension of Rocketfuel-format type).
Definition: rocketfuel-map-reader.hpp:80
ns3::RocketfuelParams::maxb2gBandwidth
string maxb2gBandwidth
Definition: rocketfuel-map-reader.hpp:52
ns3::RocketfuelParams::minb2gDelay
string minb2gDelay
Definition: rocketfuel-map-reader.hpp:50
ns3::RocketfuelParams::minb2bDelay
string minb2bDelay
Definition: rocketfuel-map-reader.hpp:43
ns3::RocketfuelParams::minb2gBandwidth
string minb2gBandwidth
Definition: rocketfuel-map-reader.hpp:49
ns3::RocketfuelParams::ming2cBandwidth
string ming2cBandwidth
Definition: rocketfuel-map-reader.hpp:56
ns3::AnnotatedTopologyReader
This class reads annotated topology and apply settings to the corresponding nodes and links.
Definition: annotated-topology-reader.hpp:37
ns3::RocketfuelParams::maxg2cDelay
string maxg2cDelay
Definition: rocketfuel-map-reader.hpp:60
ns3::RocketfuelParams::clientNodeDegrees
int clientNodeDegrees
Definition: rocketfuel-map-reader.hpp:39
ns3::RocketfuelParams::maxb2gDelay
string maxb2gDelay
Definition: rocketfuel-map-reader.hpp:53
annotated-topology-reader.hpp
ns3::RocketfuelParams
Definition: rocketfuel-map-reader.hpp:37