[VOL-4339] OLT Adapter restart is not working

Change-Id: Iab27701b2e19785d2a9fa7d2af0e671c1286ad93
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index 61da77d..b79a591 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -262,7 +262,7 @@
 	onuIDEnd := flowMgr.deviceHandler.deviceInfo.OnuIdEnd
 	for onuID := onuIDStart; onuID <= onuIDEnd; onuID++ {
 		// check for a valid serial number in onuGem as GetOnuGemInfo can return nil error in case of nothing found in the path.
-		onugem, err := rMgr.GetOnuGemInfo(ctx, onuID, ponPortIdx)
+		onugem, err := rMgr.GetOnuGemInfo(ctx, ponPortIdx, onuID)
 		if err == nil && onugem != nil && onugem.SerialNumber != "" {
 			flowMgr.onuGemInfoMap[onuID] = onugem
 		}
@@ -3311,7 +3311,7 @@
 	for _, og := range f.onuGemInfoMap {
 		for _, gem := range og.GemPorts {
 			flowIDs, err := f.resourceMgr.GetFlowIDsForGem(ctx, f.ponPortIdx, gem)
-			if err != nil {
+			if err == nil {
 				f.gemToFlowIDs[gem] = flowIDs
 				for _, flowID := range flowIDs {
 					if _, ok := f.flowIDToGems[flowID]; !ok {