Class FatTree
java.lang.Object
FatTree
- Direct Known Subclasses:
DataCenter
public class FatTree
extends java.lang.Object
This class provides the main structure for fat tree topology.
Fat Tree will take 2 fields: number of PODs and migration coefficients.
-
Field Summary
Fields Modifier and Type Field Description private org.graphstream.graph.GraphfatTreeprivate java.util.Hashtable<java.lang.String,java.lang.Integer>listNodeprivate intmigrationCoefprivate intnumPods(package private) double[][]shortestPathMatrix -
Constructor Summary
Constructors Constructor Description FatTree(int numPods, int migrationCoef)Constructor for FatTree Graph -
Method Summary
Modifier and Type Method Description private voidaddAS_CS()Connect the aggregation switches with core switchesprivate voidaddES_AS()Connect the Edge Switches with Aggregate Switchesprivate booleanaddNodes()Add all nodes into the list nodes hash table and fat tree graph.private voidaddPM_ES()Connect the physical machines with the Edge SwitchvoidbuildFatTree()private voidbuildShortestPathMatrix()Build the shortest path matrix with the structure as the follow: physical machine + edge switch + aggregation switch + core Switchjava.util.Hashtable<java.lang.Integer,java.util.List<java.lang.Integer>>getEdgeSwitch_PM_Map()Build the hash table with index of the edge switch from 0 to number edge switch as key, and list contain all the physical machines that connect to edge switch.org.graphstream.graph.GraphgetFatTreeGraph()Get the Fat Tree Graphjava.util.Hashtable<java.lang.String,java.lang.Integer>getListNode()Get the list node of the fat treeintgetMigrationCoef()Retrieve migration coefficient of the Fat TreeintgetNumPods()Retrieve number of PODS: kdouble[][]getShortestPathMatrix()Retrieve the shortest path matrix costintnumCoreSwitch()Calculate number of Core switch.intnumEdgeSwitch()Calculate number of edge switch as well as aggregation switchintnumPM()Calculate number of Physical machinesvoidprintFatTreeInformation()Display all information about fat tree: - Number of PODs - Migration Coefficient - List of all NodesvoidsetMigrationCoef(int migrationCoef)Get the migration coefficient of data center from user or file.voidsetNumPods(int numPods)Get number of PODs in data center from the user or file
-
Field Details
-
numPods
private int numPods -
migrationCoef
private int migrationCoef -
fatTree
private org.graphstream.graph.Graph fatTree -
listNode
private java.util.Hashtable<java.lang.String,java.lang.Integer> listNode -
shortestPathMatrix
double[][] shortestPathMatrix
-
-
Constructor Details
-
FatTree
public FatTree(int numPods, int migrationCoef)Constructor for FatTree Graph- Parameters:
numPods- : number of Pod in fat tree data center, it must be even number.migrationCoef- : migration cost of the data center.
-
-
Method Details
-
addNodes
private boolean addNodes()Add all nodes into the list nodes hash table and fat tree graph. Physical machine: "PM"+index, index start 0 Edge Switches: "ES" + index, index start 0 Aggregation Switches: "AS" + index, index start 0 Core Switches: "CS" + index, index start 0- Returns:
- true if number of PODS is even, otherwise return false.
-
addPM_ES
private void addPM_ES()Connect the physical machines with the Edge Switch -
addAS_CS
private void addAS_CS()Connect the aggregation switches with core switches -
addES_AS
private void addES_AS()Connect the Edge Switches with Aggregate Switches -
buildShortestPathMatrix
private void buildShortestPathMatrix()Build the shortest path matrix with the structure as the follow: physical machine + edge switch + aggregation switch + core Switch -
buildFatTree
public void buildFatTree() -
getNumPods
public int getNumPods()Retrieve number of PODS: k- Returns:
- number of POds in Fat Tree
-
getMigrationCoef
public int getMigrationCoef()Retrieve migration coefficient of the Fat Tree- Returns:
- migration coefficient of fat tree
-
getFatTreeGraph
public org.graphstream.graph.Graph getFatTreeGraph()Get the Fat Tree Graph- Returns:
- graph of the fat tree
-
getShortestPathMatrix
public double[][] getShortestPathMatrix()Retrieve the shortest path matrix cost- Returns:
- matix represent the shortest path between nodes
-
getListNode
public java.util.Hashtable<java.lang.String,java.lang.Integer> getListNode()Get the list node of the fat tree- Returns:
- hash table contain the list node of the fat tree with key is name of the node value is the indices of the node in the shortest path matrix
-
setMigrationCoef
public void setMigrationCoef(int migrationCoef)Get the migration coefficient of data center from user or file.- Parameters:
migrationCoef- - migration coefficient of the data center
-
setNumPods
public void setNumPods(int numPods)Get number of PODs in data center from the user or file- Parameters:
numPods- - number of PODs in data center
-
numPM
public int numPM()Calculate number of Physical machines- Returns:
- $\frac{\numPods^{3}}{4}$
-
numEdgeSwitch
public int numEdgeSwitch()Calculate number of edge switch as well as aggregation switch- Returns:
- $\frac{numPods^{2}}{2}$
-
numCoreSwitch
public int numCoreSwitch()Calculate number of Core switch.- Returns:
- $\frac{numPods^{2}}{4}$
-
getEdgeSwitch_PM_Map
public java.util.Hashtable<java.lang.Integer,java.util.List<java.lang.Integer>> getEdgeSwitch_PM_Map()Build the hash table with index of the edge switch from 0 to number edge switch as key, and list contain all the physical machines that connect to edge switch.- Returns:
- hashtable with key is the index of the edge switch, and the value is the list of the physical machines
-
printFatTreeInformation
public void printFatTreeInformation()Display all information about fat tree: - Number of PODs - Migration Coefficient - List of all Nodes
-