[VOL-4773] openonuAdapterGo: voltctl command to show ONU OMCI counter statistics
Change-Id: Id42a414333e293e4347e3e76d652fc1ec90723fe
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index e6236fc..ddbfe7a 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -3825,6 +3825,32 @@
return resp
}
+func (dh *deviceHandler) getOnuOMCIStats(ctx context.Context) (*extension.SingleGetValueResponse, error) {
+
+ var err error
+ var pDevOmciCC *cmn.OmciCC
+ if dh.pOnuOmciDevice == nil {
+ logger.Errorw(ctx, "No valid DeviceEntry", log.Fields{"device-id": dh.DeviceID})
+ err = fmt.Errorf("no-valid-DeviceEntry-%s", dh.DeviceID)
+ } else {
+ pDevOmciCC = dh.pOnuOmciDevice.GetDevOmciCC()
+ if pDevOmciCC == nil {
+ logger.Errorw(ctx, "No valid DeviceOmciCCEntry", log.Fields{"device-id": dh.DeviceID})
+ err = fmt.Errorf("no-valid-DeviceOmciCCEntry-%s", dh.DeviceID)
+ }
+ }
+ if err != nil {
+ return &extension.SingleGetValueResponse{
+ Response: &extension.GetValueResponse{
+ Status: extension.GetValueResponse_ERROR,
+ ErrReason: extension.GetValueResponse_INTERNAL_ERROR,
+ },
+ },
+ err
+ }
+ return pDevOmciCC.GetOmciCounters(), nil
+}
+
func (dh *deviceHandler) isFsmInOmciIdleState(ctx context.Context, PFsm *fsm.FSM, wantedState string) bool {
if PFsm == nil {
return true //FSM not active - so there is no activity on omci