Interface Switch
-
- All Superinterfaces:
Cloneable
,Comparable<SimEntity>
,Identifiable
,Nameable
,Runnable
,SimEntity
- All Known Implementing Classes:
AbstractSwitch
,AggregateSwitch
,EdgeSwitch
,RootSwitch
public interface Switch extends SimEntity
Represents a Network Switch.- Author:
- Manoel Campos da Silva Filho
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.core.SimEntity
SimEntity.State
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addPacketToBeSentToDownlinkSwitch(Switch downlinkSwitch, HostPacket packet)
void
addPacketToBeSentToHost(NetworkHost host, HostPacket packet)
void
addPacketToBeSentToUplinkSwitch(Switch uplinkSwitch, HostPacket packet)
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()
.NetworkDatacenter
getDatacenter()
Gets the Datacenter where the switch is connected to.double
getDownlinkBandwidth()
List<Switch>
getDownlinkSwitches()
List<HostPacket>
getDownlinkSwitchPacketList(Switch downlinkSwitch)
Gets the list of packets to be sent to a downlink switch.List<NetworkHost>
getHostList()
Gets a read-only list of Hosts connected to the switch.List<HostPacket>
getHostPacketList(NetworkHost host)
Gets the list of packets to be sent to a host.int
getLevel()
Gets the level (layer) of the AbstractSwitch in the network topology, depending if it is a root switch (layer 0), aggregate switch (layer 1) or edge switch (layer 2)List<HostPacket>
getPacketList()
Map<NetworkHost,List<HostPacket>>
getPacketToHostMap()
int
getPorts()
Gets the number of ports the switch has.double
getSwitchingDelay()
double
getUplinkBandwidth()
List<Switch>
getUplinkSwitches()
List<HostPacket>
getUplinkSwitchPacketList(Switch uplinkSwitch)
Gets the list of packets to be sent to an uplink switch.Map<Switch,List<HostPacket>>
getUplinkSwitchPacketMap()
void
setDatacenter(NetworkDatacenter datacenter)
Sets the Datacenter where the switch is connected to.void
setDownlinkBandwidth(double downlinkBandwidth)
void
setPorts(int ports)
void
setSwitchingDelay(double switchingDelay)
void
setUplinkBandwidth(double uplinkBandwidth)
-
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
getSimulation, getState, isAlive, isFinished, isStarted, processEvent, run, schedule, schedule, schedule, schedule, setName, setSimulation, setState, shutdownEntity, start
-
-
-
-
Method Detail
-
getUplinkBandwidth
double getUplinkBandwidth()
- Returns:
- Bandwitdh of uplink (in Megabits/s).
-
setUplinkBandwidth
void setUplinkBandwidth(double uplinkBandwidth)
-
getDownlinkBandwidth
double getDownlinkBandwidth()
- Returns:
- Bandwitdh of downlink (in Megabits/s).
-
setDownlinkBandwidth
void setDownlinkBandwidth(double downlinkBandwidth)
-
getPorts
int getPorts()
Gets the number of ports the switch has.- Returns:
-
setPorts
void setPorts(int ports)
-
getSwitchingDelay
double getSwitchingDelay()
- Returns:
- the latency time the switch spends to process a received packet. This time is considered constant no matter how many packets the switch have to process (in seconds).
-
setSwitchingDelay
void setSwitchingDelay(double switchingDelay)
-
getHostList
List<NetworkHost> getHostList()
Gets a read-only list of Hosts connected to the switch.- Returns:
-
connectHost
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
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
-
getPacketToHostMap
Map<NetworkHost,List<HostPacket>> getPacketToHostMap()
- Returns:
- a read-only map of hosts and the list of packets to be sent to each one.
-
getDownlinkSwitchPacketList
List<HostPacket> getDownlinkSwitchPacketList(Switch downlinkSwitch)
Gets the list of packets to be sent to a downlink switch.- Parameters:
downlinkSwitch
- the id of the switch to get the list of packets to send- Returns:
- the list of packets to be sent to the given switch.
-
getUplinkSwitchPacketList
List<HostPacket> getUplinkSwitchPacketList(Switch uplinkSwitch)
Gets the list of packets to be sent to an uplink switch.- Parameters:
uplinkSwitch
- the switch to get the list of packets to send- Returns:
- the list of packets to be sent to the given switch.
-
getHostPacketList
List<HostPacket> getHostPacketList(NetworkHost host)
Gets the list of packets to be sent to a host.- Parameters:
host
- the host to get the list of packets to send- Returns:
- the list of packets to be sent to the given host.
-
getUplinkSwitchPacketMap
Map<Switch,List<HostPacket>> getUplinkSwitchPacketMap()
- Returns:
- a read-only map of the uplink Switches and list of packets to be sent to each one.
-
addPacketToBeSentToDownlinkSwitch
void addPacketToBeSentToDownlinkSwitch(Switch downlinkSwitch, HostPacket packet)
-
addPacketToBeSentToUplinkSwitch
void addPacketToBeSentToUplinkSwitch(Switch uplinkSwitch, HostPacket packet)
-
addPacketToBeSentToHost
void addPacketToBeSentToHost(NetworkHost host, HostPacket packet)
-
getDatacenter
NetworkDatacenter getDatacenter()
Gets the Datacenter where the switch is connected to.- Returns:
-
setDatacenter
void setDatacenter(NetworkDatacenter datacenter)
Sets the Datacenter where the switch is connected to.- Parameters:
datacenter
- the Datacenter to set
-
getPacketList
List<HostPacket> getPacketList()
-
getLevel
int getLevel()
Gets the level (layer) of the AbstractSwitch 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
-
-