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 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 FlowRule
build()
Builds a flow rule object.FlowRule.Builder
forDevice(DeviceId deviceId)
Sets the deviceId for this flow rule.FlowRule.Builder
forTable(int tableId)
Sets the table id for this flow rule, when the identifier is of typeTableId.Type.INDEX
.FlowRule.Builder
forTable(TableId tableId)
Sets the table identifier for this flow rule.FlowRule.Builder
fromApp(ApplicationId appId)
Assigns the application that built this flow rule to this object.FlowRule.Builder
makePermanent()
Makes this rule permanent on the dataplane.FlowRule.Builder
makeTemporary(int timeout)
Makes this rule temporary and timeout after the specified amount of time.FlowRule.Builder
withCookie(long cookie)
Assigns a cookie value to this flowrule.FlowRule.Builder
withHardTimeout(int timeout)
Sets hard timeout parameter in flow table.FlowRule.Builder
withPriority(int priority)
Sets the priority for this flow rule.FlowRule.Builder
withReason(FlowRule.FlowRemoveReason reason)
Sets reason parameter received from switches .FlowRule.Builder
withSelector(TrafficSelector selector)
Sets the selector (or match field) for this flow rule.FlowRule.Builder
withTreatment(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.Builder
Assigns 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:
withCookie
in interfaceFlowRule.Builder
- Parameters:
cookie
- a long value- Returns:
- this
-
fromApp
public FlowRule.Builder fromApp(ApplicationId appId)
Description copied from interface:FlowRule.Builder
Assigns 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:
fromApp
in interfaceFlowRule.Builder
- Parameters:
appId
- an application id- Returns:
- this
-
withPriority
public FlowRule.Builder withPriority(int priority)
Description copied from interface:FlowRule.Builder
Sets the priority for this flow rule.- Specified by:
withPriority
in interfaceFlowRule.Builder
- Parameters:
priority
- an integer- Returns:
- this
-
forDevice
public FlowRule.Builder forDevice(DeviceId deviceId)
Description copied from interface:FlowRule.Builder
Sets the deviceId for this flow rule.- Specified by:
forDevice
in interfaceFlowRule.Builder
- Parameters:
deviceId
- a device id- Returns:
- this
-
forTable
public FlowRule.Builder forTable(int tableId)
Description copied from interface:FlowRule.Builder
Sets 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:
forTable
in interfaceFlowRule.Builder
- Parameters:
tableId
- an integer- Returns:
- this
-
forTable
public FlowRule.Builder forTable(TableId tableId)
Description copied from interface:FlowRule.Builder
Sets the table identifier for this flow rule. Default identifier is of typeTableId.Type.INDEX
and value 0.- Specified by:
forTable
in interfaceFlowRule.Builder
- Parameters:
tableId
- table identifier- Returns:
- this
-
withSelector
public FlowRule.Builder withSelector(TrafficSelector selector)
Description copied from interface:FlowRule.Builder
Sets the selector (or match field) for this flow rule.- Specified by:
withSelector
in interfaceFlowRule.Builder
- Parameters:
selector
- a traffic selector- Returns:
- this
-
withTreatment
public FlowRule.Builder withTreatment(TrafficTreatment treatment)
Description copied from interface:FlowRule.Builder
Sets the traffic treatment for this flow rule.- Specified by:
withTreatment
in interfaceFlowRule.Builder
- Parameters:
treatment
- a traffic treatment- Returns:
- this
-
makePermanent
public FlowRule.Builder makePermanent()
Description copied from interface:FlowRule.Builder
Makes this rule permanent on the dataplane.- Specified by:
makePermanent
in interfaceFlowRule.Builder
- Returns:
- this
-
makeTemporary
public FlowRule.Builder makeTemporary(int timeout)
Description copied from interface:FlowRule.Builder
Makes this rule temporary and timeout after the specified amount of time.- Specified by:
makeTemporary
in interfaceFlowRule.Builder
- Parameters:
timeout
- an integer- Returns:
- this
-
withHardTimeout
public FlowRule.Builder withHardTimeout(int timeout)
Description copied from interface:FlowRule.Builder
Sets hard timeout parameter in flow table.- Specified by:
withHardTimeout
in interfaceFlowRule.Builder
- Parameters:
timeout
- an integer- Returns:
- this
-
withReason
public FlowRule.Builder withReason(FlowRule.FlowRemoveReason reason)
Description copied from interface:FlowRule.Builder
Sets reason parameter received from switches .- Specified by:
withReason
in interfaceFlowRule.Builder
- Parameters:
reason
- a short- Returns:
- this
-
build
public FlowRule build()
Description copied from interface:FlowRule.Builder
Builds a flow rule object.- Specified by:
build
in interfaceFlowRule.Builder
- Returns:
- a flow rule.
-
-