VOL-1432 Segmentation error in GetGemPortID ()

Change-Id: Idca71daa1b54b86ab235d9caebacff4fee68bec1
diff --git a/core/core_server.go b/core/core_server.go
index c57a3e9..3e2a075 100644
--- a/core/core_server.go
+++ b/core/core_server.go
@@ -422,7 +422,10 @@
 			}
 
 			intfid := unipkt.Info.intfid
-			gemid, _ := getGemPortID(intfid, onuid)
+			gemid, err := getGemPortID(intfid, onuid)
+			if err != nil {
+				continue
+			}
 			pkt := unipkt.Pkt
 			layerEth := pkt.Layer(layers.LayerTypeEthernet)
 			le, _ := layerEth.(*layers.Ethernet)
@@ -565,8 +568,13 @@
 }
 
 func getGemPortID(intfid uint32, onuid uint32) (uint32, error) {
-	// FIXME - check for errors
-	return uint32(omci.GetGemPortId(intfid, onuid)), nil
+	logger.Debug("getGemPortID(intfid:%d, onuid:%d)", intfid, onuid)
+	gemportid, err := omci.GetGemPortId(intfid, onuid)
+	if err != nil {
+		logger.Error("%s", err)
+		return 0, err
+	}
+	return uint32(gemportid), nil
 }
 
 func getOnuBySN(onumap map[uint32][]*device.Onu, sn *openolt.SerialNumber) (*device.Onu, error) {
diff --git a/core/grpc_service.go b/core/grpc_service.go
index f7bf672..fe88a5a 100644
--- a/core/grpc_service.go
+++ b/core/grpc_service.go
@@ -152,7 +152,7 @@
 		}).Debug("OLT receives FlowAdd().")
 
 		if flow.Classifier.EthType == uint32(layers.EthernetTypeEAPOL) {
-			omcistate := omci.GetOnuOmciState(onu.OnuID, onu.IntfID)
+			omcistate := omci.GetOnuOmciState(onu.IntfID, onu.OnuID)
 			if omcistate == omci.DONE {
 				s.updateOnuIntState(intfid, onuid, device.ONU_OMCIACTIVE)
 			} else {