Skip to content

feat: add NR NTN access detection#684

Open
donivtech wants to merge 1 commit into
omec-project:mainfrom
donivtech:feat/ntn-access-detection
Open

feat: add NR NTN access detection#684
donivtech wants to merge 1 commit into
omec-project:mainfrom
donivtech:feat/ntn-access-detection

Conversation

@donivtech
Copy link
Copy Markdown
Contributor

@donivtech donivtech commented Apr 24, 2026

Closes #683.

Detects NR Non-Terrestrial Network access by checking for the NRNTN-TAI-Information protocol extension (ID 287 per 3GPP TS 38.413) inside UserLocationInformationNR.IEExtensions received over NGAP, and tracks the result on the UE context.

Changes

  • New context.NtnAccessInfo struct (carries Detected bool today; shaped to hold future satelliteBackhaulCat / geoSatelliteId / NTN TAI list without reshaping AmfUe/RanUe).
  • AmfUe.NtnAccess, RanUe.NtnAccess, AmfUe.IsNtn() helper.
  • Detection inside RanUe.UpdateLocation (NR branch), running after the NR TAI/CGI parsing succeeds so a malformed message cannot leave NTN state out of sync with the stored location.
  • Detection itself uses ngap.HasUserLocationInformationNRExtension from omec-project/ngap@v1.9.1 (added in omec-project/ngap#87).
  • 6 table-driven cases in context/ran_ue_test.go covering the NTN-state semantics on RanUe.updateNtnAccess.

Detection semantics — sticky

Detected is set true the first time the NRNTN-TAI-Information extension is observed for a UE during the current UE context. It is not cleared while the UE context lives. The extension is PRESENCE optional per 3GPP TS 38.413 and gNBs include it at their discretion — typically on context-establishing events (initial UE message, handover) but often not on routine uplink/location reports. Treating an absent extension as evidence of "not NTN" would cause IsNtn() to flap on routine NGAP traffic for a UE that genuinely is on NTN; sticky-on avoids that.

Scope

Detection-only groundwork. No protocol behavior changes, no SBI payloads change, nothing reads the flag yet. Follow-up patches will extend NtnAccessInfo and wire NTN into the SBI path once satelliteBackhaulCat / geoSatelliteId are available in omec-project/openapi.

Test plan

  • go build ./... clean
  • go vet ./... clean
  • go test ./... all pass (6 new sticky-semantics cases in context/ran_ue_test.go)
  • make lint (golangci-lint via Docker) — 0 issues

@donivtech donivtech force-pushed the feat/ntn-access-detection branch from 7c00259 to 807d151 Compare April 27, 2026 07:07
@donivtech donivtech marked this pull request as ready for review April 27, 2026 07:07
@donivtech donivtech requested a review from a team April 27, 2026 07:07
Comment thread context/ntn.go Outdated
donivtech pushed a commit to donivtech/ngap that referenced this pull request Apr 29, 2026
Add the NGAP protocol IE/extension identifier 287 assigned to
NRNTN-TAI-Information per 3GPP TS 38.413. This IE-extension is
optionally carried inside UserLocationInformationNR.IEExtensions
and indicates that the UE is being served over NR Non-Terrestrial
Network access.

The full Rel-17 IE type (NRNTNTAIInformation SEQUENCE) is not yet
defined here; this commit only adds the bare ID so that callers
checking presence of the extension can reference a canonical
constant rather than hard-coding 287. The type definition and the
remaining Rel-16/17/18 IE IDs are expected to land as part of the
broader NGAP release uplift.

Used by omec-project/amf#684 (NTN access detection).

Signed-off-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>
donivtech pushed a commit to donivtech/ngap that referenced this pull request Apr 29, 2026
Add a small NGAP-aware helper that reports whether a given
UserLocationInformationNR carries a protocol extension with the
specified ProtocolIE-ID inside its IEExtensions container.

Generic over the extension ID, so callers can compose it with any
existing or future ProtocolIEID* constant (NRNTN-TAI-Information being
the immediate use case from omec-project/amf#684).

Keeping NGAP-aware inspection helpers in this repo makes the eventual
N2 release uplift easier to scope: all NGAP-touching code lives here.

Signed-off-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>
donivtech pushed a commit to donivtech/ngap that referenced this pull request Apr 30, 2026
Add a small NGAP-aware helper that reports whether a given
UserLocationInformationNR carries a protocol extension with the
specified ProtocolIE-ID inside its IEExtensions container.

Generic over the extension ID, so callers can compose it with any
existing or future ProtocolIEID* constant (NRNTN-TAI-Information being
the immediate use case from omec-project/amf#684).

Keeping NGAP-aware inspection helpers in this repo makes the eventual
N2 release uplift easier to scope: all NGAP-touching code lives here.

Signed-off-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>
gab-arrobo pushed a commit to omec-project/ngap that referenced this pull request Apr 30, 2026
* feat: add NRNTN-TAI-Information protocol IE/extension ID

Add the NGAP protocol IE/extension identifier 287 assigned to
NRNTN-TAI-Information per 3GPP TS 38.413. This IE-extension is
optionally carried inside UserLocationInformationNR.IEExtensions
and indicates that the UE is being served over NR Non-Terrestrial
Network access.

The full Rel-17 IE type (NRNTNTAIInformation SEQUENCE) is not yet
defined here; this commit only adds the bare ID so that callers
checking presence of the extension can reference a canonical
constant rather than hard-coding 287. The type definition and the
remaining Rel-16/17/18 IE IDs are expected to land as part of the
broader NGAP release uplift.

Used by omec-project/amf#684 (NTN access detection).

Signed-off-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>

* feat: add HasUserLocationInformationNRExtension helper

Add a small NGAP-aware helper that reports whether a given
UserLocationInformationNR carries a protocol extension with the
specified ProtocolIE-ID inside its IEExtensions container.

Generic over the extension ID, so callers can compose it with any
existing or future ProtocolIEID* constant (NRNTN-TAI-Information being
the immediate use case from omec-project/amf#684).

Keeping NGAP-aware inspection helpers in this repo makes the eventual
N2 release uplift easier to scope: all NGAP-touching code lives here.

Signed-off-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>

* Create patch release

Signed-off-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>

---------

Signed-off-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>
Co-authored-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>
@donivtech donivtech force-pushed the feat/ntn-access-detection branch from 807d151 to ec87ad6 Compare May 5, 2026 07:14
@donivtech
Copy link
Copy Markdown
Contributor Author

ngap#87 merged and v1.9.1 tagged. Force-pushed: bumped go.mod to ngap v1.9.1, dropped the local constant and helper, now using ngap.HasUserLocationInformationNRExtension(loc, ngapType.ProtocolIEIDNRNTNTAIInformation) directly.

@gab-arrobo
Copy link
Copy Markdown
Contributor

ngap#87 merged and v1.9.1 tagged. Force-pushed: bumped go.mod to ngap v1.9.1, dropped the local constant and helper, now using ngap.HasUserLocationInformationNRExtension(loc, ngapType.ProtocolIEIDNRNTNTAIInformation) directly.

I think you need to rebase your PR and address any conflict because the amf is already using ngap v1.9.1 (https://github.com/omec-project/amf/blob/main/go.mod#L14)

@donivtech donivtech force-pushed the feat/ntn-access-detection branch from ec87ad6 to 3988068 Compare May 5, 2026 16:07
@donivtech
Copy link
Copy Markdown
Contributor Author

Good catch, rebased now. Diff are just the context/ changes.

@gab-arrobo gab-arrobo requested a review from Copilot May 5, 2026 16:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds groundwork in the AMF UE/RAN UE context layer to detect NR Non-Terrestrial Network (NTN) access from NGAP UserLocationInformationNR by checking for the NRNTN-TAI-Information extension, and stores the result on UE context objects for future use.

Changes:

  • Introduces context.NtnAccessInfo and AmfUe.IsNtn() helper.
  • Tracks NTN detection on RanUe during NR UpdateLocation and propagates it to AmfUe.
  • Extends AmfUe with an NtnAccess field to persist/access the detection result.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
context/ran_ue.go Detects NR NTN by presence of the NRNTN-TAI-Information extension during NR location updates and propagates NTN state to AmfUe.
context/ntn.go Adds NtnAccessInfo and AmfUe.IsNtn() helper to represent/query NTN access.
context/amf_ue.go Stores NTN access state on AmfUe via a new NtnAccess field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread context/ran_ue.go Outdated
Comment thread context/ran_ue.go
Comment thread context/ntn.go Outdated
Comment thread context/ntn.go Outdated
@gab-arrobo
Copy link
Copy Markdown
Contributor

@donivtech, please check Copilot's comments (make sure the comments are valid) and address them if applicable

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread context/ran_ue.go Outdated
Comment thread context/ran_ue.go Outdated
Comment thread context/ntn.go Outdated
Comment thread context/ntn.go Outdated
Comment thread context/ran_ue_test.go Outdated
@donivtech donivtech force-pushed the feat/ntn-access-detection branch 2 times, most recently from c84e3dc to 6fe40ea Compare May 7, 2026 17:34
@donivtech
Copy link
Copy Markdown
Contributor Author

  • Reverted to sticky-on. NRNTN-TAI-Information is PRESENCE optional per TS 38.413, and UpdateLocation is called from 11 NGAP handlers; non-sticky would flap on routine traffic where the extension is omitted. Doc strings spell this out.
  • Moved the NTN check to after NR TAI/CGI parsing (Copilot remove export port and clean make output #5) so a malformed message can't desync NTN state from the stored location.
  • Fixed copyright to Forsway Scandinavia AB on both new files.
  • Rebased on current main.

@donivtech
Copy link
Copy Markdown
Contributor Author

I initially had this sticky, switched to per-message after Copilot suggested it, but reverted because absence of the optional IE shouldn't be treated as evidence of no NTN access. It would cause false negatives during a session.

@gab-arrobo
Copy link
Copy Markdown
Contributor

I initially had this sticky, switched to per-message after Copilot suggested it, but reverted because absence of the optional IE shouldn't be treated as evidence of no NTN access. It would cause false negatives during a session.

I am currently trying to finalize the migration of the SBI to 3GPP release 18. As soon as those changes are merged, I will come back to this PR. I hope it does not take too long. Sorry for the delay.

@donivtech
Copy link
Copy Markdown
Contributor Author

No worries. Thanks for the heads up.

Detect Non-Terrestrial Network access by checking for the
NRNTN-TAI-Information protocol extension (ID 287 per 3GPP
TS 38.413) in UserLocationInformationNR received via NGAP,
and track the result in a new NtnAccessInfo struct on AmfUe
and RanUe.

This is detection-only groundwork. No protocol behavior
changes: nothing reads the flag yet. Future patches can
extend NtnAccessInfo with satellite backhaul category,
GEO satellite ID, and NTN TAI list as those fields become
available in omec-project/openapi and omec-project/ngap.

Signed-off-by: Vinod Patmanathan <vinod.patmanathan@forsway.com>
@donivtech donivtech force-pushed the feat/ntn-access-detection branch from 6fe40ea to 95109cf Compare May 18, 2026 09:32
@gab-arrobo
Copy link
Copy Markdown
Contributor

@donivtech, are the changes from PR still needed when we migrate the NGAP to release 18?

Comment thread context/amf_ue.go
EventSubscriptionsInfo map[string]*AmfUeEventSubscription `json:"eventSubscriptionInfo,omitempty"`
/* User Location*/
RatType models.RatType `json:"ratType,omitempty"`
NtnAccess *NtnAccessInfo `json:"ntnAccess,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the latest SBI changes (openapi models), I think these changes are not applicable. Instead of creating NtnAccessInfo (Detected: true or false), should not you rely on the models.RatType such as the ones below to make the "Detected" decision? What do you think? Also, do you need NGAP rel-18 as part of these changes?

	...
	RATTYPE_NR_LEO              RatType = "NR_LEO"
	RATTYPE_NR_MEO              RatType = "NR_MEO"
	RATTYPE_NR_GEO              RatType = "NR_GEO"
	RATTYPE_NR_OTHER_SAT        RatType = "NR_OTHER_SAT"
	...

@donivtech
Copy link
Copy Markdown
Contributor Author

Using RatType is agreed in principle. But it's worth noting the current asymmetry. openapi/v2 brought the Rel-18 RatType values (NR_LEO/MEO/GEO/OTHER_SAT), but ngap/v2 is module path bump, so the ASN.1 schema is unchanged from Rel-15. AMF doesn't yet have NGAP to distinguish between LEO/MEO/GEO. The only NTN signal we get is the presence of of the bare NRNTN-TAI-Information extension (ID 287). Contents are not decoded.

What could be done today is to set ue.RatType = RATTYPE_NR_OTHER_SAT whenever the extension is detected (coarse classification). Orbit specific can come once N2 release-18 work lands the proper IE decode.

I can refactor to drop NtnAccessInfo, set RatType to NR_OTHER_SAT from UpdateLocation when the extension is observed. Want me to do that here?

No NGAP Rel-18 dependency, just the presence-check helper we already have in ngap/v2.

@gab-arrobo
Copy link
Copy Markdown
Contributor

openapi/v2 brought the Rel-18 RatType values (NR_LEO/MEO/GEO/OTHER_SAT), but ngap/v2 is module path bump, so the ASN.1 schema is unchanged from Rel-15. AMF doesn't yet have NGAP to distinguish between LEO/MEO/GEO.

So, upgrading the NGAP to release 18 would resolve this limitation, correct? If so, let me see if I can complete the N2 upgrade in the coming days

@donivtech
Copy link
Copy Markdown
Contributor Author

Yes, that would resolve it cleanly. Prefer waiting for the N2 upgrade so the orbit specific RatType lands in one shot.

@gab-arrobo
Copy link
Copy Markdown
Contributor

Yes, that would resolve it cleanly. Prefer waiting for the N2 upgrade so the orbit specific RatType lands in one shot.

@donivtech,
NGAP is upgraded now to rel 18. Please take a look at it. Also, see the new "Find*" (e.g., https://github.com/omec-project/ngap/blob/main/extensions.go#L18). Do we still need the extensions.go file (https://github.com/omec-project/ngap/blob/main/extensions.go)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add NR NTN access detection in AMF

3 participants