# ash0545/sdn-ml-ids architecture

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

- Interactive diagram: https://gitdiagram.com/ash0545/sdn-ml-ids
- Repository: https://github.com/ash0545/sdn-ml-ids

## Overview

This repository is a research project for emulating an SDN, collecting labeled network-flow data, processing it, and training and evaluating intrusion-detection models. The main workflow runs an emulated topology with generated normal or attack traffic, collects flow/port/table statistics through Ryu, stores CSV datasets, then preprocesses data and compares models. The IDS controller also classifies live flows using a scaler, PCA, and Random Forest. README documents additional processing and model-analysis capabilities; their implementations are not shown in the excerpts, so those links are documented rather than inferred from source calls.

Main entry points: [`Network Topology/mininet_topology.py`](https://github.com/ash0545/sdn-ml-ids/blob/main/Network%20Topology/mininet_topology.py) (Mininet topology), [`Dataset Collection/Ryu Controller/ofctl_collector_controller.py`](https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/ofctl_collector_controller.py) (Statistics collector), [`Dataset Collection/Ryu Controller/IDS/controller.py`](https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/IDS/controller.py) (Live IDS controller), [`Dataset Collection/Collected Dataset`](https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Collected%20Dataset) (Collected flow CSVs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_topology["Network topology"]
  node_topo["Mininet topology"]
end

subgraph group_traffic["Traffic generation"]
  node_attack["Attack traffic"]
  node_normal["Normal traffic"]
end

subgraph group_collection["Collection and IDS"]
  node_switch["Learning switch"]
  node_collector["Statistics collector"]
  node_controller["Live IDS controller<br/>[controller.py]"]
  node_mlalg["Flow classifier<br/>[ml_alg.py]"]
  node_artifacts["IDS model artifacts"]
end

subgraph group_data["Dataset and processing"]
  node_csv[("Collected flow CSVs")]
  node_processing["Dataset processing"]
  node_selection["Feature selection"]
  node_reduction["Scaling and reduction"]
end

subgraph group_models["Modeling and analysis"]
  node_training["Model comparison"]
  node_evaluation["Model evaluation"]
  node_legacy["Earlier IP1202 work"]
end

node_operator(("Experiment operator"))
node_ofctl["Ryu ofctl REST"]

node_operator -->|"starts emulation"| node_topo
node_operator -->|"generates attacks"| node_attack
node_operator -->|"generates normal"| node_normal
node_topo -.->|"connects controller"| node_switch
node_attack -->|"sends traffic"| node_topo
node_normal -->|"sends traffic"| node_topo
node_collector -->|"inherits from"| node_switch
node_collector -->|"requests statistics"| node_ofctl
node_collector -->|"appends rows"| node_csv
node_controller -->|"inherits from"| node_switch
node_controller -->|"requests statistics"| node_ofctl
node_controller -->|"classifies flows"| node_mlalg
node_mlalg -->|"loads models"| node_artifacts
node_csv -.->|"provides data"| node_processing
node_processing -.->|"prepares features"| node_selection
node_selection -.->|"selects then reduces"| node_reduction
node_reduction -.->|"transformed data"| node_training
node_training -.->|"compares performance"| node_evaluation
node_legacy -.->|"includes prior datasets"| node_csv

click node_topo "https://github.com/ash0545/sdn-ml-ids/blob/main/Network%20Topology/mininet_topology.py"
click node_attack "https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Attack%20Traffic%20Generation"
click node_normal "https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Normal%20Traffic%20Generation"
click node_switch "https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/modified_simple_switch_13.py"
click node_collector "https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/ofctl_collector_controller.py"
click node_controller "https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/IDS/controller.py"
click node_mlalg "https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/IDS/ml_alg.py"
click node_artifacts "https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Ryu%20Controller/IDS"
click node_csv "https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Collected%20Dataset"
click node_processing "https://github.com/ash0545/sdn-ml-ids/blob/main/Data%20Processing/data_processing.ipynb"
click node_selection "https://github.com/ash0545/sdn-ml-ids/blob/main/Data%20Processing/data_processing.ipynb"
click node_reduction "https://github.com/ash0545/sdn-ml-ids/blob/main/Data%20Processing/data_processing.ipynb"
click node_training "https://github.com/ash0545/sdn-ml-ids/tree/main/Model%20Training%20%26%20Analysis"
click node_evaluation "https://github.com/ash0545/sdn-ml-ids/tree/main/Model%20Training%20%26%20Analysis"
click node_legacy "https://github.com/ash0545/sdn-ml-ids/tree/main/Previous%20Work%20-%20IP1202"

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_topo toneBlue
class node_attack,node_normal toneAmber
class node_switch,node_collector,node_controller,node_mlalg,node_artifacts toneMint
class node_csv,node_processing,node_selection,node_reduction toneRose
class node_training,node_evaluation,node_legacy,node_operator,node_ofctl toneIndigo
```

## Components

### Network topology

- [Mininet topology](https://github.com/ash0545/sdn-ml-ids/blob/main/Network%20Topology/mininet_topology.py): `Network Topology/mininet_topology.py`

### Traffic generation

- [Attack traffic](https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Attack%20Traffic%20Generation): `Dataset Collection/Attack Traffic Generation`
- [Normal traffic](https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Normal%20Traffic%20Generation): `Dataset Collection/Normal Traffic Generation`

### Collection and IDS

- [Learning switch](https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/modified_simple_switch_13.py): `Dataset Collection/Ryu Controller/modified_simple_switch_13.py`
- [Statistics collector](https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/ofctl_collector_controller.py): `Dataset Collection/Ryu Controller/ofctl_collector_controller.py`
- [Live IDS controller](https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/IDS/controller.py): `Dataset Collection/Ryu Controller/IDS/controller.py`
- [Flow classifier](https://github.com/ash0545/sdn-ml-ids/blob/main/Dataset%20Collection/Ryu%20Controller/IDS/ml_alg.py): `Dataset Collection/Ryu Controller/IDS/ml_alg.py`
- [IDS model artifacts](https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Ryu%20Controller/IDS): `Dataset Collection/Ryu Controller/IDS`

### Dataset and processing

- [Collected flow CSVs](https://github.com/ash0545/sdn-ml-ids/tree/main/Dataset%20Collection/Collected%20Dataset): `Dataset Collection/Collected Dataset`
- [Dataset processing](https://github.com/ash0545/sdn-ml-ids/blob/main/Data%20Processing/data_processing.ipynb): `Data Processing/data_processing.ipynb`
- [Feature selection](https://github.com/ash0545/sdn-ml-ids/blob/main/Data%20Processing/data_processing.ipynb): `Data Processing/data_processing.ipynb`
- [Scaling and reduction](https://github.com/ash0545/sdn-ml-ids/blob/main/Data%20Processing/data_processing.ipynb): `Data Processing/data_processing.ipynb`

### Modeling and analysis

- [Model comparison](https://github.com/ash0545/sdn-ml-ids/tree/main/Model%20Training%20%26%20Analysis): `Model Training & Analysis`
- [Model evaluation](https://github.com/ash0545/sdn-ml-ids/tree/main/Model%20Training%20%26%20Analysis): `Model Training & Analysis`
- [Earlier IP1202 work](https://github.com/ash0545/sdn-ml-ids/tree/main/Previous%20Work%20-%20IP1202): `Previous Work - IP1202`

### Other components

- **Experiment operator**
- **Ryu ofctl REST**

## Connections

- Experiment operator → Mininet topology: starts emulation (evidence: `README.md`)
- Experiment operator → Attack traffic: generates attacks (evidence: `README.md`)
- Experiment operator → Normal traffic: generates normal (evidence: `README.md`)
- Mininet topology → Learning switch: connects controller
- Attack traffic → Mininet topology: sends traffic (evidence: `README.md`)
- Normal traffic → Mininet topology: sends traffic (evidence: `README.md`)
- Statistics collector → Learning switch: inherits from (evidence: `Dataset Collection/Ryu Controller/ofctl_collector_controller.py`)
- Statistics collector → Ryu ofctl REST: requests statistics (evidence: `Dataset Collection/Ryu Controller/ofctl_collector_controller.py`)
- Statistics collector → Collected flow CSVs: appends rows (evidence: `Dataset Collection/Ryu Controller/ofctl_collector_controller.py`)
- Live IDS controller → Learning switch: inherits from (evidence: `Dataset Collection/Ryu Controller/IDS/controller.py`)
- Live IDS controller → Ryu ofctl REST: requests statistics (evidence: `Dataset Collection/Ryu Controller/IDS/controller.py`)
- Live IDS controller → Flow classifier: classifies flows (evidence: `Dataset Collection/Ryu Controller/IDS/controller.py`)
- Flow classifier → IDS model artifacts: loads models (evidence: `Dataset Collection/Ryu Controller/IDS/ml_alg.py`)
- Collected flow CSVs → Dataset processing: provides data
- Dataset processing → Feature selection: prepares features (evidence: `README.md`)
- Feature selection → Scaling and reduction: selects then reduces (evidence: `README.md`)
- Scaling and reduction → Model comparison: transformed data (evidence: `README.md`)
- Model comparison → Model evaluation: compares performance (evidence: `README.md`)
- Earlier IP1202 work → Collected flow CSVs: includes prior datasets (evidence: `Previous Work - IP1202/Model Training and Analysis/final_model_export.py`)
