RICPLT-2989 Submgr routing manager client code to support multiple endpoints

Change-Id: I0b4931090c06b4cf9a81b766a11162c8a6ebecf4
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
diff --git a/pkg/control/control.go b/pkg/control/control.go
index a2c8b0d..3c75523 100755
--- a/pkg/control/control.go
+++ b/pkg/control/control.go
@@ -23,7 +23,6 @@
 	"fmt"
 	"gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
 	rtmgrclient "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/rtmgr_client"
-	rtmgrhandle "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/rtmgr_client/handle"
 	"gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
 	httptransport "github.com/go-openapi/runtime/client"
 	"github.com/go-openapi/strfmt"
@@ -60,7 +59,7 @@
 
 const (
 	CREATE Action = 0
-	MERGE  Action = 1
+	UPDATE Action = 1
 	NONE   Action = 2
 	DELETE Action = 3
 )
@@ -75,10 +74,7 @@
 func NewControl() *Control {
 
 	transport := httptransport.New(viper.GetString("rtmgr.HostAddr")+":"+viper.GetString("rtmgr.port"), viper.GetString("rtmgr.baseUrl"), []string{"http"})
-	client := rtmgrclient.New(transport, strfmt.Default)
-	handle := rtmgrhandle.NewProvideXappSubscriptionHandleParamsWithTimeout(10 * time.Second)
-	deleteHandle := rtmgrhandle.NewDeleteXappSubscriptionHandleParamsWithTimeout(10 * time.Second)
-	rtmgrClient := RtmgrClient{client, handle, deleteHandle}
+	rtmgrClient := RtmgrClient{rtClient: rtmgrclient.New(transport, strfmt.Default)}
 
 	registry := new(Registry)
 	registry.Initialize()
@@ -335,7 +331,7 @@
 		parentTrans.SendEvent(nil, 0)
 	}
 
-	subs.DelEndpoint(parentTrans.GetEndpoint())
+	go c.registry.RemoveFromSubscription(subs, parentTrans, 5*time.Second)
 }
 
 //-------------------------------------------------------------------
@@ -353,7 +349,7 @@
 	event := c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans)
 
 	parentTrans.SendEvent(event, 0)
-	subs.DelEndpoint(parentTrans.GetEndpoint())
+	go c.registry.RemoveFromSubscription(subs, parentTrans, 5*time.Second)
 }
 
 //-------------------------------------------------------------------