[VOL-3084][VOL-3097] Added support for ONU Re-Discovery and OLT PON Port Disable/Enable
Change-Id: I21f20ffc5edc95652946007baffa4b22ecfd9b92
diff --git a/internal/bbsim/devices/pon.go b/internal/bbsim/devices/pon.go
index c2847b1..d1f7d2a 100644
--- a/internal/bbsim/devices/pon.go
+++ b/internal/bbsim/devices/pon.go
@@ -78,17 +78,44 @@
} else if e.Src == "disabled" {
for _, onu := range ponPort.Onus {
if onu.InternalState.Current() == "pon_disabled" {
- if err := onu.InternalState.Event("discover"); err != nil {
- log.Errorf("Error discover ONU: %v", err)
+ if err := onu.InternalState.Event("enable"); err != nil {
+ log.WithFields(log.Fields{
+ "Err": err,
+ "OnuSn": onu.Sn(),
+ "IntfId": onu.PonPortID,
+ }).Error("Error enabling ONU")
}
} else if onu.InternalState.Current() == "disabled" {
if err := onu.InternalState.Event("initialize"); err != nil {
- log.Errorf("Error initialize ONU: %v", err)
+ log.WithFields(log.Fields{
+ "Err": err,
+ "OnuSn": onu.Sn(),
+ "IntfId": onu.PonPortID,
+ }).Error("Error initializing ONU")
continue
}
if err := onu.InternalState.Event("discover"); err != nil {
- log.Errorf("Error discover ONU: %v", err)
+ log.WithFields(log.Fields{
+ "Err": err,
+ "OnuSn": onu.Sn(),
+ "IntfId": onu.PonPortID,
+ }).Error("Error discovering ONU")
}
+ } else if onu.InternalState.Current() == "initialized" {
+ if err := onu.InternalState.Event("discover"); err != nil {
+ log.WithFields(log.Fields{
+ "Err": err,
+ "OnuSn": onu.Sn(),
+ "IntfId": onu.PonPortID,
+ }).Error("Error discovering ONU")
+ }
+ } else {
+ // this is to loudly report unexpected states in order to address them
+ log.WithFields(log.Fields{
+ "OnuSn": onu.Sn(),
+ "IntfId": onu.PonPortID,
+ "InternalState": onu.InternalState.Current(),
+ }).Error("Unexpected ONU state in PON enabling")
}
}
}