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
addPacketToSendToDownlinkSwitch(Switch downlinkSwitch, HostPacket packet)
Adds a packet that will be sent to a downlinkSwitch
.void
addPacketToSendToHost(NetworkHost host, HostPacket packet)
Adds a packet that will be sent to aNetworkHost
.void
addPacketToSendToUplinkSwitch(Switch uplinkSwitch, HostPacket packet)
Adds a packet that will be sent to a uplinkSwitch
.double
downlinkTransferDelay(HostPacket packet, int simultaneousPackets)
Considering a list of packets to be sent simultaneously, computes the expected time to transfer each packet through the downlink, assuming that the bandwidth is shared equally between all packets.NetworkDatacenter
getDatacenter()
Gets the Datacenter where the switch is connected to.double
getDownlinkBandwidth()
Gets the bandwidth this Switch has to communicate with Switches in the lower layer.List<Switch>
getDownlinkSwitches()
Gets the list of Switches in the lower layer that this Switch is connected to.List<HostPacket>
getDownlinkSwitchPacketList(Switch downlinkSwitch)
Gets the list of packets to be sent to a downlink 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 Switch in the network topology, depending if it is a root switch (layer 0), aggregate switch (layer 1) or edge switch (layer 2)Map<NetworkHost,List<HostPacket>>
getPacketToHostMap()
int
getPorts()
Gets the number of ports the switch has.double
getSwitchingDelay()
Gets the latency time the switch spends to process a received packet.double
getUplinkBandwidth()
Gets the bandwidth this Switch has to communicate with Switches in the upper layer.List<Switch>
getUplinkSwitches()
Gets the list of Switches in the upper layer that this Switch is connected to.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)
Sets the bandwidth this Switch has to communicate with Switches in the lower layer.void
setPorts(int ports)
Sets the number of ports the switch has.void
setSwitchingDelay(double switchingDelay)
Sets the latency time the switch spends to process a received packet.void
setUplinkBandwidth(double uplinkBandwidth)
Sets the bandwidth this Switch has to communicate with Switches in the upper layer.double
uplinkTransferDelay(HostPacket packet, int simultaneousPackets)
Considering a list of packets to be sent simultaneously, computes the expected time to transfer each packet through the uplink, assuming that the bandwidth is shared equally between all packets.-
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, schedule, setName, setSimulation, setState, shutdownEntity, start
-
-
-
-
Method Detail
-
downlinkTransferDelay
double downlinkTransferDelay(HostPacket packet, int simultaneousPackets)
Considering a list of packets to be sent simultaneously, computes the expected time to transfer each packet through the downlink, assuming that the bandwidth is shared equally between all packets.- Parameters:
simultaneousPackets
- number of packets to be simultaneously sent- Returns:
- the expected transmission time in seconds
-
uplinkTransferDelay
double uplinkTransferDelay(HostPacket packet, int simultaneousPackets)
Considering a list of packets to be sent simultaneously, computes the expected time to transfer each packet through the uplink, assuming that the bandwidth is shared equally between all packets.- Parameters:
simultaneousPackets
- number of packets to be simultaneously sent- Returns:
- the expected transmission time in seconds
-
getUplinkBandwidth
double getUplinkBandwidth()
Gets the bandwidth this Switch has to communicate with Switches in the upper layer.- Returns:
- Bandwidth of uplink (in Megabits/s).
- See Also:
getUplinkSwitches()
-
setUplinkBandwidth
void setUplinkBandwidth(double uplinkBandwidth)
Sets the bandwidth this Switch has to communicate with Switches in the upper layer.- Parameters:
uplinkBandwidth
- uplink bandwidth to set (in Megabits/s).- See Also:
getUplinkSwitches()
-
getDownlinkBandwidth
double getDownlinkBandwidth()
Gets the bandwidth this Switch has to communicate with Switches in the lower layer.- Returns:
- Bandwidth of downlink (in Megabits/s).
- See Also:
getDownlinkSwitches()
-
setDownlinkBandwidth
void setDownlinkBandwidth(double downlinkBandwidth)
Sets the bandwidth this Switch has to communicate with Switches in the lower layer.- Parameters:
downlinkBandwidth
- downlink bandwidth to set (in Megabits/s).- See Also:
getDownlinkSwitches()
-
getPorts
int getPorts()
Gets the number of ports the switch has.- Returns:
-
setPorts
void setPorts(int ports)
Sets the number of ports the switch has.- Parameters:
ports
- the number of ports to set
-
getSwitchingDelay
double getSwitchingDelay()
Gets 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).- Returns:
- the switching delay
-
setSwitchingDelay
void setSwitchingDelay(double switchingDelay)
Sets 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).- Parameters:
switchingDelay
- the switching delay to set
-
getUplinkSwitches
List<Switch> getUplinkSwitches()
Gets the list of Switches in the upper layer that this Switch is connected to.- Returns:
-
getPacketToHostMap
Map<NetworkHost,List<HostPacket>> getPacketToHostMap()
- Returns:
- a read-only map of hosts and the list of packets to be sent to each one.
-
getDownlinkSwitches
List<Switch> getDownlinkSwitches()
Gets the list of Switches in the lower layer that this Switch is connected to.- Returns:
-
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.
-
addPacketToSendToDownlinkSwitch
void addPacketToSendToDownlinkSwitch(Switch downlinkSwitch, HostPacket packet)
Adds a packet that will be sent to a downlinkSwitch
.- Parameters:
downlinkSwitch
- the target switchpacket
- the packet to be sent
-
addPacketToSendToUplinkSwitch
void addPacketToSendToUplinkSwitch(Switch uplinkSwitch, HostPacket packet)
Adds a packet that will be sent to a uplinkSwitch
.- Parameters:
uplinkSwitch
- the target switchpacket
- the packet to be sent
-
addPacketToSendToHost
void addPacketToSendToHost(NetworkHost host, HostPacket packet)
Adds a packet that will be sent to aNetworkHost
.- Parameters:
host
- the targetNetworkHost
packet
- the packet to be sent
-
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
-
getLevel
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)- Returns:
- the switch network level
-
-