Class DataCenter

java.lang.Object
FatTree
DataCenter

public class DataCenter
extends FatTree

Data center is built on the fat tree topology. Data center includes more attributes such as: - Resources: number of virtual machine in each physical machines - numMBs: number of middle boxes: firewall, epoxy,... - numVMPairs: number of virtual machines pair. - maximum communication fre: maximum communication frequency between virtual machines

In the communication frequencies, these are 25% will have low communication frequency, 70% middle communication frequency, and 5% high communication frequency.

  • Field Summary

    Fields 
    Modifier and Type Field Description
    private int[] capacity  
    private int[] communicationFre  
    private java.util.List<java.lang.String> egress  
    private java.util.List<java.lang.String> ingress  
    private int maxCommunicationFre  
    private java.util.Hashtable<java.lang.String,​java.lang.Integer> mBs_Switch  
    private int numMBs  
    private int numVMPairs  
    private int resources  
    private double[][] shortestPathRoute  
    private java.util.Hashtable<java.lang.String,​java.lang.Integer> VM_PM  

    Fields inherited from class FatTree

    shortestPathMatrix
  • Constructor Summary

    Constructors 
    Constructor Description
    DataCenter​(int numPods, int migrationCoef, int resources, int numMBs, int numVMPairs, int maxCommunicationFre)
    Default constructor of Data Center
  • Method Summary

    Modifier and Type Method Description
    void buildCommunicationFre()
    Build or Reset the new communication frequency.
    private void buildDataCenter()  
    double calculateSPR​(int sourcePM, int destinationPM)
    Calculate the shortest path route from the source (PM) to destination PM.
    double costBetweenMbsOrderPolicy()
    Calculate the length travel from first middle box to last middle box in ordered policy in data center
    private boolean disMb_switch()
    Distribute the middle box into the switch randomly such that all the middle boxes distributed into the aggregation switches.
    void displayInformationOfDataCenter()
    Display all information of data center such as number of PODs, migration coefficient, resources of each physical machine, number of middle box, number of virtual machine pair, and maximum communication frequency
    private void distributeVM_PM​(boolean isRandom)
    Distribute the Virtual machine into the physical machine as follows: - Randomly - 80% virtual machine pairs distributed on the same edges switches.
    int[] getCapacity()
    get number of virtual machine in each physical machine
    int[] getCommunicationFre()
    Get array contain the communication frequencies of each virtual machine pairs.
    java.util.List<java.lang.String> getEgress()
    Get the List of ingress in data center
    java.util.List<java.lang.String> getIngress()
    Get the List of ingress in data center
    int getMaxCommunicationFre()
    Get maximum communication frequencies
    java.util.Hashtable<java.lang.String,​java.lang.Integer> getmBs_Switch()
    Get the location of each middle box inside the data center
    int getNumMBs()
    Get number of middle boxes
    int getNumVMPairs()
    Get number of virtual machine pairs
    int getResources()
    Get the resources - capacity of each physical machine All physical machine has the same resources
    double[][] getShortestPathRoute()
    Get the shortest path route between two physical machines.
    java.util.Hashtable<java.lang.String,​java.lang.Integer> getVM_PM()
    Get the location of each Virtual machine inside data center
    boolean isEnoughCapacity()
    Check whether the data center has enough capacity for number of virtual machine pairs
    java.util.List<java.lang.Integer> listClosestPMtoMB​(int mbIndex)
    Find the list of physical machine that close to the given middle box.
    void setEgress()
    Build the ingress list, list of Physical machines that are closest to last middle box.
    void setIngress()
    Build the ingress list, list of Physical machines that are closest to first middle box.
    void setMaxCommunicationFre​(int maxCommunicationFre)
    Reset or set up the maximum communication frequency of virtual machine pairs
    void setMigrationCoef​(int migrationCoef)
    Reset or changing the migration coefficient of fat tree topology.
    void setNumMBs​(int numMBs)
    Reset or change number of middle boxes
    void setNumPods​(int numPods)
    Reset or changing number of PODs in data center from user
    void setNumVMPairs​(int numVMPairs)
    Reset or change number of virtual machine pairs
    void setResources​(int resources)
    Reset or change resources of each physical machine
    void setShortestPathRoute()
    Build the matrix where each entry is the cost of the path routes between 2 physical machines.
    double totalCommunicationCostBetweenMbsOrdered()
    Calculate total communication cost from the first to the last middle box in ordered policy.
    double totalCommunicationFre()
    Calculate total communication frequency of all virtual machine pairs

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • resources

      private int resources
    • numMBs

      private int numMBs
    • numVMPairs

      private int numVMPairs
    • maxCommunicationFre

      private int maxCommunicationFre
    • communicationFre

      private int[] communicationFre
    • capacity

      private int[] capacity
    • mBs_Switch

      private java.util.Hashtable<java.lang.String,​java.lang.Integer> mBs_Switch
    • VM_PM

      private java.util.Hashtable<java.lang.String,​java.lang.Integer> VM_PM
    • shortestPathRoute

      private double[][] shortestPathRoute
    • ingress

      private java.util.List<java.lang.String> ingress
    • egress

      private java.util.List<java.lang.String> egress
  • Constructor Details

    • DataCenter

      public DataCenter​(int numPods, int migrationCoef, int resources, int numMBs, int numVMPairs, int maxCommunicationFre)
      Default constructor of Data Center
      Parameters:
      numPods - - Number of PODS
      migrationCoef - - Migration coefficient of fat tree
      resources - - capacity of each Physical machine
      numMBs - - number of MBs in the data center
      numVMPairs - - number pairs of virtual machine
      maxCommunicationFre - - maximum communication frequencies
  • Method Details

    • setNumPods

      public void setNumPods​(int numPods)
      Reset or changing number of PODs in data center from user
      Overrides:
      setNumPods in class FatTree
      Parameters:
      numPods - - number of PODs in data center
    • setMigrationCoef

      public void setMigrationCoef​(int migrationCoef)
      Reset or changing the migration coefficient of fat tree topology.
      Overrides:
      setMigrationCoef in class FatTree
      Parameters:
      migrationCoef - - new migration of fat tree.
    • setResources

      public void setResources​(int resources)

      Reset or change resources of each physical machine

      Parameters:
      resources - - new resources or capacity of each physical machine
    • setNumMBs

      public void setNumMBs​(int numMBs)

      Reset or change number of middle boxes

      Parameters:
      numMBs - - number of middle box or Virtual network function in data center.
    • setNumVMPairs

      public void setNumVMPairs​(int numVMPairs)

      Reset or change number of virtual machine pairs

      Parameters:
      numVMPairs - - number of virtual machine pairs
    • setMaxCommunicationFre

      public void setMaxCommunicationFre​(int maxCommunicationFre)

      Reset or set up the maximum communication frequency of virtual machine pairs

      Parameters:
      maxCommunicationFre - - maximum communication frequency of virtual machine pairs.
    • getResources

      public int getResources()
      Get the resources - capacity of each physical machine All physical machine has the same resources
      Returns:
      the resources of physical machine
    • getNumMBs

      public int getNumMBs()
      Get number of middle boxes
      Returns:
      total middle boxes inside the data center
    • getNumVMPairs

      public int getNumVMPairs()
      Get number of virtual machine pairs
      Returns:
      number of virtual machine pair
    • getMaxCommunicationFre

      public int getMaxCommunicationFre()
      Get maximum communication frequencies
      Returns:
      the maximum communication frequency
    • getCommunicationFre

      public int[] getCommunicationFre()
      Get array contain the communication frequencies of each virtual machine pairs. Indices of the array is indices of physical machine
      Returns:
      the array contain communication frequencies of each virtual machine pairs.
    • getCapacity

      public int[] getCapacity()
      get number of virtual machine in each physical machine
      Returns:
      array contain number of virtual machine inside each physical machine
    • getmBs_Switch

      public java.util.Hashtable<java.lang.String,​java.lang.Integer> getmBs_Switch()
      Get the location of each middle box inside the data center
      Returns:
      hash table with key is name of middle box (MB+indices), and value is indices of its switch
    • getVM_PM

      public java.util.Hashtable<java.lang.String,​java.lang.Integer> getVM_PM()
      Get the location of each Virtual machine inside data center
      Returns:
      hash table with key is name of Virtual machine (VM+indices), and value is its physical machine indices
    • getShortestPathRoute

      public double[][] getShortestPathRoute()

      Get the shortest path route between two physical machines. Row and column are index of physical machines

      Returns:
      The shortest path route between two physical machines in un-ordered policy, row = column = number of physical machine.
    • getIngress

      public java.util.List<java.lang.String> getIngress()
      Get the List of ingress in data center
      Returns:
      List of Ingress
    • getEgress

      public java.util.List<java.lang.String> getEgress()
      Get the List of ingress in data center
      Returns:
      list of Egress
    • buildDataCenter

      private void buildDataCenter()
    • disMb_switch

      private boolean disMb_switch()

      Distribute the middle box into the switch randomly such that all the middle boxes distributed into the aggregation switches.

      Returns:
      true if number of middle box is positive, otherwise, false
    • distributeVM_PM

      private void distributeVM_PM​(boolean isRandom)

      Distribute the Virtual machine into the physical machine as follows: - Randomly - 80% virtual machine pairs distributed on the same edges switches.

      Parameters:
      isRandom - - true if distribute the virtual machine randomly, false for 80%
    • isEnoughCapacity

      public boolean isEnoughCapacity()

      Check whether the data center has enough capacity for number of virtual machine pairs

      Returns:
      false if 2 * numVMPairs is greater than pow(numPods, 3) * resources / 4, otherwise is true
    • buildCommunicationFre

      public void buildCommunicationFre()

      Build or Reset the new communication frequency. these are 25% will have low communication frequency, 70% middle communication frequency, and 5% high communication frequency. All 3 levels of communication frequencies will distribute randomly through all the array of communication frequencies First, we will choose a pair of virtual machine randomly, then we assign its communication frequency.

    • calculateSPR

      public double calculateSPR​(int sourcePM, int destinationPM)

      Calculate the shortest path route from the source (PM) to destination PM. First we build the complete graph where vertices are the set of 2 physical machines (one is source, and the other is destination), and all the middle boxes. The algorithm will find the minimum spanning tree in the complete graph. Then calculate the cost when travels between two physical machines such that it will visit all the middle boxes.

      Parameters:
      sourcePM - - index of physical machine as the source
      destinationPM - - index of physical machine as the destination
      Returns:
      - the smallest weight of the walk start from a source to a destination and visit all the middle box such as visit edges at most twice.
    • setShortestPathRoute

      public void setShortestPathRoute()

      Build the matrix where each entry is the cost of the path routes between 2 physical machines.

      • pm0 pm1 pm2 pm3 ...
      • pm0
      • pm1
      • pm2
      • .
      • .
      • .
    • displayInformationOfDataCenter

      public void displayInformationOfDataCenter()

      Display all information of data center such as number of PODs, migration coefficient, resources of each physical machine, number of middle box, number of virtual machine pair, and maximum communication frequency

      Display number of physical machine, number of edge switch, number of aggregation switch, and number of core switch

    • listClosestPMtoMB

      public java.util.List<java.lang.Integer> listClosestPMtoMB​(int mbIndex)

      Find the list of physical machine that close to the given middle box.

      Parameters:
      mbIndex - - indices of the middle box
      Returns:
      - List of physical machine close to the given middle box.
    • setIngress

      public void setIngress()
      Build the ingress list, list of Physical machines that are closest to first middle box.
    • setEgress

      public void setEgress()
      Build the ingress list, list of Physical machines that are closest to last middle box.
    • costBetweenMbsOrderPolicy

      public double costBetweenMbsOrderPolicy()
      Calculate the length travel from first middle box to last middle box in ordered policy in data center
      Returns:
      total length from the first to the last middle box in ordered policy.
    • totalCommunicationFre

      public double totalCommunicationFre()
      Calculate total communication frequency of all virtual machine pairs
      Returns:
      commutative frequency of all virtual machine pairs.
    • totalCommunicationCostBetweenMbsOrdered

      public double totalCommunicationCostBetweenMbsOrdered()
      Calculate total communication cost from the first to the last middle box in ordered policy.
      Returns:
      commutative communication cost from the first to the last middle box in ordered policy.