[VOL-2778] Fixing reboots
Change-Id: I9751a6a9abd83a1a45a809b1c32834d60ec22254
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index 0f78107..9116b31 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -62,7 +62,8 @@
// PortNo comes with flows and it's used when sending packetIndications,
// There is one PortNo per UNI Port, for now we're only storing the first one
// FIXME add support for multiple UNIs (each UNI has a different PortNo)
- PortNo uint32
+ PortNo uint32
+ // deprecated (gemPort is on a Service basis)
GemPortAdded bool
Flows []FlowKey
FlowIds []uint32 // keep track of the flows we currently have in the ONU
@@ -178,6 +179,12 @@
},
}
o.Channel <- msg
+
+ // Once the ONU is enabled start listening for packets
+ for _, s := range o.Services {
+ s.Initialize()
+ go s.HandlePackets(o.PonPort.Olt.OpenoltStream)
+ }
},
"enter_disabled": func(event *fsm.Event) {
@@ -186,7 +193,7 @@
o.PortNo = 0
o.Flows = []FlowKey{}
- // set the OpenState to disabled
+ // set the OperState to disabled
if err := o.OperState.Event("disable"); err != nil {
onuLogger.WithFields(log.Fields{
"OnuId": o.ID,
@@ -211,6 +218,10 @@
if len(o.FlowIds) == 0 {
close(o.Channel)
}
+
+ for _, s := range o.Services {
+ s.Disable()
+ }
},
// BBR states
"enter_eapol_flow_sent": func(e *fsm.Event) {
@@ -346,6 +357,7 @@
} else if msg.Type == packetHandlers.DHCP {
_ = dhcp.HandleNextBbrPacket(o.ID, o.PonPortID, o.Sn(), o.DoneChannel, msg.Packet, client)
}
+ // BBR specific messages
case OmciIndication:
msg, _ := message.Data.(OmciIndicationMessage)
o.handleOmci(msg, client)
@@ -454,6 +466,7 @@
if err := stream.Send(&openolt.Indication{Data: indData}); err != nil {
// NOTE do we need to transition to a broken state?
log.Errorf("Failed to send Indication_OnuInd: %v", err)
+ return
}
onuLogger.WithFields(log.Fields{
"IntfId": o.PonPortID,
@@ -463,10 +476,6 @@
"OnuSn": o.Sn(),
}).Debug("Sent Indication_OnuInd")
- for _, s := range o.Services {
- go s.HandlePackets(stream)
- }
-
}
func (o *Onu) publishOmciEvent(msg OmciMessage) {