Address crashes when the ONU ID is not found and when IGMP state change fails.
Also allow re-joining from the igmp_started state.
Change-Id: I1e8690c8a2d1f4f5968ecd5339ee931044ff4700
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index 572507e..d08d934 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -1061,8 +1061,26 @@
}
func (o OltDevice) OmciMsgOut(ctx context.Context, omci_msg *openolt.OmciMsg) (*openolt.Empty, error) {
- pon, _ := o.GetPonById(omci_msg.IntfId)
- onu, _ := pon.GetOnuById(omci_msg.OnuId)
+ pon, err := o.GetPonById(omci_msg.IntfId)
+ if err != nil {
+ oltLogger.WithFields(log.Fields{
+ "error": err,
+ "onu_id": omci_msg.OnuId,
+ "pon_id": omci_msg.IntfId,
+ }).Error("pon ID not found")
+ return nil, err
+ }
+
+ onu, err := pon.GetOnuById(omci_msg.OnuId)
+ if err != nil {
+ oltLogger.WithFields(log.Fields{
+ "error": err,
+ "onu_id": omci_msg.OnuId,
+ "pon_id": omci_msg.IntfId,
+ }).Error("onu ID not found")
+ return nil, err
+ }
+
oltLogger.WithFields(log.Fields{
"IntfId": onu.PonPortID,
"OnuId": onu.ID,