[VOL-5567] Upgrade protos and remove deprecated dependencies
Change-Id: If577615a4cb39289c43029831f1a3b5aeebf3553
Signed-off-by: bseeniva <balaji.seenivasan@radisys.com>
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index adaa761..e6502e9 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -25,10 +25,8 @@
"sync"
"time"
- "github.com/golang/protobuf/ptypes/empty"
"github.com/opencord/voltha-openonu-adapter-go/internal/pkg/config"
- "github.com/gogo/protobuf/proto"
"github.com/looplab/fsm"
me "github.com/opencord/omci-lib-go/v2/generated"
"github.com/opencord/voltha-lib-go/v7/pkg/db"
@@ -55,6 +53,8 @@
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/emptypb"
)
const (
@@ -430,7 +430,7 @@
logger.Debugw(ctx, "onu-uni-tp-path-modified", log.Fields{"device-id": dh.DeviceID,
"uniID": uniID, "tp-path": techProfMsg.TpInstancePath, "tpID": tpID})
- err = dh.CheckAvailableOnuCapabilities(ctx, pDevEntry, *tpInst.TpInstance)
+ err = dh.CheckAvailableOnuCapabilities(ctx, pDevEntry, tpInst.TpInstance)
if err != nil {
logger.Errorw(ctx, "error-checking-available-onu-capabilities-stopping-device",
log.Fields{"device-id": dh.DeviceID, "err": err, "tp-path": techProfMsg.TpInstancePath})
@@ -455,7 +455,7 @@
var wg sync.WaitGroup
wg.Add(1) // for the 1 go routine to finish
// attention: deadline completion check and wg.Done is to be done in both routines
- go dh.pOnuTP.ConfigureUniTp(log.WithSpanFromContext(dctx, ctx), uniID, techProfMsg.TpInstancePath, *tpInst.TpInstance, &wg)
+ go dh.pOnuTP.ConfigureUniTp(log.WithSpanFromContext(dctx, ctx), uniID, techProfMsg.TpInstancePath, tpInst.TpInstance, &wg)
dh.waitForCompletion(ctx, cancel, &wg, "TechProfDwld") //wait for background process to finish
if tpErr := dh.pOnuTP.GetTpProcessingErrorIndication(uniID, tpID); tpErr != nil {
logger.Errorw(ctx, "error-processing-tp", log.Fields{"device-id": dh.DeviceID, "err": tpErr, "tp-path": techProfMsg.TpInstancePath})
@@ -977,11 +977,9 @@
pDevEntry.MutexPersOnuConfig.RUnlock()
persMutexLock = false
techProfsFound = true // set to true if we found TP once for any UNI port
- var iaTechTpInst ia.TechProfileDownloadMessage
- var ok bool
for tpID := range uniData.PersTpPathMap {
pDevEntry.MutexReconciledTpInstances.RLock()
- if iaTechTpInst, ok = pDevEntry.ReconciledTpInstances[uniID][tpID]; !ok {
+ if _, ok := pDevEntry.ReconciledTpInstances[uniID][tpID]; !ok {
logger.Errorw(ctx, "reconciling - no reconciled tp instance available",
log.Fields{"tp-id": tpID, "tpPath": uniData.PersTpPathMap[tpID], "uni-id": uniData.PersUniID,
"device-id": dh.DeviceID})
@@ -989,12 +987,14 @@
pDevEntry.MutexReconciledTpInstances.RUnlock()
break outerLoop
}
+ // Access the TpInstance directly without copying the whole message
+ techTpInst := pDevEntry.ReconciledTpInstances[uniID][tpID].TechTpInstance
pDevEntry.MutexReconciledTpInstances.RUnlock()
continueWithFlowConfig = true // valid TP found - try flow configuration later
- var tpInst tech_profile.TechProfileInstance
- switch techTpInst := iaTechTpInst.TechTpInstance.(type) {
+ var tpInst *tech_profile.TechProfileInstance
+ switch tpInstCase := techTpInst.(type) {
case *ia.TechProfileDownloadMessage_TpInstance: // supports only GPON, XGPON, XGS-PON
- tpInst = *techTpInst.TpInstance
+ tpInst = tpInstCase.TpInstance
logger.Debugw(ctx, "reconciling - received-tp-instance-successfully-after-reconcile", log.Fields{
"tp-id": tpID, "tpPath": uniData.PersTpPathMap[tpID], "uni-id": uniData.PersUniID, "device-id": dh.DeviceID})
default: // do not support epon or other tech
@@ -1528,10 +1528,10 @@
break outerLoop
}
if iaTechTpInst != nil {
- var tpInst tech_profile.TechProfileInstance
+ var tpInst *tech_profile.TechProfileInstance
switch techTpInst := iaTechTpInst.TechTpInstance.(type) {
case *ia.TechProfileDownloadMessage_TpInstance: // supports only GPON, XGPON, XGS-PON
- tpInst = *techTpInst.TpInstance
+ tpInst = techTpInst.TpInstance
logger.Debugw(ctx, "received-tp-instance-successfully-after-reboot", log.Fields{
"tp-id": tpID, "tpPath": uniData.PersTpPathMap[tpID], "uni-id": uniData.PersUniID, "device-id": dh.DeviceID})
default: // do not support epon or other tech
@@ -4708,7 +4708,7 @@
logger.Errorw(ctx, "No valid OnuDevice", log.Fields{"device-id": dh.DeviceID})
} else {
onuDevEntry.MutexReconciledTpInstances.Lock()
- onuDevEntry.ReconciledTpInstances = make(map[uint8]map[uint8]ia.TechProfileDownloadMessage)
+ onuDevEntry.ReconciledTpInstances = make(map[uint8]map[uint8]*ia.TechProfileDownloadMessage)
onuDevEntry.MutexReconciledTpInstances.Unlock()
}
dh.chReconcilingStopped <- struct{}{}
@@ -4954,7 +4954,7 @@
subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), dh.config.MaxTimeoutInterAdapterComm)
defer cancel()
logger.Debugw(subCtx, "get-tech-profile-instance",
- log.Fields{"device-id": dh.device.Id, "request": request, "parent-endpoint": dh.device.ProxyAddress.AdapterEndpoint})
+ log.Fields{"device-id": dh.device.Id, "tp-path": request.TpInstancePath, "uni-id": request.UniId, "parent-endpoint": dh.device.ProxyAddress.AdapterEndpoint})
return pgClient.GetTechProfileInstance(subCtx, &request)
}
@@ -5079,7 +5079,7 @@
return err
}
-func (dh *deviceHandler) CheckAvailableOnuCapabilities(ctx context.Context, pDevEntry *mib.OnuDeviceEntry, tpInst tech_profile.TechProfileInstance) error {
+func (dh *deviceHandler) CheckAvailableOnuCapabilities(ctx context.Context, pDevEntry *mib.OnuDeviceEntry, tpInst *tech_profile.TechProfileInstance) error {
// Check if there are additional TCONT instances necessary/available
pDevEntry.MutexPersOnuConfig.Lock()
if _, ok := pDevEntry.SOnuPersistentData.PersTcontMap[uint16(tpInst.UsScheduler.AllocId)]; !ok {
@@ -5325,7 +5325,7 @@
return dh.deviceDeleteCommChan
}
-func (dh *deviceHandler) processOnuIndication(ctx context.Context, onuInd *ia.OnuIndicationMessage) (*empty.Empty, error) {
+func (dh *deviceHandler) processOnuIndication(ctx context.Context, onuInd *ia.OnuIndicationMessage) (*emptypb.Empty, error) {
onuIndication := onuInd.OnuIndication
onuOperstate := onuIndication.GetOperState()
@@ -5371,7 +5371,7 @@
return nil, err
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
}
// PrepareForGarbageCollection - remove references to prepare for garbage collection
diff --git a/internal/pkg/core/openonu.go b/internal/pkg/core/openonu.go
index 9d43be4..f1d97c6 100755
--- a/internal/pkg/core/openonu.go
+++ b/internal/pkg/core/openonu.go
@@ -41,7 +41,6 @@
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
- "github.com/golang/protobuf/ptypes/empty"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
"github.com/opencord/voltha-lib-go/v7/pkg/events/eventif"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
@@ -50,6 +49,7 @@
ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
"github.com/opencord/voltha-protos/v5/go/omci"
"github.com/opencord/voltha-protos/v5/go/voltha"
+ "google.golang.org/protobuf/types/known/emptypb"
cmn "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/common"
"github.com/opencord/voltha-openonu-adapter-go/internal/pkg/config"
@@ -66,6 +66,7 @@
// OpenONUAC structure holds the ONU core information
type OpenONUAC struct {
+ adapter_service.UnimplementedAdapterServiceServer
eventProxy eventif.EventProxy
kvClient kvstore.Client
deviceHandlers map[string]*deviceHandler
@@ -244,7 +245,7 @@
}
// AdoptDevice creates a new device handler if not present already and then adopts the device
-func (oo *OpenONUAC) AdoptDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) {
+func (oo *OpenONUAC) AdoptDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
if device == nil {
logger.Warn(ctx, "voltha-device-is-nil")
return nil, errors.New("nil-device")
@@ -264,11 +265,11 @@
go handler.adoptOrReconcileDevice(fsmCtx, device)
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
}
// ReconcileDevice is called once when the adapter needs to re-create device - usually on core restart
-func (oo *OpenONUAC) ReconcileDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) {
+func (oo *OpenONUAC) ReconcileDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
if device == nil {
logger.Warn(ctx, "reconcile-device-voltha-device-is-nil")
return nil, errors.New("nil-device")
@@ -298,17 +299,17 @@
// reconcilement will be continued after onu-device entry is added
} else {
logger.Warnf(ctx, "device-already-reconciled-or-active", log.Fields{"device-id": device.Id, "parent-id": device.ParentId})
- return &empty.Empty{}, status.Errorf(codes.AlreadyExists, "handler exists: %s", device.Id)
+ return &emptypb.Empty{}, status.Errorf(codes.AlreadyExists, "handler exists: %s", device.Id)
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
}
// DisableDevice disables the given device
-func (oo *OpenONUAC) DisableDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) {
+func (oo *OpenONUAC) DisableDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
logger.Infow(ctx, "disable-device", log.Fields{"device-id": device.Id})
if handler, err := oo.getDeviceHandler(ctx, device.Id, false); handler != nil {
go handler.disableDevice(log.WithSpanFromContext(context.Background(), ctx), device)
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
} else {
logger.Warnw(ctx, "no handler found for device-disable", log.Fields{"device-id": device.Id})
return nil, err
@@ -316,11 +317,11 @@
}
// ReEnableDevice enables the onu device after disable
-func (oo *OpenONUAC) ReEnableDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) {
+func (oo *OpenONUAC) ReEnableDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
logger.Infow(ctx, "reenable-device", log.Fields{"device-id": device.Id})
if handler, err := oo.getDeviceHandler(ctx, device.Id, false); handler != nil {
go handler.reEnableDevice(log.WithSpanFromContext(context.Background(), ctx), device)
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
} else {
logger.Warnw(ctx, "no handler found for device-reenable", log.Fields{"device-id": device.Id})
return nil, err
@@ -328,14 +329,14 @@
}
// RebootDevice reboots the given device
-func (oo *OpenONUAC) RebootDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) {
+func (oo *OpenONUAC) RebootDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
logger.Infow(ctx, "reboot-device", log.Fields{"device-id": device.Id})
if handler, err := oo.getDeviceHandler(ctx, device.Id, false); handler != nil {
err := handler.rebootDevice(log.WithSpanFromContext(context.Background(), ctx), true, device) //reboot request with device checking
if err != nil {
return nil, err
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
} else {
logger.Warnw(ctx, "no handler found for device-reboot", log.Fields{"device-id": device.Id})
return nil, err
@@ -343,7 +344,7 @@
}
// DeleteDevice deletes the given device
-func (oo *OpenONUAC) DeleteDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) {
+func (oo *OpenONUAC) DeleteDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
nctx := log.WithSpanFromContext(context.Background(), ctx)
logger.Infow(ctx, "delete-device", log.Fields{"device-id": device.Id, "SerialNumber": device.SerialNumber, "ctx": ctx, "nctx": nctx})
@@ -404,7 +405,7 @@
oo.deleteDeviceHandlerToMap(handler)
handler.PrepareForGarbageCollection(ctx, handler.DeviceID)
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
} else {
errMsg := fmt.Sprintf("Device Handler not found -%s with error %s", device.Id, err)
logger.Error(ctx, errMsg)
@@ -413,7 +414,7 @@
}
// UpdateFlowsIncrementally updates (add/remove) the flows on a given device
-func (oo *OpenONUAC) UpdateFlowsIncrementally(ctx context.Context, incrFlows *ca.IncrementalFlows) (*empty.Empty, error) {
+func (oo *OpenONUAC) UpdateFlowsIncrementally(ctx context.Context, incrFlows *ca.IncrementalFlows) (*emptypb.Empty, error) {
logger.Infow(ctx, "update-flows-incrementally", log.Fields{"device-id": incrFlows.Device.Id})
//flow config is relayed to handler even if the device might be in some 'inactive' state
@@ -436,7 +437,7 @@
if flowUpdateErr := handler.FlowUpdateIncremental(ctx, incrFlows.Flows, incrFlows.Groups, incrFlows.FlowMetadata); flowUpdateErr != nil {
return nil, flowUpdateErr
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
} else {
logger.Warnw(ctx, "no handler found for incremental flow update", log.Fields{"device-id": incrFlows.Device.Id})
return nil, err
@@ -444,13 +445,13 @@
}
// UpdatePmConfig returns PmConfigs nil or error
-func (oo *OpenONUAC) UpdatePmConfig(ctx context.Context, configs *ca.PmConfigsInfo) (*empty.Empty, error) {
+func (oo *OpenONUAC) UpdatePmConfig(ctx context.Context, configs *ca.PmConfigsInfo) (*emptypb.Empty, error) {
logger.Infow(ctx, "update-pm-config", log.Fields{"device-id": configs.DeviceId})
if handler, err := oo.getDeviceHandler(ctx, configs.DeviceId, false); handler != nil {
if pmConfigErr := handler.updatePmConfig(log.WithSpanFromContext(context.Background(), ctx), configs.PmConfigs); pmConfigErr != nil {
return nil, pmConfigErr
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
} else {
logger.Warnw(ctx, "no handler found for update-pm-config", log.Fields{"device-id": configs.DeviceId})
return nil, err
@@ -518,9 +519,9 @@
return handler.GetUniPortStatus(ctx, reqType.UniInfo), nil
case *extension.GetValueRequest_OnuOpticalInfo:
CommChan := make(chan cmn.Message)
- respChan := make(chan extension.SingleGetValueResponse)
+ respChan := make(chan *extension.SingleGetValueResponse)
// Initiate the self test request
- if selfTestErr := handler.pSelfTestHdlr.SelfTestRequestStart(ctx, *request, CommChan, respChan); selfTestErr != nil {
+ if selfTestErr := handler.pSelfTestHdlr.SelfTestRequestStart(ctx, request, CommChan, respChan); selfTestErr != nil {
return &extension.SingleGetValueResponse{
Response: &extension.GetValueResponse{
Status: extension.GetValueResponse_ERROR,
@@ -530,7 +531,7 @@
}
// The timeout handling is already implemented in omci_self_test_handler module
resp := <-respChan
- return &resp, nil
+ return resp, nil
case *extension.GetValueRequest_OnuInfo:
return handler.getOnuOMCICounters(ctx, reqType.OnuInfo), nil
case *extension.GetValueRequest_OnuOmciStats:
@@ -958,7 +959,7 @@
*/
// OnuIndication is part of the ONU Inter-adapter service API.
-func (oo *OpenONUAC) OnuIndication(ctx context.Context, onuInd *ia.OnuIndicationMessage) (*empty.Empty, error) {
+func (oo *OpenONUAC) OnuIndication(ctx context.Context, onuInd *ia.OnuIndicationMessage) (*emptypb.Empty, error) {
logger.Debugw(ctx, "onu-indication", log.Fields{"onu-indication": onuInd})
if onuInd == nil || onuInd.OnuIndication == nil {
@@ -984,21 +985,21 @@
}
// OmciIndication is part of the ONU Inter-adapter service API.
-func (oo *OpenONUAC) OmciIndication(ctx context.Context, msg *ia.OmciMessage) (*empty.Empty, error) {
+func (oo *OpenONUAC) OmciIndication(ctx context.Context, msg *ia.OmciMessage) (*emptypb.Empty, error) {
logger.Debugw(ctx, "omci-response", log.Fields{"parent-device-id": msg.ParentDeviceId, "child-device-id": msg.ChildDeviceId})
if handler, err := oo.getDeviceHandler(ctx, msg.ChildDeviceId, false); handler != nil {
if omciIndErr := handler.handleOMCIIndication(log.WithSpanFromContext(context.Background(), ctx), msg); omciIndErr != nil {
return nil, omciIndErr
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
} else {
return nil, err
}
}
// DownloadTechProfile is part of the ONU Inter-adapter service API.
-func (oo *OpenONUAC) DownloadTechProfile(ctx context.Context, tProfile *ia.TechProfileDownloadMessage) (*empty.Empty, error) {
+func (oo *OpenONUAC) DownloadTechProfile(ctx context.Context, tProfile *ia.TechProfileDownloadMessage) (*emptypb.Empty, error) {
logger.Info(ctx, "download-tech-profile", log.Fields{"device-id": tProfile.DeviceId, "uni-id": tProfile.UniId})
if handler, err := oo.getDeviceHandler(ctx, tProfile.DeviceId, false); handler != nil {
@@ -1013,14 +1014,14 @@
if tpDownloadErr := handler.handleTechProfileDownloadRequest(log.WithSpanFromContext(context.Background(), ctx), tProfile); tpDownloadErr != nil {
return nil, tpDownloadErr
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
} else {
return nil, err
}
}
// DeleteGemPort is part of the ONU Inter-adapter service API.
-func (oo *OpenONUAC) DeleteGemPort(ctx context.Context, gPort *ia.DeleteGemPortMessage) (*empty.Empty, error) {
+func (oo *OpenONUAC) DeleteGemPort(ctx context.Context, gPort *ia.DeleteGemPortMessage) (*emptypb.Empty, error) {
logger.Debugw(ctx, "delete-gem-port", log.Fields{"device-id": gPort.DeviceId, "uni-id": gPort.UniId})
if handler, _ := oo.getDeviceHandler(ctx, gPort.DeviceId, false); handler != nil {
if handler.GetDeletionInProgress() {
@@ -1034,11 +1035,11 @@
logger.Debugw(ctx, "deviceHandler not found", log.Fields{"device-id": gPort.DeviceId})
// delete requests for objects of an already deleted ONU should be acknowledged positively - continue
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
}
// DeleteTCont is part of the ONU Inter-adapter service API.
-func (oo *OpenONUAC) DeleteTCont(ctx context.Context, tConf *ia.DeleteTcontMessage) (*empty.Empty, error) {
+func (oo *OpenONUAC) DeleteTCont(ctx context.Context, tConf *ia.DeleteTcontMessage) (*emptypb.Empty, error) {
logger.Debugw(ctx, "delete-tcont", log.Fields{"device-id": tConf.DeviceId, "tconf": tConf})
if handler, _ := oo.getDeviceHandler(ctx, tConf.DeviceId, false); handler != nil {
if handler.GetDeletionInProgress() {
@@ -1052,7 +1053,7 @@
logger.Debugw(ctx, "deviceHandler not found", log.Fields{"device-id": tConf.DeviceId})
// delete requests for objects of an already deleted ONU should be acknowledged positively - continue
}
- return &empty.Empty{}, nil
+ return &emptypb.Empty{}, nil
}
/*
@@ -1296,7 +1297,7 @@
}
// SetExtValue is unimplemented
-func (oo *OpenONUAC) SetExtValue(context.Context, *ca.SetExtValueMessage) (*empty.Empty, error) {
+func (oo *OpenONUAC) SetExtValue(context.Context, *ca.SetExtValueMessage) (*emptypb.Empty, error) {
return nil, errors.New("unImplemented")
}
@@ -1332,12 +1333,12 @@
}
// SuppressEvent unimplemented
-func (oo *OpenONUAC) SuppressEvent(ctx context.Context, filter *voltha.EventFilter) (*empty.Empty, error) {
+func (oo *OpenONUAC) SuppressEvent(ctx context.Context, filter *voltha.EventFilter) (*emptypb.Empty, error) {
return nil, errors.New("unImplemented")
}
// UnSuppressEvent unimplemented
-func (oo *OpenONUAC) UnSuppressEvent(ctx context.Context, filter *voltha.EventFilter) (*empty.Empty, error) {
+func (oo *OpenONUAC) UnSuppressEvent(ctx context.Context, filter *voltha.EventFilter) (*emptypb.Empty, error) {
return nil, errors.New("unImplemented")
}
@@ -1357,27 +1358,27 @@
}
// UpdateFlowsBulk is unimplemented
-func (oo *OpenONUAC) UpdateFlowsBulk(ctx context.Context, flows *ca.BulkFlows) (*empty.Empty, error) {
+func (oo *OpenONUAC) UpdateFlowsBulk(ctx context.Context, flows *ca.BulkFlows) (*emptypb.Empty, error) {
return nil, errors.New("unImplemented")
}
// SelfTestDevice unimplented
-func (oo *OpenONUAC) SelfTestDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) {
+func (oo *OpenONUAC) SelfTestDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
return nil, errors.New("unImplemented")
}
// SendPacketOut sends packet out to the device
-func (oo *OpenONUAC) SendPacketOut(ctx context.Context, packet *ca.PacketOut) (*empty.Empty, error) {
+func (oo *OpenONUAC) SendPacketOut(ctx context.Context, packet *ca.PacketOut) (*emptypb.Empty, error) {
return nil, errors.New("unImplemented")
}
// EnablePort to Enable PON/NNI interface - seems not to be used/required according to python code
-func (oo *OpenONUAC) EnablePort(ctx context.Context, port *voltha.Port) (*empty.Empty, error) {
+func (oo *OpenONUAC) EnablePort(ctx context.Context, port *voltha.Port) (*emptypb.Empty, error) {
return nil, errors.New("unImplemented")
}
// DisablePort to Disable pon/nni interface - seems not to be used/required according to python code
-func (oo *OpenONUAC) DisablePort(ctx context.Context, port *voltha.Port) (*empty.Empty, error) {
+func (oo *OpenONUAC) DisablePort(ctx context.Context, port *voltha.Port) (*emptypb.Empty, error) {
return nil, errors.New("unImplemented")
}
@@ -1387,7 +1388,31 @@
}
// ChildDeviceLost - unimplemented
-func (oo *OpenONUAC) ChildDeviceLost(ctx context.Context, childDevice *voltha.Device) (*empty.Empty, error) {
+func (oo *OpenONUAC) ChildDeviceLost(ctx context.Context, childDevice *voltha.Device) (*emptypb.Empty, error) {
+ return nil, errors.New("unImplemented")
+}
+
+// DisableOnuDevice - disable ONU device
+func (oo *OpenONUAC) DisableOnuDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
+ logger.Infow(ctx, "disable-onu-device", log.Fields{"device-id": device.Id})
+ return oo.DisableDevice(ctx, device)
+}
+
+// EnableOnuDevice - enable ONU device
+func (oo *OpenONUAC) EnableOnuDevice(ctx context.Context, device *voltha.Device) (*emptypb.Empty, error) {
+ logger.Infow(ctx, "enable-onu-device", log.Fields{"device-id": device.Id})
+ return oo.ReEnableDevice(ctx, device)
+}
+
+// DisableOnuSerialNumber - disable ONU by serial number
+func (oo *OpenONUAC) DisableOnuSerialNumber(ctx context.Context, serialNumber *voltha.OnuSerialNumberOnOLTPon) (*emptypb.Empty, error) {
+ logger.Infow(ctx, "disable-onu-serial-number", log.Fields{"serial-number": serialNumber.SerialNumber})
+ return nil, errors.New("unImplemented")
+}
+
+// EnableOnuSerialNumber - enable ONU by serial number
+func (oo *OpenONUAC) EnableOnuSerialNumber(ctx context.Context, serialNumber *voltha.OnuSerialNumberOnOLTPon) (*emptypb.Empty, error) {
+ logger.Infow(ctx, "enable-onu-serial-number", log.Fields{"serial-number": serialNumber.SerialNumber})
return nil, errors.New("unImplemented")
}
diff --git a/internal/pkg/core/openonuInterAdapter.go b/internal/pkg/core/openonuInterAdapter.go
index d57f5f0..68e562d 100644
--- a/internal/pkg/core/openonuInterAdapter.go
+++ b/internal/pkg/core/openonuInterAdapter.go
@@ -22,16 +22,17 @@
"fmt"
"time"
- "github.com/golang/protobuf/ptypes/empty"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
"github.com/opencord/voltha-protos/v5/go/common"
"github.com/opencord/voltha-protos/v5/go/health"
ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
"github.com/opencord/voltha-protos/v5/go/onu_inter_adapter_service"
+ "google.golang.org/protobuf/types/known/emptypb"
)
// OpenONUACInterAdapter structure holds a reference to ONU adapter
type OpenONUACInterAdapter struct {
+ onu_inter_adapter_service.UnimplementedOnuInterAdapterServiceServer
onuAdapter *OpenONUAC
exitChannel chan struct{}
}
@@ -48,27 +49,27 @@
}
// OnuIndication redirects the request the the core ONU adapter handler
-func (oo *OpenONUACInterAdapter) OnuIndication(ctx context.Context, onuInd *ia.OnuIndicationMessage) (*empty.Empty, error) {
+func (oo *OpenONUACInterAdapter) OnuIndication(ctx context.Context, onuInd *ia.OnuIndicationMessage) (*emptypb.Empty, error) {
return oo.onuAdapter.OnuIndication(ctx, onuInd)
}
// OmciIndication redirects the request the the core ONU adapter handler
-func (oo *OpenONUACInterAdapter) OmciIndication(ctx context.Context, msg *ia.OmciMessage) (*empty.Empty, error) {
+func (oo *OpenONUACInterAdapter) OmciIndication(ctx context.Context, msg *ia.OmciMessage) (*emptypb.Empty, error) {
return oo.onuAdapter.OmciIndication(ctx, msg)
}
// DownloadTechProfile redirects the request the the core ONU adapter handler
-func (oo *OpenONUACInterAdapter) DownloadTechProfile(ctx context.Context, tProfile *ia.TechProfileDownloadMessage) (*empty.Empty, error) {
+func (oo *OpenONUACInterAdapter) DownloadTechProfile(ctx context.Context, tProfile *ia.TechProfileDownloadMessage) (*emptypb.Empty, error) {
return oo.onuAdapter.DownloadTechProfile(ctx, tProfile)
}
// DeleteGemPort redirects the request the the core ONU adapter handler
-func (oo *OpenONUACInterAdapter) DeleteGemPort(ctx context.Context, gPort *ia.DeleteGemPortMessage) (*empty.Empty, error) {
+func (oo *OpenONUACInterAdapter) DeleteGemPort(ctx context.Context, gPort *ia.DeleteGemPortMessage) (*emptypb.Empty, error) {
return oo.onuAdapter.DeleteGemPort(ctx, gPort)
}
// DeleteTCont redirects the request the the core ONU adapter handler
-func (oo *OpenONUACInterAdapter) DeleteTCont(ctx context.Context, tConf *ia.DeleteTcontMessage) (*empty.Empty, error) {
+func (oo *OpenONUACInterAdapter) DeleteTCont(ctx context.Context, tConf *ia.DeleteTcontMessage) (*emptypb.Empty, error) {
return oo.onuAdapter.DeleteTCont(ctx, tConf)
}