# lucacarr0/good-fences architecture

> Architecture diagram of the GitHub repository lucacarr0/good-fences, 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/lucacarr0/good-fences
- Repository: https://github.com/lucacarr0/good-fences

## Overview

Good-Fences is a Mininet spine–leaf network simulation with a Ryu controller. Its principal workflow is to load and validate topology and tenant YAML, construct the network, install default-drop OpenFlow rules, then answer eligible host ARP requests using tenant-scoped IP/MAC bindings. The README also documents switch reconnection and strict ARP filtering; IP forwarding, dynamic learning, and request rate limiting are explicitly not implemented. Connections reflect the shown calls and documented behavior; configuration and external-switch interactions are supported by source or README evidence.

Main entry points: [`src/controller/app.py`](https://github.com/lucacarr0/good-fences/blob/main/src/controller/app.py) (Controller app), [`src/network_models.py`](https://github.com/lucacarr0/good-fences/blob/main/src/network_models.py) (Network model), [`src/datacenter.py`](https://github.com/lucacarr0/good-fences/blob/main/src/datacenter.py) (Mininet network), [`src/controller/pipeline.py`](https://github.com/lucacarr0/good-fences/blob/main/src/controller/pipeline.py) (Base pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_config["Configuration and model"]
  node_topology_yaml["Topology config<br/>[topology.yaml]"]
  node_tenants_yaml["Tenant config<br/>[tenants.yaml]"]
  node_network_model["Network model<br/>[network_models.py]"]
end

subgraph group_simulation["Network simulation"]
  node_mininet_topology["Spine-leaf topology<br/>[datacenter.py]"]
  node_mininet_runtime["Mininet network<br/>[datacenter.py]"]
end

subgraph group_controller["Ryu controller"]
  node_ryu_app["Controller app<br/>[app.py]"]
  node_pipeline["Base pipeline<br/>[pipeline.py]"]
  node_arp_logic["ARP validation and reply<br/>[arp_proxy.py]"]
end

node_operator(("Operator"))
node_switches["OpenFlow switches"]
node_hosts(("Tenant hosts"))

node_operator -->|"starts simulation"| node_mininet_topology
node_topology_yaml -->|"configures topology"| node_network_model
node_tenants_yaml -->|"configures tenants"| node_network_model
node_mininet_topology -->|"loads model"| node_network_model
node_mininet_topology -->|"builds network"| node_mininet_runtime
node_mininet_runtime -->|"creates switches"| node_switches
node_mininet_runtime -->|"creates hosts"| node_hosts
node_ryu_app -->|"loads bindings"| node_network_model
node_ryu_app -->|"installs rules"| node_pipeline
node_pipeline -->|"reads host ports"| node_network_model
node_pipeline -->|"installs drop and ARP rules"| node_switches
node_switches -->|"reports switch events"| node_ryu_app
node_ryu_app -->|"validates ARP request"| node_arp_logic
node_arp_logic -->|"returns reply frame"| node_ryu_app
node_ryu_app -->|"sends reply packet"| node_switches
node_hosts -->|"sends ARP request"| node_switches
node_network_model -->|"provides tenant bindings"| node_arp_logic
node_mininet_runtime -.->|"connects remote controller"| node_ryu_app

click node_topology_yaml "https://github.com/lucacarr0/good-fences/blob/main/config/topology.yaml"
click node_tenants_yaml "https://github.com/lucacarr0/good-fences/blob/main/config/tenants.yaml"
click node_network_model "https://github.com/lucacarr0/good-fences/blob/main/src/network_models.py"
click node_mininet_topology "https://github.com/lucacarr0/good-fences/blob/main/src/datacenter.py"
click node_mininet_runtime "https://github.com/lucacarr0/good-fences/blob/main/src/datacenter.py"
click node_ryu_app "https://github.com/lucacarr0/good-fences/blob/main/src/controller/app.py"
click node_pipeline "https://github.com/lucacarr0/good-fences/blob/main/src/controller/pipeline.py"
click node_arp_logic "https://github.com/lucacarr0/good-fences/blob/main/src/controller/arp_proxy.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_topology_yaml,node_tenants_yaml,node_network_model toneBlue
class node_mininet_topology,node_mininet_runtime toneAmber
class node_ryu_app,node_pipeline,node_arp_logic toneMint
class node_operator,node_switches,node_hosts toneIndigo
```

## Components

### Configuration and model

- [Topology config](https://github.com/lucacarr0/good-fences/blob/main/config/topology.yaml): `config/topology.yaml`
- [Tenant config](https://github.com/lucacarr0/good-fences/blob/main/config/tenants.yaml): `config/tenants.yaml`
- [Network model](https://github.com/lucacarr0/good-fences/blob/main/src/network_models.py): `src/network_models.py`

### Network simulation

- [Spine-leaf topology](https://github.com/lucacarr0/good-fences/blob/main/src/datacenter.py): `src/datacenter.py`
- [Mininet network](https://github.com/lucacarr0/good-fences/blob/main/src/datacenter.py): `src/datacenter.py`

### Ryu controller

- [Controller app](https://github.com/lucacarr0/good-fences/blob/main/src/controller/app.py): `src/controller/app.py`
- [Base pipeline](https://github.com/lucacarr0/good-fences/blob/main/src/controller/pipeline.py): `src/controller/pipeline.py`
- [ARP validation and reply](https://github.com/lucacarr0/good-fences/blob/main/src/controller/arp_proxy.py): `src/controller/arp_proxy.py`

### Other components

- **Operator**
- **OpenFlow switches**
- **Tenant hosts**

## Connections

- Operator → Spine-leaf topology: starts simulation (evidence: `README.md`)
- Topology config → Network model: configures topology (evidence: `src/network_models.py`)
- Tenant config → Network model: configures tenants (evidence: `src/network_models.py`)
- Spine-leaf topology → Network model: loads model (evidence: `src/datacenter.py`)
- Spine-leaf topology → Mininet network: builds network (evidence: `src/datacenter.py`)
- Mininet network → OpenFlow switches: creates switches (evidence: `src/datacenter.py`)
- Mininet network → Tenant hosts: creates hosts (evidence: `src/datacenter.py`)
- Controller app → Network model: loads bindings (evidence: `src/controller/app.py`)
- Controller app → Base pipeline: installs rules (evidence: `src/controller/app.py`)
- Base pipeline → Network model: reads host ports (evidence: `src/controller/pipeline.py`)
- Base pipeline → OpenFlow switches: installs drop and ARP rules (evidence: `src/controller/pipeline.py`)
- OpenFlow switches → Controller app: reports switch events (evidence: `src/controller/app.py`)
- Controller app → ARP validation and reply: validates ARP request (evidence: `src/controller/app.py`)
- ARP validation and reply → Controller app: returns reply frame (evidence: `src/controller/arp_proxy.py`)
- Controller app → OpenFlow switches: sends reply packet (evidence: `src/controller/app.py`)
- Tenant hosts → OpenFlow switches: sends ARP request (evidence: `README.md`)
- Network model → ARP validation and reply: provides tenant bindings (evidence: `src/controller/app.py`)
- Mininet network → Controller app: connects remote controller (evidence: `src/datacenter.py`)
