Class DeviceFlowTable


  • public class DeviceFlowTable
    extends Object
    Flow table for all flows associated with a specific device.

    Flows in the table are stored in buckets. Each bucket is mutated and replicated as a single unit. The device flow table performs communication independent of other device flow tables for more parallelism.

    This implementation uses several different replication protocols. Changes that occur on the device master are replicated to the backups provided in the DeviceReplicaInfo for the master's term. Additionally, a periodic anti-entropy protocol is used to detect missing flows on backups (e.g. due to a node restart). Finally, when a device mastership change occurs, the new master synchronizes flows with the prior master and/or backups for the device, allowing mastership to be reassigned to non-backup nodes.

    • Method Detail

      • count

        public int count()
        Counts the flows in the table.
        Returns:
        the total number of flows in the table
      • getFlowEntry

        public org.onosproject.net.flow.StoredFlowEntry getFlowEntry​(org.onosproject.net.flow.FlowRule rule)
        Returns the flow entry for the given rule.
        Parameters:
        rule - the rule for which to lookup the flow entry
        Returns:
        the flow entry for the given rule
      • getFlowEntries

        public CompletableFuture<Iterable<org.onosproject.net.flow.FlowEntry>> getFlowEntries()
        Returns the set of flow entries in the table.
        Returns:
        the set of flow entries in the table
      • add

        public CompletableFuture<Void> add​(org.onosproject.net.flow.FlowEntry rule)
        Adds an entry to the table.
        Parameters:
        rule - the rule to add
        Returns:
        a future to be completed once the rule has been added
      • update

        public CompletableFuture<Void> update​(org.onosproject.net.flow.FlowEntry rule)
        Updates an entry in the table.
        Parameters:
        rule - the rule to update
        Returns:
        a future to be completed once the rule has been updated
      • update

        public <T> CompletableFuture<T> update​(org.onosproject.net.flow.FlowRule rule,
                                               Function<org.onosproject.net.flow.StoredFlowEntry,​T> function)
        Applies the given update function to the rule.
        Type Parameters:
        T - the result type
        Parameters:
        rule - the rule to update
        function - the update function to apply
        Returns:
        a future to be completed with the update result or null if the rule was not updated
      • remove

        public CompletableFuture<org.onosproject.net.flow.FlowEntry> remove​(org.onosproject.net.flow.FlowEntry rule)
        Removes an entry from the table.
        Parameters:
        rule - the rule to remove
        Returns:
        a future to be completed once the rule has been removed
      • purge

        public void purge()
        Purges the flow table.
      • purge

        public CompletableFuture<Void> purge​(org.onosproject.core.ApplicationId appId)
        Purges the flows with the given application id.
        Parameters:
        appId - the application id
        Returns:
        a future to be completed once flow rules with given application id have been purged on all buckets
      • close

        public void close()
        Closes the device flow table.