A Discrete-Event Network Simulator
API
brite-topology-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  */
17 
18 #ifndef BRITE_TOPOLOGY_HELPER_H
19 #define BRITE_TOPOLOGY_HELPER_H
20 
21 #include <string>
22 #include <vector>
23 
24 #include "ns3/channel.h"
25 #include "ns3/node-container.h"
26 #include "ns3/node-list.h"
27 #include "ns3/point-to-point-helper.h"
28 #include "ns3/internet-stack-helper.h"
29 #include "ns3/ipv6-address-helper.h"
30 #include "ns3/random-variable-stream.h"
31 
32 //located in BRITE source directory
33 #include "Brite.h"
34 
35 namespace ns3 {
36 
37 class PointToPointHelper;
38 
60 {
61 public:
69  BriteTopologyHelper (std::string confFile,
70  std::string seedFile,
71  std::string newseedFile);
72 
78  BriteTopologyHelper (std::string confFile);
79 
81 
89  void AssignStreams (int64_t streamNumber);
90 
97 
105  void BuildBriteTopology (InternetStackHelper& stack, const uint32_t systemCount);
106 
114  uint32_t GetNLeafNodesForAs (uint32_t asNum);
115 
123  Ptr<Node> GetLeafNodeForAs (uint32_t asNum, uint32_t leafNum);
124 
131  uint32_t GetNNodesForAs (uint32_t asNum);
132 
140  Ptr<Node> GetNodeForAs (uint32_t asNum, uint32_t nodeNum);
141 
147  uint32_t GetNAs (void) const;
148 
156  uint32_t GetSystemNumberForAs (uint32_t asNum) const;
157 
164 
171 
178  uint32_t GetNNodesTopology () const;
179 
186  uint32_t GetNEdgesTopology () const;
187 
188 private:
189  //brite values are unitless however all examples provided use mbps to specify rate
190  //this constant value is used to convert the mbps provided by brite to bps.
191  static const int mbpsToBps = 1000000;
192 
201  {
202  int nodeId;
203  double xCoordinate;
204  double yCoordinate;
205  int inDegree;
207  int asId;
208  std::string type;
209  };
210 
219  {
220  int edgeId;
221  int srcId;
222  int destId;
223  double length;
224  double delay;
225  double bandwidth;
226  int asFrom;
227  int asTo;
228  std::string type;
229  };
230 
231  //stores all of the nodes used in the BRITE generated topology
233 
234  void BuildBriteNodeInfoList (void);
235  void BuildBriteEdgeInfoList (void);
236  void ConstructTopology (void);
237  void GenerateBriteTopology (void);
238 
240  std::string m_confFile;
241 
243  std::string m_seedFile;
244 
246  std::string m_newSeedFile;
247 
249  uint32_t m_numAs;
250 
252  std::vector<NetDeviceContainer*> m_netDevices;
253 
255  std::vector<NodeContainer*> m_asLeafNodes;
256 
258  std::vector<NodeContainer*> m_nodesByAs;
259 
261  std::vector<int> m_systemForAs;
262 
264  brite::Topology* m_topology;
265 
267  uint32_t m_numNodes;
268 
270  uint32_t m_numEdges;
271 
278  typedef std::vector<BriteNodeInfo> BriteNodeInfoList;
279  typedef std::vector<BriteEdgeInfo> BriteEdgeInfoList;
280 
287 
290 };
291 
292 } // namespace ns3
293 
294 #endif /* BRITE_TOPOLOGY_HELPER_H */
uint32_t GetNNodesForAs(uint32_t asNum)
Returns the total number of nodes for a given AS.
std::vector< BriteNodeInfo > BriteNodeInfoList
The BRITE code generates multiple nodes and edges.
uint32_t GetNLeafNodesForAs(uint32_t asNum)
Returns the number of router leaf nodes for a given AS.
uint32_t m_numEdges
stores the number of edges created in the BRITE topology
uint32_t GetSystemNumberForAs(uint32_t asNum) const
Returns the system number for the MPI instance that this AS is assigned to.
Ptr< Node > GetNodeForAs(uint32_t asNum, uint32_t nodeNum)
Returns a given router node for a given AS.
aggregate IP/TCP/UDP functionality to existing Nodes.
Interface with BRITE, the Boston university Representative Internet Topology gEnerator.
void AssignIpv6Addresses(Ipv6AddressHelper &address)
Build a set of PointToPointNetDevice objects.
void AssignStreams(int64_t streamNumber)
Assigns stream number to UniformRandomVariable used to generate brite seed file.
stack
Definition: first.py:41
brite::Topology * m_topology
the Brite topology
std::vector< NodeContainer * > m_nodesByAs
stores all of the nodes in the brite topology by AS number
std::string m_newSeedFile
brite seed file to generate for next run
BriteTopologyHelper(std::string confFile, std::string seedFile, std::string newseedFile)
Construct a BriteTopologyHelper.
void AssignIpv4Addresses(Ipv4AddressHelper &address)
uint32_t GetNAs(void) const
Returns the number of AS created in the topology.
std::vector< int > m_systemForAs
stores the MPI system number each AS assigned to. All assigned to 0 if MPI not used.
uint32_t GetNEdgesTopology() const
Returns the number of edges created within the topology.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetNNodesTopology() const
Returns the number of nodes created within the topology.
keep track of a set of node pointers.
address
Definition: first.py:44
BriteNodeInfoList m_briteNodeInfoList
The BRITE code generates multiple nodes and edges.
std::string m_confFile
brite configuration file to use
Helper class to auto-assign global IPv6 unicast addresses.
Ptr< UniformRandomVariable > m_uv
random variable stream for brite seed file
std::vector< NetDeviceContainer * > m_netDevices
stores the netdevices created for each AS
std::vector< NodeContainer * > m_asLeafNodes
stores the leaf router nodes for each AS
uint32_t m_numAs
stores the number of AS in the BRITE generated topology
PointToPointHelper m_britePointToPointHelper
used to create the links within the topology
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
std::vector< BriteEdgeInfo > BriteEdgeInfoList
The BRITE code generates multiple nodes and edges.
Ptr< Node > GetLeafNodeForAs(uint32_t asNum, uint32_t leafNum)
Returns a given router leaf node from a given AS.
std::string m_seedFile
brite seed file to use
uint32_t m_numNodes
stores the number of nodes created in the BRITE topology
void BuildBriteTopology(InternetStackHelper &stack)
Create NS3 topology using information generated from BRITE.
BriteEdgeInfoList m_briteEdgeInfoList
The BRITE code generates multiple nodes and edges.