# onemind-services-llc/evengsdk architecture

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

- Interactive diagram: https://gitdiagram.com/onemind-services-llc/evengsdk
- Repository: https://github.com/onemind-services-llc/evengsdk

## Overview

##### Project Type and Purpose
- That evengsdk is a library combined with a CLI application that serves two main purposes: providing a Python API client (EvengClient) for interacting with the EVE-NG REST API, and offering command-line utilities (organized under multiple subcommands like folder, lab, node, user, system, etc.) for automating lab creation and management.
- Stress that the tool’s primary role is to simplify the creation, configuration, and management of network topologies in EVE-NG environments.

##### Analyzing the File Structure
- The top-level directories and files (src, docs, examples, tests, Makefile, setup.py, etc.) immediately suggest separation of concerns:
- The “src/evengsdk” directory is the core library, featuring modules for the API client, CLI commands (segmented further into folders, labs, nodes, system, and users), templates, schemas, exceptions, and even plugins.
- The “examples” directory provides sample configuration files, templates (Jinja) and YAML topology declarations that show how to build lab topologies.
- The “docs” directory documents the API reference, CLI usage, and even a topology builder guide.
- The “tests” directory indicates a comprehensive testing strategy divided into API tests and CLI tests.
- Notice the presence of configuration files (like .dockerignore, flake8, pre-commit, etc.) and CI/CD related files in the “.github/workflows” directory, suggesting that the project has an established development process.

##### Key Components
a. Main Components:
- API Client Module: Represented by the EvengClient (in src/evengsdk/client.py and api.py) that encapsulates communication with the EVE-NG server’s REST API.
- CLI Application: Include the CLI entry point (src/evengsdk/__main__.py) and the various subcommand modules (cli/folders, cli/lab, cli/node, cli/system, and cli/users).
- Topology Builder: Reflect the declarative topology engine that resolves YAML/ Jinja templates and configuration files (examples and templates in src/evengsdk/templates and docs/topology_builder.md).
- Supporting Modules: Such as plugins (for extensibility), schemas/validators (to enforce valid lab definitions), and exceptions (for error handling).

b. Relationships and Interactions:
- Flow between the CLI commands and core functions such as “create lab,” “add node,” “connect nodes,” and “manage users.”
- An external node for the EVE-NG server showing that API calls flow externally from evengsdk to an EVE-NG instance.

c. Architectural Patterns and Design Principles:
- A modular design with clear separation between command handling (CLI modules) and API operations (client, API modules).
- Use of declarative configuration for building labs (topology YAML files combined with Jinja templates) that decouple lab representation from code.
- That tests are organized to mirror these components (API and CLI testing), reinforcing clean interfaces and modularity.

d. Relevant Technologies and Frameworks:
- Python is the core language with dependencies outlined in the requirements files.
- Jinja templating is used for node configuration and lab templates.
- Standard practices like environment variable configurations are supported for API connectivity.
- The integration with CI/CD workflows is bolstered by GitHub Actions (see .github/workflows).

##### Capturing Essential Architectural Elements
- Visual elements for error handling (exceptions) and extensibility (plugins) if appropriate.

## Diagram (Mermaid)

```mermaid
graph TD
    %% External Input
    UserInput("User/CI/CD Pipeline"):::cli

    %% CLI Application
    subgraph "CLI Application"
        CLI_Entry("CLI Entry Point"):::cli
        CLI_CLI("CLI Handler (cli.py)"):::cli
        CLI_Console("Console Handler (console.py)"):::cli
        Folders_Command("Folders Command"):::cli
        Lab_Command("Lab Command"):::cli
        Lab_Topology("Lab Topology Handler"):::cli
        Node_Command("Node Command"):::cli
        System_Command("System Command"):::cli
        User_Command("User Command"):::cli
    end

    %% Core Library
    subgraph "Core Library"
        API_Client("API Client (client.py)"):::library
        API_Module("API Module (api.py)"):::library
        Topo_Engine("Template Engine (templates.py)"):::library
        Templates_Dir("Templates Directory"):::library
        Plugins("Plugins"):::library
        Schemas("Schemas/Validators"):::library
        Exceptions("Exceptions"):::library
    end

    %% Topology & Documentation
    subgraph "Topology & Documentation"
        Examples_Templates("Examples Templates"):::sub
        Test_Topo_YAML("Test Topology YAML"):::sub
        Test_Topo_NAT("Test Topology NAT YAML"):::sub
        Topo_Docs("Topology Builder Docs"):::sub
    end

    %% Testing Modules
    subgraph "Tests"
        API_Testing("API Testing"):::test
        CLI_Testing("CLI Testing"):::test
    end

    %% External System
    EVE_NG("EVE-NG REST API Server"):::external

    %% Connections
    UserInput --> CLI_Entry
    CLI_Entry --> CLI_CLI
    CLI_Entry --> CLI_Console
    CLI_CLI --> Folders_Command
    CLI_CLI --> Lab_Command
    CLI_CLI --> Node_Command
    CLI_CLI --> System_Command
    CLI_CLI --> User_Command
    CLI_Console -- "assists" --> Folders_Command
    CLI_Console -- "assists" --> Lab_Command
    CLI_Console -- "assists" --> Node_Command
    CLI_Console -- "assists" --> System_Command
    CLI_Console -- "assists" --> User_Command

    Lab_Command --> Lab_Topology
    Folders_Command --> API_Client
    Lab_Command --> API_Client
    Node_Command --> API_Client
    System_Command --> API_Client
    User_Command --> API_Client
    API_Client --> API_Module
    API_Module --> EVE_NG

    Lab_Topology --> Topo_Engine
    Topo_Engine --> Templates_Dir

    Topo_Engine --> Topo_Docs
    Topo_Engine --> Examples_Templates
    Topo_Engine --> Test_Topo_YAML
    Topo_Engine --> Test_Topo_NAT

    API_Client --> Plugins
    API_Client --> Schemas
    API_Client --> Exceptions

    API_Testing --> API_Client
    API_Testing --> API_Module
    CLI_Testing --> CLI_CLI

    %% Click Events
    click CLI_Entry "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/__main__.py"
    click CLI_CLI "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/cli/cli.py"
    click CLI_Console "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/cli/console.py"
    click Folders_Command "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/cli/folders/commands.py"
    click Lab_Command "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/cli/lab/commands.py"
    click Lab_Topology "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/cli/lab/topology.py"
    click Node_Command "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/cli/node/commands.py"
    click System_Command "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/cli/system/commands.py"
    click User_Command "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/cli/users/commands.py"
    click API_Client "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/client.py"
    click API_Module "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/api.py"
    click Topo_Engine "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/templates.py"
    click Templates_Dir "https://github.com/onemind-services-llc/evengsdk/tree/master/src/evengsdk/templates/"
    click Examples_Templates "https://github.com/onemind-services-llc/evengsdk/tree/master/examples/templates"
    click Test_Topo_YAML "https://github.com/onemind-services-llc/evengsdk/blob/master/examples/test_topology.yml"
    click Test_Topo_NAT "https://github.com/onemind-services-llc/evengsdk/blob/master/examples/test_topology_nat.yml"
    click Topo_Docs "https://github.com/onemind-services-llc/evengsdk/blob/master/docs/topology_builder.md"
    click Plugins "https://github.com/onemind-services-llc/evengsdk/tree/master/src/evengsdk/plugins"
    click Schemas "https://github.com/onemind-services-llc/evengsdk/tree/master/src/evengsdk/schemas"
    click Exceptions "https://github.com/onemind-services-llc/evengsdk/blob/master/src/evengsdk/exceptions.py"
    click API_Testing "https://github.com/onemind-services-llc/evengsdk/tree/master/src/tests/api"
    click CLI_Testing "https://github.com/onemind-services-llc/evengsdk/tree/master/src/tests/cli"

    %% Styles
    classDef cli fill:#e0f7fa,stroke:#006064,stroke-width:2px;
    classDef library fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
    classDef sub fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px;
    classDef test fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px;
    classDef external fill:#ffebee,stroke:#c62828,stroke-width:2px;
```
