A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
brite-topology-helper.h
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation;
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 *
15 */
16
17#ifndef BRITE_TOPOLOGY_HELPER_H
18#define BRITE_TOPOLOGY_HELPER_H
19
20#include "ns3/channel.h"
21#include "ns3/internet-stack-helper.h"
22#include "ns3/ipv6-address-helper.h"
23#include "ns3/node-container.h"
24#include "ns3/node-list.h"
25#include "ns3/point-to-point-helper.h"
26#include "ns3/random-variable-stream.h"
27
28#include <string>
29#include <vector>
30
31// These are in #include <Brite.h>,
32// here we just need a forward declaration.
33namespace brite
34{
35class Topology;
36};
37
38namespace ns3
39{
40
41class PointToPointHelper;
42class Ipv4AddressHelper;
43
44/**
45 * \defgroup brite BRITE Topology Generator
46 *
47 * Create topologies with BRITE.
48 */
49
50/**
51 * \ingroup brite
52 * \ingroup tests
53 * \defgroup brite-tests BRITE module tests
54 */
55
56/**
57 * \ingroup brite
58 * \brief Interface with BRITE, the Boston university Representative Internet
59 * Topology gEnerator
60 *
61 * This helper class creates an interface with BRITE and allows the user to
62 * easily create ns-3 topologies from BRITE generated graphs. This class
63 * accepts a BRITE configuration and seed file, much like the stand-alone
64 * BRITE software. Using these files, BRITE generates a graph which is
65 * stored herein. ns-3 examples can then grab the BRITE generated nodes and
66 * edges from this helper and create ns-3 specific topologies.
67 *
68 */
69
71{
72 public:
73 /**
74 * Construct a BriteTopologyHelper
75 *
76 * \param confFile a BRITE configuration file
77 * \param seedFile a BRITE seed file
78 * \param newseedFile a BRITE seed file with newly generated values
79 */
80 BriteTopologyHelper(std::string confFile, std::string seedFile, std::string newseedFile);
81
82 /**
83 * Construct a BriteTopologyHelper using NS3 to generate seed values
84 * need by BRITE
85 * \param confFile a BRITE configuration file
86 */
87 BriteTopologyHelper(std::string confFile);
88
90
91 /**
92 * Assigns stream number to UniformRandomVariable used to
93 * generate brite seed file
94 *
95 * \param streamNumber the stream number to assign
96 */
97 void AssignStreams(int64_t streamNumber);
98
99 /**
100 * Create NS3 topology using information generated from BRITE.
101 *
102 * \param stack Internet stack to assign to nodes in topology
103 */
105
106 /**
107 * Create NS3 topology using information generated from BRITE and configure topology for MPI
108 * use.
109 *
110 * \param stack Internet stack to assign to nodes in topology.
111 * \param systemCount The number of MPI instances to be used in the simulation.
112 */
113 void BuildBriteTopology(InternetStackHelper& stack, const uint32_t systemCount);
114
115 /**
116 * Returns the number of router leaf nodes for a given AS
117 *
118 * \param asNum the AS number
119 * \returns the number of leaf nodes in the specified AS
120 */
122
123 /**
124 * Returns a given router leaf node from a given AS
125 *
126 * \param asNum the AS number
127 * \param leafNum the leaf number
128 * \returns the specified node
129 */
131
132 /**
133 * Returns the total number of nodes for a given AS
134 *
135 * \param asNum the AS number
136 * \returns the total number of nodes in the given AS
137 */
139
140 /**
141 * Returns a given router node for a given AS
142 *
143 * \param asNum the AS number
144 * \param nodeNum the Node number
145 * \return the specified node
146 */
147 Ptr<Node> GetNodeForAs(uint32_t asNum, uint32_t nodeNum);
148
149 /**
150 * Returns the number of AS created in the topology
151 *
152 * \returns the number of AS created in the topology
153 */
154 uint32_t GetNAs() const;
155
156 /**
157 * Returns the system number for the MPI instance that this AS is assigned to. Will always
158 * return 0 if MPI not used
159 *
160 * \returns The system number that the specified AS number belongs to
161 *
162 * \param asNum The AS Number
163 */
165
166 /**
167 * Assign IPv4 addresses.
168 *
169 * \param address an Ipv4AddressHelper which is used to install
170 * IPv4 addresses on all the node interfaces in
171 * the topology
172 */
174
175 /**
176 * Assign IPv6 addresses.
177 *
178 * \param address an Ipv6AddressHelper which is used to install
179 * IPv6 addresses on all the node interfaces in
180 * the topology
181 */
183
184 /**
185 * Returns the number of nodes created within
186 * the topology
187 *
188 * \returns the total number of nodes within the brite topology
189 */
191
192 /**
193 * Returns the number of edges created within
194 * the topology
195 *
196 * \returns the total number of edges within the brite topology
197 */
199
200 private:
201 /**
202 * brite values are unitless however all examples provided use mbps to specify rate
203 * this constant value is used to convert the mbps provided by brite to bps.
204 */
205 static const int mbpsToBps = 1000000;
206
207 /**
208 * \brief Node information from BRITE
209 *
210 * The BRITE code generates a graph and returns
211 * information on the nodes generated. This is
212 * stored here in a struct.
213 */
215 {
216 int nodeId; //!< Node ID
217 double xCoordinate; //!< X coordinate
218 double yCoordinate; //!< Y coordinate
219 int inDegree; //!< Ingress (IN) degree
220 int outDegree; //!< Egress (OUT) degree
221 int asId; //!< AS ID
222 std::string type; //!< Node type
223 };
224
225 /**
226 * \brief Edge information from BRITE
227 *
228 * The BRITE code generates a graph and returns
229 * information on the edges generated. This is
230 * stored here in a struct.
231 */
233 {
234 int edgeId; //!< Edge ID
235 int srcId; //!< Src node ID
236 int destId; //!< Dst node ID
237 double length; //!< Length
238 double delay; //!< Delay
239 double bandwidth; //!< Bandwidth
240 int asFrom; //!< Originating AS
241 int asTo; //!< Destination AS
242 std::string type; //!< Edge type
243 };
244
245 /// stores all of the nodes used in the BRITE generated topology
247
248 /// Build the Node Info list
250 /// Build the Edge Info list
252 /// Construct the topology.
253 void ConstructTopology();
254 /// Generate the BRITE topology.
256
257 /// brite configuration file to use
258 std::string m_confFile;
259
260 /// brite seed file to use
261 std::string m_seedFile;
262
263 /// brite seed file to generate for next run
264 std::string m_newSeedFile;
265
266 /// stores the number of AS in the BRITE generated topology
268
269 /// stores the netdevices created for each AS
270 std::vector<NetDeviceContainer*> m_netDevices;
271
272 /// stores the leaf router nodes for each AS
273 std::vector<NodeContainer*> m_asLeafNodes;
274
275 /// stores all of the nodes in the brite topology by AS number
276 std::vector<NodeContainer*> m_nodesByAs;
277
278 /// stores the MPI system number each AS assigned to. All assigned to 0 if MPI not used.
279 std::vector<int> m_systemForAs;
280
281 /// the Brite topology
282 brite::Topology* m_topology;
283
284 /// stores the number of nodes created in the BRITE topology
286
287 /// stores the number of edges created in the BRITE topology
289
290 /**
291 * The BRITE code generates multiple nodes and edges. Each
292 * node and edge is stored in a BriteNodeInfo or BriteEdgeInfo
293 * struct, and each instance is stored in a vector.
294 * @{
295 */
296 typedef std::vector<BriteNodeInfo> BriteNodeInfoList;
297 typedef std::vector<BriteEdgeInfo> BriteEdgeInfoList;
298
301 /**@}*/
302
303 /// used to create the links within the topology
305
306 /// random variable stream for brite seed file
308};
309
310} // namespace ns3
311
312#endif /* BRITE_TOPOLOGY_HELPER_H */
Interface with BRITE, the Boston university Representative Internet Topology gEnerator.
BriteNodeInfoList m_briteNodeInfoList
The BRITE code generates multiple nodes and edges.
void AssignIpv6Addresses(Ipv6AddressHelper &address)
Assign IPv6 addresses.
void AssignStreams(int64_t streamNumber)
Assigns stream number to UniformRandomVariable used to generate brite seed file.
BriteEdgeInfoList m_briteEdgeInfoList
The BRITE code generates multiple nodes and edges.
PointToPointHelper m_britePointToPointHelper
used to create the links within the topology
Ptr< UniformRandomVariable > m_uv
random variable stream for brite seed file
brite::Topology * m_topology
the Brite topology
uint32_t m_numNodes
stores the number of nodes created in the BRITE topology
uint32_t GetNAs() const
Returns the number of AS created in the topology.
std::vector< NetDeviceContainer * > m_netDevices
stores the netdevices created for each AS
uint32_t m_numEdges
stores the number of edges created in the BRITE topology
uint32_t GetNNodesTopology() const
Returns the number of nodes created within the topology.
void BuildBriteTopology(InternetStackHelper &stack)
Create NS3 topology using information generated from BRITE.
std::vector< NodeContainer * > m_asLeafNodes
stores the leaf router nodes for each AS
std::vector< NodeContainer * > m_nodesByAs
stores all of the nodes in the brite topology by AS number
uint32_t m_numAs
stores the number of AS in the BRITE generated topology
void BuildBriteNodeInfoList()
Build the Node Info list.
void GenerateBriteTopology()
Generate the BRITE topology.
static const int mbpsToBps
brite values are unitless however all examples provided use mbps to specify rate this constant value ...
Ptr< Node > GetNodeForAs(uint32_t asNum, uint32_t nodeNum)
Returns a given router node for a given AS.
void ConstructTopology()
Construct the topology.
void BuildBriteEdgeInfoList()
Build the Edge Info list.
void AssignIpv4Addresses(Ipv4AddressHelper &address)
Assign IPv4 addresses.
uint32_t GetNNodesForAs(uint32_t asNum)
Returns the total number of nodes for a given AS.
uint32_t GetNLeafNodesForAs(uint32_t asNum)
Returns the number of router leaf nodes for a given AS.
std::string m_newSeedFile
brite seed file to generate for next run
std::vector< BriteNodeInfo > BriteNodeInfoList
The BRITE code generates multiple nodes and edges.
std::string m_seedFile
brite seed file to use
std::vector< BriteEdgeInfo > BriteEdgeInfoList
The BRITE code generates multiple nodes and edges.
std::vector< int > m_systemForAs
stores the MPI system number each AS assigned to. All assigned to 0 if MPI not used.
NodeContainer m_nodes
stores all of the nodes used in the BRITE generated topology
uint32_t GetNEdgesTopology() const
Returns the number of edges created within the topology.
Ptr< Node > GetLeafNodeForAs(uint32_t asNum, uint32_t leafNum)
Returns a given router leaf node from a given AS.
uint32_t GetSystemNumberForAs(uint32_t asNum) const
Returns the system number for the MPI instance that this AS is assigned to.
std::string m_confFile
brite configuration file to use
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Helper class to auto-assign global IPv6 unicast addresses.
keep track of a set of node pointers.
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.