From 6a9ce4976c1fbbcb8d4a068f81e76515c99a9d3f Mon Sep 17 00:00:00 2001 From: wahidw Date: Sat, 15 Aug 2020 11:29:43 +0530 Subject: [PATCH] Removed Book Keeping of RMR CTL ports. Route Distribution only on demand Change-Id: If017b52f9bd26d2bf7b13c32eb35b047595dd0ca Signed-off-by: wahidw --- RELNOTES | 3 +++ cmd/rtmgr.go | 1 - container-tag.yaml | 2 +- pkg/nbi/control.go | 12 ++++++------ pkg/rtmgr/rtmgr.go | 1 - pkg/sbi/nngpush.go | 11 ++++------- pkg/sbi/nngpush_test.go | 2 +- pkg/sbi/sbi.go | 7 ++++--- pkg/sbi/types.go | 4 ++-- 9 files changed, 21 insertions(+), 22 deletions(-) diff --git a/RELNOTES b/RELNOTES index ab8b838..c09f8c0 100644 --- a/RELNOTES +++ b/RELNOTES @@ -1,3 +1,6 @@ +### v0.6.5 +* Removed Book Keeping of RMR CTL ports. Route Distribution on demand. + ### 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) diff --git a/cmd/rtmgr.go b/cmd/rtmgr.go index 37934ad..af0aba1 100644 --- a/cmd/rtmgr.go +++ b/cmd/rtmgr.go @@ -66,7 +66,6 @@ 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 2ff9714..1bbe2d3 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.5 +tag: 0.6.6 diff --git a/pkg/nbi/control.go b/pkg/nbi/control.go index 0ab3f06..e31379d 100644 --- a/pkg/nbi/control.go +++ b/pkg/nbi/control.go @@ -136,26 +136,26 @@ func (c *Control) handleUpdateToRoutingManagerRequest(params *xapp.RMRParams) { xapp.Logger.Info("Update Route Table Request, msg.String() : %s", msg.String()) xapp.Logger.Info("Update Route Table Request, params.Payload : %s", string(params.Payload)) - /*m.Lock() + m.Lock() data, err := sdlEngine.ReadAll(xapp.Config.GetString("rtfile")) m.Unlock() if err != nil || data == nil { xapp.Logger.Error("Cannot get data from sdl interface due to: " + err.Error()) return - }*/ + } - sbiEngine.CreateEndpoint(string(params.Payload),msg.String()) - /*if ep == nil { + ep,whid := sbiEngine.CreateEndpoint(string(params.Payload),msg.String()) + if ep == nil || whid < 0 { 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 } policies := rpeEngine.GeneratePolicies(rtmgr.Eps, data) - err = sbiEngine.DistributeToEp(policies, ep) + err = sbiEngine.DistributeToEp(policies, *ep, whid) if err != nil { xapp.Logger.Error("Routing table cannot be published due to: " + err.Error()) return - }*/ + } } func sendRoutesToAll() (err error) { diff --git a/pkg/rtmgr/rtmgr.go b/pkg/rtmgr/rtmgr.go index 7276bc8..de7db00 100644 --- a/pkg/rtmgr/rtmgr.go +++ b/pkg/rtmgr/rtmgr.go @@ -43,7 +43,6 @@ var ( Subs SubscriptionList PrsCfg *PlatformRoutes Mtype MessageTypeList - RmrEp ProcessMultipleRMR DynamicRouteList []string ) diff --git a/pkg/sbi/nngpush.go b/pkg/sbi/nngpush.go index dbd5d59..1b0bed0 100644 --- a/pkg/sbi/nngpush.go +++ b/pkg/sbi/nngpush.go @@ -123,9 +123,6 @@ 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++ @@ -192,11 +189,11 @@ func (c *RmrPush) send_data(ep *rtmgr.Endpoint, policies *[]string, call_id int) return false } -func (c *RmrPush) CreateEndpoint(payload string,rmrsrc string)*rtmgr.Endpoint { +func (c *RmrPush) CreateEndpoint(payload string,rmrsrc string)(ep *string,whid int) { return c.createEndpoint(payload,rmrsrc, c) } -func (c *RmrPush) DistributeToEp(policies *[]string, ep *rtmgr.Endpoint) error { +func (c *RmrPush) DistributeToEp(policies *[]string, ep string, whid int) error { xapp.Logger.Debug("Invoked: sbi.DistributeToEp") xapp.Logger.Debug("args: %v", *policies) @@ -204,13 +201,13 @@ func (c *RmrPush) DistributeToEp(policies *[]string, ep *rtmgr.Endpoint) error { rmrdynamiccallid = 201 } - go c.send_data(ep, policies,rmrdynamiccallid) + go c.sendDynamicRoutes(ep, whid, policies,rmrdynamiccallid) rmrdynamiccallid++ return nil } -func (c *RmrPush) send_rt_process(ep string,whid int, policies *[]string, call_id int) bool { +func (c *RmrPush) sendDynamicRoutes(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 diff --git a/pkg/sbi/nngpush_test.go b/pkg/sbi/nngpush_test.go index 3acc56b..79821eb 100644 --- a/pkg/sbi/nngpush_test.go +++ b/pkg/sbi/nngpush_test.go @@ -131,7 +131,7 @@ func TestDistributeToEp(t *testing.T) { var rmrpush = RmrPush{} resetTestPushDataset(rmrpush, stub.ValidEndpoints) - err = rmrpush.DistributeToEp(stub.ValidPolicies,rtmgr.Eps["localhost"]) + err = rmrpush.DistributeToEp(stub.ValidPolicies,"localhost:4561",100) if err != nil { t.Errorf("rmrpush.DistributetoEp(policies) was incorrect, got: %v, want: %v.", err, "nil") } diff --git a/pkg/sbi/sbi.go b/pkg/sbi/sbi.go index c576c34..21ff78e 100644 --- a/pkg/sbi/sbi.go +++ b/pkg/sbi/sbi.go @@ -176,7 +176,7 @@ func (s *Sbi) updateE2TEndpoints(E2Ts *map[string]rtmgr.E2TInstance, sbi Engine) } } -func (s *Sbi) createEndpoint(payload string,rmrsrc string, sbi Engine) *rtmgr.Endpoint { +func (s *Sbi) createEndpoint(payload string,rmrsrc string, sbi Engine) (*string,int) { xapp.Logger.Debug("CreateEndPoint %v", payload) // stringSlice := strings.Split(payload, " ") // uuid := stringSlice[0] @@ -206,9 +206,10 @@ func (s *Sbi) createEndpoint(payload string,rmrsrc string, sbi Engine) *rtmgr.En xapp.Logger.Info("Wormhole Id created is %d for EndPoint %s",Whid,srcStringSlice[1]) if Whid > 0 { - rtmgr.RmrEp[srcStringSlice[1]] = Whid +// rtmgr.RmrEp[srcStringSlice[1]] = Whid xapp.Logger.Info("received %s and mapped to Whid = %d",srcStringSlice[1],Whid) + return &srcStringSlice[1],Whid } - return nil + return nil,Whid } diff --git a/pkg/sbi/types.go b/pkg/sbi/types.go index 9e6fe02..e2f14ed 100644 --- a/pkg/sbi/types.go +++ b/pkg/sbi/types.go @@ -45,8 +45,8 @@ type Engine interface { AddEndpoint(*rtmgr.Endpoint) error DeleteEndpoint(*rtmgr.Endpoint) error UpdateEndpoints(*rtmgr.RicComponents) - CreateEndpoint(string,string)*rtmgr.Endpoint - DistributeToEp(*[]string, *rtmgr.Endpoint) error + CreateEndpoint(string,string)(*string,int) + DistributeToEp(*[]string, string, int ) error } /*type NngSocket interface { -- 2.16.6