Class DeviceFlowTable


  • public class DeviceFlowTable
    extends java.lang.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 Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Void> add​(org.onosproject.net.flow.FlowEntry rule)
      Adds an entry to the table.
      void close()
      Closes the device flow table.
      int count()
      Counts the flows in the table.
      java.util.concurrent.CompletableFuture<java.lang.Iterable<org.onosproject.net.flow.FlowEntry>> getFlowEntries()
      Returns the set of flow entries in the table.
      org.onosproject.net.flow.StoredFlowEntry getFlowEntry​(org.onosproject.net.flow.FlowRule rule)
      Returns the flow entry for the given rule.
      void purge()
      Purges the flow table.
      java.util.concurrent.CompletableFuture<org.onosproject.net.flow.FlowEntry> remove​(org.onosproject.net.flow.FlowEntry rule)
      Removes an entry from the table.
      java.util.concurrent.CompletableFuture<java.lang.Void> update​(org.onosproject.net.flow.FlowEntry rule)
      Updates an entry in the table.
      <T> java.util.concurrent.CompletableFuture<T> update​(org.onosproject.net.flow.FlowRule rule, java.util.function.Function<org.onosproject.net.flow.StoredFlowEntry,​T> function)
      Applies the given update function to the rule.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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> java.util.concurrent.CompletableFuture<T> update​(org.onosproject.net.flow.FlowRule rule,
                                                                    java.util.function.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 java.util.concurrent.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.
      • close

        public void close()
        Closes the device flow table.