public final class ResilienceNetState
extends SimState
Represents the current state of a network within the resilience simulation: SRGs/nodes/links up/down, current carried traffic per link...
Important: Users only should use this class only for queries via
getX()
methods, since kernel is in charge of modifying the network
state using the events (ResilienceEvent
)
scheduled by the event generator (see IResilienceEventGenerator
)
and the actions (see ProvisioningAction
)
provided by the event processor (see IProvisioningAlgorithm
).
Constructor and Description |
---|
ResilienceNetState(NetPlan netPlan)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkProtectionSegmentMergeabilityToRoute(long routeId,
long segmentId)
Tests whether a given protection segment is applicable to a route.
|
void |
checkRouteValidityForDemand(long[] sequenceOfLinksAndSegments,
int demandId)
Checks if a sequence of links is valid for a given demand.
|
void |
checkValidity(java.util.Map<java.lang.String,java.lang.String> net2planParameters,
boolean allowLinkOversubscription,
boolean allowExcessCarriedTraffic) |
int[] |
convertBackupRoute2SequenceOfLinks(long[] seqLinksAndSegments)
Converts a sequence of links and segments to a sequence of links.
|
NetPlan |
convertToNetPlan()
Returns a network design from the current network state.
|
SimState |
copy()
Returns a deep copy of the current state.
|
double[] |
getDemandCurrentCarriedTrafficInErlangsVector()
Returns the current carried traffic per demand.
|
long[] |
getDemandRoutes(int demandId)
Returns the routes carrying traffic for a given demand.
|
void |
getFailureEffects(ResilienceEvent event,
java.util.Set<java.lang.Integer> nodesDown,
java.util.Set<java.lang.Integer> linksDown,
java.util.Set<java.lang.Long> affectedRoutes,
java.util.Set<java.lang.Long> unrecoverableRoutes,
java.util.List<java.lang.Double> currentLinkAvailableCapacity,
java.util.Map<java.lang.Long,java.lang.Double> availableSegments)
Returns the effects of a failure event.
|
int |
getFirstAvailableNodeDownstream(long routeId,
int[] nodesDown,
int[] linksDown)
Returns the first node available from the failure point to the egress node for a given route.
|
int |
getFirstAvailableNodeUpstream(long routeId,
int[] nodesDown,
int[] linksDown)
Returns the first node available before the failure point for a given route.
|
double[] |
getLinkCurrentCarriedTrafficInErlangsVector()
Returns the current carried traffic per link.
|
long[] |
getLinkCurrentTraversingProtectionSegments(int linkId)
Returns the set of protection segments traversing a given link.
|
long[][] |
getLinkCurrentTraversingProtectionSegmentsVector()
Returns the set of protection segments traversing each link.
|
int[] |
getLinksDown()
Returns the list of links which are down.
|
int[] |
getLinksOversubscribed()
Returns the set of over-subscribed links.
|
long[] |
getLinkTraversingCurrentRoutes(int linkId)
Returns the routes traversing a given link in their current path.
|
long[] |
getLinkTraversingPrimaryRoutes(int linkId)
Returns the routes traversing a given link in their primary path.
|
long[] |
getMergedBackupRoute(long[] currentPath,
long segmentId)
Returns the new route resulting from applying a protection segment.
|
int[] |
getMergedRoute(int[] originalRoute,
int[] partialRoute)
Returns a modified route resulting after applying a partial segment to
the original route.
|
long |
getNextProtectionSegmentId()
Returns the identifier of the next added protection segment.
|
long |
getNextRouteId()
Returns the identifier of the next added route.
|
double[][] |
getNodeCurrentTrafficInErlangsVector()
Returns the current ingress/egress/traversing traffic to each node.
|
void |
getNodeLinkStateChanges(int[] newSRGsDown,
int[] newSRGsUp,
java.util.Set<java.lang.Integer> nodesDown2Up,
java.util.Set<java.lang.Integer> nodesUp2Down,
java.util.Set<java.lang.Integer> linksDown2Up,
java.util.Set<java.lang.Integer> linksUp2Down)
Returns the set of current state changes in the network.
|
double[][] |
getNodePrimaryTrafficInErlangsVector()
Returns the planned ingress/egress/traversing traffic to each node.
|
int[] |
getNodesDown()
Returns the list of nodes which are down.
|
java.lang.String |
getProtectionSegmentAttribute(long segmentId,
java.lang.String key)
Returns the value of a given attribute for a protection segment.
|
double |
getProtectionSegmentCurrentCarriedTrafficInErlangs(long segmentId)
Returns the current carried traffic of the given protection segment.
|
int |
getProtectionSegmentDestinationNode(long segmentId)
Returns the destination node of a given protection segment.
|
long[] |
getProtectionSegmentIds()
Returns the identifiers of the current protection segments.
|
int |
getProtectionSegmentOriginNode(long segmentId)
Returns the origin node of a given protection segment.
|
double |
getProtectionSegmentReservedBandwidthInErlangs(long segmentId)
Returns the reserved bandwidth for a given protection segment.
|
int[] |
getProtectionSegmentSequenceOfLinks(long segmentId)
Returns the sequence of links of a given protection segment.
|
java.util.Map<java.lang.String,java.lang.String> |
getProtectionSegmentSpecificAttributes(long segmentId)
Returns the specific attributes of a given protection segment.
|
void |
getReparationEffects(ResilienceEvent event,
java.util.Set<java.lang.Integer> nodesDown,
java.util.Set<java.lang.Integer> linksDown,
java.util.Set<java.lang.Long> reparableRoutes,
java.util.Set<java.lang.Long> unreparableRoutes,
java.util.List<java.lang.Double> currentLinkAvailableCapacity,
java.util.Map<java.lang.Long,java.lang.Double> availableSegments)
Returns the effects of a reparation event.
|
java.lang.String |
getRouteAttribute(long routeId,
java.lang.String key)
Returns the value of a given attribute for a route.
|
long[] |
getRouteBackupSegmentList(long routeId)
Returns the backup protection segments associated to a given route.
|
double |
getRouteCurrentCarriedTrafficVolumeInErlangs(long routeId) |
long[] |
getRouteCurrentSequenceOfLinksAndSegments(long routeId)
Returns the current sequence of links and segments of a given route.
|
int |
getRouteDemand(long routeId)
Returns the demand associated to a given route.
|
long[] |
getRouteIds()
Returns the identifiers of the current routes.
|
double |
getRoutePrimaryPathCarriedTrafficVolumeInErlangs(long routeId)
Returns the carried traffic in the primary path for a given route.
|
int[] |
getRoutePrimaryPathSequenceOfLinks(long routeId)
Returns the sequence of links of a given route in its primary path.
|
int[] |
getRoutePriorityVector(long[] routeIds)
Indicates the priority of each of the given routes (default, 0).
|
java.util.Map<java.lang.String,java.lang.String> |
getRouteSpecificAttributes(long routeId)
Returns the attributes for a given route.
|
long[] |
getSRGRoutesCurrentPath(int srgId)
Returns the routes traversing elements in a given SRG in their current path.
|
long[] |
getSRGRoutesPrimaryPath(int srgId)
Returns the routes traversing elements in a given SRG in their primary path.
|
int[] |
getSRGsDown()
Returns the set of SRGs which are down.
|
boolean |
hasProtectionSegments()
Indicates whether or not there are active protection segments.
|
boolean |
hasRoutes()
Indicates whether or not there are active routes.
|
boolean |
isRoutePartialRecoveryAllowed(long routeId)
Indicates whether or not a given route allows partial recovery (default,
true ). |
boolean |
isRouteRevertible(long routeId)
Indicates whether or not a given route is revertible (default,
true ). |
void |
reset()
Resets the state of the network.
|
SimState |
unmodifiableView()
Returns an unmodifiable view of the network.
|
java.lang.Object |
update(SimEvent event,
java.util.List actions)
Update the network state.
|
public ResilienceNetState(NetPlan netPlan)
netPlan
- Initial network designpublic double[] getLinkCurrentCarriedTrafficInErlangsVector()
public int[] getLinksOversubscribed()
public double getProtectionSegmentCurrentCarriedTrafficInErlangs(long segmentId)
segmentId
- Segment identifierpublic void checkValidity(java.util.Map<java.lang.String,java.lang.String> net2planParameters, boolean allowLinkOversubscription, boolean allowExcessCarriedTraffic)
public NetPlan convertToNetPlan()
public double[] getDemandCurrentCarriedTrafficInErlangsVector()
public long[] getDemandRoutes(int demandId)
demandId
- Demand identifierpublic void checkRouteValidityForDemand(long[] sequenceOfLinksAndSegments, int demandId)
demandId
- Demand identifiersequenceOfLinksAndSegments
- Sequence of links and segmentspublic long[] getMergedBackupRoute(long[] currentPath, long segmentId)
currentPath
- Current sequence of linkssegmentId
- Protection segment identifierpublic int getProtectionSegmentOriginNode(long segmentId)
segmentId
- Segment identifierpublic int getProtectionSegmentDestinationNode(long segmentId)
segmentId
- Segment identifierpublic void getFailureEffects(ResilienceEvent event, java.util.Set<java.lang.Integer> nodesDown, java.util.Set<java.lang.Integer> linksDown, java.util.Set<java.lang.Long> affectedRoutes, java.util.Set<java.lang.Long> unrecoverableRoutes, java.util.List<java.lang.Double> currentLinkAvailableCapacity, java.util.Map<java.lang.Long,java.lang.Double> availableSegments)
event
- Node/link failure eventnodesDown
- Set of nodes which are downlinksDown
- Set of links which are downaffectedRoutes
- Routes which are going down and might be reroutedunrecoverableRoutes
- Routes which are going down but cannot be rerouted (ingress/egress node is down)currentLinkAvailableCapacity
- Current available capacity per link (for links in down state it is equal to zero)availableSegments
- Set of protection segments which are up and their corresponding available capacitypublic int getFirstAvailableNodeDownstream(long routeId, int[] nodesDown, int[] linksDown)
routeId
- Route identifiernodesDown
- Set of nodes which are currently downlinksDown
- Set of links which are currently downpublic int getFirstAvailableNodeUpstream(long routeId, int[] nodesDown, int[] linksDown)
routeId
- Route identifiernodesDown
- Set of nodes which are currently downlinksDown
- Set of links which are currently downpublic long[] getLinkCurrentTraversingProtectionSegments(int linkId)
linkId
- Link identifierpublic long[][] getLinkCurrentTraversingProtectionSegmentsVector()
public int[] getLinksDown()
public long getNextProtectionSegmentId()
public long getNextRouteId()
public void getNodeLinkStateChanges(int[] newSRGsDown, int[] newSRGsUp, java.util.Set<java.lang.Integer> nodesDown2Up, java.util.Set<java.lang.Integer> nodesUp2Down, java.util.Set<java.lang.Integer> linksDown2Up, java.util.Set<java.lang.Integer> linksUp2Down)
newSRGsDown
- Set of failure groups which are moving from up to downnewSRGsUp
- Set of failure groups which are moving from down to upnodesDown2Up
- Set of nodes changing from down to upnodesUp2Down
- Set of nodes changing from up to downlinksDown2Up
- Set of links changing from down to uplinksUp2Down
- Set of links changing from up to downpublic int[] getNodesDown()
public double getProtectionSegmentReservedBandwidthInErlangs(long segmentId)
segmentId
- Segment identifierpublic int[] getProtectionSegmentSequenceOfLinks(long segmentId)
segmentId
- Segment identifierpublic long[] getProtectionSegmentIds()
public java.util.Map<java.lang.String,java.lang.String> getProtectionSegmentSpecificAttributes(long segmentId)
segmentId
- Protection segment identifierpublic void getReparationEffects(ResilienceEvent event, java.util.Set<java.lang.Integer> nodesDown, java.util.Set<java.lang.Integer> linksDown, java.util.Set<java.lang.Long> reparableRoutes, java.util.Set<java.lang.Long> unreparableRoutes, java.util.List<java.lang.Double> currentLinkAvailableCapacity, java.util.Map<java.lang.Long,java.lang.Double> availableSegments)
event
- Node/link reparation eventnodesDown
- Set of nodes which are downlinksDown
- Set of links which are downreparableRoutes
- Routes using a backup path whose (planned) primary path is availableunreparableRoutes
- Routes using a backup path whose (planned) primary path is not availablecurrentLinkAvailableCapacity
- Current available capacity per link (for links in down state it is equal to zero)availableSegments
- Set of protection segments which are up and their corresponding available capacitypublic int[] getMergedRoute(int[] originalRoute, int[] partialRoute)
originalRoute
- Sequence of links of the original routepartialRoute
- Sequence of links of the partial segmentpublic java.lang.String getRouteAttribute(long routeId, java.lang.String key)
routeId
- Route identifierkey
- Attribute namepublic java.lang.String getProtectionSegmentAttribute(long segmentId, java.lang.String key)
segmentId
- Protection segment identifierkey
- Attribute namepublic long[] getRouteBackupSegmentList(long routeId)
routeId
- Route identifierpublic double getRouteCurrentCarriedTrafficVolumeInErlangs(long routeId)
routeId
- Route identifierpublic long[] getRouteCurrentSequenceOfLinksAndSegments(long routeId)
routeId
- Route identifierpublic int getRouteDemand(long routeId)
routeId
- Route identifierpublic long[] getRouteIds()
public double getRoutePrimaryPathCarriedTrafficVolumeInErlangs(long routeId)
routeId
- Route identifierpublic int[] getRoutePrimaryPathSequenceOfLinks(long routeId)
routeId
- Route identifierpublic java.util.Map<java.lang.String,java.lang.String> getRouteSpecificAttributes(long routeId)
routeId
- Route identifierpublic long[] getSRGRoutesPrimaryPath(int srgId)
srgId
- SRG identifierpublic long[] getSRGRoutesCurrentPath(int srgId)
srgId
- SRG identifierpublic int[] convertBackupRoute2SequenceOfLinks(long[] seqLinksAndSegments)
seqLinksAndSegments
- Sequence of links and segmentspublic int[] getSRGsDown()
public boolean hasProtectionSegments()
true
if there are active protection segments. Otherwise, false
public boolean hasRoutes()
true
if there are active routes. Otherwise, false
public int[] getRoutePriorityVector(long[] routeIds)
routeIds
- Route identifierspublic boolean isRoutePartialRecoveryAllowed(long routeId)
true
).routeId
- Route identifiertrue
if route allows partial recovery. Otherwise, false
public boolean isRouteRevertible(long routeId)
true
).routeId
- Route identifiertrue
if route is revertible. Otherwise, false
public void reset()
public java.lang.Object update(SimEvent event, java.util.List actions)
event
- Current simulation eventactions
- List of actions to performnull
objectpublic boolean checkProtectionSegmentMergeabilityToRoute(long routeId, long segmentId)
segmentId
- Segment identifierrouteId
- Route identifiertrue
is segment is applicable to route, false
otherwisepublic SimState copy()
public SimState unmodifiableView()
public double[][] getNodePrimaryTrafficInErlangsVector()
public double[][] getNodeCurrentTrafficInErlangsVector()
public long[] getLinkTraversingCurrentRoutes(int linkId)
linkId
- Link identifierpublic long[] getLinkTraversingPrimaryRoutes(int linkId)
linkId
- Link identifier