NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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/random-variable.h"
29 #include "ns3/data-rate.h"
30 
31 #include <set>
32 #include <boost/graph/adjacency_list.hpp>
33 
34 using namespace std;
35 
36 namespace ns3 {
37 
39  double averageRtt;
41 
42  // parameters for links Backbone <->Backbone
44  string minb2bDelay;
45 
47  string maxb2bDelay;
48 
49  // parameters for links Backbone<->Gateway and Gateway <-> Gateway
51  string minb2gDelay;
52 
54  string maxb2gDelay;
55 
56  // parameters for links Gateway <-> Customer
58  string ming2cDelay;
59 
61  string maxg2cDelay;
62 };
63 
82 public:
83  RocketfuelMapReader(const std::string& path = "", double scale = 1.0,
84  const string& referenceOspfRate = "100Mbps");
85  virtual ~RocketfuelMapReader();
86 
91  virtual NodeContainer
92  Read();
93 
110  virtual NodeContainer
111  Read(RocketfuelParams params, bool keepOneComponent = true, bool connectBackbones = true);
112 
113  const NodeContainer&
114  GetBackboneRouters() const;
115 
116  const NodeContainer&
117  GetGatewayRouters() const;
118 
119  const NodeContainer&
120  GetCustomerRouters() const;
121 
122  virtual void
123  SaveTopology(const std::string& file);
124 
125  virtual void
126  SaveGraphviz(const std::string& file);
127 
128 private:
131  operator=(const RocketfuelMapReader&);
132 
133  // NodeContainer
134  void
135  GenerateFromMapsFile(int argc, char* argv[]);
136 
137  void
138  CreateLink(string nodeName1, string nodeName2, double averageRtt, const string& minBw,
139  const string& maxBw, const string& minDelay, const string& maxDelay);
140  void
141  KeepOnlyBiggestConnectedComponent();
142 
143  void
144  AssignClients(uint32_t clientDegree, uint32_t gwDegree);
145 
146  void
147  ConnectBackboneRouters();
148 
149 private:
150  UniformVariable m_randVar;
151 
152  NodeContainer m_backboneRouters;
153  NodeContainer m_gatewayRouters;
154  NodeContainer m_customerRouters;
155 
156  typedef boost::adjacency_list_traits<boost::setS, boost::setS, boost::undirectedS> Traits;
157 
158  enum node_type_t { UNKNOWN = 0, CLIENT = 1, GATEWAY = 2, BACKBONE = 3 };
159 
160  typedef boost::
161  property<boost::vertex_name_t, std::string,
162  boost::property<boost::vertex_index_t, uint32_t,
163  boost::property<boost::vertex_rank_t, node_type_t,
164  boost::property<boost::vertex_color_t, std::string>>>>
165  nodeProperty;
166 
167  typedef boost::no_property edgeProperty;
168 
169  typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, nodeProperty,
170  edgeProperty> Graph;
171 
172  typedef map<string, Traits::vertex_descriptor> node_map_t;
173  node_map_t m_graphNodes;
174 
175  Graph m_graph;
176  uint32_t m_maxNodeId;
177 
178  const DataRate m_referenceOspfRate; // reference rate of OSPF metric calculation
179 
180 private:
181  void
182  assignGw(Traits::vertex_descriptor vertex, uint32_t degree, node_type_t nodeType);
183 }; // end class RocketfuelMapReader
184 
185 }; // end namespace ns3
186 
187 #endif /* ROCKETFUEL_MAP_READER_H */
This class reads annotated topology and apply settings to the corresponding nodes and links...
Topology file reader and topology estimator (extension of Rocketfuel-format type).