public class Demand extends NetworkElement
This class contains a representation of a unicast demand. Unicast demands are defined by its initial and end node, the network layer they belong to,
and their offered traffic. When the routing in the network layer is the type SOURCE_ROUTING
, demands are carried
throgh Route
objects associated to them. If the routing type is HOP_BY_HOP_ROUTING
, the demand
traffic is carried by defining the forwarding rules (for each demand and link, fraction of the demand traffic from the link initial node, that is carried through it).
In multilayer design, a demand in a lower layer can be coupled to a link in the upper layer. Then, the demand carried traffic is equal to the upper layer link capacity (thus, upper link capacity and lower layer demand traffic must be measured in the same units).
Modifier and Type | Class and Description |
---|---|
static class |
Demand.IntendedRecoveryType |
Modifier and Type | Method and Description |
---|---|
void |
checkRoutingType(Constants.RoutingType routingType)
Checks whether routing type is the expected one.
|
Pair<SortedSet<Route>,Double> |
computeMinimumCostServiceChains(double[] linkCosts,
double[] resourceCosts)
Returns the set of demand service chains with shortest cost, using the cost per link and cost per resources arrays provided.
|
Pair<SortedSet<Route>,Double> |
computeShortestPathRoutes(double[] costs)
Returns the set of demand routes with shortest path (and its cost), using the cost per link array provided.
|
Link |
coupleToNewLinkCreated(NetworkLayer newLinkLayer)
Creates a new link in the given layer with same end nodes, and couples it to this demand.
|
void |
coupleToUpperOrSameLayerLink(Link link)
Couples this demand to a link in an upper layer.
|
Demand |
createBidirectionalPair()
Creates a demand in the opposite direction as this, and with the same attributes, and associate both as bidirectional pairs.
|
void |
decouple()
Decouples this demand from an other layer link.
|
Demand |
getBidirectionalPair()
If this demand was added using the method addDemandBidirectional(),
returns the demand in the other direction (if it was not previously removed).
|
double |
getBlockedTraffic()
Returns the blocked traffic of the demand (offered minus carried, or 0 if carried is above offered).
|
double |
getCarriedTraffic()
Returns the carried traffic of the demand.
|
Link |
getCoupledLink()
Returns the link this demand is coupled to.
|
Node |
getEgressNode()
Returns the demand egress node.
|
SortedSet<Node> |
getEndNodes()
Returns a non-modifiable set of two elements, with the demand end nodes
|
SortedMap<Pair<Demand,Link>,Double> |
getForwardingRules()
Returns the non zero forwarding rules as a map of pairs demand-link, and its associated splitting factor (between 0 and 1).
|
Node |
getIngressNode()
Returns the demand ingress node.
|
Demand.IntendedRecoveryType |
getIntendedRecoveryType()
Returns the specified intended recovery type for this demand
|
NetworkLayer |
getLayer()
Returns the
NetworkLayer object this element is attached to. |
Pair<SortedSet<Link>,SortedSet<Link>> |
getLinksNoDownPropagationPotentiallyCarryingTraffic()
Returns the set of links in this layer that could potentially carry traffic of this demand, according to the routes/forwarding rules defined,
if the routes had carried traffic / (hop-by-hop) the demand had offered traffic different to zero.
|
SortedSet<Link> |
getLinksWithNonZeroForwardingRules()
Returns the set of links in this layer, with non zero forwarding rules defined for them.
|
double |
getMaximumAcceptableE2EWorstCaseLatencyInMs()
Returns the maximum e2e latency registered as acceptable for the demand (in ms)
|
TrafficSeries |
getMonitoredOrForecastedOfferedTraffic()
Returns the object contianing the monitored or forecasted time series information for the offered traffic
|
double |
getOccupiedCapacity(Link e)
Returns the amount of occupied capacity of the demand in a particular link
|
double |
getOfferedTraffic()
Returns the offered traffic of the demand
|
double |
getOfferedTrafficPerPeriodGrowthFactor()
Return the growth factor of the offered traffic in subsequent periods.
|
String |
getQosType()
Return the QoS type of the demand
|
SortedSet<Route> |
getRoutes()
Returns the routes associated to this demand.
|
SortedSet<Route> |
getRoutesAreBackup()
Returns the routes associated to this demand, but only those that are a backup route.
|
SortedSet<Route> |
getRoutesAreNotBackup()
Returns the routes associated to this demand, but only those that are not a backup route.
|
SortedSet<Route> |
getRoutesHaveBackup()
Returns the routes associated to this demand, but only those that are have themselves a backup route.
|
SortedSet<Route> |
getRoutesHaveNoBackup()
Returns the routes associated to this demand, but only those that have no backup route themselves.
|
Constants.RoutingCycleType |
getRoutingCycleType()
Returns the routing cycle type of the demand, indicating if the traffic is routed in a loopless form, with open loops or with closed
loops (the latter can only happen in
HOP_BY_HOP_ROUTING routing). |
Constants.RoutingType |
getRoutingType()
Returns the routing type of the demand.
|
List<String> |
getServiceChainSequenceOfTraversedResourceTypes()
Gets the sequence of types of resources defined (the ones that the routes of this demand have to follow).
|
SortedMap<Link,Double> |
getTraversedLinksAndCarriedTraffic(boolean normalizedToOfferedTraffic)
Returns a map with an entry for each traversed link, and associated to it the demand's traffic carried in that link.
|
double |
getWorstCaseLengthInKm()
Returns the worse case end-to-end length in km of the demand traffic.
|
double |
getWorstCasePropagationTimeInMs()
Returns the worse case end-to-end propagation time of the demand traffic.
|
boolean |
isBidirectional()
Returns true if the demand is bidirectional.
|
boolean |
isBifurcated()
If routing is
SOURCE_ROUTING , return true if more than one route is associated to this demand (routes down or with zero carried traffic also count). |
boolean |
isBlocked()
Returns
true if the carried traffic is strictly less than the offered traffic, up to the Net2Plan-wide precision factor. |
boolean |
isCoupled()
Returns
true if the demand is coupled to a link of an upper layer. |
boolean |
isCoupledInDifferentLayer()
Returns
true if the demand is coupled to a link in a different layer than the demnad (and thus an *upper* layer)
, false otherwise. |
boolean |
isCoupledInSameLayer()
Returns
true if the demand is coupled to a link in the same layer as the demand, false otherwise. |
boolean |
isServiceChainRequest()
Returns if the current demand reflects a service chain request, that is, if the routes are constrained
to traverse a given sequence of resources of given types.
|
boolean |
isSourceRouting()
Returns true if the routing type in this demand is of the type source routing
|
boolean |
isTraversingOversubscribedLinks()
Returns
true if the traffic of the demand is traversing an oversubscribed link, false otherwise. |
boolean |
isTraversingOversubscribedResources()
Returns
true if the traffic of the demand is traversing an oversubscribed resource, false otherwise. |
void |
remove()
Removes a demand, and any associated routes or forwarding rules.
|
void |
removeAllForwardingRules()
Removes all forwarding rules associated to the demand.
|
void |
removeAllRoutes()
Removes all forwarding rules associated to the demand.
|
void |
setBidirectionalPair(Demand d)
Sets the given demand as the bidirectional pair of this demand.
|
void |
setIntendedRecoveryType(Demand.IntendedRecoveryType recoveryType)
Sets the intended recovery type for this demand
|
void |
setMaximumAcceptableE2EWorstCaseLatencyInMs(double maxLatencyMs)
Sets the maximum latency in ms acceptable for the demand.
|
void |
setMonitoredOrForecastedOfferedTraffic(TrafficSeries newTimeSeries)
Sets the new time series for the monitored or forecasted offered traffic, eliminating any previous values
|
void |
setOfferedTraffic(double offeredTraffic)
Sets the offered traffic by a demand.
|
void |
setOfferedTrafficPerPeriodGrowthFactor(double growthFactor)
Sets the growth factor of the offered traffic in subsequent periods.
|
void |
setQoSType(String newQosType)
Sets the QoS type of the demand.
|
void |
setRoutingType(Constants.RoutingType newRoutingType)
Sets the routing type at the given layer.
|
void |
setServiceChainSequenceOfTraversedResourceTypes(List<String> resourceTypesSequence)
Sets the sequence of types of resources that the routes of this demand have to follow.
|
String |
toString()
Returns a
String representation of the demand. |
addTag, checkAttachedToNetPlanObject, checkAttachedToNetPlanObject, compareTo, equals, getAttribute, getAttribute, getAttributeAsDouble, getAttributeAsDoubleList, getAttributeAsDoubleMatrix, getAttributeAsDoubleMatrix, getAttributeAsStringList, getAttributeAsStringMatrix, getAttributes, getDescription, getId, getIndex, getName, getNetPlan, getNeType, getTags, hasTag, removeAllAttributes, removeAttribute, removeTag, setAttribute, setAttribute, setAttributeAsNumberList, setAttributeAsNumberMatrix, setAttributeAsNumberMatrix, setAttributeAsStringList, setAttributeAsStringMatrix, setAttributeMap, setDescription, setName, wasRemoved
public void checkRoutingType(Constants.RoutingType routingType)
routingType
- Expected RoutingType
public Pair<SortedSet<Route>,Double> computeMinimumCostServiceChains(double[] linkCosts, double[] resourceCosts)
Returns the set of demand service chains with shortest cost, using the cost per link and cost per resources arrays provided. If more than one minimum cost route exists, all of them are provided. If the link cost vector provided is null, all links have cost one. The same for the resource costs array.
linkCosts
- Costs for each link (indexed by link index)resourceCosts
- the costs of the resources (indexed by resource index)Double.MAX_VALUE
if there is no shortest path)public Pair<SortedSet<Route>,Double> computeShortestPathRoutes(double[] costs)
Returns the set of demand routes with shortest path (and its cost), using the cost per link array provided. If more than one shortest route exists, all of them are provided. If the cost vector provided is null, all links have cost one.
costs
- Costs for each linkDouble.MAX_VALUE
if there is no shortest path)public Link coupleToNewLinkCreated(NetworkLayer newLinkLayer)
Creates a new link in the given layer with same end nodes, and couples it to this demand.
newLinkLayer
- Layer where the link will be created.public void coupleToUpperOrSameLayerLink(Link link)
Couples this demand to a link in an upper layer. After the link is coupled, its capacity will be always equal to the demand carried traffic.
Important: The link and the demand must belong to different layers, have same end nodes, not be already coupled, and the traffic units of the demand must be the same as the capacity units of the link. Also, the coupling of layers cannot create a loop.
link
- Link to be coupledpublic Demand createBidirectionalPair()
public void decouple()
Decouples this demand from an other layer link. Throws an exception if the demand is not currently coupled.
public Demand getBidirectionalPair()
If this demand was added using the method addDemandBidirectional(), returns the demand in the other direction (if it was not previously removed). Returns null otherwise.
null
otherwisepublic double getBlockedTraffic()
Returns the blocked traffic of the demand (offered minus carried, or 0 if carried is above offered).
public double getCarriedTraffic()
Returns the carried traffic of the demand.
public Link getCoupledLink()
Returns the link this demand is coupled to.
null
if the demand is not coupledpublic Node getEgressNode()
Returns the demand egress node.
public SortedSet<Node> getEndNodes()
public SortedMap<Pair<Demand,Link>,Double> getForwardingRules()
Returns the non zero forwarding rules as a map of pairs demand-link, and its associated splitting factor (between 0 and 1).
Important: If routing type is set to HOP_BY_HOP_ROUTING
an exception will be thrown.
public Node getIngressNode()
Returns the demand ingress node.
public Demand.IntendedRecoveryType getIntendedRecoveryType()
public NetworkLayer getLayer()
Returns the NetworkLayer
object this element is attached to.
public Pair<SortedSet<Link>,SortedSet<Link>> getLinksNoDownPropagationPotentiallyCarryingTraffic()
public SortedSet<Link> getLinksWithNonZeroForwardingRules()
public double getMaximumAcceptableE2EWorstCaseLatencyInMs()
public TrafficSeries getMonitoredOrForecastedOfferedTraffic()
public double getOccupiedCapacity(Link e)
e
- see abovepublic double getOfferedTraffic()
public double getOfferedTrafficPerPeriodGrowthFactor()
public String getQosType()
public SortedSet<Route> getRoutes()
Returns the routes associated to this demand.
Important: If network layer routing type is not SOURCE_ROUTING
, an exception is thrown.
public SortedSet<Route> getRoutesAreBackup()
Returns the routes associated to this demand, but only those that are a backup route.
Important: If network layer routing type is not SOURCE_ROUTING
, an exception is thrown.
public SortedSet<Route> getRoutesAreNotBackup()
Returns the routes associated to this demand, but only those that are not a backup route.
Important: If network layer routing type is not SOURCE_ROUTING
, an exception is thrown.
public SortedSet<Route> getRoutesHaveBackup()
Returns the routes associated to this demand, but only those that are have themselves a backup route.
Important: If network layer routing type is not SOURCE_ROUTING
, an exception is thrown.
public SortedSet<Route> getRoutesHaveNoBackup()
Returns the routes associated to this demand, but only those that have no backup route themselves.
Important: If network layer routing type is not SOURCE_ROUTING
, an exception is thrown.
public Constants.RoutingCycleType getRoutingCycleType()
Returns the routing cycle type of the demand, indicating if the traffic is routed in a loopless form, with open loops or with closed
loops (the latter can only happen in HOP_BY_HOP_ROUTING
routing).
Constants.RoutingCycleType
public Constants.RoutingType getRoutingType()
Constants.RoutingType
public List<String> getServiceChainSequenceOfTraversedResourceTypes()
public SortedMap<Link,Double> getTraversedLinksAndCarriedTraffic(boolean normalizedToOfferedTraffic)
normalizedToOfferedTraffic
- see abovepublic double getWorstCaseLengthInKm()
Returns the worse case end-to-end length in km of the demand traffic. If the routing is source routing, this is the worst length
(summing the link lengths in km) for all the routes carrying traffic. If the routing is hop-by-hop and loopless,
the paths followed are computed and the worst case length among all the paths is returned.
If the hop-by-hop routing has loops, Double.MAX_VALUE
is returned. In multilayer design, when the
traffic of a demand traverses a link that is coupled to a lower layer demand, the link length taken is the
worst case length of the lower layer demand
of the underlying demand.
public double getWorstCasePropagationTimeInMs()
Returns the worse case end-to-end propagation time of the demand traffic. If the routing is source routing, this is the worse propagation time
(summing the link latencies) for all the routes carrying traffic. If the routing is hop-by-hop and loopless, the paths followed are computed and
the worse case propagation time is returned. If the hop-by-hop routing has loops, Double.MAX_VALUE
is returned. In multilayer design, when the
traffic of a demand traverses a link that is coupled to a lower layer demand, the link latency taken is the worse case propagation time
of the underlying demand.
public boolean isBidirectional()
public boolean isBifurcated()
If routing is SOURCE_ROUTING
, return true
if more than one route is associated to this demand (routes down or with zero carried traffic also count).
If routing is HOP_BY_HOP_ROUTING
, return true
if a node sends traffic of the demand through more than one output link.
true
if bifurcated, false otherwisepublic boolean isBlocked()
Returns true
if the carried traffic is strictly less than the offered traffic, up to the Net2Plan-wide precision factor.
true
if blocked, false otherwiseConfiguration
public boolean isCoupled()
Returns true
if the demand is coupled to a link of an upper layer.
true
is coupled, false otherwisepublic boolean isCoupledInDifferentLayer()
Returns true
if the demand is coupled to a link in a different layer than the demnad (and thus an *upper* layer)
, false otherwise.
public boolean isCoupledInSameLayer()
Returns true
if the demand is coupled to a link in the same layer as the demand, false otherwise.
public boolean isServiceChainRequest()
public boolean isSourceRouting()
public boolean isTraversingOversubscribedLinks()
Returns true
if the traffic of the demand is traversing an oversubscribed link, false
otherwise.
true
if the traffic is traversing an oversubscribed link, false
otherwisepublic boolean isTraversingOversubscribedResources()
Returns true
if the traffic of the demand is traversing an oversubscribed resource, false
otherwise. If the
layer is not in a SOURCE ROUTING mode, an Exception is thrown
true
if the traffic is traversing an oversubscribed resource, false
otherwisepublic void remove()
Removes a demand, and any associated routes or forwarding rules.
public void removeAllForwardingRules()
Removes all forwarding rules associated to the demand.
Important: If routing type is not HOP_BY_HOP_ROUTING
and exception is thrown.
public void removeAllRoutes()
Removes all forwarding rules associated to the demand.
Important: If routing type is not HOP_BY_HOP_ROUTING
and exception is thrown.
public void setBidirectionalPair(Demand d)
Sets the given demand as the bidirectional pair of this demand. If any of the demands was previously set as bidirectional link of other demand, such relation is removed. The demands must be in the same layer, and have opposite end nodes
d
- the other demandpublic void setIntendedRecoveryType(Demand.IntendedRecoveryType recoveryType)
recoveryType
- the recovery typepublic void setMaximumAcceptableE2EWorstCaseLatencyInMs(double maxLatencyMs)
maxLatencyMs
- see abovepublic void setMonitoredOrForecastedOfferedTraffic(TrafficSeries newTimeSeries)
newTimeSeries
- see abovepublic void setOfferedTraffic(double offeredTraffic)
Sets the offered traffic by a demand. If routing type is HOP_BY_HOP_ROUTING
, the carried traffic for each link is updated according to the forwarding rules.
In SOURCE_ROUTING
, the routes carried traffic is not updated.
offeredTraffic
- The new offered traffic (must be non-negative)public void setOfferedTrafficPerPeriodGrowthFactor(double growthFactor)
growthFactor
- see abovepublic void setQoSType(String newQosType)
newQosType
- see abovepublic void setRoutingType(Constants.RoutingType newRoutingType)
Sets the routing type at the given layer. If there is some previous routing information, it will be converted to the new type. If no layer is provided, default layer is assumed. In the conversion from HOP-BY-HOP to SOURCE-ROUTING: (i) the demands with open loops are routed so these loops are removed, and the resulting routing consumes the same or less bandwidth in the demand traversed links, (ii) the demands with closed loops are routed so that the traffic that enters the closed loops is not carried. These modifications are done since open or close loops would require routes with an infinite number of links to be fairly represented.
In the conversion to HOP-BY-HOP: An exception is thrown if a demand is service chain demand (since this information would be lost in the hop-by-bop representation). Also, in this conversion, some information can be lost (so a conversion back to SOURCE ROUTING will not produce the original network): the conversion uses the route carried traffics, and discards the information of the the routes occupied capacities in the links. A conversion back will put all the occupied capacities of the routes, equal to the carried traffics (so the original occupied links capacities would be lost, if different).
newRoutingType
- RoutingType
public void setServiceChainSequenceOfTraversedResourceTypes(List<String> resourceTypesSequence)
resourceTypesSequence
- the sequence of types of the resources that has to be traversed by all the routes of this demand. If null, an empty sequence is assumedpublic String toString()
Returns a String
representation of the demand.
toString
in class NetworkElement
String
representation of the demandCopyright © 2018. All rights reserved.