Package org.onosproject.net.flow
Class DefaultFlowRule
- java.lang.Object
-
- org.onosproject.net.flow.DefaultFlowRule
-
- All Implemented Interfaces:
FlowRule
,PiTranslatable
- Direct Known Subclasses:
DefaultFlowEntry
public class DefaultFlowRule extends Object implements FlowRule
Default flow rule.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultFlowRule.Builder
Default flow rule builder.-
Nested classes/interfaces inherited from interface org.onosproject.net.flow.FlowRule
FlowRule.FlowRemoveReason
-
-
Field Summary
-
Fields inherited from interface org.onosproject.net.flow.FlowRule
DEFAULT_TABLE, MAX_PRIORITY, MAX_TIMEOUT, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description DefaultFlowRule(FlowRule rule)
Creates a new flow rule from an existing rule.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description short
appId()
Returns the application id of this flow.static DefaultFlowRule.Builder
builder()
Returns a default flow rule builder.long
created()
Returns the wallclock time that the flow was created.DeviceId
deviceId()
Returns the identity of the device where this rule applies.boolean
equals(Object obj)
Equality for flow rules only considers 'match equality'.boolean
exactMatch(FlowRule rule)
Returns whether this flow rule is an exact match to the flow rule given in the argument.GroupId
groupId()
Returns the group id of this flow.int
hardTimeout()
Returns the hard timeout for this flow requested by an application.int
hashCode()
FlowId
id()
Returns the ID of this flow.boolean
isPermanent()
Returns whether the flow is permanent i.e.int
priority()
Returns the flow rule priority given in natural order; higher numbers mean higher priorities.FlowRule.FlowRemoveReason
reason()
Returns the reason for the flow received from switches.TrafficSelector
selector()
Returns the traffic selector that identifies what traffic this rule should apply to.TableId
table()
Returns the table identifier for this rule.int
tableId()
Returns the table id for this rule.int
timeout()
Returns the timeout for this flow requested by an application.String
toString()
TrafficTreatment
treatment()
Returns the traffic treatment that applies to selected traffic.
-
-
-
Constructor Detail
-
DefaultFlowRule
public DefaultFlowRule(FlowRule rule)
Creates a new flow rule from an existing rule.- Parameters:
rule
- new flow rule
-
-
Method Detail
-
appId
public short appId()
Description copied from interface:FlowRule
Returns the application id of this flow.
-
groupId
public GroupId groupId()
Description copied from interface:FlowRule
Returns the group id of this flow.
-
priority
public int priority()
Description copied from interface:FlowRule
Returns the flow rule priority given in natural order; higher numbers mean higher priorities.
-
deviceId
public DeviceId deviceId()
Description copied from interface:FlowRule
Returns the identity of the device where this rule applies.
-
selector
public TrafficSelector selector()
Description copied from interface:FlowRule
Returns the traffic selector that identifies what traffic this rule should apply to.
-
treatment
public TrafficTreatment treatment()
Description copied from interface:FlowRule
Returns the traffic treatment that applies to selected traffic.
-
equals
public boolean equals(Object obj)
Description copied from interface:FlowRule
Equality for flow rules only considers 'match equality'. This means that two flow rules with the same match conditions will be equal, regardless of the treatment or other characteristics of the flow.
-
exactMatch
public boolean exactMatch(FlowRule rule)
Description copied from interface:FlowRule
Returns whether this flow rule is an exact match to the flow rule given in the argument.Exact match means that deviceId, priority, selector, tableId, flowId and treatment are equal. Note that this differs from the notion of object equality for flow rules, which does not consider the flowId or treatment when testing equality.
- Specified by:
exactMatch
in interfaceFlowRule
- Parameters:
rule
- other rule to match against- Returns:
- true if the rules are an exact match, otherwise false
-
timeout
public int timeout()
Description copied from interface:FlowRule
Returns the timeout for this flow requested by an application.
-
hardTimeout
public int hardTimeout()
Description copied from interface:FlowRule
Returns the hard timeout for this flow requested by an application. This parameter configure switch's flow hard timeout. In case of controller-switch connection lost, this variable can be useful.- Specified by:
hardTimeout
in interfaceFlowRule
- Returns:
- integer value of the hard Timeout
-
reason
public FlowRule.FlowRemoveReason reason()
Description copied from interface:FlowRule
Returns the reason for the flow received from switches.
-
isPermanent
public boolean isPermanent()
Description copied from interface:FlowRule
Returns whether the flow is permanent i.e. does not time out.- Specified by:
isPermanent
in interfaceFlowRule
- Returns:
- true if the flow is permanent, otherwise false
-
tableId
public int tableId()
Description copied from interface:FlowRule
Returns the table id for this rule.
-
table
public TableId table()
Description copied from interface:FlowRule
Returns the table identifier for this rule.
-
created
public long created()
Returns the wallclock time that the flow was created.- Returns:
- creation time in milliseconds since epoch
-
builder
public static DefaultFlowRule.Builder builder()
Returns a default flow rule builder.- Returns:
- builder
-
-