Proactive static flows have to be allowed in container mode 74/574/4
authorAlessandro Boch <aboch@cisco.com>
Mon, 8 Jul 2013 21:06:15 +0000 (14:06 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 10 Jul 2013 05:11:00 +0000 (05:11 +0000)
ISSUE: Once container are created, setting the forwarding mode to proactive for newly
       joined switches does not result in having the punt flows installed
CHANGE: - Have filtering check in install/uninstall/modify function allow internal
          generated flows when in container mode
        - Also removing uneeded dependecy on IfIptoHost in forwardingrulesmanager
        - Also fix some dependencies in sal activator regarding FlowProgrammer service

Change-Id: Id8a69abb2f3fa948195700a50c30fb368264adf9
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowConfig.java
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntry.java
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManager.java
opendaylight/forwardingrulesmanager/api/src/test/java/org/opendaylight/controller/forwardingrulesmanager/frmTest.java
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/Activator.java
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java
opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java
opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Activator.java
opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java

index 2b9696d..1ac7cb2 100644 (file)
@@ -71,9 +71,11 @@ import org.slf4j.LoggerFactory;
 public class FlowConfig implements Serializable {
     private static final long serialVersionUID = 1L;
     private static final Logger log = LoggerFactory.getLogger(FlowConfig.class);
-    public static final String staticFlowsGroup = "**StaticFlows";
-    public static final String internalStaticFlowsGroup = "**InternalStaticFlows";
-    public static final String internalStaticFlowBegin = "**";
+    private static final String NAMEREGEX = "^[a-zA-Z0-9]+$";
+    private static final String STATICFLOWGROUP = "__StaticFlows__";
+    public static final String INTERNALSTATICFLOWGROUP = "__InternalStaticFlows__";
+    public static final String INTERNALSTATICFLOWBEGIN = "__";
+    public static final String INTERNALSTATICFLOWEND = "__";
     private boolean dynamic;
     private String status;
 
@@ -200,8 +202,9 @@ public class FlowConfig implements Serializable {
     }
 
     public boolean isInternalFlow() {
-        // Controller generated static flows have name starting with "**"
-        return (this.name != null && this.name.startsWith(FlowConfig.internalStaticFlowBegin));
+        return (this.name != null &&
+                this.name.startsWith(FlowConfig.INTERNALSTATICFLOWBEGIN) &&
+                this.name.endsWith(FlowConfig.INTERNALSTATICFLOWEND));
     }
 
     public String getName() {
@@ -692,7 +695,7 @@ public class FlowConfig implements Serializable {
 
         Switch sw = null;
         try {
-            if (name == null || name.trim().isEmpty()) {
+            if (name == null || name.trim().isEmpty() || !name.matches(FlowConfig.NAMEREGEX)) {
                 return new Status(StatusCode.BADREQUEST, "Invalid name");
             }
 
@@ -965,7 +968,8 @@ public class FlowConfig implements Serializable {
     }
 
     public FlowEntry getFlowEntry() {
-        return new FlowEntry(FlowConfig.staticFlowsGroup, this.name, this.getFlow(), this.getNode());
+        String group = this.isInternalFlow() ? FlowConfig.INTERNALSTATICFLOWGROUP : FlowConfig.STATICFLOWGROUP;
+        return new FlowEntry(group, this.name, this.getFlow(), this.getNode());
     }
 
     public Flow getFlow() {
index e86e018..e8c5f64 100644 (file)
@@ -187,6 +187,7 @@ public class FlowEntry implements Cloneable, Serializable {
      * @return true if internal generated static flow, false otherwise
      */
     public boolean isInternal() {
-        return flowName.startsWith(FlowConfig.internalStaticFlowBegin);
+        return flowName.startsWith(FlowConfig.INTERNALSTATICFLOWBEGIN)
+                && flowName.endsWith(FlowConfig.INTERNALSTATICFLOWEND);
     }
 }
index bde6932..4b82574 100644 (file)
@@ -350,12 +350,9 @@ public interface IForwardingRulesManager {
      *
      * @param config
      *            the {@code FlowConfig} object representing the static flow
-     * @param restore
-     *            if set to true, the config object validation will be skipped.
-     *            Used only internally, always set it to false.
      * @return the {@code Status} object indicating the result of this action.
      */
-    public Status addStaticFlow(FlowConfig config, boolean restore);
+    public Status addStaticFlow(FlowConfig config);
 
     /**
      * Remove a flow specified by the {@code FlowConfig} object on the current
index f139f45..fc22ee7 100644 (file)
@@ -258,7 +258,10 @@ public class frmTest {
     public void testInternalFlow() {
         FlowConfig flowConfig = new FlowConfig();
         Assert.assertFalse(flowConfig.isInternalFlow());
-        flowConfig.setName("**Internal");
+        flowConfig.setName("__Internal__");
+        Status status = flowConfig.validate(null);
+        Assert.assertFalse(status.isSuccess());
+        Assert.assertTrue(status.getDescription().contains("name"));
         Assert.assertTrue(flowConfig.isInternalFlow());
         flowConfig.setName("External");
         Assert.assertFalse(flowConfig.isInternalFlow());
index f6fc001..5b2b3b3 100644 (file)
@@ -30,7 +30,6 @@ import org.slf4j.LoggerFactory;
 
 import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.hosttracker.IfIptoHost;
 
 public class Activator extends ComponentActivatorAbstractBase {
     protected static final Logger logger = LoggerFactory.getLogger(Activator.class);
@@ -104,15 +103,12 @@ public class Activator extends ComponentActivatorAbstractBase {
 
             c.add(createContainerServiceDependency(containerName).setService(IFlowProgrammerService.class)
                     .setCallbacks("setFlowProgrammerService", "unsetFlowProgrammerService").setRequired(true));
-
             c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
                     .setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true));
             c.add(createContainerServiceDependency(containerName).setService(ISwitchManager.class)
                     .setCallbacks("setSwitchManager", "unsetSwitchManager").setRequired(true));
             c.add(createContainerServiceDependency(containerName).setService(IForwardingRulesManagerAware.class)
                     .setCallbacks("setFrmAware", "unsetFrmAware").setRequired(false));
-            c.add(createContainerServiceDependency(containerName).setService(IfIptoHost.class)
-                    .setCallbacks("setHostFinder", "unsetHostFinder").setRequired(true));
             c.add(createContainerServiceDependency(containerName).setService(IContainer.class)
                     .setCallbacks("setIContainer", "unsetIContainer").setRequired(true));
         }
index 7fae181..7634b8b 100644 (file)
@@ -45,7 +45,6 @@ import org.opendaylight.controller.forwardingrulesmanager.PortGroup;
 import org.opendaylight.controller.forwardingrulesmanager.PortGroupChangeListener;
 import org.opendaylight.controller.forwardingrulesmanager.PortGroupConfig;
 import org.opendaylight.controller.forwardingrulesmanager.PortGroupProvider;
-import org.opendaylight.controller.hosttracker.IfIptoHost;
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.ActionType;
 import org.opendaylight.controller.sal.action.Controller;
@@ -129,9 +128,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
      * contain all the flow entries which were installed on the global container
      * when the first container is created.
      */
-    private List<FlowEntry> inactiveFlows;
+    private ConcurrentMap<FlowEntry, FlowEntry> inactiveFlows;
 
-    private IfIptoHost hostFinder;
     private IContainer container;
     private Set<IForwardingRulesManagerAware> frmAware;
     private PortGroupProvider portGroupProvider;
@@ -744,13 +742,13 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
     @Override
     public Status installFlowEntry(FlowEntry flowEntry) {
         Status status;
-        if (inContainerMode) {
+        if (isContainerModeAllowed(flowEntry)) {
+            status = addEntry(flowEntry, false);
+        } else {
             String msg = "Controller in container mode: Install Refused";
             String logMsg = msg + ": {}";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
             log.warn(logMsg, flowEntry);
-        } else {
-            status = addEntry(flowEntry, false);
         }
         return status;
     }
@@ -758,26 +756,26 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
     @Override
     public Status installFlowEntryAsync(FlowEntry flowEntry) {
         Status status;
-        if (inContainerMode) {
+        if (isContainerModeAllowed(flowEntry)) {
+            status = addEntry(flowEntry, true);
+        } else {
             String msg = "Controller in container mode: Install Refused";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
             log.warn(msg);
-        } else {
-            status = addEntry(flowEntry, true);
         }
         return status;
     }
 
     @Override
-    public Status uninstallFlowEntry(FlowEntry entry) {
+    public Status uninstallFlowEntry(FlowEntry flowEntry) {
         Status status;
-        if (inContainerMode) {
+        if (isContainerModeAllowed(flowEntry)) {
+            status = removeEntry(flowEntry, false);
+        } else {
             String msg = "Controller in container mode: Uninstall Refused";
             String logMsg = msg + ": {}";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
-            log.warn(logMsg, entry);
-        } else {
-            status = removeEntry(entry, false);
+            log.warn(logMsg, flowEntry);
         }
         return status;
     }
@@ -785,12 +783,12 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
     @Override
     public Status uninstallFlowEntryAsync(FlowEntry flowEntry) {
         Status status;
-        if (inContainerMode) {
+        if (isContainerModeAllowed(flowEntry)) {
+            status = removeEntry(flowEntry, true);
+        } else {
             String msg = "Controller in container mode: Uninstall Refused";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
             log.warn(msg);
-        } else {
-            status = removeEntry(flowEntry, true);
         }
         return status;
     }
@@ -798,30 +796,53 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
     @Override
     public Status modifyFlowEntry(FlowEntry currentFlowEntry, FlowEntry newFlowEntry) {
         Status status = null;
-        if (inContainerMode) {
+        if (isContainerModeAllowed(currentFlowEntry)) {
+            status = modifyEntry(currentFlowEntry, newFlowEntry, false);
+        } else {
             String msg = "Controller in container mode: Modify Refused";
             String logMsg = msg + ": {}";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
             log.warn(logMsg, newFlowEntry);
-        } else {
-            status = modifyEntry(currentFlowEntry, newFlowEntry, false);
         }
         return status;
     }
 
     @Override
-    public Status modifyFlowEntryAsync(FlowEntry current, FlowEntry newone) {
+    public Status modifyFlowEntryAsync(FlowEntry currentFlowEntry, FlowEntry newFlowEntry) {
         Status status = null;
-        if (inContainerMode) {
+        if (isContainerModeAllowed(currentFlowEntry)) {
+            status = modifyEntry(currentFlowEntry, newFlowEntry, true);
+        } else {
             String msg = "Controller in container mode: Modify Refused";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
             log.warn(msg);
-        } else {
-            status = modifyEntry(current, newone, true);
         }
         return status;
     }
 
+    /**
+     * Returns whether the specified flow entry is allowed to be
+     * installed/removed/modified based on the current container mode status.
+     * This call always returns true in the container instance of forwarding
+     * rules manager. It is meant for the global instance only (default
+     * container) of forwarding rules manager. Idea is that for assuring
+     * container isolation of traffic, flow installation in default container is
+     * blocked when in container mode (containers are present). The only flows
+     * that are allowed in container mode in the default container are the
+     * proactive flows, the ones automatically installed on the network node
+     * which forwarding mode has been configured to "proactive". These flows are
+     * needed by controller to discover the nodes topology and to discover the
+     * attached hosts for some SDN switches.
+     *
+     * @param flowEntry
+     *            The flow entry to be installed/removed/modified
+     * @return true if not in container mode or if flowEntry is internally
+     *         generated
+     */
+    private boolean isContainerModeAllowed(FlowEntry flowEntry) {
+        return (!inContainerMode) ? true : flowEntry.isInternal();
+    }
+
     @Override
     public Status modifyOrAddFlowEntry(FlowEntry newFlowEntry) {
         /*
@@ -867,8 +888,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
         if (groupName == null || groupName.isEmpty()) {
             return new Status(StatusCode.BADREQUEST, "Invalid group name");
         }
-        if (groupName.equals(FlowConfig.internalStaticFlowsGroup)) {
-            return new Status(StatusCode.BADREQUEST, "Static flows group cannot be deleted through this api");
+        if (groupName.equals(FlowConfig.INTERNALSTATICFLOWGROUP)) {
+            return new Status(StatusCode.BADREQUEST, "Internal static flows group cannot be deleted through this api");
         }
         if (inContainerMode) {
             String msg = "Controller in container mode: Group Uninstall Refused";
@@ -898,7 +919,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
         if (groupName == null || groupName.isEmpty()) {
             return new Status(StatusCode.BADREQUEST, "Invalid group name");
         }
-        if (groupName.equals(FlowConfig.internalStaticFlowsGroup)) {
+        if (groupName.equals(FlowConfig.INTERNALSTATICFLOWGROUP)) {
             return new Status(StatusCode.BADREQUEST, "Static flows group cannot be deleted through this api");
         }
         if (inContainerMode) {
@@ -947,7 +968,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
         }
     }
 
-    public void nonClusterObjectCreate() {
+    private void nonClusterObjectCreate() {
         originalSwView = new ConcurrentHashMap<FlowEntry, FlowEntry>();
         installedSwView = new ConcurrentHashMap<FlowEntryInstall, FlowEntryInstall>();
         nodeFlows = new ConcurrentHashMap<Node, List<FlowEntryInstall>>();
@@ -958,7 +979,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
         portGroupData = new ConcurrentHashMap<PortGroupConfig, Map<Node, PortGroup>>();
         staticFlows = new ConcurrentHashMap<Integer, FlowConfig>();
         flowsSaveEvent = new HashMap<Long, String>();
-        inactiveFlows = new ArrayList<FlowEntry>(1);
+        inactiveFlows = new ConcurrentHashMap<FlowEntry, FlowEntry>();
     }
 
     private void registerWithOSGIConsole() {
@@ -1145,6 +1166,9 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
             clusterContainerService.createCache("frm.installedSwView",
                     EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
 
+            clusterContainerService.createCache("frm.inactiveFlows",
+                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
+
             clusterContainerService.createCache("frm.nodeFlows",
                     EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
 
@@ -1182,6 +1206,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
 
         if (this.clusterContainerService == null) {
             log.warn("un-initialized clusterContainerService, can't retrieve cache");
+            nonClusterObjectCreate();
             return;
         }
 
@@ -1201,6 +1226,13 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
             log.error("Retrieval of frm.installedSwView cache failed for Container {}", container.getName());
         }
 
+        map = clusterContainerService.getCache("frm.inactiveFlows");
+        if (map != null) {
+            inactiveFlows = (ConcurrentMap<FlowEntry, FlowEntry>) map;
+        } else {
+            log.error("Retrieval of frm.inactiveFlows cache failed for Container {}", container.getName());
+        }
+
         map = clusterContainerService.getCache("frm.nodeFlows");
         if (map != null) {
             nodeFlows = (ConcurrentMap<Node, List<FlowEntryInstall>>) map;
@@ -1270,19 +1302,38 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
     }
 
     @Override
-    public Status addStaticFlow(FlowConfig config, boolean restore) {
-        boolean multipleFlowPush = false;
-        String error;
-        Status status;
-        config.setStatus(SUCCESS);
-
-        // Skip validation check if we are trying to restore a saved config
-        if (!restore && !(status = config.validate(container)).isSuccess()) {
+    public Status addStaticFlow(FlowConfig config) {
+        // Configuration object validation
+        Status status = config.validate(container);
+        if (!status.isSuccess()) {
             log.warn("Invalid Configuration for flow {}. The failure is {}", config, status.getDescription());
-            error = "Invalid Configuration (" + status.getDescription() + ")";
+            String error = "Invalid Configuration (" + status.getDescription() + ")";
             config.setStatus(error);
             return new Status(StatusCode.BADREQUEST, error);
         }
+        return addStaticFlowInternal(config, false);
+    }
+
+    /**
+     * Private method to add a static flow configuration which does not run any
+     * validation on the passed FlowConfig object. If restore is set to true,
+     * configuration is stored in configuration database regardless the
+     * installation on the network node was successful. This is useful at boot
+     * when static flows are present in startup configuration and are read
+     * before the switches connects.
+     *
+     * @param config
+     *            The static flow configuration
+     * @param restore
+     *            if true, the configuration is stored regardless the
+     *            installation on the network node was successful
+     * @return The status of this request
+     */
+    private Status addStaticFlowInternal(FlowConfig config, boolean restore) {
+        boolean multipleFlowPush = false;
+        String error;
+        Status status;
+        config.setStatus(SUCCESS);
 
         // Presence check
         if (flowConfigExists(config)) {
@@ -1639,12 +1690,12 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
             FlowEntryInstall flowEntries = mapEntry.getValue();
             // Skip internal generated static flows
             if (!flowEntries.isInternal()) {
-                inactiveFlows.add(flowEntries.getOriginal());
+                inactiveFlows.put(flowEntries.getOriginal(), null);
             }
         }
 
         // Now remove the entries
-        for (FlowEntry flowEntry : inactiveFlows) {
+        for (FlowEntry flowEntry : inactiveFlows.keySet()) {
             Status status = this.removeEntry(flowEntry, false);
             if (!status.isSuccess()) {
                 log.warn("Failed to remove entry: {}. The failure is: {}", flowEntry, status.getDescription());
@@ -1660,7 +1711,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
     private void reinstallAllFlowEntries() {
         log.info("Reinstalling all inactive flows");
 
-        for (FlowEntry flowEntry : this.inactiveFlows) {
+        for (FlowEntry flowEntry : this.inactiveFlows.keySet()) {
             this.addEntry(flowEntry, false);
         }
 
@@ -1756,7 +1807,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
         }
 
         for (FlowConfig conf : getStaticFlowsOrderedList(confList, maxKey)) {
-            addStaticFlow(conf, true);
+            addStaticFlowInternal(conf, true);
         }
     }
 
@@ -1816,13 +1867,13 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
 
         FlowConfig allowARP = new FlowConfig();
         allowARP.setInstallInHw(true);
-        allowARP.setName("**Punt ARP Reply");
+        allowARP.setName(FlowConfig.INTERNALSTATICFLOWBEGIN + "Punt ARP Reply" + FlowConfig.INTERNALSTATICFLOWEND);
         allowARP.setPriority("500");
         allowARP.setNode(node);
         allowARP.setEtherType("0x" + Integer.toHexString(EtherTypes.ARP.intValue()).toUpperCase());
         allowARP.setDstMac(HexEncode.bytesToHexString(switchManager.getControllerMAC()));
         allowARP.setActions(puntAction);
-        addStaticFlow(allowARP, false);
+        addStaticFlowInternal(allowARP, true); // skip validation on internal static flow name
     }
 
     @Override
@@ -1834,7 +1885,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
 
         FlowConfig allowARP = new FlowConfig();
         allowARP.setInstallInHw(true);
-        allowARP.setName("**Punt ARP");
+        allowARP.setName(FlowConfig.INTERNALSTATICFLOWBEGIN + "Punt ARP" + FlowConfig.INTERNALSTATICFLOWEND);
         allowARP.setPriority("1");
         allowARP.setNode(node);
         allowARP.setEtherType("0x" + Integer.toHexString(EtherTypes.ARP.intValue()).toUpperCase());
@@ -1843,7 +1894,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
 
         FlowConfig allowLLDP = new FlowConfig();
         allowLLDP.setInstallInHw(true);
-        allowLLDP.setName("**Punt LLDP");
+        allowLLDP.setName(FlowConfig.INTERNALSTATICFLOWBEGIN + "Punt LLDP" + FlowConfig.INTERNALSTATICFLOWEND);
         allowLLDP.setPriority("1");
         allowLLDP.setNode(node);
         allowLLDP.setEtherType("0x" + Integer.toHexString(EtherTypes.LLDP.intValue()).toUpperCase());
@@ -1855,21 +1906,21 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
 
         FlowConfig dropAllConfig = new FlowConfig();
         dropAllConfig.setInstallInHw(true);
-        dropAllConfig.setName("**Catch-All Drop");
+        dropAllConfig.setName(FlowConfig.INTERNALSTATICFLOWBEGIN + "Catch-All Drop" + FlowConfig.INTERNALSTATICFLOWEND);
         dropAllConfig.setPriority("0");
         dropAllConfig.setNode(node);
         dropAllConfig.setActions(dropAction);
         defaultConfigs.add(dropAllConfig);
 
+        log.info("Forwarding mode for node {} set to {}", node, (proactive ? "proactive" : "reactive"));
         for (FlowConfig fc : defaultConfigs) {
-            if (proactive) {
-                addStaticFlow(fc, false);
+            Status status = (proactive) ? addStaticFlowInternal(fc, true) : removeStaticFlow(fc);
+            if (status.isSuccess()) {
+                log.info("{} Proactive Static flow: {}", (proactive ? "Installed" : "Removed"), fc.getName());
             } else {
-                removeStaticFlow(fc);
+                log.warn("Failed to {} Proactive Static flow: {}", (proactive ? "install" : "remove"), fc.getName());
             }
         }
-
-        log.info("Set Switch {} Mode to {}", node, (proactive ? "proactive" : "reactive"));
     }
 
     /**
@@ -1915,7 +1966,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
             if ((staticFlow.getNode().equals(node)) && (staticFlow.getPortGroup().equals(config.getName()))) {
                 for (Short port : data.getPorts()) {
                     FlowConfig derivedFlow = getDerivedFlowConfig(staticFlow, config.getName(), port);
-                    addStaticFlow(derivedFlow, false);
+                    addStaticFlowInternal(derivedFlow, false);
                 }
             }
         }
@@ -2053,16 +2104,6 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
         }
     }
 
-    public void setHostFinder(IfIptoHost hostFinder) {
-        this.hostFinder = hostFinder;
-    }
-
-    public void unsetHostFinder(IfIptoHost hostFinder) {
-        if (this.hostFinder == hostFinder) {
-            this.hostFinder = null;
-        }
-    }
-
     public void setFrmAware(IForwardingRulesManagerAware obj) {
         this.frmAware.add(obj);
     }
@@ -2106,8 +2147,6 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
             portGroupProvider.registerPortGroupChange(this);
         }
 
-        nonClusterObjectCreate();
-
         cacheStartup();
 
         registerWithOSGIConsole();
@@ -2228,8 +2267,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
     }
 
     @Override
-    public void containerFlowUpdated(String containerName, ContainerFlow previous, ContainerFlow current,
-            UpdateType t) {
+    public void containerFlowUpdated(String containerName, ContainerFlow previous, ContainerFlow current, UpdateType t) {
         if (!container.getName().equals(containerName)) {
             return;
         }
@@ -2501,7 +2539,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, Port
         log.trace("Received flow removed notification on {} for {}", node, flow);
 
         // For flow entry identification, only node, match and priority matter
-        FlowEntryInstall test = new FlowEntryInstall(new FlowEntry("","",flow, node), null);
+        FlowEntryInstall test = new FlowEntryInstall(new FlowEntry("", "", flow, node), null);
         FlowEntryInstall installedEntry = this.installedSwView.get(test);
         if (installedEntry == null) {
             log.trace("Entry is not known to us");
index b419a9b..d3cbc4a 100644 (file)
@@ -321,7 +321,7 @@ public class FlowProgrammerNorthbound {
                     + RestMessages.RESOURCECONFLICT.toString());
         }
 
-        Status status = frm.addStaticFlow(flowConfig.getValue(), false);
+        Status status = frm.addStaticFlow(flowConfig.getValue());
         if (status.isSuccess()) {
             return Response.status(Response.Status.CREATED).build();
         }
index 1a9675a..b56a96e 100644 (file)
@@ -138,7 +138,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginInFlowProgrammerService.class)
                     .setCallbacks("setService", "unsetService")
                     .setRequired(false));
-            c.add(createServiceDependency()
+            c.add(createContainerServiceDependency(containerName)
                     .setService(IFlowProgrammerListener.class)
                     .setCallbacks("setListener", "unsetListener")
                     .setRequired(false));
index be75609..145ef90 100644 (file)
@@ -241,7 +241,7 @@ public class Flows implements IDaylightWeb {
         flow.setNode(node);
         Status result = new Status(StatusCode.BADREQUEST, "Invalid request");
         if (action.equals("add")) {
-            result = frm.addStaticFlow(flow, false);
+            result = frm.addStaticFlow(flow);
         }
 
         return (result.isSuccess()) ? StatusCode.SUCCESS.toString() : result