X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fcontrol.go;h=1f769e1229af9560582ae63bd4ded958a98e95b3;hb=bf583163d3f26548dbeafd5631f83a403313d52f;hp=b4667e0e9d166665b3b20b7e9eec2586d054dc5f;hpb=84662c4f3e2273152fc849f74880108b6346bcad;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/control.go b/pkg/control/control.go index b4667e0..1f769e1 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -696,7 +696,11 @@ func (c *Control) handleSubscriptionRequest(trans *TransactionXapp, subReqMsg *e } xapp.Logger.Error("XAPP-SubReq E2 subscription failed: %s", idstring(err, trans, subs)) - c.registry.RemoveFromSubscription(subs, trans, waitRouteCleanup_ms, c) + // If policy type subscription fails we cannot remove it only internally. Once subscription has been created + // successfully, it must be deleted on both sides. + if subs.PolicyUpdate == false { + c.registry.RemoveFromSubscription(subs, trans, waitRouteCleanup_ms, c) + } return nil, &errorInfo, err } @@ -1132,7 +1136,13 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran subRfMsg, valid = subs.SetCachedResponse(event, true) subs.SubRespRcvd = true case *e2ap.E2APSubscriptionFailure: - subRfMsg, valid = subs.SetCachedResponse(event, false) + if subs.PolicyUpdate == false { + subRfMsg, valid = subs.SetCachedResponse(event, false) + } else { + // In policy update case where subscription has already been created successfully in Gnb + // we cannot delete subscription internally in submgr + subRfMsg, valid = subs.SetCachedResponse(event, true) + } xapp.Logger.Debug("SUBS-SubReq: internal delete due failure event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) case *SubmgrRestartTestEvent: // This is used to simulate that no response has been received and after restart, subscriptions are restored from db @@ -1156,6 +1166,9 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran } else { xapp.Logger.Debug("SUBS-SubReq: Handling (cached response %s) %s", typeofSubsMessage(subRfMsg), idstring(nil, trans, subs, parentTrans)) } + xapp.Logger.Debug("subs.PolicyUpdate: %v", subs.PolicyUpdate) + xapp.Logger.Debug("subs: %v", subs) + if valid == false { removeSubscriptionFromDb = true }