-
Notifications
You must be signed in to change notification settings - Fork 46
feat: add NR NTN access detection #684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
donivtech
wants to merge
1
commit into
omec-project:main
Choose a base branch
from
donivtech:feat/ntn-access-detection
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+151
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // SPDX-FileCopyrightText: 2026 Forsway Scandinavia AB | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package context | ||
|
|
||
| // NtnAccessInfo captures Non-Terrestrial Network access properties for a | ||
| // UE, as derived from NGAP signaling. Only NTN-access presence is tracked | ||
| // today; future 3GPP-defined fields (satelliteBackhaulCategory, | ||
| // geoSatelliteId, NTN TAI list) can be added without reshaping AmfUe or | ||
| // RanUe. | ||
| type NtnAccessInfo struct { | ||
| // Detected is set true the first time the NRNTN-TAI-Information | ||
| // protocol extension is observed in a UserLocationInformationNR for | ||
| // this UE. It is sticky: once set, 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. | ||
| Detected bool `json:"detected"` | ||
| } | ||
|
|
||
| // IsNtn reports whether NTN access has been observed for this UE during | ||
| // the current UE context. The flag is sticky for the session — see | ||
| // NtnAccessInfo.Detected for the rationale. | ||
| func (ue *AmfUe) IsNtn() bool { | ||
| return ue.NtnAccess != nil && ue.NtnAccess.Detected | ||
| } | ||
|
|
||
| // updateNtnAccess records observed NTN access on this RanUe. | ||
| // | ||
| // detected==false is a no-op: the NRNTN-TAI-Information extension is | ||
| // PRESENCE optional per 3GPP TS 38.413, so an absent extension does not | ||
| // imply the UE has left NTN access. The flag is sticky for the lifetime | ||
| // of the UE context. | ||
| func (ranUe *RanUe) updateNtnAccess(detected bool) { | ||
| if !detected { | ||
| return | ||
| } | ||
| if ranUe.NtnAccess != nil && ranUe.NtnAccess.Detected { | ||
| return | ||
| } | ||
| if ranUe.NtnAccess == nil { | ||
| ranUe.NtnAccess = &NtnAccessInfo{} | ||
| } | ||
| ranUe.NtnAccess.Detected = true | ||
| ranUe.Log.Debugf("NR NTN access detected (NRNTN-TAI-Information extension present)") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // SPDX-FileCopyrightText: 2026 Forsway Scandinavia AB | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package context | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "go.uber.org/zap" | ||
| ) | ||
|
|
||
| func TestRanUeUpdateNtnAccess(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| initial *NtnAccessInfo | ||
| detected bool | ||
| wantPresent bool | ||
| wantDetected bool | ||
| }{ | ||
| { | ||
| name: "nil + not-detected stays nil", | ||
| initial: nil, | ||
| detected: false, | ||
| wantPresent: false, | ||
| }, | ||
| { | ||
| name: "nil + detected allocates true", | ||
| initial: nil, | ||
| detected: true, | ||
| wantPresent: true, | ||
| wantDetected: true, | ||
| }, | ||
| { | ||
| name: "detected + detected stays true", | ||
| initial: &NtnAccessInfo{Detected: true}, | ||
| detected: true, | ||
| wantPresent: true, | ||
| wantDetected: true, | ||
| }, | ||
| { | ||
| name: "detected + not-detected stays true (sticky)", | ||
| initial: &NtnAccessInfo{Detected: true}, | ||
| detected: false, | ||
| wantPresent: true, | ||
| wantDetected: true, | ||
| }, | ||
| { | ||
| name: "not-detected + detected sets true", | ||
| initial: &NtnAccessInfo{Detected: false}, | ||
| detected: true, | ||
| wantPresent: true, | ||
| wantDetected: true, | ||
| }, | ||
| { | ||
| // Unreachable in production (we never allocate with Detected=false), | ||
| // but documents the function's contract: sticky means a !detected | ||
| // signal never modifies state. | ||
| name: "not-detected + not-detected stays false", | ||
| initial: &NtnAccessInfo{Detected: false}, | ||
| detected: false, | ||
| wantPresent: true, | ||
| wantDetected: false, | ||
| }, | ||
| } | ||
| for _, tc := range tests { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| ranUe := &RanUe{ | ||
| NtnAccess: tc.initial, | ||
| Log: zap.NewNop().Sugar(), | ||
| } | ||
| ranUe.updateNtnAccess(tc.detected) | ||
|
|
||
| if got := ranUe.NtnAccess != nil; got != tc.wantPresent { | ||
| t.Fatalf("NtnAccess presence: got %v, want %v", got, tc.wantPresent) | ||
| } | ||
| if !tc.wantPresent { | ||
| return | ||
| } | ||
| if ranUe.NtnAccess.Detected != tc.wantDetected { | ||
| t.Errorf("Detected = %v, want %v", ranUe.NtnAccess.Detected, tc.wantDetected) | ||
| } | ||
| }) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?