# asadfattani/cn-project architecture

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

- Interactive diagram: https://gitdiagram.com/asadfattani/cn-project
- Repository: https://github.com/asadfattani/cn-project

## Overview

This repository is a network address-planning tool and configuration generator. Its primary workflow is: a user supplies organization requirements, the CLI loads and validates them, the planner constructs a topology and allocates IPv4/IPv6 addresses, then checks the result and reports route summaries; generation renders Packet Tracer and FRRouting/containerlab configurations. Separate capabilities audit hand-written plans, compare subnetting strategies, and run simulator-based experiments. The graph follows relationships shown in the excerpts or README; some implementation details, especially the experiment tool’s internal calls, were not sampled.

Main entry points: [`planner/render.py`](https://github.com/asadfattani/cn-project/blob/main/planner/render.py) (Output renderer), [`planner/__init__.py`](https://github.com/asadfattani/cn-project/blob/main/planner/__init__.py) (Plan orchestrator), [`planner/models.py`](https://github.com/asadfattani/cn-project/blob/main/planner/models.py) (Network data model), [`plan.py`](https://github.com/asadfattani/cn-project/blob/main/plan.py) (Plan CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and Inputs"]
  node_cli["Plan CLI<br/>[plan.py]"]
  node_yaml["Organization requirements"]
  node_loader["YAML loader<br/>[loader.py]"]
end

subgraph group_planning["Address Planning"]
  node_models["Network data model<br/>[models.py]"]
  node_planner["Plan orchestrator<br/>[__init__.py]"]
  node_topology["WAN topology<br/>[topology.py]"]
  node_ipv4["IPv4 allocation<br/>[ipv4.py]"]
  node_ipv6["IPv6 allocation<br/>[ipv6.py]"]
end

subgraph group_reports["Validation and Analysis"]
  node_validation["Plan validation<br/>[validate.py]"]
  node_summarize["Route summarization<br/>[summarize.py]"]
  node_compare["Strategy comparison<br/>[compare.py]"]
end

subgraph group_generation["Configuration Generation"]
  node_render["Output renderer<br/>[render.py]"]
  node_pt_templates["Packet Tracer templates<br/>[ios_router.j2]"]
  node_frr_templates["FRR and lab templates<br/>[frr.conf.j2]"]
  node_report_templates["Plan and topology templates<br/>[plan.md.j2]"]
end

subgraph group_experiments["Experiments"]
  node_labtool["Lab measurement tool<br/>[labtool.py]"]
end

node_user(("Network planner user"))
node_packet_tracer["Packet Tracer environment"]
node_containerlab["Containerlab and FRR"]
node_simulator["Running lab"]

node_user -->|"runs commands"| node_cli
node_user -->|"provides requirements"| node_yaml
node_cli -->|"loads input"| node_loader
node_cli -->|"builds plan"| node_planner
node_cli -->|"audits CSV"| node_validation
node_cli -->|"writes outputs"| node_render
node_planner -->|"builds links"| node_topology
node_planner -->|"allocates IPv4"| node_ipv4
node_planner -->|"allocates IPv6"| node_ipv6
node_planner -->|"validates plan"| node_validation
node_planner -->|"counts routes"| node_summarize
node_loader -->|"creates records"| node_models
node_ipv4 -->|"updates allocations"| node_models
node_ipv6 -->|"updates allocations"| node_models
node_topology -->|"sets links"| node_models
node_validation -->|"checks networks"| node_models
node_summarize -->|"reads networks"| node_models
node_compare -->|"compares strategies"| node_planner
node_render -->|"builds render context"| node_models
node_render -->|"gets site summaries"| node_summarize
node_render -->|"gets site links"| node_topology
node_render -->|"renders configs"| node_pt_templates
node_render -->|"renders lab configs"| node_frr_templates
node_render -->|"renders reports"| node_report_templates
node_packet_tracer -->|"builds and tests"| node_user
node_containerlab -->|"provides lab topology"| node_labtool
node_labtool -->|"measures network"| node_simulator
node_user -->|"runs experiments"| node_labtool

click node_cli "https://github.com/asadfattani/cn-project/blob/main/plan.py"
click node_loader "https://github.com/asadfattani/cn-project/blob/main/planner/loader.py"
click node_models "https://github.com/asadfattani/cn-project/blob/main/planner/models.py"
click node_planner "https://github.com/asadfattani/cn-project/blob/main/planner/__init__.py"
click node_topology "https://github.com/asadfattani/cn-project/blob/main/planner/topology.py"
click node_ipv4 "https://github.com/asadfattani/cn-project/blob/main/planner/ipv4.py"
click node_ipv6 "https://github.com/asadfattani/cn-project/blob/main/planner/ipv6.py"
click node_validation "https://github.com/asadfattani/cn-project/blob/main/planner/validate.py"
click node_summarize "https://github.com/asadfattani/cn-project/blob/main/planner/summarize.py"
click node_compare "https://github.com/asadfattani/cn-project/blob/main/compare.py"
click node_render "https://github.com/asadfattani/cn-project/blob/main/planner/render.py"
click node_pt_templates "https://github.com/asadfattani/cn-project/blob/main/templates/ios_router.j2"
click node_frr_templates "https://github.com/asadfattani/cn-project/blob/main/templates/frr.conf.j2"
click node_report_templates "https://github.com/asadfattani/cn-project/blob/main/templates/plan.md.j2"
click node_labtool "https://github.com/asadfattani/cn-project/blob/main/scripts/labtool.py"

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_cli,node_yaml,node_loader,node_user toneBlue
class node_models,node_planner,node_topology,node_ipv4,node_ipv6 toneAmber
class node_validation,node_summarize,node_compare toneMint
class node_render,node_pt_templates,node_frr_templates,node_report_templates toneRose
class node_labtool,node_packet_tracer,node_containerlab,node_simulator toneIndigo
```

## Components

### CLI and Inputs

- [Plan CLI](https://github.com/asadfattani/cn-project/blob/main/plan.py): `plan.py`
- **Organization requirements**
- [YAML loader](https://github.com/asadfattani/cn-project/blob/main/planner/loader.py): `planner/loader.py`

### Address Planning

- [Network data model](https://github.com/asadfattani/cn-project/blob/main/planner/models.py): `planner/models.py`
- [Plan orchestrator](https://github.com/asadfattani/cn-project/blob/main/planner/__init__.py): `planner/__init__.py`
- [WAN topology](https://github.com/asadfattani/cn-project/blob/main/planner/topology.py): `planner/topology.py`
- [IPv4 allocation](https://github.com/asadfattani/cn-project/blob/main/planner/ipv4.py): `planner/ipv4.py`
- [IPv6 allocation](https://github.com/asadfattani/cn-project/blob/main/planner/ipv6.py): `planner/ipv6.py`

### Validation and Analysis

- [Plan validation](https://github.com/asadfattani/cn-project/blob/main/planner/validate.py): `planner/validate.py`
- [Route summarization](https://github.com/asadfattani/cn-project/blob/main/planner/summarize.py): `planner/summarize.py`
- [Strategy comparison](https://github.com/asadfattani/cn-project/blob/main/compare.py): `compare.py`

### Configuration Generation

- [Output renderer](https://github.com/asadfattani/cn-project/blob/main/planner/render.py): `planner/render.py`
- [Packet Tracer templates](https://github.com/asadfattani/cn-project/blob/main/templates/ios_router.j2): `templates/ios_router.j2`
- [FRR and lab templates](https://github.com/asadfattani/cn-project/blob/main/templates/frr.conf.j2): `templates/frr.conf.j2`
- [Plan and topology templates](https://github.com/asadfattani/cn-project/blob/main/templates/plan.md.j2): `templates/plan.md.j2`

### Experiments

- [Lab measurement tool](https://github.com/asadfattani/cn-project/blob/main/scripts/labtool.py): `scripts/labtool.py`

### Other components

- **Network planner user**
- **Packet Tracer environment**
- **Containerlab and FRR**
- **Running lab**

## Connections

- Network planner user → Plan CLI: runs commands (evidence: `README.md`)
- Network planner user → Organization requirements: provides requirements (evidence: `README.md`)
- Plan CLI → YAML loader: loads input (evidence: `plan.py`)
- Plan CLI → Plan orchestrator: builds plan (evidence: `plan.py`)
- Plan CLI → Plan validation: audits CSV (evidence: `plan.py`)
- Plan CLI → Output renderer: writes outputs (evidence: `plan.py`)
- Plan orchestrator → WAN topology: builds links (evidence: `planner/__init__.py`)
- Plan orchestrator → IPv4 allocation: allocates IPv4 (evidence: `planner/__init__.py`)
- Plan orchestrator → IPv6 allocation: allocates IPv6 (evidence: `planner/__init__.py`)
- Plan orchestrator → Plan validation: validates plan (evidence: `planner/__init__.py`)
- Plan orchestrator → Route summarization: counts routes (evidence: `planner/__init__.py`)
- YAML loader → Network data model: creates records (evidence: `planner/loader.py`)
- IPv4 allocation → Network data model: updates allocations (evidence: `planner/ipv4.py`)
- IPv6 allocation → Network data model: updates allocations (evidence: `planner/ipv6.py`)
- WAN topology → Network data model: sets links (evidence: `planner/topology.py`)
- Plan validation → Network data model: checks networks (evidence: `planner/validate.py`)
- Route summarization → Network data model: reads networks (evidence: `planner/summarize.py`)
- Strategy comparison → Plan orchestrator: compares strategies (evidence: `compare.py`)
- Output renderer → Network data model: builds render context (evidence: `planner/render.py`)
- Output renderer → Route summarization: gets site summaries (evidence: `planner/render.py`)
- Output renderer → WAN topology: gets site links (evidence: `planner/render.py`)
- Output renderer → Packet Tracer templates: renders configs (evidence: `planner/render.py`)
- Output renderer → FRR and lab templates: renders lab configs (evidence: `planner/render.py`)
- Output renderer → Plan and topology templates: renders reports (evidence: `README.md`)
- Packet Tracer environment → Network planner user: builds and tests (evidence: `README.md`)
- Containerlab and FRR → Lab measurement tool: provides lab topology (evidence: `README.md`)
- Lab measurement tool → Running lab: measures network (evidence: `README.md`)
- Network planner user → Lab measurement tool: runs experiments (evidence: `README.md`)
