VOL-2103 - Device reason update modifications
A new api is defined to update the reason attribute of Device in rw_core.
Change-Id: Icc4134498fc622d67d8e8b6f6d08f0968a8e9bd2
diff --git a/rw_core/core/device_manager.go b/rw_core/core/device_manager.go
index bb36966..9434dcf 100755
--- a/rw_core/core/device_manager.go
+++ b/rw_core/core/device_manager.go
@@ -1413,3 +1413,11 @@
//TODO CLI always get successful response
sendResponse(ctx, ch, res)
}
+
+func (dMgr *DeviceManager) updateDeviceReason(deviceId string, reason string) error {
+ log.Debugw("updateDeviceReason", log.Fields{"deviceid": deviceId, "reason": reason})
+ if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+ return agent.updateDeviceReason(reason)
+ }
+ return status.Errorf(codes.NotFound, "%s", deviceId)
+}