Skip to content

feat(n3iwf): add N3IWF-ID support to sctplb gRPC bridge#646

Draft
andybavier wants to merge 3 commits intomainfrom
feat/n3iwf-id-support
Draft

feat(n3iwf): add N3IWF-ID support to sctplb gRPC bridge#646
andybavier wants to merge 3 commits intomainfrom
feat/n3iwf-id-support

Conversation

@andybavier
Copy link
Copy Markdown

@andybavier andybavier commented Mar 19, 2026

Summary

  • Extends the sctplb↔AMF gRPC bridge to support N3IWF (Non-3GPP Interworking Function) nodes alongside existing gNB support
  • Aligns protos/server.proto with sctplb's client.proto — adds N3IWF_MSG, N3IWF_DISC, N3IWF_CONN message types and N3iwfId fields
  • Fixes a pre-existing bug where AMF always set AnType = 3GPP_ACCESS for sctplb-mode UEs, breaking non-3GPP attach flows

Changes

File Change
protos/server.proto Add N3IWF enum values + N3iwfId field to both messages
protos/sdcoreAmfServer/server.pb.go Regenerated
protos/sdcoreAmfServer/server_grpc.pb.go Regenerated
service/amf_server.go Handle N3IWF INIT/DISC/CONN; set RanPresentN3IwfId + NON_3GPP_ACCESS
ngap/dispatcher.go Resolve RAN from N3IwfId; populate correct redirect field
ngap/message/send.go Set N3IwfId vs GnbId based on RanPresent
nas/handler.go Fix AnType assignment; fix redirect field for N3IWF
ngap/handler.go Fix redirect field for N3IWF

Design Notes

  • N3IWF RANs use ran.GnbId to store the N3IWF ID string ("mcc:mnc:n3iwfId") — same as the AmfRanPool key — so AmfRanFindByGnbId works uniformly for both node types
  • RanPresentN3IwfId == 3 is the discriminator for all N3IWF-specific branches

Post-Deploy Monitoring & Validation

  • Logs to watch: GrpcLog entries — "new N3IWF RAN", "N3IWF disconnected", "new N3IWF Connected"
  • Expected healthy behavior: N3IWF INIT_MSG creates a new RAN entry with RanPresentN3IwfId; subsequent NGAP messages route correctly via N3IwfId field; UE attach completes with AccessType_NON_3_GPP_ACCESS
  • Failure signals: "N3IwfId" missing from REDIRECT_MSG (sctplb drops packet); UE stuck in non-3GPP auth with wrong AnType; AmfRanFindByGnbId returning false for known N3IWF ID
  • Companion PR: omec-project/sctplb feat/n3iwf-id-support — both sides must be deployed together

🤖 Generated with Claude Code

- Extend server.proto with N3IWF_MSG/DISC/CONN msgType values and
  N3iwfId field in SctplbMessage and AmfMessage (aligns with sctplb
  client.proto)
- Regenerate protos/sdcoreAmfServer/{server,server_grpc}.pb.go
- service/amf_server.go: handle N3IWF INIT_MSG (create RAN with
  RanPresentN3IwfId + NON_3GPP AnType), N3IWF_DISC, and N3IWF_CONN
- ngap/dispatcher.go: resolve RAN from N3IwfId when GnbId absent;
  populate N3IwfId (not GnbId) on REDIRECT_MSG for N3IWF RANs
- ngap/message/send.go: send N3IwfId or GnbId based on RanPresent
- nas/handler.go: fix AnType assignment (was always 3GPP); fix
  REDIRECT_MSG to use N3IwfId for N3IWF RANs
- ngap/handler.go: fix REDIRECT_MSG N3IwfId field for N3IWF RANs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andy Bavier <andybavier@gmail.com>
@andybavier andybavier requested a review from a team March 19, 2026 21:46
@andybavier andybavier marked this pull request as draft March 19, 2026 21:49
@andybavier andybavier marked this pull request as draft March 19, 2026 21:49
@gab-arrobo gab-arrobo requested a review from Copilot March 19, 2026 22:05
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

This PR extends the sctplb↔AMF gRPC bridge to support N3IWF (non‑3GPP) nodes in addition to gNBs, including protobuf updates and runtime routing/redirect fixes so non‑3GPP attach flows use the correct access type and identifiers.

Changes:

  • Extend server.proto / generated gRPC code with N3IWF_* message types and N3iwfId fields on both request/response messages.
  • Update AMF gRPC handling and NGAP dispatch/send paths to key/look up RANs via N3IwfId and populate N3IwfId vs GnbId in redirect / AMF→RAN messages.
  • Fix non‑3GPP AnType assignment for sctplb-mode UEs.

Reviewed changes

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

Show a summary per file
File Description
service/amf_server.go Creates/updates RAN context during INIT; handles N3IWF DISC/CONN and sets non‑3GPP access type.
protos/server.proto Adds N3IWF enum values and N3iwfId fields to bridge messages.
protos/sdcoreAmfServer/server.pb.go Regenerated protobuf types for new enum/fields and updated proto source path metadata.
protos/sdcoreAmfServer/server_grpc.pb.go Regenerated gRPC stubs/metadata reflecting updated proto path.
ngap/dispatcher.go Resolves RAN by N3IwfId and sets redirect ID field based on RanPresent.
ngap/message/send.go Sends AMF→RAN messages using N3IwfId vs GnbId depending on RanPresent.
ngap/handler.go Populates correct redirect identifier field for N3IWF vs gNB.
nas/handler.go Fixes AnType for sctplb UEs and sets redirect identifier field for N3IWF vs gNB.

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

RanID() and Remove() both dereference ran.RanId, which was left nil
when creating N3IWF RAN entries. Add ConvertN3iwfIdToRanId (parallel
to ConvertGnbIdToRanId) that parses "mcc:mnc:n3iwfId" into a
GlobalRanNodeId and sets RanPresent = RanPresentN3IwfId. Call it in
both amf_server.go and dispatcher.go instead of the bare RanPresent
assignment.

Addresses PR review comments.

Signed-off-by: Andy Bavier <andybavier@gmail.com>
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.

2 participants