Added some more checks for E2T create handling and RMR update to v4.8.0

Change-Id: I153ec1fd4a5a81d29fe01f1bac0e7e667091ec41
Signed-off-by: wahidw <abdulwahid.w@nokia.com>
diff --git a/Dockerfile b/Dockerfile
index d479183..6963a30 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,7 +26,7 @@
 FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu20-c-go:1.0.0 as rtmgrbuild
 
 # Install RMr shared library
-ARG RMRVERSION=4.7.4
+ARG RMRVERSION=4.8.0
 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb && rm -rf rmr_${RMRVERSION}_amd64.deb
 # Install RMr development header files
 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb && rm -rf rmr-dev_${RMRVERSION}_amd64.deb
diff --git a/RELNOTES b/RELNOTES
index 8c62e10..d68b57f 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -1,3 +1,6 @@
+### v0.8.2
+* Added some checks for E2tcreate handling and RMR update to v4.8.0 
+
 ### v0.8.1
 * RIC-702: Clean-up logging in routing manager
 
diff --git a/container-tag.yaml b/container-tag.yaml
index 2a12ede..2810342 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.8.1
+tag: 0.8.2
diff --git a/pkg/nbi/control.go b/pkg/nbi/control.go
index 98d7821..bd1bf4b 100644
--- a/pkg/nbi/control.go
+++ b/pkg/nbi/control.go
@@ -244,9 +244,11 @@
 	go updateEp()
 	time.Sleep(5 * time.Second)
 	sendRoutesToAll()
-	/* Sometimes first message  fails, retry after 5 sec */
-	time.Sleep(5 * time.Second)
-	sendRoutesToAll()
+	for i := 0; i <= 5; i++ {
+		/* Sometimes first message  fails, retry after 5 sec */
+		time.Sleep(10 * time.Second)
+		sendRoutesToAll()
+	}
 
 	for {
 		xapp.Logger.Debug("Periodic Routes value = %s", xapp.Config.GetString("periodicroutes"))
diff --git a/pkg/nbi/httprestful.go b/pkg/nbi/httprestful.go
index 8222e72..794cee9 100644
--- a/pkg/nbi/httprestful.go
+++ b/pkg/nbi/httprestful.go
@@ -49,6 +49,7 @@
 	//"routing-manager/pkg/restapi/operations/handle"
 	"routing-manager/pkg/rpe"
 	"routing-manager/pkg/rtmgr"
+	"routing-manager/pkg/sbi"
 	"routing-manager/pkg/sdl"
 	"strconv"
 	"strings"
@@ -312,13 +313,18 @@
 	m.Unlock()
 	updateEp()
 	//sendPartialRoutesToAll(nil, rtmgr.E2Type)
+	sbi.Conn.Lock()
+	rtmgr.RMRConnStatus[*data.E2TAddress] = false
+	sbi.Conn.Unlock()
+
 	sendRoutesToAll()
 	time.Sleep(10 * time.Second)
-	for ep, value := range rtmgr.RMRConnStatus {
-		if ep == *data.E2TAddress && value == true {
-			rtmgr.RMRConnStatus[ep] = false //Reset to false incase of E2t restart scenario
-			return nil
-		}
+	if rtmgr.RMRConnStatus[*data.E2TAddress] == true {
+		sbi.Conn.Lock()
+		delete(rtmgr.RMRConnStatus, *data.E2TAddress)
+		sbi.Conn.Unlock()
+		xapp.Logger.Debug("RMRConnStatus Map after = %v", rtmgr.RMRConnStatus)
+		return nil
 	}
 
 	return errors.New("Error while adding new E2T " + *data.E2TAddress)
diff --git a/pkg/sbi/nngpush.go b/pkg/sbi/nngpush.go
index 7ba43c5..0d9634e 100644
--- a/pkg/sbi/nngpush.go
+++ b/pkg/sbi/nngpush.go
@@ -50,7 +50,7 @@
 var rmrdynamiccallid = 201
 var addendpointct = 1
 var count int
-var conn sync.Mutex
+var Conn sync.Mutex
 
 type RmrPush struct {
 	Sbi
@@ -169,9 +169,9 @@
 		xapp.Logger.Error("Invoked  send_data to try again due to return value : %v", ret)
 	}
 
-	conn.Lock()
+	Conn.Lock()
 	rtmgr.RMRConnStatus[ep.Uuid] = ret
-	conn.Unlock()
+	Conn.Unlock()
 	// Handling per connection .. may be updating global map
 
 	//channel <- EPStatus{ep.Uuid, ret}