fixed issue in meid table if same meid is associated with different E2T

Signed-off-by: Abdulwahid W <abdulwahid.w@nokia.com>
Change-Id: Ie8c4cdbd0a67bfd77fdd40c0d2cfccea8e788aaf
diff --git a/RELNOTES b/RELNOTES
index d68b57f..15d9ecf 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -1,3 +1,6 @@
+### v0.9.2
+* fixed issue in meid table if same meid is associated with different E2T 
+
 ### v0.8.2
 * Added some checks for E2tcreate handling and RMR update to v4.8.0 
 
diff --git a/container-tag.yaml b/container-tag.yaml
index 2479949..7898fd5 100644
--- a/container-tag.yaml
+++ b/container-tag.yaml
@@ -2,4 +2,4 @@
 # By default this file is in the docker build directory,
 # but the location can configured in the JJB template.
 ---
-tag: 0.9.1
+tag: 0.9.2
diff --git a/pkg/rpe/rmr.go b/pkg/rpe/rmr.go
index 5447693..87c0e2b 100644
--- a/pkg/rpe/rmr.go
+++ b/pkg/rpe/rmr.go
@@ -96,32 +96,34 @@
 	count := 0
 
 	rawrt = append(rawrt, key+"meid_map|start\n")
-	keys := make(map[string]RouteIndex)
+	
+	keys := make(map[string]MeidEntry)
+	MEID := ""
+	E2TIP := ""
+	RECTYP := ""
 	for _, value := range rcs.MeidMap {
-		if _, v := keys[key+value+"\n"]; !v {
-			rawrt = append(rawrt, key+value+"\n")
-			appendedindex := uint16(len(rawrt) - 1)
-			keys[key+value+"\n"] = RouteIndex{true, appendedindex}
-			count++
-		}
 		if strings.Contains(value, "mme_ar") {
 			tmpstr := strings.Split(value, "|")
-
 			//MEID entry for mme_ar must always contain 3 strings speartred by | i.e "mme_ar|<string1>|<string2>"
-			MEID := strings.TrimSuffix(tmpstr[2], "\n")
+			MEID = strings.TrimSuffix(tmpstr[2], "\n")
+			E2TIP = strings.TrimSuffix(tmpstr[1], "\n")
+			RECTYP = "mme_ar"
+		} else if strings.Contains(value, "mme_del") {
+			tmpstr := strings.Split(value, "|")
+			MEID = strings.TrimSuffix(tmpstr[1], "\n")
+			E2TIP = ""
+			RECTYP = "mme_del"
+		}
+		keys[MEID] = MeidEntry{RECTYP, E2TIP}
+	}
 
-			mapindex := "mme_del|" + MEID + "\n"
-			i := keys[mapindex].index
-			if keys[mapindex].flag {
-				//copy(rawrt[i:], rawrt[i+1:])
-				//rawrt[len(rawrt)-1] = ""
-				//rawrt = rawrt[:len(rawrt)-1]
-				rawrt[i] = ""
-				delete(keys, mapindex)
-				count--
-			}
+	for k, v := range keys {
+		if v.recordtype == "mme_ar" {
+			rawrt = append(rawrt, key+v.recordtype+"|"+v.e2tip+"|"+k+"\n")
+		    count++
 		}
 	}
+
 	rawrt = removeEmptyStrings(rawrt)
 	rawrt = append(rawrt, key+"meid_map|end|"+strconv.Itoa(count)+"\n")
 
diff --git a/pkg/rpe/types.go b/pkg/rpe/types.go
index 95cdf01..b7e1742 100644
--- a/pkg/rpe/types.go
+++ b/pkg/rpe/types.go
@@ -51,7 +51,7 @@
 	GeneratePartialPolicies(eps rtmgr.Endpoints, xappSubData *models.XappSubscriptionData, updatetype rtmgr.RMRUpdateType) *[]string
 }
 
-type RouteIndex struct {
-	flag  bool
-	index uint16
+type MeidEntry struct {
+	recordtype string
+	e2tip      string
 }