move isConnected to OpenFlowSwitch interface
Change-Id: I08d1746dc05464135cabe31888f6bb3eac9c15d5
diff --git a/openflow/api/src/main/java/org/onlab/onos/openflow/controller/OpenFlowSwitch.java b/openflow/api/src/main/java/org/onlab/onos/openflow/controller/OpenFlowSwitch.java
index 77eb437..2d3f890 100644
--- a/openflow/api/src/main/java/org/onlab/onos/openflow/controller/OpenFlowSwitch.java
+++ b/openflow/api/src/main/java/org/onlab/onos/openflow/controller/OpenFlowSwitch.java
@@ -115,6 +115,13 @@
public String serialNumber();
/**
+ * Checks if the switch is still connected.
+ *
+ * @return whether the switch is still connected
+ */
+ public boolean isConnected();
+
+ /**
* Disconnects the switch by closing the TCP connection. Results in a call
* to the channel handler's channelDisconnected method for cleanup
*/
diff --git a/openflow/api/src/main/java/org/onlab/onos/openflow/controller/driver/OpenFlowSwitchDriver.java b/openflow/api/src/main/java/org/onlab/onos/openflow/controller/driver/OpenFlowSwitchDriver.java
index 2647fed..b6a4770 100644
--- a/openflow/api/src/main/java/org/onlab/onos/openflow/controller/driver/OpenFlowSwitchDriver.java
+++ b/openflow/api/src/main/java/org/onlab/onos/openflow/controller/driver/OpenFlowSwitchDriver.java
@@ -187,13 +187,6 @@
public void setConnected(boolean connected);
/**
- * Checks if the switch is still connected.
- *
- * @return whether the switch is still connected
- */
- public boolean isConnected();
-
- /**
* Writes the message to the output stream
* in a driver specific manner.
*
diff --git a/providers/openflow/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java b/providers/openflow/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
index 1a96fca..a960c02 100644
--- a/providers/openflow/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
+++ b/providers/openflow/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
@@ -39,7 +39,6 @@
import org.onlab.onos.openflow.controller.OpenFlowSwitch;
import org.onlab.onos.openflow.controller.OpenFlowSwitchListener;
import org.onlab.onos.openflow.controller.RoleState;
-import org.onlab.onos.openflow.controller.driver.OpenFlowSwitchDriver;
import org.onlab.packet.ChassisId;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFPortConfig;
@@ -113,14 +112,11 @@
@Override
public boolean isReachable(Device device) {
- // FIXME if possible, we might want this to be part of
- // OpenFlowSwitch interface so the driver interface isn't misused.
OpenFlowSwitch sw = controller.getSwitch(dpid(device.id().uri()));
- if (sw == null || !((OpenFlowSwitchDriver) sw).isConnected()) {
+ if (sw == null || !sw.isConnected()) {
return false;
}
return true;
- //return checkChannel(device, sw);
}
@Override
diff --git a/providers/openflow/device/src/test/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProviderTest.java b/providers/openflow/device/src/test/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProviderTest.java
index 76d32e4..839de7d 100644
--- a/providers/openflow/device/src/test/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProviderTest.java
+++ b/providers/openflow/device/src/test/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProviderTest.java
@@ -370,6 +370,11 @@
}
@Override
+ public boolean isConnected() {
+ return true;
+ }
+
+ @Override
public void disconnectSwitch() {
}
diff --git a/providers/openflow/link/src/test/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProviderTest.java b/providers/openflow/link/src/test/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProviderTest.java
index 4109ba0..a6b0ac3 100644
--- a/providers/openflow/link/src/test/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProviderTest.java
+++ b/providers/openflow/link/src/test/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProviderTest.java
@@ -475,6 +475,11 @@
}
@Override
+ public boolean isConnected() {
+ return true;
+ }
+
+ @Override
public void disconnectSwitch() {
}
diff --git a/providers/openflow/packet/src/test/java/org/onlab/onos/provider/of/packet/impl/OpenFlowPacketProviderTest.java b/providers/openflow/packet/src/test/java/org/onlab/onos/provider/of/packet/impl/OpenFlowPacketProviderTest.java
index f547bbe..c27e084 100644
--- a/providers/openflow/packet/src/test/java/org/onlab/onos/provider/of/packet/impl/OpenFlowPacketProviderTest.java
+++ b/providers/openflow/packet/src/test/java/org/onlab/onos/provider/of/packet/impl/OpenFlowPacketProviderTest.java
@@ -406,6 +406,11 @@
}
@Override
+ public boolean isConnected() {
+ return true;
+ }
+
+ @Override
public void disconnectSwitch() {
}