A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
50
class
PointToPointHelper;
51
52
class
BriteTopologyHelper
53
{
54
public
:
55
/*
56
* Construct a BriteTopologyHelper
57
*
58
* \param confFile a BRITE configuration file
59
* \param seedFile a BRITE seed file
60
* \param newseedFile a BRITE seed file with newly generated values
61
*/
62
BriteTopologyHelper
(std::string confFile,
63
std::string seedFile,
64
std::string newseedFile);
65
66
/*
67
* Construct a BriteTopologyHelper using NS3 to generate seed values
68
* need by BRITE
69
*
70
*/
71
BriteTopologyHelper
(std::string confFile);
72
73
~BriteTopologyHelper
();
74
75
/*
76
* Assigns stream number to UniformRandomVariable used to
77
* generate brite seed file
78
*
79
* \param streamNumber the stream number to assign
80
*
81
*/
82
void
AssignStreams
(int64_t streamNumber);
83
84
/*
85
* Create NS3 topology using information generated from BRITE.
86
*
87
* \param stack Internet stack to assign to nodes in topology
88
*/
89
void
BuildBriteTopology
(
InternetStackHelper
& stack);
90
91
/*
92
* Create NS3 topology using information generated from BRITE and configure topology for MPI use.
93
*
94
* \param stack Internet stack to assign to nodes in topology.
95
* \param systemCount The number of MPI instances to be used in the simulation.
96
*
97
*/
98
void
BuildBriteTopology
(
InternetStackHelper
& stack,
const
uint32_t systemCount);
99
100
/*
101
* Returns the number of router leaf nodes for a given AS
102
*
103
* \param asNum the AS number
104
* \returns the number of leaf nodes in the specified AS
105
*
106
*/
107
uint32_t
GetNLeafNodesForAs
(uint32_t asNum);
108
109
/*
110
* Returns a given router leaf node from a given AS
111
*
112
* \param asNum the AS number
113
* \param leafNum the leaf number
114
* \returns the specified node
115
*/
116
Ptr<Node>
GetLeafNodeForAs
(uint32_t asNum, uint32_t leafNum);
117
118
/*
119
* Returns the total number of nodes for a given AS
120
*
121
* \param asNum the AS number
122
* \returns the total number of nodes in the given AS
123
*/
124
uint32_t
GetNNodesForAs
(uint32_t asNum);
125
126
/*
127
* Returns a given router node for a given AS
128
*
129
* \param asNum the AS number
130
* \return the specified node
131
*
132
*/
133
Ptr<Node>
GetNodeForAs
(uint32_t asNum, uint32_t nodeNum);
134
140
uint32_t
GetNAs
(
void
)
const
;
141
149
uint32_t
GetSystemNumberForAs
(uint32_t asNum)
const
;
150
156
void
AssignIpv4Addresses
(
Ipv4AddressHelper
& address);
157
163
void
AssignIpv6Addresses
(
Ipv6AddressHelper
& address);
164
171
uint32_t
GetNNodesTopology
()
const
;
172
179
uint32_t
GetNEdgesTopology
()
const
;
180
181
private
:
182
//brite values are unitless however all examples provided use mbps to specify rate
183
//this constant value is used to convert the mbps provided by brite to bps.
184
static
const
int
mbpsToBps
= 1000000;
185
193
struct
BriteNodeInfo
194
{
195
int
nodeId
;
196
double
xCoordinate
;
197
double
yCoordinate
;
198
int
inDegree
;
199
int
outDegree
;
200
int
asId
;
201
std::string
type
;
202
};
203
211
struct
BriteEdgeInfo
212
{
213
int
edgeId
;
214
int
srcId
;
215
int
destId
;
216
double
length
;
217
double
delay
;
218
double
bandwidth
;
219
int
asFrom
;
220
int
asTo
;
221
std::string
type
;
222
};
223
224
//stores all of the nodes used in the BRITE generated topology
225
NodeContainer
m_nodes
;
226
230
void
BuildBriteNodeInfoList
(
void
);
231
235
void
BuildBriteEdgeInfoList
(
void
);
236
240
void
ConstructTopology
(
void
);
241
245
void
GenerateBriteTopology
(
void
);
246
247
//brite configuration file to use
248
std::string
m_confFile
;
249
250
//brite seed file to use
251
std::string
m_seedFile
;
252
253
//brite seed file to generate for next run
254
std::string
m_newSeedFile
;
255
256
//stores the number of AS in the BRITE generated topology
257
uint32_t
m_numAs
;
258
259
//stores the netdevices created for each AS
260
std::vector<NetDeviceContainer*>
m_netDevices
;
261
262
//stores the leaf router nodes for each AS
263
std::vector<NodeContainer*>
m_asLeafNodes
;
264
265
//stores all of the nodes in the brite topology by AS number
266
std::vector<NodeContainer*>
m_nodesByAs
;
267
268
//stores the MPI system number each AS assigned to. All assigned to 0 if MPI not used.
269
std::vector<int>
m_systemForAs
;
270
271
brite::Topology*
m_topology
;
272
273
//stores the number of nodes created in the BRITE topology
274
uint32_t
m_numNodes
;
275
276
//stores the number of edges created in the BRITE topology
277
uint32_t
m_numEdges
;
278
284
typedef
std::vector<BriteNodeInfo>
BriteNodeInfoList
;
285
typedef
std::vector<BriteEdgeInfo>
BriteEdgeInfoList
;
286
287
BriteNodeInfoList
m_briteNodeInfoList
;
288
BriteEdgeInfoList
m_briteEdgeInfoList
;
289
290
//used to create the links within the topology
291
PointToPointHelper
m_britePointToPointHelper
;
292
293
Ptr<UniformRandomVariable>
m_uv
;
294
};
295
296
}
// namespace ns3
297
298
#endif
/* BRITE_TOPOLOGY_HELPER_H */
src
brite
helper
brite-topology-helper.h
Generated on Tue May 14 2013 11:08:16 for ns-3 by
1.8.1.2