# fherbine/42_badass architecture

> Architecture diagram of the GitHub repository fherbine/42_badass, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fherbine/42_badass
- Repository: https://github.com/fherbine/42_badass

## Overview

##### Project type and purpose
- This is not a traditional full-stack app. It’s a network-simulation/training project built on top of GNS3, using custom Docker images to emulate hosts and routers running BGP (Border Gateway Protocol) across Autonomous Systems (AS).
- The README confirms the goal: learn BGP mechanics by spinning up Docker-based hosts and routers in GNS3 topologies in three parts (P1, P2, P3).

##### File structure
- Top-level:
- P1, P2, P3 each contain a GNS3 project (.gns3project) and walkthrough markdown.
- P1 has two Docker build contexts (`_aabelque_routeur-1` and `_fherbine_host-1`), so Part 1 uses two custom containers.
- P3/.data/images suggests custom or pre-built images stored for reuse.
- No traditional “src” code; instead, containers acting as network nodes.

##### README
- Confirms BGP, AS, GNS3 focus.
- Part 1 instructions: build two Docker images for host and router.
- P2 and P3 likely build on this by adding more nodes or more complex topologies.

a. Main components
- GNS3 controller (the orchestrator)—the environment where all nodes connect.
- Docker-based nodes:
- Hosts (e.g., `host_fherbine`)
- Routers (e.g., `routeur_aabelque`)
- Links/subnets interconnecting these nodes.
- External networks or “the Internet” (if simulated).

b. Relationships & interactions
- Point-to-point links (Ethernet segments) between hosts and routers.
- Data plane vs control plane: illustrate that Docker containers simulate OSI layers 2/3 and run BGP at layer 4/7.

c. Architectural patterns
- It’s a simple two-node BGP topology in P1 (demo of eBGP), expanded in P2/P3.
- The “microservice” analogy: each container is an independent network function.
- The orchestrator (GNS3) acts like a lightweight SDN controller.

d. Key technologies / frameworks
- GNS3 (network emulator)
- Docker (for creating host/router VMs)
- BGP daemon (e.g., FRRouting or Quagga inside the containers)
- Linux networking namespaces inside Docker.

##### Detail without overcomplicating
- Docker image name next to the node (e.g., `routeur_aabelque` uses image tag `routeur_aabelque:latest`).
- Version of BGP daemon if relevant.

Putting it all together:
- Top-center: GNS3 (cloud).
- With a line labeled “10.0.0.0/30 – eBGP AS65001 ↔ AS65002.”
- For P2/P3, replicate and interconnect more routers/hosts, grouping them by AS or region.
- Callouts for Docker build contexts (`_fherbine_host-1`, `_aabelque_routeur-1`) and data folder (.data/images).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Part 1
    subgraph "Part 1"
        G1["GNS3 Orchestrator (P1)"]:::orchestrator
        H1["Host: host_fherbine<br>(image: host_fherbine:latest)"]:::host
        R1["Router: routeur_aabelque<br>(image: routeur_aabelque:latest)"]:::router
        BD1["BGP Daemon Config (daemons.conf)"]:::docs
        G1 --> H1
        G1 --> R1
        R1 --> BD1
        H1 ---|"10.0.0.0/30 – eBGP AS65001 ↔ AS65002"| R1
    end

    %% Part 2
    subgraph "Part 2"
        G2["GNS3 Orchestrator (P2)"]:::orchestrator
        MD2["Documentation: walkthrough_p2.md"]:::docs
        G2 --> MD2
    end

    %% Part 3
    subgraph "Part 3"
        G3["GNS3 Orchestrator (P3)"]:::orchestrator
        IMG3["Images Storage (.data/images)"]:::storage
        MD3["Documentation: walkthrough_p3.md"]:::docs
        G3 --> IMG3
        G3 --> MD3
    end

    %% README
    README["Project Overview and Instructions (README.md)"]:::docs

    %% Connections between parts
    Part1End((" ")) --> README
    README --> Part2Start((" "))
    Part2End((" ")) --> Part3Start((" "))

    %% Click Events
    click G1 "https://github.com/fherbine/42_badass/blob/master/P1/P1.gns3project"
    click H1 "https://github.com/fherbine/42_badass/tree/master/P1/_fherbine_host-1"
    click R1 "https://github.com/fherbine/42_badass/tree/master/P1/_aabelque_routeur-1"
    click BD1 "https://github.com/fherbine/42_badass/blob/master/P1/_aabelque_routeur-1.daemons.conf"
    click G2 "https://github.com/fherbine/42_badass/blob/master/P2/P2.gns3project"
    click MD2 "https://github.com/fherbine/42_badass/blob/master/P2/walkthrough_p2.md"
    click G3 "https://github.com/fherbine/42_badass/blob/master/P3/P3.gns3project"
    click IMG3 "https://github.com/fherbine/42_badass/tree/master/P3/.data/images"
    click MD3 "https://github.com/fherbine/42_badass/blob/master/P3/walkthrough_p3.md"
    click README "https://github.com/fherbine/42_badass/blob/master/README.md"

    %% Styles
    classDef orchestrator fill:#d5d8dc,stroke:#808b96,stroke-width:1px;
    classDef host fill:#aed6f1,stroke:#5499c7,stroke-width:1px;
    classDef router fill:#f5b041,stroke:#d68910,stroke-width:1px;
    classDef docs fill:#d7bde2,stroke:#8e44ad,stroke-width:1px;
    classDef storage fill:#abebc6,stroke:#27ae60,stroke-width:1px;
```
