This project implements RAN slicing using OpenAirInterface (OAI) 5G components, providing network slicing capabilities for 5G networks. The implementation supports both single and dedicated SMF/UPF configurations per slice without requiring E2Sim, xApp, or Near-RT RIC components. The MAC layer reads slicing policies directly from rrmPolicy.json
.
Key Features:
- RAN slicing with configurable slice policies
- Single or dedicated SMF/UPF deployment options
- Support for USRP X310, USRP B210 hardware
- RF simulator mode for testing
- Multi-UE support with network namespaces
Based on: ORANSlice reference implementation
Before starting, ensure you have:
- Ubuntu 20.04/22.04 LTS
- Minimum 8GB RAM and 50GB disk space
- Root/sudo access
- Internet connectivity
Following the OAI CN5G documentation.
# Clone repository
git clone https://github.com/ngkore/oai-ran-slicing.git ~/oai-ran-slicing/
cd ~/oai-ran-slicing/
# Install essential tools
sudo apt install -y git net-tools putty
# Update system and install prerequisites
sudo apt update
sudo apt install -y ca-certificates curl
# Add Docker GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add Docker repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install Docker components
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $(whoami)
# Restart system to apply group changes
reboot
cd ~/oai-ran-slicing/
# Clone OAI CN5G federation
git clone https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed.git
cd oai-cn5g-fed/
git checkout v2.0.1
# Apply slicing configuration patch
git apply ../oai-cn5g-fed.patch
Choose deployment architecture based on your requirements:
Option A: Shared SMF/UPF (Simpler setup)
cd docker-compose/
docker compose -f docker-compose-basic-nrf.yaml up -d
Option B: Dedicated SMF/UPF per slice (Production-ready)
cd docker-compose/
docker compose -f docker-compose-slicing-basic-nrf.yaml up -d
Verify deployment:
docker ps -a
Following the OAI RAN documentation.
cd ~/oai-ran-slicing/
# Install build tools and libraries
sudo apt install -y autoconf automake build-essential ccache cmake cpufrequtils \
doxygen ethtool g++ git inetutils-tools libboost-all-dev libncurses-dev \
libusb-1.0-0 libusb-1.0-0-dev libusb-dev python3-dev python3-mako \
python3-numpy python3-requests python3-scipy python3-setuptools python3-ruamel.yaml
# Install nrscope visualization dependencies
sudo apt install -y libforms-dev libforms-bin
# Clone and build UHD
git clone https://github.com/EttusResearch/uhd.git
cd uhd && git checkout v4.7.0.0
cd host && mkdir build && cd build
# Configure and build
cmake ../
make -j $(nproc)
sudo make install && sudo ldconfig
# Download FPGA images
sudo uhd_images_downloader
YAML-CPP for configuration parsing:
cd ~/oai-ran-slicing/
git clone https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp && mkdir build && cd build
cmake .. -DYAML_BUILD_SHARED_LIBS=ON
make && sudo make install
Protocol Buffers for E2 Agent:
cd ~/oai-ran-slicing/
sudo apt install -y protobuf-compiler libprotoc-dev pkg-config libtool libprotobuf-dev
git clone https://github.com/protobuf-c/protobuf-c
cd protobuf-c/
./autogen.sh && ./configure && make
sudo make install && sudo ldconfig
cd ~/oai-ran-slicing/
git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
cd openairinterface5g/
# Install build dependencies
./cmake_targets/build_oai -I
# Build gNB and UE with visualization support
./build_oai -w USRP --ninja --nrUE --gNB --build-lib "nrscope" -C
Optional: Telnet Server for debugging
./build_oai --build-lib telnetsrv
See telnet documentation for usage details.
Navigate to the build directory:
cd openairinterface5g/cmake_targets/ran_build/build/
RF Simulator Mode (for testing):
sudo ./nr-softmodem \
-O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf \
--sa --rfsim
USRP X310 Hardware Mode:
sudo ./nr-softmodem \
-O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb/usrp_x/gnb.sa.band78.fr1.106PRB.usrpx310.conf \
--sa --usrp-tx-thread-config 1
Important
Update the MACRLCs
section in your gNB configuration file to point to the correct rrmPolicy.json
path. Adjust min_ratio
and max_ratio
values to control slice throughput allocation.
Setup network namespaces for isolated UE testing (detailed guide):
cd ~/oai-ran-slicing/openairinterface5g/tools/scripts/
chmod +x multi-ue.sh
# Create UE1 namespace (Slice 1)
sudo ./multi-ue.sh -c1
# Create UE2 namespace (Slice 2)
sudo ./multi-ue.sh -c2
Access namespaces in separate terminals:
# UE1 namespace
sudo ./multi-ue.sh -o1
# UE2 namespace
sudo ./multi-ue.sh -o2
Navigate to build directory first:
cd openairinterface5g/cmake_targets/ran_build/build/
UE1 (Slice SST=1, SD=1):
sudo ./nr-uesoftmodem \
-O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.sst1.sd1.dnn.oai.conf \
-r 106 --numerology 1 --band 78 -C 3619200000 --rfsim \
--rfsimulator.serveraddr 10.201.1.100 --telnetsrv --telnetsrv.listenport 9095
UE2 (Slice SST=1, SD=2):
sudo ./nr-uesoftmodem \
-O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.sst1.sd2.dnn.oai2.conf \
-r 106 --numerology 1 --band 78 -C 3619200000 --rfsim \
--rfsimulator.serveraddr 10.202.1.100 --telnetsrv --telnetsrv.listenport 9096
UE1 connectivity:
sudo ip netns exec ue1 bash
ping 8.8.8.8 -I 12.1.1.2
UE2 connectivity:
sudo ip netns exec ue2 bash
ping 8.8.8.8 -I 12.1.2.2
USRP B210:
sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --sa \
-O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue/ue.sst1.sd1.oai.conf \
--ue-fo-compensation -E
USRP X310:
sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --sa \
-O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue/ue.sst1.sd1.oai.conf \
--ue-fo-compensation --usrp-args "addr=192.168.40.2"
- Slicing Policy: Modify
rrmPolicy.json
to adjust slice parameters (min_ratio
,max_ratio
) - Network Addresses: IP addresses in examples may vary based on your network configuration
- Hardware Support: Tested with USRP X310 and USRP B210 devices
- No O-RAN Components: This implementation bypasses E2Sim, xApp, and Near-RT RIC for direct MAC-layer control