Skip to content

Conversation

@kevin8023c
Copy link

@kevin8023c kevin8023c commented Jan 22, 2026

Summary

This PR implements multi-PLMN support in OAI 5G NR, which is a prerequisite for MOCN scenarios.

Changes

  1. gNB downlink: Add support for reading multiple PLMNs from gNB configuration file and broadcasting them in SIB1.

  2. Simulated NR UE: Implement PLMN selection logic based on IMSI. UE now extracts MCC/MNC from its IMSI and selects the matching PLMN from the broadcast list.

  3. F1AP data structure refactoring: Modified f1ap_served_cell_info_t by removing the single slice list and adding served_plmn_list, where each element contains a PLMN and its associated slices (plmn, num_nssai, nssai[MAX_NUM_SLICES]). Updated related logic including configuration file parsing, DU encoding, CU decoding, and utility functions.

  4. Testing: Tested with both single and dual simulated UEs (using namespace isolation and telnet). Successfully tested with dual PLMNs (46011 and 20893). Ping tests (ping -I oaitun_ue1 10.10.4.2) successful, where 10.10.4.2 is the Data Network IP. Also tested with f1ap_lib_test.c.

  5. Bug fixes: Fixed some minor issues.

Test Setup

  • OAI gNB/UE on node 0
  • 5G Core (L25GC+, based on free5GC) on node 1
  • Data Network on node 3
  • node 2 is using for Core 2. But right now 2 Cores haven't connected to the same gNB yet. So the testing is one gNB (node 0), one Core (node 1), and one DN (node 3).

Setup:
image

Extend F1AP protocol to support multiple PLMNs per cell:
- Add served_plmn_list array in f1ap_served_cell_info_t
- Update F1 Setup Request/Response encoding/decoding
- Support per-PLMN slice configuration (S-NSSAI)
- Update F1AP unit tests for multi-PLMN scenarios

This allows DU to advertise multiple PLMNs to CU during F1 Setup,
enabling MOCN (Multi-Operator Core Network) support.

Files changed:
- openair2/COMMON/f1ap_messages_types.h: Add num_plmn, served_plmn_list
- openair2/F1AP/lib/f1ap_interface_management.c: Multi-PLMN encode/decode
- openair2/F1AP/lib/f1ap_lib_common.c: Helper functions
- openair2/F1AP/tests/f1ap_lib_test.c: Test updates
Add DU-side support for multiple PLMNs:
- Read multi-PLMN configuration from config file
- Generate SIB1 with multiple PLMN identities
- Send multi-PLMN info to CU via F1 Setup Request
- Temporarily disable strict PLMN matching in F1 Setup
  (TODO: implement subset check as suggested by Robert)

Changes:
- openair2/GNB_APP/gnb_config.c: Read PLMN list and per-PLMN slices
- openair2/LAYER2/NR_MAC_gNB/*: Update SIB1 generation (get_SIB1_NR)
- openair2/RRC/NR/rrc_gNB_du.c: Accept multi-PLMN in F1 Setup

This enables gNB to broadcast multiple operator networks in SIB1.
Update CU to use the PLMN selected by UE instead of hardcoded plmn[0]:
- In UE Context Setup Request, use ue_p->serving_plmn
- This allows UE to register with its chosen PLMN from SIB1 list
- Update NGAP and telnet handlers for PLMN selection

Changes:
- openair2/RRC/NR/rrc_gNB.c: Use ue_p->serving_plmn in UE Context Setup
- openair3/NGAP/ngap_gNB_handlers.c: PLMN handling updates
- common/utils/telnetsrv/telnetsrv_o1.c: Telnet PLMN config support

This completes the CU-side multi-PLMN support for MOCN.
Add intelligent PLMN selection in UE based on IMSI:
- Extract MCC/MNC from UE's IMSI (from UICC)
- Match against PLMN list in SIB1 cellAccessRelatedInfo
- Set selectedPLMN_Identity to matched PLMN index (1-based)
- Fall back to first PLMN if no match found

Implementation in nr_rrc_process_sib1():
- Parse IMSI string to get UE's home PLMN
- Iterate through SIB1's plmn_IdentityInfoList
- Compare MCC (3 digits) and MNC (2 or 3 digits)
- Update rrc->selected_plmn_identity accordingly

This fixes the PLMN selection bug where UE always used the first PLMN
regardless of its IMSI, and enables proper MOCN operation where UE
can select its home operator from multiple PLMNs broadcast by gNB.

Files changed:
- openair2/RRC/NR_UE/rrc_UE.c: Add PLMN matching logic
Add configuration examples and build system updates:
- Update .gitignore to exclude build directory
- Update build_oai script for telnet library compilation
- Add multi-PLMN configuration example in gnb.conf
- Update ue.conf with PLMN selection examples
- Add ue2.conf for multi-UE testing scenarios

Configuration changes demonstrate:
- How to configure multiple PLMNs in gNB (e.g., 46011, 20893)
- How to configure UE IMSI to match specific PLMN
- How to set up multiple UEs with different operators

Files changed:
- .gitignore: Exclude build artifacts
- cmake_targets/build_oai: Build script updates
- targets/PROJECTS/GENERIC-NR-5GC/CONF/*.conf: Config examples
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.

1 participant