Class TierConstraint
- java.lang.Object
-
- org.onosproject.net.intent.constraint.BooleanConstraint
-
- org.onosproject.net.intent.constraint.TierConstraint
-
- All Implemented Interfaces:
Constraint
@Beta public class TierConstraint extends BooleanConstraint
Constraint that evaluates links based on their type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTierConstraint.CostType
-
Constructor Summary
Constructors Constructor Description TierConstraint(boolean inclusive, Integer... tiers)Creates a new constraint for requesting connectivity using or avoiding the specified link tiers.TierConstraint(boolean inclusive, TierConstraint.CostType costType, Integer... tiers)Creates a new constraint for requesting connectivity using or avoiding the specified link tiers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecost(Link link, ResourceContext context)Evaluates the specified link and provides the cost for its traversal.TierConstraint.CostTypecostType()Return the cost model used by this constraint.booleanequals(Object obj)inthashCode()booleanisInclusive()Indicates if the constraint is inclusive or exclusive.booleanisValid(Link link, ResourceContext context)Returns true if the specified link satisfies the constraint.List<Integer>tiers()Returns the set of link tiers.StringtoString()-
Methods inherited from class org.onosproject.net.intent.constraint.BooleanConstraint
validate
-
-
-
-
Constructor Detail
-
TierConstraint
public TierConstraint(boolean inclusive, TierConstraint.CostType costType, Integer... tiers)Creates a new constraint for requesting connectivity using or avoiding the specified link tiers.- Parameters:
inclusive- indicates whether the given link tiers are to be permitted or avoidedcostType- defines the model used to calculate the link cost.tiers- link tiers
-
TierConstraint
public TierConstraint(boolean inclusive, Integer... tiers)Creates a new constraint for requesting connectivity using or avoiding the specified link tiers. The VALID cost type is used by default.- Parameters:
inclusive- indicates whether the given link tiers are to be permitted or avoidedtiers- link tiers
-
-
Method Detail
-
isValid
public boolean isValid(Link link, ResourceContext context)
Description copied from class:BooleanConstraintReturns true if the specified link satisfies the constraint.- Specified by:
isValidin classBooleanConstraint- Parameters:
link- link to be validatedcontext- resource context for checking available resources- Returns:
- true if link is viable
-
cost
public double cost(Link link, ResourceContext context)
Description copied from class:BooleanConstraintEvaluates the specified link and provides the cost for its traversal. Negative return value means the specified link does not satisfy this constraint.- Specified by:
costin interfaceConstraint- Overrides:
costin classBooleanConstraint- Parameters:
link- link to be evaluatedcontext- resource context for validating availability of resources- Returns:
- cost of link traversal
-
isInclusive
public boolean isInclusive()
Indicates if the constraint is inclusive or exclusive.- Returns:
- true if inclusive
-
costType
public TierConstraint.CostType costType()
Return the cost model used by this constraint.- Returns:
- true if inclusive
-
-