Skip to content

Fix AMF/SMF match filters, add TAI filter, cache regex - #173

Merged
gab-arrobo merged 2 commits into
omec-project:mainfrom
gab-arrobo:fix-filters
Aug 7, 2026
Merged

Fix AMF/SMF match filters, add TAI filter, cache regex#173
gab-arrobo merged 2 commits into
omec-project:mainfrom
gab-arrobo:fix-filters

Conversation

@gab-arrobo

Copy link
Copy Markdown
Contributor

No description provided.

@gab-arrobo
gab-arrobo requested review from a team and a lite review from Copilot August 7, 2026 04:06
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates NRF cache discovery matching to align more closely with 3GPP TS 29.510 semantics for AMF/SMF filtering, adds AMF TAI-based filtering, and introduces regex compilation caching to reduce repeated SUPI-pattern compilation overhead.

Changes:

  • Adjust AMF target PLMN handling so profiles without plmnList match any target-plmn-list filter; add tai filtering via amfInfo.taiList.
  • Fix SMF DNN matching so dnn is evaluated within the matched S-NSSAI context when snssais is provided.
  • Cache compiled SUPI regex patterns to avoid recompiling on each match; add tests covering the AMF/SMF behavior.

Reviewed changes

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

File Description
VERSION Bumps project version to 2.2.0.
nrfcache/nrfcache_test.go Adds unit tests for AMF PLMN-list absence behavior, AMF TAI filtering, and SMF DNN scoping to matched S-NSSAI.
nrfcache/match_filters.go Implements AMF PLMN-list/TAI filter semantics, scopes SMF DNN matching to matching S-NSSAI entries, and adds regex compile caching.

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

Comment thread nrfcache/match_filters.go Outdated
Comment thread nrfcache/match_filters.go Outdated
Comment thread nrfcache/nrfcache_test.go Outdated
Copilot AI review requested due to automatic review settings August 7, 2026 04:20

Copilot AI left a comment

Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

nrfcache/match_filters.go:170

  • The SUPI regex cache size check is not concurrency-safe: multiple goroutines can observe the count below the cap and all store new patterns, so the cache can grow beyond maxRegexpCacheEntries despite the comment saying it is capped. Consider enforcing the cap with an atomic CAS around the counter and deleting the just-stored entry if the cap is reached.
			if regexpCacheCount.Load() < maxRegexpCacheEntries {
				if _, loaded := regexpCache.LoadOrStore(pattern, r); !loaded {
					regexpCacheCount.Add(1)
				}
			}

nrfcache/match_filters.go:336

  • taiInList compares Nid via GetNid(), which collapses an unset Nid to the empty string. That makes the behavior slightly broader than the comment suggests (a present-but-empty Nid would match an absent Nid). If you want the documented behavior ("absent matches only absent"), also compare Nid presence via HasNid().
// taiInList matches PlmnId, Tac, and Nid; an absent Nid (PLMN context) matches only another absent Nid.
func taiInList(tai models.Tai, list []models.Tai) bool {
	for _, t := range list {
		if t.GetPlmnId() == tai.GetPlmnId() && t.GetTac() == tai.GetTac() && t.GetNid() == tai.GetNid() {
			return true

Copilot AI review requested due to automatic review settings August 7, 2026 04:36
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

nrfcache/match_filters.go:316

  • TAI filtering is only applied against amfInfo.taiList. If a profile uses amfInfo.taiRangeList (and taiList is empty), the current logic will treat it as unrestricted and allow it through even when the queried TAI is outside the allowed TAC ranges. This can make cached discovery results diverge from live NRF filtering for AMFs that rely on taiRangeList.
		tai := opts.GetTai()
		// Absent taiList and taiRangeList means unrestricted (TS 29.510 Table 6.1.6.2.11-1).
		// taiRangeList matching is not yet implemented; profiles with only taiRangeList pass through.
		if tai != nil && len(amfInfo.GetTaiList()) > 0 && !taiInList(*tai, amfInfo.GetTaiList()) {
			logger.NrfcacheLog.Debugf("amf match failed: TAI mismatch for %s", profile.GetNfInstanceId())
			return false, nil

@gab-arrobo
gab-arrobo merged commit 56ddfb4 into omec-project:main Aug 7, 2026
9 checks passed
@gab-arrobo
gab-arrobo deleted the fix-filters branch August 7, 2026 04:58
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.

3 participants