check switch connection before probing
Change-Id: I7f53866d8863e7335bb19a5bee80967c4ce0070c
Showing
1 changed file
with
22 additions
and
7 deletions
... | @@ -121,14 +121,29 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -121,14 +121,29 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
121 | 121 | ||
122 | @Override | 122 | @Override |
123 | public void triggerProbe(Device device) { | 123 | public void triggerProbe(Device device) { |
124 | - LOG.info("Triggering probe on device {}", device.id()); | 124 | + final DeviceId deviceId = device.id(); |
125 | + LOG.info("Triggering probe on device {}", deviceId); | ||
125 | 126 | ||
126 | - OpenFlowSwitch sw = controller.getSwitch(dpid(device.id().uri())); | 127 | + final Dpid dpid = dpid(deviceId.uri()); |
127 | - //if (!checkChannel(device, sw)) { | 128 | + OpenFlowSwitch sw = controller.getSwitch(dpid); |
128 | - // LOG.error("Failed to probe device {} on sw={}", device, sw); | 129 | + if (sw == null || !sw.isConnected()) { |
129 | - // providerService.deviceDisconnected(device.id()); | 130 | + LOG.error("Failed to probe device {} on sw={}", device, sw); |
130 | - //return; | 131 | + providerService.deviceDisconnected(deviceId); |
131 | - //} | 132 | + } else { |
133 | + LOG.trace("Confirmed device {} connection", device); | ||
134 | + // FIXME require something like below to match javadoc description | ||
135 | + // but this starts infinite loop with current DeviceManager | ||
136 | +// final ChassisId cId = new ChassisId(dpid.value()); | ||
137 | +// final Type deviceType = device.type(); | ||
138 | +// DeviceDescription description = | ||
139 | +// new DefaultDeviceDescription(deviceId.uri(), deviceType, | ||
140 | +// sw.manfacturerDescription(), | ||
141 | +// sw.hardwareDescription(), | ||
142 | +// sw.softwareDescription(), | ||
143 | +// sw.serialNumber(), | ||
144 | +// cId); | ||
145 | +// providerService.deviceConnected(deviceId, description); | ||
146 | + } | ||
132 | 147 | ||
133 | // Prompt an update of port information. We can use any XID for this. | 148 | // Prompt an update of port information. We can use any XID for this. |
134 | OFFactory fact = sw.factory(); | 149 | OFFactory fact = sw.factory(); | ... | ... |
-
Please register or login to post a comment