public class IPUtils
extends Object
Constructor and Description |
---|
IPUtils() |
Modifier and Type | Method and Description |
---|---|
static double[][] |
computeECMPRoutingTableMatrix(int[][] linkTable,
double[] linkWeights,
int N)
Computes the routing tables for ECMP (Equal-Cost Multi-Path) using an OSPF-like (or IS-IS) mechanism, given a set of link weights.
|
static double[][] |
computeOMPRoutingTableMatrix(int[][] linkTable,
double[] linkWeights,
int N)
Computes the optimal routing tables using an OSPF-OMP-like mechanism, given a set of link weights.
|
static double[] |
getLinkWeightAttributes(NetPlan netPlan)
Obtains the set of link weights (link attribute 'linkWeight', default: 1) from a given a network design.
|
static double[][] |
getRoutingTableMatrix(NetPlan netPlan)
Obtains a destination-based routing from a given network design.
|
static void |
main(String[] args)
Main method to test methods from this class.
|
static String |
routingTableMatrixToString(int[][] linkTable,
double[][] f_te)
Outputs a given set of routing tables to a
String . |
static void |
setLinkWeightAttributes(NetPlan netPlan,
double linkWeight)
Adds a 'linkWeight' attribute to each link with an associated link weight.
|
static void |
setLinkWeightAttributes(NetPlan netPlan,
double[] linkWeights)
Adds a 'linkWeight' attribute to each link with an associated link weight.
|
static void |
setRoutesFromRoutingTableMatrix(NetPlan netPlan,
double[][] f_te)
Generates routes from the demand set of a given a network design using a given set of routing tables.
|
public static void main(String[] args)
public static double[][] computeECMPRoutingTableMatrix(int[][] linkTable, double[] linkWeights, int N)
Computes the routing tables for ECMP (Equal-Cost Multi-Path) using an OSPF-like (or IS-IS) mechanism, given a set of link weights.
The point with ECMP-based routing is that traffic is equally split among the candidate output links, not between paths. For example, if three shortest paths go from a node n to the egress node t, and there are only two candidate output links, each link will forward 50% of traffic to node t, instead of a 33.33%/66.66% ratio. To achieve a behavior like the latter, use the computeOMPRoutingTableMatrix()
method.
Important: Although non-integer values are allowed, usage of positive integer values is encouraged to follow the OSPF standard
linkTable
- Set of links defining a physical topologylinkWeights
- Set of link weights (must be greater or equal than one)N
- Number of nodes in the networkpublic static double[][] computeOMPRoutingTableMatrix(int[][] linkTable, double[] linkWeights, int N)
Computes the optimal routing tables using an OSPF-OMP-like mechanism, given a set of link weights.
Contrary to ECMP, this routing scheme equally splits traffic among multiple shortest paths. For example, if three shortest paths go from a node n to the egress node t, and there are only two candidate output links, traffic will be divided following a 33.33%/66.66% ratio.
linkTable
- Set of links defining a physical topologylinkWeights
- Set of link weights (must be greater or equal than one)N
- Number of nodes in the networkpublic static double[] getLinkWeightAttributes(NetPlan netPlan)
netPlan
- Network designpublic static double[][] getRoutingTableMatrix(NetPlan netPlan)
netPlan
- Network designpublic static String routingTableMatrixToString(int[][] linkTable, double[][] f_te)
String
. For debugging purposes.linkTable
- Set of links defining a physical topologyf_te
- Destination-based routing in the form of fractions fte (fraction of the traffic targeted to node t that arrives (or is generated in) node a(e) (the initial node of link e), that is forwarded through link e)String
from the given routing tablespublic static void setLinkWeightAttributes(NetPlan netPlan, double linkWeight)
netPlan
- Network designlinkWeight
- Link weight value (same for every link)public static void setLinkWeightAttributes(NetPlan netPlan, double[] linkWeights)
netPlan
- Network designlinkWeights
- Set of link weights (must be greater than zero)public static void setRoutesFromRoutingTableMatrix(NetPlan netPlan, double[][] f_te)
netPlan
- Network designf_te
- Destination-based routing in the form of fractions fte (fraction of the traffic targeted to node t that arrives (or is generated in) node a(e) (the initial node of link e), that is forwarded through link e)