RIC-1011: Not Removing Subscriptions For Policy Based Subscription Failure
Change-Id: I1d0c70efa12f98df095e71ffd7194dad8572bc27
Signed-off-by: aditverm <aditya.3.verma@nokia.com>
diff --git a/pkg/control/control.go b/pkg/control/control.go
index 227eb0c..5852121 100755
--- a/pkg/control/control.go
+++ b/pkg/control/control.go
@@ -690,7 +690,11 @@
}
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
}
@@ -1126,7 +1130,13 @@
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
@@ -1150,6 +1160,9 @@
} 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
}