RIC-79 intial implementation to fetch subscriptions via rest
Change-Id: Iff2915998c130cb93fa3b1767b2499d8ef3713e5
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
diff --git a/pkg/control/registry.go b/pkg/control/registry.go
index f24dccd..b816b61 100644
--- a/pkg/control/registry.go
+++ b/pkg/control/registry.go
@@ -22,6 +22,7 @@
import (
"fmt"
"gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
+ "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 +47,19 @@
}
}
+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]