VOL-3616 Support for API to retrieve information (example UNI) from an ONU
This commit implements extension service, which includes handling of the GetExtValue and SetExtValue APIs
Change-Id: I537160af5b70eccef77a8bc11235af3b50f9a513
diff --git a/rw_core/core/device/remote/adapter_proxy.go b/rw_core/core/device/remote/adapter_proxy.go
index fd9a1a0..66e7672 100755
--- a/rw_core/core/device/remote/adapter_proxy.go
+++ b/rw_core/core/device/remote/adapter_proxy.go
@@ -21,6 +21,7 @@
"github.com/opencord/voltha-lib-go/v4/pkg/kafka"
"github.com/opencord/voltha-lib-go/v4/pkg/log"
+ "github.com/opencord/voltha-protos/v4/go/extension"
ic "github.com/opencord/voltha-protos/v4/go/inter_container"
ofp "github.com/opencord/voltha-protos/v4/go/openflow_13"
"github.com/opencord/voltha-protos/v4/go/voltha"
@@ -474,3 +475,47 @@
replyToTopic := ap.getCoreTopic()
return ap.sendRPC(ctx, rpc, toTopic, &replyToTopic, true, value.Id, args...)
}
+
+// GetSingleValue get a value from the adapter, based on the request type
+func (ap *AdapterProxy) GetSingleValue(ctx context.Context, adapterType string, request *extension.SingleGetValueRequest) (chan *kafka.RpcResponse, error) {
+ logger.Debugw(ctx, "GetSingleValue", log.Fields{"device-id": request.TargetId})
+ rpc := "single_get_value_request"
+ toTopic, err := ap.getAdapterTopic(ctx, request.TargetId, adapterType)
+ 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: "request",
+ Value: request,
+ },
+ }
+
+ replyToTopic := ap.getCoreTopic()
+ return ap.sendRPC(ctx, rpc, toTopic, &replyToTopic, true, request.TargetId, args...)
+}
+
+// SetSingleValue set a single value on the adapter, based on the request type
+func (ap *AdapterProxy) SetSingleValue(ctx context.Context, adapterType string, request *extension.SingleSetValueRequest) (chan *kafka.RpcResponse, error) {
+ logger.Debugw(ctx, "SetSingleValue", log.Fields{"device-id": request.TargetId})
+ rpc := "single_set_value_request"
+ toTopic, err := ap.getAdapterTopic(ctx, request.TargetId, adapterType)
+ 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: "request",
+ Value: request,
+ },
+ }
+
+ replyToTopic := ap.getCoreTopic()
+ return ap.sendRPC(ctx, rpc, toTopic, &replyToTopic, true, request.TargetId, args...)
+}