Yuta HIGUCHI

move isConnected to OpenFlowSwitch interface

Change-Id: I08d1746dc05464135cabe31888f6bb3eac9c15d5
......@@ -115,6 +115,13 @@ public interface OpenFlowSwitch {
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
*/
......
......@@ -187,13 +187,6 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch {
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.
*
......
......@@ -39,7 +39,6 @@ import org.onlab.onos.openflow.controller.OpenFlowController;
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 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
@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
......
......@@ -370,6 +370,11 @@ public class OpenFlowDeviceProviderTest {
}
@Override
public boolean isConnected() {
return true;
}
@Override
public void disconnectSwitch() {
}
......
......@@ -475,6 +475,11 @@ public class OpenFlowLinkProviderTest {
}
@Override
public boolean isConnected() {
return true;
}
@Override
public void disconnectSwitch() {
}
......
......@@ -406,6 +406,11 @@ public class OpenFlowPacketProviderTest {
}
@Override
public boolean isConnected() {
return true;
}
@Override
public void disconnectSwitch() {
}
......