Part of: Duranta on COSMOS · FlexRIC on COSMOS · 4G / 5G & O-RAN tutorials
Rebuild the Duranta gNB with its E2 agent, connect it to the FlexRIC near-real-time RIC installed
from the cosmos-flexric package, and read per-UE throughput, MCS and SINR distributions, PDCP volumes and
PRB usage out of a running 5G SA cell with FlexRIC's KPM monitoring xApp, then the UEs' RRC measurement
reports with its RAN Control (RC) monitoring xApp. Everything runs on one server with no radio: the cell is
the RF-simulator rig of the packaged duranta-soft tutorial,
started here with two parameters changed.
Duranta is an OpenAirInterface (OAI) fork, and OAI's E2 agent is FlexRIC's agent library: the Duranta
source tree carries FlexRIC as a git submodule (openair2/E2AP/flexric, pinned to the FlexRIC v3.0.0
release). The duranta.ndz image is built without it, so this tutorial first builds a second copy of the
gNB with the agent switched on, in its own build directory; the image's normal build stays untouched.
You install the FlexRIC RIC and its xApps from the COSMOS package cosmos-flexric, the same package as in
the FlexRIC + OCUDU tutorial, start the
RIC, add an e2_agent section to a copy of the gNB configuration and run the duranta-soft tutorial against
the new build. When the UE is attached, the KPM xApp subscribes to the gNB's E2SM-KPM service model and
prints one report per second per subscription; the RC xApp subscribes to its E2SM-RC service model and
prints every RRC message the gNB forwards.
What the RIC sees from an OAI-based gNB is richer than from OCUDU: besides throughput and PRB usage, each
KPM report carries the PDSCH and PUSCH MCS distributions, the UE's SS-SINR distribution, PDCP
volumes and RLC delay. The FlexRIC page
explains the components and the protocol versions; the RIC page
the concepts.
cosmos-flexric package (FlexRIC's dev branch), all built for E2AP v2 and KPM v3.00,lib*_sm.so plugins as the RIC, frome2_agent.sm_dir. Point it at the package's plugin directory, /usr/lib/flexric/,After completing this tutorial you will be able to:
e2_agent section at its plugins;| Learning path | After duranta-soft; the OCUDU counterpart is FlexRIC + OCUDU |
| Domain / testbed | Any COSMOS server that runs duranta.ndz (verified on osc and sb1) |
| Duration | 30–45 min; the gNB build takes about 2 min on platform A |
| Difficulty | Intermediate |
| RAN stack | Duranta (OAI fork) nr-softmodem with the RF simulator, OAI nr-uesoftmodem |
| Core | OAI CN5G (Docker Compose, on the same server) |
| New interface | E2 (SCTP 36421) and FlexRIC's E42 (36422) |
| Topic group | Cellular 4G/5G & O-RAN |
| Last verified | 2026-11-20 — every command on this page run verbatim on a freshly loaded duranta.ndz with cosmos-flexric 3.0.0+40.gfbd9859e-1 from apt, platform A (2× Intel Xeon Gold 6226, 24C/24T) |
Background knowledge
Account & access
duranta.ndz — seeDevices / nodes
| Resource | Role | Qty | Notes |
|---|---|---|---|
Server (e.g. srvN) |
gNB + UE + core + RIC | 1 | no radio |
Disk image
| Image | Load onto | Provides |
|---|---|---|
duranta.ndz |
the server | the Duranta source tree in /opt/duranta, OAI CN5G, the RF-simulator configs in /root/duranta/, and the COSMOS package repository in its apt sources |
Software components
| Component | Version | Source |
|---|---|---|
| Duranta gNB and UE | in duranta.ndz (verified with 2026.w44-int, commit 020422cc8c), rebuilt with E2_AGENT=ON |
Duranta |
| E2 agent | FlexRIC v3.0.0, the openair2/E2AP/flexric submodule |
duranta-project/flexric |
| FlexRIC RIC + xApps | package cosmos-flexric 3.0.0+40.gfbd9859e-1: FlexRIC dev commit fbd9859 with a one-line COSMOS fix, built for E2AP_V2 + KPM_V3_00 |
COSMOS apt repository; upstream duranta-project/flexric |
| OAI CN5G | in duranta.ndz |
OAI CN5G |
Spectrum / RF — none. The gNB and the UE exchange samples over the RF simulator's TCP socket
(band n78, 40 MHz, 30 kHz SCS, PLMN 00101).
one server (duranta.ndz)
┌──────────────────────────────────────────────────────────────────────────┐
│ nr-uesoftmodem ──RFsim TCP── nr-softmodem (E2 agent) ──N2/N3── OAI CN5G │
│ (oaitun_ue1) │ (docker) │
│ │ E2 (SCTP 127.0.0.1:36421) │
│ ▼ │
│ FlexRIC nearRT-RIC ◄──E42 (36422)── xapp_kpm_moni │
│ └── xapp_rc_moni │
└──────────────────────────────────────────────────────────────────────────┘
ssh <username>@console.<sandbox>.cosmos-lab.org
omf tell -a offh -t <server>
omf load -i duranta.ndz -t <server> -r 0 -o 2400 -b 600
omf tell -a on -t <server>
Read the last line of the load: 1 node successfully imaged.ssh root@<server>); Step 4 runs on the console.apt-get update && apt-get install -y cosmos-flexric iperf3
dpkg-query -W cosmos-flexric
ls /usr/lib/flexric/
...
0 upgraded, 1 newly installed, 0 to remove and 380 not upgraded.
...
Setting up cosmos-flexric (3.0.0+40.gfbd9859e-1) ...
...
cosmos-flexric 3.0.0+40.gfbd9859e-1
libccc_sm.so
libgtp_sm.so
libkpm_sm.so
libmac_sm.so
libpdcp_sm.so
librc_sm.so
librlc_sm.so
libslice_sm.so
libtc_sm.so
The RIC is /usr/bin/nearRT-RIC, the xApps are /usr/bin/xapp_*, the service-model plugins are in
/usr/lib/flexric/ and the RIC configuration is /etc/flexric/flexric.conf; the
FlexRIC + OCUDU tutorial
lists every installed path. Besides the O-RAN KPM, RC and CCC models, the plugins include FlexRIC's own
MAC, RLC, PDCP and GTP statistics models, which only OAI-based gNBs implement.
Check out the FlexRIC submodule and build the gNB, the UE and the RF simulator into a new directory, for
the same E2AP and KPM versions as the RIC:
cd /opt/duranta && git submodule update --init openair2/E2AP/flexric
git -C openair2/E2AP/flexric describe --tags
cmake -S /opt/duranta -B /opt/duranta/build-e2 -GNinja -DE2_AGENT=ON -DE2AP_VERSION=E2AP_V2 -DKPM_VERSION=KPM_V3_00 \
-DOAI_SIMU=ON -DOAI_USRP=OFF -DOAI_FHI72=OFF -DOAI_FHI72_MPLANE=OFF | grep -E "E2AP|KPM"
ninja -C /opt/duranta/build-e2 nr-softmodem nr-uesoftmodem rfsimulator params_libconfig params_yaml ldpc ldpc_orig dfts coding
Submodule 'openair2/E2AP/flexric' (https://github.com/duranta-project/flexric.git) registered for path 'openair2/E2AP/flexric'
Cloning into '/opt/duranta/openair2/E2AP/flexric'...
Submodule path 'openair2/E2AP/flexric': checked out '18c3325091ad6890a706ebb2bba38d3c0fb741e5'
v3.0.0
-- Selected E2AP version: E2AP_V2
-- Selected KPM version: KPM_V3_00
ninja: Entering directory `/opt/duranta/build-e2'
...
The libraries in the target list are loaded by nr-softmodem at run time; the RF-simulator run needs all
of them next to the binary. OAI_FHI72 (the O-RAN 7.2 fronthaul) is off because this build only drives
the RF simulator.
e2_agent sectionsystemd-run --unit=flexric-ric --collect /usr/bin/nearRT-RIC -c /etc/flexric/flexric.conf -p /usr/lib/flexric/
cp /root/duranta/gnb-rfsim.conf /root/duranta/gnb-rfsim-e2.conf
cat >> /root/duranta/gnb-rfsim-e2.conf <<'EOF'
e2_agent = {
near_ric_ip_addr = "127.0.0.1";
sm_dir = "/usr/lib/flexric/";
};
EOF
sleep 2; ss -A sctp -lan | grep 36421
Running as unit: flexric-ric.service; invocation ID: 3ec5353026e24f1fa094120e58f2a82b
LISTEN 0 32 127.0.0.1:36421 0.0.0.0:*
sm_dir points the gNB's agent at the package's plugin directory, so both ends load identical service
models.
The packaged duranta-soft tutorial starts the core, the gNB and the UE. Two of its parameters point it at
the E2 build and the E2 configuration; everything else is unchanged:
printf 'duranta_build_dir: /opt/duranta/build-e2\nduranta_gnb_cfg: /root/duranta/gnb-rfsim-e2.conf\n' > ~/duranta-e2-overlay.yml
OMF_NODES=<server> cosmos-tutorial run duranta-soft --mode manual --params ~/duranta-e2-overlay.yml
...
## 3. Start nr-softmodem as the RFsim server (LD_LIBRARY_PATH: relocated build)
Running as unit: duranta-gnb.service; invocation ID: e90d3a2704f34671bd33bc301e4923f4
cell in service
## 4. Start the soft UE with the carrier arguments the gNB printed
UE args: -C 3319680000 -r 106 --numerology 1 --band 78 --ssb 516
Running as unit: duranta-ue.service; invocation ID: bb235bec0a3d44fea006d94c544d1876
## 5. Wait for the UE tun (oaitun_ue1) to carry a PDU-session address
attached: 192.168.100.2
## 6. Latency: local ext-DN (192.168.70.132) and remote (8.8.8.8)
## 7. Throughput (iperf3 server inside the ext-DN container)
## 8. Build the MANUAL-mode result contract
{
"mode": "manual",
"cell_in_service": true,
"attached": true,
"ue_ipv4": "192.168.100.2",
"ping_loss_pct": 0.0,
"ping_remote_loss_pct": 0.0,
"dl_mbps": 152.0,
"ul_mbps": 80.7
...
}
## duranta-soft (manual) exit 0 - record: ...
The run ends with the gNB and the UE still running, which is what the next steps need.
First the E2 Setup, from the gNB's log and from the transport:
grep -aE "E2 SETUP|nearRT-RIC IP" /tmp/duranta-soft/gnb.log
ss -A sctp -an | grep ESTAB | grep 36421
[E2 AGENT]: nearRT-RIC IP Address = 127.0.0.1, PORT = 36421, RAN type = ngran_gNB, nb_id = 3584
[E2-AGENT]: E2 SETUP-REQUEST tx
[E2-AGENT]: E2 SETUP RESPONSE rx
[E2-AGENT]: Transaction ID E2 SETUP-REQUEST 0 E2 SETUP-RESPONSE 0
`- ESTAB 0 0 127.0.0.1%lo:36421 127.0.0.1:34262
`- ESTAB 0 0 127.0.0.1%lo:34262 127.0.0.1:36421
Then a 50 Mbit/s downlink stream from the core's data network to the UE, and the KPM xApp for 20 seconds:
DN=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' oai-ext-dn)
UE=$(ip -4 -o addr show oaitun_ue1 | awk '{print $4}' | cut -d/ -f1); echo "DN $DN UE $UE"
docker exec -d oai-ext-dn iperf3 -s -p 5201; sleep 1
iperf3 -c "$DN" -p 5201 -B "$UE" -t 25 -b 50M -R > /tmp/iperf-dl.log 2>&1 &
sleep 2
XAPP_DURATION=20 /usr/bin/xapp_kpm_moni -c /etc/flexric/flexric.conf -p /usr/lib/flexric/ \
-a 127.0.0.1 -d /tmp/ -n xappdb > /tmp/xapp-kpm.log 2>&1
grep -E "Connected E2 nodes|Successfully subscribed|run SUCCESSFULLY" /tmp/xapp-kpm.log
grep -E "^(DRB|RRU|RRC)\." /tmp/xapp-kpm.log | tail -9
grep -c "CARR.PDSCHMCSDist" /tmp/xapp-kpm.log
sleep 5; grep receiver /tmp/iperf-dl.log
DN 192.168.70.132 UE 192.168.100.2
Connected E2 nodes = 1
[xApp]: Successfully subscribed to RAN_FUNC_ID 2
[xApp]: Successfully subscribed to RAN_FUNC_ID 2
Test xApp run SUCCESSFULLY
RRC.ConnMean = 24887 []
DRB.PdcpSduVolumeDL = 52 [Mb]
DRB.PdcpSduVolumeUL = 0 [Mb]
DRB.RlcSduDelayDl = 2082.99 [μs]
DRB.UEThpDl = 52388.46 [kbps]
DRB.UEThpUl = 875.33 [kbps]
RRU.PrbTotDl = 17 [%]
RRU.PrbTotUl = 40 [%]
RRC.ConnMean = 24887 []
580
[ 5] 0.00-25.00 sec 149 MBytes 50.0 Mbits/sec receiver
What to look for: two subscriptions and Test xApp run SUCCESSFULLY at the end. DRB.UEThpDl sits
just above the iperf3 rate (the gNB counts at the PDCP/RLC layer, headers included); DRB.UEThpUl is the
TCP acknowledgements. CARR.PDSCHMCSDist, CARR.PUSCHMCSDist and MR.NRScSSSINR are distributions: one
line per bin, the count of resource blocks or samples that fell into it. The xApp also stores every report
in /tmp/xappdb. RRC.ConnMean is not a UE count in this build: it read 24887 with one UE attached.
The gNB's E2 agent also offers the RAN Control service model (RAN function 3). FlexRIC's RC monitoring
xApp subscribes to its two REPORT styles: style 1 forwards RRC messages (here the UE's measurement
reports), style 4 reports UE RRC state changes. Run it for 20 seconds:
XAPP_DURATION=20 /usr/bin/xapp_rc_moni -c /etc/flexric/flexric.conf -p /usr/lib/flexric/ -a 127.0.0.1 > /tmp/xapp-rc.log 2>&1
grep -E "Connected E2 nodes|SUBSCRIPTION RESPONSE rx|run SUCCESSFULLY" /tmp/xapp-rc.log
grep -c "RC Indication Message received" /tmp/xapp-rc.log
grep -m1 "^RSRP" /tmp/xapp-rc.log
Connected E2 nodes = 1
[xApp]: SUBSCRIPTION RESPONSE rx
[xApp]: SUBSCRIPTION RESPONSE rx
Test xApp run SUCCESSFULLY
53
RSRP -43 [dBm], RSRQ not provided, SINR not provided
What to look for: two subscription responses, a few RC indications per second and
Test xApp run SUCCESSFULLY. Each indication carries one MeasurementReport from the UE, decoded in full
in /tmp/xapp-rc.log, with the serving cell's SSB RSRP (-43 dBm is the RF simulator's fixed level).
Style 4 stays quiet while the UE stays connected; when a UE connects or is released, the xApp prints
RAN Parameter Value = RRC connected (or RRC idle) and "RRC Setup Complete" message detected.
RC control (for example FlexRIC's xapp_rc_handover) is not covered here.
| Check | Command | Expected |
|---|---|---|
| FlexRIC installed | dpkg-query -W cosmos-flexric |
cosmos-flexric 3.0.0+40.gfbd9859e-1 |
| E2 agent built in | strings /opt/duranta/build-e2/nr-softmodem \| grep -c e2_agent |
non-zero |
| RIC listening | ss -A sctp -lan \| grep 36421 |
LISTEN on 127.0.0.1:36421 |
| E2 Setup | grep -a "E2 SETUP" /tmp/duranta-soft/gnb.log |
E2 SETUP-REQUEST tx then E2 SETUP RESPONSE rx |
| Cell and UE | the duranta-soft result contract | attached: true, 0 % ping loss |
| KPM | grep DRB.UEThpDl /tmp/xapp-kpm.log |
about 1 report/s, close to the iperf3 rate after the first |
| RC | grep -c "RC Indication Message received" /tmp/xapp-rc.log |
non-zero |
Platform A = 2× Intel Xeon Gold 6226 @ 2.70 GHz (24 cores / 24 threads); platform B = 2× Intel Xeon Gold 6126 @ 2.60 GHz (24 cores / 48 threads), the letters used on the
OCUDU results page; the other COSMOS server platforms are
listed on the Duranta page.
| Rig | Platform | iperf3 DL (receiver) | KPM DRB.UEThpDl (after the first report) |
KPM DRB.UEThpUl |
Reports | Date |
|---|---|---|---|---|---|---|
| Duranta RF simulator (n78, 40 MHz) + OAI CN5G, E2 build | B | 50.0 Mbit/s (offered 50) | 52.21–52.26 Mbit/s | 0.97–0.98 Mbit/s | 2 subscriptions, two 20 s runs | 2026-11-09 (FlexRIC dev e047ff4c built from source) |
| Duranta RF simulator (n78, 40 MHz) + OAI CN5G, E2 build | A | 50.0 Mbit/s (offered 50) | 51.33–52.42 Mbit/s | 0.82–0.93 Mbit/s | 2 subscriptions, two 20 s runs | 2026-11-19 (FlexRIC dev fbd9859 built from source) |
| Duranta RF simulator (n78, 40 MHz) + OAI CN5G, E2 build | A | 50.0–50.1 Mbit/s (offered 50) | 51.33–52.42 Mbit/s | 0.78–0.93 Mbit/s | 2 subscriptions, 20 per 20 s run, four runs | 2026-11-20 (cosmos-flexric 3.0.0+40.gfbd9859e-1) |
The same E2 build passed the duranta-soft tutorial's own checks: UE attached, 0 % ping loss (11–13 ms), DL 141–152 / UL 80.1–80.7 Mbit/s over two runs (2026-11-20, platform A). The E2 agent does not cost
the cell anything measurable on this rig. The RC monitoring xApp (Step 6) received 51–53 indications in 20 s, one per UE measurement report (2026-11-20, two runs).
On the server:
systemctl stop flexric-ric
On the console, the duranta-soft teardown stops the gNB, the UE and the core:
OMF_NODES=<server> cosmos-tutorial run duranta-soft --mode teardown
omf tell -a offh -t <server>
The E2 build in /opt/duranta/build-e2 is lost when the server is reimaged; save the image first if you
want to keep it.
| Symptom | Cause | Fix |
|---|---|---|
E: Unable to locate package cosmos-flexric |
the package lists are stale | apt-get update first (Step 1) |
cmake prints no Selected E2AP version line, or E2AP submodule not found |
the FlexRIC submodule is not checked out (it is not, in duranta.ndz) |
git submodule update --init openair2/E2AP/flexric (Step 2) |
nr-softmodem fails at start with cannot open shared object file |
a run-time library is missing from build-e2 |
build the full target list of Step 2 |
the gNB log shows E2 SETUP-REQUEST tx but no response |
the RIC is not running, or was built for other E2AP/KPM versions | systemctl status flexric-ric; the package and the Step 2 build both use E2AP_V2 + KPM_V3_00 |
the gNB log has no [E2 AGENT] lines at all |
duranta-soft ran the image's own build | check the overlay: duranta_build_dir: /opt/duranta/build-e2 |
| the RIC or an xApp loads no service models | no -p option: FlexRIC has no default plugin directory |
pass -p /usr/lib/flexric/ |
xapp_kpm_moni crashes with Segmentation fault at the end of its run, in get_meas_unit() |
an unpatched source build of FlexRIC (v3.0.0 and dev): it frees its unit table while a report is still being printed; reports from OAI are long, so this hits often |
use the packaged xApp, which carries the fix (/usr/share/cosmos-flexric/flexric-dev-cosmos.patch) |
the gNB build stops in E1AP: error: 'in->protocolIEs' is a pointer; did you mean to use '->'? |
a FlexRIC source build installed its asn1c over OAI's own in /opt/asn1c |
with the package no asn1c is needed; for a source build follow the OCUDU tutorial's appendix (/opt/asn1c-flexric), and reload the image if /opt/asn1c was already overwritten |
the first DRB.UEThpDl is hundreds of Mbit/s or more |
the first report covers the counters since the UE attached | read the reports after the first |
On this wiki
External
openair2/E2AP/README.md in the Duranta / OAI source treeAuthor(s): COSMOS team · Last verified: 2026-11-20 (Duranta 2026.w44-int 020422cc8c with the FlexRIC v3.0.0 E2 agent, cosmos-flexric 3.0.0+40.gfbd9859e-1 = FlexRIC dev fbd9859 + one-line COSMOS fix, RF simulator + OAI CN5G, platform A) · Tested image/release: duranta.ndz, cosmos-flexric 3.0.0+40.gfbd9859e-1 · Tags: 5g, oran, ric, e2, kpm, rc, xapp, flexric, duranta, oai