Fixing ForwardingRulesManager code that 32/232/1
authorKalvin Hom <kahom@cisco.com>
Tue, 23 Apr 2013 23:20:33 +0000 (16:20 -0700)
committerKalvin Hom <kahom@cisco.com>
Tue, 23 Apr 2013 23:26:17 +0000 (16:26 -0700)
got lost in a previous merge

Change-Id: I3e3ba4e69e3082b6980a42101d54c3af834a99cb
Signed-off-by: Kalvin Hom <kahom@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/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/Activator.java
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java

index b11b5f3dbc29c1e9ecf9674ae3dc7845ac3e4adf..f3429e62b181f155897ac7dc9034e355ac7d5d1f 100644 (file)
@@ -607,14 +607,15 @@ public class FlowConfig implements Serializable {
                         }
                     }
 
-                    log.debug("Get Nexthop address = " + address + " Type = "
-                            setNHType.toString());
+                    log.debug("Get Nexthop address = {} Type = {}", address,
+                            setNHType.toString());
                     if (setNHType == SetNextHopType.RESOLVE_L2RW) {
                         try {
                             return InetAddress.getByName(address);
                         } catch (Exception e) {
-                            log.debug("Exception during nextHopAddress resolution : "
-                                    + e.getMessage());
+                            log.debug(
+                                    "Exception during nextHopAddress resolution : ",
+                                    e);
                         }
                     }
                 }
index 091ebb0d3ad8f7b87a0219f444905627797ae116..2e174d25e29930e43431d72052c8060ddc5b9939 100644 (file)
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
  */
 public class FlowEntry implements Cloneable, Serializable {
     protected static final Logger logger = LoggerFactory
-    .getLogger(FlowEntry.class);
+            .getLogger(FlowEntry.class);
     private static final long serialVersionUID = 1L;
     private static final Logger log = LoggerFactory.getLogger(FlowEntry.class);
     private String groupName; // group name
@@ -83,7 +83,7 @@ public class FlowEntry implements Cloneable, Serializable {
             cloned = (FlowEntry) super.clone();
             cloned.flow = this.flow.clone();
         } catch (CloneNotSupportedException e) {
-           log.warn("exception in clone", e);
+            log.warn("exception in clone", e);
         }
         return cloned;
     }
index 70ae1f1fd76cc246d788981097e62c0e14fa901b..d0a370276fa9d17995802e65c29193b911e266dc 100644 (file)
@@ -100,7 +100,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                         IInventoryListener.class.getName(),
                         ICacheUpdateAware.class.getName(),
                         IConfigurationContainerAware.class.getName(),
-                        IFlowProgrammerListener.class.getName()};
+                        IFlowProgrammerListener.class.getName() };
             } else {
                 interfaces = new String[] {
                         ISwitchManagerAware.class.getName(),
@@ -108,7 +108,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                         IInventoryListener.class.getName(),
                         ICacheUpdateAware.class.getName(),
                         IConfigurationContainerAware.class.getName(),
-                        IFlowProgrammerListener.class.getName()};
+                        IFlowProgrammerListener.class.getName() };
             }
 
             c.setInterface(interfaces, props);
index 8e80f83d80fbcee10dfd5aa02dbab5634f0200a1..b82ab6f9a850b43d0c41b6313538d96268b86e6e 100644 (file)
@@ -59,10 +59,10 @@ import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.core.Property;
 import org.opendaylight.controller.sal.core.UpdateType;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
+import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerListener;
 import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
 import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchType;
-import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.controller.sal.utils.EtherTypes;
 import org.opendaylight.controller.sal.utils.GlobalConstants;
 import org.opendaylight.controller.sal.utils.HexEncode;
@@ -73,6 +73,7 @@ import org.opendaylight.controller.sal.utils.NodeCreator;
 import org.opendaylight.controller.sal.utils.ObjectReader;
 import org.opendaylight.controller.sal.utils.ObjectWriter;
 import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.controller.switchmanager.IInventoryListener;
 import org.opendaylight.controller.switchmanager.ISwitchManager;
 import org.opendaylight.controller.switchmanager.ISwitchManagerAware;
@@ -90,7 +91,8 @@ import org.slf4j.LoggerFactory;
 public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         PortGroupChangeListener, IContainerListener, ISwitchManagerAware,
         IConfigurationContainerAware, IInventoryListener, IObjectReader,
-        ICacheUpdateAware<Long, String>, CommandProvider {
+        ICacheUpdateAware<Long, String>, CommandProvider,
+        IFlowProgrammerListener {
     private static final String SAVE = "Save";
     private static final String NODEDOWN = "Node is Down";
     private static final Logger log = LoggerFactory
@@ -142,7 +144,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         // Sanity Check
         if (flowEntry == null || flowEntry.getNode() == null) {
             String msg = "Invalid FlowEntry";
-            log.warn(msg + ": " + flowEntry);
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, flowEntry);
             return new Status(StatusCode.NOTACCEPTABLE, msg);
         }
 
@@ -156,7 +159,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         // Container Flow conflict Check
         if (toInstallList.isEmpty()) {
             String msg = "Flow Entry conflicts with all Container Flows";
-            log.warn(msg);
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, flowEntry);
             return new Status(StatusCode.CONFLICT, msg);
         }
 
@@ -168,7 +172,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
             if (findMatch(entry.getInstall(), false) != null) {
                 log.warn("Operation Rejected: A flow with same match "
                         + "and priority exists on the target node");
-                log.trace("Aborting to install " + entry);
+                log.trace("Aborting to install {}", entry);
                 continue;
             }
             toInstallSafe.add(entry);
@@ -179,7 +183,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         if (toInstallSafe.size() == 0) {
             String msg = "A flow with same match and priority exists "
                     + "on the target node";
-            log.warn(msg);
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, flowEntry);
             return new Status(StatusCode.CONFLICT, msg);
         }
 
@@ -195,7 +200,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                 oneSucceded = true;
             } else {
                 error = ret;
-                log.warn("Failed to install the entry: " + ret.getDescription());
+                log.warn("Failed to install the entry: {}. The failure is: {}",
+                        installEntry, ret.getDescription());
             }
         }
 
@@ -255,21 +261,24 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         if (currentFlowEntry == null || currentFlowEntry.getNode() == null
                 || newFlowEntry == null || newFlowEntry.getNode() == null) {
             String msg = "Modify: Invalid FlowEntry";
-            log.warn(msg + ": {} or {} ", currentFlowEntry, newFlowEntry);
+            String logMsg = msg + ": {} or {}";
+            log.warn(logMsg, currentFlowEntry, newFlowEntry);
             return new Status(StatusCode.NOTACCEPTABLE, msg);
         }
         if (!currentFlowEntry.getNode().equals(newFlowEntry.getNode())
                 || !currentFlowEntry.getFlowName().equals(
                         newFlowEntry.getFlowName())) {
             String msg = "Modify: Incompatible Flow Entries";
-            log.warn(msg + ": {} and {}", currentFlowEntry, newFlowEntry);
+            String logMsg = msg + ": {} and {}";
+            log.warn(logMsg, currentFlowEntry, newFlowEntry);
             return new Status(StatusCode.NOTACCEPTABLE, msg);
         }
 
         // Equality Check
         if (currentFlowEntry.equals(newFlowEntry)) {
             String msg = "Modify skipped as flows are the same";
-            log.debug(msg + ": " + currentFlowEntry + " and " + newFlowEntry);
+            String logMsg = msg + ": {} and {}";
+            log.debug(logMsg, currentFlowEntry, newFlowEntry);
             return new Status(StatusCode.SUCCESS, msg);
         }
 
@@ -284,7 +293,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                         currentFlowEntry)) {
             String msg = "Operation Rejected: Another flow with same match "
                     + "and priority exists on the target node";
-            log.warn(msg);
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, currentFlowEntry);
             return new Status(StatusCode.CONFLICT, msg);
         }
 
@@ -297,6 +307,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         if (toInstallList.isEmpty()) {
             String msg = "Modify Operation Rejected: The new entry "
                     + "conflicts with all the container flows";
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, newFlowEntry);
             log.warn(msg);
             return new Status(StatusCode.CONFLICT, msg);
         }
@@ -417,8 +429,9 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                         .getFlow());
 
         if (!status.isSuccess()) {
-            log.warn("SDN Plugin failed to program the flow: "
-                    + status.getDescription());
+            log.warn(
+                    "SDN Plugin failed to program the flow: {}. The failure is: {}",
+                    newEntries.getInstall(), status.getDescription());
             return status;
         }
 
@@ -445,7 +458,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         // Sanity Check
         if (flowEntry == null || flowEntry.getNode() == null) {
             String msg = "Invalid FlowEntry";
-            log.warn(msg + ": " + flowEntry);
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, flowEntry);
             return new Status(StatusCode.NOTACCEPTABLE, msg);
         }
 
@@ -457,14 +471,14 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         boolean atLeastOneRemoved = false;
         for (FlowEntryInstall entry : installedList) {
             if (flowsOnNode == null) {
-                String msg = "Removal skipped (Node down)";
-                log.debug(msg + " for flow entry " + flowEntry);
+                String msg = "Removal skipped (Node down) for flow entry";
+                String logMsg = msg + ": {}";
+                log.debug(logMsg, flowEntry);
                 return new Status(StatusCode.SUCCESS, msg);
             }
             if (!flowsOnNode.contains(entry)) {
-                log.debug("Removal skipped (not present in software view) "
-                        + "for flow entry " + flowEntry);
-
+                String logMsg = "Removal skipped (not present in software view) for flow entry: {}";
+                log.debug(logMsg, flowEntry);
                 if (installedList.size() == 1) {
                     // If we had only one entry to remove, we are done
                     return new Status(StatusCode.SUCCESS, null);
@@ -478,7 +492,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
 
             if (!ret.isSuccess()) {
                 error = ret;
-                log.warn("Failed to remove the entry: " + ret.getDescription());
+                log.warn("Failed to remove the entry: {}. The failure is: {}",
+                        entry.getInstall(), ret.getDescription());
                 if (installedList.size() == 1) {
                     // If we had only one entry to remove, this is fatal failure
                     return error;
@@ -515,11 +530,12 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                 .getInstall().getFlow());
 
         if (!status.isSuccess()) {
-            log.warn("SDN Plugin failed to remove the flow: "
-                    + status.getDescription());
+            log.warn(
+                    "SDN Plugin failed to program the flow: {}. The failure is: {}",
+                    entry.getInstall(), status.getDescription());
             return status;
         }
-        log.trace("Removed  {}", entry.getInstall());
+        log.info("Removed  {}", entry.getInstall());
 
         // Update DB
         updateLocalDatabase(entry, false);
@@ -543,12 +559,13 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                 .getFlow());
 
         if (!status.isSuccess()) {
-            log.warn("SDN Plugin failed to program the flow: "
-                    + status.getDescription());
+            log.warn(
+                    "SDN Plugin failed to program the flow: {}. The failure is: {}",
+                    entry.getInstall(), status.getDescription());
             return status;
         }
 
-        log.trace("Added    {}", entry.getInstall());
+        log.info("Added    {}", entry.getInstall());
 
         // Update DB
         updateLocalDatabase(entry, true);
@@ -704,6 +721,11 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         // Update DB
         if (status.isSuccess()) {
             updateLocalDatabase(target, false);
+        } else {
+            // log the error
+            log.warn(
+                    "SDN Plugin failed to remove the flow: {}. The failure is: {}",
+                    target.getInstall(), status.getDescription());
         }
 
         return status;
@@ -714,8 +736,9 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         Status status;
         if (inContainerMode) {
             String msg = "Controller in container mode: Install Refused";
+            String logMsg = msg + ": {}";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
-            log.warn(msg);
+            log.warn(logMsg, flowEntry);
         } else {
             status = addEntry(flowEntry);
         }
@@ -727,8 +750,9 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         Status status;
         if (inContainerMode) {
             String msg = "Controller in container mode: Uninstall Refused";
+            String logMsg = msg + ": {}";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
-            log.warn(msg);
+            log.warn(logMsg, entry);
         } else {
             status = removeEntry(entry);
         }
@@ -741,8 +765,9 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         Status status = null;
         if (inContainerMode) {
             String msg = "Controller in container mode: Modify Refused";
+            String logMsg = msg + ": {}";
             status = new Status(StatusCode.NOTACCEPTABLE, msg);
-            log.warn(msg);
+            log.warn(logMsg, newFlowEntry);
         } else {
             status = modifyEntry(currentFlowEntry, newFlowEntry);
         }
@@ -879,7 +904,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                     try {
                         frma.policyUpdate(policyname, add);
                     } catch (Exception e) {
-                        log.error("Exception on callback", e);
+                        log.warn("Exception on callback", e);
                     }
                 }
             }
@@ -931,9 +956,10 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                     log.info("Ports {} added to FlowEntry {}", portList,
                             flowName);
                 } else {
-                    log.warn("Failed to add ports {} to Flow entry {}: "
-                            + error.getDescription(), portList,
-                            currentFlowEntry.toString());
+                    log.warn(
+                            "Failed to add ports {} to Flow entry {}. The failure is: {}",
+                            portList, currentFlowEntry.toString(),
+                            error.getDescription());
                 }
                 return;
             }
@@ -961,9 +987,10 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                     log.info("Ports {} removed from FlowEntry {}", portList,
                             flowName);
                 } else {
-                    log.warn("Failed to remove ports {} from Flow entry {}: "
-                            + status.getDescription(), portList,
-                            currentFlowEntry.toString());
+                    log.warn(
+                            "Failed to remove ports {} from Flow entry {}. The failure is: {}",
+                            portList, currentFlowEntry.toString(),
+                            status.getDescription());
                 }
                 return;
             }
@@ -1013,11 +1040,12 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         Status status = modifyEntry(currentFlowEntry, newFlowEntry);
 
         if (status.isSuccess()) {
-            log.info("Output port replaced with " + outPort
-                    + " for flow {} on node {}", flowName, node);
+            log.info("Output port replaced with {} for flow {} on node {}",
+                    outPort, flowName, node);
         } else {
-            log.warn("Failed to replace output port for flow {} on node {}: ",
-                    status.getDescription(), flowName, node);
+            log.warn(
+                    "Failed to replace output port for flow {} on node {}. The failure is: {}",
+                    flowName, node, status.getDescription());
         }
         return;
     }
@@ -1079,9 +1107,9 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                     EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
 
         } catch (CacheConfigException cce) {
-            log.error("FRM CacheConfigException");
+            log.error("FRM CacheConfigException", cce);
         } catch (CacheExistException cce) {
-            log.error("FRM CacheExistException");
+            log.error("FRM CacheExistException", cce);
         }
     }
 
@@ -1211,13 +1239,17 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         // Presence check
         if (flowConfigExists(config)) {
             error = "Entry with this name on specified switch already exists";
+            log.warn(
+                    "Entry with this name on specified switch already exists: {}",
+                    config);
             config.setStatus(error);
             return new Status(StatusCode.CONFLICT, error);
         }
 
         // Skip validation check if we are trying to restore a saved config
         if (!restore && !config.isValid(container, resultStr)) {
-            log.debug(resultStr.toString());
+            log.warn("Invalid Configuration for flow {}. The failure is {}",
+                    config, resultStr.toString());
             error = "Invalid Configuration (" + resultStr.toString() + ")";
             config.setStatus(error);
             return new Status(StatusCode.BADREQUEST, error);
@@ -1231,7 +1263,9 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                 }
             }
             if (!multipleFlowPush) {
-                log.debug(resultStr.toString());
+                log.warn(
+                        "Invalid Configuration(Invalid PortGroup Name) for flow {}",
+                        config);
                 error = "Invalid Configuration (Invalid PortGroup Name)";
                 config.setStatus(error);
                 return new Status(StatusCode.BADREQUEST, error);
@@ -1302,7 +1336,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
     }
 
     private void updateStaticFlowConfigsOnNodeDown(Node node) {
-        log.trace("Updating Static Flow configs on node down: " + node);
+        log.trace("Updating Static Flow configs on node down: {}", node);
 
         List<Integer> toRemove = new ArrayList<Integer>();
         for (Entry<Integer, FlowConfig> entry : staticFlows.entrySet()) {
@@ -1329,8 +1363,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
     }
 
     private void updateStaticFlowConfigsOnContainerModeChange(UpdateType update) {
-        log.trace("Updating Static Flow configs on container mode change: "
-                update);
+        log.trace("Updating Static Flow configs on container mode change: {}",
+                update);
 
         for (FlowConfig config : staticFlows.values()) {
             if (config.isPortGroupEnabled()) {
@@ -1385,7 +1419,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
                 if (entry.isInternalFlow()) {
                     String msg = "Invalid operation: Controller generated "
                             + "flow cannot be deleted";
-                    log.warn(msg);
+                    String logMsg = msg + ": {}";
+                    log.warn(logMsg, name);
                     return new Status(StatusCode.NOTACCEPTABLE, msg);
                 }
                 if (!entry.isPortGroupEnabled()) {
@@ -1410,7 +1445,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         if (newFlowConfig.isInternalFlow()) {
             String msg = "Invalid operation: Controller generated flow "
                     + "cannot be modified";
-            log.warn(msg);
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, newFlowConfig);
             return new Status(StatusCode.NOTACCEPTABLE, msg);
         }
 
@@ -1419,7 +1455,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         if (!newFlowConfig.isValid(container, resultStr)) {
             String msg = "Invalid Configuration (" + resultStr.toString() + ")";
             newFlowConfig.setStatus(msg);
-            log.warn(msg);
+            log.warn("Invalid Configuration for flow {}. The failure is {}",
+                    newFlowConfig, resultStr.toString());
             return new Status(StatusCode.BADREQUEST, msg);
         }
 
@@ -1437,14 +1474,17 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
 
         if (oldFlowConfig == null) {
             String msg = "Attempt to modify a non existing static flow";
-            log.warn(msg);
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, newFlowConfig);
             return new Status(StatusCode.NOTFOUND, msg);
         }
 
         // Do not attempt to reinstall the flow, warn user
         if (newFlowConfig.equals(oldFlowConfig)) {
             String msg = "No modification detected";
-            log.info("Static flow modification skipped: " + msg);
+            log.info(
+                    "Static flow modification skipped. New flow and old flow are the same: {}",
+                    newFlowConfig);
             return new Status(StatusCode.SUCCESS, msg);
         }
 
@@ -1480,7 +1520,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         if (config.isInternalFlow()) {
             String msg = "Invalid operation: Controller generated flow "
                     + "cannot be modified";
-            log.warn(msg);
+            String logMsg = msg + ": {}";
+            log.warn(logMsg, config);
             return new Status(StatusCode.NOTACCEPTABLE, msg);
         }
 
@@ -1530,9 +1571,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         for (FlowEntry flowEntry : inactiveFlows) {
             Status status = this.removeEntry(flowEntry);
             if (!status.isSuccess()) {
-                log.warn(
-                        "Failed to remove entry: {}: "
-                                + status.getDescription(), flowEntry);
+                log.warn("Failed to remove entry: {}. The failure is: {}"
+                        + flowEntry, status.getDescription());
             }
         }
     }
@@ -1548,9 +1588,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         for (FlowEntry flowEntry : this.inactiveFlows) {
             Status status = this.addEntry(flowEntry);
             if (!status.isSuccess()) {
-                log.warn(
-                        "Failed to install entry: {}: "
-                                + status.getDescription(), flowEntry);
+                log.warn("Failed to install entry: {}. The failure is: {}"
+                        + flowEntry, status.getDescription());
             }
         }
 
@@ -1777,7 +1816,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
      * @param node
      */
     private synchronized void cleanDatabaseForNode(Node node) {
-        log.info("Cleaning Flow database for Node " + node.toString());
+        log.info("Cleaning Flow database for Node {}", node.toString());
 
         // Find out which groups the node's flows are part of
         Set<String> affectedGroups = new HashSet<String>();
@@ -2242,7 +2281,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         try {
             node = NodeCreator.createOFNode(Long.valueOf(nodeId));
         } catch (NumberFormatException e) {
-            e.printStackTrace();
+            ci.print("Node id not a number");
+            return;
         }
         ci.println(this.programmer.addFlow(node, getSampleFlow(node)));
     }
@@ -2258,7 +2298,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         try {
             node = NodeCreator.createOFNode(Long.valueOf(nodeId));
         } catch (NumberFormatException e) {
-            e.printStackTrace();
+            ci.print("Node id not a number");
+            return;
         }
         ci.println(this.programmer.removeFlow(node, getSampleFlow(node)));
     }
@@ -2357,4 +2398,28 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager,
         }
     }
 
+    @Override
+    public void flowRemoved(Node node, Flow flow) {
+        log.trace("Received flow removed notification on {} for {}", node, flow);
+        // For flow entry identification, only match and priority matter
+        FlowEntry toFind = new FlowEntry("any", "any", flow, node);
+        FlowEntryInstall installedEntry = this.findMatch(toFind, false);
+        if (installedEntry == null) {
+            log.trace("Entry is not know to us");
+            return;
+        }
+
+        // Update Static flow status
+        for (Map.Entry<Integer, FlowConfig> entry : staticFlows.entrySet()) {
+            FlowConfig conf = entry.getValue();
+            if (conf.isByNameAndNodeIdEqual(installedEntry.getFlowName(), node)) {
+                // Update Configuration database
+                conf.toggleStatus();
+                break;
+            }
+        }
+        // Update software views
+        this.updateLocalDatabase(installedEntry, false);
+    }
+
 }