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>
/**
* Returns the list of Flow entries across network nodes which are part of
/**
* 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
*
* @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);
*/
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
/**
* Add a list of output port to the flow with the specified name on the
* specified network node
+ @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) {
@Override
public void addOutputPort(Node node, String flowName, List<NodeConnector> portList) {