# aifakhri/network-test-automation-robotframework architecture

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

- Interactive diagram: https://gitdiagram.com/aifakhri/network-test-automation-robotframework
- Repository: https://github.com/aifakhri/network-test-automation-robotframework

## Overview

##### Project type and purpose
- This is a keyword‑driven Test Automation Framework built with Robotframework and Python, designed to validate BGP‑EVPN and VXLAN configurations on a virtual Arista vEOS CLOS topology.
- The top‑level entry point is “program_runner.py,” which dispatches Robotframework test suites against leaf and spine switch VMs.

##### File structure
- Top level:
- program_runner.py – CLI wrapper to select devices/tests.
- readme.md – project overview and usage.
- Libraries/ – Python modules that implement Robotframework keywords:
- commonLib.py
- bgpRouting.py
- bgpEvpn.py
- vxlanInstance.py
- Resources/
- Keywords/ – Robot .robot files that map test‐level keywords to the Python libraries.
- Variables/ – YAML device definitions (veosLeaf01.yaml, veosSpine02.yaml, etc.).
- Tests/ – Robot .robot test suites:
- test_bgp_evpn.robot
- test_bgp_routing.robot
- test_vxlan.robot

##### README for additional insights
- Describes a virtual vEOS CLOS topology.
- Instructs how to invoke the framework via program_runner.py with flags to target specific devices or groups.

##### Main components & relationships
a. User/CLI
– “program_runner.py” parses arguments (`-d leaf|spine|veosLeaf01`, etc.) and invokes
→ Robotframework engine
b. Robotframework engine
– Loads Test Suites from Tests/*.robot
– Loads Resource files:
- Keywords/*.robot (maps high‑level keywords to Python library methods)
- Variables/*.yaml (device IPs, credentials, topology roles)
– Loads Python Libraries from Libraries/*.py
c. Python Keyword Libraries
– Use network‑automation drivers (e.g., pyeapi, netmiko) to connect to vEOS devices
– Execute CLI or API commands to validate: BGP routing, EVPN state, VXLAN overlay
d. Network Devices (External Services)
– Virtual Arista vEOS switches arranged in a CLOS (leaf/spine) topology

##### Architectural patterns and design principles
- Keyword‑Driven Testing (Robotframework)
- Modular separation:
- Test logic (Tests/*.robot)
- Keyword definitions (Resources/Keywords/*.robot)
- Implementation (Libraries/*.py)
- Environment data (Resources/Variables/*.yaml)
- Single orchestration entry point (program_runner.py)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CLI and Documentation
    CLI["program_runner.py\n(CLI Entry Point)"]:::cli
    Doc["readme.md\n(Project Overview)"]:::doc
    CLI -->|"references"| Doc

    %% Core Engine
    CLI -->|"invokes"| Engine
    Engine["Robotframework Engine"]:::engine

    %% Tests Layer
    subgraph "Tests (Tests/*.robot)"
        EB["test_bgp_evpn.robot"]:::test
        RB["test_bgp_routing.robot"]:::test
        XB["test_vxlan.robot"]:::test
    end

    %% Resource Layer
    subgraph "Resources"
        subgraph "Keywords (Resources/Keywords/*.robot)"
            CK["common.robot"]:::keyword
            BRK["bgpRouting.robot"]:::keyword
            BE["bgpEvpn.robot"]:::keyword
            VXK["vxlan.robot"]:::keyword
        end
        subgraph "Variables (Resources/Variables/*.yaml)"
            VL1["veosLeaf01.yaml"]:::var
            VL2["veosLeaf02.yaml"]:::var
            VS1["veosSpine01.yaml"]:::var
            VS2["veosSpine02.yaml"]:::var
        end
    end

    %% Implementation Layer
    subgraph "Libraries (Libraries/*.py)"
        CL["commonLib.py"]:::lib
        BRL["bgpRouting.py"]:::lib
        BEL["bgpEvpn.py"]:::lib
        VL["vxlanInstance.py"]:::lib
    end

    %% External Devices
    subgraph "Arista vEOS Devices\n(leaf/spine VMs)"
        leaf1["veosLeaf01"]:::device
        leaf2["veosLeaf02"]:::device
        spine1["veosSpine01"]:::device
        spine2["veosSpine02"]:::device
    end

    %% Data Flows
    Engine -->|"loads tests"| EB
    Engine -->|"loads tests"| RB
    Engine -->|"loads tests"| XB

    Engine -->|"loads keywords"| CK
    Engine -->|"loads keywords"| BRK
    Engine -->|"loads keywords"| BE
    Engine -->|"loads keywords"| VXK

    Engine -->|"loads variables"| VL1
    Engine -->|"loads variables"| VL2
    Engine -->|"loads variables"| VS1
    Engine -->|"loads variables"| VS2

    Engine -->|"loads libraries"| CL
    Engine -->|"loads libraries"| BRL
    Engine -->|"loads libraries"| BEL
    Engine -->|"loads libraries"| VL

    EB -->|"calls keywords"| BE
    RB -->|"calls keywords"| BRK
    XB -->|"calls keywords"| VXK

    CK -->|"delegates to"| CL
    BRK -->|"delegates to"| BRL
    BE -->|"delegates to"| BEL
    VXK -->|"delegates to"| VL

    CL -->|"connects to"| leaf1
    CL -->|"connects to"| leaf2
    BRL -->|"connects to"| spine1
    BRL -->|"connects to"| spine2
    BEL -->|"connects to"| leaf1
    BEL -->|"connects to"| spine1
    VL -->|"connects to"| leaf2
    VL -->|"connects to"| spine2

    leaf1 -->|"returns state"| CL
    leaf2 -->|"returns state"| CL
    spine1 -->|"returns state"| BRL
    spine2 -->|"returns state"| BRL

    CL -->|"reports result"| Engine
    BRL -->|"reports result"| Engine
    BEL -->|"reports result"| Engine
    VL -->|"reports result"| Engine

    Engine -->|"outputs summary"| CLI

    %% Click Events
    click CLI "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/program_runner.py"
    click Doc "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/readme.md"
    click EB "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Tests/test_bgp_evpn.robot"
    click RB "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Tests/test_bgp_routing.robot"
    click XB "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Tests/test_vxlan.robot"
    click CK "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Resources/Keywords/common.robot"
    click BRK "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Resources/Keywords/bgpRouting.robot"
    click BE "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Resources/Keywords/bgpEvpn.robot"
    click VXK "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Resources/Keywords/vxlan.robot"
    click VL1 "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Resources/Variables/veosLeaf01.yaml"
    click VL2 "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Resources/Variables/veosLeaf02.yaml"
    click VS1 "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Resources/Variables/veosSpine01.yaml"
    click VS2 "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Resources/Variables/veosSpine02.yaml"
    click CL "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Libraries/commonLib.py"
    click BRL "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Libraries/bgpRouting.py"
    click BEL "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Libraries/bgpEvpn.py"
    click VL "https://github.com/aifakhri/network-test-automation-robotframework/blob/master/Libraries/vxlanInstance.py"

    %% Styles
    classDef cli fill:#f9f,stroke:#333,stroke-width:1px
    classDef doc fill:#ddd,stroke:#333,stroke-width:1px
    classDef engine fill:#ff9,stroke:#333,stroke-width:1px
    classDef test fill:#9f9,stroke:#333,stroke-width:1px
    classDef keyword fill:#9cf,stroke:#333,stroke-width:1px
    classDef var fill:#ccf,stroke:#333,stroke-width:1px
    classDef lib fill:#cfc,stroke:#333,stroke-width:1px
    classDef device fill:#fcf,stroke:#333,stroke-width:1px
```
