Add hooks for sending omci indication

Change-Id: I0b21aa7e41dd14e9613fb3ab41142825527a75ac
diff --git a/common/logger/logger.go b/common/logger/logger.go
index b53e86d..cf391bf 100644
--- a/common/logger/logger.go
+++ b/common/logger/logger.go
@@ -30,7 +30,7 @@
 func Setup(kafkaBroker string, level string) {
 
 	logger := log.New()
-	logger.SetReportCaller(true)
+	//logger.SetReportCaller(true)
 	myLogger = logger.WithField("topics", []string{"bbsim.log"})
 
 	// TODO make this configurable via cli arg
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" {
diff --git a/core/grpc_service.go b/core/grpc_service.go
index d833104..5fd0e4f 100644
--- a/core/grpc_service.go
+++ b/core/grpc_service.go
@@ -100,8 +100,12 @@
 }
 
 func (s *Server) OmciMsgOut(c context.Context, msg *openolt.OmciMsg) (*openolt.Empty, error) {
+	var resp OmciIndication
 	logger.Debug("OLT %d receives OmciMsgOut to IF %v (ONU-ID: %v) pkt:%x.", s.Olt.ID, msg.IntfId, msg.OnuId, msg.Pkt)
-	//s.olt.Queue = append(s.olt.Queue, *msg)
+	resp.IntfId = msg.IntfId
+	resp.OnuId = msg.OnuId
+	resp.Pkt = make([]byte, len(msg.Pkt))
+	s.omciChan <- resp
 	return new(openolt.Empty), nil
 }