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
public class EdgeSwitch extends AbstractSwitch
Represents an Edge Switch in a Datacenter network, which can be connected toNetworkHost
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
-
-
Constructor Summary
Constructors Constructor Description EdgeSwitch(CloudSim simulation, NetworkDatacenter dc)
Instantiates a EdgeSwitch specifying Datacenter that are connected to its downlink and uplink ports, and corresponding bandwidths.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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()
.List<NetworkHost>
getHostList()
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 if it is a root switch (layer 0), aggregate switch (layer 1) or edge switch (layer 2)protected void
processPacketDown(SimEvent evt)
Sends a packet to Datacenter connected through a downlink port.protected void
processPacketUp(SimEvent evt)
Sends a packet to Datacenter connected through a uplink port.-
Methods inherited from class org.cloudbus.cloudsim.network.switches.AbstractSwitch
addPacketToBeSentToFirstUplinkSwitch, addPacketToSendToDownlinkSwitch, addPacketToSendToHost, addPacketToSendToUplinkSwitch, bandwidthByPacket, downlinkTransferDelay, getDatacenter, getDownlinkBandwidth, getDownlinkSwitches, getDownlinkSwitchPacketList, getHostPacketList, getPacketToHostMap, getPorts, getSwitchingDelay, getUplinkBandwidth, getUplinkSwitches, getUplinkSwitchPacketList, getUplinkSwitchPacketMap, getVmEdgeSwitch, getVmHost, packetTransferDelay, processEvent, processHostPacket, setDatacenter, setDownlinkBandwidth, setPorts, setSwitchingDelay, setUplinkBandwidth, shutdownEntity, startEntity, uplinkTransferDelay
-
Methods inherited from class org.cloudbus.cloudsim.core.CloudSimEntity
cancelEvent, clone, compareTo, equals, getId, getName, getNextEvent, getNextEvent, getSimulation, getState, hashCode, isAlive, isFinished, isStarted, numEventsWaiting, numEventsWaiting, pause, run, schedule, schedule, schedule, schedule, schedule, scheduleFirst, scheduleFirst, scheduleFirstNow, scheduleFirstNow, scheduleNow, scheduleNow, selectEvent, send, send, sendNow, sendNow, setEventBuffer, setId, setName, setSimulation, setStarted, 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
-
-
-
-
Field Detail
-
LEVEL
public static final int LEVEL
The level (layer) of the switch in the network topology.- See Also:
- Constant Field Values
-
PORTS
public static final int PORTS
Default number of ports that defines the number ofHost
that can be connected to the switch.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EdgeSwitch
public EdgeSwitch(CloudSim simulation, NetworkDatacenter dc)
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 is related todc
- The Datacenter where the switch is connected to
-
-
Method Detail
-
processPacketDown
protected void processPacketDown(SimEvent evt)
Description copied from class:AbstractSwitch
Sends a packet to Datacenter connected through a downlink port.- Overrides:
processPacketDown
in classAbstractSwitch
- Parameters:
evt
- Event/packet to process
-
processPacketUp
protected void processPacketUp(SimEvent evt)
Description copied from class:AbstractSwitch
Sends a packet to Datacenter connected through a 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 if it is a root switch (layer 0), aggregate switch (layer 1) or edge switch (layer 2)- Returns:
- the switch network level
-
getHostList
public List<NetworkHost> getHostList()
Gets a read-only list of Hosts connected to the switch.- Returns:
-
connectHost
public void connectHost(NetworkHost host)
Connects aNetworkHost
to the switch, by adding it to thegetHostList()
.- Parameters:
host
- the host to be connected to the switch
-
disconnectHost
public boolean disconnectHost(NetworkHost host)
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
-
-