VOL-2395:  Update GEM pktin cache if value is different

Otherwise if the key is the same but the gem value changes
pkt out will fail

Change-Id: Iceb3865e8cfeaf8c7db7b1055e8c20289fe19b47
diff --git a/adaptercore/openolt_flowmgr.go b/adaptercore/openolt_flowmgr.go
index c16d44c..e34283a 100644
--- a/adaptercore/openolt_flowmgr.go
+++ b/adaptercore/openolt_flowmgr.go
@@ -2184,16 +2184,18 @@
 
 	f.lockCache.Lock()
 	defer f.lockCache.Unlock()
-	_, ok := f.packetInGemPort[pktInkey]
+	lookupGemPort, ok := f.packetInGemPort[pktInkey]
 	if ok {
-		log.Debugw("pktin key found in cache , no need to update kv as we are assuming both will be in sync",
-			log.Fields{"pktinkey": pktInkey, "gem": gemPort})
-	} else {
-		f.packetInGemPort[pktInkey] = gemPort
-
-		f.resourceMgr.UpdateGemPortForPktIn(pktInkey, gemPort)
-		log.Debugw("pktin key not found in local cache updating cache and kv store", log.Fields{"pktinkey": pktInkey, "gem": gemPort})
+		if lookupGemPort == gemPort {
+			log.Debugw("pktin key/value found in cache , no need to update kv as we are assuming both will be in sync",
+				log.Fields{"pktinkey": pktInkey, "gem": gemPort})
+			return
+		}
 	}
+	f.packetInGemPort[pktInkey] = gemPort
+
+	f.resourceMgr.UpdateGemPortForPktIn(pktInkey, gemPort)
+	log.Debugw("pktin key not found in local cache or value is different. updating cache and kv store", log.Fields{"pktinkey": pktInkey, "gem": gemPort})
 	return
 }