X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fcontrol.go;h=933df7f9986b23c6a9f36902f380c55e65d7fa45;hb=6d629ad71687993ee08b6193e957439f5c87aa22;hp=7d180ad6d914d7303bacb313b3d01a61d1eb0a7d;hpb=c92b421ec9f89e77df36422987e478ed8db85299;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/control.go b/pkg/control/control.go index 7d180ad..933df7f 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -469,44 +469,25 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran subRfMsg, valid := subs.GetCachedResponse() if subRfMsg == nil && valid == true { - - // - // 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) - subs.SubRespRcvd = true - case *e2ap.E2APSubscriptionFailure: - removeSubscriptionFromDb = true - 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) - case *SubmgrRestartTestEvent: - // This simulates that no response has been received and after restart subscriptions are restored from db - xapp.Logger.Debug("Test restart flag is active. Dropping this transaction to test restart case") - return - default: - xapp.Logger.Info("SUBS-SubReq: internal delete due event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) - removeSubscriptionFromDb = true - subRfMsg, valid = subs.SetCachedResponse(nil, false) - c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) - } + event := c.sendE2TSubscriptionRequest(subs, trans, parentTrans) + switch event.(type) { + case *e2ap.E2APSubscriptionResponse: + subRfMsg, valid = subs.SetCachedResponse(event, true) + subs.SubRespRcvd = true + case *e2ap.E2APSubscriptionFailure: + removeSubscriptionFromDb = true + subRfMsg, valid = subs.SetCachedResponse(event, false) + xapp.Logger.Info("SUBS-SubReq: internal delete due event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) + c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) + case *SubmgrRestartTestEvent: + // This simulates that no response has been received and after restart subscriptions are restored from db + xapp.Logger.Debug("Test restart flag is active. Dropping this transaction to test restart case") + return + default: + xapp.Logger.Info("SUBS-SubReq: internal delete due event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) + removeSubscriptionFromDb = true + 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 {