Skip to content

fix(amfd,udmd,nefd): an expired subscription is not revived, the UDM refresh keeps reportingOptions, the AF is told on removal (#2133) - #2152

Merged
parlakisik merged 3 commits into
mainfrom
b2-2133-r42-gaps
Nov 20, 2026
Merged

parlakisik merged 3 commits into
mainfrom
b2-2133-r42-gaps

Conversation

@parlakisik

Copy link
Copy Markdown
Contributor

Closes #2133.

These are R42's three pre-existing gaps from the #2128 review, in one PR. The branch has main merged in, including #2144 (udmd EE expiry), and its udmd and nefd suites were rerun after that merge.

Verified against main (#2128 merged)

Item On main
1. amfd modify revives an expired subscription True. event_subscription_find does not filter on expiry, so a replace /options/expiry answered 200 and the subscription came back to life
2a. nefd add /reportingOptions replaces the object True. Under RFC 6902 §4.1, add on an existing member replaces it, so every other reportingOptions member the UDM held was dropped
2b. udmd applies a nested patch No. apply_ee_patch refused any path deeper than the top level, so nefd could not target /reportingOptions/expiry even at our own UDM
3. The AF is not told when the NEF removes its subscription True, at all three places the NEF removes one on its own: a 404 on refresh, an expiry that passed before a refresh got through, and a deferred leg past its deadline

TS 29.122 MonitoringNotification (which TS 29.522's MonitoringEvent API reuses) defines cancelInd: "Indicates whether to request to cancel the corresponding monitoring subscription". subscription is its only required member. The spec does define a termination indication, so it is sent rather than documented as a ceiling.

Changes

  1. amfd: a modify of an expired subscription answers 404 SUBSCRIPTION_NOT_FOUND and sweeps it: the subscription is removed and its periodic timer cancelled. A DELETE of an expired one is unchanged (204).
  2. nefd: the UDM refresh is now add /reportingOptions/expiry for any leg that recorded an expiry, which means it was made with reportingOptions (nefd: subscriptions created after a create timeout are unrecorded; bound them with expiry and refresh #2102). A leg made before nefd: subscriptions created after a create timeout are unrecorded; bound them with expiry and refresh #2102 has none and still gets the whole object, so nothing is lost there.
    udmd: an EE PatchItem may address a member at any depth (RFC 6901: objects and arrays, -, ~0/~1). The parent must exist. The patch is applied to a copy and committed only if every op applies. fix(udmd): an EE subscription lapses at its granted reportingOptions.expiry (#2125) #2144's expiry grant then applies to the result, as before.
  3. nefd: remove_and_tell_af at the three NEF-initiated sites. It POSTs {"subscription": <self link>, "cancelInd": true} to the AF on a detached task, best effort like every AF notification. An AF-requested DELETE is not notified, and neither is an abandoned create (Cancellation-unsafe side effects in nefd, udmd, pcfd and lmfd #1877), since that AF holds no link.
  4. Docs: nef.md and udm.md.

Acceptance vs evidence (each revert done on its own, restored, and checked with diff)

Item Test Revert, and what fails
1 amfd a_modify_does_not_revive_an_expired_subscription_2133: 404 with that cause, the subscription is gone, and the live subscription's identical PATCH is 200 The whole expiry filter removed: the expired PATCH is not 404
2 (udmd) ee_patch_sets_a_nested_member_and_keeps_its_siblings_2133: maxNumOfReports survives, the object form replaces, array and escaped ops work, and four bad patches change nothing Top-level only: fails at expect("nested add")
2 (nefd) the_udm_refresh_adds_the_expiry_member_not_the_object_2133; #2102's refresh test now expects the member path The UDM arm always sends the object: the unit test fails
3 a_subscription_the_nef_removes_is_cancelled_at_the_af_2133: a real AF stub gets exactly 3 cancellations, one per site Each site back to a silent subscription_remove: that site's "the AF is told" assertion fails (lines 4136, 4143 and 4159)

Gates (local)

  • cargo fmt --all --check.
  • clippy --all-targets -D warnings for amfd, udmd and nefd, plus nefd --features demo-d445a-fl-t8.
  • Full suites for amfd (1442 lib + others), udmd and nefd; udmd and nefd again after merging main.
  • The nefd tests looped 5 times.
  • The workspace run is left to CI.

…refresh keeps reportingOptions, the AF is told on removal (#2133)

R42's pre-existing gaps from the #2128 review:

- amfd: a modify of a Namf_EventExposure subscription whose expiry has
  passed answers 404 SUBSCRIPTION_NOT_FOUND and sweeps it. It used to answer
  200, and a refreshed expiry revived it. It no longer exists
  (TS 29.518 §5.3.2.2.3).
- nefd: the UDM refresh is `add /reportingOptions/expiry`. RFC 6902 `add`
  on `/reportingOptions` replaces the whole object and drops the UDM's other
  members. A leg made before #2102, which has no reportingOptions, still
  gets the object.
- udmd: an EE subscription PatchItem may address a member at any depth
  (RFC 6901), so that refresh applies. A patch is applied to a copy and
  committed only if every op applies.
- nefd: when the NEF removes an AF's subscription on its own initiative
  (404 on refresh, expired before a refresh, deferred past its deadline),
  the AF gets a MonitoringNotification with `cancelInd: true` (TS 29.122).

Spec: specs/nef-amf-udm-subscription-lifecycle-2133.md
Spec: specs/nef-amf-udm-subscription-lifecycle-2133.md
Spec: specs/nef-amf-udm-subscription-lifecycle-2133.md
@parlakisik

Copy link
Copy Markdown
Contributor Author

R42 review: #2152 (head b4607e9, Closes #2133)

Tested on b4607e9 merged with origin/main. cargo test -p nextgcore-nefd -p nextgcore-amfd -p nextgcore-udmd passes on all 20 result lines (1796 tests).

Merge order: #2144 is merged (63b8f21), and this branch already contains it. #2144's modify 404 filter and expiry re-grant are intact, and re-grant still runs after apply_ee_patch. No merge after #2144 is needed.

Verified. Each revert below was a behavioural edit run on its own; I restored each and the tree is clean.

  1. amfd: a modify of an expired subscription answers 404 SUBSCRIPTION_NOT_FOUND and sweeps the subscription (amfd/src/namf_server.rs:2993). Expiry check disabled: a_modify_does_not_revive_an_expired_subscription_2133 fails with 200 at "an expired subscription is not modified" (:10032).
  2. udmd and nefd: reportingOptions is no longer replaced whole.
    • nefd sends add /reportingOptions/expiry for a leg that recorded an expiry (nefd/src/main.rs:1876). Member path disabled: the_udm_refresh_adds_the_expiry_member_not_the_object_2133 and nefd: subscriptions created after a create timeout are unrecorded; bound them with expiry and refresh #2102's refresh test both fail.
    • udmd now applies a JSON Pointer of any depth (RFC 6901/6902, parent must exist). Top-level only again: ee_patch_sets_a_nested_member_and_keeps_its_siblings_2133 fails at :6318.
    • Patches apply to a copy and commit all-or-nothing. Applied in place instead: the same test fails at "nothing applied" (:6360).
  3. The AF is told. Your TS 29.122 reading is right, and it is stronger than "defined". §4.4.2.4 (29122-k10.txt:1069, :1073) says that when the network side deletes the resource, the SCEF shall "send an HTTP POST message including the subscription identifier and a cancellation indication" set to true. cancelInd is defined at :3839-3842, and TS 29.522's MonitoringEvent API reuses it. So the fix is notifying, not documenting a ceiling. Pending-deadline site reverted to a silent remove: a_subscription_the_nef_removes_is_cancelled_at_the_af_2133 fails at :4160. The removal is persisted before the notification goes out. An AF DELETE racing it gets None back, so nothing is sent.

minor

  1. cancellation_notification (nefd/src/main.rs:1966) always sends the T8 shape, with a /3gpp-monitoring-event/... link, including to subscriptions made through Nnef_EventExposure (TS 29.591). Those consumers expect NefEventExposureNotif, and TS 29.591 has no cancelInd. Every nefd notification is already T8-shaped (build_monitoring_notification), so this predates the PR, but it is a new message to those consumers. The record does not store which northbound API was used. Consider storing it and telling only T8 subscribers, or note the gap.
  2. Rolling upgrade: nefd's nested /reportingOptions/expiry is refused (400) by a udmd older than this PR, which handles top-level paths only. nefd treats a 4xx as a per-leg failure, so every refresh fails and the legs lapse and are removed. Both ship in this PR, so it only bites with mixed versions. Worth a sentence in the release notes: upgrade udmd before nefd.
  3. Nit: parse::<usize>() accepts "01" as an array index (udmd/src/app.rs:3028). RFC 6901 forbids leading zeros. It is harmless here.

VERDICT: APPROVE

@parlakisik parlakisik added the review-approved Independent reviewer agent approved: corner cases, validation, tests, production readiness label Nov 20, 2026
@parlakisik
parlakisik merged commit 1385762 into main Nov 20, 2026
18 checks passed
@parlakisik
parlakisik deleted the b2-2133-r42-gaps branch November 20, 2026 04:18
parlakisik added a commit that referenced this pull request Nov 20, 2026
#2089 landed squashed (6e702d7), so its files met this branch's as add/add: ausfd app.rs and sbi tests/owner_binding_callers.rs take this branch's side, which is #2089's content plus #2132's change (main has no other change to them since 2f10266). nefd main.rs auto-merged with #2152.

Spec: specs/nefd-ausfd-verified-identity-2132.md
parlakisik added a commit that referenced this pull request Nov 20, 2026
…tions, an old udmd is refreshed, no leading-zero index (#2154) (#2158)

R42 on #2152:
- nefd records the northbound API each subscription was made on. A
  Nnef_EventExposure subscriber is now notified with a TS 29.591
  NefEventExposureNotif (notifId; eventNotifs[{event, timeStamp}]) instead
  of a T8 MonitoringNotification. TS 29.591 defines no cancellation
  indication, so none is sent to it when the NEF removes its subscription.
  Both ceilings are documented in nef.md.
- Upgrade order: udmd before nefd (CHANGELOG, nef.md). As a fallback, a 400
  to the `add /reportingOptions/expiry` refresh (a udmd from before #2133)
  is retried once with the whole object.
- udmd refuses a JSON Pointer array index with a leading zero or a sign
  (RFC 6901 §4).

Spec: specs/nefd-udmd-2152-followups-2154.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-approved Independent reviewer agent approved: corner cases, validation, tests, production readiness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

amfd/udmd/nefd: pre-existing subscription lifecycle gaps found in #2128 review

1 participant