VOL-3248 Support for SetExtValue API
This commits adds a new SetExtValue API in the VOLTHA
core and also the handling of the request.
Change-Id: I45b76e4bcc3234842c8404514f5220573ac33211
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index 345255f..fc6a3dd 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -1563,3 +1563,22 @@
return nil, status.Errorf(codes.NotFound, "%s", value.Id)
}
+
+// SetExtValue set some given configs or value
+func (dMgr *Manager) SetExtValue(ctx context.Context, value *voltha.ValueSet) (*empty.Empty, error) {
+ logger.Debugw(ctx, "setExtValue", log.Fields{"onu-id": value.Id})
+ device, err := dMgr.getDeviceReadOnly(ctx, value.Id)
+ if err != nil {
+ return nil, status.Errorf(codes.Aborted, "%s", err.Error())
+ }
+ if agent := dMgr.getDeviceAgent(ctx, device.Id); agent != nil {
+ resp, err := agent.setExtValue(ctx, device, value)
+ if err != nil {
+ return nil, err
+ }
+ logger.Debugw(ctx, "setExtValue-result", log.Fields{"result": resp})
+ return resp, nil
+ }
+ return nil, status.Errorf(codes.NotFound, "%s", value.Id)
+
+}