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, java.lang.Integer... tiers)
Creates a new constraint for requesting connectivity using or avoiding the specified link tiers.TierConstraint(boolean inclusive, TierConstraint.CostType costType, java.lang.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(java.lang.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.java.util.List<java.lang.Integer>
tiers()
Returns the set of link tiers.java.lang.String
toString()
-
Methods inherited from class org.onosproject.net.intent.constraint.BooleanConstraint
validate
-
-
-
-
Constructor Detail
-
TierConstraint
public TierConstraint(boolean inclusive, TierConstraint.CostType costType, java.lang.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, java.lang.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
-
tiers
public java.util.List<java.lang.Integer> tiers()
Returns the set of link tiers.- Returns:
- set of link tiers
-
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
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-