# titom73/eos-downloader architecture

> Architecture diagram of the GitHub repository titom73/eos-downloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/titom73/eos-downloader
- Repository: https://github.com/titom73/eos-downloader

## Overview

##### Main Components
- CLI Layer: Represented by the modules under eos_downloader/cli (with subdirectories for commands like “get”, “debug”, “info”). This layer handles user interaction and processes command-line arguments.
- Business Logic Layer: Consists of the core functionality in eos_downloader/logics. This is where the different “server” implementations (arista_server.py and arista_xml_server.py) and the download routines (download.py) reside. It encapsulates the algorithms to interact with external APIs/services and to perform the download actions.
- Data Model & Helpers: Modules under eos_downloader/models and eos_downloader/helpers represent how the software encapsulates downloaded data, versioning, and custom types. They also abstract any data transformations needed.
- Integration & External Services: The project supports downloading to various destinations such as local storage, Cloudvision, and EVE-NG. This should be shown as external services or endpoints with which the business logic communicates.
- Deployment & Containerization: With Dockerfiles present at multiple layers (root level and within .devcontainer), it’s clear that containerized deployment and developer environments are supported.
- Documentation & Configuration: Directories (docs, mkdocs.yml) and files like pyproject.toml, .pre-commit-config.yaml, and Makefile indicate build, configuration, and documentation processes.

##### Relationships and Interactions
- The CLI layer acts as the entry point. User commands are parsed and then routed to corresponding logic functions in the Business Logic Layer.
- The Business Logic Layer interacts with the Data Model to retrieve or update information about software images before initiating downloads.
- External integrations (Arista API endpoints, Docker registries or EVE-NG environments) are engaged by the logic layer via parameterized commands (e.g., “--import-docker”, “--eve-ng”).
- Helper modules and custom exceptions support error handling and utility functions that ensure clean communication between components.
- Testing modules simulate interactions among these components and verify end-to-end functionality.

##### Architectural Patterns and Technologies
- Modularity is key, as the separation into CLI, logic, and models promotes loose coupling.
- Command design pattern – each CLI command (“get”, “debug”, “info”) is implemented as a distinct module.
- Dependency Management and Containerization – Dockerfiles and devcontainer configurations indicate that isolated environments and CI/CD workflows (GitHub actions, release workflows) are essential.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Layer
    subgraph "CLI Layer"
        CLI["CLI Interface (eos_downloader/cli)"]
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        LOGIC["Core Logic (eos_downloader/logics)"]
        ARISTA["Arista Server (arista_server.py)"]
        ARISTA_XML["Arista XML Server (arista_xml_server.py)"]
        DOWNLOAD["Download Module (download.py)"]
    end

    %% Data Models & Helpers
    subgraph "Data Models & Helpers"
        MODELS["Data Models (eos_downloader/models)"]
        HELPERS["Helpers (eos_downloader/helpers)"]
    end

    %% External Services
    subgraph "External Services"
        LOCAL["Local Storage"]
        CLOUD["Cloudvision"]
        EVENG["EVE-NG"]
    end

    %% Testing & Quality Assurance
    subgraph "Testing & QA"
        UNIT["Unit Tests (tests/unit)"]
        SYSTEM["System Tests (tests/system)"]
    end

    %% Deployment & Containerization
    subgraph "Deployment & Containerization"
        DOCKERFILE["Dockerfile (root)"]
        DEVCONT[".devcontainer"]
    end

    %% Documentation & Configuration
    subgraph "Documentation & Configuration"
        DOCS["Documentation (docs)"]
        MKDOCS["mkdocs.yml"]
        PYPROJECT["pyproject.toml"]
        PRECOMMIT[".pre-commit-config.yaml"]
        MAKEFILE["Makefile"]
    end

    %% Relationships
    CLI -->|"calls"| LOGIC
    LOGIC -->|"uses"| ARISTA
    LOGIC -->|"uses"| ARISTA_XML
    LOGIC -->|"triggers"| DOWNLOAD
    LOGIC -->|"retrieves_data_from"| MODELS
    LOGIC -->|"utilizes"| HELPERS
    LOGIC -->|"integrates_with"| LOCAL
    LOGIC -->|"integrates_with"| CLOUD
    LOGIC -->|"integrates_with"| EVENG

    UNIT ---|"tests"| CLI
    UNIT ---|"tests"| LOGIC
    SYSTEM ---|"tests"| LOGIC

    %% Styling
    classDef cli fill:#f5b7b1,stroke:#922B21,stroke-width:2px;
    classDef logic fill:#aed6f1,stroke:#2471A3,stroke-width:2px;
    classDef models fill:#d5f5e3,stroke:#27AE60,stroke-width:2px;
    classDef external fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
    classDef testing fill:#f9e79f,stroke:#f39c12,stroke-width:2px;
    classDef deploy fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
    classDef docs fill:#d6eaf8,stroke:#3498db,stroke-width:2px;

    class CLI cli;
    class LOGIC,ARISTA,ARISTA_XML,DOWNLOAD logic;
    class MODELS,HELPERS models;
    class LOCAL,CLOUD,EVENG external;
    class UNIT,SYSTEM testing;
    class DOCKERFILE,DEVCONT deploy;
    class DOCS,MKDOCS,PYPROJECT,PRECOMMIT,MAKEFILE docs;

    %% Click Events
    click CLI "https://github.com/titom73/eos-downloader/tree/main/eos_downloader/cli"
    click LOGIC "https://github.com/titom73/eos-downloader/tree/main/eos_downloader/logics"
    click ARISTA "https://github.com/titom73/eos-downloader/blob/main/eos_downloader/logics/arista_server.py"
    click ARISTA_XML "https://github.com/titom73/eos-downloader/blob/main/eos_downloader/logics/arista_xml_server.py"
    click DOWNLOAD "https://github.com/titom73/eos-downloader/blob/main/eos_downloader/logics/download.py"
    click MODELS "https://github.com/titom73/eos-downloader/tree/main/eos_downloader/models"
    click HELPERS "https://github.com/titom73/eos-downloader/tree/main/eos_downloader/helpers"
    click UNIT "https://github.com/titom73/eos-downloader/tree/main/tests/unit"
    click SYSTEM "https://github.com/titom73/eos-downloader/tree/main/tests/system"
    click DOCKERFILE "https://github.com/titom73/eos-downloader/tree/main/Dockerfile"
    click DEVCONT "https://github.com/titom73/eos-downloader/blob/main/.devcontainer"
    click DOCS "https://github.com/titom73/eos-downloader/tree/main/docs"
    click MKDOCS "https://github.com/titom73/eos-downloader/blob/main/mkdocs.yml"
    click PYPROJECT "https://github.com/titom73/eos-downloader/blob/main/pyproject.toml"
    click PRECOMMIT "https://github.com/titom73/eos-downloader/blob/main/.pre-commit-config.yaml"
    click MAKEFILE "https://github.com/titom73/eos-downloader/tree/main/Makefile"
```
