# yangmodels/yang architecture

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

- Interactive diagram: https://gitdiagram.com/yangmodels/yang
- Repository: https://github.com/yangmodels/yang

## Overview

##### Main components
- Repository (monorepo)
- Top-level directories:
– experimental/ (IETF, IEEE, ODP, other experimental modules)
– standard/ (IETF, IEEE, ETSI, BBF, MEF, IANA drafts/RFCs)
– vendor/ (Cisco, NetconfCentral, YumaWorks)
- Configuration and CI:
– .github/workflows/complete_check.yml
– .github/workflows/sdo_check.yml
– top-level scripts: testall.sh, check.sh (in each submodule)
- Submodules
- Standard bodies’ git submodules under standard/bbf, standard/mef, etc.
- Each brings its own directory hierarchy and check.sh
- Continuous Integration
- GitHub Actions
– Triggers on push/pull request
– Runs complete_check.yml which discovers check.sh in each major directory
– Invokes pyang to validate and produce schema trees
- External Services
- GitHub (repo hosting, PRs, issues)
- Slack (notifications, collaboration)
- pyang (YANG validator)

##### Relationships and interactions
- Contributor forks → clones → adds/updates modules → commits → opens a PR
- GitHub Actions picks up the PR
- complete_check.yml orchestrates:
- For each top-level area (experimental, standard, vendor): locate check.sh → run tests
- For submodules: navigate into subrepo, run its check.sh
- Results (pass/fail) reported back to GitHub PR

##### Architectural patterns and design principles
- Monorepo with logical grouping by domain/standard type
- Pluggable CI steps (each area supplies its own check.sh)
- Use of submodules to isolate third-party or standard‐body sources
- Convention-driven (directory names dictate license, CI entry points)
- Clear separation of concerns:
- Storage of YANG modules
- Validation pipelines
- Contribution workflow

##### Relevant technologies
- Git, Git submodules
- GitHub, GitHub Actions
- Shell scripts: check.sh, testall.sh
- pyang (YANG parser/validator)
- Markdown for documentation (README.md, READMEs in subdirs)

##### Detail and clarity
- Check.sh in each area as the CI entry point
- Testall.sh for local testing outside CI
- Where complete_check.yml references each check.sh
- Call out the convention: “each top-level area must supply its own check.sh for CI”

## Diagram (Mermaid)

```mermaid
flowchart TD
    direction TB

    contrib["Contributor"]:::external
    gh["GitHub (Repo Hosting)"]:::external
    actions["GitHub Actions (CI)"]:::ci
    slack["Slack Notifications"]:::external
    pyang["pyang (YANG Validator)"]:::tool

    subgraph "Monorepo (YangModels/yang)"
        direction TB
        subgraph "experimental/" 
            style experimental fill:#BBDEFB,stroke-dashed,stroke-width:1
            expIEEE["check.sh (IEEE)"]:::ci
            expODP["odp/"]:::submodule
            expOC["openconfig/"]:::submodule
            expIETFExtr["ietf-extracted-YANG-modules/"]:::submodule
        end
        subgraph "standard/"
            style standard fill:#BBDEFB,stroke-dashed,stroke-width:1
            stdIETF["check.sh (IETF)"]:::ci
            stdIANA["check.sh (IANA)"]:::ci
            stdIEEE["check.sh (IEEE)"]:::ci
            stdBBF["bbf/"]:::submodule
            stdMEF["mef/"]:::submodule
            stdETSI["etsi/"]:::submodule
        end
        subgraph "vendor/"
            style vendor fill:#BBDEFB,stroke-dashed,stroke-width:1
            vendorDir["vendor/"]:::code
        end
        talls["testall.sh"]:::ci
        gitmod[".gitmodules"]:::metadata
    end

    contrib-->|"forks/clones & opens PR"|gh
    gh-->|"on push/PR triggers"|actions
    actions-->|"invoke scripts"|talls
    actions-->talls
    actions-->expIEEE
    actions-->expODP
    actions-->expOC
    actions-->expIETFExtr
    actions-->stdIETF
    actions-->stdIANA
    actions-->stdIEEE
    actions-->stdBBF
    actions-->stdMEF
    actions-->stdETSI
    actions-->vendorDir
    expIEEE-->|"runs pyang"|pyang
    expODP-->|"runs pyang"|pyang
    expOC-->|"runs pyang"|pyang
    expIETFExtr-->|"runs pyang"|pyang
    stdIETF-->|"runs pyang"|pyang
    stdIANA-->|"runs pyang"|pyang
    stdIEEE-->|"runs pyang"|pyang
    stdBBF-->|"runs pyang"|pyang
    stdMEF-->|"runs pyang"|pyang
    stdETSI-->|"runs pyang"|pyang
    vendorDir-->|"runs pyang"|pyang
    pyang-->actions
    actions-->|"reports status"|gh
    actions-->|"notify"|slack

    click expIEEE "https://github.com/yangmodels/yang/blob/main/experimental/ieee/check.sh"
    click expODP "https://github.com/yangmodels/yang/tree/main/experimental/odp/"
    click expOC "https://github.com/yangmodels/yang/tree/main/experimental/openconfig/"
    click expIETFExtr "https://github.com/yangmodels/yang/tree/main/experimental/ietf-extracted-YANG-modules/"
    click stdIETF "https://github.com/yangmodels/yang/blob/main/standard/ietf/check.sh"
    click stdIANA "https://github.com/yangmodels/yang/blob/main/standard/iana/check.sh"
    click stdIEEE "https://github.com/yangmodels/yang/blob/main/standard/ieee/check.sh"
    click stdBBF "https://github.com/yangmodels/yang/tree/main/standard/bbf/"
    click stdMEF "https://github.com/yangmodels/yang/tree/main/standard/mef/"
    click stdETSI "https://github.com/yangmodels/yang/tree/main/standard/etsi/"
    click vendorDir "https://github.com/yangmodels/yang/tree/main/vendor/"
    click talls "https://github.com/yangmodels/yang/blob/main/./testall.sh"
    click gitmod "https://github.com/yangmodels/yang/blob/main/.gitmodules"

    classDef external fill:#FFE0B2,stroke:#FB8C00,color:#000
    classDef ci fill:#C8E6C9,stroke:#388E3C,color:#000
    classDef tool fill:#FFECB3,stroke:#FFA000,color:#000
    classDef submodule fill:#E1BEE7,stroke:#8E24AA,color:#000
    classDef metadata fill:#CFD8DC,stroke:#455A64,color:#000
    classDef code fill:#BBDEFB,stroke:#1976D2,color:#000
```
