diff --git a/.github/workflows/generate-uml.yml b/.github/workflows/generate-uml.yml deleted file mode 100644 index 6c3968f..0000000 --- a/.github/workflows/generate-uml.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Generate UML - -# Trigger whenever the domain model or the generator script itself changes. -# "workflow_dispatch" lets you re-run it manually from the GitHub UI. -on: - push: - paths: - - "src/netdiag/domain/models.py" - - "scripts/generate_uml.py" - workflow_dispatch: - -# The job needs write access so it can push the generated files back. -permissions: - contents: write - -jobs: - generate-uml: - runs-on: ubuntu-latest - - steps: - # ── 1. check out the repository ──────────────────────────────────────── - - uses: actions/checkout@v4 - - # ── 2. set up Python (stdlib only – no pip packages needed) ──────────── - - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - # ── 3. generate UML/UML.d2 from models.py ────────────────────────────── - - name: Generate D2 source - run: python scripts/generate_uml.py src/netdiag/domain/models.py UML/UML.d2 - - # ── 4. install the D2 CLI ─────────────────────────────────────────────── - # - # The official install script detects the platform and drops the binary - # into one of several locations depending on how the shell is invoked. - # We add all common candidates to GITHUB_PATH so the next step finds it - # regardless of where the script chose to install. - # - # Pin a specific version to keep renders reproducible. - # Bump this when you want to adopt a newer D2 release. - - name: Install D2 - env: - D2_VERSION: "0.7.1" - run: | - curl -fsSL \ - "https://github.com/terrastruct/d2/releases/download/v${D2_VERSION}/d2-v${D2_VERSION}-linux-amd64.tar.gz" \ - | tar -xz -C /tmp - sudo install -m 0755 \ - "/tmp/d2-v${D2_VERSION}-linux-amd64/bin/d2" \ - /usr/local/bin/d2 - d2 --version - - # ── 5. render SVG ─────────────────────────────────────────────────────── - - name: Render UML/UML.svg - run: d2 UML/UML.d2 UML/UML.svg - - # ── 6. commit generated files back to the repo ───────────────────────── - # - # stefanzweifel/git-auto-commit-action is a thin wrapper around - # "git add / git commit / git push". It silently skips the commit when - # nothing has changed, so re-running the workflow is always safe. - # - # The "[skip ci]" suffix prevents this commit from re-triggering CI - # (GitHub Actions honors this convention natively). - - name: Commit generated UML files - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: "chore: auto-generate UML diagrams [skip ci]" - file_pattern: "UML/UML.d2 UML/UML.svg" diff --git a/UML/UML.d2 b/UML/UML.d2 deleted file mode 100644 index a62add3..0000000 --- a/UML/UML.d2 +++ /dev/null @@ -1,113 +0,0 @@ -direction: down - -Interface: { - shape: class - - name: str - itype: "[str]" - adapter: "[str]" - slave_interfaces: "[List[str]]" - parent_interface: "[str]" - ip_address: "[str]" - network: "[str]" - subnet_mask: "[str]" - default_gateway: "[str]" - vlan: "[str]" - device: Device - - "__init__(name, ...)" - "__repr__(): str" -} - -Device: { - shape: class - - name: str - role: str - interfaces: "Dict[str, Interface]" - - "__init__(name: str)" - "add_interface(interface: Interface)" - "rm_interface(interface: Interface)" - "__repr__(): str" -} - -Host: { - shape: class - - role: str -} - -Router: { - shape: class - - role: str -} - -Switch: { - shape: class - - role: str -} - -Network: { - shape: class - - name: str - interfaces: "List[Interface]" - network_ip: "[str]" - - "__init__(name: str, [vlan: [str]], [network_ip: [str]])" - "add_interface(interface: Interface)" - "rm_interface(interface: Interface)" - "__repr__(): str" -} - -Topology: { - shape: class - - devices: "Dict[str, Device]" - networks: "Dict[str, Network]" - - "__init__()" - "add_device(device: Device)" - "rm_device(device: Device)" - "add_network(network: Network)" - "rm_network(network: Network)" - "__repr__(): str" -} - -Host -> Device: { - target-arrowhead.shape: triangle - target-arrowhead.style.filled: false -} - -Router -> Device: { - target-arrowhead.shape: triangle - target-arrowhead.style.filled: false -} - -Switch -> Device: { - target-arrowhead.shape: triangle - target-arrowhead.style.filled: false -} - -Device -- Interface: interfaces { - source-arrowhead: 1..* - target-arrowhead: 1 -} - -Network -- Interface: interfaces { - source-arrowhead: 1..* - target-arrowhead: 1 -} - -Topology -- Device: devices { - source-arrowhead: 1..* - target-arrowhead: 1 -} - -Topology -- Network: networks { - source-arrowhead: 1..* - target-arrowhead: 1 -} diff --git a/UML/UML.svg b/UML/UML.svg deleted file mode 100644 index 6979430..0000000 --- a/UML/UML.svg +++ /dev/null @@ -1,105 +0,0 @@ -Interface+namestr+itype[str]+adapter[str]+slave_interfaces[List[str]]+parent_interface[str]+ip_address[str]+network[str]+subnet_mask[str]+default_gateway[str]+vlan[str]+deviceDevice+__init__(name, ...)void+__repr__(): strvoidDevice+namestr+rolestr+interfacesDict[str, Interface]+__init__(name: str)void+add_interface(interface: Interface)void+rm_interface(interface: Interface)void+__repr__(): strvoidHost+rolestrRouter+rolestrSwitch+rolestrNetwork+namestr+interfacesList[Interface]+network_ip[str]+__init__(name: str, [vlan: [str]], [network_ip: [str]])void+add_interface(interface: Interface)void+rm_interface(interface: Interface)void+__repr__(): strvoidTopology+devicesDict[str, Device]+networksDict[str, Network]+__init__()void+add_device(device: Device)void+rm_device(device: Device)void+add_network(network: Network)void+rm_network(network: Network)void+__repr__(): strvoid interfaces1..*1interfaces1..*1devices1..*1networks1..*1 - - - - - - diff --git a/readme.md b/readme.md index b5b5eea..42620be 100644 --- a/readme.md +++ b/readme.md @@ -38,6 +38,3 @@ pip install -e . После этого средство можно запускать из установленного пакета или через Python-модули проекта. -## UML-модель - -![](UML/UML.svg?raw=true)