From: rangajal Date: Tue, 11 Aug 2020 06:51:17 +0000 (+0000) Subject: Creating dymanic endpoints(Eps) and distributing routes to those endpoints on upgrad... X-Git-Tag: 0.6.10~10 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=2037469c7f636b15cc069694b5e7a63cb230ec9a;p=ric-plt%2Frtmgr.git Creating dymanic endpoints(Eps) and distributing routes to those endpoints on upgrade route table request from xApp Change-Id: I92bf9d51bcc429069175c1e964177e22f0e6e300 Signed-off-by: rangajal --- diff --git a/Dockerfile b/Dockerfile index 20f4b60..c38c323 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ # a Docker tag from the string in file container-tag.yaml #FROM golang:1.12.1 as rtmgrbuild -FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:8-u18.04 as rtmgrbuild +FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:9-u18.04 as rtmgrbuild # Install RMr shared library ARG RMRVERSION=4.1.2 diff --git a/RELNOTES b/RELNOTES index 019508c..ab8b838 100644 --- a/RELNOTES +++ b/RELNOTES @@ -1,3 +1,6 @@ +### v0.6.4 +* Creating dymanic endpoints(Eps) and distributing routes to those endpoints on upgrade route table request from xApp (this is fixed part MCxapp distribution issue for multiple route ports) + ### v0.6.3 * [RIC-369] Routing manager needs to support for xApps that terminate other protocols than E2 diff --git a/cmd/rtmgr.go b/cmd/rtmgr.go index af0aba1..37934ad 100644 --- a/cmd/rtmgr.go +++ b/cmd/rtmgr.go @@ -66,6 +66,7 @@ func main() { xapp.Logger.Info("Start " + SERVICENAME + " service") rtmgr.Eps = make(rtmgr.Endpoints) rtmgr.Mtype = make(rtmgr.MessageTypeList) + rtmgr.RmrEp = make(rtmgr.ProcessMultipleRMR) rtmgr.Rtmgr_ready = false // RMR thread is starting port: 4560 diff --git a/container-tag.yaml b/container-tag.yaml index 41de17d..2ff9714 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.6.4 +tag: 0.6.5 diff --git a/pkg/nbi/control.go b/pkg/nbi/control.go index 885230f..4f61299 100644 --- a/pkg/nbi/control.go +++ b/pkg/nbi/control.go @@ -144,7 +144,7 @@ func (c *Control) handleUpdateToRoutingManagerRequest(params *xapp.RMRParams) { return } - ep := sbiEngine.CreateEndpoint(string(params.Payload)) + ep := sbiEngine.CreateEndpoint(string(params.Payload),msg.String()) if ep == nil { xapp.Logger.Error("Update Routing Table Request can't handle due to end point %s is not avail in complete ep list: ", string(params.Payload)) return diff --git a/pkg/rtmgr/rtmgr.go b/pkg/rtmgr/rtmgr.go index de7db00..7276bc8 100644 --- a/pkg/rtmgr/rtmgr.go +++ b/pkg/rtmgr/rtmgr.go @@ -43,6 +43,7 @@ var ( Subs SubscriptionList PrsCfg *PlatformRoutes Mtype MessageTypeList + RmrEp ProcessMultipleRMR DynamicRouteList []string ) diff --git a/pkg/rtmgr/types.go b/pkg/rtmgr/types.go index 138c2b5..4501bb8 100644 --- a/pkg/rtmgr/types.go +++ b/pkg/rtmgr/types.go @@ -41,6 +41,8 @@ type SubscriptionList []Subscription type MessageTypeList map[string]string +type ProcessMultipleRMR map[string]int + //TODO: uuid is not a real UUID but a string of "ip:port" // this should be changed to real UUID later on which should come from xApp Manager // petszila type Endpoint struct { diff --git a/pkg/sbi/nngpush.go b/pkg/sbi/nngpush.go index 1f0e0e6..dbd5d59 100644 --- a/pkg/sbi/nngpush.go +++ b/pkg/sbi/nngpush.go @@ -123,6 +123,10 @@ func (c *RmrPush) DistributeAll(policies *[]string) error { for _, ep := range rtmgr.Eps { go c.send_sync(ep, policies, channel, rmrcallid) } + for rEp, id := range rtmgr.RmrEp { + go c.send_rt_process(rEp,id,policies,rmrcallid) + } + rmrcallid++ count := 0 @@ -188,8 +192,8 @@ func (c *RmrPush) send_data(ep *rtmgr.Endpoint, policies *[]string, call_id int) return false } -func (c *RmrPush) CreateEndpoint(payload string) *rtmgr.Endpoint { - return c.createEndpoint(payload, c) +func (c *RmrPush) CreateEndpoint(payload string,rmrsrc string)*rtmgr.Endpoint { + return c.createEndpoint(payload,rmrsrc, c) } func (c *RmrPush) DistributeToEp(policies *[]string, ep *rtmgr.Endpoint) error { @@ -205,3 +209,39 @@ func (c *RmrPush) DistributeToEp(policies *[]string, ep *rtmgr.Endpoint) error { return nil } + +func (c *RmrPush) send_rt_process(ep string,whid int, policies *[]string, call_id int) bool { + xapp.Logger.Debug("Invoked send_rt_process to endpoint: " + ep + " call_id: " + strconv.Itoa(call_id) + "whid: " + strconv.Itoa(whid)) + var state int + var retstr string + + var policy = []byte{} + + for _, pe := range *policies { + b:= []byte(pe) + for j:=0; j>> uuid %v", stringSlice[0]) +// stringSlice := strings.Split(payload, " ") +// uuid := stringSlice[0] +// xapp.Logger.Debug(">>> uuid %v", stringSlice[0]) - if _, ok := rtmgr.Eps[uuid]; ok { +/* if _, ok := rtmgr.Eps[uuid]; ok { ep := rtmgr.Eps[uuid] return ep - } + }*/ /* incase the stored Endpoint list is in the form of IP:port*/ - stringsubsplit := strings.Split(uuid, ":") +/* stringsubsplit := strings.Split(uuid, ":") addr, err := net.LookupIP(stringsubsplit[0]) if err == nil { convertedUuid := fmt.Sprintf("%s:%s", addr[0], stringsubsplit[1]) @@ -197,7 +197,18 @@ func (s *Sbi) createEndpoint(payload string, sbi Engine) *rtmgr.Endpoint { ep := rtmgr.Eps[convertedUuid] return ep } + }*/ + + /* Create a new mapping, this case is assumed for multiple process sending RMR request from a container */ + srcString := strings.Split(rmrsrc," ") + srcStringSlice := strings.Split(srcString[0],"=") + Whid := int(xapp.Rmr.Openwh(srcStringSlice[1])) + + xapp.Logger.Info("Wormhole Id created is %d for EndPoint %s",Whid,srcStringSlice[1]) + if Whid > 0 { + rtmgr.RmrEp[srcStringSlice[1]] = Whid + xapp.Logger.Info("received %s and mapped to Whid = %d",srcStringSlice[1],Whid) } return nil -} + } diff --git a/pkg/sbi/types.go b/pkg/sbi/types.go index 232a1dc..9e6fe02 100644 --- a/pkg/sbi/types.go +++ b/pkg/sbi/types.go @@ -45,7 +45,7 @@ type Engine interface { AddEndpoint(*rtmgr.Endpoint) error DeleteEndpoint(*rtmgr.Endpoint) error UpdateEndpoints(*rtmgr.RicComponents) - CreateEndpoint(string) (*rtmgr.Endpoint) + CreateEndpoint(string,string)*rtmgr.Endpoint DistributeToEp(*[]string, *rtmgr.Endpoint) error }