X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fcontrol.go;h=c2b33b765ca87737f2d19ec7a756454c2c4333ad;hb=af91f971681842c22dc0fad165c0cbf7ebaa0e4d;hp=a2c8b0d5d84acb812c6154ae237d2848a7ca0392;hpb=422d018f94aedd9f4c001176b5ff06c786de28eb;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/control.go b/pkg/control/control.go index a2c8b0d..c2b33b7 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -23,7 +23,6 @@ import ( "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 @@ type RMRMeid struct { const ( CREATE Action = 0 - MERGE Action = 1 + UPDATE Action = 1 NONE Action = 2 DELETE Action = 3 ) @@ -75,10 +74,7 @@ func init() { 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 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran parentTrans.SendEvent(nil, 0) } - subs.DelEndpoint(parentTrans.GetEndpoint()) + go c.registry.RemoveFromSubscription(subs, parentTrans, 5*time.Second) } //------------------------------------------------------------------- @@ -353,7 +349,7 @@ func (c *Control) handleSubscriptionDelete(subs *Subscription, parentTrans *Tran event := c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) parentTrans.SendEvent(event, 0) - subs.DelEndpoint(parentTrans.GetEndpoint()) + go c.registry.RemoveFromSubscription(subs, parentTrans, 5*time.Second) } //------------------------------------------------------------------- @@ -398,7 +394,7 @@ func (c *Control) sendE2TSubscriptionDeleteRequest(subs *Subscription, trans *Tr subDelReqMsg := &e2ap.E2APSubscriptionDeleteRequest{} subDelReqMsg.RequestId.Id = 123 subDelReqMsg.RequestId.Seq = uint32(subs.GetSubId()) - subDelReqMsg.FunctionId = 0 + subDelReqMsg.FunctionId = subs.SubReqMsg.FunctionId trans.Mtype, trans.Payload, err = c.e2ap.PackSubscriptionDeleteRequest(subDelReqMsg) if err != nil { xapp.Logger.Error("SUBS-SubDelReq: %s parent %s", idstring(trans, subs, err), parentTrans.String())