# omec-project/amf architecture

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

- Interactive diagram: https://gitdiagram.com/omec-project/amf
- Repository: https://github.com/omec-project/amf

## Overview

SD-Core AMF is a 5G-core control-plane function that terminates RAN N2 and UE NAS signaling, manages UE registration, security, mobility and reachability, and transports session-management messages. The principal flow begins at a RAN signaling event, passes through NGAP and NAS/GMM handling, consults shared UE context and external 5G-core services, then sends protocol responses back toward the RAN or UE. SBI APIs expose communication, mobile-terminated, location, event, and OAM capabilities. Sampled source supports key calls; README documents broader features whose detailed implementation was not sampled.

Main entry points: [`ngap/handler.go`](https://github.com/omec-project/amf/blob/main/ngap/handler.go) (NGAP Handler), [`gmm/handler.go`](https://github.com/omec-project/amf/blob/main/gmm/handler.go) (GMM Procedures), [`producer/ue_context.go`](https://github.com/omec-project/amf/blob/main/producer/ue_context.go) (UE Context Producer), [`context/context.go`](https://github.com/omec-project/amf/blob/main/context/context.go) (AMF Context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_protocol["Signaling Protocols"]
  node_ngap["NGAP Handler<br/>[handler.go]"]
  node_ngapbuild["NGAP Messages<br/>[build.go]"]
  node_nas["NAS Handler<br/>[handler.go]"]
  node_gmm["GMM Procedures<br/>[handler.go]"]
  node_security["NAS Security<br/>[security.go]"]
end

subgraph group_state["UE State and Services"]
  node_statectx[("AMF Context<br/>[context.go]")]
  node_uecontext[("UE Context<br/>[amf_ue.go]")]
  node_smcontext["SM Context Client<br/>[sm_context.go]"]
  node_authclient["Authentication Client"]
  node_ueclient["UE Management Client"]
end

subgraph group_api["SBI and Management APIs"]
  node_comm["Communication API<br/>[routers.go]"]
  node_mt["Mobile-Terminated API<br/>[routers.go]"]
  node_location["Location API<br/>[routers.go]"]
  node_events["Event Exposure API<br/>[routers.go]"]
  node_oam["OAM API<br/>[routers.go]"]
  node_callbacks["HTTP Callbacks<br/>[router.go]"]
  node_producer["UE Context Producer<br/>[ue_context.go]"]
end

subgraph group_runtime["Runtime Operations"]
  node_init["Context Initialization<br/>[init_context.go]"]
  node_polling["Network Config Polling"]
  node_metrics["Metrics Export<br/>[telemetry.go]"]
  node_tracing["OpenTelemetry<br/>[tracing.go]"]
end

node_ran(("RAN"))
node_smf(("SMF"))
node_udm(("UDM / AUSF"))

node_ran -->|"sends N2"| node_ngap
node_ngap -.->|"dispatches NAS"| node_nas
node_ngap -->|"builds messages"| node_ngapbuild
node_ngap -->|"uses context"| node_statectx
node_ngap -->|"updates sessions"| node_smcontext
node_nas -->|"uses context"| node_statectx
node_nas -->|"decodes NAS"| node_security
node_gmm -->|"uses context"| node_statectx
node_gmm -->|"updates sessions"| node_smcontext
node_gmm -->|"requests authentication"| node_authclient
node_gmm -->|"protects NAS"| node_security
node_smcontext -->|"sends SBI requests"| node_smf
node_authclient -.->|"requests authentication"| node_udm
node_ueclient -.->|"uses SBI"| node_udm
node_oam -->|"purges UE state"| node_producer
node_location -->|"serves location"| node_producer
node_producer -->|"uses UE context"| node_statectx
node_init -->|"initializes context"| node_statectx
node_polling -.->|"refreshes configuration"| node_init
node_metrics -->|"reports status"| node_ngap
node_comm -.->|"uses SBI"| node_ueclient
node_mt -.->|"handles MT services"| node_producer
node_events -.->|"exposes events"| node_producer
node_callbacks -.->|"notifies procedures"| node_gmm
node_tracing -->|"traces requests"| node_smcontext

click node_ngap "https://github.com/omec-project/amf/blob/main/ngap/handler.go"
click node_ngapbuild "https://github.com/omec-project/amf/blob/main/ngap/message/build.go"
click node_nas "https://github.com/omec-project/amf/blob/main/nas/handler.go"
click node_gmm "https://github.com/omec-project/amf/blob/main/gmm/handler.go"
click node_security "https://github.com/omec-project/amf/blob/main/nas/nas_security/security.go"
click node_statectx "https://github.com/omec-project/amf/blob/main/context/context.go"
click node_uecontext "https://github.com/omec-project/amf/blob/main/context/amf_ue.go"
click node_smcontext "https://github.com/omec-project/amf/blob/main/consumer/sm_context.go"
click node_authclient "https://github.com/omec-project/amf/blob/main/consumer/ue_authentication.go"
click node_ueclient "https://github.com/omec-project/amf/blob/main/consumer/ue_context_management.go"
click node_comm "https://github.com/omec-project/amf/blob/main/communication/routers.go"
click node_mt "https://github.com/omec-project/amf/blob/main/mt/routers.go"
click node_location "https://github.com/omec-project/amf/blob/main/location/routers.go"
click node_events "https://github.com/omec-project/amf/blob/main/eventexposure/routers.go"
click node_oam "https://github.com/omec-project/amf/blob/main/oam/routers.go"
click node_callbacks "https://github.com/omec-project/amf/blob/main/httpcallback/router.go"
click node_producer "https://github.com/omec-project/amf/blob/main/producer/ue_context.go"
click node_init "https://github.com/omec-project/amf/blob/main/util/init_context.go"
click node_polling "https://github.com/omec-project/amf/blob/main/polling/nf_configuration.go"
click node_metrics "https://github.com/omec-project/amf/blob/main/metrics/telemetry.go"
click node_tracing "https://github.com/omec-project/amf/blob/main/tracing/tracing.go"

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_ngap,node_ngapbuild,node_nas,node_gmm,node_security toneBlue
class node_statectx,node_uecontext,node_smcontext,node_authclient,node_ueclient toneAmber
class node_comm,node_mt,node_location,node_events,node_oam,node_callbacks,node_producer toneMint
class node_init,node_polling,node_metrics,node_tracing toneRose
class node_ran,node_smf,node_udm toneIndigo
```

## Components

### Signaling Protocols

- [NGAP Handler](https://github.com/omec-project/amf/blob/main/ngap/handler.go): `ngap/handler.go`
- [NGAP Messages](https://github.com/omec-project/amf/blob/main/ngap/message/build.go): `ngap/message/build.go`
- [NAS Handler](https://github.com/omec-project/amf/blob/main/nas/handler.go): `nas/handler.go`
- [GMM Procedures](https://github.com/omec-project/amf/blob/main/gmm/handler.go): `gmm/handler.go`
- [NAS Security](https://github.com/omec-project/amf/blob/main/nas/nas_security/security.go): `nas/nas_security/security.go`

### UE State and Services

- [AMF Context](https://github.com/omec-project/amf/blob/main/context/context.go): `context/context.go`
- [UE Context](https://github.com/omec-project/amf/blob/main/context/amf_ue.go): `context/amf_ue.go`
- [SM Context Client](https://github.com/omec-project/amf/blob/main/consumer/sm_context.go): `consumer/sm_context.go`
- [Authentication Client](https://github.com/omec-project/amf/blob/main/consumer/ue_authentication.go): `consumer/ue_authentication.go`
- [UE Management Client](https://github.com/omec-project/amf/blob/main/consumer/ue_context_management.go): `consumer/ue_context_management.go`

### SBI and Management APIs

- [Communication API](https://github.com/omec-project/amf/blob/main/communication/routers.go): `communication/routers.go`
- [Mobile-Terminated API](https://github.com/omec-project/amf/blob/main/mt/routers.go): `mt/routers.go`
- [Location API](https://github.com/omec-project/amf/blob/main/location/routers.go): `location/routers.go`
- [Event Exposure API](https://github.com/omec-project/amf/blob/main/eventexposure/routers.go): `eventexposure/routers.go`
- [OAM API](https://github.com/omec-project/amf/blob/main/oam/routers.go): `oam/routers.go`
- [HTTP Callbacks](https://github.com/omec-project/amf/blob/main/httpcallback/router.go): `httpcallback/router.go`
- [UE Context Producer](https://github.com/omec-project/amf/blob/main/producer/ue_context.go): `producer/ue_context.go`

### Runtime Operations

- [Context Initialization](https://github.com/omec-project/amf/blob/main/util/init_context.go): `util/init_context.go`
- [Network Config Polling](https://github.com/omec-project/amf/blob/main/polling/nf_configuration.go): `polling/nf_configuration.go`
- [Metrics Export](https://github.com/omec-project/amf/blob/main/metrics/telemetry.go): `metrics/telemetry.go`
- [OpenTelemetry](https://github.com/omec-project/amf/blob/main/tracing/tracing.go): `tracing/tracing.go`

### Other components

- **RAN**
- **SMF**
- **UDM / AUSF**

## Connections

- RAN → NGAP Handler: sends N2
- NGAP Handler → NAS Handler: dispatches NAS
- NGAP Handler → NGAP Messages: builds messages (evidence: `ngap/handler.go`)
- NGAP Handler → AMF Context: uses context (evidence: `ngap/handler.go`)
- NGAP Handler → SM Context Client: updates sessions (evidence: `ngap/handler.go`)
- NAS Handler → AMF Context: uses context (evidence: `nas/handler.go`)
- NAS Handler → NAS Security: decodes NAS (evidence: `nas/handler.go`)
- GMM Procedures → AMF Context: uses context (evidence: `gmm/handler.go`)
- GMM Procedures → SM Context Client: updates sessions (evidence: `gmm/handler.go`)
- GMM Procedures → Authentication Client: requests authentication (evidence: `gmm/handler.go`)
- GMM Procedures → NAS Security: protects NAS (evidence: `gmm/handler.go`)
- SM Context Client → SMF: sends SBI requests (evidence: `consumer/sm_context.go`)
- Authentication Client → UDM / AUSF: requests authentication
- UE Management Client → UDM / AUSF: uses SBI
- OAM API → UE Context Producer: purges UE state
- Location API → UE Context Producer: serves location
- UE Context Producer → AMF Context: uses UE context (evidence: `producer/ue_context.go`)
- Context Initialization → AMF Context: initializes context (evidence: `util/init_context.go`)
- Network Config Polling → Context Initialization: refreshes configuration
- Metrics Export → NGAP Handler: reports status (evidence: `ngap/handler.go`)
- Communication API → UE Management Client: uses SBI
- Mobile-Terminated API → UE Context Producer: handles MT services
- Event Exposure API → UE Context Producer: exposes events
- HTTP Callbacks → GMM Procedures: notifies procedures
- OpenTelemetry → SM Context Client: traces requests (evidence: `consumer/sm_context.go`)
