VOL-4199: PM-Data: Fix Wrong oper_status and uni_admin_state in
metric event UNI-Status for disabled onu device
- Use AdministrativeState in ONUG ME to determine authoritative
admin state of the ONU and not internal states in bbsim.
Change-Id: I32a526fe5e918f22551d0918ab5b05ee5c9916b2
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index 17abfc3..7de3cc3 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -112,6 +112,8 @@
OperState *fsm.FSM
SerialNumber *openolt.SerialNumber
+ AdminLockState uint8 // 0 is enabled, 1 is disabled.
+
Channel chan bbsim.Message // this Channel is to track state changes OMCI messages, EAPOL and DHCP packets
// OMCI params
@@ -785,7 +787,7 @@
case omci.MibUploadNextRequestType:
responsePkt, _ = omcilib.CreateMibUploadNextResponse(msg.OmciPkt, msg.OmciMsg, o.MibDataSync, o.MibDb)
case omci.GetRequestType:
- onuDown := o.OperState.Current() == "down"
+ onuDown := o.AdminLockState == 1
responsePkt, _ = omcilib.CreateGetResponse(msg.OmciPkt, msg.OmciMsg, o.SerialNumber, o.MibDataSync, o.ActiveImageEntityId,
o.CommittedImageEntityId, o.StandbyImageVersion, o.ActiveImageVersion, o.CommittedImageVersion, onuDown)
case omci.SetRequestType:
@@ -819,6 +821,14 @@
}).Warn("cannot-change-uni-status")
}
}
+ case me.OnuGClassID:
+ o.AdminLockState = msgObj.Attributes["AdministrativeState"].(uint8)
+ onuLogger.WithFields(log.Fields{
+ "IntfId": o.PonPortID,
+ "OnuId": o.ID,
+ "SerialNumber": o.Sn(),
+ "AdminLockState": o.AdminLockState,
+ }).Debug("set-onu-admin-lock-state")
case me.TContClassID:
allocId := msgObj.Attributes["AllocId"].(uint16)