# ayush-learner44/thesis architecture

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

- Interactive diagram: https://gitdiagram.com/ayush-learner44/thesis
- Repository: https://github.com/ayush-learner44/thesis

## Overview

This repository is a Mininet/BMv2 testbed for distributed SYN-flood detection in a fat-tree fabric. Operators boot the topology, start the controller, and launch benign or attack traffic from client hosts toward server hosts. Edge switches spray flowlets, aggregation switches emit detector digests, and the controller combines evidence across switches, scores flows, and installs fabric-wide blocks; a separate cardinality monitor flags spoofed-source victims. Servers run nginx and packet capture; verification compares captures and run labels with controller decisions. README documents these capabilities; controller details are sampled only in part.

Main entry points: [`controller.py`](https://github.com/ayush-learner44/thesis/blob/completed/controller.py) (P4Runtime controller), [`p4src/ddos_detector.p4`](https://github.com/ayush-learner44/thesis/blob/completed/p4src/ddos_detector.p4) (Aggregation detector), [`network.py`](https://github.com/ayush-learner44/thesis/blob/completed/network.py) (Fabric bootstrap), [`launch.py`](https://github.com/ayush-learner44/thesis/blob/completed/launch.py) (Traffic scenarios)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fabric["Fabric setup"]
  node_network["Fabric bootstrap<br/>[network.py]"]
  node_topology["Fat-tree topology<br/>[fattree.py]"]
end

subgraph group_plane["Switch dataplane"]
  node_core["Core forwarding<br/>[ft_core.p4]"]
  node_edge["Edge flowlet spray<br/>[ft_edge.p4]"]
  node_detector["Aggregation detector<br/>[ddos_detector.p4]"]
end

subgraph group_detect["Detection control"]
  node_controller["P4Runtime controller<br/>[controller.py]"]
  node_flowstate["Flow reputation<br/>[controller.py]"]
  node_classifier["Lean classifier<br/>[controller.py]"]
  node_model["Trained model<br/>[lean_model.pkl]"]
  node_spoof["Spoof cardinality monitor<br/>[controller.py]"]
end

subgraph group_traffic["Traffic and service"]
  node_launch["Traffic scenarios<br/>[launch.py]"]
  node_attack["SYN traffic generator<br/>[attack.py]"]
  node_serverproc["nginx and capture<br/>[server.py]"]
  node_nginxconf["nginx configuration<br/>[nginx_ft.conf]"]
end

subgraph group_eval["Run verification"]
  node_verify["Run verification<br/>[verify.py]"]
end

node_operator(("Operator"))
node_mininet["Mininet fabric"]
node_clients(("Client hosts"))
node_servers(("Server hosts"))
node_captures["Server packet captures"]
node_runlabels["Run role labels"]
node_evalcsv["Controller evaluation CSV"]

node_operator -->|"boots"| node_network
node_network -->|"uses topology"| node_topology
node_network -->|"configures fabric"| node_mininet
node_network -->|"programs core"| node_core
node_network -->|"programs edges"| node_edge
node_network -->|"programs aggregations"| node_detector
node_network -->|"starts servers"| node_serverproc
node_mininet -->|"hosts"| node_clients
node_mininet -->|"hosts"| node_servers
node_clients -->|"send traffic"| node_edge
node_edge -->|"spray uplinks"| node_detector
node_detector -->|"forward packets"| node_core
node_core -->|"forward packets"| node_detector
node_detector -->|"deliver packets"| node_servers
node_operator -->|"starts controller"| node_controller
node_controller -->|"loads routes"| node_topology
node_controller -->|"connects P4Runtime"| node_mininet
node_controller -->|"enables digests"| node_detector
node_detector -->|"send digests"| node_controller
node_controller -->|"updates flow evidence"| node_flowstate
node_controller -->|"scores windows"| node_classifier
node_classifier -->|"predicts with"| node_model
node_controller -->|"tracks completions"| node_spoof
node_spoof -->|"reports suspects"| node_controller
node_controller -->|"installs block rules"| node_detector
node_operator -->|"chooses scenario"| node_launch
node_launch -->|"launches traffic"| node_clients
node_launch -->|"invokes flooder"| node_attack
node_attack -->|"sends SYNs"| node_servers
node_serverproc -->|"runs on"| node_servers
node_serverproc -->|"loads config"| node_nginxconf
node_serverproc -->|"writes captures"| node_captures
node_launch -->|"writes roles"| node_runlabels
node_controller -->|"writes decisions"| node_evalcsv
node_operator -->|"scores run"| node_verify
node_verify -->|"reads captures"| node_captures
node_verify -->|"reads roles"| node_runlabels
node_verify -->|"reads decisions"| node_evalcsv

click node_network "https://github.com/ayush-learner44/thesis/blob/completed/network.py"
click node_topology "https://github.com/ayush-learner44/thesis/blob/completed/lib/fattree.py"
click node_core "https://github.com/ayush-learner44/thesis/blob/completed/p4src/ft_core.p4"
click node_edge "https://github.com/ayush-learner44/thesis/blob/completed/p4src/ft_edge.p4"
click node_detector "https://github.com/ayush-learner44/thesis/blob/completed/p4src/ddos_detector.p4"
click node_controller "https://github.com/ayush-learner44/thesis/blob/completed/controller.py"
click node_flowstate "https://github.com/ayush-learner44/thesis/blob/completed/controller.py"
click node_classifier "https://github.com/ayush-learner44/thesis/blob/completed/controller.py"
click node_model "https://github.com/ayush-learner44/thesis/blob/completed/models/lean_model.pkl"
click node_spoof "https://github.com/ayush-learner44/thesis/blob/completed/controller.py"
click node_launch "https://github.com/ayush-learner44/thesis/blob/completed/launch.py"
click node_attack "https://github.com/ayush-learner44/thesis/blob/completed/lib/attack.py"
click node_serverproc "https://github.com/ayush-learner44/thesis/blob/completed/server.py"
click node_nginxconf "https://github.com/ayush-learner44/thesis/blob/completed/lib/nginx_ft.conf"
click node_verify "https://github.com/ayush-learner44/thesis/blob/completed/lib/verify.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_network,node_topology,node_clients toneBlue
class node_core,node_edge,node_detector toneAmber
class node_controller,node_flowstate,node_classifier,node_model,node_spoof,node_servers,node_captures toneMint
class node_launch,node_attack,node_serverproc,node_nginxconf toneRose
class node_verify,node_operator,node_mininet,node_runlabels,node_evalcsv toneIndigo
```

## Components

### Fabric setup

- [Fabric bootstrap](https://github.com/ayush-learner44/thesis/blob/completed/network.py): `network.py`
- [Fat-tree topology](https://github.com/ayush-learner44/thesis/blob/completed/lib/fattree.py): `lib/fattree.py`

### Switch dataplane

- [Core forwarding](https://github.com/ayush-learner44/thesis/blob/completed/p4src/ft_core.p4): `p4src/ft_core.p4`
- [Edge flowlet spray](https://github.com/ayush-learner44/thesis/blob/completed/p4src/ft_edge.p4): `p4src/ft_edge.p4`
- [Aggregation detector](https://github.com/ayush-learner44/thesis/blob/completed/p4src/ddos_detector.p4): `p4src/ddos_detector.p4`

### Detection control

- [P4Runtime controller](https://github.com/ayush-learner44/thesis/blob/completed/controller.py): `controller.py`
- [Flow reputation](https://github.com/ayush-learner44/thesis/blob/completed/controller.py): `controller.py`
- [Lean classifier](https://github.com/ayush-learner44/thesis/blob/completed/controller.py): `controller.py`
- [Trained model](https://github.com/ayush-learner44/thesis/blob/completed/models/lean_model.pkl): `models/lean_model.pkl`
- [Spoof cardinality monitor](https://github.com/ayush-learner44/thesis/blob/completed/controller.py): `controller.py`

### Traffic and service

- [Traffic scenarios](https://github.com/ayush-learner44/thesis/blob/completed/launch.py): `launch.py`
- [SYN traffic generator](https://github.com/ayush-learner44/thesis/blob/completed/lib/attack.py): `lib/attack.py`
- [nginx and capture](https://github.com/ayush-learner44/thesis/blob/completed/server.py): `server.py`
- [nginx configuration](https://github.com/ayush-learner44/thesis/blob/completed/lib/nginx_ft.conf): `lib/nginx_ft.conf`

### Run verification

- [Run verification](https://github.com/ayush-learner44/thesis/blob/completed/lib/verify.py): `lib/verify.py`

### Other components

- **Operator**
- **Mininet fabric**
- **Client hosts**
- **Server hosts**
- **Server packet captures**
- **Run role labels**
- **Controller evaluation CSV**

## Connections

- Operator → Fabric bootstrap: boots
- Fabric bootstrap → Fat-tree topology: uses topology
- Fabric bootstrap → Mininet fabric: configures fabric
- Fabric bootstrap → Core forwarding: programs core
- Fabric bootstrap → Edge flowlet spray: programs edges
- Fabric bootstrap → Aggregation detector: programs aggregations
- Fabric bootstrap → nginx and capture: starts servers
- Mininet fabric → Client hosts: hosts
- Mininet fabric → Server hosts: hosts
- Client hosts → Edge flowlet spray: send traffic
- Edge flowlet spray → Aggregation detector: spray uplinks
- Aggregation detector → Core forwarding: forward packets
- Core forwarding → Aggregation detector: forward packets
- Aggregation detector → Server hosts: deliver packets
- Operator → P4Runtime controller: starts controller
- P4Runtime controller → Fat-tree topology: loads routes
- P4Runtime controller → Mininet fabric: connects P4Runtime
- P4Runtime controller → Aggregation detector: enables digests
- Aggregation detector → P4Runtime controller: send digests
- P4Runtime controller → Flow reputation: updates flow evidence
- P4Runtime controller → Lean classifier: scores windows
- Lean classifier → Trained model: predicts with
- P4Runtime controller → Spoof cardinality monitor: tracks completions
- Spoof cardinality monitor → P4Runtime controller: reports suspects
- P4Runtime controller → Aggregation detector: installs block rules
- Operator → Traffic scenarios: chooses scenario
- Traffic scenarios → Client hosts: launches traffic
- Traffic scenarios → SYN traffic generator: invokes flooder
- SYN traffic generator → Server hosts: sends SYNs
- nginx and capture → Server hosts: runs on
- nginx and capture → nginx configuration: loads config
- nginx and capture → Server packet captures: writes captures
- Traffic scenarios → Run role labels: writes roles
- P4Runtime controller → Controller evaluation CSV: writes decisions
- Operator → Run verification: scores run
- Run verification → Server packet captures: reads captures
- Run verification → Run role labels: reads roles
- Run verification → Controller evaluation CSV: reads decisions
