Added a generic API to return a list of configured switches that are not connected...
[controller.git] / opendaylight / switchmanager / implementation / src / main / java / org / opendaylight / controller / switchmanager / internal / SwitchManager.java
index 4d2aea203601dafe6e19fcacc208ae4760819b0f..4950cae33a9fc37813afb963250e31a5ff71e824 100644 (file)
@@ -2155,4 +2155,25 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
         return (desc == null /* || desc.getValue().equalsIgnoreCase("none") */) ? ""
                 : desc.getValue();
     }
+
+    @Override
+    public Set<Switch> getConfiguredNotConnectedSwitches() {
+        Set<Switch> configuredNotConnectedSwitches = new HashSet<Switch>();
+        if (this.inventoryService == null) {
+            log.trace("inventory service not avaiable");
+            return configuredNotConnectedSwitches;
+        }
+
+        Set<Node> configuredNotConnectedNodes = this.inventoryService.getConfiguredNotConnectedNodes();
+        if (configuredNotConnectedNodes != null) {
+            for (Node node : configuredNotConnectedNodes) {
+                Switch sw = getSwitchByNode(node);
+                if (sw != null) {
+                    configuredNotConnectedSwitches.add(sw);
+                }
+            }
+        }
+        return configuredNotConnectedSwitches;
+    }
+
 }