# dasharo/open-source-firmware-validation architecture

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

- Interactive diagram: https://gitdiagram.com/dasharo/open-source-firmware-validation
- Repository: https://github.com/dasharo/open-source-firmware-validation

## Overview

##### And Label Main Components
- Test Orchestration Layer:
- The Robot Framework tests are the heart of the system. Mark areas such as “dasharo-compatibility”, “dasharo-security”, “dasharo-performance”, “dasharo-stability”, and “self-tests” as distinct test modules.
- “keys-and-keywords”, “lib” (which contains shared libraries and helper scripts) and “platform-configs” (which encapsulates per-platform configuration details).
- External Device Control and Power Management:
- External hardware components referenced in the README: DUT (Device Under Test), Sonoff WiFi smart plugs for power control, RTE relay systems, serial connectivity (via ser2net), and PiKVM for display/keyboard emulation.
- Software Integration Layer:
- That these APIs/libraries are integrated through the “requirements.txt” and are used by underlying scripts in “osfv_cli” and the “lib” directory.
- Supporting Utilities and Scripts:
- “scripts/” that contain CI workflows, regression and run wrappers, configuration parsers, and documentation generators.
- “os-config” and “pikvm-rest-api” as support components.

- From the test runner (Robot Commands, scripts/run.sh, and scripts/regression.sh) to each module (the various dasharo-* directories).
- From each test module to common libraries (e.g., “lib/”) that encapsulate hardware interactions (bios, power, network, flash, etc).
- Demonstrate configuration flow: Platform-specific configurations are read from “platform-configs” and are used to drive test conditions.

##### Architectural Patterns and Design Principles
- Modular Design:
- That the test system is organized by functional concerns (compatibility, security, performance, stability) – each functioning as separate modules that feed into the overall validation pipeline.
- Reusability and Extensibility:
- How common libraries in “lib/” (for instance, for network operations, flash operations, secure boot management) are reused across modules.
- Integration with External Services:
- Model the external API services (the previously standalone sonoff and RTE APIs now unified into common libraries via requirements) and how they integrate with the test environment.
- CI/CD and Automation:
- GitHub Workflows that are used to run “smoke” tests, QEMU tests, and documentation generation (e.g., scripts in “.github/workflows/”), indicating automation pipelines.

##### Technologies and Frameworks
- Robot Framework:
- Since many test files are in .robot format, include a “Robot Framework Test Runner” component.
- Scripting Languages:
- Python scripts and command-line wrappers (e.g., get_results_from_logs.py, scripts/lib/robot.sh, etc.) are part of the integration layer.
- External APIs:
- External libraries and previously independent repositories for controlling power devices (Sonoff) and test setups (RTE, PiKVM).

- Related test modules (all dasharo-* directories) together in a “Test Modules” group.
- Have a separate section for “Platform Configurations” from the “platform-configs” directory.
- Isolate the “lib” and “scripts” directories as shared infrastructure components.
- Annotations (labels) for connection logic:
- How generated documentation is produced from “scripts/create-docs.sh” and exported to “docs/”.

## Diagram (Mermaid)

```mermaid
flowchart TD 
    %% Top Layer: Test Orchestration & CI/CD
    subgraph "Test Orchestration & CI/CD"
        CI1["GitHub Workflows"]:::ci
        CI2["Automation Scripts"]:::ci
        CI3["Documentation & Reporting"]:::doc
    end

    %% Test Runner Layer
    subgraph "Test Runner Layer"
        TR["Robot Framework Test Runner"]:::test
    end

    %% Test Modules Group
    subgraph "Test Modules"
        TM1["Dasharo Compatibility Tests"]:::test
        TM2["Dasharo Security Tests"]:::test
        TM3["Dasharo Performance Tests"]:::test
        TM4["Dasharo Stability Tests"]:::test
        TM5["Self Tests"]:::test
    end

    %% Shared Libraries & Helpers
    subgraph "Shared Libraries & Helpers"
        LIB1["Shared Libraries (lib)"]:::library
        LIB2["Keys and Keywords"]:::library
    end

    %% Platform-specific Configurations
    CPC["Platform Configurations"]:::config

    %% External Device Control & Power Management
    subgraph "External Device Control & Power Management"
        EXT1["DUT (Device Under Test)"]:::external
        EXT2["Sonoff WiFi Smart Plugs"]:::external
        EXT3["RTE Relay Systems"]:::external
        EXT4["Serial Connectivity (ser2net)"]:::external
        EXT5["PiKVM (Display/Keyboard Emulation)"]:::external
        EXT6["Pikvm-rest-api"]:::external
        EXT7["os-config"]:::external
    end

    %% Documentation Support File (standalone)
    DOCFILE["get_results_from_logs.py"]:::doc

    %% Connections between CI/CD and Test Runner
    CI2 -->|"test_execution_wrapper"| TR
    %% Test Runner invokes Test Modules
    TR -->|"invokes"| TM1
    TR -->|"invokes"| TM2
    TR -->|"invokes"| TM3
    TR -->|"invokes"| TM4
    TR -->|"invokes"| TM5

    %% Test Modules use Shared Libraries and Platform Configurations
    TM1 -->|"utilizes"| LIB1
    TM1 -->|"reads"| CPC
    TM2 -->|"utilizes"| LIB1
    TM2 -->|"reads"| CPC
    TM3 -->|"utilizes"| LIB1
    TM3 -->|"reads"| CPC
    TM4 -->|"utilizes"| LIB1
    TM4 -->|"reads"| CPC
    TM5 -->|"utilizes"| LIB1
    TM5 -->|"reads"| CPC

    %% External Interfaces: Bi-directional communication with Test Modules
    TM1 <-->|"control_feedback"| EXT1
    TM2 <-->|"control_feedback"| EXT2
    TM3 <-->|"control_feedback"| EXT3
    TM4 <-->|"control_feedback"| EXT4
    TM5 <-->|"control_feedback"| EXT5

    %% Shared Libraries Integration with External APIs
    LIB1 -->|"integrates_API"| EXT6
    LIB1 -->|"integrates_API"| EXT7

    %% Documentation flow triggered from CI/CD Automation Scripts
    CI2 -->|"triggers_docs"| CI3
    CI3 -->|"parses_logs_via"| DOCFILE

    %% Click Events for Component Mapping
    click TM1 "https://github.com/dasharo/open-source-firmware-validation/tree/main/dasharo-compatibility"
    click TM2 "https://github.com/dasharo/open-source-firmware-validation/tree/main/dasharo-security"
    click TM3 "https://github.com/dasharo/open-source-firmware-validation/tree/main/dasharo-performance"
    click TM4 "https://github.com/dasharo/open-source-firmware-validation/tree/main/dasharo-stability"
    click TM5 "https://github.com/dasharo/open-source-firmware-validation/tree/main/self-tests"

    click LIB1 "https://github.com/dasharo/open-source-firmware-validation/tree/main/lib"
    click LIB2 "https://github.com/dasharo/open-source-firmware-validation/tree/main/keys-and-keywords"

    click CPC "https://github.com/dasharo/open-source-firmware-validation/tree/main/platform-configs"

    click CI1 "https://github.com/dasharo/open-source-firmware-validation/tree/main/.github/workflows"
    click CI2 "https://github.com/dasharo/open-source-firmware-validation/tree/main/scripts"
    click CI3 "https://github.com/dasharo/open-source-firmware-validation/tree/main/docs"
    click DOCFILE "https://github.com/dasharo/open-source-firmware-validation/blob/main/get_results_from_logs.py"

    click EXT6 "https://github.com/dasharo/open-source-firmware-validation/tree/main/pikvm-rest-api"
    click EXT7 "https://github.com/dasharo/open-source-firmware-validation/tree/main/os-config"

    %% Styling Classes
    classDef test fill:#add8e6,stroke:#000,stroke-width:1px;
    classDef ci fill:#ffa500,stroke:#000,stroke-width:1px;
    classDef library fill:#90ee90,stroke:#000,stroke-width:1px;
    classDef config fill:#ffff99,stroke:#000,stroke-width:1px;
    classDef external fill:#ffb6c1,stroke:#000,stroke-width:1px;
    classDef doc fill:#dda0dd,stroke:#000,stroke-width:1px;
```
