Switch

public interface Switch extends SimEntity

Represents a Network Switch.

Author:Manoel Campos da Silva Filho

Fields

NULL

Switch NULL

An attribute that implements the Null Object Design Pattern for Switch objects.

Methods

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

getDatacenter

NetworkDatacenter getDatacenter()

Gets the Datacenter where the switch is connected to.

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()

getDownlinkSwitches

List<Switch> getDownlinkSwitches()

Gets the list of Switches in the lower layer that this Switch is connected to.

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

getPorts

int getPorts()

Gets the number of ports the switch has.

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

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()

getUplinkSwitches

List<Switch> getUplinkSwitches()

Gets the list of Switches in the upper layer that this Switch is connected to.

setDatacenter

void setDatacenter(NetworkDatacenter datacenter)

Sets the Datacenter where the switch is connected to.

Parameters:
  • datacenter – the Datacenter to set

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()

setPorts

void setPorts(int ports)

Sets the number of ports the switch has.

Parameters:
  • ports – the number of ports to set

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

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()

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