Fix: invoke a fake role reply ack on role change event for ovsdb
Change-Id: If824ccc41d0136fb7b16f81cc08e3aa9abd2db4a
diff --git a/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java b/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java
index 5fbf304..dbe7bae 100644
--- a/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java
+++ b/providers/ovsdb/device/src/main/java/org/onosproject/ovsdb/providers/device/OvsdbDeviceProvider.java
@@ -53,6 +53,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.MastershipRole.NONE;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -121,7 +122,12 @@
@Override
public void roleChanged(DeviceId deviceId, MastershipRole newRole) {
- // TODO: This will be implemented later.
+ // for OVSDB there is no Mastership concept, simulating here a fake
+ // Mastership handshake to be compliant with the ONOS core
+ if (newRole != null && newRole != NONE) {
+ final MastershipRole role = mastershipService.getLocalRole(deviceId);
+ providerService.receivedRoleReply(deviceId, role, role);
+ }
}
@Override
@@ -149,7 +155,6 @@
cid,
annotations);
providerService.deviceConnected(deviceId, deviceDescription);
-
}
@Override