move isConnected to OpenFlowSwitch interface
Change-Id: I08d1746dc05464135cabe31888f6bb3eac9c15d5
Showing
6 changed files
with
23 additions
and
12 deletions
... | @@ -115,6 +115,13 @@ public interface OpenFlowSwitch { | ... | @@ -115,6 +115,13 @@ public interface OpenFlowSwitch { |
115 | public String serialNumber(); | 115 | public String serialNumber(); |
116 | 116 | ||
117 | /** | 117 | /** |
118 | + * Checks if the switch is still connected. | ||
119 | + * | ||
120 | + * @return whether the switch is still connected | ||
121 | + */ | ||
122 | + public boolean isConnected(); | ||
123 | + | ||
124 | + /** | ||
118 | * Disconnects the switch by closing the TCP connection. Results in a call | 125 | * Disconnects the switch by closing the TCP connection. Results in a call |
119 | * to the channel handler's channelDisconnected method for cleanup | 126 | * to the channel handler's channelDisconnected method for cleanup |
120 | */ | 127 | */ | ... | ... |
... | @@ -187,13 +187,6 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch { | ... | @@ -187,13 +187,6 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch { |
187 | public void setConnected(boolean connected); | 187 | public void setConnected(boolean connected); |
188 | 188 | ||
189 | /** | 189 | /** |
190 | - * Checks if the switch is still connected. | ||
191 | - * | ||
192 | - * @return whether the switch is still connected | ||
193 | - */ | ||
194 | - public boolean isConnected(); | ||
195 | - | ||
196 | - /** | ||
197 | * Writes the message to the output stream | 190 | * Writes the message to the output stream |
198 | * in a driver specific manner. | 191 | * in a driver specific manner. |
199 | * | 192 | * | ... | ... |
... | @@ -39,7 +39,6 @@ import org.onlab.onos.openflow.controller.OpenFlowController; | ... | @@ -39,7 +39,6 @@ import org.onlab.onos.openflow.controller.OpenFlowController; |
39 | import org.onlab.onos.openflow.controller.OpenFlowSwitch; | 39 | import org.onlab.onos.openflow.controller.OpenFlowSwitch; |
40 | import org.onlab.onos.openflow.controller.OpenFlowSwitchListener; | 40 | import org.onlab.onos.openflow.controller.OpenFlowSwitchListener; |
41 | import org.onlab.onos.openflow.controller.RoleState; | 41 | import org.onlab.onos.openflow.controller.RoleState; |
42 | -import org.onlab.onos.openflow.controller.driver.OpenFlowSwitchDriver; | ||
43 | import org.onlab.packet.ChassisId; | 42 | import org.onlab.packet.ChassisId; |
44 | import org.projectfloodlight.openflow.protocol.OFFactory; | 43 | import org.projectfloodlight.openflow.protocol.OFFactory; |
45 | import org.projectfloodlight.openflow.protocol.OFPortConfig; | 44 | import org.projectfloodlight.openflow.protocol.OFPortConfig; |
... | @@ -113,14 +112,11 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -113,14 +112,11 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
113 | 112 | ||
114 | @Override | 113 | @Override |
115 | public boolean isReachable(Device device) { | 114 | public boolean isReachable(Device device) { |
116 | - // FIXME if possible, we might want this to be part of | ||
117 | - // OpenFlowSwitch interface so the driver interface isn't misused. | ||
118 | OpenFlowSwitch sw = controller.getSwitch(dpid(device.id().uri())); | 115 | OpenFlowSwitch sw = controller.getSwitch(dpid(device.id().uri())); |
119 | - if (sw == null || !((OpenFlowSwitchDriver) sw).isConnected()) { | 116 | + if (sw == null || !sw.isConnected()) { |
120 | return false; | 117 | return false; |
121 | } | 118 | } |
122 | return true; | 119 | return true; |
123 | - //return checkChannel(device, sw); | ||
124 | } | 120 | } |
125 | 121 | ||
126 | @Override | 122 | @Override | ... | ... |
... | @@ -370,6 +370,11 @@ public class OpenFlowDeviceProviderTest { | ... | @@ -370,6 +370,11 @@ public class OpenFlowDeviceProviderTest { |
370 | } | 370 | } |
371 | 371 | ||
372 | @Override | 372 | @Override |
373 | + public boolean isConnected() { | ||
374 | + return true; | ||
375 | + } | ||
376 | + | ||
377 | + @Override | ||
373 | public void disconnectSwitch() { | 378 | public void disconnectSwitch() { |
374 | } | 379 | } |
375 | 380 | ... | ... |
... | @@ -475,6 +475,11 @@ public class OpenFlowLinkProviderTest { | ... | @@ -475,6 +475,11 @@ public class OpenFlowLinkProviderTest { |
475 | } | 475 | } |
476 | 476 | ||
477 | @Override | 477 | @Override |
478 | + public boolean isConnected() { | ||
479 | + return true; | ||
480 | + } | ||
481 | + | ||
482 | + @Override | ||
478 | public void disconnectSwitch() { | 483 | public void disconnectSwitch() { |
479 | } | 484 | } |
480 | 485 | ... | ... |
... | @@ -406,6 +406,11 @@ public class OpenFlowPacketProviderTest { | ... | @@ -406,6 +406,11 @@ public class OpenFlowPacketProviderTest { |
406 | } | 406 | } |
407 | 407 | ||
408 | @Override | 408 | @Override |
409 | + public boolean isConnected() { | ||
410 | + return true; | ||
411 | + } | ||
412 | + | ||
413 | + @Override | ||
409 | public void disconnectSwitch() { | 414 | public void disconnectSwitch() { |
410 | } | 415 | } |
411 | 416 | ... | ... |
-
Please register or login to post a comment