Package org.onosproject.net.flow
Interface FlowRule.Builder
-
- All Known Implementing Classes:
DefaultFlowRule.Builder
- Enclosing interface:
- FlowRule
public static interface FlowRule.Builder
A flowrule builder.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default 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.default FlowRule.Builder
withIdleTimeout(int timeout)
Sets the idle 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.
-
-
-
Method Detail
-
withCookie
FlowRule.Builder withCookie(long cookie)
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.- Parameters:
cookie
- a long value- Returns:
- this
-
fromApp
FlowRule.Builder fromApp(ApplicationId appId)
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.- Parameters:
appId
- an application id- Returns:
- this
-
withPriority
FlowRule.Builder withPriority(int priority)
Sets the priority for this flow rule.- Parameters:
priority
- an integer- Returns:
- this
-
forDevice
FlowRule.Builder forDevice(DeviceId deviceId)
Sets the deviceId for this flow rule.- Parameters:
deviceId
- a device id- Returns:
- this
-
forTable
FlowRule.Builder forTable(int tableId)
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
forTable(TableId)
.- Parameters:
tableId
- an integer- Returns:
- this
-
forTable
FlowRule.Builder forTable(TableId tableId)
Sets the table identifier for this flow rule. Default identifier is of typeTableId.Type.INDEX
and value 0.- Parameters:
tableId
- table identifier- Returns:
- this
-
withSelector
FlowRule.Builder withSelector(TrafficSelector selector)
Sets the selector (or match field) for this flow rule.- Parameters:
selector
- a traffic selector- Returns:
- this
-
withTreatment
FlowRule.Builder withTreatment(TrafficTreatment treatment)
Sets the traffic treatment for this flow rule.- Parameters:
treatment
- a traffic treatment- Returns:
- this
-
makePermanent
FlowRule.Builder makePermanent()
Makes this rule permanent on the dataplane.- Returns:
- this
-
makeTemporary
FlowRule.Builder makeTemporary(int timeout)
Makes this rule temporary and timeout after the specified amount of time.- Parameters:
timeout
- an integer- Returns:
- this
-
withIdleTimeout
default FlowRule.Builder withIdleTimeout(int timeout)
Sets the idle timeout parameter in flow table. Will automatically make it permanent or temporary if the timeout is 0 or not, respectively.- Parameters:
timeout
- an integer- Returns:
- this
-
withHardTimeout
FlowRule.Builder withHardTimeout(int timeout)
Sets hard timeout parameter in flow table.- Parameters:
timeout
- an integer- Returns:
- this
-
withReason
FlowRule.Builder withReason(FlowRule.FlowRemoveReason reason)
Sets reason parameter received from switches .- Parameters:
reason
- a short- Returns:
- this
-
build
FlowRule build()
Builds a flow rule object.- Returns:
- a flow rule.
-
-