Skeleton code for Omci go routine

Change-Id: Ida34470b465c40f2e0bdaf47b0d1b38b4e8396b5
diff --git a/core/core_server.go b/core/core_server.go
index 6a32da3..48ac9a9 100644
--- a/core/core_server.go
+++ b/core/core_server.go
@@ -41,12 +41,6 @@
 	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
@@ -63,7 +57,8 @@
 	cancel       context.CancelFunc
 	state        coreState
 	stateChan    chan coreState
-	omciChan     chan OmciIndication
+	omciIn       chan OmciMsg
+	omciOut      chan OmciMsg
 }
 
 type Packet struct {
@@ -85,7 +80,7 @@
        <-              <-
 */
 
-func NewCore(opt *option) *Server {
+func NewCore(opt *option, omciOut chan OmciMsg, omciIn chan OmciMsg) *Server {
 	// TODO: make it decent
 	oltid := opt.oltid
 	npon := opt.npon
@@ -102,7 +97,8 @@
 		EnableServer: nil,
 		state:        INACTIVE,
 		stateChan:    make(chan coreState, 8),
-		omciChan:     make(chan OmciIndication, 8),
+		omciIn:       omciIn,
+		omciOut:      omciOut,
 	}
 
 	nnni := s.Olt.NumNniIntf
@@ -355,7 +351,7 @@
 	s.updateState(ACTIVE)
 	for {
 		select {
-		case msg := <-s.omciChan:
+		case msg := <-s.omciIn:
 			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 {
diff --git a/core/grpc_service.go b/core/grpc_service.go
index 5fd0e4f..9cd6fae 100644
--- a/core/grpc_service.go
+++ b/core/grpc_service.go
@@ -100,12 +100,12 @@
 }
 
 func (s *Server) OmciMsgOut(c context.Context, msg *openolt.OmciMsg) (*openolt.Empty, error) {
-	var resp OmciIndication
+	var resp OmciMsg
 	logger.Debug("OLT %d receives OmciMsgOut to IF %v (ONU-ID: %v) pkt:%x.", s.Olt.ID, msg.IntfId, msg.OnuId, msg.Pkt)
 	resp.IntfId = msg.IntfId
 	resp.OnuId = msg.OnuId
 	resp.Pkt = make([]byte, len(msg.Pkt))
-	s.omciChan <- resp
+	s.omciOut <- resp
 	return new(openolt.Empty), nil
 }
 
diff --git a/core/mediator.go b/core/mediator.go
index ee25264..0ad0696 100644
--- a/core/mediator.go
+++ b/core/mediator.go
@@ -125,7 +125,10 @@
 func (m *mediator) Start() {
 	var wg sync.WaitGroup
 	opt := m.opt
-	server := NewCore(opt)
+	omciOut := make(chan OmciMsg, 8)
+	omciIn := make(chan OmciMsg, 8)
+	go OmciRun(omciOut, omciIn)
+	server := NewCore(opt, omciOut, omciIn)
 	wg.Add(1)
 	go func() {
 		if err := server.Start(); err != nil { //Blocking