NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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 */
STL namespace.
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).
Copyright (c) 2011-2015 Regents of the University of California.