# nextgcorelab/nextgsim architecture

> Architecture diagram of the GitHub repository nextgcorelab/nextgsim, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nextgcorelab/nextgsim
- Repository: https://github.com/nextgcorelab/nextgsim

## Overview

nextgsim is a pure-Rust 5G UE and gNB simulator, with optional 6G research prototypes. Its main workflow is to start a UE and gNB, register the UE through the radio link and 5G control-plane protocols, establish a session, and carry user traffic through GTP-U. The graph also preserves the documented AI/ML capabilities. Main-function excerpts support task startup and some subsystem ownership; other cross-crate links reflect README-documented protocol roles, not inspected call sites.

Main entry points: [`nextgsim-gnb/src/main.rs`](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-gnb/src/main.rs) (gNB simulator), [`nextgsim-ue/src/main.rs`](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ue/src/main.rs) (UE simulator), [`nextgsim-ai/src/lib.rs`](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ai/src/lib.rs) (AI inference), [`nextgsim-nwdaf/src/lib.rs`](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-nwdaf/src/lib.rs) (NWDAF analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_endpoints["Simulation endpoints"]
  node_ue["UE simulator<br/>[main.rs]"]
  node_gnb["gNB simulator<br/>[main.rs]"]
  node_cli["Node CLI<br/>[main.rs]"]
end

subgraph group_protocols["5G protocols"]
  node_nas["NAS procedures<br/>[lib.rs]"]
  node_ngap["NGAP procedures<br/>[lib.rs]"]
  node_rrc["RRC procedures<br/>[lib.rs]"]
  node_pdcp["PDCP bearer<br/>[lib.rs]"]
  node_rlc["RLC entity<br/>[lib.rs]"]
  node_gtp["GTP-U tunnel<br/>[lib.rs]"]
  node_crypto["Security algorithms<br/>[lib.rs]"]
end

subgraph group_transport["Radio and transport"]
  node_rls["Radio link<br/>[lib.rs]"]
  node_sctp["SCTP transport<br/>[lib.rs]"]
  node_tunnel["UE data interface<br/>[mod.rs]"]
end

subgraph group_research["6G research capabilities"]
  node_ai["AI inference<br/>[lib.rs]"]
  node_nw["NWDAF analytics<br/>[lib.rs]"]
  node_nkef["Knowledge exposure<br/>[lib.rs]"]
  node_she["Edge hosting<br/>[lib.rs]"]
  node_isac["ISAC sensing<br/>[lib.rs]"]
  node_fl["Federated learning<br/>[lib.rs]"]
  node_semantic["Semantic communication<br/>[lib.rs]"]
  node_agent["Agent framework<br/>[lib.rs]"]
end

node_operator(("Operator"))
node_core(("5G core"))

node_operator -->|"starts"| node_ue
node_operator -->|"starts"| node_gnb
node_operator -->|"controls"| node_cli
node_cli -->|"commands"| node_ue
node_cli -->|"commands"| node_gnb
node_ue -->|"runs procedures"| node_nas
node_ue -->|"runs procedures"| node_rrc
node_gnb -->|"spawns task"| node_rrc
node_gnb -->|"spawns task"| node_gtp
node_ue -->|"radio traffic"| node_rls
node_gnb -->|"radio traffic"| node_rls
node_ue -->|"reads and writes"| node_tunnel
node_ue -->|"user-plane data"| node_pdcp
node_gnb -->|"user-plane data"| node_pdcp
node_pdcp -->|"passes bearer data"| node_rlc
node_gnb -->|"runs procedures"| node_ngap
node_ngap -->|"NG interface"| node_core
node_ngap -->|"uses transport"| node_sctp
node_nas -->|"security algorithms"| node_crypto
node_rrc -->|"security algorithms"| node_crypto
node_gnb -.->|"optional task"| node_nw
node_gnb -.->|"optional task"| node_she
node_gnb -.->|"optional task"| node_agent
node_ai -->|"supports analytics"| node_nw
node_nw -.->|"knowledge bridge"| node_nkef
node_agent -.->|"analytics integration"| node_nw
node_gnb -.->|"optional sensing"| node_isac
node_ue -.->|"optional participation"| node_fl
node_gnb -.->|"optional service"| node_fl
node_ue -.->|"optional codec"| node_semantic
node_ai -.->|"model processing"| node_isac
node_ai -.->|"model inference"| node_semantic
node_she -.->|"hosts inference"| node_ai

click node_ue "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ue/src/main.rs"
click node_gnb "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-gnb/src/main.rs"
click node_cli "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-cli/src/main.rs"
click node_nas "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-nas/src/lib.rs"
click node_ngap "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ngap/src/lib.rs"
click node_rrc "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-rrc/src/lib.rs"
click node_pdcp "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-pdcp/src/lib.rs"
click node_rlc "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-rlc/src/lib.rs"
click node_gtp "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-gtp/src/lib.rs"
click node_crypto "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-crypto/src/lib.rs"
click node_rls "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-rls/src/lib.rs"
click node_sctp "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-sctp/src/lib.rs"
click node_tunnel "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ue/src/tun/mod.rs"
click node_ai "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ai/src/lib.rs"
click node_nw "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-nwdaf/src/lib.rs"
click node_nkef "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-nkef/src/lib.rs"
click node_she "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-she/src/lib.rs"
click node_isac "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-isac/src/lib.rs"
click node_fl "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-fl/src/lib.rs"
click node_semantic "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-semantic/src/lib.rs"
click node_agent "https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-agent/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ue,node_gnb,node_cli toneBlue
class node_nas,node_ngap,node_rrc,node_pdcp,node_rlc,node_gtp,node_crypto toneAmber
class node_rls,node_sctp,node_tunnel toneMint
class node_ai,node_nw,node_nkef,node_she,node_isac,node_fl,node_semantic,node_agent toneRose
class node_operator,node_core toneIndigo
```

## Components

### Simulation endpoints

- [UE simulator](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ue/src/main.rs): `nextgsim-ue/src/main.rs`
- [gNB simulator](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-gnb/src/main.rs): `nextgsim-gnb/src/main.rs`
- [Node CLI](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-cli/src/main.rs): `nextgsim-cli/src/main.rs`

### 5G protocols

- [NAS procedures](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-nas/src/lib.rs): `nextgsim-nas/src/lib.rs`
- [NGAP procedures](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ngap/src/lib.rs): `nextgsim-ngap/src/lib.rs`
- [RRC procedures](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-rrc/src/lib.rs): `nextgsim-rrc/src/lib.rs`
- [PDCP bearer](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-pdcp/src/lib.rs): `nextgsim-pdcp/src/lib.rs`
- [RLC entity](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-rlc/src/lib.rs): `nextgsim-rlc/src/lib.rs`
- [GTP-U tunnel](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-gtp/src/lib.rs): `nextgsim-gtp/src/lib.rs`
- [Security algorithms](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-crypto/src/lib.rs): `nextgsim-crypto/src/lib.rs`

### Radio and transport

- [Radio link](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-rls/src/lib.rs): `nextgsim-rls/src/lib.rs`
- [SCTP transport](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-sctp/src/lib.rs): `nextgsim-sctp/src/lib.rs`
- [UE data interface](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ue/src/tun/mod.rs): `nextgsim-ue/src/tun/mod.rs`

### 6G research capabilities

- [AI inference](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-ai/src/lib.rs): `nextgsim-ai/src/lib.rs`
- [NWDAF analytics](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-nwdaf/src/lib.rs): `nextgsim-nwdaf/src/lib.rs`
- [Knowledge exposure](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-nkef/src/lib.rs): `nextgsim-nkef/src/lib.rs`
- [Edge hosting](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-she/src/lib.rs): `nextgsim-she/src/lib.rs`
- [ISAC sensing](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-isac/src/lib.rs): `nextgsim-isac/src/lib.rs`
- [Federated learning](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-fl/src/lib.rs): `nextgsim-fl/src/lib.rs`
- [Semantic communication](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-semantic/src/lib.rs): `nextgsim-semantic/src/lib.rs`
- [Agent framework](https://github.com/nextgcorelab/nextgsim/blob/main/nextgsim-agent/src/lib.rs): `nextgsim-agent/src/lib.rs`

### Other components

- **Operator**
- **5G core**

## Connections

- Operator → UE simulator: starts
- Operator → gNB simulator: starts
- Operator → Node CLI: controls
- Node CLI → UE simulator: commands
- Node CLI → gNB simulator: commands
- UE simulator → NAS procedures: runs procedures
- UE simulator → RRC procedures: runs procedures
- gNB simulator → RRC procedures: spawns task
- gNB simulator → GTP-U tunnel: spawns task
- UE simulator → Radio link: radio traffic
- gNB simulator → Radio link: radio traffic
- UE simulator → UE data interface: reads and writes
- UE simulator → PDCP bearer: user-plane data
- gNB simulator → PDCP bearer: user-plane data
- PDCP bearer → RLC entity: passes bearer data
- gNB simulator → NGAP procedures: runs procedures
- NGAP procedures → 5G core: NG interface
- NGAP procedures → SCTP transport: uses transport
- NAS procedures → Security algorithms: security algorithms
- RRC procedures → Security algorithms: security algorithms
- gNB simulator → NWDAF analytics: optional task
- gNB simulator → Edge hosting: optional task
- gNB simulator → Agent framework: optional task
- AI inference → NWDAF analytics: supports analytics
- NWDAF analytics → Knowledge exposure: knowledge bridge
- Agent framework → NWDAF analytics: analytics integration
- gNB simulator → ISAC sensing: optional sensing
- UE simulator → Federated learning: optional participation
- gNB simulator → Federated learning: optional service
- UE simulator → Semantic communication: optional codec
- AI inference → ISAC sensing: model processing
- AI inference → Semantic communication: model inference
- Edge hosting → AI inference: hosts inference
