Package org.onosproject.net.flow
Class DefaultFlowRule.Builder
- java.lang.Object
-
- org.onosproject.net.flow.DefaultFlowRule.Builder
-
- All Implemented Interfaces:
FlowRule.Builder
- Enclosing class:
- DefaultFlowRule
public static final class DefaultFlowRule.Builder extends java.lang.Object implements FlowRule.Builder
Default flow rule builder.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FlowRulebuild()Builds a flow rule object.FlowRule.BuilderforDevice(DeviceId deviceId)Sets the deviceId for this flow rule.FlowRule.BuilderforTable(int tableId)Sets the table id for this flow rule, when the identifier is of typeTableId.Type.INDEX.FlowRule.BuilderforTable(TableId tableId)Sets the table identifier for this flow rule.FlowRule.BuilderfromApp(ApplicationId appId)Assigns the application that built this flow rule to this object.FlowRule.BuildermakePermanent()Makes this rule permanent on the dataplane.FlowRule.BuildermakeTemporary(int timeout)Makes this rule temporary and timeout after the specified amount of time.FlowRule.BuilderwithCookie(long cookie)Assigns a cookie value to this flowrule.FlowRule.BuilderwithHardTimeout(int timeout)Sets hard timeout parameter in flow table.FlowRule.BuilderwithPriority(int priority)Sets the priority for this flow rule.FlowRule.BuilderwithReason(FlowRule.FlowRemoveReason reason)Sets reason parameter received from switches .FlowRule.BuilderwithSelector(TrafficSelector selector)Sets the selector (or match field) for this flow rule.FlowRule.BuilderwithTreatment(TrafficTreatment treatment)Sets the traffic treatment for this flow rule.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.onosproject.net.flow.FlowRule.Builder
withIdleTimeout
-
-
-
-
Method Detail
-
withCookie
public FlowRule.Builder withCookie(long cookie)
Description copied from interface:FlowRule.BuilderAssigns a cookie value to this flowrule. Mutually exclusive with the fromApp method. This method is intended to take a cookie value from the dataplane and not from the application.- Specified by:
withCookiein interfaceFlowRule.Builder- Parameters:
cookie- a long value- Returns:
- this
-
fromApp
public FlowRule.Builder fromApp(ApplicationId appId)
Description copied from interface:FlowRule.BuilderAssigns the application that built this flow rule to this object. The short value of the appId will be used as a basis for the cookie value computation. It is expected that application use this call to set their application id.- Specified by:
fromAppin interfaceFlowRule.Builder- Parameters:
appId- an application id- Returns:
- this
-
withPriority
public FlowRule.Builder withPriority(int priority)
Description copied from interface:FlowRule.BuilderSets the priority for this flow rule.- Specified by:
withPriorityin interfaceFlowRule.Builder- Parameters:
priority- an integer- Returns:
- this
-
forDevice
public FlowRule.Builder forDevice(DeviceId deviceId)
Description copied from interface:FlowRule.BuilderSets the deviceId for this flow rule.- Specified by:
forDevicein interfaceFlowRule.Builder- Parameters:
deviceId- a device id- Returns:
- this
-
forTable
public FlowRule.Builder forTable(int tableId)
Description copied from interface:FlowRule.BuilderSets the table id for this flow rule, when the identifier is of typeTableId.Type.INDEX. Default value is 0.Important: This method is left here for backward compatibility with applications that specifies table identifiers using integers, e.g. as in OpenFlow. Currently there is no plan to deprecate this method, however, new applications should favor using
FlowRule.Builder.forTable(TableId).- Specified by:
forTablein interfaceFlowRule.Builder- Parameters:
tableId- an integer- Returns:
- this
-
forTable
public FlowRule.Builder forTable(TableId tableId)
Description copied from interface:FlowRule.BuilderSets the table identifier for this flow rule. Default identifier is of typeTableId.Type.INDEXand value 0.- Specified by:
forTablein interfaceFlowRule.Builder- Parameters:
tableId- table identifier- Returns:
- this
-
withSelector
public FlowRule.Builder withSelector(TrafficSelector selector)
Description copied from interface:FlowRule.BuilderSets the selector (or match field) for this flow rule.- Specified by:
withSelectorin interfaceFlowRule.Builder- Parameters:
selector- a traffic selector- Returns:
- this
-
withTreatment
public FlowRule.Builder withTreatment(TrafficTreatment treatment)
Description copied from interface:FlowRule.BuilderSets the traffic treatment for this flow rule.- Specified by:
withTreatmentin interfaceFlowRule.Builder- Parameters:
treatment- a traffic treatment- Returns:
- this
-
makePermanent
public FlowRule.Builder makePermanent()
Description copied from interface:FlowRule.BuilderMakes this rule permanent on the dataplane.- Specified by:
makePermanentin interfaceFlowRule.Builder- Returns:
- this
-
makeTemporary
public FlowRule.Builder makeTemporary(int timeout)
Description copied from interface:FlowRule.BuilderMakes this rule temporary and timeout after the specified amount of time.- Specified by:
makeTemporaryin interfaceFlowRule.Builder- Parameters:
timeout- an integer- Returns:
- this
-
withHardTimeout
public FlowRule.Builder withHardTimeout(int timeout)
Description copied from interface:FlowRule.BuilderSets hard timeout parameter in flow table.- Specified by:
withHardTimeoutin interfaceFlowRule.Builder- Parameters:
timeout- an integer- Returns:
- this
-
withReason
public FlowRule.Builder withReason(FlowRule.FlowRemoveReason reason)
Description copied from interface:FlowRule.BuilderSets reason parameter received from switches .- Specified by:
withReasonin interfaceFlowRule.Builder- Parameters:
reason- a short- Returns:
- this
-
build
public FlowRule build()
Description copied from interface:FlowRule.BuilderBuilds a flow rule object.- Specified by:
buildin interfaceFlowRule.Builder- Returns:
- a flow rule.
-
-