Class BriteNetworkTopology
java.lang.Object
org.cloudbus.cloudsim.network.topologies.BriteNetworkTopology
- All Implemented Interfaces:
NetworkTopology
public final class BriteNetworkTopology extends java.lang.Object implements NetworkTopology
Implements a network layer by reading the topology from a file in the
BRITE
format, the Boston university
Representative Internet Topology gEnerator
(http://www.cs.bu.edu/brite/),
and generates a topological network
from it. Information of this network is used to simulate latency in network
traffic of CloudSim.
The topology file may contain more nodes than the number of entities in the simulation. It allows users to increase the scale of the simulation without changing the topology file. Nevertheless, each CloudSim entity must be mapped to one (and only one) BRITE node to allow proper work of the network simulation. Each BRITE node can be mapped to only one entity at a time.
- Since:
- CloudSim Toolkit 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov
- See Also:
getInstance(String)
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BriteNetworkTopology()
Instantiates a Network Topology.BriteNetworkTopology(java.lang.String filePath)
Instantiates a Network Topology if a given file exists and can be successfully parsed. -
Method Summary
Modifier and Type Method Description void
addLink(long srcId, long destId, double bandwidth, double latency)
Adds a new link in the network topology.double[][]
getBwMatrix()
Gets acopy of the matrix containing the bandwidth between every pair of nodes in the network.double
getDelay(long srcID, long destID)
Calculates the delay between two nodes.static BriteNetworkTopology
getInstance(java.lang.String fileName)
Instantiates a Network Topology from a file inside the application's resource directory.TopologicalGraph
getTopologicalGraph()
boolean
isNetworkEnabled()
Checks if the network simulation is working.void
mapNode(long cloudSimEntityID, int briteID)
Maps a CloudSim entity to a BRITE node in the network topology.void
unmapNode(long cloudSimEntityID)
Un-maps a previously mapped CloudSim entity to a BRITE node in the network topology.
-
Constructor Details
-
BriteNetworkTopology
public BriteNetworkTopology()Instantiates a Network Topology.- See Also:
BriteNetworkTopology(String)
,BriteNetworkTopology(InputStreamReader)
,getInstance(String)
-
BriteNetworkTopology
public BriteNetworkTopology(java.lang.String filePath)Instantiates a Network Topology if a given file exists and can be successfully parsed. File is written in the BRITE format and contains topological information on simulation entities.- Parameters:
filePath
- the path of the BRITE file- See Also:
BriteNetworkTopology()
,BriteNetworkTopology(InputStreamReader)
,getInstance(String)
-
-
Method Details
-
getInstance
Instantiates a Network Topology from a file inside the application's resource directory.- Parameters:
fileName
- the relative name of the BRITE file- Returns:
- the BriteNetworkTopology instance.
-
addLink
public void addLink(long srcId, long destId, double bandwidth, double latency)Description copied from interface:NetworkTopology
Adds a new link in the network topology. The CloudSim entities that represent the source and destination of the link will be mapped to BRITE entities.- Specified by:
addLink
in interfaceNetworkTopology
- Parameters:
srcId
- ID of the CloudSim entity that represents the link's source nodedestId
- ID of the CloudSim entity that represents the link's destination nodebandwidth
- Link's bandwidthlatency
- link's latency
-
mapNode
public void mapNode(long cloudSimEntityID, int briteID)Description copied from interface:NetworkTopology
Maps a CloudSim entity to a BRITE node in the network topology.- Specified by:
mapNode
in interfaceNetworkTopology
- Parameters:
cloudSimEntityID
- ID of the entity being mappedbriteID
- ID of the BRITE node that corresponds to the CloudSim
-
unmapNode
public void unmapNode(long cloudSimEntityID)Description copied from interface:NetworkTopology
Un-maps a previously mapped CloudSim entity to a BRITE node in the network topology.- Specified by:
unmapNode
in interfaceNetworkTopology
- Parameters:
cloudSimEntityID
- ID of the entity being unmapped
-
getDelay
public double getDelay(long srcID, long destID)Description copied from interface:NetworkTopology
Calculates the delay between two nodes.- Specified by:
getDelay
in interfaceNetworkTopology
- Parameters:
srcID
- ID of the CloudSim entity that represents the link's source nodedestID
- ID of the CloudSim entity that represents the link's destination node- Returns:
- communication delay between the two nodes
-
isNetworkEnabled
public boolean isNetworkEnabled()Description copied from interface:NetworkTopology
Checks if the network simulation is working. If there were some problem during creation of network (e.g., during parsing of BRITE file) that does not allow a proper simulation of the network, this method returns false.- Specified by:
isNetworkEnabled
in interfaceNetworkTopology
- Returns:
- $true if network simulation is working, $false otherwise
-
getTopologicalGraph
- Specified by:
getTopologicalGraph
in interfaceNetworkTopology
- Returns:
- the graph
-
getBwMatrix
public double[][] getBwMatrix()Gets acopy of the matrix containing the bandwidth between every pair of nodes in the network.
-