# modapothularajasekhar/mini-xr architecture

> Architecture diagram of the GitHub repository modapothularajasekhar/mini-xr, 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/modapothularajasekhar/mini-xr
- Repository: https://github.com/modapothularajasekhar/mini-xr

## Overview

Mini-XR is a small modular network OS whose daemons publish configuration, interface, and routing state through Redis. The clearest implemented workflow is OSPF neighbor formation, topology installation, SPF/ECMP calculation, route-event publication, and RIB selection/programming. The README also describes protocol-manager and interface-manager roles; sampled code shows their Redis writes and protocol event, but does not show a complete integration between them and the RIB. OSPF subsystem paths are supported by the tree; unsampled daemon behavior is not expanded beyond documented roles.

Main entry points: [`common/redis_client.cpp`](https://github.com/modapothularajasekhar/mini-xr/blob/main/common/redis_client.cpp) (Redis client), [`common/pubsub.cpp`](https://github.com/modapothularajasekhar/mini-xr/blob/main/common/pubsub.cpp) (Pub/Sub client), [`ospfd/main.cpp`](https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/main.cpp) (OSPF daemon), [`ospfd/neighbor.cpp`](https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/neighbor.cpp) (Neighbor FSM)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_management["Management"]
  node_cfgmgr["Config manager<br/>[main.cpp]"]
  node_ifmgr["Interface manager<br/>[main.cpp]"]
end

subgraph group_protocols["Routing Protocols"]
  node_protod["Protocol manager<br/>[main.cpp]"]
  node_ospfd["OSPF daemon<br/>[main.cpp]"]
  node_neighbor["Neighbor FSM<br/>[neighbor.cpp]"]
  node_lsdb["Link-state DB<br/>[lsdb.cpp]"]
  node_spf["SPF engine<br/>[spf.cpp]"]
end

subgraph group_routing["Route Management"]
  node_ribd["RIB daemon<br/>[main.cpp]"]
end

subgraph group_shared["Shared Infrastructure"]
  node_redisclient["Redis client<br/>[redis_client.cpp]"]
  node_pubsub["Pub/Sub client<br/>[pubsub.cpp]"]
  node_logger["Logging<br/>[logger.cpp]"]
end

node_redis[("Redis service")]

node_cfgmgr -->|"writes config"| node_redisclient
node_ifmgr -->|"writes interface state"| node_redisclient
node_protod -->|"writes route data"| node_redisclient
node_protod -->|"publishes event"| node_pubsub
node_ospfd -->|"drives timers"| node_neighbor
node_ospfd -->|"installs topology"| node_lsdb
node_ospfd -->|"runs SPF"| node_spf
node_spf -->|"reads LSAs"| node_lsdb
node_ospfd -->|"publishes routes"| node_pubsub
node_neighbor -->|"updates topology"| node_lsdb
node_neighbor -->|"withdraws routes"| node_pubsub
node_ribd -->|"subscribes events"| node_pubsub
node_ribd -->|"programs routes"| node_redisclient
node_redisclient -->|"reads/writes keys"| node_redis
node_pubsub -->|"publishes/subscribes"| node_redis

click node_cfgmgr "https://github.com/modapothularajasekhar/mini-xr/blob/main/cfgmgrd/main.cpp"
click node_ifmgr "https://github.com/modapothularajasekhar/mini-xr/blob/main/ifmgrd/main.cpp"
click node_protod "https://github.com/modapothularajasekhar/mini-xr/blob/main/protod/main.cpp"
click node_ospfd "https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/main.cpp"
click node_neighbor "https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/neighbor.cpp"
click node_lsdb "https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/lsdb.cpp"
click node_spf "https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/spf.cpp"
click node_ribd "https://github.com/modapothularajasekhar/mini-xr/blob/main/ribd/main.cpp"
click node_redisclient "https://github.com/modapothularajasekhar/mini-xr/blob/main/common/redis_client.cpp"
click node_pubsub "https://github.com/modapothularajasekhar/mini-xr/blob/main/common/pubsub.cpp"
click node_logger "https://github.com/modapothularajasekhar/mini-xr/blob/main/common/logger.cpp"

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_cfgmgr,node_ifmgr toneBlue
class node_protod,node_ospfd,node_neighbor,node_lsdb,node_spf,node_redis toneAmber
class node_ribd toneMint
class node_redisclient,node_pubsub,node_logger toneRose
```

## Components

### Management

- [Config manager](https://github.com/modapothularajasekhar/mini-xr/blob/main/cfgmgrd/main.cpp): `cfgmgrd/main.cpp`
- [Interface manager](https://github.com/modapothularajasekhar/mini-xr/blob/main/ifmgrd/main.cpp): `ifmgrd/main.cpp`

### Routing Protocols

- [Protocol manager](https://github.com/modapothularajasekhar/mini-xr/blob/main/protod/main.cpp): `protod/main.cpp`
- [OSPF daemon](https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/main.cpp): `ospfd/main.cpp`
- [Neighbor FSM](https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/neighbor.cpp): `ospfd/neighbor.cpp`
- [Link-state DB](https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/lsdb.cpp): `ospfd/lsdb.cpp`
- [SPF engine](https://github.com/modapothularajasekhar/mini-xr/blob/main/ospfd/spf.cpp): `ospfd/spf.cpp`

### Route Management

- [RIB daemon](https://github.com/modapothularajasekhar/mini-xr/blob/main/ribd/main.cpp): `ribd/main.cpp`

### Shared Infrastructure

- [Redis client](https://github.com/modapothularajasekhar/mini-xr/blob/main/common/redis_client.cpp): `common/redis_client.cpp`
- [Pub/Sub client](https://github.com/modapothularajasekhar/mini-xr/blob/main/common/pubsub.cpp): `common/pubsub.cpp`
- [Logging](https://github.com/modapothularajasekhar/mini-xr/blob/main/common/logger.cpp): `common/logger.cpp`

### Other components

- **Redis service**

## Connections

- Config manager → Redis client: writes config
- Interface manager → Redis client: writes interface state
- Protocol manager → Redis client: writes route data
- Protocol manager → Pub/Sub client: publishes event
- OSPF daemon → Neighbor FSM: drives timers
- OSPF daemon → Link-state DB: installs topology
- OSPF daemon → SPF engine: runs SPF
- SPF engine → Link-state DB: reads LSAs
- OSPF daemon → Pub/Sub client: publishes routes
- Neighbor FSM → Link-state DB: updates topology
- Neighbor FSM → Pub/Sub client: withdraws routes
- RIB daemon → Pub/Sub client: subscribes events
- RIB daemon → Redis client: programs routes
- Redis client → Redis service: reads/writes keys
- Pub/Sub client → Redis service: publishes/subscribes
