X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=pkg%2Fcontrol%2Fcontrol.go;fp=pkg%2Fcontrol%2Fcontrol.go;h=1bcffc6d8f843839557b4c737429cfc75c6ccee5;hb=08c8fbd6d2d26e17b87aac8438d035813170bc91;hp=94109258bb8a228828c6cf928e3985d88ac5c988;hpb=cb7dd49aa5f40a880b37a6bc35c972ef2773c164;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/control.go b/pkg/control/control.go index 9410925..1bcffc6 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -87,6 +87,7 @@ type Control struct { ResetTestFlag bool Counters map[string]xapp.Counter LoggerLevel int + UTTesting bool } type RMRMeid struct { @@ -483,6 +484,7 @@ func (c *Control) GetE2SubscriptionDirectives(p *models.SubscriptionParams) (*E2 func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription, subReqList *e2ap.SubscriptionRequestList, clientEndpoint *models.SubscriptionParamsClientEndpoint, meid *string, restSubId *string, xAppRmrEndpoint string, md5sum string, e2SubscriptionDirectives *E2SubscriptionDirectives) { + c.SubscriptionProcessingStartDelay() xapp.Logger.Debug("Subscription Request count=%v ", len(subReqList.E2APSubscriptionRequests)) var xAppEventInstanceID int64 @@ -523,6 +525,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") + } +} + //------------------------------------------------------------------- // //------------------------------------------------------------------