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/grpc_service.go b/core/grpc_service.go
index 6c07833..f7bf672 100644
--- a/core/grpc_service.go
+++ b/core/grpc_service.go
@@ -25,6 +25,7 @@
"gerrit.opencord.org/voltha-bbsim/protos"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
+ omci "github.com/opencord/omci-sim"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc"
@@ -138,14 +139,27 @@
}
func (s *Server) FlowAdd(c context.Context, flow *openolt.Flow) (*openolt.Empty, error) {
+ logger.Debug("OLT %d receives FlowAdd() IntfID:%d OnuID:%d EType:%x:.", s.Olt.ID, flow.AccessIntfId, flow.OnuId, flow.Classifier.EthType)
+ onu, err := s.GetOnuByID(uint32(flow.OnuId))
- onu, _ := s.GetOnuByID(uint32(flow.OnuId))
+ if err == nil {
+ intfid := onu.IntfID
+ onuid := onu.OnuID
- utils.LoggerWithOnu(onu).WithFields(log.Fields{
- "olt": s.Olt.ID,
- "c_tag": flow.Action.IVid,
- }).Debug("OLT receives FlowAdd().")
+ utils.LoggerWithOnu(onu).WithFields(log.Fields{
+ "olt": s.Olt.ID,
+ "c_tag": flow.Action.IVid,
+ }).Debug("OLT receives FlowAdd().")
+ if flow.Classifier.EthType == uint32(layers.EthernetTypeEAPOL) {
+ omcistate := omci.GetOnuOmciState(onu.OnuID, onu.IntfID)
+ if omcistate == omci.DONE {
+ s.updateOnuIntState(intfid, onuid, device.ONU_OMCIACTIVE)
+ } else {
+ logger.Error("FlowAdd() OMCI state %d is not \"DONE\"", omci.GetOnuOmciState(onu.OnuID, onu.IntfID))
+ }
+ }
+ }
return new(openolt.Empty), nil
}