A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
brite-topology-helper.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 */
5
6#ifndef BRITE_TOPOLOGY_HELPER_H
7#define BRITE_TOPOLOGY_HELPER_H
8
9#include "ns3/channel.h"
10#include "ns3/internet-stack-helper.h"
11#include "ns3/ipv6-address-helper.h"
12#include "ns3/node-container.h"
13#include "ns3/node-list.h"
14#include "ns3/point-to-point-helper.h"
15#include "ns3/random-variable-stream.h"
16
17#include <string>
18#include <vector>
19
20// These are in #include <Brite.h>,
21// here we just need a forward declaration.
22namespace brite
23{
24class Topology;
25};
26
27namespace ns3
28{
29
30class PointToPointHelper;
31class Ipv4AddressHelper;
32
33/**
34 * \defgroup brite BRITE Topology Generator
35 *
36 * Create topologies with BRITE.
37 */
38
39/**
40 * \ingroup brite
41 * \ingroup tests
42 * \defgroup brite-tests BRITE module tests
43 */
44
45/**
46 * \ingroup brite
47 * \brief Interface with BRITE, the Boston university Representative Internet
48 * Topology gEnerator
49 *
50 * This helper class creates an interface with BRITE and allows the user to
51 * easily create ns-3 topologies from BRITE generated graphs. This class
52 * accepts a BRITE configuration and seed file, much like the stand-alone
53 * BRITE software. Using these files, BRITE generates a graph which is
54 * stored herein. ns-3 examples can then grab the BRITE generated nodes and
55 * edges from this helper and create ns-3 specific topologies.
56 *
57 */
58
60{
61 public:
62 /**
63 * Construct a BriteTopologyHelper
64 *
65 * \param confFile a BRITE configuration file
66 * \param seedFile a BRITE seed file
67 * \param newseedFile a BRITE seed file with newly generated values
68 */
69 BriteTopologyHelper(std::string confFile, std::string seedFile, std::string newseedFile);
70
71 /**
72 * Construct a BriteTopologyHelper using NS3 to generate seed values
73 * need by BRITE
74 * \param confFile a BRITE configuration file
75 */
76 BriteTopologyHelper(std::string confFile);
77
79
80 /**
81 * Assigns stream number to UniformRandomVariable used to
82 * generate brite seed file
83 *
84 * \param streamNumber the stream number to assign
85 */
86 void AssignStreams(int64_t streamNumber);
87
88 /**
89 * Create NS3 topology using information generated from BRITE.
90 *
91 * \param stack Internet stack to assign to nodes in topology
92 */
94
95 /**
96 * Create NS3 topology using information generated from BRITE and configure topology for MPI
97 * use.
98 *
99 * \param stack Internet stack to assign to nodes in topology.
100 * \param systemCount The number of MPI instances to be used in the simulation.
101 */
102 void BuildBriteTopology(InternetStackHelper& stack, const uint32_t systemCount);
103
104 /**
105 * Returns the number of router leaf nodes for a given AS
106 *
107 * \param asNum the AS number
108 * \returns the number of leaf nodes in the specified AS
109 */
111
112 /**
113 * Returns a given router leaf node from a given AS
114 *
115 * \param asNum the AS number
116 * \param leafNum the leaf number
117 * \returns the specified node
118 */
120
121 /**
122 * Returns the total number of nodes for a given AS
123 *
124 * \param asNum the AS number
125 * \returns the total number of nodes in the given AS
126 */
128
129 /**
130 * Returns a given router node for a given AS
131 *
132 * \param asNum the AS number
133 * \param nodeNum the Node number
134 * \return the specified node
135 */
136 Ptr<Node> GetNodeForAs(uint32_t asNum, uint32_t nodeNum);
137
138 /**
139 * Returns the number of AS created in the topology
140 *
141 * \returns the number of AS created in the topology
142 */
143 uint32_t GetNAs() const;
144
145 /**
146 * Returns the system number for the MPI instance that this AS is assigned to. Will always
147 * return 0 if MPI not used
148 *
149 * \returns The system number that the specified AS number belongs to
150 *
151 * \param asNum The AS Number
152 */
154
155 /**
156 * Assign IPv4 addresses.
157 *
158 * \param address an Ipv4AddressHelper which is used to install
159 * IPv4 addresses on all the node interfaces in
160 * the topology
161 */
163
164 /**
165 * Assign IPv6 addresses.
166 *
167 * \param address an Ipv6AddressHelper which is used to install
168 * IPv6 addresses on all the node interfaces in
169 * the topology
170 */
172
173 /**
174 * Returns the number of nodes created within
175 * the topology
176 *
177 * \returns the total number of nodes within the brite topology
178 */
180
181 /**
182 * Returns the number of edges created within
183 * the topology
184 *
185 * \returns the total number of edges within the brite topology
186 */
188
189 private:
190 /**
191 * brite values are unitless however all examples provided use mbps to specify rate
192 * this constant value is used to convert the mbps provided by brite to bps.
193 */
194 static const int mbpsToBps = 1000000;
195
196 /**
197 * \brief Node information from BRITE
198 *
199 * The BRITE code generates a graph and returns
200 * information on the nodes generated. This is
201 * stored here in a struct.
202 */
204 {
205 int nodeId; //!< Node ID
206 double xCoordinate; //!< X coordinate
207 double yCoordinate; //!< Y coordinate
208 int inDegree; //!< Ingress (IN) degree
209 int outDegree; //!< Egress (OUT) degree
210 int asId; //!< AS ID
211 std::string type; //!< Node type
212 };
213
214 /**
215 * \brief Edge information from BRITE
216 *
217 * The BRITE code generates a graph and returns
218 * information on the edges generated. This is
219 * stored here in a struct.
220 */
222 {
223 int edgeId; //!< Edge ID
224 int srcId; //!< Src node ID
225 int destId; //!< Dst node ID
226 double length; //!< Length
227 double delay; //!< Delay
228 double bandwidth; //!< Bandwidth
229 int asFrom; //!< Originating AS
230 int asTo; //!< Destination AS
231 std::string type; //!< Edge type
232 };
233
234 /// stores all of the nodes used in the BRITE generated topology
236
237 /// Build the Node Info list
239 /// Build the Edge Info list
241 /// Construct the topology.
242 void ConstructTopology();
243 /// Generate the BRITE topology.
245
246 /// brite configuration file to use
247 std::string m_confFile;
248
249 /// brite seed file to use
250 std::string m_seedFile;
251
252 /// brite seed file to generate for next run
253 std::string m_newSeedFile;
254
255 /// stores the number of AS in the BRITE generated topology
257
258 /// stores the netdevices created for each AS
259 std::vector<NetDeviceContainer*> m_netDevices;
260
261 /// stores the leaf router nodes for each AS
262 std::vector<NodeContainer*> m_asLeafNodes;
263
264 /// stores all of the nodes in the brite topology by AS number
265 std::vector<NodeContainer*> m_nodesByAs;
266
267 /// stores the MPI system number each AS assigned to. All assigned to 0 if MPI not used.
268 std::vector<int> m_systemForAs;
269
270 /// the Brite topology
271 brite::Topology* m_topology;
272
273 /// stores the number of nodes created in the BRITE topology
275
276 /// stores the number of edges created in the BRITE topology
278
279 /**
280 * The BRITE code generates multiple nodes and edges. Each
281 * node and edge is stored in a BriteNodeInfo or BriteEdgeInfo
282 * struct, and each instance is stored in a vector.
283 * @{
284 */
285 typedef std::vector<BriteNodeInfo> BriteNodeInfoList;
286 typedef std::vector<BriteEdgeInfo> BriteEdgeInfoList;
287
290 /**@}*/
291
292 /// used to create the links within the topology
294
295 /// random variable stream for brite seed file
297};
298
299} // namespace ns3
300
301#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.
BriteTopologyHelper(std::string confFile, std::string seedFile, std::string newseedFile)
Construct a BriteTopologyHelper.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.