How arunkumartechstar/ospf_project works
Purpose and entry points
This repository automates deployment and validation of an OSPF lab on FRRouting Docker nodes hosted by GNS3. Its operational entry point is generate_and_push.py; generate_and_push_old.py is a legacy alternative. The main script supports generation-only, deployment, and validation-only modes.
Paths: generate_and_push.py, generate_and_push_old.py
Topology source of truth
The YAML inventory defines routers, interfaces, loopbacks, OSPF networks/areas, and configured container identifiers. It is the intended change boundary for adapting the lab topology without changing automation code.
Path: inventory/ospf_topology.yaml
Configuration rendering stage
The automation loads the inventory and renders a per-router FRR/vtysh configuration through Jinja2. The template translates topology fields into interface addressing and OSPF configuration; generated artifacts are written as router-specific .cfg files.
Paths: templates/frr_ospf.j2, configs/FFR-1.cfg, configs/FFR-2.cfg, configs/FFR-3.cfg
Container discovery and deployment boundary
The script operates from the GNS3 VM and uses the local Docker CLI as its control-plane boundary. It resolves configured or live GNS3 Docker containers by router/node name, copies rendered configuration into each container’s /etc/frr/frr.conf, and configures FRR daemon settings. Docker container IDs are ephemeral across GNS3 restarts, so live discovery is material to reliable deployment.
Path: generate_and_push.py
FRR process orchestration
Within each target container, deployment ensures zebra and OSPF daemon behavior is compatible with the generated configuration. Zebra must establish interface state before ospfd; FRR daemons are explicitly started/restarted against /etc/frr/frr.conf rather than relying on image defaults. This is the key runtime boundary between Python automation and the FRRouting control plane.
Paths: generate_and_push.py, templates/frr_ospf.j2
Validation flow
After deployment, the script invokes vtysh through Docker to inspect OSPF neighbor adjacencies and learned routes, then tests loopback reachability among routers. Validation can run independently, allowing operators to distinguish configuration rendering/deployment failures from OSPF convergence failures.
Path: generate_and_push.py
Runtime and infrastructure dependencies
Execution requires Python 3.8+ with PyYAML and Jinja2, Docker available on the GNS3 VM, GNS3 2.2.x topology nodes, and the frrouting/frr:v8.4.0 image. The designed lab is a three-router, Area 0 triangle; the automation itself is inventory-driven and can target expanded topologies if GNS3 links and inventory remain consistent.
Paths: requirement.txt, inventory/ospf_topology.yaml
Main entry points: generate_and_push.py Deployment & validation CLI · ospf_topology.yaml OSPF topology inventory · frr_ospf.j2 FRR config template · FFR-1.cfg Per-router FRR configs
Components 13
Automation
- Deployment & validation CLI · Supports generation-only, deployment, and validation-only modes.
generate_and_push.py - Legacy CLI
generate_and_push_old.py - OSPF topology inventory · Defines routers, interfaces, loopbacks, areas, and container identifiers.
inventory/ospf_topology.yaml - FRR config template
templates/frr_ospf.j2 - Per-router FRR configs
configs/FFR-1.cfg - Python rendering dependencies
requirement.txt - vtysh and reachability checks · Inspects neighbors, learned routes, and loopback reachability.
generate_and_push.py
GNS3 / Docker Lab
- Local Docker CLI · Discovers live GNS3 containers and executes deployment commands.
generate_and_push.py - GNS3 FRR containers · Container IDs are ephemeral across GNS3 restarts.
inventory/ospf_topology.yaml
FRRouting Runtime
- /etc/frr/frr.conf
- zebra and ospfd · Zebra interface state is established before ospfd.
generate_and_push.py - OSPF adjacencies & routes
Other components
- Operator
Connections 18
- Operator → Deployment & validation CLI: runs mode
- Legacy CLI → OSPF topology inventory: alternative automation
- Deployment & validation CLI → OSPF topology inventory: loads
- Deployment & validation CLI → FRR config template: renders with
- Python rendering dependencies → Deployment & validation CLI: supports
- OSPF topology inventory → FRR config template: topology fields
- FRR config template → Per-router FRR configs: produces
- Deployment & validation CLI → Local Docker CLI: uses
- OSPF topology inventory → Local Docker CLI: configured node names
- Local Docker CLI → GNS3 FRR containers: discovers and targets
- Per-router FRR configs → /etc/frr/frr.conf: copied into
- Local Docker CLI → /etc/frr/frr.conf: deploys
- Local Docker CLI → zebra and ospfd: starts or restarts
- /etc/frr/frr.conf → zebra and ospfd: loaded by
- zebra and ospfd → OSPF adjacencies & routes: forms
- Deployment & validation CLI → vtysh and reachability checks: invokes
- vtysh and reachability checks → Local Docker CLI: runs vtysh through
- vtysh and reachability checks → OSPF adjacencies & routes: verifies