From 2243618f01972303843293fa10635744a49384d6 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 24 Aug 2026 22:53:00 +0200 Subject: [PATCH] Draw a scenario, from the declaration and from the hypervisor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `mesh-lab diagram` renders a scenario as draw.io, from either source, through one layout — so a difference between what was asked for and what exists is a difference you can see. The shape says what a resource is and is fixed per kind. The badges say what is true about that particular one and come entirely from metadata: translation, forwardability, mapping expiry, refuses-inbound, container-or-VM, running. The interesting properties of a network are exactly the ones with no visual consequence — a translated address looks identical to an untranslated one. For the live picture to be a record rather than a restatement, raise now writes down what it applied: a segment's kind, ranges and MTU on the link; a gateway's translation, forwardability and expiry on the gateway; inbound: deny on the machine. Every behavioural tag is written AFTER the thing works, never at creation — a failed raise leaves wreckage standing on purpose, and a picture of that wreckage must not badge translation the router never got. The pairing earned itself immediately: drawn side by side, every virtual machine held no addresses. A container's interface carries the device's name and a VM names its own, so joining them by name silently dropped one whole class of machine. Fixed by joining on MAC. Also brings tests under the typecheck gate, which caught integration timeouts being passed as a 4th argument and therefore ignored entirely. --- README.md | 65 +++++- package.json | 2 +- src/cli.ts | 21 ++ src/diagram/drawio.ts | 367 ++++++++++++++++++++++++++++++ src/diagram/from-declaration.ts | 68 ++++++ src/diagram/from-live.ts | 115 ++++++++++ src/diagram/model.ts | 54 +++++ src/incus/client.ts | 17 +- src/lifecycle/firewall.ts | 6 +- src/lifecycle/raise.ts | 19 +- src/lifecycle/router.ts | 19 ++ test/diagram.test.ts | 149 ++++++++++++ test/integration/underlay.test.ts | 119 ++++++++-- tsconfig.test.json | 9 + 14 files changed, 993 insertions(+), 37 deletions(-) create mode 100644 src/diagram/drawio.ts create mode 100644 src/diagram/from-declaration.ts create mode 100644 src/diagram/from-live.ts create mode 100644 src/diagram/model.ts create mode 100644 test/diagram.test.ts create mode 100644 tsconfig.test.json diff --git a/README.md b/README.md index cebe26c..2bc160c 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ mesh-lab exec -- mesh-lab snapshot