Notebooks
N
NVIDIA
DLI Lab Setup

DLI Lab Setup

gpu-accelerationretrieval-augmented-generationllm-inferencetensorrtnvidia-generative-ai-exampleslarge-language-modelsmicroservicetriton-inference-servercommunityLLMragllm-slicing-5g-labnemoautonomous_5g_slicing_lab

Start 5G Network Simulator

In this DLI you will use an Agentic Generative AI solution to solve a bandwidth allocation problem. The lab will consist of two different parts. In the first part, the lab will show you how to setup an open source 5G Network Lab consisting of the following parts:

The Lab setup will start with the initialization of the 5G Core Network, then we will set up the gNodeB and the RIC connecting both via the E1 protocol. We will attach two UEs to the 5G network, each UE1 will have its own slice as seen in the diagram. Once UEs are functional, we will use the Iperf tool to generate traffic. First we will set up the Iperf server on the OAI External Network connected by the User Plane Function UPF. Then we will use the Iperf Client to generate traffic against the External Network using the UEs connection.

5G Lab

In this Jupyter Notebook we will set the lab for the experiment. In a separate Jupyter Notebook we will build the Agentic Workflow for the experiment.

Installing Requirements

In this first cell we will install the requirements for the Blueprint and we will restart the kernel, so you will need to press "yes" to the window that will pop up

[1]

Installing Flexric and gNodeB

This code will take between 7 and 8 minutes to run. It will compile the ric and gNodeB components within the DLI environment. If you want to install this lab in your computer, you just need to download the DLI directory and execute this command.

[1]

OAI 5G Network

To set up the 5G core Network funcitons we will use the docker compose comand. First, we will setup the standard network funciton for the core and then we will set up an additonal slice (slice 2) that will have its own SMF and UPF

[2]

Start RIC

Then we will start the FlexRIC to be able to modify parameters in the gNodeB on an ad hoc basis

[3]
Process started with PID 102070, logging to logs/RIC.log.
Trouble Shooting - Sample output

If flexric starts successfully you should see a similar output in logs/RIC.log

[UTIL]: Setting the config -c file to /usr/local/etc/flexric/flexric.conf
[UTIL]: Setting path -p for the shared libraries to /usr/local/lib/flexric/
[NEAR-RIC]: nearRT-RIC IP Address = 127.0.0.1, PORT = 36421
[NEAR-RIC]: Initializing 
[NEAR-RIC]: Loading SM ID = 142 with def = MAC_STATS_V0 
[NEAR-RIC]: Loading SM ID = 143 with def = RLC_STATS_V0 
[NEAR-RIC]: Loading SM ID = 3 with def = ORAN-E2SM-RC 
[NEAR-RIC]: Loading SM ID = 146 with def = TC_STATS_V0 
[NEAR-RIC]: Loading SM ID = 148 with def = GTP_STATS_V0 
[NEAR-RIC]: Loading SM ID = 145 with def = SLICE_STATS_V0 
[NEAR-RIC]: Loading SM ID = 2 with def = ORAN-E2SM-KPM 
[NEAR-RIC]: Loading SM ID = 144 with def = PDCP_STATS_V0 
[iApp]: Initializing ... 
[iApp]: nearRT-RIC IP Address = 127.0.0.1, PORT = 36422
[NEAR-RIC]: Initializing Task Manager with 2 threads 
[E2AP]: E2 SETUP-REQUEST rx from PLMN   1. 1 Node ID 3584 RAN type ngran_gNB
[NEAR-RIC]: Accepting RAN function ID 2 with def = ORAN-E2SM-KPM 
[NEAR-RIC]: Accepting RAN function ID 3 with def = ORAN-E2SM-RC 
[NEAR-RIC]: Accepting RAN function ID 142 with def = MAC_STATS_V0 
[NEAR-RIC]: Accepting RAN function ID 143 with def = RLC_STATS_V0 
[NEAR-RIC]: Accepting RAN function ID 144 with def = PDCP_STATS_V0 
[NEAR-RIC]: Accepting RAN function ID 145 with def = SLICE_STATS_V0 
[NEAR-RIC]: Accepting RAN function ID 146 with def = TC_STATS_V0 
[NEAR-RIC]: Accepting RAN function ID 148 with def = GTP_STATS_V0 

Start the gNodeB

Then we will run the gNodeB using the OAI softmoden software

[4]
Process started with PID 117275, logging to logs/gNodeB.log.

Initialize Bandwidth 50 50

The gNodeB will have initially allocated 50% of its bandwidth to each of the slices.

  • Note : Incase you get [E2AP]: Resending Setup Request after timeouterror, rerun the Start RIC cell.

Please check ./logs/RIC.log to ensure that flexRIC is working. Incase you see a "failed" message, try rerunning the Start RIC cell above.

Error message :

nearRT-RIC: /dli/task/llm-slicing-5g-lab/flexric/src/lib/e2ap/v2_03/enc/e2ap_msg_enc_asn.c:3165: e2ap_enc_e42_setup_response_asn_pdu: Assertion `sr->len_e2_nodes_conn > 0 && "No global node conected??"' failed.

[5]
50+50
[UTIL]: Setting the config -c file to /usr/local/etc/flexric/flexric.conf
[UTIL]: Setting path -p for the shared libraries to /usr/local/lib/flexric/
[xAapp]: Initializing ... 
[xApp]: nearRT-RIC IP Address = 127.0.0.1, PORT = 36422
[E2 AGENT]: Opening plugin from path = /usr/local/lib/flexric/libslice_sm.so 
[E2 AGENT]: Opening plugin from path = /usr/local/lib/flexric/libmac_sm.so 
[E2 AGENT]: Opening plugin from path = /usr/local/lib/flexric/libkpm_sm.so 
[E2 AGENT]: Opening plugin from path = /usr/local/lib/flexric/librc_sm.so 
[E2 AGENT]: Opening plugin from path = /usr/local/lib/flexric/librlc_sm.so 
[E2 AGENT]: Opening plugin from path = /usr/local/lib/flexric/libtc_sm.so 
[E2 AGENT]: Opening plugin from path = /usr/local/lib/flexric/libgtp_sm.so 
[E2 AGENT]: Opening plugin from path = /usr/local/lib/flexric/libpdcp_sm.so 
[NEAR-RIC]: Loading SM ID = 145 with def = SLICE_STATS_V0 
[NEAR-RIC]: Loading SM ID = 142 with def = MAC_STATS_V0 
[NEAR-RIC]: Loading SM ID = 2 with def = ORAN-E2SM-KPM 
[NEAR-RIC]: Loading SM ID = 3 with def = ORAN-E2SM-RC 
[NEAR-RIC]: Loading SM ID = 143 with def = RLC_STATS_V0 
[NEAR-RIC]: Loading SM ID = 146 with def = TC_STATS_V0 
[NEAR-RIC]: Loading SM ID = 148 with def = GTP_STATS_V0 
[NEAR-RIC]: Loading SM ID = 144 with def = PDCP_STATS_V0 
[xApp]: DB filename = /tmp/xapp_db_1747219577414412 
 [xApp]: E42 SETUP-REQUEST tx
[xApp]: E42 SETUP-RESPONSE rx 
[xApp]: xApp ID = 7 
[xApp]: Registered E2 Nodes = 1 
Connected E2 nodes = 1
Setting PRB Ratio to 50:50
[xApp]: CONTROL-REQUEST tx 
[xApp]: CONTROL ACK rx
[xApp]: Successfully received CONTROL-ACK 
[xApp]: Control Loop Latency: 828 us
[xApp]: Sucessfully stopped 
Test xApp run SUCCESSFULLY

Start the UE

After we will create a User Equipment Simulator and attach it to the gNodeB. Following cell creates UE1 and UE2

[6]
[7]
2025-05-14 10:46:32 INFO: Starting process UE1 with command: 
    sudo ./multi_ue.sh -c1 -e & 
    sleep 5
    sudo ip netns exec ue1 bash -c '
        sudo LD_LIBRARY_PATH=. ./openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
        --rfsimulator.serveraddr 10.201.1.100 -r 106 --numerology 1 --band 78 -C 3619200000 \
        --rfsim --sa -O ran-conf/ue_1.conf -E
    '
    
2025-05-14 10:46:32 INFO: Process UE1 started with PID 118709, logging to logs/UE1.log
2025-05-14 10:46:32 INFO: Starting process UE3 with command: 
    sudo ./multi_ue.sh -c3 -e & 
    sleep 5
    sudo ip netns exec ue3 bash -c '
        sudo LD_LIBRARY_PATH=. ./openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
        --rfsimulator.serveraddr 10.203.1.100 -r 106 --numerology 1 --band 78 -C 3619200000 \
        --rfsim --sa -O ran-conf/ue_2.conf -E
    '
    
2025-05-14 10:46:32 INFO: Process UE3 started with PID 118712, logging to logs/UE3.log

    sudo ./multi_ue.sh -c1 -e & 
    sleep 5
    sudo ip netns exec ue1 bash -c '
        sudo LD_LIBRARY_PATH=. ./openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
        --rfsimulator.serveraddr 10.201.1.100 -r 106 --numerology 1 --band 78 -C 3619200000 \
        --rfsim --sa -O ran-conf/ue_1.conf -E
    '
    

    sudo ./multi_ue.sh -c3 -e & 
    sleep 5
    sudo ip netns exec ue3 bash -c '
        sudo LD_LIBRARY_PATH=. ./openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
        --rfsimulator.serveraddr 10.203.1.100 -r 106 --numerology 1 --band 78 -C 3619200000 \
        --rfsim --sa -O ran-conf/ue_2.conf -E
    '
    

Debugging tip: Print logs for sanity check

tail -f logs/UE1.log
tail -f logs/UE3.log

Start the Iperf Tool Server

Once the 5G Network Simulation is running we will start the simulation of traffic by using with tool Iperf. First we will create an Iperf Server that will be on the External Network connected via the User Plane Function.

[8]
2025-05-14 10:46:38 INFO: Starting process iPerf_server1 with command: docker exec -t oai-ext-dn iperf3 -s -p 5201
2025-05-14 10:46:38 INFO: Process iPerf_server1 started with PID 119502, logging to logs/docker_iperfserver_server1.log
2025-05-14 10:46:38 INFO: Starting process iPerf_server2 with command: docker exec -t oai-ext-dn iperf3 -s -p 5202
2025-05-14 10:46:38 INFO: Process iPerf_server2 started with PID 119503, logging to logs/docker_iperfserver_server2.log

Start Traffic generator and insert records in the database

Once every element in The Network is up and running and the Iperf server is listening in the external network. We will run two iperf clients that will be generating traffic in both UEs. These scripts will generate udp traffic from the iperf server towards the UE and will alternate speeds 30M and 120M for 100 seconds. In the following cell we will

  1. Run traffic generator to alternate between 30M and 120M
  2. Insert UE1 and UE2 iperf logs into the Kinetica Database. Kinetica is a very fast, distributed, GPU-accelerated database with advanced analytics, visualization, geospatial, and machine learning functionality.
[9]
[11]
2025-05-14 19:25:50 INFO: CURRENT ITERATION: 0
2025-05-14 19:26:40 INFO: CURRENT ITERATION: 1
2025-05-14 19:26:56 INFO: CURRENT ITERATION: 2
2025-05-14 19:27:34 INFO: CURRENT ITERATION: 3
2025-05-14 19:28:17 INFO: CURRENT ITERATION: 4
2025-05-14 19:29:51 INFO: CURRENT ITERATION: 5
2025-05-14 19:29:51 INFO: CURRENT ITERATION: 6
2025-05-14 19:29:51 INFO: CURRENT ITERATION: 7
2025-05-14 19:29:51 INFO: CURRENT ITERATION: 8
2025-05-14 19:29:51 INFO: CURRENT ITERATION: 9
2025-05-14 19:29:51 INFO: CURRENT ITERATION: 10
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 11
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 12
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 13
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 14
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 15
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 16
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 17
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 18
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 19
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 20
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 21
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 22
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 23
2025-05-14 19:29:52 INFO: CURRENT ITERATION: 24

Keep the above cell running! If you want to see what is happening in the background, you can:

  1. Check out UE1, UE2 iperf logs to see how traffic generator works, and how it leads to packet loss:

    tail -f logs/UE1_iperfc.log
    tail -f logs/UE2_iperfc.log
    
  2. Access Kinetica database, and see how wlogs are updated there real-time. Login with your username and password, mentioned in the .env file.

    • KINETICA_USERNAME="nvidia_gtc_2025"
    • KINETICA_PASSWORD="Kinetica123!"
    • KINETICA_SCHEMA="nvidia_gtc_dli_2025"
    • Table name: os.environment.get("IPERF3_RANDOM_TABLE_NAME")
    • URL : https://demo72.kinetica.com/gadmin/

This will be the final step setting up the 5G Lab for the Agentic Workflow.

stop