[ONOS-7751] Sometimes device availability is not changed to available after creation of OF device
Change-Id: I5fd62c598e865e149755b9d09594c985846a572b
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
index 458d100..1d23960 100644
--- a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
@@ -18,7 +18,6 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.Futures;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -565,13 +564,11 @@
deviceDescription = deviceAnnotationOp.combine(deviceId, deviceDescription, Optional.of(annoConfig));
}
+ MastershipRole role = mastershipService.requestRoleForSync(deviceId);
+ log.info("Local role is {} for {}", role, deviceId);
DeviceEvent event = store.createOrUpdateDevice(provider().id(), deviceId,
- deviceDescription);
- Futures.getUnchecked(mastershipService.requestRoleFor(deviceId)
- .thenAccept(role -> {
- log.info("Local role is {} for {}", role, deviceId);
- applyRole(deviceId, role);
- }));
+ deviceDescription);
+ applyRole(deviceId, role);
if (portConfig != null) {
//updating the ports if configration exists