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/remote/adapter_proxy.go b/rw_core/core/device/remote/adapter_proxy.go
index e8681c4..f3d3358 100755
--- a/rw_core/core/device/remote/adapter_proxy.go
+++ b/rw_core/core/device/remote/adapter_proxy.go
@@ -454,3 +454,23 @@
replyToTopic := ap.getCoreTopic()
return ap.sendRPC(ctx, rpc, toTopic, &replyToTopic, true, pdevice.Id, args...)
}
+
+// SetExtValue set some given configs or value
+func (ap *AdapterProxy) SetExtValue(ctx context.Context, device *voltha.Device, value *voltha.ValueSet) (chan *kafka.RpcResponse, error) {
+ logger.Debugw(ctx, "SetExtValue", log.Fields{"device-id": value.Id})
+ rpc := "set_ext_value"
+ toTopic, err := ap.getAdapterTopic(ctx, value.Id, device.Adapter)
+ if err != nil {
+ return nil, err
+ }
+ // Use a device specific topic to send the request. The adapter handling the device creates a device
+ // specific topic
+ args := []*kafka.KVArg{
+ {
+ Key: "value",
+ Value: value,
+ },
+ }
+ replyToTopic := ap.getCoreTopic()
+ return ap.sendRPC(ctx, rpc, toTopic, &replyToTopic, true, value.Id, args...)
+}