๐ฐ๏ธ Open5GS NWDAF
August 23, 2026 ยท View on GitHub
๐ฐ๏ธ Open5GS NWDAF
Production-grade Network Data Analytics Function for 5G Core โ in modern C++
Standalone, 3GPP Release-17 compliant NWDAF that plugs into Open5GS and brings native ML-driven analytics to your 5G core.
Quick Start ยท Architecture ยท 3GPP Compliance ยท REST API ยท Dashboard ยท Roadmap ยท Contributing
๐ก Why this project?
The NWDAF (Network Data Analytics Function) is the intelligence layer of the 5G Core defined by 3GPP โ yet no complete, freely available open-source implementation exists that works out of the box with Open5GS. This project fills that gap:
- Zero-friction Open5GS integration โ registers with the NRF, reads journald/
/proc//sys/MongoDB, no core patches required - Native, dependency-light ML โ Isolation Forest anomaly detection and EWMA prediction implemented in pure C++, no Python runtime, no TensorFlow
- Spec-first design โ analytics IDs, SBI resource paths, subscription model and NRF registration follow TS 23.288 / TS 29.520 / TS 29.510
- Ops-ready from day one โ Prometheus metrics, Grafana dashboard, React web UI, systemd unit, hardened Docker build, TLS/mTLS, OAuth2, rate limiting
โจ Features
| Capability | Details |
|---|---|
| ๐ 10 Analytics IDs | NF load, UE mobility, UE communication, abnormal behaviour, QoS sustainability, service experience, network performance, SM congestion, redundant transmission, dispersion |
| ๐ค Embedded ML | Native C++ Isolation Forest (anomaly detection) + EWMA predictor (load forecasting), atomic model persistence, on-demand retraining via API |
| ๐ Subscriptions | Nnwdaf_EventsSubscription create/list/get/delete with push notification delivery (background notifier thread) |
| ๐๏ธ Persistence | SQLite-backed throughput history and subscription store โ survives restarts |
| ๐ฐ๏ธ NRF Integration | Registration + heartbeat per TS 29.510 ยง5.3.2.4 |
| ๐ Security | TLS/mTLS on SBI (TS 33.501 ยง13.3), OAuth 2.0 bearer-token validation, per-IP + global token-bucket rate limiting, hardened build flags (-D_FORTIFY_SOURCE=2, PIE, RELRO) |
| ๐ Observability | Prometheus /metrics, Grafana dashboard JSON, health/readiness probes |
| ๐ฅ๏ธ Web Dashboard | React + Recharts "NWDAF Intelligence" UI: live throughput, anomaly detection, MOS scores, traffic simulator, subscription management |
| ๐งช Tested | 85 Catch2 test cases: unit, integration, and a mock Open5GS environment |
| ๐ฆ Deployable | Reproducible two-stage Docker build (Ubuntu 22.04, pinned deps), systemd service, cmake --install |
๐ Architecture
flowchart LR
subgraph Open5GS["Open5GS 5G Core"]
NF["AMF / SMF / UPF / ...<br/>(systemd units)"]
NRF["NRF"]
MDB[("MongoDB")]
end
subgraph NWDAF["open5gs-nwdafd (C++17)"]
COL["NwdafCollector<br/><i>journald ยท /proc ยท /sys ยท MongoDB</i>"]
ENG["NwdafAnalyticsEngine"]
ML["ML Core<br/><i>IsolationForest ยท EwmaPredictor</i>"]
SRV["NwdafServer<br/><i>SBI ยท cpp-httplib ยท TLS</i>"]
NOT["NwdafNotifier<br/><i>push delivery</i>"]
DB[("SQLite<br/>history + subs")]
end
subgraph Consumers["Consumers"]
UI["React Dashboard"]
GRAF["Grafana / Prometheus"]
NFC["NF Consumers<br/>(PCF, AMF, OAM ...)"]
end
NF -- "logs & stats" --> COL
MDB -- "subscriber count" --> COL
COL --> ENG
ENG <--> ML
ENG <--> DB
ENG --> SRV
ENG --> NOT
SRV <-- "Nnwdaf SBI (HTTP/JSON)" --> NFC
SRV --> UI
SRV -- "/metrics" --> GRAF
NWDAF -- "register + heartbeat<br/>TS 29.510" --> NRF
NOT -- "event notifications" --> NFC
Data collection strategy (Open5GS-specific, all configurable):
- NF health โ systemd unit states via the
nf_service_namesmap (no fragile string-stripping) - Throughput โ reads
/sys/class/net/<iface>/statistics/directly, because thegtp5gkernel module bypasses user-space capture (tcpdump/eBPF) - UE activity โ AMF/SMF journald parsing with a configurable
supi_regex(imsi-(\d{15})for Open5GS โฅ v2.7.6) - Subscriber count โ optional MongoDB (UDR/UDM database) integration
๐ 3GPP Compliance
| Analytics ID | TS 23.288 (Rel-17) | ML backing | Status |
|---|---|---|---|
NF_LOAD | ยง6.5 | EWMA load prediction | โ Implemented |
UE_MOBILITY | ยง6.7.2 | โ | โ Implemented |
UE_COMMUNICATION | ยง6.7.3 | โ | โ Implemented |
ABNORMAL_BEHAVIOUR | ยง6.7.5 | Isolation Forest | โ Implemented |
SERVICE_EXPERIENCE | ยง6.4 | MOS estimation | โ Implemented |
NETWORK_PERFORMANCE | ยง6.6 | Weighted composite score | โ Implemented |
QoS_SUSTAINABILITY | ยง6.9 | Threshold trend analysis | โ Implemented |
SM_CONGESTION | ยง6.16 | Failure-ratio + NF-load bands | โ Implemented |
REDUNDANT_TRANSMISSION | ยง6.12 | Rate-stability estimator | โ Implemented |
DISPERSION | ยง6.10 | Gini / HHI concentration | โ Implemented |
DN_PERFORMANCE | ยง6.14 | โ | โฌ Planned (needs Naf_EventExposure) |
SLICE_LOAD_LEVEL | ยง6.3 | โ | โฌ Planned (needs S-NSSAI threading) |
USER_DATA_CONGESTION | ยง6.8 | โ | โฌ Planned (needs per-location input) |
WLAN_PERFORMANCE | ยง6.11 | โ | โฌ Planned (N3IWF-dependent) |
Known scope limits. SM_CONGESTION, REDUNDANT_TRANSMISSION and
DISPERSION each report what the current journald/procfs data path can
actually observe and name the input they cannot yet see in a note field โ
per-path GTP-U counters, per-location cell data, and per-slice decomposition
respectively. See docs/ENHANCEMENT_PLAN_5G_6G.md
H1.1โH1.3 for the work that lifts those limits.
Referenced specifications: TS 23.288 v17.3.0 (architecture) ยท TS 29.520 v17.7.0 (Nnwdaf services) ยท TS 29.510 v17.6.0 (NRF) ยท TS 28.554 v17.4.0 (KPIs) ยท TS 33.501 (security)
OpenAPI contract
The SBI is published as an OpenAPI 3.0 document at
docs/openapi/nwdaf-analytics-v1.yaml,
and served from the running instance at GET /nwdaf-analytics/v1/openapi so NF
consumers can fetch the contract without cloning the repository:
curl "http://127.0.0.1:7779/nwdaf-analytics/v1/openapi" -o nwdaf-openapi.yaml
It is not documentation-by-hand: tests/test_openapi_conformance.cpp loads it
and validates live responses from every endpoint against the declared schemas,
so the spec and the implementation cannot drift apart without CI failing.
๐ Quick Start
Verified on CI: Ubuntu 22.04 (full: sd-journal + TLS + SQLite) and Ubuntu 20.04 (sd-journal + SQLite, TLS off) โ see the CI workflow.
Prerequisites
Toolchain (required):
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake git pkg-config ca-certificates
- CMake โฅ 3.22 is required. Ubuntu 22.04 satisfies this; Ubuntu 20.04 ships CMake 3.16, so install a newer one there (e.g.
pip3 install "cmake>=3.22,<4"or the Kitware APT repo). - An internet connection is needed on the first configure: cpp-httplib, nlohmann/json, yaml-cpp, spdlog (and Catch2 for tests) are fetched automatically via CMake
FetchContent. You do not need to install these from apt.
Optional feature dependencies (each degrades gracefully if absent):
sudo apt-get install -y --no-install-recommends \
libsystemd-dev \ # journald collection (NWDAF_USE_SD_JOURNAL=ON)
libssl-dev \ # TLS/mTLS on the SBI (NWDAF_USE_TLS=ON, needs OpenSSL โฅ 3.0)
libsqlite3-dev \ # restart-safe persistence (history_backend=sqlite)
libmongoc-dev libmongocxx-dev # subscriber count via MongoDB
TLS needs OpenSSL โฅ 3.0 (Ubuntu 22.04+). On Ubuntu 20.04 (OpenSSL 1.1.1), build with
-DNWDAF_USE_TLS=OFF.
Build
Ubuntu 22.04+ (full features):
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel $(nproc)
Ubuntu 20.04 (TLS off โ OpenSSL 1.1.1):
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DNWDAF_USE_TLS=OFF
cmake --build build --parallel $(nproc)
Minimal build (no journald, no TLS โ e.g. non-systemd hosts or containers):
cmake -S . -B build \
-DNWDAF_USE_SD_JOURNAL=OFF \
-DNWDAF_USE_TLS=OFF
cmake --build build --parallel $(nproc)
Run
./build/open5gs-nwdafd --config config/nwdaf.yaml
curl http://127.0.0.1:7779/nwdaf-analytics/v1/health
Run tests
cd build && ctest --output-on-failure
Docker
The image is a multi-stage build on ubuntu:22.04 (OpenSSL 3.0, so TLS-capable) and contains only the daemon binary and default config.
docker build -t open5gs-nwdaf .
docker run --rm -p 7779:7779 open5gs-nwdaf
To reach the SBI from outside the container, set
sbi_bind_address: "0.0.0.0"in your config โ the default127.0.0.1only listens inside the container. Mount your own config with-v $(pwd)/config/nwdaf.yaml:/etc/open5gs/nwdaf.yaml.
Install as a systemd service
sudo cmake --install build
sudo systemctl daemon-reload
sudo systemctl enable --now open5gs-nwdafd
๐ REST API (TS 29.520 SBI)
Base URL: http://<host>:7779
| Method | Path | Description |
|---|---|---|
GET | /nwdaf-analytics/v1/health | Liveness probe (returns UP immediately) |
GET | /nwdaf-analytics/v1/ready | Readiness probe (READY once ML models are fitted, 503 otherwise) |
GET | /nwdaf-analytics/v1/metrics | Prometheus metrics |
GET | /nwdaf-analytics/v1/openapi | The published OpenAPI 3.0 contract (application/yaml) |
GET | /nwdaf-analytics/v1/analytics?analyticsId=<ID> | Fetch analytics (Nnwdaf_AnalyticsInfo) |
POST | /nnwdaf-analyticsinfo/v1/analytics | Spec-compliant analytics request (POST body) |
POST | /nwdaf-analytics/v1/subscriptions | Create subscription (Nnwdaf_EventsSubscription) |
GET | /nwdaf-analytics/v1/subscriptions | List subscriptions |
GET | /nwdaf-analytics/v1/subscriptions/{subId} | Get subscription |
DELETE | /nwdaf-analytics/v1/subscriptions/{subId} | Delete subscription |
POST | /nwdaf-analytics/v1/train | Retrain the Isolation Forest on collected history |
Examples
# NF load analytics
curl "http://127.0.0.1:7779/nwdaf-analytics/v1/analytics?analyticsId=NF_LOAD"
# Anomaly detection
curl "http://127.0.0.1:7779/nwdaf-analytics/v1/analytics?analyticsId=ABNORMAL_BEHAVIOUR"
# Session-management congestion (TS 23.288 ยง6.16)
curl "http://127.0.0.1:7779/nwdaf-analytics/v1/analytics?analyticsId=SM_CONGESTION"
# Service experience โ MOS with its G.107 impairment breakdown
curl "http://127.0.0.1:7779/nwdaf-analytics/v1/analytics?analyticsId=SERVICE_EXPERIENCE"
# Subscribe to events with push notifications
curl -X POST "http://127.0.0.1:7779/nwdaf-analytics/v1/subscriptions" \
-H "Content-Type: application/json" \
-d '{"eventId": "NF_LOAD", "notificationUri": "http://consumer:8080/notify"}'
โ๏ธ Configuration
Everything deployment-specific lives in config/nwdaf.yaml:
| Parameter | Default | Description |
|---|---|---|
nf_instance_id | โ | Mandatory. Stable UUID of this NF instance |
plmn_mcc / plmn_mnc | 999 / 70 | PLMN (test network default) |
sbi_bind_address / sbi_port | 127.0.0.1 / 7779 | SBI endpoint (must not collide with Open5GS's 7777) |
nf_service_names | AMFโamfd, โฆ | Open5GS systemd unit suffix map |
throughput_interfaces | ogstun | UPF tunnel interfaces to sample |
collection_interval_seconds | 10 | Collector cadence |
supi_regex | imsi-(\d{15}) | SUPI extraction pattern (Open5GS v2.7.6) |
mongodb_uri / mongodb_db | 127.0.0.1:27017 / open5gs | Optional subscriber-count source |
nrf_uri | http://127.0.0.10:7777 | NRF for registration + heartbeat |
nrf_heartbeat_interval_seconds | 60 | TS 29.510 heartbeat (0 = disabled) |
anomaly_contamination | 0.10 | Expected anomaly fraction (Isolation Forest) |
anomaly_seed | 0 | Deterministic ML seed (0 = random) |
anomaly_min_samples | 120 | Retrain quality gate (~20 min at 10 s interval) |
baseline_stddev_min_kbps | 0.5 | Idle-baseline guard against zero-traffic false positives |
ewma_alpha | 0.3 | EWMA smoothing factor |
history_backend / history_db_path | sqlite | Restart-safe history + subscription persistence |
rate_limit_per_ip_rps / rate_limit_global_rps | 10 / 100 | Token-bucket SBI rate limits (0 = off) |
network_performance_weights | 0.6/0.2/0.2 | NF-health / DL / PDU weights (validated to sum to 1.0) |
tls_enabled + cert/key/CA paths | false | TLS; setting tls_ca_file enables mTLS client verification |
Build options
| CMake option | Default | Description |
|---|---|---|
NWDAF_USE_SD_JOURNAL | ON | journald collection via libsystemd |
NWDAF_USE_TLS | ON | TLS/mTLS on SBI (OpenSSL) |
NWDAF_ENABLE_PUSH_DELIVERY | ON | Subscription push-notification thread |
NWDAF_BUILD_TESTS | ON | Catch2 unit + integration tests |
Optional dependencies degrade gracefully: no MongoDB driver โ subscriber count returns 0; no SQLite โ in-memory history only.
TLS note:
NWDAF_USE_TLS=ONrequires OpenSSL โฅ 3.0 (Ubuntu 22.04+). On Ubuntu 20.04 (OpenSSL 1.1.1), build with-DNWDAF_USE_TLS=OFF; sd-journal and SQLite are unaffected.
๐ Dashboard & Observability
- NWDAF Intelligence web UI (
dashboard/) โ React + Recharts single-page app with live throughput, NF health, anomaly detection, QoS sustainability, MOS/service experience, network performance scoring, subscription management, a traffic simulator, and light/dark themes. - Grafana (
grafana/nwdaf_dashboard.json) โ import-ready dashboard fed by the Prometheus/metricsendpoint.
๐ง ML Internals
| Model | Purpose | Implementation |
|---|---|---|
| Isolation Forest | ABNORMAL_BEHAVIOUR โ flags throughput/behaviour outliers | Native C++ (~300 LoC), configurable contamination & seed, quality-gated retraining, atomic write-then-rename model persistence |
| EWMA Predictor | NF_LOAD โ short-horizon load forecasting | Exponentially weighted moving average with configurable ฮฑ |
| E-model MOS estimator | SERVICE_EXPERIENCE โ mean opinion score | ITU-T G.107 transmission rating: R = R0 โ Id โ Ie_eff, with a Weber-Fechner throughput term, G.107 packet-loss weighting and the Idd delay curve. Reports the R-factor and a per-impairment breakdown; falls back to the legacy step ladder when no throughput sample is available |
No Python runtime, no external ML framework โ the entire inference path is in-process C++, which keeps the footprint small enough for edge and lab deployments.
๐งช Testing
120 Catch2 test cases across six suites, including a mock Open5GS environment so the full pipeline can be tested without a running core:
cmake -S . -B build -DNWDAF_BUILD_TESTS=ON
cmake --build build --parallel
cd build && ctest --output-on-failure
| Suite | Covers |
|---|---|
test_collector | Data collection, parsing, interface stats |
test_analytics | The original 7 analytics IDs, ML outputs, edge cases |
test_h1_analytics | E-model MOS calibration and the SM_CONGESTION / REDUNDANT_TRANSMISSION / DISPERSION analytics |
test_server_integration | SBI endpoints, subscriptions, auth, rate limiting |
test_arch_improvements | Persistence, TLS config, weights validation |
test_openapi_conformance | Every endpoint validated against the published OpenAPI schemas |
๐บ Roadmap
Tracked against docs/ENHANCEMENT_PLAN_5G_6G.md
and the 5G/6G enhancement plan project board.
Horizon 1 โ Rel-17/18 completeness & data-path realism (#20)
-
DISPERSION,SM_CONGESTION,REDUNDANT_TRANSMISSIONanalytics (#26, partial) - MOS / service-experience E-model upgrade (#27)
- OpenAPI 3.0 spec published + CI conformance test (#28)
- Pluggable
IDataSourceingestion โ SBI / OAM backend (#23) - Slice awareness (S-NSSAI) +
SLICE_LOAD_LEVEL(TS 23.288 ยง6.3) (#24) - PFCP usage reporting โ per-UE / per-session analytics (#25)
-
DN_PERFORMANCE(ยง6.14) andUSER_DATA_CONGESTION(ยง6.8) โ both blocked on the above input paths
Horizon 2 โ Data & ML platform maturity (#21)
- MTLF / AnLF split (Rel-17 ยง5.1) (#29)
- Model registry, versioning and rollback (#30)
- Drift detection + auto-retrain (#31)
- Seasonality-aware forecasting โ Holt-Winters / ONNX (#32)
- ADRF + data lake / feature store, Parquet export (#33)
- Evaluation harness + calibrated confidence (#34)
- Per-feature anomaly attribution (#35)
Horizon 3 โ 5G-Advanced โ 6G readiness (#22)
- Closed-loop automation & intent layer (#36)
- Energy efficiency & sustainability analytics (#37)
- AI-native / federated learning coordinator (#38)
- Network digital twin (#39)
- ISAC data types (#40)
- Kubernetes Helm chart + horizontal scaling (#41)
Unscheduled
- srsRAN / UERANSIM end-to-end CI pipeline
๐ค Contributing
Contributions are very welcome โ this project aims to become the reference open-source NWDAF for the Open5GS ecosystem.
- Fork the repo and create a feature branch
- Build with tests:
cmake -S . -B build -DNWDAF_BUILD_TESTS=ON - Make sure
ctestpasses and the build stays warning-clean (-Wall -Wextra -Werror) - Open a PR with a clear description; reference the relevant 3GPP clause when touching spec-defined behaviour
Bug reports, spec-compliance findings, and lab test reports (please include your Open5GS version and topology) are as valuable as code.
๐ License
Licensed under the Apache License 2.0 โ free for commercial and non-commercial use.
๐ Acknowledgements
- Open5GS โ the open-source 5G core this project is built to serve
- cpp-httplib, nlohmann/json, yaml-cpp, spdlog, Catch2
- 3GPP SA2/CT3 for the NWDAF specification family
โญ If this project is useful to you, please star it โ it directly helps the 5G open-source ecosystem grow.