public class Route extends NetworkElement
This class contains a representation of a unidirectional route, an structure used to carry traffic of unicast demands at a layer, when the layer routing type is source routing. Routes are characterized by the unicast demand they carry traffic of, the traversed links which should form a path from the demand ingress node to the demand egress node, the amount of traffic of the demand that they carry (in traffic units of the layer), amount of link capacity that they occupy in the traversed links (in link capacoty units for its layer).
Naturally, the links and the demand belong to the same layer, the layer of the route.
Routes can be rerouted (change in its sequence of links), and its carried traffic and occupied capacity can change, but not its associate demand. If a route traverses a link or node that is down, its carried traffic automatically drops to zero. If the failing links/nodes are set to up state, its carried traffic and occupied link capacity goes back to the value before the failure.
Routes can be associated to an arbitrary number of protection segments. Protection segments are just reserved capacity in the links, that a route may use. Typically, a built-in or user-made algorithm that reacts to link and node failures decides how and when the assigned protection segments to a route are used.
Modifier and Type | Method and Description |
---|---|
void |
addBackupRoute(Route backupRoute)
Adds an existing route backupRoute in the same demand, designating it as a backup of this route.
|
Route |
createBidirectionalOppositePair()
Creates a route in the opposite direction as this, and associate both as bidirectional pairs.
|
List<Route> |
getBackupRoutes()
Returns the list of backup routes for this route (the ones defined as backup by the user)
|
Route |
getBidirectionalPair()
If this route was added using the method addRouteBidirectional(),
returns the route in the other direction (if it was not previously removed).
|
double |
getCarriedTraffic()
Returns the route carried traffic at this moment.
|
double |
getCarriedTrafficInNoFailureState()
Returns the route amount of carried traffic, if the route was not traversing any failing link or node.
|
Demand |
getDemand()
Returns the demand that the route is associated to
|
Node |
getEgressNode()
Returns the route egress node, which is the egress node if its associated demand
|
Node |
getFirstAvailableNodeAfterFailures()
Returns the first node in the route that is in up state after all failures in the route.
|
Node |
getFirstAvailableNodeBeforeFailures()
Returns the first node starting from the route ingress node that is in up state, and is immediatly before
a failed resource for this route.
|
Node |
getIngressNode()
Returns the route ingress node, which is the ingress node if its associated demand
|
Triple<Double,List<NetworkElement>,List<Double>> |
getInitialState()
Returns the initial state of the route (the one when it was created): the carried traffic (in the no-failure state), its path (sequence of links and/or resources), and the occupation information (occupation in each link/resource travserse).
|
NetworkLayer |
getLayer()
Returns the route layer
|
double |
getLengthInKm()
Returns the route length in km, summing the traversed link lengths, as many times as the link is traversed.
|
int |
getNumberOfHops()
Returns the route number of traversed links.
|
int |
getNumberOfTimesIsTraversed(NetworkElement e)
Returns the number of times that a particular link or resource is traversed
|
double |
getOccupiedCapacity(NetworkElement... e)
Returns the route occupied capacity at this moment, at the particular link or resource.
|
double |
getOccupiedCapacityInNoFailureState(NetworkElement... e)
The same as getOccupiedCapacity, but if the network had no failures
|
List<NetworkElement> |
getOppositePath()
Return the opposite path of this route, from the destination to the origin traversing the
bidirectional pairs of the traversed links, and the same resources.
|
List<NetworkElement> |
getPath()
Return the current path (sequence of links and resources) of the route.
|
double |
getPropagationDelayInMiliseconds()
Returns the route propagation delay in seconds, summing the traversed link propagation delays
|
double |
getPropagationSpeedInKmPerSecond()
Returns the route average propagation speed in km per second, as the ratio between the total route length and the total route delay
(not including the processing time in the traversed resources)
|
SortedSet<Route> |
getRoutesIAmBackup()
Return the set of routes that this route is a designated as a backup for them
|
List<Node> |
getSeqIntermediateNodes()
Returns the route sequence of traversed nodes, removing the origin and end node
|
List<Link> |
getSeqLinks()
Returns the route current sequence of traversed links (without any resource traversed).
|
static List<Link> |
getSeqLinks(List<? extends NetworkElement> seqLinksAndResources)
Given a path, composed of a sequence of links and resources, extracts the list of links, filtering out the resources
|
List<Node> |
getSeqNodes()
Returns the route sequence of traversed nodes (when a resource is traversed, the resource node is not added again as a traversal)
|
List<Double> |
getSeqOccupiedCapacitiesIfNotFailing()
Returns a list of double, with one element per link or resource traversed,
in the order in which they are traversed, meaning the occupation in such traversal.
|
static List<Resource> |
getSeqResources(List<? extends NetworkElement> seqLinksAndResources)
Given a path, composed of a sequence of links and resources, extracts the list of resources, filtering out the links
|
List<Resource> |
getSeqResourcesTraversed()
Returns the route current sequence of traversed resources, in the order they are traversed (and thus, a resource will
appear as many times as it is traversed.
|
SortedSet<SharedRiskGroup> |
getSRGs()
Returns the SRGs the route is affected by (any traversed node or link is in the SRG)
|
boolean |
hasBackupRoutes()
Returns true if this route has at least one backup route defined
|
boolean |
hasLoops()
Returns true if the route has loops (traverses a node more than once), and false otherwise
|
boolean |
isBackupRoute()
Returns true if this route has been defined as a backup route for other
|
boolean |
isBidirectional()
Returns true if the route is bidirectional.
|
boolean |
isDown()
Returns true if the route is traversing a link or node that is down.
|
boolean |
isOccupyingDifferentCapacitiesInDifferentLinksInNoFailureState() |
boolean |
isServiceChain()
Indicates if the route is a serivce chain: traverses resources
|
boolean |
isTraversingZeroCapLinks()
Returns true if the route is traversing a link with zero capacity
|
void |
remove()
Removes this route.
|
void |
removeBackupRoute(Route backupRoute)
Removes the given backupRoute from the backupRoute list of this route
|
void |
setBidirectionalPair(Route r)
Sets the given route as the bidirectional pair of this route.
|
void |
setCarriedTraffic(double newCarriedTraffic,
double newOccupiedLinkAndResourcesCapacities)
Sets the route carried traffic and the occupied capacity in the traversed links and resources (typically the same as the carried traffic),
setting it to being the same in all the links and resources traversed.
|
void |
setCarriedTraffic(double newCarriedTraffic,
List<Double> linkAndResourcesOccupationInformation)
Sets the route carried traffic and the occupied capacity in the traversed links and resources, so the capacity occupied can
be different (but always non-negative) in each.
|
void |
setPath(double newCarriedTraffic,
List<? extends NetworkElement> newPath,
List<Double> newOccupationInformation)
Sets the new sequence of links and/or resources traversed by the route, carried traffic, and occupied capacity in the traversed links/resources
If the new route traverses failing link or nodes, its current
carried traffic and occupied link capacities will be zero.
|
void |
setSeqLinks(List<Link> seqLinks)
Sets the new sequence of links traversed by the route.
|
String |
toString()
Returns a
String representation of the network element. |
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 addBackupRoute(Route backupRoute)
Adds an existing route backupRoute in the same demand, designating it as a backup of this route. For this to happen, this route cannot have backup routes itself, or an exception is thrown.
backupRoute
- the backup routepublic Route createBidirectionalOppositePair()
public List<Route> getBackupRoutes()
public Route getBidirectionalPair()
If this route was added using the method addRouteBidirectional(), returns the route in the other direction (if it was not previously removed). Returns null otherwise.
public double getCarriedTraffic()
public double getCarriedTrafficInNoFailureState()
public Demand getDemand()
public Node getEgressNode()
public Node getFirstAvailableNodeAfterFailures()
public Node getFirstAvailableNodeBeforeFailures()
public Node getIngressNode()
public Triple<Double,List<NetworkElement>,List<Double>> getInitialState()
public NetworkLayer getLayer()
public double getLengthInKm()
public int getNumberOfHops()
public int getNumberOfTimesIsTraversed(NetworkElement e)
e
- the link or resource to checkpublic double getOccupiedCapacity(NetworkElement... e)
e
- one link or resource where to see the occupation (if not part of the route, zero is returned)public double getOccupiedCapacityInNoFailureState(NetworkElement... e)
e
- one link or resource where to see the occupation (if not part of the route, zero is returned). If no element is passed, the result is the one of the first traversed elementpublic List<NetworkElement> getOppositePath()
public List<NetworkElement> getPath()
public double getPropagationDelayInMiliseconds()
public double getPropagationSpeedInKmPerSecond()
public SortedSet<Route> getRoutesIAmBackup()
public List<Node> getSeqIntermediateNodes()
public List<Link> getSeqLinks()
public static List<Link> getSeqLinks(List<? extends NetworkElement> seqLinksAndResources)
seqLinksAndResources
- sequence of links and resourcespublic List<Node> getSeqNodes()
public List<Double> getSeqOccupiedCapacitiesIfNotFailing()
public static List<Resource> getSeqResources(List<? extends NetworkElement> seqLinksAndResources)
seqLinksAndResources
- sequence of links and resourcespublic List<Resource> getSeqResourcesTraversed()
public SortedSet<SharedRiskGroup> getSRGs()
public boolean hasBackupRoutes()
public boolean hasLoops()
public boolean isBackupRoute()
public boolean isBidirectional()
public boolean isDown()
public boolean isOccupyingDifferentCapacitiesInDifferentLinksInNoFailureState()
public boolean isServiceChain()
public boolean isTraversingZeroCapLinks()
public void remove()
Removes this route.
public void removeBackupRoute(Route backupRoute)
Removes the given backupRoute from the backupRoute list of this route
backupRoute
- The route to remove as backuppublic void setBidirectionalPair(Route r)
Sets the given route as the bidirectional pair of this route. If any of the routes was previously set as bidirectional pair of other route, such relation is removed. The routes demands must be bidirectional pairs of each other
r
- the other routepublic void setCarriedTraffic(double newCarriedTraffic, double newOccupiedLinkAndResourcesCapacities)
newCarriedTraffic
- the new carried trafficnewOccupiedLinkAndResourcesCapacities
- the new occuppied link and resourcs capacitypublic void setCarriedTraffic(double newCarriedTraffic, List<Double> linkAndResourcesOccupationInformation)
newCarriedTraffic
- the new carried trafficlinkAndResourcesOccupationInformation
- the new occupied capacity in traversed link and resources. If null, the occupied capacities are kept unchangedpublic void setPath(double newCarriedTraffic, List<? extends NetworkElement> newPath, List<Double> newOccupationInformation)
newCarriedTraffic
- new amount of carried trafficnewPath
- the new sequence of links and resourcesnewOccupationInformation
- the new link/resource occupation infopublic void setSeqLinks(List<Link> seqLinks)
seqLinks
- the new sequence of links and protection segmentspublic String toString()
NetworkElement
Returns a String
representation of the network element.
toString
in class NetworkElement
String
representation of the network elementCopyright © 2018. All rights reserved.