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 Detail

      • FLOW_OP_TOPIC

        static final java.lang.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 identifier
        state - the state for which to count flow rules
        Returns:
        number of flow rules in the given state for the given device
      • getFlowEntries

        java.lang.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 java.lang.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 lookup
        liveType - the flow live type to lookup
        Returns:
        collection of flow entries
      • getFlowEntriesByState

        default java.lang.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 lookup
        flowState - 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
      • 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

        java.lang.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

        java.lang.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 particular Group.

        Parameters:
        appId - the application ID to look up
        groupId - 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

        java.lang.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.1
        Returns number of flow rules in ADDED state for specified device.
        Parameters:
        deviceId - device identifier
        Returns:
        number of flow rules in ADDED state