[VOL5378]-support to set offload onu config
Change-Id: I7be0d038fcb1ba9a0a858469198c25b819b48eac
Signed-off-by: Akash Soni <akash.soni@radisys.com>
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 6f983a9..02d996f 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -3873,6 +3873,17 @@
}
}
+func (dh *deviceHandler) setOnuOffloadStats(ctx context.Context, config *extension.AppOffloadOnuConfig) *extension.SingleSetValueResponse {
+
+ singleValResp := extension.SingleSetValueResponse{
+ Response: &extension.SetValueResponse{
+ Status: extension.SetValueResponse_OK,
+ },
+ }
+
+ return &singleValResp
+}
+
func (dh *deviceHandler) GetUniPortStatus(ctx context.Context, uniInfo *extension.GetOnuUniInfoRequest) *extension.SingleGetValueResponse {
portStatus := uniprt.NewUniPortStatus(dh, dh.pOnuOmciDevice.PDevOmciCC)
diff --git a/internal/pkg/core/openonu.go b/internal/pkg/core/openonu.go
index 8028c34..fb3e2be 100755
--- a/internal/pkg/core/openonu.go
+++ b/internal/pkg/core/openonu.go
@@ -1253,9 +1253,30 @@
return nil, errors.New("unImplemented")
}
-// SetSingleValue is unimplemented
-func (oo *OpenONUAC) SetSingleValue(context.Context, *extension.SingleSetValueRequest) (*extension.SingleSetValueResponse, error) {
- return nil, errors.New("unImplemented")
+// SetSingleValue sets a single value based on the given request and returns the response.
+func (oo *OpenONUAC) SetSingleValue(ctx context.Context, request *extension.SingleSetValueRequest) (*extension.SingleSetValueResponse, error) {
+ logger.Infow(ctx, "single_set_value_request", log.Fields{"request": request})
+
+ errResp := func(status extension.SetValueResponse_Status,
+ reason extension.SetValueResponse_ErrorReason) *extension.SingleSetValueResponse {
+ return &extension.SingleSetValueResponse{
+ Response: &extension.SetValueResponse{
+ Status: status,
+ ErrReason: reason,
+ },
+ }
+ }
+ if handler := oo.getDeviceHandler(ctx, request.TargetId, false); handler != nil {
+ switch reqType := request.GetRequest().GetRequest().(type) {
+ case *extension.SetValueRequest_AppOffloadOnuConfig:
+ return handler.setOnuOffloadStats(ctx, reqType.AppOffloadOnuConfig), nil
+ default:
+ return errResp(extension.SetValueResponse_ERROR, extension.SetValueResponse_UNSUPPORTED), nil
+ }
+ }
+
+ logger.Infow(ctx, "Single_set_value_request failed ", log.Fields{"request": request})
+ return errResp(extension.SetValueResponse_ERROR, extension.SetValueResponse_INVALID_DEVICE_ID), nil
}
// StartOmciTest not implemented