aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/providers/ovsdb/device
diff options
context:
space:
mode:
authorAshlee Young <ashlee@wildernessvoice.com>2015-11-22 10:02:05 -0800
committerAshlee Young <ashlee@wildernessvoice.com>2015-11-22 10:02:05 -0800
commit77ce3be7567bd01c66d8ee88a93b485666723501 (patch)
tree283e7f39a501750bbd705fbb91645b20198900f1 /framework/src/onos/providers/ovsdb/device
parent00e6500d0813dcbccaaa741ef38cc1eae6d11e07 (diff)
Removed patch path since changes have been merged upstream to a different path. Updated README with directions.
Change-Id: Ie419abd2d3d3ef7315de9f607dcd757a78190995 Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/providers/ovsdb/device')
-rw-r--r--framework/src/onos/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/framework/src/onos/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java b/framework/src/onos/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java
index 10e745e3..d573458e 100644
--- a/framework/src/onos/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java
+++ b/framework/src/onos/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java
@@ -27,6 +27,7 @@ import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.packet.ChassisId;
+import org.onlab.packet.IpAddress;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
@@ -40,6 +41,7 @@ import org.onosproject.net.device.DeviceProviderService;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.provider.AbstractProvider;
import org.onosproject.net.provider.ProviderId;
+import org.onosproject.ovsdb.controller.OvsdbClientService;
import org.onosproject.ovsdb.controller.OvsdbController;
import org.onosproject.ovsdb.controller.OvsdbNodeId;
import org.onosproject.ovsdb.controller.OvsdbNodeListener;
@@ -87,8 +89,14 @@ public class OvsdbDeviceProvider extends AbstractProvider
@Override
public void triggerProbe(DeviceId deviceId) {
- // TODO: This will be implemented later.
log.info("Triggering probe on device {}", deviceId);
+ if (!isReachable(deviceId)) {
+ log.error("Failed to probe device {}", deviceId);
+ providerService.deviceDisconnected(deviceId);
+ return;
+ } else {
+ log.trace("Confirmed device {} connection", deviceId);
+ }
}
@Override
@@ -98,7 +106,8 @@ public class OvsdbDeviceProvider extends AbstractProvider
@Override
public boolean isReachable(DeviceId deviceId) {
- return true;
+ OvsdbClientService ovsdbClient = controller.getOvsdbClient(changeDeviceIdToNodeId(deviceId));
+ return !(ovsdbClient == null || !ovsdbClient.isConnected());
}
private class InnerOvsdbNodeListener implements OvsdbNodeListener {
@@ -131,4 +140,12 @@ public class OvsdbDeviceProvider extends AbstractProvider
}
}
+
+ private OvsdbNodeId changeDeviceIdToNodeId(DeviceId deviceId) {
+ String[] strings = deviceId.toString().split(":");
+ if (strings.length < 1) {
+ return null;
+ }
+ return new OvsdbNodeId(IpAddress.valueOf(strings[1]), 0);
+ }
}