public class Link extends NetworkElement
This class contains a representation of a link. A link is characterized by its initial and end node, the network layer it belongs to,
and its capacity, measured in the layer link capacity units. When the routing type at the link layer is SOURCE_ROUTING
, the link
carries traffic of the traversing routes, and can have some capacity reserved by protection segments. If the routing type is HOP_BY_HOP_ROUTING
, the
link carried traffic depends on the demands offered traffic and the forwarding rules. In both routing types, links can be part of multicast trees and
carry their traffic.
SOURCE_ROUTING
), the splitting factors of the forwarding rules through it are set to zero
(HOP_BY_HOP_ROUTING
), and the carried traffic of any traversing multicast tree is set to zero.Modifier and Type | Method and Description |
---|---|
void |
coupleToLowerLayerDemand(Demand demand)
Couples the link to a unicast
Demand in the lower layer. |
Demand |
coupleToNewDemandCreated(NetworkLayer newDemandLayer)
Creates a new
Demand in the given layer, with same end nodes as the link, and then couples the link to the new created demand. |
Link |
getBidirectionalPair()
If the link was added using
addLinkBidirectional() ,
returns the link in the opposite direction (if it was not previously removed). |
double |
getCapacity()
Returns the link capacity.
|
double |
getCarriedTrafficIncludingProtectionSegments()
Returns the link carried traffic (in traffic demand units).
|
double |
getCarriedTrafficNotIncludingProtectionSegments()
Returns the link carried traffic (in traffic demand units).
|
Demand |
getCoupledDemand()
Returns the unicast
Demand the link is coupled to, or null if none. |
MulticastDemand |
getCoupledMulticastDemand()
Returns the
MulticastDemand the link is coupled to, or null if none. |
Node |
getDestinationNode()
Returns the link destination
Node . |
Map<Pair<Demand,Link>,Double> |
getForwardingRules()
Returns the non zero forwarding rules that are defined in the link.
|
NetworkLayer |
getLayer()
Returns the
NetworkLayer the link belongs to. |
double |
getLengthInKm()
Returns the link length in km.
|
double |
getMulticastCarriedTraffic()
Returns the sum of the traffic carried by the
MulticastTree traversing the link. |
double |
getMulticastOccupiedLinkCapacity()
Returns the sum of the occupied link capacity by the traffic of the
Multicast Trees traversing the link. |
double |
getOccupiedCapacityIncludingProtectionSegments()
Returns the link occupied capacity (in link capacity units).
|
double |
getOccupiedCapacityNotIncludingProtectionSegments()
Returns the link occupied capacity (in link capacity units).
|
Node |
getOriginNode()
Returns the link origin node.
|
double |
getPropagationDelayInMs()
Returns the link propagation delay in miliseconds.
|
double |
getPropagationSpeedInKmPerSecond()
Returns the link propagation speed in km per second.
|
double |
getReservedCapacityForProtection()
Returns the link capacity that is reserved by traversing protection segments (disregarding the traffic they may or not carry).
|
Set<SharedRiskGroup> |
getSRGs()
Returns the Shared Risk Groups (
SRGs ) the link belongs to. |
Set<ProtectionSegment> |
getTraversingProtectionSegments()
Returns the
Protection Segments traversing the link. |
Set<Route> |
getTraversingRoutes()
Returns the
Routes traversing the link. |
Set<MulticastTree> |
getTraversingTrees()
Returns the
Multicast Trees traversing the link. |
double |
getUtilizationIncludingProtectionSegments()
Returns the link utilization, measured as the ratio between the total occupied capacity in the link and the total link capacity.
|
double |
getUtilizationNotIncludingProtectionSegments()
Returns the link utilization, measured as the ratio between the total occupied capacity in the link and the total link capacity.
|
boolean |
isCoupled()
|
boolean |
isDown()
Returns whether the link is down (in failure) or not.
|
boolean |
isOversubscribed()
Returns true if the link is oversubscribed, up to the Net2Plan defined precision factor.
|
boolean |
isUp()
Returns whether the link is up (not in failure) or down.
|
void |
remove()
Removes the link.
|
void |
removeAllForwardingRules()
Removes all forwarding rules associated to the link.
|
void |
setCapacity(double linkCapacity)
Sets the link capacity.
|
boolean |
setFailureState(boolean setAsUp)
Sets the failure state of the link: up or down and returns the previous failure state.
|
void |
setLengthInKm(double lengthInKm)
Sets the link length in km.
|
void |
setPropagationSpeedInKmPerSecond(double speed)
Sets the link propagation speed in km per second.
|
String |
toString()
Returns a
String representation of the link. |
checkAttachedToNetPlanObject, checkAttachedToNetPlanObject, equals, getAttribute, getAttributes, getId, getIndex, getNetPlan, removeAllAttributes, removeAttribute, setAttribute, setAttributeMap, wasRemoved
public void coupleToLowerLayerDemand(Demand demand)
Couples the link to a unicast Demand
in the lower layer.
demand
- The demand to be coupled topublic Demand coupleToNewDemandCreated(NetworkLayer newDemandLayer)
Creates a new Demand
in the given layer, with same end nodes as the link, and then couples the link to the new created demand.
newDemandLayer
- The layer where the demand will be created (and coupled to the link)public Link getBidirectionalPair()
If the link was added using addLinkBidirectional()
,
returns the link in the opposite direction (if it was not previously removed). Returns null
otherwise.
null
if nonepublic double getCapacity()
Returns the link capacity.
public double getCarriedTrafficIncludingProtectionSegments()
Returns the link carried traffic (in traffic demand units).
Important: carried traffic of the protection segments traversing the link is summed.
public double getCarriedTrafficNotIncludingProtectionSegments()
Returns the link carried traffic (in traffic demand units).
Important: carried traffic of the protection segments traversing the link is NOTconsidered.
public Demand getCoupledDemand()
Returns the unicast Demand
the link is coupled to, or null
if none.
null
public MulticastDemand getCoupledMulticastDemand()
Returns the MulticastDemand
the link is coupled to, or null
if none.
null
public Node getDestinationNode()
Returns the link destination Node
.
public Map<Pair<Demand,Link>,Double> getForwardingRules()
Returns the non zero forwarding rules that are defined in the link. If the routing type of the layer where the link is attached is not
HOP_BY_HOP_ROUTING
an exception is thrown.
[0,1]
splitting factorspublic NetworkLayer getLayer()
Returns the NetworkLayer
the link belongs to.
public double getLengthInKm()
Returns the link length in km.
public double getMulticastCarriedTraffic()
Returns the sum of the traffic carried by the MulticastTree
traversing the link.
public double getMulticastOccupiedLinkCapacity()
Returns the sum of the occupied link capacity by the traffic of the Multicast Trees
traversing the link.
public double getOccupiedCapacityIncludingProtectionSegments()
Returns the link occupied capacity (in link capacity units). If routing type is SOURCE_ROUTING
, this includes any traffic carried in the protection segments traversing the link.
public double getOccupiedCapacityNotIncludingProtectionSegments()
Returns the link occupied capacity (in link capacity units). If routing type is SOURCE_ROUTING
, this does NOT include any traffic carried in the protection segments traversing the link.
public Node getOriginNode()
Returns the link origin node.
public double getPropagationDelayInMs()
Returns the link propagation delay in miliseconds.
public double getPropagationSpeedInKmPerSecond()
Returns the link propagation speed in km per second.
public double getReservedCapacityForProtection()
Returns the link capacity that is reserved by traversing protection segments (disregarding the traffic they may or not carry).
public Set<SharedRiskGroup> getSRGs()
Returns the Shared Risk Groups (SRGs
) the link belongs to. The link fails when any of these SRGs is down.
public Set<ProtectionSegment> getTraversingProtectionSegments()
Returns the Protection Segments
traversing the link. If network layer routing type is not
SOURCE_ROUTING
, an exception is thrown.
Set
with the traversing protection segments. If no protection segments traverse the link, an empty Set
is returnedpublic Set<Route> getTraversingRoutes()
Returns the Routes
traversing the link. If network layer routing type is not
SOURCE_ROUTING
, an exception is thrown.
Set
of traversing routes. If no routes exist, an empty Set
is returnedpublic Set<MulticastTree> getTraversingTrees()
Returns the Multicast Trees
traversing the link.
Set
of traversing multicast trees. If no tree exists, an empty set is returnedpublic double getUtilizationIncludingProtectionSegments()
Returns the link utilization, measured as the ratio between the total occupied capacity in the link and the total link capacity. In SOURCE_ROUTING
,
the occupied capacity includes the one of the traversing routes, and the one from the traffic carried in the protection segments (disregarding the segment
reserved traffic). The total link capacity includes also any capacity reserved by the protection segments.
public double getUtilizationNotIncludingProtectionSegments()
Returns the link utilization, measured as the ratio between the total occupied capacity in the link and the total link capacity. In SOURCE_ROUTING
,
the occupied capacity includes the one of the traversing routes, BUT NOT from one of the traffic carried in the protection segments.
The total link capacity includes does NOT include any capacity reserved by the protection segments.
public boolean isCoupled()
Returns True
if the link is coupled to a Demand
from other layer, false
otherwise.
True
if the link is coupled, false
otherwisepublic boolean isDown()
Returns whether the link is down (in failure) or not.
True
if down, false
if uppublic boolean isOversubscribed()
Returns true if the link is oversubscribed, up to the Net2Plan defined precision factor. That is, if the occupied capacity by the traversing
traffic exceeds the link capacity plus said precision factor. In SOURCE_ROUTING
, the link capacity includes any reserved capacity, and the occupied
link capacity includes that from the traversing routes and protection segments.
True
if oversubscribed, false
otherwiseConfiguration
public boolean isUp()
Returns whether the link is up (not in failure) or down.
true
if up, false
if downpublic void remove()
Removes the link. The routing is updated removing any associated routes, protection segments, multicast trees or forwarding rules.
If the link is coupled to a unicast or multicast demand, it is first decoupled. In the multicast case, this means that the multicast demand is decoupled from ALL the links it is coupled to.
public void removeAllForwardingRules()
Removes all forwarding rules associated to the link.
If routing type is not HOP_BY_HOP_ROUTING
, an exeception is thrown.
public void setCapacity(double linkCapacity)
Sets the link capacity.
linkCapacity
- The link capacity (must be non-negative)public boolean setFailureState(boolean setAsUp)
Sets the failure state of the link: up or down and returns the previous failure state. The routing is updated if the failure state changed.
setAsUp
- The new failure state: true
if up, false
if downpublic void setLengthInKm(double lengthInKm)
Sets the link length in km.
lengthInKm
- New link length in km (must be non-negative)public void setPropagationSpeedInKmPerSecond(double speed)
Sets the link propagation speed in km per second.
speed
- The speed in km per secondpublic String toString()
Returns a String
representation of the link.
toString
in class NetworkElement
String
representation of the link