submgr 0.10.3 published

Changes:
* New troubeshooting tools available in the image during runtime (curl, ping, net-tools,
  tcpdump)
* RMr version 1.9.0 in use
* Bugfix related to concurrent read and write of internal hash maps

Change-Id: Id6a2a1da69860e15662d20f2f20cacb2a2dc1a40
Signed-off-by: Balint Uveges <balint.uveges@nokia.com>
diff --git a/Dockerfile b/Dockerfile
index 4ae45f0..e38c343 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,9 +25,9 @@
 WORKDIR /tmp
 
 # Install RMr shared library
-RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_1.6.0_amd64.deb/download.deb && dpkg -i rmr_1.6.0_amd64.deb && rm -rf rmr_1.6.0_amd64.deb
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_1.9.0_amd64.deb/download.deb && dpkg -i rmr_1.9.0_amd64.deb && rm -rf rmr_1.9.0_amd64.deb
 # Install RMr development header files
-RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_1.6.0_amd64.deb/download.deb && dpkg -i rmr-dev_1.6.0_amd64.deb && rm -rf rmr-dev_1.6.0_amd64.deb
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_1.9.0_amd64.deb/download.deb && dpkg -i rmr-dev_1.9.0_amd64.deb && rm -rf rmr-dev_1.9.0_amd64.deb
 
 # "PULLING LOG and COMPILING LOG"
 RUN git clone "https://gerrit.o-ran-sc.org/r/com/log" /opt/log && cd /opt/log && \
@@ -66,10 +66,10 @@
     /usr/local/go/bin/swagger generate client -f api/routing_manager.yaml -t pkg/ -m rtmgr_models -c rtmgr_client
 
 
+RUN /usr/local/go/bin/go mod tidy
 COPY pkg pkg
 COPY cmd cmd
 
-RUN /usr/local/go/bin/go mod tidy
 
 RUN git clone -b v0.0.8 "https://gerrit.o-ran-sc.org/r/ric-plt/xapp-frame" /tmp/xapp-frame
 COPY tmp/rmr.go /tmp/xapp-frame/pkg/xapp/rmr.go
@@ -85,6 +85,8 @@
 
 FROM ubuntu:18.04
 
+RUN apt update && apt install -y iputils-ping net-tools curl tcpdump
+
 COPY --from=submgrbuild /opt/bin/submgr /opt/submgr/config/submgr.yaml /
 COPY run_submgr.sh /
 COPY --from=submgrbuild /usr/local/include /usr/local/include
diff --git a/RELNOTES b/RELNOTES
index 72ef0b3..65553c9 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -1,3 +1,12 @@
+### v0.10.3
+* The following tools made available in the final docker image: iputils-ping, net-tools, curl and tcpdump
+
+### v0.10.2
+* Taking in use the most recent RMr version
+
+### v0.10.1
+* Sequential execution of message handling to avoid parallel read/write of internal hash maps
+
 ### v0.10.0
 * Tracking Mbuf in transaction table
 
diff --git a/container-tag.yaml b/container-tag.yaml
index 68891cd..4cc4c24 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.10.0
+tag: 0.10.3
diff --git a/pkg/control/control.go b/pkg/control/control.go
index ec6419e..291075d 100644
--- a/pkg/control/control.go
+++ b/pkg/control/control.go
@@ -46,6 +46,7 @@
 	registry    *Registry
 	rtmgrClient *RtmgrClient
 	tracker     *Tracker
+	rc_chan     chan *xapp.RMRParams
 }
 
 type RMRMeid struct {
@@ -90,26 +91,16 @@
 	delete_handle := rtmgrhandle.NewDeleteXappSubscriptionHandleParamsWithTimeout(10 * time.Second)
 	rtmgrClient := RtmgrClient{client, handle, delete_handle}
 
-	return Control{new(E2ap), registry, &rtmgrClient, tracker}
+	return Control{new(E2ap), registry, &rtmgrClient, tracker, make(chan *xapp.RMRParams)}
 }
 
 func (c *Control) Run() {
+	go c.controlLoop()
 	xapp.Run(c)
 }
 
 func (c *Control) Consume(rp *xapp.RMRParams) (err error) {
-	switch rp.Mtype {
-	case C.RIC_SUB_REQ:
-		err = c.handleSubscriptionRequest(rp)
-	case C.RIC_SUB_RESP:
-		err = c.handleSubscriptionResponse(rp)
-	case C.RIC_SUB_DEL_REQ:
-		err = c.handleSubscriptionDeleteRequest(rp)
-	case C.RIC_SUB_DEL_RESP:
-		err = c.handleSubscriptionDeleteResponse(rp)
-	default:
-		err = errors.New("Message Type " + strconv.Itoa(rp.Mtype) + " is discarded")
-	}
+	c.rc_chan <- rp
 	return
 }
 
@@ -127,6 +118,25 @@
 	return
 }
 
+func (c *Control) controlLoop() {
+	for {
+		msg := <-c.rc_chan
+		switch msg.Mtype {
+			case C.RIC_SUB_REQ:
+				c.handleSubscriptionRequest(msg)
+			case C.RIC_SUB_RESP:
+				c.handleSubscriptionResponse(msg)
+			case C.RIC_SUB_DEL_REQ:
+				c.handleSubscriptionDeleteRequest(msg)
+			case C.RIC_SUB_DEL_RESP:
+				c.handleSubscriptionDeleteResponse(msg)
+			default:
+				err := errors.New("Message Type " + strconv.Itoa(msg.Mtype) + " is discarded")
+				xapp.Logger.Error("Unknown message type: %v", err)
+		}
+	}
+}
+
 func (c *Control) handleSubscriptionRequest(params *xapp.RMRParams) (err error) {
 	payload_seq_num, err := c.e2ap.GetSubscriptionRequestSequenceNumber(params.Payload)
 	if err != nil {