public class IPUtils
extends Object
Modifier and Type | Field and Description |
---|---|
static String |
IP_WEIGHT_ATTRIBUTE_NAME
Link attribute name for IP weight setting.
|
Modifier and Type | Method and Description |
---|---|
static double |
calculateIGPCost(double[] y_e,
double[] u_e)
Returns the cost of a routing scheme according to the carried traffic per
link and the link capacity vectors, assuming the IGP-WO cost model.
|
static double |
calculateIGPCost(Map<Long,Double> y_e,
Map<Long,Double> u_e)
Returns the cost of a routing scheme according to the carried traffic per
link and link capacities, assuming the IGP-WO cost model.
|
static Quadruple<Map<Pair<Long,Long>,Double>,Map<Pair<Long,Long>,Double>,Map<Long,Double>,Map<Long,Double>> |
computeCarriedTrafficFromIGPWeights(NetPlan netPlan,
long layerId,
Map<Long,Double> linkWeightMap)
Computes the resulting carried traffic according to a link weight setting
and OSPF/ECMP routing.
|
static Quadruple<Map<Pair<Long,Long>,Double>,Map<Pair<Long,Long>,Double>,Map<Long,Double>,Map<Long,Double>> |
computeCarriedTrafficFromIGPWeights(NetPlan netPlan,
Map<Long,Double> linkWeightMap)
Computes the resulting carried traffic according to a link weight setting
and OSPF/ECMP routing.
|
static Map<Pair<Long,Long>,Double> |
computeECMPForwardingRules(Set<Long> nodeIds,
Map<Long,Pair<Long,Long>> linkMap,
Map<Long,Pair<Long,Long>> demandMap,
Map<Long,Double> linkWeightMap)
Computes the forwarding rules according to an OSPF/ECMP scheme.
|
static Map<Pair<Long,Long>,Double> |
computeECMPRoutingTableMap(Set<Long> nodeIds,
Map<Long,Pair<Long,Long>> linkMap,
Map<Long,Double> linkWeightMap)
Computes the routing table matrix according to an OSPF/ECMP scheme.
|
static cern.colt.matrix.tdouble.DoubleMatrix2D |
computeECMPRoutingTableMatrix(Set<Long> nodeIds,
Map<Long,Pair<Long,Long>> linkMap,
Map<Long,Double> linkWeightMap)
Computes the routing table matrix according to an OSPF/ECMP scheme.
|
static double |
getLinkWeight(NetPlan netPlan,
long linkId)
Returns the weight associated to a given link.
|
static double |
getLinkWeight(NetPlan netPlan,
long layerId,
long linkId)
Returns the weight associated to a given link.
|
static Map<Long,Double> |
getLinkWeightMap(NetPlan netPlan)
Obtains the set of link weights (link attribute 'linkWeight', default: 1) from a given a network design.
|
static Map<Long,Double> |
getLinkWeightMap(NetPlan netPlan,
long layerId)
Obtains the set of link weights (link attribute 'linkWeight', default: 1) from a given a network design.
|
static double[] |
getLinkWeightVector(NetPlan netPlan)
Obtains the set of link weights (link attribute 'linkWeight', default: 1) from a given a network design.
|
static double[] |
getLinkWeightVector(NetPlan netPlan,
long layerId)
Obtains the set of link weights (link attribute 'linkWeight', default: 1) from a given a network design.
|
static cern.colt.matrix.tdouble.DoubleMatrix2D |
getRoutingTableMatrix(NetPlan netPlan)
Obtains a destination-based routing from a given network design.
|
static String |
routingTableMatrixToString(Set<Long> nodeIds,
Map<Long,Pair<Long,Long>> linkMap,
double[][] f_te)
Outputs a given set of routing tables to a
String . |
static void |
setECMPForwardingRulesFromLinkWeights(NetPlan netPlan,
long layerId,
Map<Long,Double> linkWeightMap)
Sets the OSPF/ECMP forwarding rules in the given design, according to the
given IGP weight setting.
|
static void |
setECMPForwardingRulesFromLinkWeights(NetPlan netPlan,
Map<Long,Double> linkWeightMap)
Sets the OSPF/ECMP forwarding rules in the given design, according to the
given IGP weight setting.
|
static void |
setECMPRoutesFromLinkWeights(NetPlan netPlan,
long layerId,
Map<Long,Double> linkWeightMap)
Sets the explicit traffic routing according to an OSPF/ECMP scheme.
|
static void |
setECMPRoutesFromLinkWeights(NetPlan netPlan,
Map<Long,Double> linkWeightMap)
Sets the explicit traffic routing according to an OSPF/ECMP scheme.
|
static void |
setLinkWeight(NetPlan netPlan,
long linkId,
double linkWeight)
Sets the weight associated to the link.
|
static void |
setLinkWeight(NetPlan netPlan,
long layerId,
long linkId,
double linkWeight)
Sets the weight associated to the link.
|
static void |
setLinkWeights(NetPlan netPlan,
double linkWeight)
Sets the weight associated to every link.
|
static void |
setLinkWeights(NetPlan netPlan,
double[] linkWeightVector)
Sets the weight associated to each link.
|
static void |
setLinkWeights(NetPlan netPlan,
long layerId,
double linkWeight)
Sets the weight associated to every link.
|
static void |
setLinkWeights(NetPlan netPlan,
long layerId,
double[] linkWeightVector)
Sets the weight associated to each link.
|
static void |
setLinkWeights(NetPlan netPlan,
long layerId,
Map<Long,Double> linkWeightMap)
Sets the weight associated to each link.
|
static void |
setLinkWeights(NetPlan netPlan,
Map<Long,Double> linkWeightMap)
Sets the weight associated to each link.
|
public static final String IP_WEIGHT_ATTRIBUTE_NAME
public static double calculateIGPCost(double[] y_e, double[] u_e)
Returns the cost of a routing scheme according to the carried traffic per link and the link capacity vectors, assuming the IGP-WO cost model.
For more information, see calculateIGPCost(java.util.Map, java.util.Map)
y_e
- Carried traffic per link vectoru_e
- Link capacity vectorcalculateIGPCost(java.util.Map, java.util.Map)
public static double calculateIGPCost(Map<Long,Double> y_e, Map<Long,Double> u_e)
Returns the cost of a routing scheme according to the carried traffic per link and link capacities, assuming the IGP-WO cost model.
Let E be a set of links, where ue is the capacity for link e ∈ E, and ye is the carried traffic by link e ∈ E. Then, the total cost of the associated routing, denoted as C, is the sum for every link e ∈ E of its associated cost ce, which is computed as follows:
where ρe is the ratio ye / ue.
Reference: H. Ümit, "Techniques and Tools for Intra-domain Traffic Engineering," Ph.D. Thesis, Université Catholique de Louvain (Belgium), December 2009
y_e
- Carried traffic per linku_e
- Capacity per linkpublic static Quadruple<Map<Pair<Long,Long>,Double>,Map<Pair<Long,Long>,Double>,Map<Long,Double>,Map<Long,Double>> computeCarriedTrafficFromIGPWeights(NetPlan netPlan, long layerId, Map<Long,Double> linkWeightMap)
netPlan
- Network designlayerId
- Layer identifierlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means 'takes weight from link attribute'). No special iteration-order (i.e. ascending) is requiredQuadruple
composed of f_de
(splitting rules), x_de
(carried traffic for demand 'd' through link 'e'), r_d
(end-to-end carried traffic for demand 'd'), and y_e
(carried traffic by link 'e')public static Quadruple<Map<Pair<Long,Long>,Double>,Map<Pair<Long,Long>,Double>,Map<Long,Double>,Map<Long,Double>> computeCarriedTrafficFromIGPWeights(NetPlan netPlan, Map<Long,Double> linkWeightMap)
netPlan
- Network designlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means 'takes weight from link attribute'). No special iteration-order (i.e. ascending) is requiredQuadruple
composed of f_de
(splitting rules), x_de
(carried traffic for demand 'd' through link 'e'), r_d
(end-to-end carried traffic for demand 'd'), and y_e
(carried traffic by link 'e')public static Map<Pair<Long,Long>,Double> computeECMPForwardingRules(Set<Long> nodeIds, Map<Long,Pair<Long,Long>> linkMap, Map<Long,Pair<Long,Long>> demandMap, Map<Long,Double> linkWeightMap)
nodeIds
- Set of node identifiers. It is mandatory that can be iterated in ascending order of node identifier (i.e. using TreeSet
or those Set
objects returned from Net2Plan
objectlinkMap
- Map of links, where the key is the unique link identifier and the value is a Pair
representing the origin node and the destination node of the link, respectively. It is mandatory that can be iterated in ascending order of link identifier (i.e. using TreeMap
or those Map
objects returned from Net2Plan
objectdemandMap
- Map of demands, where the key is the unique demand identifier and the value is a Pair
representing the ingress node and the egress node of the demand, respectively. It is mandatory that can be iterated in ascending order of demand identifier (i.e. using TreeMap
or those Map
objects returned from Net2Plan
objectlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means each link will have a weight equal to '1'). No special iteration-order (i.e. ascending) is requiredpublic static Map<Pair<Long,Long>,Double> computeECMPRoutingTableMap(Set<Long> nodeIds, Map<Long,Pair<Long,Long>> linkMap, Map<Long,Double> linkWeightMap)
f_te[t][e]
sets the 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. It must hold that for every
node n different of t, the sum of the fractions
fte along its outgoing links must be 1. For every
destination t, fte = 0 for all the links e
that are outgoing links of t.nodeIds
- Set of node identifiers. It is mandatory that can be iterated in ascending order of node identifier (i.e. using TreeSet
or those Set
objects returned from Net2Plan
objectlinkMap
- Map of links, where the key is the unique link identifier and the value is a Pair
representing the origin node and the destination node of the link, respectively. It is mandatory that can be iterated in ascending order of link identifier (i.e. using TreeMap
or those Map
objects returned from Net2Plan
objectlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means each link will have a weight equal to '1'). No special iteration-order (i.e. ascending) is requiredt
)public static cern.colt.matrix.tdouble.DoubleMatrix2D computeECMPRoutingTableMatrix(Set<Long> nodeIds, Map<Long,Pair<Long,Long>> linkMap, Map<Long,Double> linkWeightMap)
f_te[t][e]
sets the 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. It must hold that for every
node n different of t, the sum of the fractions
fte along its outgoing links must be 1. For every
destination t, fte = 0 for all the links e
that are outgoing links of t.nodeIds
- Set of node identifiers. It is mandatory that can be iterated in ascending order of node identifier (i.e. using TreeSet
or those Set
objects returned from Net2Plan
objectlinkMap
- Map of links, where the key is the unique link identifier and the value is a Pair
representing the origin node and the destination node of the link, respectively. It is mandatory that can be iterated in ascending order of link identifier (i.e. using TreeMap
or those Map
objects returned from Net2Plan
objectlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means each link will have a weight equal to '1'). No special iteration-order (i.e. ascending) is requiredt
)public static double getLinkWeight(NetPlan netPlan, long linkId)
netPlan
- Network designlinkId
- Link identifierDouble.MAX_VALUE
if link is down)public static double getLinkWeight(NetPlan netPlan, long layerId, long linkId)
netPlan
- Network designlayerId
- Layer identifierlinkId
- Link identifierDouble.MAX_VALUE
if link is down)public static Map<Long,Double> getLinkWeightMap(NetPlan netPlan)
netPlan
- Network designpublic static Map<Long,Double> getLinkWeightMap(NetPlan netPlan, long layerId)
netPlan
- Network designlayerId
- Layer identifierpublic static double[] getLinkWeightVector(NetPlan netPlan)
netPlan
- Network designpublic static double[] getLinkWeightVector(NetPlan netPlan, long layerId)
netPlan
- Network designlayerId
- Layer identifierpublic static cern.colt.matrix.tdouble.DoubleMatrix2D getRoutingTableMatrix(NetPlan netPlan)
netPlan
- Network designpublic static String routingTableMatrixToString(Set<Long> nodeIds, Map<Long,Pair<Long,Long>> linkMap, double[][] f_te)
String
. For debugging purposes.nodeIds
- Set of node identifierslinkMap
- Map of links, where the key is the link identifier and the value is Pair
representing the origin node and the destination node of the link, respectively.f_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 setECMPForwardingRulesFromLinkWeights(NetPlan netPlan, long layerId, Map<Long,Double> linkWeightMap)
computeECMPForwardingRules
and setForwardingRules
methods.netPlan
- Network designlayerId
- Layer identifierlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means 'takes weight from link attribute'). No special iteration-order (i.e. ascending) is requiredpublic static void setECMPForwardingRulesFromLinkWeights(NetPlan netPlan, Map<Long,Double> linkWeightMap)
computeECMPForwardingRules
and setForwardingRules
methods.netPlan
- Network designlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means 'takes weight from link attribute'). No special iteration-order (i.e. ascending) is requiredpublic static void setECMPRoutesFromLinkWeights(NetPlan netPlan, long layerId, Map<Long,Double> linkWeightMap)
netPlan
- Network designlayerId
- Layer identifierlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means 'takes weight from link attribute'). No special iteration-order (i.e. ascending) is requiredpublic static void setECMPRoutesFromLinkWeights(NetPlan netPlan, Map<Long,Double> linkWeightMap)
netPlan
- Network designlinkWeightMap
- Cost per link, where the key is the link identifier and the value is the link weight (null means 'takes weight from link attribute'). No special iteration-order (i.e. ascending) is requiredpublic static void setLinkWeight(NetPlan netPlan, long linkId, double linkWeight)
netPlan
- Network designlinkId
- Link identifierlinkWeight
- IGP weight associated to the link (must be greater or equal than one)public static void setLinkWeight(NetPlan netPlan, long layerId, long linkId, double linkWeight)
netPlan
- Network designlayerId
- Layer identifierlinkId
- Link identifierlinkWeight
- IGP weight associated to the link (must be greater or equal than one)public static void setLinkWeights(NetPlan netPlan, double linkWeight)
netPlan
- Network designlinkWeight
- IGP weight associated to each link (must be greater or equal than one)public static void setLinkWeights(NetPlan netPlan, double[] linkWeightVector)
netPlan
- Network designlinkWeightVector
- IGP weight per link (must be greater or equal than one)public static void setLinkWeights(NetPlan netPlan, long layerId, double linkWeight)
netPlan
- Network designlayerId
- Layer identifierlinkWeight
- IGP weight associated to each link (must be greater or equal than one)public static void setLinkWeights(NetPlan netPlan, long layerId, double[] linkWeightVector)
netPlan
- Network designlayerId
- Layer identifierlinkWeightVector
- IGP weight per link (must be greater or equal than one)public static void setLinkWeights(NetPlan netPlan, long layerId, Map<Long,Double> linkWeightMap)
netPlan
- Network designlayerId
- Layer identifierlinkWeightMap
- IGP weight per link (must be greater or equal than one)public static void setLinkWeights(NetPlan netPlan, Map<Long,Double> linkWeightMap)
netPlan
- Network designlinkWeightMap
- IGP weight per link (must be greater or equal than one)