Add hooks for sending omci indication
Change-Id: I0b21aa7e41dd14e9613fb3ab41142825527a75ac
diff --git a/core/core_server.go b/core/core_server.go
index f00d72d..6a32da3 100644
--- a/core/core_server.go
+++ b/core/core_server.go
@@ -41,6 +41,12 @@
MAX_ONUS_PER_PON = 64 // This value should be the same with the value in AdapterPlatrorm class
)
+type OmciIndication struct {
+ IntfId uint32
+ OnuId uint32
+ Pkt []byte
+}
+
type Server struct {
wg *sync.WaitGroup
Olt *device.Olt
@@ -57,6 +63,7 @@
cancel context.CancelFunc
state coreState
stateChan chan coreState
+ omciChan chan OmciIndication
}
type Packet struct {
@@ -95,6 +102,7 @@
EnableServer: nil,
state: INACTIVE,
stateChan: make(chan coreState, 8),
+ omciChan: make(chan OmciIndication, 8),
}
nnni := s.Olt.NumNniIntf
@@ -347,6 +355,13 @@
s.updateState(ACTIVE)
for {
select {
+ case msg := <-s.omciChan:
+ logger.Debug("OLT %d send omci indication, IF %v (ONU-ID: %v) pkt:%x.", s.Olt.ID, msg.IntfId, msg.OnuId, msg.Pkt)
+ omci := &openolt.Indication_OmciInd{OmciInd: &openolt.OmciIndication{IntfId: msg.IntfId, OnuId: msg.OnuId, Pkt: msg.Pkt}}
+ if err := stream.Send(&openolt.Indication{Data: omci}); err != nil {
+ logger.Error("send omci indication failed.", err)
+ continue
+ }
case unipkt := <-unichannel:
logger.Debug("Received packet in grpc Server from UNI.")
if unipkt.Info == nil || unipkt.Info.iotype != "uni" {