Package org.onosproject.net.flow
Interface FlowRuleService
-
- All Superinterfaces:
ListenerService<FlowRuleEvent,FlowRuleListener>
public interface FlowRuleService extends ListenerService<FlowRuleEvent,FlowRuleListener>
Service for injecting flow rules into the environment and for obtaining information about flow rules already in the environment. This implements semantics of a distributed authoritative flow table where the master copy of the flow rules lies with the controller and the devices hold only the 'cached' copy.
-
-
Field Summary
Fields Modifier and Type Field Description static String
FLOW_OP_TOPIC
The topic used for obtaining globally unique ids.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
apply(FlowRuleOperations ops)
Applies a batch operation of FlowRules.void
applyFlowRules(FlowRule... flowRules)
Applies the specified flow rules onto their respective devices.default long
getActiveFlowRuleCount(DeviceId deviceId)
Deprecated.since 2.1Iterable<FlowEntry>
getFlowEntries(DeviceId deviceId)
Returns the collection of flow entries applied on the specified device.Iterable<FlowEntry>
getFlowEntriesById(ApplicationId id)
Returns a list of rules with this application ID.default Iterable<FlowEntry>
getFlowEntriesByLiveType(DeviceId deviceId, FlowEntry.FlowLiveType liveType)
Returns a list of rules filtered by device id and flow live type.default Iterable<FlowEntry>
getFlowEntriesByState(DeviceId deviceId, FlowEntry.FlowEntryState flowState)
Returns a list of rules filtered by device id and flow state.int
getFlowRuleCount()
Returns the number of flow rules in the system.default int
getFlowRuleCount(DeviceId deviceId)
Returns the number of flow rules for the given device.default int
getFlowRuleCount(DeviceId deviceId, FlowEntry.FlowEntryState state)
Returns the number of flow rules in the given state for the given device.Iterable<FlowRule>
getFlowRulesByGroupId(ApplicationId appId, short groupId)
Returns a list of rules filtered by application and group id.Iterable<TableStatisticsEntry>
getFlowTableStatistics(DeviceId deviceId)
Returns the collection of flow table statistics of the specified device.void
purgeFlowRules(DeviceId deviceId)
Purges all the flow rules on the specified device.default void
purgeFlowRules(DeviceId deviceId, ApplicationId appId)
Purges all the flow rules on the specified device from the given application id.void
removeFlowRules(FlowRule... flowRules)
Removes the specified flow rules from their respective devices.void
removeFlowRulesById(ApplicationId appId)
Removes all rules submitted by a particular application.-
Methods inherited from interface org.onosproject.event.ListenerService
addListener, removeListener
-
-
-
-
Field Detail
-
FLOW_OP_TOPIC
static final String FLOW_OP_TOPIC
The topic used for obtaining globally unique ids.- See Also:
- Constant Field Values
-
-
Method Detail
-
getFlowRuleCount
int getFlowRuleCount()
Returns the number of flow rules in the system.- Returns:
- flow rule count
-
getFlowRuleCount
default int getFlowRuleCount(DeviceId deviceId)
Returns the number of flow rules for the given device.- Parameters:
deviceId
- device identifier- Returns:
- number of flow rules for the given device
-
getFlowRuleCount
default int getFlowRuleCount(DeviceId deviceId, FlowEntry.FlowEntryState state)
Returns the number of flow rules in the given state for the given device.- Parameters:
deviceId
- the device identifierstate
- the state for which to count flow rules- Returns:
- number of flow rules in the given state for the given device
-
getFlowEntries
Iterable<FlowEntry> getFlowEntries(DeviceId deviceId)
Returns the collection of flow entries applied on the specified device. This will include flow rules which may not yet have been applied to the device.- Parameters:
deviceId
- device identifier- Returns:
- collection of flow rules
-
getFlowEntriesByLiveType
default Iterable<FlowEntry> getFlowEntriesByLiveType(DeviceId deviceId, FlowEntry.FlowLiveType liveType)
Returns a list of rules filtered by device id and flow live type.- Parameters:
deviceId
- the device id to lookupliveType
- the flow live type to lookup- Returns:
- collection of flow entries
-
getFlowEntriesByState
default Iterable<FlowEntry> getFlowEntriesByState(DeviceId deviceId, FlowEntry.FlowEntryState flowState)
Returns a list of rules filtered by device id and flow state.- Parameters:
deviceId
- the device id to lookupflowState
- the flow state to lookup- Returns:
- collection of flow entries
-
applyFlowRules
void applyFlowRules(FlowRule... flowRules)
Applies the specified flow rules onto their respective devices. These flow rules will be retained by the system and re-applied anytime the device reconnects to the controller.- Parameters:
flowRules
- one or more flow rules
-
purgeFlowRules
void purgeFlowRules(DeviceId deviceId)
Purges all the flow rules on the specified device.- Parameters:
deviceId
- device identifier
-
purgeFlowRules
default void purgeFlowRules(DeviceId deviceId, ApplicationId appId)
Purges all the flow rules on the specified device from the given application id.- Parameters:
deviceId
- device identifierappId
- application identifier
-
removeFlowRules
void removeFlowRules(FlowRule... flowRules)
Removes the specified flow rules from their respective devices. If the device is not presently connected to the controller, these flow will be removed once the device reconnects.- Parameters:
flowRules
- one or more flow rules
-
removeFlowRulesById
void removeFlowRulesById(ApplicationId appId)
Removes all rules submitted by a particular application.- Parameters:
appId
- ID of application whose flows will be removed
-
getFlowEntriesById
Iterable<FlowEntry> getFlowEntriesById(ApplicationId id)
Returns a list of rules with this application ID.- Parameters:
id
- the application ID to look up- Returns:
- collection of flow rules
-
getFlowRulesByGroupId
Iterable<FlowRule> getFlowRulesByGroupId(ApplicationId appId, short groupId)
Returns a list of rules filtered by application and group id.Note that the group concept here is simply a logical grouping of flows. This is not the same as a group in the
GroupService
, and this method will not return flows that are mapped to a particularGroup
.- Parameters:
appId
- the application ID to look upgroupId
- the group ID to look up- Returns:
- collection of flow rules
-
apply
void apply(FlowRuleOperations ops)
Applies a batch operation of FlowRules.- Parameters:
ops
- batch operation to apply
-
getFlowTableStatistics
Iterable<TableStatisticsEntry> getFlowTableStatistics(DeviceId deviceId)
Returns the collection of flow table statistics of the specified device.- Parameters:
deviceId
- device identifier- Returns:
- collection of flow table statistics
-
getActiveFlowRuleCount
@Deprecated default long getActiveFlowRuleCount(DeviceId deviceId)
Deprecated.since 2.1Returns number of flow rules in ADDED state for specified device.- Parameters:
deviceId
- device identifier- Returns:
- number of flow rules in ADDED state
-
-