Added new method IDBUtils.searchActiveSwitch()
diff --git a/src/main/java/net/onrc/onos/util/GraphDBUtils.java b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
index ba48103..7283d09 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBUtils.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
@@ -44,6 +44,16 @@
}
@Override
+ public ISwitchObject searchActiveSwitch(GraphDBConnection conn, String dpid) {
+ ISwitchObject sw = searchSwitch(conn, dpid);
+ if ((sw != null) &&
+ sw.getState().equals(SwitchState.ACTIVE.toString())) {
+ return sw;
+ }
+ return null;
+ }
+
+ @Override
public IDeviceObject searchDevice(GraphDBConnection conn, String macAddr) {
// TODO Auto-generated method stub
FramedGraph<TitanGraph> fg = conn.getFramedGraph();
diff --git a/src/main/java/net/onrc/onos/util/IDBUtils.java b/src/main/java/net/onrc/onos/util/IDBUtils.java
index 864e227..51948a2 100644
--- a/src/main/java/net/onrc/onos/util/IDBUtils.java
+++ b/src/main/java/net/onrc/onos/util/IDBUtils.java
@@ -10,6 +10,7 @@
public interface IDBUtils {
public ISwitchObject searchSwitch(GraphDBConnection conn, String dpid);
+ public ISwitchObject searchActiveSwitch(GraphDBConnection conn, String dpid);
public Iterable<ISwitchObject> getActiveSwitches(GraphDBConnection conn);
public Iterable<ISwitchObject> getAllSwitches(GraphDBConnection conn);
public Iterable<ISwitchObject> getInactiveSwitches(GraphDBConnection conn);