Some checks failed
CI/CD / lint (pull_request) Failing after 10s
CI/CD / test (pull_request) Failing after 10s
CI/CD / typecheck (pull_request) Failing after 23s
CI/CD / build (pull_request) Has been skipped
CI/CD / publish-rpm (pull_request) Has been skipped
CI/CD / publish-deb (pull_request) Has been skipped
VyOS ships no unattended installer (install_image() is unconditionally interactive; --no-prompt is wired only to 'add'), so the automation is injected through live-config's hooks component: iPXE boots the live kernel with fetch= and live-config.hooks=, the hook fetches a generated per-MAC Python driver, and the driver builds config.boot, stages the rootfs, and drives the interactive installer over a pty. Bastion: - vyos-boot.ipxe template (no 'nonetworking' — breaks the hook fetch; no console=ttyS0 — 30s/systemd-phase on UART-less boards) - /vyos/autoinstall.sh + /vyos/install.py routes (per-MAC driver with the config spec baked in as base64) - vyos-config-spec: bond0 (802.3ad) + tagged VLANs + VRRP groups (vrid = VLAN id) + sync group + hw-id pinning by MAC + SSH keys; config built from the image's own config.boot.default via vyos.configtree, version footer reattached via component_version - prepareVyosArtifacts: extract kernel/initrd/squashfs from the nightly ISO with xorriso; initrd picked by size from regular files only; ISO URL "latest" resolves the newest vyos-nightly-build GH release (downloads.vyos.io no longer serves direct ISOs) Verified end-to-end in a libvirt VM against the real nightly ISO — installed system boots with bond/VRRP/hw-id config applied and no migrations. Fixes found by the VM run, encoded in code comments: config.boot.default lives at /usr/share/vyos at hook time; fetch= boot has no medium so the rootfs is symlinked to the installer's expected path; reboot must be --force (the hook is a child of the still-starting live-config unit); installer disk answers are full /dev paths; zram0 passes the 2GB min-disk filter so the disk is always pinned. CLI/labd: vyos spec threaded through provision install (--vyos-* and --vlan/--vlan-vip flags with guards), labd install route, protocol command-install, and the bastion's direct /api/install. 268 unit tests pass; no new lint errors in touched files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DMVzWZgiKW2wquf5z8S1yH
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
// Tests for VyOS install option parsing.
|
|
|
|
import { describe, it, expect } from "vitest";
|
|
import { parseVlan } from "../src/commands/install.js";
|
|
|
|
describe("parseVlan", () => {
|
|
it("parses id and CIDR", () => {
|
|
expect(parseVlan("10:10.0.10.1/24")).toEqual([{ id: 10, address: "10.0.10.1/24" }]);
|
|
});
|
|
|
|
it("accumulates across repeated flags", () => {
|
|
const first = parseVlan("10:10.0.10.1/24");
|
|
const both = parseVlan("20:10.0.20.1/24", first);
|
|
expect(both).toHaveLength(2);
|
|
expect(both[1]).toEqual({ id: 20, address: "10.0.20.1/24" });
|
|
});
|
|
|
|
it("keeps a description, including one containing colons", () => {
|
|
expect(parseVlan("30:10.0.30.1/24:mgmt:secondary")).toEqual([
|
|
{ id: 30, address: "10.0.30.1/24", description: "mgmt:secondary" },
|
|
]);
|
|
});
|
|
|
|
it("rejects an address that is not CIDR", () => {
|
|
// A bare address would produce a VyOS config that fails to commit on first
|
|
// boot, long after the operator has stopped watching.
|
|
expect(() => parseVlan("10:10.0.10.1")).toThrow(/CIDR/);
|
|
});
|
|
|
|
it("rejects out-of-range and non-numeric VLAN ids", () => {
|
|
expect(() => parseVlan("0:10.0.10.1/24")).toThrow(/1-4094/);
|
|
expect(() => parseVlan("4095:10.0.10.1/24")).toThrow(/1-4094/);
|
|
expect(() => parseVlan("abc:10.0.10.1/24")).toThrow(/1-4094/);
|
|
});
|
|
});
|