# sonic-net/dash architecture

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

- Interactive diagram: https://gitdiagram.com/sonic-net/dash
- Repository: https://github.com/sonic-net/dash

## Overview

##### Main Components
- API and Object Model Layer: Representing the network APIs defined and implemented via SAI (located in the “dash-pipeline/SAI” directory) and the API generation tools.
- P4 and Data Plane Components: Capture the P4 programs in “dash-pipeline/bmv2” and related templates and utilities that define the behavior of the data plane through BMv2 and DPDK.
- Data Plane Application (dpapp): Represents the compiled and executable logic (located in “dash-pipeline/dpapp”) that interacts with API/SAI calls and may be responsible for bridging data plane operations.
- CI/CD & Build Infrastructure: Include the GitHub workflows (.github/workflows) that build Docker images (for BMv2, P4 compiler, dpapp, saithrift, etc.), execute spell checks, and run tests.
- Testing Framework: Encompass the “test” directory, which contains both functional test cases (PTF tests, saithrift based tests, scale tests) and testing environments.
- Documentation: Show the Documentation (in “documentation”) that supports design, requirements, and user guides.
- DevOps/Deployment Tools: Indicate container build scripts (Dockerfiles under “dash-pipeline/dockerfiles”) and Makefiles used for integration and deployment.

##### Relationships and Interactions
- Flow of data from the control API (SAI layer) to the underlying data plane (P4 programs in BMv2) and the role of dpapp in managing network traffic.
- Integration of testing suites with both unit and functional tests that validate the behavior of the SAI and P4 pipelines.
- External interaction points (for instance, the testing frameworks interfacing with the hardware or software simulation services and external contributions by community users).

##### Architectural Patterns and Technologies
- Separation of concerns across layers, with clear boundaries between API/SAI processing, data-plane P4 processing, and testing/CI systems.
- Use of infrastructure as code elements (Dockerfiles and Makefiles) that facilitate reproducible builds and containerized deployments.
- Recognize that this is a hybrid system that mixes high-performance, stateful network data processing (via programming frameworks such as P4 and PNA) with robust development practices (CI/CD pipelines, extensive testing, and documentation).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Control & API layer
    subgraph "Control & API"
        SAI["SAI API Layer"]:::api
    end

    %% Data Plane layer
    subgraph "Data Plane"
        BMv2["BMv2 P4 Programs"]:::dataplane
        Dpapp["dpapp (Data Plane Application)"]:::dataplane
    end

    %% CI/CD & Deployment layer
    subgraph "CI/CD & Deployment"
        CICD["CI/CD Pipelines"]:::cicd
        Dockerfiles["Dockerfiles"]:::devops
        Makefile["Makefile"]:::devops
    end

    %% Testing & Validation layer
    subgraph "Testing & Validation"
        TestDash["Tests (dash-pipeline/tests)"]:::testing
        TestGeneral["Tests (test)"]:::testing
    end

    %% Documentation layer
    subgraph "Documentation"
        Docs["Documentation"]:::docs
    end

    %% Relationships
    CICD -->|"builds"| Dockerfiles
    CICD -->|"builds"| Makefile
    Dockerfiles -->|"deploys to"| BMv2
    Dockerfiles -->|"deploys to"| Dpapp
    Makefile -->|"orchestrates"| Dpapp
    Makefile -->|"orchestrates"| BMv2

    SAI -->|"controls"| Dpapp
    SAI -->|"configures"| BMv2

    CICD -->|"triggers"| TestDash
    CICD -->|"triggers"| TestGeneral

    TestDash -->|"validates"| SAI
    TestDash -->|"validates"| Dpapp
    TestDash -->|"validates"| BMv2
    TestGeneral -->|"validates"| SAI
    TestGeneral -->|"validates"| Dpapp
    TestGeneral -->|"validates"| BMv2

    Docs ---|"guides"| CICD
    Docs ---|"informs"| SAI

    %% Click Events
    click SAI "https://github.com/sonic-net/dash/tree/main/dash-pipeline/SAI"
    click BMv2 "https://github.com/sonic-net/dash/tree/main/dash-pipeline/bmv2"
    click Dpapp "https://github.com/sonic-net/dash/tree/main/dash-pipeline/dpapp"
    click CICD "https://github.com/sonic-net/dash/tree/main/.github/workflows"
    click TestDash "https://github.com/sonic-net/dash/tree/main/dash-pipeline/tests"
    click TestGeneral "https://github.com/sonic-net/dash/tree/main/test"
    click Docs "https://github.com/sonic-net/dash/tree/main/documentation"
    click Dockerfiles "https://github.com/sonic-net/dash/tree/main/dash-pipeline/dockerfiles"
    click Makefile "https://github.com/sonic-net/dash/tree/main/dash-pipeline/Makefile"

    %% Styles
    classDef api fill:#9fd9d3,stroke:#333,stroke-width:2px;
    classDef dataplane fill:#a2c4c9,stroke:#333,stroke-width:2px;
    classDef cicd fill:#f9d090,stroke:#333,stroke-width:2px;
    classDef testing fill:#f7b2d0,stroke:#333,stroke-width:2px;
    classDef docs fill:#d8b4f9,stroke:#333,stroke-width:2px;
    classDef devops fill:#ffdfba,stroke:#333,stroke-width:2px;
```
