# redhat-performance/badfish architecture

> Architecture diagram of the GitHub repository redhat-performance/badfish, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/redhat-performance/badfish
- Repository: https://github.com/redhat-performance/badfish

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Core Components:
- Badfish CLI Interface
- Badfish Python Library
- Redfish API Client
- Configuration Management
- Authentication Handler

b) External Interfaces:
- iDRAC/BMC Systems (Dell, SuperMicro, HPE)
- Configuration Files
- Logging System

**┌─ User Interface Layer ─────────────────────┐**
- CLI Interface                            │
- Container Interface (Podman/Docker)      │
- Python Library Interface                 │
- ┬─┘

**┌─ Core Service Layer ──────────────────────┐**
- Command Processor                       │
- Configuration Manager                   │
- Authentication Handler                  │
- Async Task Manager                      │
- ┬┘

**┌─ Integration Layer ──────────────────────┐**
- Redfish API Client                     │
- Vendor-Specific Adapters              │
- Dell iDRAC Handler                  │
- SuperMicro Handler                  │
- HPE Handler                         │
- ┘

##### Component Relationships

- User interfaces → Command Processor (synchronous calls)
- Command Processor → Configuration Manager (config file parsing)
- Command Processor → Authentication Handler (credential management)
- Command Processor → Async Task Manager (job handling)
- Async Task Manager → Vendor-Specific Adapters (async operations)
- Vendor-Specific Adapters → External Systems (Redfish API calls)

##### Additional Elements

Supporting elements:
- Configuration file storage (YAML)
- Logging system
- Error handling flow
- Async operation queue
- Job management system

##### Specific Implementation Details

Key features:
- Boot order management
- Power state control
- Firmware management
- Virtual media handling
- BIOS configuration
- Server configuration profiles

##### Notes

Important notes:
- Async operations handling
- Vendor-specific functionality differences
- Configuration override hierarchy
- Authentication methods
- Error handling strategy

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef integration fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef config fill:#e74c3c,stroke:#c0392b,color:white
    classDef test fill:#9b59b6,stroke:#8e44ad,color:white

    %% User Interface Layer
    subgraph UI[User Interface Layer]
        CLI[CLI Interface]
        Container[Container Interface]
        PythonLib[Python Library Interface]
    end

    %% Core Service Layer
    subgraph Core[Core Service Layer]
        CmdProc[Command Processor]
        ConfigMgr[Configuration Manager]
        AuthHandler[Authentication Handler]
        AsyncMgr[Async Task Manager]
        Logger[Logging System]
    end

    %% Integration Layer
    subgraph Integration[Integration Layer]
        RedfishClient[Redfish API Client]
        subgraph Vendors[Vendor Handlers]
            DellHandler[Dell iDRAC Handler]
            SuperMicroHandler[SuperMicro Handler]
            HPEHandler[HPE Handler]
        end
    end

    %% External Systems
    subgraph External[External Systems]
        iDRAC[iDRAC Systems]
        BMC[BMC Systems]
        Config[Configuration Files]
    end

    %% Test Components
    subgraph Tests[Test Suite]
        BootTests[Boot Management Tests]
        PowerTests[Power Management Tests]
        BIOSTests[BIOS Configuration Tests]
        VirtualMediaTests[Virtual Media Tests]
        FirmwareTests[Firmware Tests]
        JobTests[Job Management Tests]
    end

    %% Relationships
    CLI --> CmdProc
    Container --> CmdProc
    PythonLib --> CmdProc
    CmdProc --> ConfigMgr
    CmdProc --> AuthHandler
    CmdProc --> AsyncMgr
    CmdProc --> Logger
    AsyncMgr --> RedfishClient
    RedfishClient --> DellHandler & SuperMicroHandler & HPEHandler
    DellHandler & SuperMicroHandler & HPEHandler --> iDRAC & BMC
    ConfigMgr --> Config

    %% Click Events
    click CLI "https://github.com/redhat-performance/badfish/blob/master/src/badfish/main.py"
    click Container "https://github.com/redhat-performance/badfish/tree/master/Dockerfile"
    click ConfigMgr "https://github.com/redhat-performance/badfish/blob/master/config/idrac_interfaces.yml"
    click AsyncMgr "https://github.com/redhat-performance/badfish/blob/master/src/badfish/helpers/async_lru.py"
    click Logger "https://github.com/redhat-performance/badfish/blob/master/src/badfish/helpers/logger.py"
    click PythonLib "https://github.com/redhat-performance/badfish/blob/master/src/badfish/__init__.py"
    click BootTests "https://github.com/redhat-performance/badfish/blob/master/tests/test_boot_to.py"
    click PowerTests "https://github.com/redhat-performance/badfish/blob/master/tests/test_power.py"
    click BIOSTests "https://github.com/redhat-performance/badfish/blob/master/tests/test_bios_attributes.py"
    click VirtualMediaTests "https://github.com/redhat-performance/badfish/blob/master/tests/test_virtual_media.py"
    click FirmwareTests "https://github.com/redhat-performance/badfish/blob/master/tests/test_firmware_inventory.py"
    click JobTests "https://github.com/redhat-performance/badfish/blob/master/tests/test_job_queue.py"

    %% Legend
    subgraph Legend
        UI_L[User Interface]:::ui
        Core_L[Core Services]:::core
        Int_L[Integration]:::integration
        Ext_L[External Systems]:::external
        Test_L[Test Components]:::test
        Conf_L[Configuration]:::config
    end
```
