AbstractSwitch

public abstract class AbstractSwitch extends CloudSimEntity implements Switch

An base class for implementing Network Switch.

Author:Saurabh Kumar Garg, Manoel Campos da Silva Filho

Constructors

AbstractSwitch

public AbstractSwitch(CloudSim simulation, NetworkDatacenter dc)

Methods

addPacketToBeSentToDownlinkSwitch

public void addPacketToBeSentToDownlinkSwitch(Switch downlinkSwitch, HostPacket packet)

addPacketToBeSentToHost

public void addPacketToBeSentToHost(NetworkHost host, HostPacket packet)

addPacketToBeSentToUplinkSwitch

public void addPacketToBeSentToUplinkSwitch(Switch uplinkSwitch, HostPacket packet)

connectHost

public void connectHost(NetworkHost host)

disconnectHost

public boolean disconnectHost(NetworkHost host)

getDatacenter

public NetworkDatacenter getDatacenter()

getDownlinkBandwidth

public double getDownlinkBandwidth()

getDownlinkSwitchPacketList

public List<HostPacket> getDownlinkSwitchPacketList(Switch downlinkSwitch)

getDownlinkSwitches

public List<Switch> getDownlinkSwitches()

getHostList

public List<NetworkHost> getHostList()

getHostPacketList

public List<HostPacket> getHostPacketList(NetworkHost host)

getPacketList

public List<HostPacket> getPacketList()

getPacketToHostMap

public Map<NetworkHost, List<HostPacket>> getPacketToHostMap()

getPorts

public int getPorts()

getSwitchingDelay

public double getSwitchingDelay()

getUplinkBandwidth

public double getUplinkBandwidth()

getUplinkSwitchPacketList

public List<HostPacket> getUplinkSwitchPacketList(Switch uplinkSwitch)

getUplinkSwitchPacketMap

public Map<Switch, List<HostPacket>> getUplinkSwitchPacketMap()

getUplinkSwitches

public List<Switch> getUplinkSwitches()

getVmEdgeSwitch

protected EdgeSwitch getVmEdgeSwitch(Vm vm)

Gets the EdgeSwitch that the Host where the VM is placed is connected to.

Parameters:
  • vm – the VM to get the Edge Switch
Returns:

the connected Edge Switch

getVmHost

protected NetworkHost getVmHost(Vm vm)

Gets the Host where a VM is placed.

Parameters:
  • vm – the VM to get its Host
Returns:

the Host where the VM is placed

networkDelayForPacketTransmission

protected double networkDelayForPacketTransmission(HostPacket netPkt, double bwCapacity, List<HostPacket> netPktList)

Computes the network delay to send a packet through the network.

Parameters:
  • netPkt – the packet to be sent
  • bwCapacity – the total bandwidth capacity (in Megabits/s)
  • netPktList – the list of packets waiting to be sent
Returns:

the expected time to transfer the packet through the network (in seconds)

processEvent

public void processEvent(SimEvent evt)

processHostPacket

protected void processHostPacket(SimEvent evt)

Process a packet sent to a host.

Parameters:
  • evt – The packet sent.

processPacketDown

protected void processPacketDown(SimEvent evt)

Sends a packet to Datacenter connected through a downlink port.

Parameters:
  • evt – Event/packet to process

processPacketUp

protected void processPacketUp(SimEvent evt)

Sends a packet to Datacenter connected through a uplink port.

Parameters:
  • evt – Event/packet to process

setDatacenter

public void setDatacenter(NetworkDatacenter datacenter)

setDownlinkBandwidth

public final void setDownlinkBandwidth(double downlinkBandwidth)

setPorts

public final void setPorts(int ports)

setSwitchingDelay

public final void setSwitchingDelay(double switchingDelay)

setUplinkBandwidth

public final void setUplinkBandwidth(double uplinkBandwidth)

shutdownEntity

public void shutdownEntity()

startEntity

protected void startEntity()