X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fcontrol.go;h=f67f4e290d467a9d88bb1b5bc37be62feaa77920;hb=79448447559c11f6f9a1a509448b199c5fe68976;hp=e4b5820b0f0e7ce0d81d17574ce745044ea557aa;hpb=920cedb92c7fe1f8fa7aeb349a26e20c686f8416;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/control.go b/pkg/control/control.go index e4b5820..f67f4e2 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -86,6 +86,7 @@ type Control struct { ResetTestFlag bool Counters map[string]xapp.Counter LoggerLevel uint32 + UTTesting bool } type RMRMeid struct { @@ -142,25 +143,6 @@ func NewControl() *Control { // Read subscriptions from db c.ReadE2Subscriptions() c.ReadRESTSubscriptions() - - /* - xapp.Logger.Info("Reading subscriptions from db") - subIds, register, err := c.ReadAllSubscriptionsFromSdl() - if err != nil { - xapp.Logger.Error("%v", err) - } else { - c.registry.subIds = subIds - c.registry.register = register - c.HandleUncompletedSubscriptions(register) - } - - restSubscriptions, err := c.ReadAllRESTSubscriptionsFromSdl() - if err != nil { - xapp.Logger.Error("%v", err) - } else { - c.registry.restSubscriptions = restSubscriptions - } - */ return c } @@ -446,7 +428,8 @@ func (c *Control) SubscriptionHandler(params interface{}) (*models.SubscriptionR func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription, subReqList *e2ap.SubscriptionRequestList, clientEndpoint *models.SubscriptionParamsClientEndpoint, meid *string, restSubId *string, xAppRmrEndpoint string, md5sum string) { - xapp.Logger.Info("Subscription Request count=%v ", len(subReqList.E2APSubscriptionRequests)) + c.SubscriptionProcessingStartDelay() + xapp.Logger.Debug("Subscription Request count=%v ", len(subReqList.E2APSubscriptionRequests)) var xAppEventInstanceID int64 var e2EventInstanceID int64 @@ -484,6 +467,19 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription } } +//------------------------------------------------------------------- +// +//------------------------------------------------------------------ +func (c *Control) SubscriptionProcessingStartDelay() { + if c.UTTesting == true { + // This is temporary fix for the UT problem that notification arrives before subscription response + // Correct fix would be to allow notification come before response and process it correctly + xapp.Logger.Debug("Setting 50 ms delay before starting processing Subscriptions") + <-time.After(time.Millisecond * 50) + xapp.Logger.Debug("Continuing after delay") + } +} + //------------------------------------------------------------------- // //------------------------------------------------------------------