Class EdgeSwitch
java.lang.Object
org.cloudbus.cloudsim.core.CloudSimEntity
org.cloudbus.cloudsim.network.switches.AbstractSwitch
org.cloudbus.cloudsim.network.switches.EdgeSwitch
- All Implemented Interfaces:
Cloneable
,Comparable<SimEntity>
,Runnable
,Identifiable
,Nameable
,SimEntity
,Switch
Represents an Edge Switch in a Datacenter network, which can be connected to
Please refer to following publication for more details:
NetworkHost
s.
It interacts with other Datacenter in order to exchange packets.
Please refer to following publication for more details:
- Since:
- CloudSim Toolkit 3.0
- Author:
- Saurabh Kumar Garg, Manoel Campos da Silva Filho
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.core.SimEntity
SimEntity.State
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The level (layer) of the switch in the network topology.static final int
Default number of ports that defines the number ofHost
that can be connected to the switch. -
Constructor Summary
ConstructorDescriptionEdgeSwitch
(CloudSim simulation, NetworkDatacenter dc) Instantiates a EdgeSwitch specifying Datacenter that are connected to its downlink and uplink ports, and corresponding bandwidths. -
Method Summary
Modifier and TypeMethodDescriptionvoid
connectHost
(NetworkHost host) Connects aNetworkHost
to the switch, by adding it to thegetHostList()
.boolean
disconnectHost
(NetworkHost host) Disconnects aNetworkHost
from the switch, by removing it from thegetHostList()
.Gets a read-only list of Hosts connected to the switch.int
getLevel()
Gets the level (layer) of the Switch in the network topology, depending on whether it is aRootSwitch
(layer 0),AggregateSwitch
(layer 1) orEdgeSwitch
(layer 2).protected void
Sends a packet from uplink to Datacenter connected through a downlink port.protected void
processPacketUp
(SimEvent evt) Sends a packet from down switch or host to Datacenter connected through an uplink port.Methods inherited from class org.cloudbus.cloudsim.network.switches.AbstractSwitch
addPacketToBeSentToFirstUplinkSwitch, addPacketToSendToDownlinkSwitch, addPacketToSendToHost, addPacketToSendToUplinkSwitch, bandwidthByPacket, downlinkTransferDelay, getDatacenter, getDownlinkBandwidth, getDownlinkSwitches, getDownlinkSwitchPacketList, getHostPacketList, getPorts, getSwitchingDelay, getUplinkBandwidth, getUplinkSwitches, getUplinkSwitchPacketList, getVmHost, packetTransferDelay, processEvent, processHostPacket, setDatacenter, setDownlinkBandwidth, setPorts, setSwitchingDelay, setUplinkBandwidth, shutdown, startInternal, uplinkTransferDelay
Methods inherited from class org.cloudbus.cloudsim.core.CloudSimEntity
cancelEvent, clone, compareTo, equals, getId, getName, getNextEvent, getNextEvent, getShutdownTime, getSimulation, getStartTime, getState, hashCode, isAlive, isFinished, isStarted, pause, run, run, schedule, schedule, schedule, schedule, schedule, schedule, scheduleFirst, scheduleFirst, scheduleFirstNow, scheduleFirstNow, scheduleNow, scheduleNow, selectEvent, send, send, sendNow, sendNow, setEventBuffer, setId, setName, setSimulation, setState, start, waitForEvent
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface org.cloudbus.cloudsim.core.Identifiable
getId
Methods inherited from interface org.cloudbus.cloudsim.core.SimEntity
getShutdownTime, getSimulation, getStartTime, getState, isAlive, isFinished, isStarted, run, schedule, schedule, schedule, schedule, schedule, schedule, schedule, setName, setSimulation, setState, start
-
Field Details
-
LEVEL
public static final int LEVELThe level (layer) of the switch in the network topology.- See Also:
-
PORTS
public static final int PORTSDefault number of ports that defines the number ofHost
that can be connected to the switch.- See Also:
-
-
Constructor Details
-
EdgeSwitch
Instantiates a EdgeSwitch specifying Datacenter that are connected to its downlink and uplink ports, and corresponding bandwidths. In this switch, downlink ports aren't connected to other switch but to hosts.- Parameters:
simulation
- the CloudSim instance that represents the simulation the Entity belongsdc
- The Datacenter where the switch is connected to
-
-
Method Details
-
processPacketDown
Description copied from class:AbstractSwitch
Sends a packet from uplink to Datacenter connected through a downlink port.- Overrides:
processPacketDown
in classAbstractSwitch
- Parameters:
evt
- event/packet to process
-
processPacketUp
Description copied from class:AbstractSwitch
Sends a packet from down switch or host to Datacenter connected through an uplink port.- Overrides:
processPacketUp
in classAbstractSwitch
- Parameters:
evt
- Event/packet to process
-
getLevel
public int getLevel()Description copied from interface:Switch
Gets the level (layer) of the Switch in the network topology, depending on whether it is aRootSwitch
(layer 0),AggregateSwitch
(layer 1) orEdgeSwitch
(layer 2).- Returns:
- the switch network level
-
getHostList
Gets a read-only list of Hosts connected to the switch.- Returns:
-
connectHost
Connects aNetworkHost
to the switch, by adding it to thegetHostList()
.- Parameters:
host
- the host to be connected to the switch
-
disconnectHost
Disconnects aNetworkHost
from the switch, by removing it from thegetHostList()
.- Parameters:
host
- the host to be disconnected from the switch- Returns:
- true if the Host was connected to the switch, false otherwise
-