[VOL-5378]-ppoeIA and DHCPRA support in voltha openolt adapter
Change-Id: I12d304294eca680a64b7f0b02b9ef1783854438f
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 48eff8d..f41ab4d 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -3649,6 +3649,31 @@
return errResp(extension.GetValueResponse_ERROR, extension.GetValueResponse_INTERNAL_ERROR)
}
+func (dh *DeviceHandler) getOltOffloadStats(ctx context.Context, oltPortInfo *extension.GetOffloadedAppsStatisticsRequest) *extension.SingleGetValueResponse {
+
+ singleValResp := extension.SingleGetValueResponse{
+ Response: &extension.GetValueResponse{
+ Status: extension.GetValueResponse_OK,
+ Response: &extension.GetValueResponse_OffloadedAppsStats{
+ OffloadedAppsStats: &extension.GetOffloadedAppsStatisticsResponse{},
+ },
+ },
+ }
+
+ return &singleValResp
+}
+
+func (dh *DeviceHandler) setOltOffloadStats(ctx context.Context, congig *extension.AppOffloadConfig) *extension.SingleSetValueResponse {
+
+ singleValResp := extension.SingleSetValueResponse{
+ Response: &extension.SetValueResponse{
+ Status: extension.SetValueResponse_OK,
+ },
+ }
+
+ return &singleValResp
+}
+
func (dh *DeviceHandler) getOnuPonCounters(ctx context.Context, onuPonInfo *extension.GetOnuCountersRequest) *extension.SingleGetValueResponse {
singleValResp := extension.SingleGetValueResponse{
diff --git a/internal/pkg/core/openolt.go b/internal/pkg/core/openolt.go
index a30b3e0..c6d5563 100644
--- a/internal/pkg/core/openolt.go
+++ b/internal/pkg/core/openolt.go
@@ -407,6 +407,8 @@
return handler.getRxPower(ctx, reqType.RxPower), nil
case *extension.GetValueRequest_OltRxPower:
return handler.getPONRxPower(ctx, reqType.OltRxPower), nil
+ case *extension.GetValueRequest_OffloadedAppsStats:
+ return handler.getOltOffloadStats(ctx, reqType.OffloadedAppsStats), nil
default:
return errResp(extension.GetValueResponse_ERROR, extension.GetValueResponse_UNSUPPORTED), nil
}
@@ -416,6 +418,32 @@
return errResp(extension.GetValueResponse_ERROR, extension.GetValueResponse_INVALID_DEVICE_ID), nil
}
+// SetSingleValue is implemented
+func (oo *OpenOLT) 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(request.TargetId); handler != nil {
+ switch reqType := request.GetRequest().GetRequest().(type) {
+ case *extension.SetValueRequest_AppOffloadConfig:
+ return handler.setOltOffloadStats(ctx, reqType.AppOffloadConfig), 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
+}
+
/*
* OLT Inter-adapter service
*/
@@ -519,11 +547,6 @@
return nil, olterrors.ErrNotImplemented
}
-// SetSingleValue is unimplemented
-func (oo *OpenOLT) SetSingleValue(context.Context, *extension.SingleSetValueRequest) (*extension.SingleSetValueResponse, error) {
- return nil, olterrors.ErrNotImplemented
-}
-
// StartOmciTest not implemented
func (oo *OpenOLT) StartOmciTest(ctx context.Context, test *ca.OMCITest) (*omci.TestResponse, error) {
return nil, olterrors.ErrNotImplemented