be.ac.ulg.montefiore.run.totem.domain.model.impl
Class LinkImpl

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.domain.model.jaxb.impl.LinkImpl
      extended by be.ac.ulg.montefiore.run.totem.domain.model.impl.LinkImpl
All Implemented Interfaces:
DomainElement, Link, UnmarshallableObject, ValidatableObject, XMLSerializable, com.sun.xml.bind.JAXBObject

public class LinkImpl
extends LinkImpl
implements Link

Represent a Link in a Domain

Creation date: 12-Jan-2005 17:27:03

Author:
Fabian Skivee (skivee@run.montefiore.ulg.ac.be)

Nested Class Summary
 
Nested classes/interfaces inherited from class be.ac.ulg.montefiore.run.totem.domain.model.jaxb.impl.LinkImpl
LinkImpl.FromTypeImpl, LinkImpl.SrlgsTypeImpl, LinkImpl.ToTypeImpl, LinkImpl.Unmarshaller
 
Nested classes/interfaces inherited from interface be.ac.ulg.montefiore.run.totem.domain.model.Link
Link.Type
 
Nested classes/interfaces inherited from interface be.ac.ulg.montefiore.run.totem.domain.model.jaxb.Link
Link.FromType, Link.SrlgsType, Link.ToType
 
Field Summary
 
Fields inherited from class be.ac.ulg.montefiore.run.totem.domain.model.jaxb.impl.LinkImpl
_Bw, _Delay, _Description, _From, _Id, _Srlgs, _Status, _Technology, _To, _Type, has_Bw, has_Delay, version
 
Fields inherited from interface be.ac.ulg.montefiore.run.totem.domain.model.Link
STATUS_DOWN, STATUS_UP
 
Constructor Summary
LinkImpl()
           
LinkImpl(Domain domain, java.lang.String id, java.lang.String src, java.lang.String dst, float bandwidth)
          Basic constructor
 
Method Summary
 void addPriority(int priority)
          This function should be called after a priority is added to the domain.
 void addReservation(float bw)
          Adds a reservation on the link As no priority is specified, this reservation is added to lowest prioritary class type and preemption level
 void addReservation(float bw, int priority)
          Adds a reservation on the link for a given priority (constraints are checked)
 boolean equals(java.lang.Object o)
          Two links are equal if they belong to the same domain and have the same id.
 float getBandwidth()
          Return the maximum reservable bandwidth of the link if defined.
 float[] getBCs()
          Gets the BCs, should not be needed for most algorithms
 int getDiffServBCM()
           
 DiffServModel getDiffServModel()
           
 NodeInterface getDstInterface()
          Returns the interface of the destination node used by this link.
 Node getDstNode()
          Returns the destination node.
 LinkIgp getIgpLink()
          Get the IGP link associated to the link
 int getLinkStatus()
          Get the status of the link.
 Link.Type getLinkType()
          Get the type of the node.
 float getMaximumBandwidth()
          Return the maximum bandwidth of the link.
 float getMetric()
          Return the metric of the link
 float[] getRbw()
           
 float getReservableBandwidth()
          Return the reservable bandwidth of the link (for the classType corresponding to minimum priority)
 float getReservableBandwidth(int priority)
          Return the reservable bandwidth of the link for a given priority (found in database) If domain does not use preemptions, the reservable bandwidth for minimum priority in the same class type is returned.
 float getReservableBandwidthCT(int ct)
           
 float getReservedBandwidth()
          Return the reserved bandwidth of the link for the classType corresponding to minimum priority
 float getReservedBandwidth(int priority)
          Return the reserved bandwidth of the link for a given priority (bandwidth constraints model is used)
 float getReservedBandwidthCT(int ct)
          Return the reserved bandwidth of the link for the given classType
 NodeInterface getSrcInterface()
          Returns the interface of the source node used by this link.
 Node getSrcNode()
          Returns the source node.
 float getTEMetric()
          Return the TE metric of the link
 float getTotalReservableBandwidth()
           
 float getTotalReservedBandwidth()
           
 int hashCode()
           
 void init(Domain domain)
          Initialize a link.
 void removePriority(int priority)
          This function should be called after a priority is removed from the domain.
 void removeReservation(float bw)
          Removes a reservation from the default priority, and update reservable bandwidths accordingly
 void removeReservation(float bw, int priority)
          Removes a reservation from the priority specified, and update reservable bandwidths accordingly
 void setBandwidth(float bw)
          Set the maximum reservable bandwidth of the link
 void setBC(int ct, float value)
          Set the BC to the given value.
 void setDstInterface(java.lang.String dstInterfaceId)
          Sets the destination interface.
 void setElementId(java.lang.String id)
          Sets the id of the element.
 void setLinkStatus(int status)
          Set the status of a link
 void setLinkType(Link.Type type)
           
 void setMaximumBandwidth(float value)
          Sets the bandwidth of the link.
 void setMetric(float metric)
          Sets the metric of the link.
 void setRbw(float[] rbw)
           
 void setSrcInterface(java.lang.String srcInterfaceId)
          Sets the source interface.
 void setTEMetric(float metric)
          Sets the TE metric of the link.
 
Methods inherited from class be.ac.ulg.montefiore.run.totem.domain.model.jaxb.impl.LinkImpl
createRawValidator, createUnmarshaller, getBw, getDelay, getDescription, getFrom, getId, getPrimaryInterface, getSrlgs, getStatus, getTechnology, getTo, getType, isSetBw, isSetDelay, isSetDescription, isSetFrom, isSetId, isSetSrlgs, isSetStatus, isSetTechnology, isSetTo, isSetType, serializeAttributes, serializeBody, serializeURIs, setBw, setDelay, setDescription, setFrom, setId, setSrlgs, setStatus, setTechnology, setTo, setType, unsetBw, unsetDelay, unsetDescription, unsetFrom, unsetId, unsetSrlgs, unsetStatus, unsetTechnology, unsetTo, unsetType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface be.ac.ulg.montefiore.run.totem.domain.model.Link
getDelay, getDescription, setDelay, setDescription
 
Methods inherited from interface be.ac.ulg.montefiore.run.totem.domain.model.DomainElement
getId
 

Constructor Detail

LinkImpl

public LinkImpl()

LinkImpl

public LinkImpl(Domain domain,
                java.lang.String id,
                java.lang.String src,
                java.lang.String dst,
                float bandwidth)
Basic constructor

Parameters:
domain -
id -
src - id of the src node
dst - id the dst node
bandwidth -
Method Detail

getIgpLink

public LinkIgp getIgpLink()
Get the IGP link associated to the link

Returns:

init

public void init(Domain domain)
Initialize a link. Create the domain reference and populate the rbwMapping structure

Parameters:
domain -

getSrcNode

public Node getSrcNode()
                throws NodeNotFoundException
Returns the source node.

Returns:
The source node.
Throws:
NodeNotFoundException

getDstNode

public Node getDstNode()
                throws NodeNotFoundException
Returns the destination node.

Returns:
The destination node.
Throws:
NodeNotFoundException

getSrcInterface

public NodeInterface getSrcInterface()
                              throws NodeNotFoundException,
                                     NodeInterfaceNotFoundException
Returns the interface of the source node used by this link.

Returns:
The interface of the source node used by this link.
Throws:
NodeNotFoundException
NodeInterfaceNotFoundException

getDstInterface

public NodeInterface getDstInterface()
                              throws NodeNotFoundException,
                                     NodeInterfaceNotFoundException
Returns the interface of the destination node used by this link.

Returns:
The interface of the destination node used by this link.
Throws:
NodeNotFoundException
NodeInterfaceNotFoundException

setSrcInterface

public void setSrcInterface(java.lang.String srcInterfaceId)
                     throws NodeNotFoundException,
                            NodeInterfaceNotFoundException
Sets the source interface.

Throws:
NodeNotFoundException
NodeInterfaceNotFoundException

setDstInterface

public void setDstInterface(java.lang.String dstInterfaceId)
                     throws NodeNotFoundException,
                            NodeInterfaceNotFoundException
Sets the destination interface.

Throws:
NodeNotFoundException
NodeInterfaceNotFoundException

getBandwidth

public float getBandwidth()
Return the maximum reservable bandwidth of the link if defined. Otherwise, it returns the bw field of the link.

Returns:
the maximum reservable bandwidth of the link if defined. Otherwise, it returns the bw field of the link.

setBandwidth

public void setBandwidth(float bw)
                  throws LinkCapacityExceededException
Set the maximum reservable bandwidth of the link

Parameters:
bw -
Throws:
LinkCapacityExceededException

setMaximumBandwidth

public void setMaximumBandwidth(float value)
Sets the bandwidth of the link. This sets the true link capacity. It corresponds to mbw (Maximum Bandwidth) in IGP and bw in normal link.
It does not change the reservable bandwidth of the link (mrbw in igp).

Parameters:
value -

getMaximumBandwidth

public float getMaximumBandwidth()
Return the maximum bandwidth of the link. It is the true link capacity.

Returns:
Returns the Mbw value of igp static section if exists. Otherwise returns the link bw.

getLinkStatus

public int getLinkStatus()
Get the status of the link. Returns down if the source or destination node is down or link is down.

Returns:
Link.STATUS_UP if the link is UP and Link.STATUS_DOWN otherwise

setLinkStatus

public void setLinkStatus(int status)
                   throws StatusTypeException
Set the status of a link

Parameters:
status -
Throws:
StatusTypeException - if status is neither STATUS_DOWN nor STATUS_UP

getLinkType

public Link.Type getLinkType()
Get the type of the node.

Returns:
Return a member of the enum Link.Type. Link.Type.INTRA if type is not set.

setLinkType

public void setLinkType(Link.Type type)

getMetric

public float getMetric()
Return the metric of the link

Returns:

setMetric

public void setMetric(float metric)
Sets the metric of the link.

Parameters:
metric - The new metric of the link.

getTEMetric

public float getTEMetric()
Return the TE metric of the link

Returns:

setTEMetric

public void setTEMetric(float metric)
Sets the TE metric of the link.

Parameters:
metric - The new TE metric of the link.

getReservableBandwidth

public float getReservableBandwidth()
Return the reservable bandwidth of the link (for the classType corresponding to minimum priority)

Returns:

getReservedBandwidth

public float getReservedBandwidth()
Return the reserved bandwidth of the link for the classType corresponding to minimum priority

Returns:

getTotalReservedBandwidth

public float getTotalReservedBandwidth()

getTotalReservableBandwidth

public float getTotalReservableBandwidth()

getReservedBandwidthCT

public float getReservedBandwidthCT(int ct)
Return the reserved bandwidth of the link for the given classType

Parameters:
ct -
Returns:

getReservableBandwidthCT

public float getReservableBandwidthCT(int ct)

getReservableBandwidth

public float getReservableBandwidth(int priority)
Return the reservable bandwidth of the link for a given priority (found in database) If domain does not use preemptions, the reservable bandwidth for minimum priority in the same class type is returned.

Parameters:
priority -
Returns:

getReservedBandwidth

public float getReservedBandwidth(int priority)
Return the reserved bandwidth of the link for a given priority (bandwidth constraints model is used)

Parameters:
priority -
Returns:

addReservation

public void addReservation(float bw)
                    throws LinkCapacityExceededException
Adds a reservation on the link As no priority is specified, this reservation is added to lowest prioritary class type and preemption level

Throws:
LinkCapacityExceededException

addReservation

public void addReservation(float bw,
                           int priority)
                    throws LinkCapacityExceededException
Adds a reservation on the link for a given priority (constraints are checked)

Parameters:
bw -
priority -
Throws:
LinkCapacityExceededException

getDiffServBCM

public int getDiffServBCM()

getDiffServModel

public DiffServModel getDiffServModel()

removeReservation

public void removeReservation(float bw)
                       throws LinkCapacityExceededException
Removes a reservation from the default priority, and update reservable bandwidths accordingly

Parameters:
bw -
Throws:
LinkCapacityExceededException

removeReservation

public void removeReservation(float bw,
                              int priority)
                       throws LinkCapacityExceededException
Removes a reservation from the priority specified, and update reservable bandwidths accordingly

Parameters:
bw -
priority -
Throws:
LinkCapacityExceededException

getBCs

public float[] getBCs()
Gets the BCs, should not be needed for most algorithms

Returns:
an array indexed with BC ids and corresponding float values

setBC

public void setBC(int ct,
                  float value)
           throws DiffServConfigurationException,
                  LinkCapacityExceededException
Set the BC to the given value.

Parameters:
ct - class type
value -
Throws:
DiffServConfigurationException - when the classType cannot be found in the domain.
LinkCapacityExceededException - If the new BC value do not leave enough bandwidth for the current established LSPs.

getRbw

public float[] getRbw()

setRbw

public void setRbw(float[] rbw)

addPriority

public void addPriority(int priority)
This function should be called after a priority is added to the domain. The new priority is added to the rbw array and the rbw array is refreshed (thanks to the BandwidthManagement). If the priority corresponds to a new class type, a correponding BC is added (with 0 bandwidth).
Warning: this method is not intended to be called directly.

Parameters:
priority - the priority that was added.

removePriority

public void removePriority(int priority)
This function should be called after a priority is removed from the domain. The priority is removed from the rbw array and the rbw array is refreshed (thanks to the BandwidthManagement).

Parameters:
priority -

equals

public boolean equals(java.lang.Object o)
Two links are equal if they belong to the same domain and have the same id.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setElementId

public void setElementId(java.lang.String id)
                  throws IdException
Description copied from interface: DomainElement
Sets the id of the element.

Specified by:
setElementId in interface DomainElement
Throws:
IdException


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.