FRM to expose list of installed flow entries per group 09/909/1
authorAlessandro Boch <aboch@cisco.com>
Mon, 19 Aug 2013 16:12:53 +0000 (09:12 -0700)
committerAlessandro Boch <aboch@cisco.com>
Mon, 19 Aug 2013 16:13:35 +0000 (09:13 -0700)
    ISSUE:
    Given a group/policy name, ForwardingRulesManager only provides a function to return the list of Flow Entry it was requested to install.
    In presence of container flows, this list does not represent the actual entries which were installed on the network nodes for that group.
    CHANGE:
    Add getInstalledFlowEntriesForGroup(String policyName) to IForwardingRulesManager.

Change-Id: Ie26d64c05d5eb49b3073d34d701ea1fa5b05adfa
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManager.java
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java

index 4b8257488ef08c072785a5cef76f56c550ba882a..9f0005e7fb5b2aa3a7dea5cbfa62fdf11be94dab 100644 (file)
@@ -199,14 +199,29 @@ public interface IForwardingRulesManager {
 
     /**
      * Returns the list of Flow entries across network nodes which are part of
-     * the same flow group, policy
+     * the same flow group, policy. This list contains the flows as they were
+     * requested to be installed by the applications, before any merging with
+     * container flow is done.
      *
      * @param group
      *            the group name
-     * @return the list of flow entries belonging to the specified group
+     * @return the original list of flow entries belonging to the specified group
      */
     public List<FlowEntry> getFlowEntriesForGroup(String group);
 
+    /**
+     * Returns the list of Flow entries installed in network nodes which are part of
+     * the same flow group, policy. This list contains the effective flows installed
+     * on the nodes after the merging with any possible container flow was performed.
+     * If no container flow are specified, this method returns the same list returned
+     * by getFlowEntriesForGroup(String group).
+     *
+     * @param group
+     *            the group name
+     * @return the list of container flow merged flow entries belonging to the specified group
+     */
+    public List<FlowEntry> getInstalledFlowEntriesForGroup(String policyName);
+
     /**
      * Add a list of output port to the flow with the specified name on the
      * specified network node
index e7a8a8e22cf9b2c4826d33bcd2450253f7d59794..57f3e8eb3605195f516aec818ee6c4200fec9186 100644 (file)
@@ -1034,6 +1034,19 @@ public class ForwardingRulesManager implements IForwardingRulesManager, PortGrou
         return list;
     }
 
+    @Override
+    public List<FlowEntry> getInstalledFlowEntriesForGroup(String policyName) {
+        List<FlowEntry> list = new ArrayList<FlowEntry>();
+        if (policyName != null && !policyName.trim().isEmpty()) {
+            for (Map.Entry<FlowEntryInstall, FlowEntryInstall> entry : this.installedSwView.entrySet()) {
+                if (policyName.equals(entry.getKey().getGroupName())) {
+                    list.add(entry.getKey().getInstall().clone());
+                }
+            }
+        }
+        return list;
+    }
+
     @Override
     public void addOutputPort(Node node, String flowName, List<NodeConnector> portList) {