VOL-3356 - Changed the way devices are updated.

so that state transitions will execute in the calling thread.
Also changed the locking guarantees when accessing devices.

Change-Id: I0d40215bf35ffafd2ee4fcef6b34515001adcc9c
diff --git a/rw_core/core/device/agent_group.go b/rw_core/core/device/agent_group.go
index 86cc108..da2b7c5 100644
--- a/rw_core/core/device/agent_group.go
+++ b/rw_core/core/device/agent_group.go
@@ -50,7 +50,7 @@
 		return coreutils.DoneResponse(), nil
 	}
 
-	device := agent.getDeviceWithoutLock()
+	device := agent.getDeviceReadOnly()
 	dType, err := agent.adapterMgr.GetDeviceType(ctx, &voltha.ID{Id: device.Type})
 	if err != nil {
 		return coreutils.DoneResponse(), status.Errorf(codes.FailedPrecondition, "non-existent-device-type-%s", device.Type)
@@ -128,7 +128,7 @@
 		logger.Debugw(ctx, "nothing-to-delete", log.Fields{"device-id": agent.deviceID})
 		return coreutils.DoneResponse(), nil
 	}
-	device := agent.getDeviceWithoutLock()
+	device := agent.getDeviceReadOnly()
 	dType, err := agent.adapterMgr.GetDeviceType(ctx, &voltha.ID{Id: device.Type})
 	if err != nil {
 		return coreutils.DoneResponse(), status.Errorf(codes.FailedPrecondition, "non-existent-device-type-%s", device.Type)
@@ -184,7 +184,7 @@
 		return coreutils.DoneResponse(), nil
 	}
 
-	device := agent.getDeviceWithoutLock()
+	device := agent.getDeviceReadOnly()
 	if device.OperStatus != voltha.OperStatus_ACTIVE || device.ConnectStatus != voltha.ConnectStatus_REACHABLE || device.AdminState != voltha.AdminState_ENABLED {
 		return coreutils.DoneResponse(), status.Errorf(codes.FailedPrecondition, "invalid device states-oper-%s-connect-%s-admin-%s", device.OperStatus, device.ConnectStatus, device.AdminState)
 	}