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 class
TierConstraint.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 double
cost(Link link, ResourceContext context)
Evaluates the specified link and provides the cost for its traversal.TierConstraint.CostType
costType()
Return the cost model used by this constraint.boolean
equals(Object obj)
int
hashCode()
boolean
isInclusive()
Indicates if the constraint is inclusive or exclusive.boolean
isValid(Link link, ResourceContext context)
Returns true if the specified link satisfies the constraint.List<Integer>
tiers()
Returns the set of link tiers.String
toString()
-
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:BooleanConstraint
Returns true if the specified link satisfies the constraint.- Specified by:
isValid
in 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:BooleanConstraint
Evaluates the specified link and provides the cost for its traversal. Negative return value means the specified link does not satisfy this constraint.- Specified by:
cost
in interfaceConstraint
- Overrides:
cost
in 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
-
-