VOL-1357 BBSim - OMCI status management
AddFlow() triggers the update of ONU status into ONU_OMCIACTIVE.
The ONU status update is notified to the mediator, and then, it activates the tester.
Change-Id: I1a077026b872868a74a4b5d9849b65cf52baeaa4
diff --git a/core/core_server.go b/core/core_server.go
index 2fc494b..c57a3e9 100644
--- a/core/core_server.go
+++ b/core/core_server.go
@@ -200,6 +200,15 @@
}
}
+func (s *Server) updateOnuIntState (intfid uint32, onuid uint32, state device.DeviceState) error {
+ onu, err := s.GetOnuByID(onuid) //TODO: IntfID should be included ?
+ if err != nil {
+ return err
+ }
+ s.updateDevIntState(onu, state)
+ return nil
+}
+
func (s *Server) activateOLT(stream openolt.Openolt_EnableIndicationServer) error {
defer logger.Debug("activateOLT() Done")
logger.Debug("activateOLT() Start")
@@ -368,6 +377,7 @@
defer func() {
close(unichannel)
logger.Debug("Closed unichannel ")
+ logger.Debug("runMainPktLoop Done")
}()
for intfid, _ := range s.Onumap {
for _, onu := range s.Onumap[intfid] {
@@ -418,7 +428,7 @@
le, _ := layerEth.(*layers.Ethernet)
ethtype := le.EthernetType
- if ethtype == 0x888e {
+ if ethtype == layers.EthernetTypeEAPOL {
utils.LoggerWithOnu(onu).WithFields(log.Fields{
"gemId": gemid,
}).Info("Received upstream packet is EAPOL.")
@@ -491,7 +501,7 @@
if layerEth != nil {
pkt, _ := layerEth.(*layers.Ethernet)
ethtype := pkt.EthernetType
- if ethtype == 0x888e {
+ if ethtype == layers.EthernetTypeEAPOL {
utils.LoggerWithOnu(onu).Info("Received downstream packet is EAPOL.")
} else if layerDHCP := rawpkt.Layer(layers.LayerTypeDHCPv4); layerDHCP != nil {
utils.LoggerWithOnu(onu).WithFields(log.Fields{
@@ -543,6 +553,17 @@
return true
}
+func (s *Server) isAllOnuOmciActive() bool {
+ for _, onus := range s.Onumap {
+ for _, onu := range onus{
+ if onu.GetIntState() != device.ONU_OMCIACTIVE {
+ return false
+ }
+ }
+ }
+ return true
+}
+
func getGemPortID(intfid uint32, onuid uint32) (uint32, error) {
// FIXME - check for errors
return uint32(omci.GetGemPortId(intfid, onuid)), nil