X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fcontrol.go;h=152d08a3c879b5d4863172af351d0918ceba6678;hb=f28853b537355b9ce04d7f3617bc80b3f0c34a1a;hp=b5c60ec554d890f2df4eb07575ab5b0ac694d8f2;hpb=e4c9c4d411bc706901d0ffd2217b1941d3b83381;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/control.go b/pkg/control/control.go index b5c60ec..152d08a 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -331,17 +331,39 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran subRfMsg, valid := subs.GetCachedResponse() if subRfMsg == nil && valid == true { - event := c.sendE2TSubscriptionRequest(subs, trans, parentTrans) - switch event.(type) { - case *e2ap.E2APSubscriptionResponse: - subRfMsg, valid = subs.SetCachedResponse(event, true) - case *e2ap.E2APSubscriptionFailure: - subRfMsg, valid = subs.SetCachedResponse(event, false) - default: - xapp.Logger.Info("SUBS-SubReq: internal delete due event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) - subRfMsg, valid = subs.SetCachedResponse(nil, false) - c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) + + // + // In case of failure + // - make internal delete + // - in case duplicate cause, retry (currently max 1 retry) + // + maxRetries := uint64(1) + doRetry := true + for retries := uint64(0); retries <= maxRetries && doRetry; retries++ { + doRetry = false + + event := c.sendE2TSubscriptionRequest(subs, trans, parentTrans) + switch themsg := event.(type) { + case *e2ap.E2APSubscriptionResponse: + subRfMsg, valid = subs.SetCachedResponse(event, true) + case *e2ap.E2APSubscriptionFailure: + subRfMsg, valid = subs.SetCachedResponse(event, false) + doRetry = true + for _, item := range themsg.ActionNotAdmittedList.Items { + if item.Cause.Content != e2ap.E2AP_CauseContent_Ric || (item.Cause.Value != e2ap.E2AP_CauseValue_Ric_duplicate_action && item.Cause.Value != e2ap.E2AP_CauseValue_Ric_duplicate_event) { + doRetry = false + break + } + } + xapp.Logger.Info("SUBS-SubReq: internal delete and possible retry due event(%s) retry(%t,%d/%d) %s", typeofSubsMessage(event), doRetry, retries, maxRetries, idstring(nil, trans, subs, parentTrans)) + c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) + default: + xapp.Logger.Info("SUBS-SubReq: internal delete due event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) + subRfMsg, valid = subs.SetCachedResponse(nil, false) + c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) + } } + xapp.Logger.Debug("SUBS-SubReq: Handling (e2t response %s) %s", typeofSubsMessage(subRfMsg), idstring(nil, trans, subs, parentTrans)) } else { xapp.Logger.Debug("SUBS-SubReq: Handling (cached response %s) %s", typeofSubsMessage(subRfMsg), idstring(nil, trans, subs, parentTrans))