RICPLT-3059 multi e2term crash in rmr library

Change-Id: I0b3c44d6767c891561a8fab4d2271137d4044f15
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
diff --git a/Dockerfile b/Dockerfile
index 0c36b03..6143fdb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -29,7 +29,7 @@
 
 WORKDIR /tmp
 
-ARG RMRVERSION=3.2.0
+ARG RMRVERSION=3.2.4
 # Install RMr shared library
 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/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
@@ -95,6 +95,7 @@
 COPY go.sum go.sum
 
 RUN go mod download
+RUN go mod tidy
 
 #
 #
@@ -114,6 +115,7 @@
 RUN mkdir -p /root/go && \
     swagger generate client -f api/routing_manager.yaml -t pkg/ -m rtmgr_models -c rtmgr_client
 
+
 #
 #
 #
diff --git a/go.mod b/go.mod
index 73f1fd0..8de80d1 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@
 
 require (
 	gerrit.o-ran-sc.org/r/ric-plt/e2ap v0.0.0-00010101000000-000000000000
-	gerrit.o-ran-sc.org/r/ric-plt/xapp-frame v0.0.23
+	gerrit.o-ran-sc.org/r/ric-plt/xapp-frame v0.0.28
 	github.com/go-openapi/errors v0.19.2
 	github.com/go-openapi/runtime v0.19.7
 	github.com/go-openapi/strfmt v0.19.3
@@ -15,7 +15,7 @@
 
 replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.2.0
 
-replace gerrit.o-ran-sc.org/r/ric-plt/xapp-frame => gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.23
+replace gerrit.o-ran-sc.org/r/ric-plt/xapp-frame => gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.28
 
 replace gerrit.o-ran-sc.org/r/com/golog => gerrit.o-ran-sc.org/r/com/golog.git v0.0.1
 
diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go
index 5d57832..53d8a85 100644
--- a/pkg/control/ut_messaging_test.go
+++ b/pkg/control/ut_messaging_test.go
@@ -61,7 +61,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -106,14 +106,14 @@
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
 	waiter.WaitResult(t)
 
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
 
 	waiter = rtmgrHttp.AllocNextEvent(true)
-	e2termConn.SendSubsDelResp(t, delreq, delmsg)
+	e2termConn1.SendSubsDelResp(t, delreq, delmsg)
 	xappConn1.RecvSubsDelResp(t, deltrans)
 	waiter.WaitResult(t)
 
@@ -122,7 +122,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -159,19 +159,19 @@
 
 	//Subs Create
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
 
 	seqBef := mainCtrl.get_msgcounter(t)
 	xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq
 	mainCtrl.wait_msgcounter_change(t, seqBef, 10)
 
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 
 	//Subs Delete
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq, delmsg)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq, delmsg)
 	xappConn1.RecvSubsDelResp(t, deltrans)
 
 	//Wait that subs is cleaned
@@ -179,7 +179,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -217,19 +217,19 @@
 
 	//Subs Create
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 
 	//Subs Delete
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
 
 	seqBef := mainCtrl.get_msgcounter(t)
 	xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq
 	mainCtrl.wait_msgcounter_change(t, seqBef, 10)
 
-	e2termConn.SendSubsDelResp(t, delreq, delmsg)
+	e2termConn1.SendSubsDelResp(t, delreq, delmsg)
 	xappConn1.RecvSubsDelResp(t, deltrans)
 
 	//Wait that subs is cleaned
@@ -237,7 +237,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -279,13 +279,13 @@
 
 	//Subs Create
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 
 	//Subs Delete
 	xappConn1.SendSubsDelReq(t, nil, e2SubsId)
-	delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
+	delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
 
 	// Subs Delete colliding
 	seqBef := mainCtrl.get_msgcounter(t)
@@ -294,7 +294,7 @@
 	mainCtrl.wait_msgcounter_change(t, seqBef, 10)
 
 	// Del resp for first and second
-	e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
+	e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
 
 	// don't care in which order responses are received
 	xappConn1.RecvSubsDelResp(t, nil)
@@ -305,46 +305,46 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
 //-----------------------------------------------------------------------------
 // TestSubReqAndSubDelOkTwoParallel
 //
-//   stub                          stub
-// +-------+     +---------+    +---------+
-// | xapp  |     | submgr  |    | e2term  |
-// +-------+     +---------+    +---------+
-//     |              |              |
-//     |              |              |
-//     |              |              |
-//     | SubReq1      |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubReq1      |
-//     |              |------------->|
-//     |              |              |
-//     | SubReq2      |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubReq2      |
-//     |              |------------->|
-//     |              |              |
-//     |              |    SubResp1  |
-//     |              |<-------------|
-//     |              |    SubResp2  |
-//     |              |<-------------|
-//     |              |              |
-//     |    SubResp1  |              |
-//     |<-------------|              |
-//     |    SubResp2  |              |
-//     |<-------------|              |
-//     |              |              |
-//     |        [SUBS 1 DELETE]      |
-//     |              |              |
-//     |        [SUBS 2 DELETE]      |
-//     |              |              |
+//   stub       stub                          stub
+// +-------+  +-------+     +---------+    +---------+
+// | xapp  |  | xapp  |     | submgr  |    | e2term  |
+// +-------+  +-------+     +---------+    +---------+
+//     |          |              |              |
+//     |          |              |              |
+//     |          |              |              |
+//     |          | SubReq1      |              |
+//     |          |------------->|              |
+//     |          |              |              |
+//     |          |              | SubReq1      |
+//     |          |              |------------->|
+//     |          |              |              |
+//     |       SubReq2           |              |
+//     |------------------------>|              |
+//     |          |              |              |
+//     |          |              | SubReq2      |
+//     |          |              |------------->|
+//     |          |              |              |
+//     |          |              |    SubResp1  |
+//     |          |              |<-------------|
+//     |          |    SubResp1  |              |
+//     |          |<-------------|              |
+//     |          |              |              |
+//     |          |              |    SubResp2  |
+//     |          |              |<-------------|
+//     |       SubResp2          |              |
+//     |<------------------------|              |
+//     |          |              |              |
+//     |          |        [SUBS 1 DELETE]      |
+//     |          |              |              |
+//     |          |        [SUBS 2 DELETE]      |
+//     |          |              |              |
 //
 //-----------------------------------------------------------------------------
 func TestSubReqAndSubDelOkTwoParallel(t *testing.T) {
@@ -355,42 +355,42 @@
 	rparams1.Init()
 	rparams1.Req.EventTriggerDefinition.ProcedureCode = 5
 	cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
-	crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
+	crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
 
 	//Req2
 	rparams2 := &teststube2ap.E2StubSubsReqParams{}
 	rparams2.Init()
 	rparams2.Req.EventTriggerDefinition.ProcedureCode = 28
 	cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
-	crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
+	crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
 
 	//Resp1
-	e2termConn.SendSubsResp(t, crereq1, cremsg1)
+	e2termConn1.SendSubsResp(t, crereq1, cremsg1)
 	e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
 
 	//Resp2
-	e2termConn.SendSubsResp(t, crereq2, cremsg2)
+	e2termConn1.SendSubsResp(t, crereq2, cremsg2)
 	e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
 
 	//Del1
 	deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
-	delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
+	delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
 	xappConn1.RecvSubsDelResp(t, deltrans1)
 	//Wait that subs is cleaned
 	mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
 
 	//Del2
 	deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
-	delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
+	delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
 	xappConn2.RecvSubsDelResp(t, deltrans2)
 	//Wait that subs is cleaned
 	mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -441,22 +441,22 @@
 	//Req1
 	cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
 	xappConn1.SendSubsReq(t, nil, cretrans1)
-	crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq1, cremsg1)
+	crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq1, cremsg1)
 	e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
 
 	//Req2
 	cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
 	xappConn1.SendSubsReq(t, nil, cretrans2)
-	crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq2, cremsg2)
+	crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq2, cremsg2)
 	e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
 
 	//Del1
 	deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
 	xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1)
-	delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
+	delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
 	xappConn1.RecvSubsDelResp(t, deltrans1)
 	//Wait that subs is cleaned
 	mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
@@ -464,15 +464,15 @@
 	//Del2
 	deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
 	xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2)
-	delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
+	delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
 	xappConn1.RecvSubsDelResp(t, deltrans2)
 	//Wait that subs is cleaned
 	mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -513,18 +513,18 @@
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
 
 	// E2t: Receive 1st SubsReq
-	e2termConn.RecvSubsReq(t)
+	e2termConn1.RecvSubsReq(t)
 
 	// E2t: Receive 2nd SubsReq and send SubsResp
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 
 	// Xapp: Receive SubsResp
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq, delmsg)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq, delmsg)
 	xappConn1.RecvSubsDelResp(t, deltrans)
 
 	// Wait that subs is cleaned
@@ -532,7 +532,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -576,21 +576,21 @@
 	xappConn1.SendSubsReq(t, nil, nil)
 
 	// E2t: Receive 1st SubsReq
-	e2termConn.RecvSubsReq(t)
+	e2termConn1.RecvSubsReq(t)
 
 	// E2t: Receive 2nd SubsReq
-	e2termConn.RecvSubsReq(t)
+	e2termConn1.RecvSubsReq(t)
 
 	// E2t: Send receive SubsDelReq and send SubsResp
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq, delmsg)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq, delmsg)
 
 	// Wait that subs is cleaned
 	mainCtrl.wait_subs_clean(t, delreq.RequestId.Seq, 10)
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -631,23 +631,23 @@
 	xappConn1.SendSubsReq(t, nil, nil)
 
 	// E2t: Receive 1st SubsReq
-	e2termConn.RecvSubsReq(t)
+	e2termConn1.RecvSubsReq(t)
 
 	// E2t: Receive 2nd SubsReq
-	e2termConn.RecvSubsReq(t)
+	e2termConn1.RecvSubsReq(t)
 
 	// E2t: Receive 1st SubsDelReq
-	e2termConn.RecvSubsDelReq(t)
+	e2termConn1.RecvSubsDelReq(t)
 
 	// E2t: Receive 2nd SubsDelReq
-	delreq, _ := e2termConn.RecvSubsDelReq(t)
+	delreq, _ := e2termConn1.RecvSubsDelReq(t)
 
 	// Wait that subs is cleaned
 	mainCtrl.wait_subs_clean(t, delreq.RequestId.Seq, 15)
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -682,10 +682,10 @@
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
 
 	// E2t: Receive SubsReq and send SubsFail
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
 	fparams := &teststube2ap.E2StubSubsFailParams{}
 	fparams.Set(crereq)
-	e2termConn.SendSubsFail(t, fparams, cremsg)
+	e2termConn1.SendSubsFail(t, fparams, cremsg)
 
 	// Xapp: Receive SubsFail
 	e2SubsId := xappConn1.RecvSubsFail(t, cretrans)
@@ -695,7 +695,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -733,8 +733,8 @@
 
 	// Subs Create
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 
 	// Subs Delete
@@ -742,11 +742,11 @@
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
 
 	// E2t: Receive 1st SubsDelReq
-	e2termConn.RecvSubsDelReq(t)
+	e2termConn1.RecvSubsDelReq(t)
 
 	// E2t: Receive 2nd SubsDelReq and send SubsDelResp
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq, delmsg)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq, delmsg)
 
 	// Xapp: Receive SubsDelResp
 	xappConn1.RecvSubsDelResp(t, deltrans)
@@ -756,7 +756,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -792,8 +792,8 @@
 
 	// Subs Create
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 
 	// Subs Delete
@@ -801,10 +801,10 @@
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
 
 	// E2t: Receive 1st SubsDelReq
-	e2termConn.RecvSubsDelReq(t)
+	e2termConn1.RecvSubsDelReq(t)
 
 	// E2t: Receive 2nd SubsDelReq
-	e2termConn.RecvSubsDelReq(t)
+	e2termConn1.RecvSubsDelReq(t)
 
 	// Xapp: Receive SubsDelResp
 	xappConn1.RecvSubsDelResp(t, deltrans)
@@ -814,7 +814,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -850,16 +850,16 @@
 
 	// Subs Create
 	cretrans := xappConn1.SendSubsReq(t, nil, nil)
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 
 	// Xapp: Send SubsDelReq
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
 
 	// E2t: Send receive SubsDelReq and send SubsDelFail
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelFail(t, delreq, delmsg)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelFail(t, delreq, delmsg)
 
 	// Xapp: Receive SubsDelResp
 	xappConn1.RecvSubsDelResp(t, deltrans)
@@ -869,7 +869,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -877,45 +877,45 @@
 // TestSubReqAndSubDelOkSameAction
 //
 //   stub                          stub
-// +-------+     +---------+    +---------+
-// | xapp  |     | submgr  |    | e2term  |
-// +-------+     +---------+    +---------+
-//     |              |              |
-//     |              |              |
-//     |              |              |
-//     | SubReq1      |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubReq1      |
-//     |              |------------->|
-//     |              |    SubResp1  |
-//     |              |<-------------|
-//     |    SubResp1  |              |
-//     |<-------------|              |
-//     |              |              |
-//     | SubReq2      |              |
-//     |------------->|              |
-//     |              |              |
-//     |    SubResp2  |              |
-//     |<-------------|              |
-//     |              |              |
-//     | SubDelReq 1  |              |
-//     |------------->|              |
-//     |              |              |
-//     | SubDelResp 1 |              |
-//     |<-------------|              |
-//     |              |              |
-//     | SubDelReq 2  |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubDelReq 2  |
-//     |              |------------->|
-//     |              |              |
-//     |              | SubDelReq 2  |
-//     |              |------------->|
-//     |              |              |
-//     | SubDelResp 2 |              |
-//     |<-------------|              |
+// +-------+     +-------+     +---------+    +---------+
+// | xapp2 |     | xapp1 |     | submgr  |    | e2term  |
+// +-------+     +-------+     +---------+    +---------+
+//     |             |              |              |
+//     |             |              |              |
+//     |             |              |              |
+//     |             | SubReq1      |              |
+//     |             |------------->|              |
+//     |             |              |              |
+//     |             |              | SubReq1      |
+//     |             |              |------------->|
+//     |             |              |    SubResp1  |
+//     |             |              |<-------------|
+//     |             |    SubResp1  |              |
+//     |             |<-------------|              |
+//     |             |              |              |
+//     |          SubReq2           |              |
+//     |--------------------------->|              |
+//     |             |              |              |
+//     |          SubResp2          |              |
+//     |<---------------------------|              |
+//     |             |              |              |
+//     |             | SubDelReq 1  |              |
+//     |             |------------->|              |
+//     |             |              |              |
+//     |             | SubDelResp 1 |              |
+//     |             |<-------------|              |
+//     |             |              |              |
+//     |         SubDelReq 2        |              |
+//     |--------------------------->|              |
+//     |             |              |              |
+//     |             |              | SubDelReq 2  |
+//     |             |              |------------->|
+//     |             |              |              |
+//     |             |              | SubDelReq 2  |
+//     |             |              |------------->|
+//     |             |              |              |
+//     |         SubDelResp 2       |              |
+//     |<---------------------------|              |
 //
 //-----------------------------------------------------------------------------
 func TestSubReqAndSubDelOkSameAction(t *testing.T) {
@@ -925,82 +925,82 @@
 	rparams1 := &teststube2ap.E2StubSubsReqParams{}
 	rparams1.Init()
 	cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
-	crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq1, cremsg1)
+	crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq1, cremsg1)
 	e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
 
 	//Req2
 	rparams2 := &teststube2ap.E2StubSubsReqParams{}
 	rparams2.Init()
 	cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
-	//crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
-	//e2termConn.SendSubsResp(t, crereq2, cremsg2)
+	//crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
+	//e2termConn1.SendSubsResp(t, crereq2, cremsg2)
 	e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
 
 	//Del1
 	deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
-	//e2termConn.RecvSubsDelReq(t)
-	//e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
+	//e2termConn1.RecvSubsDelReq(t)
+	//e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
 	xappConn1.RecvSubsDelResp(t, deltrans1)
 	//Wait that subs is cleaned
 	//mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
 
 	//Del2
 	deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
-	delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
+	delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
 	xappConn2.RecvSubsDelResp(t, deltrans2)
 	//Wait that subs is cleaned
 	mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
 //-----------------------------------------------------------------------------
 // TestSubReqAndSubDelOkSameActionParallel
 //
-//   stub                          stub
-// +-------+     +---------+    +---------+
-// | xapp  |     | submgr  |    | e2term  |
-// +-------+     +---------+    +---------+
-//     |              |              |
-//     |              |              |
-//     |              |              |
-//     | SubReq1      |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubReq1      |
-//     |              |------------->|
-//     | SubReq2      |              |
-//     |------------->|              |
-//     |              |    SubResp1  |
-//     |              |<-------------|
-//     |    SubResp1  |              |
-//     |<-------------|              |
-//     |              |              |
-//     |    SubResp2  |              |
-//     |<-------------|              |
-//     |              |              |
-//     | SubDelReq 1  |              |
-//     |------------->|              |
-//     |              |              |
-//     | SubDelResp 1 |              |
-//     |<-------------|              |
-//     |              |              |
-//     | SubDelReq 2  |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubDelReq 2  |
-//     |              |------------->|
-//     |              |              |
-//     |              | SubDelReq 2  |
-//     |              |------------->|
-//     |              |              |
-//     | SubDelResp 2 |              |
-//     |<-------------|              |
+//   stub          stub                          stub
+// +-------+     +-------+     +---------+    +---------+
+// | xapp2 |     | xapp1 |     | submgr  |    | e2term  |
+// +-------+     +-------+     +---------+    +---------+
+//     |             |              |              |
+//     |             |              |              |
+//     |             |              |              |
+//     |             | SubReq1      |              |
+//     |             |------------->|              |
+//     |             |              |              |
+//     |             |              | SubReq1      |
+//     |             |              |------------->|
+//     |          SubReq2           |              |
+//     |--------------------------->|              |
+//     |             |              |    SubResp1  |
+//     |             |              |<-------------|
+//     |             |    SubResp1  |              |
+//     |             |<-------------|              |
+//     |             |              |              |
+//     |          SubResp2          |              |
+//     |<---------------------------|              |
+//     |             |              |              |
+//     |             | SubDelReq 1  |              |
+//     |             |------------->|              |
+//     |             |              |              |
+//     |             | SubDelResp 1 |              |
+//     |             |<-------------|              |
+//     |             |              |              |
+//     |         SubDelReq 2        |              |
+//     |--------------------------->|              |
+//     |             |              |              |
+//     |             |              | SubDelReq 2  |
+//     |             |              |------------->|
+//     |             |              |              |
+//     |             |              | SubDelReq 2  |
+//     |             |              |------------->|
+//     |             |              |              |
+//     |         SubDelResp 2       |              |
+//     |<---------------------------|              |
 //
 //-----------------------------------------------------------------------------
 func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) {
@@ -1010,7 +1010,7 @@
 	rparams1 := &teststube2ap.E2StubSubsReqParams{}
 	rparams1.Init()
 	cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
-	crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
+	crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
 
 	//Req2
 	rparams2 := &teststube2ap.E2StubSubsReqParams{}
@@ -1018,7 +1018,7 @@
 	cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
 
 	//Resp1
-	e2termConn.SendSubsResp(t, crereq1, cremsg1)
+	e2termConn1.SendSubsResp(t, crereq1, cremsg1)
 	e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
 
 	//Resp2
@@ -1030,8 +1030,8 @@
 
 	//Del2
 	deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
-	delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
+	delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
 	xappConn2.RecvSubsDelResp(t, deltrans2)
 
 	//Wait that subs is cleaned
@@ -1039,34 +1039,34 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
 //-----------------------------------------------------------------------------
 // TestSubReqAndSubDelNokSameActionParallel
 //
-//   stub                          stub
-// +-------+     +---------+    +---------+
-// | xapp  |     | submgr  |    | e2term  |
-// +-------+     +---------+    +---------+
-//     |              |              |
-//     |              |              |
-//     |              |              |
-//     | SubReq1      |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubReq1      |
-//     |              |------------->|
-//     | SubReq2      |              |
-//     |------------->|              |
-//     |              |    SubFail1  |
-//     |              |<-------------|
-//     |    SubFail1  |              |
-//     |<-------------|              |
-//     |              |              |
-//     |    SubFail2  |              |
-//     |<-------------|              |
+//   stub          stub                          stub
+// +-------+     +-------+     +---------+    +---------+
+// | xapp2 |     | xapp1 |     | submgr  |    | e2term  |
+// +-------+     +-------+     +---------+    +---------+
+//     |             |              |              |
+//     |             |              |              |
+//     |             |              |              |
+//     |             | SubReq1      |              |
+//     |             |------------->|              |
+//     |             |              |              |
+//     |             |              | SubReq1      |
+//     |             |              |------------->|
+//     |          SubReq2           |              |
+//     |--------------------------->|              |
+//     |             |              |    SubFail1  |
+//     |             |              |<-------------|
+//     |             |    SubFail1  |              |
+//     |             |<-------------|              |
+//     |             |              |              |
+//     |          SubFail2          |              |
+//     |<---------------------------|              |
 //
 //-----------------------------------------------------------------------------
 func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) {
@@ -1076,7 +1076,7 @@
 	rparams1 := &teststube2ap.E2StubSubsReqParams{}
 	rparams1.Init()
 	cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
-	crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
+	crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
 
 	//Req2
 	rparams2 := &teststube2ap.E2StubSubsReqParams{}
@@ -1088,7 +1088,7 @@
 	//E2T Fail
 	fparams := &teststube2ap.E2StubSubsFailParams{}
 	fparams.Set(crereq1)
-	e2termConn.SendSubsFail(t, fparams, cremsg1)
+	e2termConn1.SendSubsFail(t, fparams, cremsg1)
 
 	//Fail1
 	e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1)
@@ -1100,37 +1100,37 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
 //-----------------------------------------------------------------------------
 // TestSubReqAndSubDelNoAnswerSameActionParallel
 //
-//   stub                          stub
-// +-------+     +---------+    +---------+
-// | xapp  |     | submgr  |    | e2term  |
-// +-------+     +---------+    +---------+
-//     |              |              |
-//     |              |              |
-//     |              |              |
-//     | SubReq1      |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubReq1      |
-//     |              |------------->|
-//     | SubReq2      |              |
-//     |------------->|              |
-//     |              |              |
-//     |              | SubReq1      |
-//     |              |------------->|
-//     |              |              |
-//     |              |              |
-//     |              | SubDelReq    |
-//     |              |------------->|
-//     |              |              |
-//     |              |   SubDelResp |
-//     |              |<-------------|
+//   stub          stub                          stub
+// +-------+     +-------+     +---------+    +---------+
+// | xapp2 |     | xapp1 |     | submgr  |    | e2term  |
+// +-------+     +-------+     +---------+    +---------+
+//     |             |              |              |
+//     |             |              |              |
+//     |             |              |              |
+//     |             | SubReq1      |              |
+//     |             |------------->|              |
+//     |             |              |              |
+//     |             |              | SubReq1      |
+//     |             |              |------------->|
+//     |             | SubReq2      |              |
+//     |--------------------------->|              |
+//     |             |              |              |
+//     |             |              | SubReq1      |
+//     |             |              |------------->|
+//     |             |              |              |
+//     |             |              |              |
+//     |             |              | SubDelReq    |
+//     |             |              |------------->|
+//     |             |              |              |
+//     |             |              |   SubDelResp |
+//     |             |              |<-------------|
 //
 //-----------------------------------------------------------------------------
 func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) {
@@ -1141,7 +1141,7 @@
 	rparams1.Init()
 	xappConn1.SendSubsReq(t, rparams1, nil)
 
-	e2termConn.RecvSubsReq(t)
+	e2termConn1.RecvSubsReq(t)
 
 	//Req2
 	rparams2 := &teststube2ap.E2StubSubsReqParams{}
@@ -1151,17 +1151,17 @@
 	mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
 
 	//Req1 (retransmitted)
-	e2termConn.RecvSubsReq(t)
+	e2termConn1.RecvSubsReq(t)
 
-	delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
-	e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
+	delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
 
 	//Wait that subs is cleaned
 	mainCtrl.wait_subs_clean(t, delreq1.RequestId.Seq, 10)
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 15)
 }
 
@@ -1208,13 +1208,13 @@
 	rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
 	cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
 
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
 
-	e2termConn.SendSubsDelResp(t, delreq, delmsg)
+	e2termConn1.SendSubsDelResp(t, delreq, delmsg)
 	xappConn1.RecvSubsDelResp(t, deltrans)
 
 	//Wait that subs is cleaned
@@ -1222,7 +1222,7 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
 
@@ -1280,8 +1280,8 @@
 	rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
 	cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
 
-	crereq, cremsg := e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg := e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
 
 	//Policy change
@@ -1289,13 +1289,13 @@
 	rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms
 	xappConn1.SendSubsReq(t, rparams1, cretrans)
 
-	crereq, cremsg = e2termConn.RecvSubsReq(t)
-	e2termConn.SendSubsResp(t, crereq, cremsg)
+	crereq, cremsg = e2termConn1.RecvSubsReq(t)
+	e2termConn1.SendSubsResp(t, crereq, cremsg)
 	e2SubsId = xappConn1.RecvSubsResp(t, cretrans)
 	deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
-	delreq, delmsg := e2termConn.RecvSubsDelReq(t)
+	delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
 
-	e2termConn.SendSubsDelResp(t, delreq, delmsg)
+	e2termConn1.SendSubsDelResp(t, delreq, delmsg)
 	xappConn1.RecvSubsDelResp(t, deltrans)
 
 	//Wait that subs is cleaned
@@ -1303,6 +1303,86 @@
 
 	xappConn1.TestMsgChanEmpty(t)
 	xappConn2.TestMsgChanEmpty(t)
-	e2termConn.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
+	mainCtrl.wait_registry_empty(t, 10)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubReqAndSubDelOkTwoE2termParallel
+//
+//   stub                          stub           stub
+// +-------+     +---------+    +---------+    +---------+
+// | xapp  |     | submgr  |    | e2term1 |    | e2term2 |
+// +-------+     +---------+    +---------+    +---------+
+//     |              |              |              |
+//     |              |              |              |
+//     |              |              |              |
+//     | SubReq1      |              |              |
+//     |------------->|              |              |
+//     |              |              |              |
+//     |              | SubReq1      |              |
+//     |              |------------->|              |
+//     |              |              |              |
+//     | SubReq2      |              |              |
+//     |------------->|              |              |
+//     |              |              |              |
+//     |              | SubReq2      |              |
+//     |              |---------------------------->|
+//     |              |              |              |
+//     |              |    SubResp1  |              |
+//     |              |<-------------|              |
+//     |    SubResp1  |              |              |
+//     |<-------------|              |              |
+//     |              |    SubResp2  |              |
+//     |              |<----------------------------|
+//     |    SubResp2  |              |              |
+//     |<-------------|              |              |
+//     |              |              |              |
+//     |        [SUBS 1 DELETE]      |              |
+//     |              |              |              |
+//     |        [SUBS 2 DELETE]      |              |
+//     |              |              |              |
+//
+//-----------------------------------------------------------------------------
+func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) {
+	CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel")
+
+	//Req1
+	cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
+	xappConn1.SendSubsReq(t, nil, cretrans1)
+	crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
+
+	cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11")
+	xappConn1.SendSubsReq(t, nil, cretrans2)
+	crereq2, cremsg2 := e2termConn2.RecvSubsReq(t)
+
+	//Resp1
+	e2termConn1.SendSubsResp(t, crereq1, cremsg1)
+	e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
+
+	//Resp2
+	e2termConn2.SendSubsResp(t, crereq2, cremsg2)
+	e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
+
+	//Del1
+	deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
+	delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
+	e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
+	xappConn1.RecvSubsDelResp(t, deltrans1)
+	//Wait that subs is cleaned
+	mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
+
+	//Del2
+	deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2)
+	delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t)
+	e2termConn2.SendSubsDelResp(t, delreq2, delmsg2)
+	xappConn1.RecvSubsDelResp(t, deltrans2)
+	//Wait that subs is cleaned
+	mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
+
+	xappConn1.TestMsgChanEmpty(t)
+	xappConn2.TestMsgChanEmpty(t)
+	e2termConn1.TestMsgChanEmpty(t)
+	e2termConn2.TestMsgChanEmpty(t)
 	mainCtrl.wait_registry_empty(t, 10)
 }
diff --git a/pkg/control/ut_test.go b/pkg/control/ut_test.go
index 38bd322..7d27412 100644
--- a/pkg/control/ut_test.go
+++ b/pkg/control/ut_test.go
@@ -42,7 +42,8 @@
 
 var xappConn1 *teststube2ap.E2Stub
 var xappConn2 *teststube2ap.E2Stub
-var e2termConn *teststube2ap.E2Stub
+var e2termConn1 *teststube2ap.E2Stub
+var e2termConn2 *teststube2ap.E2Stub
 var rtmgrHttp *testingHttpRtmgrStub
 var mainCtrl *testingSubmgrControl
 
@@ -112,30 +113,38 @@
 	// Port    Entity
 	// -------------------
 	// 14560   submgr
-	// 15560   e2term stub
+	// 15560   e2term1 stub
+	// 15660   e2term2 stub
 	// 13560   xapp1 stub
 	// 13660   xapp2 stub
 	// 16560   dummy stub
 	//
 	//---------------------------------
 	rt := &teststub.RmrRouteTable{}
-	rt.AddEntry(12010, "", -1, "localhost:14560")
-	rt.AddEntry(12010, "localhost:14560", -1, "localhost:15560")
-	rt.AddEntry(12011, "localhost:15560", -1, "localhost:14560")
-	rt.AddEntry(12012, "localhost:15560", -1, "localhost:14560")
-	rt.AddEntry(12011, "localhost:14560", -1, "localhost:13660;localhost:13560")
-	rt.AddEntry(12012, "localhost:14560", -1, "localhost:13660;localhost:13560")
-	rt.AddEntry(12020, "", -1, "localhost:14560")
-	rt.AddEntry(12020, "localhost:14560", -1, "localhost:15560")
-	rt.AddEntry(12021, "localhost:15560", -1, "localhost:14560")
-	rt.AddEntry(12022, "localhost:15560", -1, "localhost:14560")
-	rt.AddEntry(12021, "localhost:14560", -1, "localhost:13660;localhost:13560")
-	rt.AddEntry(12022, "localhost:14560", -1, "localhost:13660;localhost:13560")
-	rt.AddEntry(55555, "", -1, "localhost:13660;localhost:13560;localhost:15560;localhost:16560")
+	rt.AddRoute(12010, "", -1, "localhost:14560")
+	rt.AddRoute(12010, "localhost:14560", -1, "%meid")
+	rt.AddRoute(12011, "localhost:15560", -1, "localhost:14560")
+	rt.AddRoute(12012, "localhost:15560", -1, "localhost:14560")
+	rt.AddRoute(12011, "localhost:15660", -1, "localhost:14560")
+	rt.AddRoute(12012, "localhost:15660", -1, "localhost:14560")
+	rt.AddRoute(12011, "localhost:14560", -1, "localhost:13660;localhost:13560")
+	rt.AddRoute(12012, "localhost:14560", -1, "localhost:13660;localhost:13560")
+	rt.AddRoute(12020, "", -1, "localhost:14560")
+	rt.AddRoute(12020, "localhost:14560", -1, "%meid")
+	rt.AddRoute(12021, "localhost:15560", -1, "localhost:14560")
+	rt.AddRoute(12022, "localhost:15560", -1, "localhost:14560")
+	rt.AddRoute(12021, "localhost:15660", -1, "localhost:14560")
+	rt.AddRoute(12022, "localhost:15660", -1, "localhost:14560")
+	rt.AddRoute(12021, "localhost:14560", -1, "localhost:13660;localhost:13560")
+	rt.AddRoute(12022, "localhost:14560", -1, "localhost:13660;localhost:13560")
+	rt.AddRoute(55555, "", -1, "localhost:13660;localhost:13560;localhost:15560;localhost:15660;localhost:16560")
 
-	rtfilename, _ := teststub.CreateTmpFile(rt.GetRt())
+	rt.AddMeid("localhost:15560", []string{"RAN_NAME_1", "RAN_NAME_2"})
+	rt.AddMeid("localhost:15660", []string{"RAN_NAME_11", "RAN_NAME_12"})
+
+	rtfilename, _ := teststub.CreateTmpFile(rt.GetTable())
 	defer os.Remove(rtfilename)
-
+	tent.Logger.Info("table[%s]", rt.GetTable())
 	//---------------------------------
 	//
 	//---------------------------------
@@ -157,8 +166,14 @@
 	//---------------------------------
 	//
 	//---------------------------------
-	tent.Logger.Info("### e2term stub run ###")
-	e2termConn = teststube2ap.CreateNewE2termStub("e2termstub", rtfilename, "15560", "RMRE2TERMSTUB", 55555)
+	tent.Logger.Info("### e2term1 stub run ###")
+	e2termConn1 = teststube2ap.CreateNewE2termStub("e2termstub1", rtfilename, "15560", "RMRE2TERMSTUB1", 55555)
+
+	//---------------------------------
+	//
+	//---------------------------------
+	tent.Logger.Info("### e2term2 stub run ###")
+	e2termConn2 = teststube2ap.CreateNewE2termStub("e2termstub2", rtfilename, "15660", "RMRE2TERMSTUB2", 55555)
 
 	//---------------------------------
 	// Just to test dummy stub
diff --git a/pkg/teststub/rmrroutetable.go b/pkg/teststub/rmrroutetable.go
index 9ea2657..cb7adeb 100644
--- a/pkg/teststub/rmrroutetable.go
+++ b/pkg/teststub/rmrroutetable.go
@@ -28,10 +28,11 @@
 //-----------------------------------------------------------------------------
 
 type RmrRouteTable struct {
-	lines []string
+	routes []string
+	meids  []string
 }
 
-func (rrt *RmrRouteTable) AddEntry(mtype int, src string, subid int, trg string) {
+func (rrt *RmrRouteTable) AddRoute(mtype int, src string, subid int, trg string) {
 
 	line := "mse|"
 	line += strconv.FormatInt(int64(mtype), 10)
@@ -42,14 +43,43 @@
 	line += strconv.FormatInt(int64(subid), 10)
 	line += "|"
 	line += trg
-	rrt.lines = append(rrt.lines, line)
+	rrt.routes = append(rrt.routes, line)
 }
 
-func (rrt *RmrRouteTable) GetRt() string {
+func (rrt *RmrRouteTable) AddMeid(trg string, meids []string) {
+
+	line := "mme_ar"
+	line += "|"
+	line += trg
+	line += "|"
+	for _, str := range meids {
+		line += " " + str
+	}
+	rrt.meids = append(rrt.meids, line)
+}
+
+func (rrt *RmrRouteTable) DelMeid(meids []string) {
+
+	line := "mme_del"
+	line += "|"
+	for _, str := range meids {
+		line += " " + str
+	}
+	rrt.meids = append(rrt.meids, line)
+}
+
+func (rrt *RmrRouteTable) GetTable() string {
 	allrt := "newrt|start\n"
-	for _, val := range rrt.lines {
+	for _, val := range rrt.routes {
 		allrt += val + "\n"
 	}
 	allrt += "newrt|end\n"
+	if len(rrt.meids) > 0 {
+		allrt += "meid_map | start\n"
+		for _, val := range rrt.meids {
+			allrt += val + "\n"
+		}
+		allrt += "meid_map | end | " + strconv.FormatInt(int64(len(rrt.meids)), 10) + "\n"
+	}
 	return allrt
 }
diff --git a/pkg/xapptweaks/rmrparams.go b/pkg/xapptweaks/rmrparams.go
index 1b40466..812a43e 100644
--- a/pkg/xapptweaks/rmrparams.go
+++ b/pkg/xapptweaks/rmrparams.go
@@ -34,7 +34,7 @@
 
 func (params *RMRParams) String() string {
 	var b bytes.Buffer
-	fmt.Fprintf(&b, "params(Src=%s Mtype=%d SubId=%d Xid=%s Meid=%s)", params.Src, params.Mtype, params.SubId, params.Xid, params.Meid.RanName)
+	fmt.Fprintf(&b, "params(Src=%s Mtype=%d SubId=%d Xid=%s Meid=%s Paylens=%d/%d)", params.Src, params.Mtype, params.SubId, params.Xid, params.Meid.RanName, params.PayloadLen, len(params.Payload))
 	return b.String()
 }