X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fregistry.go;h=25709605a29c1a56c8d5d333abc19af599eba112;hb=7348625b9ef03d41dd5a0ca0f6c508376259717e;hp=9cacd9433333d8da7f528ad379097053533819b1;hpb=e530286062bdc07625e54433bd64530ae7ae2118;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/registry.go b/pkg/control/registry.go index 9cacd94..2570960 100644 --- a/pkg/control/registry.go +++ b/pkg/control/registry.go @@ -22,6 +22,8 @@ package control import ( "fmt" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" + "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/xapptweaks" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" "sync" "time" @@ -46,6 +48,19 @@ func (r *Registry) Initialize() { } } +func (r *Registry) QueryHandler() (models.SubscriptionList, error) { + r.mutex.Lock() + defer r.mutex.Unlock() + + resp := models.SubscriptionList{} + for _, subs := range r.register { + subs.mutex.Lock() + resp = append(resp, &models.SubscriptionData{SubscriptionID: int64(subs.ReqId.Seq), Meid: subs.Meid.RanName, Endpoint: subs.EpList.StringList()}) + subs.mutex.Unlock() + } + return resp, nil +} + func (r *Registry) allocateSubs(trans *TransactionXapp, subReqMsg *e2ap.E2APSubscriptionRequest) (*Subscription, error) { if len(r.subIds) > 0 { sequenceNumber := r.subIds[0] @@ -125,7 +140,7 @@ func (r *Registry) AssignToSubscription(trans *TransactionXapp, subReqMsg *e2ap. // Find possible existing Policy subscription // if actionType == e2ap.E2AP_ActionTypePolicy { - if subs, ok := r.register[subReqMsg.RequestId.Seq]; ok { + if subs, ok := r.register[trans.GetSubId()]; ok { xapp.Logger.Debug("CREATE %s. Existing subscription for Policy found", subs.String()) subs.SetCachedResponse(nil, true) return subs, nil @@ -230,7 +245,7 @@ func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *Transaction // // Subscription route delete // - tmpList := RmrEndpointList{} + tmpList := xapptweaks.RmrEndpointList{} tmpList.AddEndpoint(trans.GetEndpoint()) subRouteAction := SubRouteInfo{tmpList, uint16(seqId)} r.rtmgrClient.SubscriptionRequestDelete(subRouteAction)