diff --git a/deploy/containerlab/README.md b/deploy/containerlab/README.md index 0931bc7f..9a38ae39 100644 --- a/deploy/containerlab/README.md +++ b/deploy/containerlab/README.md @@ -697,7 +697,7 @@ its addresses. The script works for any Kind node of the topology. The [VLAN transport contract](../../docs/designs/vlan-transport/contract.md) needs each side of an edge node to run tagged (802.1Q) or untagged. The topology above builds untagged bonds only. `scripts/vlan-transport.sh` re-plumbs sjc at run time, without changing a manifest. It changes the public side (sjc-worker2 `bond0` to tr2 `bond1`) and the fabric side (sjc-worker2 `bond1` to sjc-worker `bond0`). - `resources/vlan-transport/cells.env` defines cells C1 to C6 of the [acceptance matrix](../../docs/designs/vlan-transport/acceptance.md), plus C1AB and C4AB on active-backup bonds. `PUB_VID` and `FAB_VID` override a cell's IDs, `PUB_PARENT` and `FAB_PARENT` its parent per side (`bond`, `nic` or `shared`), and `BOND_MODE` its bond mode. A later `apply` changes only the side whose ID or parent differs. -- C5 needs one parent that reaches both tr2 and sjc-worker, which point-to-point links cannot give. `scripts/vlan-transport-switch.sh` adds a bridge node, `clab-gvpc-vtsw`, with four new veths. The edge's new bond `bondsw` trunks both VLANs to the bridge, which passes the public VLAN to tr2 and the fabric VLAN to sjc-worker. `apply C5` builds it and `revert` removes it. Creating the veths needs passwordless `sudo` for `containerlab tools veth create`, as `restart-node.sh` does. +- C5 needs one parent that reaches both tr2 and sjc-worker, which point-to-point links cannot give. `scripts/vlan-transport-switch.sh` adds a bridge node, `clab-gvpc-vtsw`, on the transit routers' image, with four new veths. The edge's new bond `bondsw` trunks both VLANs to the bridge, which passes the public VLAN to tr2 and the fabric VLAN to sjc-worker. `apply C5` builds it and `revert` removes it. Creating the veths needs passwordless `sudo` for `containerlab tools veth create`, as `restart-node.sh` does. - `apply` creates the VLAN netdevices on both ends of each tagged side and moves the link's addresses onto them: with `ip` on the Kind nodes and in vtysh's running configuration on tr2. It then points `galactic-gateway`, `galactic-nat` and `galactic-cni` at the new interfaces with `kubectl set env`. `SELECT=logical` names the VLAN netdevice, as the contract requires. `SELECT=parent` names the parent instead. - sjc's single `galactic-cni` DaemonSet needs a different interface on each node once a side is tagged. By default `apply` gives sjc-worker2 its own copy, `galactic-cni-vt-edge`, and excludes that node from the original. `CNI_SELECT=by-node` instead sets `GALACTIC_CNI_EBPF_INTERFACES_BY_NODE` on the one DaemonSet, which needs a `galactic-cni` that reads it ([#1539](https://github.com/datum-cloud/galactic/pull/1539), for [#1404](https://github.com/datum-cloud/galactic/issues/1404)). - `apply` saves the deployed settings on sjc-worker2 in `/galactic/vlan-transport.state`. `revert` uses it to restore C1. `offload on|off` toggles VLAN offloads on every transport member. `csum on|off` toggles their transmit checksum offload: a veth sender with it on hands a natively redirected frame on with a partial checksum, which the far end counts as a checksum error. @@ -728,7 +728,8 @@ task report:vlan-transport OUT=/tmp/vt # re-render the rep - `CELL` takes cell names, or `all`: C1 to C6, C4ALT (C4 with the IDs in `ALT_PUB_VID` and `ALT_FAB_VID`, default 1234 and 3456), C1AB and C4AB. Untagged cells run first, since each tagged cell's throughput, latency and recovery are compared with C1 (C1AB for C4AB) in the same XDP mode and offload state. - `ROWS` takes row IDs, ranges such as `V01-V08`, or `all`. `XM` checks every XDP hook's mode, `NAA` reproduces the `verify:nat-active-active` finding from #1401 once, and `POST` runs sjc's untagged checks after the final revert. - `XDP_MODES` (default `native generic`), `OFFLOADS` (default `on off`), `SELECT`, `CSUM` (default `off`) and `CNI_SELECT` set the run's configuration. `BASELINE` names a pre-change run's output for V20. -- V17 to V28 test configuration and lifecycle, so they run once per cell and XDP mode, in the first offload state. +- V10 and V17 to V28 run once per cell and XDP mode, in the first offload state: they test configuration and lifecycle, or run on dfw-worker3, which the offload toggle leaves alone. V18's invalid configurations run in C1 and C4 only (`V18_CELLS`). +- Recovery probes start 10 s before each event and stop 10 s after it returns. The Kind nodes have no `ping`, so probes from them run the netshoot image `galactic-debug` builds on, in the node's network namespace. `OUT` holds `report.md` (pinned revisions, configuration, expected against observed for every check, skips, captures and counters, commands), `results.tsv`, and a directory per cell, mode and offload state with each step's output and captures. A check is PASS, FAIL, SKIP (did not run, with the reason), BASELINE (an untagged measurement), N/A (excluded by the contract for that cell) or PLANNED (dry run). A skip is never a pass: the task exits 1 when a check failed and 3 when none failed but some were skipped. An interrupted live run still reverts sjc to C1, restores the XDP mode and writes the report. diff --git a/deploy/containerlab/scripts/lib.sh b/deploy/containerlab/scripts/lib.sh index 9e3fcbe2..09bac988 100755 --- a/deploy/containerlab/scripts/lib.sh +++ b/deploy/containerlab/scripts/lib.sh @@ -99,9 +99,9 @@ apply_xdp_mode() { -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -E '^galactic-(nat|gateway-.+)$') for ds in "${daemonsets[@]}"; do if [ -z "${mode}" ] || [ "${mode}" = auto ]; then - docker exec "${node}" kubectl -n galactic-system set env "daemonset/${ds}" -c 'galactic-*' GALACTIC_XDP_MODE- + kube_retry docker exec "${node}" kubectl -n galactic-system set env "daemonset/${ds}" -c 'galactic-*' GALACTIC_XDP_MODE- else - docker exec "${node}" kubectl -n galactic-system set env "daemonset/${ds}" -c 'galactic-*' \ + kube_retry docker exec "${node}" kubectl -n galactic-system set env "daemonset/${ds}" -c 'galactic-*' \ "GALACTIC_XDP_MODE=${mode}" fi done @@ -191,5 +191,48 @@ pick_port() { [ -n "${PORTS_USED[${p}]:-}" ] || break done PORTS_USED[${p}]=1 + # shellcheck disable=SC2034 # read by the scripts that source this file PORT_PICKED=${p} } + +# PROBE_IMAGE: the netshoot release galactic-debug builds on. The Kind node +# image has no ping, so node_ping runs one from it in the node's network +# namespace. +PROBE_IMAGE=${PROBE_IMAGE:-nicolaka/netshoot:v0.16@sha256:b09d9b21381f47a79b3cbcb30da25266dc17186ea00ae65e99fdc51396f48e70} + +# node_ping NODE [NAME] -- PING_ARGS...: ping from NODE's network namespace. +# Transit routers (clab-*) have busybox ping; Kind nodes borrow PROBE_IMAGE's, +# in a container named NAME when given, so a caller can stop it with +# `docker kill -s INT NAME`. +node_ping() { + local node="$1" name="" + shift + if [ "$1" != -- ]; then name="$1"; shift; fi + shift + case "${node}" in + clab-*) docker exec "${node}" ping "$@" ;; + *) docker run --rm ${name:+--name "${name}"} --network "container:${node}" "${PROBE_IMAGE}" ping "$@" ;; + esac +} + +# kube_retry CMD...: run a kubectl command, retrying up to five times in all +# while it fails with "etcdserver: request timed out", which a loaded host +# produces during rollouts. Any other failure returns at once. Its stdout +# and stderr pass through unchanged and apart, from the last attempt. +kube_retry() { + local i rc out err + out=$(mktemp) err=$(mktemp) + for i in 1 2 3 4 5; do + "$@" >"${out}" 2>"${err}" + rc=$? + if [ "${rc}" -eq 0 ] || ! grep -q 'etcdserver: request timed out' "${err}"; then + break + fi + echo "kube_retry: etcd timed out (attempt ${i} of 5): $*" >&2 + sleep 5 + done + cat "${out}" + cat "${err}" >&2 + rm -f "${out}" "${err}" + return "${rc}" +} diff --git a/deploy/containerlab/scripts/verify-vlan-transport.sh b/deploy/containerlab/scripts/verify-vlan-transport.sh index c536eaab..bf03c4f4 100755 --- a/deploy/containerlab/scripts/verify-vlan-transport.sh +++ b/deploy/containerlab/scripts/verify-vlan-transport.sh @@ -18,8 +18,10 @@ # --rows all (default) is XM NAA V01-V28 POST. XM checks the XDP # attach mode, NAA reproduces the verify:nat-active-active # finding once, POST runs sjc's untagged checks after revert. -# V17 to V28 run once per cell and XDP mode, in the first -# offload state: they test configuration and lifecycle. +# V10 and V17 to V28 run once per cell and XDP mode, in the +# first offload state: they test configuration and lifecycle, +# or run on dfw-worker3, which the offload toggle leaves alone. +# V18 runs in the cells in V18_CELLS (default "C1 C4"). # --xdp-modes host XDP modes, set with `task lab:xdp-mode` (generic, # native or auto); default "native generic". # --offloads VLAN receive and transmit offload states; default "on off". @@ -28,7 +30,14 @@ # --cni-select how galactic-cni gets per-node interfaces (vlan-transport.sh # CNI_SELECT); by-node needs GALACTIC_CNI_EBPF_INTERFACES_BY_NODE. # --baseline a pre-change run's output directory, for V20. +# BASE_TOP (environment) an earlier run's output directory holding the +# untagged baselines, so a rerun of a tagged cell's V09 or +# V21 to V28 compares against them. # --out output directory; default /tmp/vlan-transport-. +# ADMIT_WAIT (environment) seconds V15 waits for Cilium to admit its +# third VLAN before measuring; default 60. +# --skip-cell CELL=REASON, repeatable: record every row of CELL as SKIP +# with REASON instead of running it, for a missing prerequisite. # # --dry-run prints every step and writes the report skeleton without touching # the lab: no docker, kubectl or task call runs. Everything else needs the @@ -56,6 +65,7 @@ ALT_FAB_VID=${ALT_FAB_VID:-3456} DRY_RUN=0 CELLS=all ROWS=all XMODES="native generic" OFFLOADS="on off" SELECT=logical CSUM=off CNI_SELECT=${CNI_SELECT:-copy} PRE_CHANGE="" TOP="" +declare -A SKIP_CELL=() while [ "$#" -gt 0 ]; do case "$1" in --dry-run) DRY_RUN=1 ;; @@ -68,7 +78,8 @@ while [ "$#" -gt 0 ]; do --cni-select) CNI_SELECT="$2"; shift ;; --baseline) PRE_CHANGE="$2"; shift ;; --out) TOP="$2"; shift ;; - -h | --help) sed -n '2,46p' "$0"; exit 0 ;; + --skip-cell) SKIP_CELL[${2%%=*}]="${2#*=}"; shift ;; + -h | --help) sed -n '2,48p' "$0"; exit 0 ;; *) echo "verify-vlan-transport: unknown argument $1" >&2; exit 2 ;; esac shift @@ -80,6 +91,9 @@ die() { echo "verify-vlan-transport: $*" >&2; exit 2; } case "${SELECT}" in logical | parent) ;; *) die "--select must be logical or parent" ;; esac case "${CSUM}" in on | off) ;; *) die "--csum must be on or off" ;; esac case "${CNI_SELECT}" in copy | by-node) ;; *) die "--cni-select must be copy or by-node" ;; esac +# Every apply, including the ones rows and recovery events make, selects +# galactic-cni's interfaces the same way. +export CNI_SELECT for m in ${XMODES}; do case "${m}" in native | generic | auto) ;; *) die "unknown XDP mode ${m}" ;; esac; done for o in ${OFFLOADS}; do case "${o}" in on | off) ;; *) die "unknown offload state ${o}" ;; esac; done @@ -119,6 +133,8 @@ RESULTS="${TOP}/results.tsv" printf 'run\tcell\txdp\toffload\trow\tcase\tstatus\texpected\tobserved\tevidence\tcommands\n' >"${RESULTS}" exec > >(tee -a "${TOP}/$([ "${DRY_RUN}" = 1 ] && echo plan || echo run).log") 2>&1 +# shellcheck source=lib.sh +source "${SCRIPT_DIR}/lib.sh" # shellcheck source=vlan-transport-rows.sh source "${SCRIPT_DIR}/vlan-transport-rows.sh" @@ -141,9 +157,12 @@ meta csum "${CSUM}" meta cni_select "${CNI_SELECT}" meta alt_ids "${ALT_PUB_VID}/${ALT_FAB_VID}" meta third_vid "${THIRD_VID}" +meta admit_wait "${ADMIT_WAIT:-60}" meta lab "${LAB}" meta pre_change "${PRE_CHANGE:-none}" meta host_kernel "$(uname -r)" +meta uptime_deploy "${DEPLOY_UPTIME:-not recorded}" +meta uptime_start "$(uptime)" if [ "${DRY_RUN}" = 1 ]; then meta images "not collected (dry run)" else @@ -203,12 +222,15 @@ run_rows() { any_wanted V11 V12 V13 && row_V11 row_wanted V15 && row_V15 row_wanted V09 && row_V09 - row_wanted V10 && row_V10 row_wanted V14 && row_V14 row_wanted V16 && row_V16 [ "${first}" = 1 ] || return 0 + # V10 runs on dfw-worker3, which the sjc offload toggle does not touch. + row_wanted V10 && row_V10 row_wanted V17 && row_V17 - row_wanted V18 && row_V18 + # V18's invalid configurations do not depend on the cell: C1 and C4 cover + # an untagged and a tagged parent (V18_CELLS). + row_wanted V18 && [[ " ${V18_CELLS:-C1 C4} " == *" ${CELL} "* ]] && row_V18 row_wanted V19 && row_V19 row_wanted V20 && row_V20 any_wanted V21 V22 V23 V24 V25 V26 V27 V28 && row_V21 @@ -259,7 +281,16 @@ for XMODE in ${XMODES}; do OUT="${TOP}/${CELL}-${XMODE}" mkdir -p "${OUT}" RUN_ID="${CELL}-${XMODE}" + if [ -n "${SKIP_CELL[${CELL}]:-}" ]; then + OFFLOAD=- + for r in ${WANT}; do + [ "${r}" = NAA ] || [ "${r}" = POST ] || [ "${r}" = XM ] || skip "${r}" "" "${SKIP_CELL[${CELL}]}" + done + continue + fi row_start APPLY "apply ${CELL}" + echo " host load at ${CELL} start: $(uptime)" + [ "${DRY_RUN}" = 1 ] || uptime >"${OUT}/uptime.txt" if ! x env LAB="${LAB}" "${VT_ENV[@]}" CNI_SELECT="${CNI_SELECT}" EXTRA_VIDS="${THIRD_VID}" "${VT}" apply "${BASE_CELL}" "${SELECT}"; then record APPLY "" FAIL "vlan-transport.sh apply ${BASE_CELL} failed; no row ran in this cell" continue @@ -268,9 +299,10 @@ for XMODE in ${XMODES}; do for OFFLOAD in ${OFFLOADS}; do RUN_ID="${CELL}-${XMODE}-offload-${OFFLOAD}" OUT="${TOP}/${RUN_ID}" - BASE_DIR="${TOP}/${BASE_REF}-${XMODE}-offload-${OFFLOAD}" + BASE_DIR="${BASE_TOP:-${TOP}}/${BASE_REF}-${XMODE}-offload-${OFFLOAD}" mkdir -p "${OUT}" echo "== ${RUN_ID}" + [ "${DRY_RUN}" = 1 ] || uptime >"${OUT}/uptime.txt" row_start SETUP "offloads and snapshot" if ! x env LAB="${LAB}" "${VT}" offload "${OFFLOAD}" || ! x env LAB="${LAB}" "${VT}" csum "${CSUM}"; then record SETUP "" FAIL "setting VLAN offload ${OFFLOAD} or checksum offload ${CSUM} failed; no row ran in this state" diff --git a/deploy/containerlab/scripts/vlan-transport-baseline.sh b/deploy/containerlab/scripts/vlan-transport-baseline.sh index 2f4022ce..3cc45e81 100755 --- a/deploy/containerlab/scripts/vlan-transport-baseline.sh +++ b/deploy/containerlab/scripts/vlan-transport-baseline.sh @@ -31,6 +31,8 @@ result() { echo "RESULT ${CELL}/${SELECT} $1: $2" | tee -a "${OUT}/results.txt"; # metrics, metric_delta and the counter snapshots are shared with # verify-vlan-transport.sh, which runs these rows as part of the full matrix. +# shellcheck source=lib.sh +source "${SCRIPT_DIR}/lib.sh" # shellcheck source=vlan-transport-rows.sh source "${SCRIPT_DIR}/vlan-transport-rows.sh" diff --git a/deploy/containerlab/scripts/vlan-transport-interrupt.sh b/deploy/containerlab/scripts/vlan-transport-interrupt.sh index fd875f83..d0a31f01 100755 --- a/deploy/containerlab/scripts/vlan-transport-interrupt.sh +++ b/deploy/containerlab/scripts/vlan-transport-interrupt.sh @@ -8,10 +8,13 @@ # tenant sjc's ns20 pod pings the off-fabric host through sjc's NAT shard, # crossing both sides # -# Each probe's interruption is its longest run of missing replies times -# 20 ms. Results go to OUT/interrupt.tsv as "name probe replies sent gap_ms -# event", where name is the event's position and spelling (01-restart_all), -# and the old netdevice check to OUT/.stale. +# Probes start DELAY seconds (default 10) before the event and stop SETTLE +# seconds (default 10) after it returns. Each probe's interruption is its +# longest run of missing replies times 20 ms, leaving out the last five +# probes, still in flight when the probe stopped. Results go to +# OUT/interrupt.tsv as "name probe replies sent gap_ms event", where name is +# the event's position and spelling (01-restart_all), and the old netdevice +# check to OUT/.stale. # # Events: # restart:COMPONENT roll galactic-nat, galactic-gateway (the edge's own @@ -51,12 +54,14 @@ TARGET=2001:db8:1:40::2 PUB_ADDR=2001:db8:1:21::2 FAB_ADDR=2001:db8:1:20::1 INTERVAL=0.02 -COUNT=${PROBE_COUNT:-9000} # 180 s at 20 ms, enough for an apply or revert to finish +COUNT=${PROBE_COUNT:-30000} # at most 600 s at 20 ms; probes stop SETTLE s after the event DELAY=${EVENT_DELAY:-10} +SETTLE=${EVENT_SETTLE:-10} +STOP_GRACE=${PROBE_STOP_GRACE:-15} MEMBER_HOLD=${MEMBER_HOLD:-10} mkdir -p "${OUT}" -kc() { docker exec "${CP}" kubectl -n "${NS}" "$@"; } +kc() { kube_retry docker exec "${CP}" kubectl -n "${NS}" "$@"; } field() { docker exec "${EDGE}" sh -c "grep '^$1=' /galactic/vlan-transport.state 2>/dev/null | cut -d= -f2-"; } # side_dev SIDE prints the edge's logical interface on SIDE now. @@ -182,12 +187,18 @@ stale() { } gap() { # FILE PROBE NAME EVENT - python3 -I - "$1" "${COUNT}" "$2" "$3" "$4" <<'EOF' + python3 -I - "$1" "$2" "$3" "$4" <<'EOF' import re, sys -path, count, probe, name, event = sys.argv[1], int(sys.argv[2]), sys.argv[3], sys.argv[4], sys.argv[5] -seen = set(int(m.group(1)) for m in re.finditer(r"icmp_seq=(\d+)", open(path).read())) +path, probe, name, event = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4] +text = open(path).read() +seqs = [int(m.group(1)) for m in re.finditer(r"(?:icmp_)?seq=(\d+)", text)] +seen = set(seqs) +m = re.search(r"(\d+) packets transmitted", text) +count = int(m.group(1)) if m else (max(seqs) if seqs else 0) +# busybox ping counts from 0, iputils from 1. +first = 0 if 0 in seen else 1 gap = run = 0 -for s in range(1, count + 1): +for s in range(first, first + max(count - 5, 0)): run = 0 if s in seen else run + 1 gap = max(gap, run) print("%s\t%s\t%d\t%d\t%d\t%s" % (name, probe, len(seen), count, gap * 20, event)) @@ -200,9 +211,10 @@ probe() { local name="$1" event="$2" pod before pod=$(pod_name "${CP}" ns20) local -a pids=() - docker exec "${TR}" ping -6 -n -i "${INTERVAL}" -c "${COUNT}" -W 1 "${PUB_ADDR}" >"${OUT}/${name}.public.ping" 2>&1 & + node_ping "${TR}" -- -6 -n -i "${INTERVAL}" -c "${COUNT}" -W 1 "${PUB_ADDR}" >"${OUT}/${name}.public.ping" 2>&1 & pids+=($!) - docker exec "${COMPUTE}" ping -6 -n -i "${INTERVAL}" -c "${COUNT}" -W 1 "${FAB_ADDR}" >"${OUT}/${name}.fabric.ping" 2>&1 & + docker rm -f vt-probe-fabric >/dev/null 2>&1 + node_ping "${COMPUTE}" vt-probe-fabric -- -6 -n -i "${INTERVAL}" -c "${COUNT}" -W 1 "${FAB_ADDR}" >"${OUT}/${name}.fabric.ping" 2>&1 & pids+=($!) docker exec "${CP}" kubectl -n ns20 exec "${pod}" -- \ ping -6 -n -i "${INTERVAL}" -c "${COUNT}" -W 1 "${TARGET}" >"${OUT}/${name}.tenant.ping" 2>&1 & @@ -211,8 +223,35 @@ probe() { before=$(links_now) echo "event ${name} at $(date -u +%T.%N | cut -c1-12): ${event}" run_event "${event}" >"${OUT}/${name}.event" 2>&1 - echo "event ${name} exit $?" >>"${OUT}/${name}.event" - wait "${pids[@]}" + echo "event ${name} exit $? at $(date -u +%T.%N | cut -c1-12)" >>"${OUT}/${name}.event" + sleep "${SETTLE}" + docker exec "${TR}" pkill -INT -f "ping -6 -n -i ${INTERVAL} -c ${COUNT}" || true + docker kill -s INT vt-probe-fabric >/dev/null 2>&1 || true + docker exec "${CP}" kubectl -n ns20 exec "${pod}" -- pkill -INT -f "ping -6 -n -i ${INTERVAL}" || true + # An image without pkill leaves the probes running to their count, so give + # them a short grace, then stop each ping where it runs: the fabric + # probe's container, and by pidof on tr2 and in the tenant pod. Each + # background job is a subshell running a docker client, so end the client + # with its subshell rather than orphan it. + local deadline=$((SECONDS + STOP_GRACE)) pid alive=0 + for pid in "${pids[@]}"; do + while kill -0 "${pid}" 2>/dev/null && [ "${SECONDS}" -lt "${deadline}" ]; do + sleep 0.5 + done + kill -0 "${pid}" 2>/dev/null && alive=1 + done + if [ "${alive}" = 1 ]; then + echo "probe ${name}: a probe outlived its stop; ending it at its source" + docker rm -f vt-probe-fabric >/dev/null 2>&1 || true + docker exec "${TR}" sh -c 'kill -INT $(pidof ping) 2>/dev/null' || true + docker exec "${CP}" kubectl -n ns20 exec "${pod}" -- sh -c 'kill -INT $(pidof ping) 2>/dev/null' || true + sleep 2 + for pid in "${pids[@]}"; do + pkill -P "${pid}" 2>/dev/null || true + kill "${pid}" 2>/dev/null || true + done + fi + wait "${pids[@]}" || true local p for p in public fabric tenant; do gap "${OUT}/${name}.${p}.ping" "${p}" "${name}" "${event}" | tee -a "${OUT}/interrupt.tsv" diff --git a/deploy/containerlab/scripts/vlan-transport-report.sh b/deploy/containerlab/scripts/vlan-transport-report.sh index 0ed7dee9..5b0ae6b7 100755 --- a/deploy/containerlab/scripts/vlan-transport-report.sh +++ b/deploy/containerlab/scripts/vlan-transport-report.sh @@ -38,7 +38,7 @@ if dry: w("> [!NOTE]") w("> Dry run. Every step below was printed, not executed. Nothing was observed, so no row has passed.") w("") -w("Rows and pass conditions: `docs/designs/vlan-transport/acceptance.md`. A row passes only with status PASS and its evidence. SKIP, FAIL and PLANNED are gaps; a skip is never a pass. BASELINE rows are the untagged measurements other cells are compared with, not acceptance. N/A rows are cases the contract excludes for that cell.") +w("Rows and pass conditions: `docs/designs/vlan-transport/acceptance.md`. A row passes only with status PASS and its evidence. SKIP, FAIL and PLANNED are gaps; a skip is never a pass. BASELINE rows are the untagged measurements other cells are compared with, not acceptance. N/A rows are cases the contract excludes for that cell. FLAKE rows failed once in a way an open lab bug explains, and passed on their one rerun; the observed column names the bug. The harness never sets FLAKE itself: the operator reruns a failed row once and marks it after reading both results.") w("") w("## Pinned revisions") w("") @@ -46,7 +46,8 @@ w("| Item | Value |") w("| --- | --- |") for k, label in [("commit", "Code commit"), ("describe", "git describe"), ("branch", "Branch"), ("worktree", "Worktree"), ("images", "Image digests"), ("host_kernel", "Host kernel"), - ("containerlab", "containerlab"), ("docker", "Docker")]: + ("containerlab", "containerlab"), ("docker", "Docker"), + ("uptime_deploy", "Host load at deploy"), ("uptime_start", "Host load at run start")]: if k in meta: w("| %s | `%s` |" % (label, cell(meta[k]))) w("") @@ -70,14 +71,14 @@ w("## Summary") w("") w("| Status | Checks |") w("| --- | --- |") -for s in ["PASS", "FAIL", "SKIP", "BASELINE", "N/A", "PLANNED"]: +for s in ["PASS", "FAIL", "FLAKE", "SKIP", "BASELINE", "N/A", "PLANNED"]: w("| %s | %d |" % (s, counts.get(s, 0))) w("") -gaps = sum(counts.get(s, 0) for s in ("FAIL", "SKIP", "PLANNED")) +gaps = sum(counts.get(s, 0) for s in ("FAIL", "FLAKE", "SKIP", "PLANNED")) if dry: w("**Verdict:** not run.") elif gaps: - w("**Verdict:** not qualified: %d checks failed, %d were skipped." % (counts.get("FAIL", 0), counts.get("SKIP", 0))) + w("**Verdict:** not qualified: %d checks failed, %d flaked on a known lab bug, %d were skipped." % (counts.get("FAIL", 0), counts.get("FLAKE", 0), counts.get("SKIP", 0))) else: w("**Verdict:** every check passed.") w("") @@ -91,6 +92,11 @@ for run, rs in runs.items(): w("### %s" % run) w("") w("Cell `%s`, XDP `%s`, VLAN offload `%s`." % (rs[0]["cell"], rs[0]["xdp"], rs[0]["offload"])) + up = os.path.join(top, run, "uptime.txt") + if os.path.exists(up): + with open(up) as f: + w("") + w("Host load at the start: `%s`." % f.read().strip()) w("") w("| Row | Case | Status | Expected | Observed | Evidence |") w("| --- | --- | --- | --- | --- | --- |") diff --git a/deploy/containerlab/scripts/vlan-transport-rows.sh b/deploy/containerlab/scripts/vlan-transport-rows.sh index bdfed668..808a4d91 100755 --- a/deploy/containerlab/scripts/vlan-transport-rows.sh +++ b/deploy/containerlab/scripts/vlan-transport-rows.sh @@ -20,7 +20,8 @@ # PLANNED dry run: the steps were printed, nothing ran # # The caller sets LAB, VT, OUT (the run directory), RESULTS, RUN_ID, CELL, -# XMODE, OFFLOAD, SELECT, DRY_RUN and the side names (side_names). +# XMODE, OFFLOAD, SELECT, DRY_RUN and the side names (side_names), and +# sources lib.sh for node_ping. # shellcheck disable=SC2034 # globals shared with the sourcing scripts GW_METRICS=8081 @@ -54,9 +55,9 @@ declare -A EXPECTED=( [V14]="C5: V01 to V05 and V11 pass with both VLANs on one parent" [V15]="A third VLAN on a side's parent carries host traffic both ways with its own tag, unclaimed" [V16]="Zero frames with the other side's tag, zero tagged frames at the tenant, zero cross-VPC packets" - [V17]="Each component reports per side: mode, VLAN ID, parent and logical interface" + [V17]="Each component reports per side: mode, VLAN ID, parent and logical interface (contract section 1 roles)" [V18]="Each invalid configuration fails with an error naming side, component, interface and rule" - [V19]="C1 unset matches C1 named; tagged cells need explicit edge selection; compute auto-detects" + [V19]="C1 unset matches C1 named (galactic-nat, galactic-cni); a compute node with only a fabric side auto-detects it" [V20]="C1 passes V01 to V08 with the same results as the pre-change baseline" [V21]="VLAN ID change: changed side recovers within baseline + 1 s; other side loses nothing; nothing stale" [V22]="Parent change: as V21" @@ -128,7 +129,7 @@ skip() { record "$1" "$2" SKIP "$3"; } # --- lab reads ---------------------------------------------------------------- -kc() { docker exec "${CP}" kubectl -n galactic-system "$@"; } +kc() { kube_retry docker exec "${CP}" kubectl -n galactic-system "$@"; } # edge_gateway_ds names the edge node's own galactic-gateway DaemonSet. edge_gateway_ds() { @@ -191,6 +192,7 @@ wire() { return 1 fi WIRE=$(awk -v pt="${PUB_VID:+1}" -v ft="${FAB_VID:+1}" ' + $4 == "capture" { printf "%s %s %s: capture missing; ", $1, $2, $3; breach = 1; next } { for (i = 4; i <= NF; i++) { split($i, kv, "="); v[i] = kv[2] } role = $1; tot = v[4]; a = v[5]; b = v[6]; un = v[7]; oth = v[8] cls = role; sub(/-.*/, "", cls); seen[cls] += tot @@ -204,13 +206,18 @@ wire() { if (!breach) printf "rule holds"; exit breach }' "${f}") local rc=$? if [ -s "${t}" ]; then - local tagged - tagged=$(grep -Eo 'tagged=[0-9]+' "${t}" | cut -d= -f2) + local tagged total + tagged=$(grep -Eo ' tagged=[0-9]+' "${t}" | cut -d= -f2) + total=$(grep -Eo 'total=[0-9]+' "${t}" | cut -d= -f2) if [ "${tagged:-1}" != 0 ]; then WIRE="${WIRE}; tenant saw ${tagged:-unknown} tagged frames" rc=1 + elif [ "${total:-0}" = 0 ]; then + # This path does not reach sjc's ns20 tenant, so its capture says + # nothing either way. + WIRE="${WIRE}; ns20 tenant not on this path" else - WIRE="${WIRE}; tenant untagged" + WIRE="${WIRE}; tenant untagged (${total} frames)" fi else WIRE="${WIRE}; no tenant capture" @@ -274,8 +281,8 @@ row_V03() { # also V04 local w=$? local n66="exit ${r}" n64="exit ${r}" if [ "${DRY_RUN}" != 1 ]; then - n66="${n66}, $(grep -ciE 'nat66.*ok|ok.*nat66' "${OUT}/V03.txt") NAT66 ok lines" - n64="${n64}, $(grep -ciE 'nat64.*ok|ok.*nat64' "${OUT}/V03.txt") NAT64 ok lines" + n66="${n66}, $(grep -cE '^ +ok .*(2001:db8|::)' "${OUT}/V03.txt") IPv6 ok lines" + n64="${n64}, $(grep -cE '^ +ok .*192\.0\.2\.' "${OUT}/V03.txt") IPv4 ok lines" fi record V03 "" "$(verdict "${r}" "${w}")" "verify:nat-datapath ${n66}; ${WIRE}" "V03.txt V03-tags.txt V03-counters.txt" record V04 "" "$(verdict "${r}" "${w}")" "verify:nat-datapath ${n64}; ${WIRE}" "V03.txt V03-tags.txt" @@ -307,7 +314,7 @@ print(any(af.get("peers",{}).get(p,{}).get("state")=="Established" for af in d.v local pub=1 fab=1 nd node if [ "$(est "${OUT}/V06-public-bgp.txt" 2001:db8:1:21::2)" = True ] && [ "$(est "${OUT}/V06-public-bgp.txt" 10.1.21.2)" = True ]; then pub=0; fi if [ "$(est "${OUT}/V06-fabric-bgp.txt" 2001:db8:1:20::2)" = True ] && [ "$(est "${OUT}/V06-fabric-bgp.txt" 10.1.20.2)" = True ]; then fab=0; fi - nd=$(awk '/^---/{s=1; next} /REACHABLE|STALE|DELAY|PERMANENT/{ok[s]=1} END{exit !(ok[0] && ok[1])}' "${OUT}/V06-neigh.txt"; echo $?) + nd=$(awk 'BEGIN {s = 0} /^---/ {s = 1; next} / (REACHABLE|STALE|DELAY|PERMANENT) *$/ {ok[s] = 1} END {exit !(ok[0] && ok[1])}' "${OUT}/V06-neigh.txt"; echo $?) node=$(grep -qw Ready "${OUT}/V06-node.txt"; echo $?) record V06 "" "$(verdict "${pub}" "${fab}" "${nd}" "${node}")" \ "public BGP $([ "${pub}" = 0 ] && echo up || echo down), fabric BGP $([ "${fab}" = 0 ] && echo up || echo down), neighbours on ${PUB_L} and ${FAB_L} $([ "${nd}" = 0 ] && echo resolved || echo missing), node $([ "${node}" = 0 ] && echo Ready || echo 'not Ready')" \ @@ -414,14 +421,27 @@ row_V11() { # also V12, V13 local pv=${PUB_VID:-101} fv=${FAB_VID:-202} other other=$((${PUB_VID:-0} == 999 ? 998 : 999)) local valid wrong=() malformed=(in-frame\ prio "in-frame qq:${pv}:5" "in-frame ad:300:${pv}" "in-frame trunc:${pv}") cross=() + # On an untagged side with receive VLAN offload on, a kernel-tagged frame's + # tag is in skb metadata, which native XDP cannot read, so the side may + # claim it (contract section 6, the note on receive VLAN offload). Those + # cases are reported, not judged. With offload off the tag is in packet + # data and every case is judged. + local accepted=() kernel_judged=1 + if [ -z "${PUB_VID}" ] && [ "${OFFLOAD}" = on ]; then kernel_judged=0; fi if [ -n "${PUB_VID}" ]; then valid=("in-frame q:${pv}" "kernel q:${pv}") cross=("in-frame untagged") else valid=("in-frame untagged") - cross=("in-frame q:${pv}" "kernel q:${pv}") + cross=("in-frame q:${pv}") + if [ "${kernel_judged}" = 1 ]; then cross+=("kernel q:${pv}"); else accepted+=("kernel q:${pv}"); fi + fi + wrong=("in-frame q:${other}" "in-frame q:${fv}") + if [ "${kernel_judged}" = 1 ]; then + wrong+=("kernel q:${other}" "kernel q:${fv}") + else + accepted+=("kernel q:${other}" "kernel q:${fv}") fi - wrong=("in-frame q:${other}" "in-frame q:${fv}" "kernel q:${other}" "kernel q:${fv}") # none LABEL CASE...: 0 when every case was claimed zero times. local c n obs bad check() { # ROW WANT CASE... @@ -435,13 +455,15 @@ row_V11() { # also V12, V13 done } check V11 some "${valid[@]}" - local ctl_bad=${bad} ctl_obs=${obs} + local ctl_bad=${bad} ctl_obs=${obs} acc_obs="" + for c in "${accepted[@]}"; do acc_obs="${acc_obs}${c} +$(claimed "${c}"); "; done + [ -n "${acc_obs}" ] && acc_obs="; accepted on an untagged side with offload on (contract section 6 note): ${acc_obs}" check V11 none "${wrong[@]}" - record V11 public-vip "$(verdict "${bad}" "${ctl_bad}")" "positive control ${ctl_obs}wrong IDs ${obs}" "V11.txt inject.txt" + record V11 public-vip "$(verdict "${bad}" "${ctl_bad}")" "positive control ${ctl_obs}wrong IDs ${obs}${acc_obs}" "V11.txt inject.txt" check V12 none "${malformed[@]}" record V12 public-vip "$(verdict "${bad}" "${ctl_bad}")" "${obs}" "V11.txt" check V13 none "${cross[@]}" - record V13 public-vip "$(verdict "${bad}" "${ctl_bad}")" "${obs}valid: ${ctl_obs}" "V11.txt" + record V13 public-vip "$(verdict "${bad}" "${ctl_bad}")" "${obs}valid: ${ctl_obs}${acc_obs}" "V11.txt" } row_V14() { @@ -459,6 +481,32 @@ row_V14() { record V14 "" "$(verdict "${bad}")" "${obs}" "results of ${RUN_ID}" } +# cilium_vlan_drops NODE FILE: Cilium's drop counters on NODE that name a +# VLAN, from its agent's metrics. FILE's first line is a marker saying what +# was found: cilium-pod-not-found, cilium-metrics-unreadable, +# no-vlan-drop-counters or vlan-drop-counters, so a failed read is never +# mistaken for zero drops. +cilium_vlan_drops() { + log_cmd cilium-dbg metrics list "($1)" + [ "${DRY_RUN}" = 1 ] && return 0 + local pod metrics drops + pod=$(docker exec "${CP}" kubectl -n kube-system get pods -l k8s-app=cilium --field-selector "spec.nodeName=$1" -o name 2>&1) + if [[ "${pod}" != pod/* ]] || [ "$(wc -l <<<"${pod}")" -ne 1 ]; then + printf 'MARKER cilium-pod-not-found %s\n%s\n' "$1" "${pod}" >"$2" + return 0 + fi + if ! metrics=$(docker exec "${CP}" kubectl -n kube-system exec "${pod}" -c cilium-agent -- cilium-dbg metrics list 2>&1); then + printf 'MARKER cilium-metrics-unreadable %s %s\n%s\n' "$1" "${pod}" "${metrics}" >"$2" + return 0 + fi + drops=$(grep -i 'drop' <<<"${metrics}" | grep -i 'vlan') + if [ -z "${drops}" ]; then + printf 'MARKER no-vlan-drop-counters %s %s\n' "$1" "${pod}" >"$2" + else + printf 'MARKER vlan-drop-counters %s %s\n%s\n' "$1" "${pod}" "${drops}" >"$2" + fi +} + # third_vlan SIDE: V15 on one side's parent. third_vlan() { local side="$1" a_node a_par b_node b_par a_addr=2001:db8:ffff:15::1 b_addr=2001:db8:ffff:15::2 @@ -473,13 +521,47 @@ third_vlan() { x docker exec "${b_node}" ip link add link "${b_par}" name "${dev_b}" type vlan id "${THIRD_VID}" x docker exec "${a_node}" sh -c "ip link set ${dev_a} up && ip -6 addr add ${a_addr}/64 dev ${dev_a} nodad" x docker exec "${b_node}" sh -c "ip link set ${dev_b} up && ip -6 addr add ${b_addr}/64 dev ${dev_b} nodad" + # Cilium drops a VLAN it has not adopted yet (DROP_VLAN_FILTERED), so wait + # until one round trip each way succeeds, at most ADMIT_WAIT s, before the + # measured pings. A VLAN that never gets through is "not admitted", never + # a pass. Cilium's VLAN filter drops are kept from before and after. + cilium_vlan_drops "${b_node}" "${OUT}/V15-${side}-cilium-before.txt" + [[ "${a_node}" == clab-* ]] || cilium_vlan_drops "${a_node}" "${OUT}/V15-${side}-cilium-peer-before.txt" + local waited=-1 + log_cmd admit_wait "${a_node}" "${b_addr}" "${b_node}" "${a_addr}" + if [ "${DRY_RUN}" = 1 ]; then + waited=0 + else + local t0=${SECONDS} + while [ $((SECONDS - t0)) -lt "${ADMIT_WAIT:-60}" ]; do + if node_ping "${a_node}" -- -6 -c 1 -W 1 "${b_addr}" >/dev/null 2>&1 && + node_ping "${b_node}" -- -6 -c 1 -W 1 "${a_addr}" >/dev/null 2>&1; then + waited=$((SECONDS - t0)) + break + fi + sleep 1 + done + fi + if [ "${waited}" -lt 0 ]; then + cilium_vlan_drops "${b_node}" "${OUT}/V15-${side}-cilium-after.txt" + [[ "${a_node}" == clab-* ]] || cilium_vlan_drops "${a_node}" "${OUT}/V15-${side}-cilium-peer-after.txt" + x docker exec "${a_node}" ip link del "${dev_a}" + x docker exec "${b_node}" ip link del "${dev_b}" + record V15 "${side}" FAIL "not admitted: no round trip on VLAN ${THIRD_VID} within ${ADMIT_WAIT:-60} s; see the Cilium counters for the cause" \ + "V15-${side}-cilium-*.txt" + return + fi + x docker exec "${a_node}" ip -6 neigh flush dev "${dev_a}" + x docker exec "${b_node}" ip -6 neigh flush dev "${dev_b}" x env LAB="${LAB}" "${VT}" capture-start "${OUT}" "V15-${side}" - xo "${OUT}/V15-${side}-a.txt" docker exec "${a_node}" ping -6 -c 20 -i 0.2 -W 1 "${b_addr}" + xo "${OUT}/V15-${side}-a.txt" node_ping "${a_node}" -- -6 -c 20 -i 0.2 -W 1 "${b_addr}" local ra=$? - xo "${OUT}/V15-${side}-b.txt" docker exec "${b_node}" ping -6 -c 20 -i 0.2 -W 1 "${a_addr}" + xo "${OUT}/V15-${side}-b.txt" node_ping "${b_node}" -- -6 -c 20 -i 0.2 -W 1 "${a_addr}" local rb=$? x env LAB="${LAB}" TAG_A="${THIRD_VID}" TAG_B="${PUB_VID:-${FAB_VID}}" "${VT}" capture-stop "${OUT}" "V15-${side}" counters_after "V15-${side}" + cilium_vlan_drops "${b_node}" "${OUT}/V15-${side}-cilium-after.txt" + [[ "${a_node}" == clab-* ]] || cilium_vlan_drops "${a_node}" "${OUT}/V15-${side}-cilium-peer-after.txt" x docker exec "${a_node}" ip link del "${dev_a}" x docker exec "${b_node}" ip link del "${dev_b}" local tag=1 tagobs="not read" @@ -488,8 +570,8 @@ third_vlan() { [ "${tagobs}" -gt 0 ] 2>/dev/null && tag=0 fi record V15 "${side}" "$(verdict "${ra}" "${rb}" "${tag}")" \ - "pings ${a_node#clab-"${LAB}"-}->${b_node} exit ${ra}, back exit ${rb}; ${tagobs} frames tagged ${THIRD_VID}; Galactic counters in V15-${side}-counters.txt" \ - "V15-${side}-a.txt V15-${side}-b.txt V15-${side}-tags.txt V15-${side}-counters.txt" + "admitted after ${waited} s; pings ${a_node#clab-"${LAB}"-}->${b_node} exit ${ra}, back exit ${rb}; ${tagobs} frames tagged ${THIRD_VID}; Galactic counters in V15-${side}-counters.txt" \ + "V15-${side}-a.txt V15-${side}-b.txt V15-${side}-tags.txt V15-${side}-counters.txt V15-${side}-cilium-*.txt" } row_V15() { @@ -528,14 +610,23 @@ side_info() { docker exec "$1" curl -s --max-time 4 "http://localhost:$2/metrics" \ | sed -n 's/^galactic_transport_side_info{\(.*\)} 1$/\1/p' \ | awk -F, '{for (i = 1; i <= NF; i++) {split($i, kv, "="); gsub(/"/, "", kv[2]); v[kv[1]] = kv[2]} - print v["side"], v["interface"], v["mode"], (v["vlan_id"] == "" ? "-" : v["vlan_id"]), v["parent"]}' + print v["side"], v["interface"], v["mode"], (v["vlan_id"] == "" ? "-" : v["vlan_id"]), (v["parent"] == "" ? "-" : v["parent"])}' +} + +# want_side SIDE L P VID prints the side_info line a side should report: +# an untagged side reports no VLAN ID and no parent. +want_side() { + if [ -n "$4" ]; then echo "$1 $2 tagged $4 $3"; else echo "$1 $2 untagged - -"; fi } +# V17, by contract section 1: galactic-gateway names both sides; +# galactic-nat has no public and fabric split, so its uplinks are unassigned; +# galactic-cni reports what the node selects. sjc's edge selects only its +# public side, named public; the compute node names no public side, so its +# fabric interface is unassigned. row_V17() { row_start V17 "derived mode is visible" - local comp node port want_pub want_fab - want_pub="public ${PUB_L} $([ -n "${PUB_VID}" ] && echo tagged || echo untagged) ${PUB_VID:--} ${PUB_P}" - want_fab="fabric ${FAB_L} $([ -n "${FAB_VID}" ] && echo tagged || echo untagged) ${FAB_VID:--} ${FAB_P}" + local comp node port for comp in "galactic-gateway ${EDGE} ${GW_METRICS}" "galactic-nat ${EDGE} ${NAT_METRICS}" "galactic-cni ${EDGE} ${CNI_METRICS}" "galactic-cni ${COMPUTE} ${CNI_METRICS}"; do read -r comp node port <<<"${comp}" log_cmd docker exec "${node}" curl -s "http://localhost:${port}/metrics" @@ -543,10 +634,17 @@ row_V17() { local got got=$(side_info "${node}" "${port}") echo "${got}" >"${OUT}/V17-${comp}-${node}.txt" - local want=("${want_pub}" "${want_fab}") w bad=0 miss="" - if [ "${node}" = "${COMPUTE}" ]; then - want=("fabric ${CPT_L} $([ -n "${FAB_VID}" ] && echo tagged || echo untagged) ${FAB_VID:--} ${CPT_P}") - fi + local want=() w bad=0 miss="" + case "${comp}@${node}" in + galactic-gateway@*) + want=("$(want_side public "${PUB_L}" "${PUB_P}" "${PUB_VID}")" "$(want_side fabric "${FAB_L}" "${FAB_P}" "${FAB_VID}")") ;; + galactic-nat@*) + want=("$(want_side unassigned "${PUB_L}" "${PUB_P}" "${PUB_VID}")" "$(want_side unassigned "${FAB_L}" "${FAB_P}" "${FAB_VID}")") ;; + "galactic-cni@${EDGE}") + want=("$(want_side public "${PUB_L}" "${PUB_P}" "${PUB_VID}")") ;; + *) + want=("$(want_side unassigned "${CPT_L}" "${CPT_P}" "${FAB_VID}")") ;; + esac for w in "${want[@]}"; do grep -qxF "${w}" <<<"${got}" || { bad=1; miss="${miss}missing '${w}'; "; } done @@ -561,16 +659,16 @@ invalid() { local case="$1" rule="$2" pub="$3" int="$4" setup="$5" teardown="$6" gw [ -n "${setup}" ] && x docker exec "${EDGE}" sh -c "${setup}" gw=$(edge_gateway_ds) - x docker exec "${CP}" kubectl -n galactic-system set env "ds/${gw}" -c galactic-gateway \ + x kube_retry docker exec "${CP}" kubectl -n galactic-system set env "ds/${gw}" -c galactic-gateway \ "GALACTIC_GATEWAY_PUBLIC_INTERFACE=${pub}" "GALACTIC_GATEWAY_INTERNAL_INTERFACES=${int}" - x docker exec "${CP}" kubectl -n galactic-system set env ds/galactic-nat -c galactic-nat "GALACTIC_NAT_UPLINK_INTERFACES=${pub},${int}" + x kube_retry docker exec "${CP}" kubectl -n galactic-system set env ds/galactic-nat -c galactic-nat "GALACTIC_NAT_UPLINK_INTERFACES=${pub},${int}" x sleep "${V18_WAIT:-60}" xo "${OUT}/V18-${case}.txt" docker exec "${CP}" sh -c \ "for l in app.kubernetes.io/name=galactic-gateway app.kubernetes.io/name=galactic-nat; do for p in \$(kubectl -n galactic-system get pods -l \$l --field-selector spec.nodeName=${EDGE} -o name); do echo \"=== \$p\"; kubectl -n galactic-system get \$p -o jsonpath='{range .status.containerStatuses[*]}{.name} ready={.ready} restarts={.restartCount}{\"\\n\"}{end}'; - kubectl -n galactic-system logs \$p --all-containers --tail=200 2>&1 | grep -iE 'transport|${rule}' | tail -5; - kubectl -n galactic-system logs \$p --all-containers --previous --tail=200 2>/dev/null | grep -iE 'transport|${rule}' | tail -5; + kubectl -n galactic-system logs \$p --all-containers --tail=200 2>&1 | grep -iE 'transport|error|fatal|refus|${rule}' | tail -8; + kubectl -n galactic-system logs \$p --all-containers --previous --tail=200 2>/dev/null | grep -iE 'transport|error|fatal|refus|${rule}' | tail -8; done; done" [ -n "${teardown}" ] && x docker exec "${EDGE}" sh -c "${teardown}" x env LAB="${LAB}" "${VT_ENV[@]}" "${VT}" apply "${BASE_CELL}" "${SELECT}" @@ -604,35 +702,78 @@ row_V18() { skip V18 galactic-cni "the invalid cases are driven on the gateway and NAT only" } +# cni_cluster_value prints galactic-cni's deployed cluster-wide interface +# list, as vlan-transport.sh saved it before the first change. +cni_cluster_value() { + if [ "${DRY_RUN}" = 1 ]; then echo bond0; return; fi + docker exec "${EDGE}" sh -c "grep '^cni_ifaces=' /galactic/vlan-transport.state | cut -d= -f2-" +} + +# V19: contract section 1 rule 1. galactic-cni and galactic-nat auto-detect +# their interfaces when unset; galactic-gateway never does. In C1, unset +# matches named. In a tagged cell an edge node needs explicit selection, and +# a compute node with only a fabric side auto-detects it. row_V19() { row_start V19 "auto-detection and explicit selection" - local gw - gw=$(edge_gateway_ds) - if [ "${DRY_RUN}" != 1 ]; then - side_info "${EDGE}" "${GW_METRICS}" >"${OUT}/V19-named.txt" - fi - log_cmd docker exec "${EDGE}" curl -s "http://localhost:${GW_METRICS}/metrics" - x docker exec "${CP}" kubectl -n galactic-system set env "ds/${gw}" -c galactic-gateway \ - GALACTIC_GATEWAY_PUBLIC_INTERFACE- GALACTIC_GATEWAY_INTERNAL_INTERFACES- - x docker exec "${CP}" kubectl -n galactic-system rollout status "ds/${gw}" --timeout=120s - x sleep 20 - xo "${OUT}/V19-unset.txt" docker exec "${CP}" sh -c \ - "kubectl -n galactic-system get pods -l app.kubernetes.io/name=galactic-gateway --field-selector spec.nodeName=${EDGE} -o wide; - kubectl -n galactic-system logs -l app.kubernetes.io/name=galactic-gateway --all-containers --tail=100 2>&1 | grep -iE 'transport|interface' | tail -10" - [ "${DRY_RUN}" = 1 ] || side_info "${EDGE}" "${GW_METRICS}" >"${OUT}/V19-auto.txt" - x env LAB="${LAB}" "${VT_ENV[@]}" "${VT}" apply "${BASE_CELL}" "${SELECT}" - [ "${DRY_RUN}" = 1 ] && { record V19 edge PLANNED ""; return; } + local orig + orig=$(cni_cluster_value) if [ -z "${PUB_VID}${FAB_VID}" ]; then + if [ "${DRY_RUN}" != 1 ]; then + side_info "${EDGE}" "${NAT_METRICS}" | sort >"${OUT}/V19-nat-named.txt" + side_info "${EDGE}" "${CNI_METRICS}" | sort >"${OUT}/V19-cni-named.txt" + fi + x kube_retry docker exec "${CP}" kubectl -n galactic-system set env ds/galactic-nat -c galactic-nat GALACTIC_NAT_UPLINK_INTERFACES- + x kube_retry docker exec "${CP}" kubectl -n galactic-system set env ds/galactic-cni --containers='*' GALACTIC_CNI_EBPF_INTERFACES- + x kube_retry docker exec "${CP}" kubectl -n galactic-system rollout status ds/galactic-nat --timeout=180s + x kube_retry docker exec "${CP}" kubectl -n galactic-system rollout status ds/galactic-cni --timeout=300s + x sleep 20 + if [ "${DRY_RUN}" != 1 ]; then + side_info "${EDGE}" "${NAT_METRICS}" | sort >"${OUT}/V19-nat-auto.txt" + side_info "${EDGE}" "${CNI_METRICS}" | sort >"${OUT}/V19-cni-auto.txt" + fi + x kube_retry docker exec "${CP}" kubectl -n galactic-system set env ds/galactic-cni --containers='*' "GALACTIC_CNI_EBPF_INTERFACES=${orig}" + x env LAB="${LAB}" "${VT_ENV[@]}" "${VT}" apply "${BASE_CELL}" "${SELECT}" + if [ "${DRY_RUN}" = 1 ]; then + record V19 nat-untagged PLANNED "" + record V19 cni-untagged PLANNED "" + return + fi + # Kind routes each node's IPv6 default through its management interface, + # eth0, so auto-detection also selects it in this lab; a host whose + # default route uses its uplink does not. eth0 is left out of the + # comparison for that reason. local same=1 - [ -s "${OUT}/V19-named.txt" ] && cmp -s "${OUT}/V19-named.txt" "${OUT}/V19-auto.txt" && same=0 - record V19 edge-untagged "$(verdict "${same}")" "named: $(tr '\n' '|' <"${OUT}/V19-named.txt"); unset: $(tr '\n' '|' <"${OUT}/V19-auto.txt")" "V19-named.txt V19-auto.txt" - else - # Refused: the edge's gateway pod is not fully ready, or not Running. - local refused - refused=$(awk '$1 ~ /^galactic-gateway/ {split($2, r, "/"); if (r[1] != r[2] || $3 != "Running") f = 1} END {print f ? 0 : 1}' "${OUT}/V19-unset.txt") - record V19 edge-tagged "$(verdict "${refused}")" "gateway with no selection on a tagged edge: $(grep -m1 galactic-gateway "${OUT}/V19-unset.txt" | tr -s ' ')" "V19-unset.txt" + grep -v ' eth0 ' "${OUT}/V19-nat-auto.txt" >"${OUT}/V19-nat-auto-no-eth0.txt" + [ -s "${OUT}/V19-nat-named.txt" ] && cmp -s "${OUT}/V19-nat-named.txt" "${OUT}/V19-nat-auto-no-eth0.txt" && same=0 + record V19 nat-untagged "$(verdict "${same}")" \ + "named: $(tr '\n' '|' <"${OUT}/V19-nat-named.txt"); unset: $(tr '\n' '|' <"${OUT}/V19-nat-auto.txt") (eth0, Kind's management interface carrying the default route, left out)" "V19-nat-named.txt V19-nat-auto.txt" + # The lab names only the public side for galactic-cni on the edge, and + # detection also finds the fabric side, so only the public side compares. + local pub=1 + grep '^public ' "${OUT}/V19-cni-named.txt" >"${OUT}/V19-cni-named-public.txt" + [ -s "${OUT}/V19-cni-named-public.txt" ] && grep -qxFf "${OUT}/V19-cni-named-public.txt" "${OUT}/V19-cni-auto.txt" && pub=0 + record V19 cni-untagged "$(verdict "${pub}")" \ + "named: $(tr '\n' '|' <"${OUT}/V19-cni-named.txt"); unset: $(tr '\n' '|' <"${OUT}/V19-cni-auto.txt")" "V19-cni-named.txt V19-cni-auto.txt" + return fi - skip V19 compute-auto "auto-detection of the compute node's fabric side needs galactic-cni's side report on the compute node (V17 galactic-cni@${COMPUTE}); not driven separately" + record V19 edge-tagged N/A "contract section 1 rule 1: an edge node whose sides use different interfaces needs explicit selection; there is nothing to auto-detect" + if [ "${CNI_SELECT:-copy}" != by-node ]; then + skip V19 compute-auto "needs CNI_SELECT=by-node, so the edge keeps its own list while the compute node auto-detects" + return + fi + local edge_entry="${EDGE}=${PUB_L}" + x kube_retry docker exec "${CP}" kubectl -n galactic-system set env ds/galactic-cni --containers='*' \ + "GALACTIC_CNI_EBPF_INTERFACES_BY_NODE=${edge_entry}" GALACTIC_CNI_EBPF_INTERFACES- + x kube_retry docker exec "${CP}" kubectl -n galactic-system rollout status ds/galactic-cni --timeout=300s + x sleep 20 + [ "${DRY_RUN}" = 1 ] || side_info "${COMPUTE}" "${CNI_METRICS}" >"${OUT}/V19-compute-auto.txt" + x kube_retry docker exec "${CP}" kubectl -n galactic-system set env ds/galactic-cni --containers='*' "GALACTIC_CNI_EBPF_INTERFACES=${orig}" + x env LAB="${LAB}" "${VT_ENV[@]}" "${VT}" apply "${BASE_CELL}" "${SELECT}" + [ "${DRY_RUN}" = 1 ] && { record V19 compute-auto PLANNED ""; return; } + local found=1 + awk -v i="${CPT_L}" '$2 == i {f = 1} END {exit !f}' "${OUT}/V19-compute-auto.txt" && found=0 + record V19 compute-auto "$(verdict "${found}")" \ + "${COMPUTE} with no selection resolved: $(tr '\n' '|' <"${OUT}/V19-compute-auto.txt"); want ${CPT_L}" "V19-compute-auto.txt" } row_V20() { diff --git a/deploy/containerlab/scripts/vlan-transport-switch.sh b/deploy/containerlab/scripts/vlan-transport-switch.sh index 6ccdbda0..5c09a21b 100755 --- a/deploy/containerlab/scripts/vlan-transport-switch.sh +++ b/deploy/containerlab/scripts/vlan-transport-switch.sh @@ -34,7 +34,11 @@ SW=clab-${LAB}-vtsw TR=clab-${LAB}-tr2 EDGE=sjc-worker2 COMPUTE=sjc-worker -IMAGE=${VT_SWITCH_IMAGE:-kindest/node:galactic} +# The transit routers' image: it has iproute2 with XDP object loading, +# tcpdump and the python3 the injection rows need, which the Kind node +# image lacks. +IMAGE=${VT_SWITCH_IMAGE:-fabric-router:latest} +MKBOND="${SCRIPT_DIR}/../group_files/common/mkbond.sh" XDP_OBJ="${SCRIPT_DIR}/../node_files/common/xdp-passthrough.o" BOND_MODE=${BOND_MODE:-802.3ad} @@ -56,14 +60,14 @@ vid_ok() { fi } -# mkbond NODE: build bondsw from MEMBERS in BOND_MODE with the lab's bond -# helper, baked into the Kind node image the switch also runs. +# mkbond NODE PATH A B: build bondsw from A and B in BOND_MODE with the +# lab's bond helper at PATH on NODE. mkbond() { - local n="$1" a="$2" b="$3" + local n="$1" helper="$2" a="$3" b="$4" if ! q "${n}" ip link show dev bondsw >/dev/null 2>&1 && [ "${BOND_MODE}" != 802.3ad ]; then on "${n}" ip link add bondsw type bond mode "${BOND_MODE}" miimon 100 fi - on "${n}" /galactic/scripts/mkbond.sh bondsw "${a}" "${b}" + on "${n}" "${helper}" bondsw "${a}" "${b}" } cmd_plan() { @@ -99,8 +103,9 @@ cmd_up() { fi on "${n}" ip link set dev "${i}" up done - mkbond "${EDGE}" vtsw1 vtsw2 - mkbond "${SW}" e1 e2 + docker cp "${MKBOND}" "${SW}:/mkbond.sh" >/dev/null + mkbond "${EDGE}" /galactic/scripts/mkbond.sh vtsw1 vtsw2 + mkbond "${SW}" /mkbond.sh e1 e2 docker cp "${XDP_OBJ}" "${SW}:/xdp-passthrough.o" >/dev/null for i in e1 e2; do diff --git a/deploy/containerlab/scripts/vlan-transport.sh b/deploy/containerlab/scripts/vlan-transport.sh index 7d817216..282ece27 100755 --- a/deploy/containerlab/scripts/vlan-transport.sh +++ b/deploy/containerlab/scripts/vlan-transport.sh @@ -15,6 +15,8 @@ # vlan-transport.sh plan CELL [logical|parent] print what apply would change; needs no lab # vlan-transport.sh apply CELL [logical|parent] cells in ../resources/vlan-transport/cells.env # vlan-transport.sh revert back to C1 with the saved Galactic settings +# vlan-transport.sh repair with no saved state: every transport address back on its +# bond, transmit checksum offload back to containerlab's off # vlan-transport.sh status what is applied now # vlan-transport.sh offload on|off VLAN offloads on every transport member # vlan-transport.sh csum on|off transmit checksum offload on every transport member @@ -37,7 +39,8 @@ # CNI_SELECT picks how galactic-cni gets a different interface list on the # edge and compute nodes: "copy" (default) gives the edge node its own copy # of the DaemonSet; "by-node" sets GALACTIC_CNI_EBPF_INTERFACES_BY_NODE on -# the one DaemonSet, which needs a galactic-cni that reads it (#1404). +# the one DaemonSet (#1539), and names the edge's public side in +# GALACTIC_CNI_EBPF_PUBLIC_INTERFACE (#1542), so DSR replies leave by it. # # The caller holds the containerlab-manager reservation. Every change here is # echoed with a "change:" prefix so the run's log records it exactly. @@ -87,7 +90,7 @@ case "${VT_SITE:-sjc}" in esac # Datapath images and kubectl live on the Kind nodes; the transit routers # have vtysh. -kc() { docker exec "${CP}" kubectl -n "${NS}" "$@"; } +kc() { kube_retry docker exec "${CP}" kubectl -n "${NS}" "$@"; } on() { local n="$1"; shift; echo "change: ${n}: $*"; docker exec "${n}" "$@"; } q() { local n="$1"; shift; docker exec "${n}" "$@"; } @@ -127,6 +130,7 @@ save_original() { state_put nat_uplinks "$(ds_env galactic-nat galactic-nat GALACTIC_NAT_UPLINK_INTERFACES)" state_put cni_ifaces "$(ds_env galactic-cni credential-refresh GALACTIC_CNI_EBPF_INTERFACES)" state_put cni_by_node "$(ds_env galactic-cni credential-refresh GALACTIC_CNI_EBPF_INTERFACES_BY_NODE)" + state_put cni_public "$(ds_env galactic-cni credential-refresh GALACTIC_CNI_EBPF_PUBLIC_INTERFACE)" q "${EDGE}" cat "${STATE}" | sed 's/^/saved: /' } @@ -175,6 +179,36 @@ side_apply() { echo "${logical} ${parent}" >&3 } +# addr_home END: take the end's addresses off its first member and put them +# on its bond. An untagged side on a plain NIC parent holds them on the +# member itself, which no VLAN netdevice marks: on tr2 in FRR's running +# configuration, on a Kind node in the kernel, where re-enslaving the +# member flushes its IPv6 address but keeps the IPv4 one. Each family is +# checked on its own, since vtysh refuses to remove an address it lacks. +addr_home() { + local -n h="$1" + local n="${h[0]}" bond="${h[1]}" member="${h[2]}" v6="${h[3]}" v4="${h[4]}" a + local -a held=() + for a in "${v6}" "${v4}"; do + q "${n}" ip -o addr show dev "${member}" 2>/dev/null | grep -qwF "${a}" && held+=("${a}") + done + [ "${#held[@]}" -gt 0 ] || return 0 + if [ "${n}" = "${TR}" ]; then + local -a cmds=(-c "configure terminal" -c "interface ${member}") + for a in "${held[@]}"; do + if [[ "${a}" == *:* ]]; then cmds+=(-c "no ipv6 address ${a}"); else cmds+=(-c "no ip address ${a}"); fi + done + cmds+=(-c "interface ${bond}" -c "ipv6 address ${v6}" -c "ip address ${v4}") + on "${n}" vtysh "${cmds[@]}" + else + for a in "${held[@]}"; do + on "${n}" ip addr del "${a}" dev "${member}" + done + on "${n}" ip -6 addr replace "${v6}" dev "${bond}" + on "${n}" ip -4 addr replace "${v4}" dev "${bond}" + fi +} + # side_revert END: remove any VLAN and re-bond, moving the addresses home. side_revert() { local -n e="$1" @@ -187,6 +221,7 @@ side_revert() { ;; esac done + addr_home "$1" if ! q "${n}" ip -o link show dev "${member}" | grep -q " master ${bond} "; then if [ "${n}" = "${TR}" ]; then on "${n}" /opt/lab/mkbond.sh "${bond}" "${member}" @@ -214,14 +249,14 @@ set_nat() { kc set env ds/galactic-nat -c galactic-nat "GALACTIC_NAT_UPLINK_INTERFACES=$1" } -# set_cni COMPUTE_VALUE EDGE_VALUE. One cluster-wide DaemonSet serves both +# set_cni COMPUTE_VALUE EDGE_VALUE EDGE_PUBLIC. One cluster-wide DaemonSet serves both # sjc nodes, and bond0 is the public side on the edge but the fabric side on # the compute node, so a tagged side needs different names per node. With # CNI_SELECT=copy, when the values differ, the edge gets its own copy of the # DaemonSet and the original excludes it. With CNI_SELECT=by-node, the one # DaemonSet names each node in GALACTIC_CNI_EBPF_INTERFACES_BY_NODE. set_cni() { - local compute="$1" edge="$2" + local compute="$1" edge="$2" public="${3:-}" if kc get ds "${CNI_COPY}" >/dev/null 2>&1; then cni_unsplit fi @@ -235,6 +270,16 @@ set_cni() { echo "change: ds/galactic-cni: GALACTIC_CNI_EBPF_INTERFACES_BY_NODE=${by_node} (all containers)" kc set env ds/galactic-cni --containers='*' "GALACTIC_CNI_EBPF_INTERFACES_BY_NODE=${by_node}" fi + if [ -n "${public}" ]; then + # Keep every other node's entry, and replace only this edge's. + local pv e + pv="${EDGE}=${public}" + for e in $(state_get cni_public | tr ';\n' ' '); do + [[ "${e}" == "${EDGE}="* ]] || pv="${e};${pv}" + done + echo "change: ds/galactic-cni: GALACTIC_CNI_EBPF_PUBLIC_INTERFACE=${pv} (all containers)" + kc set env ds/galactic-cni --containers='*' "GALACTIC_CNI_EBPF_PUBLIC_INTERFACE=${pv}" + fi kc rollout status ds/galactic-cni --timeout=300s || echo "set_cni: galactic-cni not ready (recorded, not fatal)" return 0 fi @@ -283,6 +328,14 @@ cni_restore() { echo "change: ds/galactic-cni: unset GALACTIC_CNI_EBPF_INTERFACES_BY_NODE (all containers)" kc set env ds/galactic-cni --containers='*' GALACTIC_CNI_EBPF_INTERFACES_BY_NODE- fi + orig=$(state_get cni_public) + if [ -n "${orig}" ]; then + echo "change: ds/galactic-cni: GALACTIC_CNI_EBPF_PUBLIC_INTERFACE=${orig} (all containers)" + kc set env ds/galactic-cni --containers='*' "GALACTIC_CNI_EBPF_PUBLIC_INTERFACE=${orig}" + elif [ -n "$(ds_env galactic-cni credential-refresh GALACTIC_CNI_EBPF_PUBLIC_INTERFACE)" ]; then + echo "change: ds/galactic-cni: unset GALACTIC_CNI_EBPF_PUBLIC_INTERFACE (all containers)" + kc set env ds/galactic-cni --containers='*' GALACTIC_CNI_EBPF_PUBLIC_INTERFACE- + fi echo "change: ds/galactic-cni: GALACTIC_CNI_EBPF_INTERFACES=$(state_get cni_ifaces) (all containers)" kc set env ds/galactic-cni --containers='*' "GALACTIC_CNI_EBPF_INTERFACES=$(state_get cni_ifaces)" kc rollout status ds/galactic-cni --timeout=300s || echo "cni_restore: galactic-cni not ready (recorded, not fatal)" @@ -298,6 +351,70 @@ wait_galactic() { return "${rc}" } +# --- BGP after a move ------------------------------------------------------- + +# Moving a side's addresses onto another netdevice keeps its BGP sessions +# up, so both ends keep the routes they learned with next hops on the old +# netdevice, often the untagged parent. A hard reset makes them relearn. + +# frr_exec NODE ARGS...: vtysh on an end's FRR: the transit router itself, +# or the fabric-router pod on a Kind node. +frr_exec() { + local n="$1" pod + shift + if [ "${n}" = "${TR}" ]; then + docker exec "${n}" vtysh "$@" + return + fi + pod=$(kc get pods -l app.kubernetes.io/name=fabric-router --field-selector "spec.nodeName=${n}" -o name) + kc exec "${pod}" -c frr -- vtysh "$@" +} + +# bgp_reset PEER_END EDGE_END: hard-reset the side's sessions from the peer. +bgp_reset() { + local -n rp="$1" + local -n re="$2" + local a6=${re[3]%/*} a4=${re[4]%/*} + echo "change: ${rp[0]#clab-"${LAB}"-}: clear bgp ${a6} and ${a4}" + frr_exec "${rp[0]}" -c "clear bgp ${a6}" -c "clear bgp ${a4}" || echo "bgp_reset: ${rp[0]} refused (recorded)" +} + +# bgp_routes NODE DEV prints how many BGP routes, IPv4 and IPv6, leave NODE +# through DEV. +bgp_routes() { + local dev=${2//./\\.} + q "$1" sh -c "{ ip -o -6 route; ip -o -4 route; } | grep 'proto bgp' | grep -cE 'dev ${dev}( |\\\\|\$)'" || true +} + +# wait_moved END KIND VID: wait up to 180 s until END's BGP routes leave +# through its logical interface, and none through a different parent. +wait_moved() { + local -n we="$1" + local kind="$2" vid="$3" l p on_l on_p + read -r l p <<<"$(name_of "$1" "${kind}" "${vid}")" + for _ in $(seq 1 36); do + on_l=$(bgp_routes "${we[0]}" "${l}") + on_p=0 + [ "${p}" != "${l}" ] && on_p=$(bgp_routes "${we[0]}" "${p}") + if [ "${on_l:-0}" -gt 0 ] && [ "${on_p:-0}" -eq 0 ]; then + echo "routes: ${we[0]#clab-"${LAB}"-}: ${on_l} BGP routes via ${l}, none via ${p}" + return 0 + fi + sleep 5 + done + echo "routes: ${we[0]#clab-"${LAB}"-}: ${on_l:-0} BGP routes via ${l}, ${on_p:-0} still via ${p} after 180 s" >&2 + return 1 +} + +# settle_side SIDE KIND VID: reset a moved side's BGP and wait for both ends' +# routes to follow. Returns 1 when they do not; apply then fails. +settle_side() { + local side="$1" kind="$2" vid="$3" peer edge + if [ "${side}" = public ]; then peer=PUB_PEER edge=PUB_EDGE; else peer=FAB_PEER edge=FAB_EDGE; fi + bgp_reset "${peer}" "${edge}" + wait_moved "${peer}" "${kind}" "${vid}" && wait_moved "${edge}" "${kind}" "${vid}" +} + # --- bonds ------------------------------------------------------------------ # bond_mode END MODE rebuilds one end's bond in MODE: a bond's mode changes @@ -399,6 +516,9 @@ cmd_plan() { if [ "${SET_NAT}" = 1 ]; then echo " galactic-nat: UPLINK_INTERFACES=${pick[PUB_EDGE]},${pick[FAB_EDGE]}" echo " galactic-cni: ${COMPUTE} EBPF_INTERFACES=${pick[FAB_PEER]}; ${EDGE} EBPF_INTERFACES=${pick[PUB_EDGE]}" + if [ "${CNI_SELECT:-copy}" = by-node ]; then + echo " galactic-cni: ${EDGE} EBPF_PUBLIC_INTERFACE=${pick[PUB_EDGE]}" + fi else echo " galactic-cni: ${EDGE} EBPF_INTERFACES=${pick[PUB_EDGE]},${pick[FAB_EDGE]}; other nodes unchanged" fi @@ -465,13 +585,20 @@ cmd_apply() { read -r cpt_l cpt_p <<<"${lines[3]}" if [ "${select}" = parent ]; then pub=${pub_p}; fab=${fab_p}; cpt=${cpt_p}; else pub=${pub_l}; fab=${fab_l}; cpt=${cpt_l}; fi + if [ "${pub_changed}" = 1 ]; then + settle_side public "${pk}" "${pv}" || die "public side: BGP routes did not move to ${pub_l}" + fi + if [ "${fab_changed}" = 1 ]; then + settle_side fabric "${fk}" "${fv}" || die "fabric side: BGP routes did not move to ${fab_l}" + fi + set_gateway "${pub}" "${fab}" if [ "${SET_NAT}" = 1 ]; then set_nat "${pub},${fab}" - set_cni "${cpt}" "${pub}" + set_cni "${cpt}" "${pub}" "${pub}" else # dfw names both uplinks on every node (resources/galactic-cni/dfw). - set_cni "$(state_get cni_ifaces)" "${pub},${fab}" + set_cni "$(state_get cni_ifaces)" "${pub},${fab}" "${pub}" fi state_put cell "${cell}" state_put select "${select}" @@ -506,9 +633,13 @@ cmd_revert() { if [ "$(state_get offload)" = off ]; then cmd_offload on fi - if [ "$(state_get csum)" = off ]; then - cmd_csum on + if [ -n "$(state_get csum)" ]; then + csum_restore fi + # Which sides the cell moved, read before the revert resets them. + local pub_spec fab_spec + pub_spec=$(state_get pub_spec) + fab_spec=$(state_get fab_spec) cmd_revert_interfaces if [ "$(state_get bond_mode)" != "" ] && [ "$(state_get bond_mode)" != 802.3ad ]; then local end @@ -522,6 +653,14 @@ cmd_revert() { fi cni_restore wait_galactic + # Only the sides the cell moved, and never fatal: the settings above are + # already restored, and a revert that stops here would strand the lab. + if [ -n "${pub_spec}" ] && [ "${pub_spec}" != bond/ ]; then + settle_side public bond "" || echo "revert: public side's BGP routes did not move back to its bond (recorded)" + fi + if [ -n "${fab_spec}" ] && [ "${fab_spec}" != bond/ ]; then + settle_side fabric bond "" || echo "revert: fabric side's BGP routes did not move back to its bond (recorded)" + fi on "${EDGE}" rm -f "${STATE}" echo "revert: ${EDGE} back to C1" } @@ -562,7 +701,16 @@ cmd_offload() { # A veth sender with it on hands its peer a frame whose checksum is still # partial, and a native XDP redirect forwards those bytes as they are, so the # far end counts a false checksum error (baseline report, probe-rig artifact). +# containerlab creates its veths with it off, which is the lab as deployed; +# the first change records each member's own setting, and revert puts that +# back (csum_restore). csum_one() { + local key="csum_orig_${1#clab-"${LAB}"-}_$2" cur + key=${key//-/_} + if [ -z "$(state_get "${key}")" ]; then + cur=$(eth "$1" -k "$2" 2>/dev/null | awk '/^tx-checksumming:/ {print $2}') + state_put "${key}" "${cur:-off}" + fi echo "change: $1: ethtool -K $2 tx ${CSUM_STATE}" eth "$1" -K "$2" tx "${CSUM_STATE}" || echo "csum: $1 $2 refused (recorded)" } @@ -573,6 +721,17 @@ cmd_csum() { state_put csum "${CSUM_STATE}" } +# csum_restore_one NODE IFACE puts back the member's recorded setting, or +# containerlab's default, off, when none was recorded. +csum_restore_one() { + local key="csum_orig_${1#clab-"${LAB}"-}_$2" v + key=${key//-/_} + v=$(state_get "${key}" 2>/dev/null || true) + echo "change: $1: ethtool -K $2 tx ${v:-off}" + eth "$1" -K "$2" tx "${v:-off}" || echo "csum: $1 $2 refused (recorded)" +} +csum_restore() { for_members csum_restore_one; } + cmd_status() { q "${EDGE}" sh -c "cat ${STATE} 2>/dev/null || echo 'no state: C1 as deployed'" local n @@ -640,7 +799,12 @@ cmd_capture_start() { # LACP, LLDP and STP frames are link-local and never tagged; they are left # out of every count so a tagged link's "untagged" means data frames only. -L2CTL='(ether proto 0x8809 or ether proto 0x88cc or stp)' +L2CTL='ether proto 0x8809 or ether proto 0x88cc or stp' + +# pcount FILE FILTER counts FILE's frames matching FILTER. libpcap's `vlan` +# primitive shifts the offsets of every primitive after it, so each count +# uses one filter on its own and the others are derived by subtraction. +pcount() { tcpdump -r "$1" -nn "$2" 2>/dev/null | wc -l; } cmd_capture_stop() { local dir="${1:?dir}" name="${2:?name}" c n i role f @@ -649,21 +813,31 @@ cmd_capture_stop() { sleep 1 for c in "${CAPS[@]}"; do read -r n i role <<<"${c}" - q "${n}" sh -c "pkill -INT -f 'tcpdump -i ${i} -nn -e -s 128 -w /tmp/vt-${name}-${i}.pcap' || true" + # The bracket keeps the pattern from matching this sh -c itself, which + # pkill would otherwise interrupt before it stops tcpdump. + q "${n}" sh -c "pkill -INT -f '[t]cpdump -i ${i} -nn -e -s 128 -w /tmp/vt-${name}-${i}.pcap' || true" done sleep 1 for c in "${CAPS[@]}"; do read -r n i role <<<"${c}" f="${dir}/${name}-${n#clab-"${LAB}"-}-${i}.pcap" - docker cp "${n}:/tmp/vt-${name}-${i}.pcap" "${f}" >/dev/null 2>&1 || continue - local tot v1 v2 un drop - tot=$(tcpdump -r "${f}" -nn "not ${L2CTL}" 2>/dev/null | wc -l) - v1=$(tcpdump -r "${f}" -nn "vlan ${TAG_A:-101}" 2>/dev/null | wc -l) - v2=$(tcpdump -r "${f}" -nn "vlan ${TAG_B:-202}" 2>/dev/null | wc -l) - un=$(tcpdump -r "${f}" -nn "not vlan and not ${L2CTL}" 2>/dev/null | wc -l) + # docker cp cannot read the Kind nodes' /tmp, a tmpfs, so copy through + # the container instead. + if ! q "${n}" cat "/tmp/vt-${name}-${i}.pcap" >"${f}" 2>/dev/null || [ ! -s "${f}" ]; then + printf '%-18s %-12s %-5s capture missing\n' "${role}" "${n#clab-"${LAB}"-}" "${i}" + rm -f "${f}" + continue + fi + local all anyv l2 v1 v2 un drop + all=$(pcount "${f}" "") + anyv=$(pcount "${f}" vlan) + l2=$(pcount "${f}" "${L2CTL}") + v1=$(pcount "${f}" "vlan ${TAG_A:-101}") + v2=$(pcount "${f}" "vlan ${TAG_B:-202}") + un=$((all - anyv - l2)) drop=$(q "${n}" sh -c "grep -Eo '[0-9]+ packets dropped by kernel' /tmp/vt-${name}-${i}.err | cut -d' ' -f1" 2>/dev/null) printf '%-18s %-12s %-5s total=%-6s vlan%s=%-6s vlan%s=%-6s untagged=%-6s other-tag=%-4s capture-drops=%s\n' "${role}" "${n#clab-"${LAB}"-}" "${i}" \ - "${tot}" "${TAG_A:-101}" "${v1}" "${TAG_B:-202}" "${v2}" "${un}" "$((tot - v1 - v2 - un))" "${drop:-unknown}" + "$((all - l2))" "${TAG_A:-101}" "${v1}" "${TAG_B:-202}" "${v2}" "${un}" "$((anyv - v1 - v2))" "${drop:-unknown}" done | tee "${dir}/${name}-tags.txt" } @@ -694,6 +868,10 @@ case "${1:-}" in plan) shift; cmd_plan "$@" ;; apply) shift; cmd_apply "$@" ;; revert) cmd_revert ;; + repair) + for end in PUB_PEER PUB_EDGE FAB_EDGE FAB_PEER; do side_revert "${end}"; done + csum_restore + ;; status) cmd_status ;; offload) shift; cmd_offload "$@" ;; csum) shift; cmd_csum "$@" ;; @@ -702,5 +880,5 @@ case "${1:-}" in capture-stop) shift; cmd_capture_stop "$@" ;; tenant-capture-start) shift; cmd_tenant_capture_start "$@" ;; tenant-capture-stop) shift; cmd_tenant_capture_stop "$@" ;; - *) sed -n '2,44p' "$0"; exit 2 ;; + *) sed -n '2,46p' "$0"; exit 2 ;; esac diff --git a/docs/archive/README.md b/docs/archive/README.md index 2bdd91a0..9ef35576 100644 --- a/docs/archive/README.md +++ b/docs/archive/README.md @@ -15,5 +15,6 @@ Use the [current egress rollout checklist](../nat/active-active-rollout.md). In - [fabric-api full-table measurements, October 7](benchmarks/fabric-api-2026-10-07.md). - [Looking Glass qualification on the lab, October 27](benchmarks/looking-glass-qualification-2026-10-27.md). - [VLAN transport baseline, November 30](benchmarks/vlan-transport-baseline-2026-11-30.md): kernel probe results and the expected result of each path, before the transport work. +- [VLAN transport lab acceptance, November 30 to December 1](benchmarks/vlan-transport-acceptance-2026-11-30.md): the lab smoke pass of cells C1 and C4, and what the first lab run found. Use the [maintained load-test procedure](../fabric-api/load-test.md) and the [Looking Glass qualification procedure](../fabric-api/qualification.md) to qualify a new release. Record its revision, environment and result instead of replacing the older evidence. diff --git a/docs/archive/benchmarks/vlan-transport-acceptance-2026-11-30.md b/docs/archive/benchmarks/vlan-transport-acceptance-2026-11-30.md new file mode 100644 index 00000000..6a586ed6 --- /dev/null +++ b/docs/archive/benchmarks/vlan-transport-acceptance-2026-11-30.md @@ -0,0 +1,127 @@ +# VLAN transport lab acceptance, November 30 to December 1, 2026 + +This is the environment L report for issue [#1405](https://github.com/datum-cloud/galactic/issues/1405) under epic [#1399](https://github.com/datum-cloud/galactic/issues/1399). It checks the [transport contract](../../designs/vlan-transport/contract.md) against the [acceptance matrix](../../designs/vlan-transport/acceptance.md) in the containerlab lab. A lab result does not qualify hardware, a staging cell or a release. + +## Scope + +The smoke pass runs cells C1 and C4, native XDP, VLAN offload on, rows XM, NAA, V01 to V20 and POST, as the [lab scope](../../designs/vlan-transport/acceptance.md#lab-scope-for-1405) sets out. Every other cell, XDP mode and offload setting, and the reconfiguration and recovery rows V21 to V28, are gaps for [#1406](https://github.com/datum-cloud/galactic/issues/1406), not passes. + +```sh +cd deploy/containerlab +task verify:vlan-transport CELL="C1 C4" ROWS="XM NAA V01-V20 POST" XDP_MODES=native OFFLOADS=on CNI_SELECT=by-node +``` + +A failure that loses only a few TCP flows of the gateway ingress check, and passes on its one rerun, is recorded as FLAKE under lab bug [#1483](https://github.com/datum-cloud/galactic/issues/1483). Any other failure, or a second one, is FAIL. + +## Smoke pass results, December 1, 2026 + +| Item | Value | +| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Code | This branch at `2671ebe1`: the epic branch at `c72a7e9f`, with [#1548](https://github.com/datum-cloud/galactic/pull/1548), plus the harness. It predates [#1551](https://github.com/datum-cloud/galactic/pull/1551), the fix for [#1550](https://github.com/datum-cloud/galactic/issues/1550). | +| Deployment | Images built and the lab deployed from a dedicated worktree of this branch at `2671ebe1`, with no uncommitted changes | +| Environment (L) | containerlab 0.75.0 on host kernel 7.3.3; three Kind clusters; veth members in 802.3ad bonds | +| Run | C1 from 03:42 UTC, C4 from 04:10 UTC, native XDP, VLAN offload on, `CNI_SELECT=by-node`; each failing row rerun once; load average 1.9 at C1's start and 4.2 at the run's start | + +Each failing row failed the same way on its rerun, so none is a FLAKE. + +| Cell | Pass | Fail | Skip | N/A | Baseline | +| ---- | ---- | ---- | ---- | --- | -------- | +| C1 | 20 | 7 | 8 | 2 | 1 | +| C4 | 11 | 18 | 7 | 1 | 0 | + +### C1, untagged + +Passed: XM, NAA, V01 to V06, V08, V10, V12, V16 (wire), V17 (gateway), all six V18 invalid configurations, and V19 (galactic-cni). V09 recorded the untagged baseline: tenant traffic 1347 Mb/s out and 1360 Mb/s in with a 0.215 ms p99, and NAT 2858 Mb/s out and 2421 Mb/s in with a 0.123 ms p99. + +| Row | Result | Finding | Disposition | +| --------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| V07 | Fail | After a neighbour flush, `edge_lb` dropped one packet as `fib_no_neigh` where the kernel should have taken it; every flow answered | Code: [#1550](https://github.com/datum-cloud/galactic/issues/1550), fixed by [#1551](https://github.com/datum-cloud/galactic/pull/1551), which these images predate | +| V11, V13 | Fail | Kernel-tagged frames were claimed on the untagged side; no frame with its tag in packet data was | Harness: the [contract's note](../../designs/vlan-transport/contract.md#frame-handling-per-mode) accepts these. The corrected check, applied offline to this run's saved captures rather than observed live, passes | +| V17 (galactic-nat and -cni) | Fail | galactic-nat reported its bonds unassigned, sjc's edge galactic-cni its public side only, the compute node's galactic-cni its bond unassigned | Harness: contract section 1 gives exactly these roles. The corrected check, applied offline to this run's saved captures rather than observed live, passes | +| V19 (galactic-nat) | Fail | Auto-detection also selected `eth0` | Lab: Kind routes each node's IPv6 default through its management interface `eth0`. The check now leaves `eth0` out | + +### C4, tagged and tagged + +Passed: XM, V06, V12, V17 (gateway), all six V18 invalid configurations, and POST after the revert to C1. V17 for galactic-nat and galactic-cni reported the tagged sides correctly (`bond0.101 tagged 101 bond0`, `bond1.202 tagged 202 bond1`), and passes the corrected check. + +> [!IMPORTANT] +> C4's datapath rows give no verdict. Moving the side addresses onto the VLAN netdevices kept the BGP sessions up, so tr2 and the edge kept every BGP route through the untagged parents, and the traffic left untagged. The tagged sides correctly did not claim it. The harness now resets BGP after a move and waits for the routes to follow. + +| Row | Result | Finding | Disposition | +| ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| V01, V02, V05, V07, V08, V09, V10, V15, V16 | Void | Gateway, tenant, PMTU, throughput, same-node and third-VLAN traffic followed BGP routes through the untagged parents | Harness; rerun after the BGP fix | +| V03, V04 | Void | NAT66 and NAT64 traffic passed; only the wire check failed | Harness: frame counts combined `vlan` with other libpcap primitives, and the edge's and compute node's captures were not kept | +| V11, V13 | Fail | The tagged public side claimed untagged frames and frames with other IDs. Native `xdp_dispatch` was still on the bond members, and on `eth0`, beside the generic hooks on the VLAN netdevices | Code: stale XDP hooks after reconfiguration, [#1552](https://github.com/datum-cloud/galactic/issues/1552) | +| V19 (compute) | Fail | With no selection, the compute node selected `bond0` and `eth0`, not `bond0.202` | Unconfirmed: the stale BGP routes through `bond0` may cause it; the rerun after the BGP fix decides | + +The lab was returned to C1. Its first baseline after the run failed full-size transfers into sjc (`verify:mss-clamp`). After one repair of addresses and checksum offload, every baseline check passed. The native `xdp_dispatch` left on sjc-worker2's `eth0` remained ([#1552](https://github.com/datum-cloud/galactic/issues/1552)). + +The C4 rerun below repeated these rows after #1552 merged, with the BGP fix. + +## C4 rerun, December 1, 2026 + +| Item | Value | +| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Code | This branch at `3c685792`: the epic branch at `fd773e03`, with [#1551](https://github.com/datum-cloud/galactic/pull/1551) and [#1553](https://github.com/datum-cloud/galactic/pull/1553), plus the harness's BGP reset. It predates [#1560](https://github.com/datum-cloud/galactic/pull/1560) and [#1558](https://github.com/datum-cloud/galactic/pull/1558). | +| Deployment | Images built and the lab deployed from a dedicated worktree of this branch at `3c685792`, with no uncommitted changes | +| Run | C1's V07 at 08:03 UTC, then C4 from 08:05 to 08:41 UTC with its reruns, native XDP, VLAN offload on, `CNI_SELECT=by-node` | + +C1's V07 passed: after a neighbour flush the first reply took the kernel path, and nothing was dropped. + +In C4 the BGP reset moved every route onto the VLAN netdevices before any row ran: 24 checks passed, 5 failed (V07, V09, V10, and V15 on each side), 7 were skipped and 1 was N/A. Passed: XM, V01 to V06, V08, V11, V12, V13, V16 (wire, with no tag leakage on any link or at the tenant), V17 for every component, all six V18 invalid configurations, V19 (the compute node auto-detected its fabric side), and POST after the revert to C1. + +Each failing row failed the same way on its rerun. Cilium reloaded its netdev programs only at 08:40 and 08:41, during the revert, after every row and rerun, so no failure is a lab artifact of those reloads. + +| Row | Finding | Disposition | +| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| V07 | After a neighbour flush on tagged sides, the edge dropped 3 and then 4 replies as conntrack `INVALID`: they took the kernel's forwarding path, not `edge_return` | Code: [#1555](https://github.com/datum-cloud/galactic/issues/1555) | +| V10 | Same-node delivery through a tagged public side on dfw-worker3 timed out for IPv6 and IPv4 | Code: [#1556](https://github.com/datum-cloud/galactic/issues/1556), fixed by [#1560](https://github.com/datum-cloud/galactic/pull/1560) after these images | +| V15 | A third VLAN on each side's parent carried traffic from the edge, but none from tr2 or the compute node to the edge | No Galactic defect ([#1557](https://github.com/datum-cloud/galactic/issues/1557)): Cilium drops a VLAN it has not yet adopted. The check is changed to wait for one round trip each way, at most 60 s, before measuring; the final retest below used it | +| V09 | Against the C1 baseline of the smoke pass: 64% to 75% of the tenant throughput, 89% to 92% for NAT, and a p99 latency 9% to 17% higher | Accepted cost of generic XDP on a tagged side ([contract §8](../../designs/vlan-transport/contract.md#measurement-and-recovery-targets)); [#1406](https://github.com/datum-cloud/galactic/issues/1406) measures it on hardware | + +The lab was returned to C1, and every baseline check passed on the first try. The final retest below repeated V07, V10 and V15 after their fixes merged. + +## Final C4 retest, December 1, 2026 + +| Item | Value | +| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Code | `b087178d`, since rebased: the epic branch at `f8cf46f2`, with every fix the earlier runs led to: [#1551](https://github.com/datum-cloud/galactic/pull/1551), [#1553](https://github.com/datum-cloud/galactic/pull/1553), [#1558](https://github.com/datum-cloud/galactic/pull/1558), [#1559](https://github.com/datum-cloud/galactic/pull/1559) and [#1560](https://github.com/datum-cloud/galactic/pull/1560). Its tree differs from this report's head only in this report, a probe-stop fix in the interrupt script and three Go test strings | +| Deployment | Images built and the lab deployed from a dedicated worktree of this branch at `b087178d`, with no uncommitted changes, after recovering a lab another session had left part-deployed | +| Run | C4 from 15:47 UTC, native XDP, VLAN offload on, `CNI_SELECT=by-node`, rows V07, V10 and V15 | + +Every check passed on its first run, so nothing was rerun: + +| Row | Result | Observed | +| ------------ | ------ | ------------------------------------------------------------------------------------------------------ | +| V07 | Pass | After a neighbour flush on the tagged sides the first reply took the kernel path, with nothing dropped | +| V10 | Pass | Same-node delivery through dfw-worker3's tagged public side answered for IPv6 and IPv4 | +| V15 (public) | Pass | Cilium admitted the third VLAN after 12 s; then 20 of 20 pings each way, 168 frames tagged with its ID | +| V15 (fabric) | Pass | Cilium admitted the third VLAN after 25 s; then 20 of 20 pings each way, 168 frames tagged with its ID | + +While the new VLAN waited, Cilium's "VLAN traffic disallowed by VLAN filter" drop counter rose on both the edge and the compute node, as [#1557](https://github.com/datum-cloud/galactic/issues/1557) found. Cilium reloaded its netdev programs on sjc and dfw while the rows ran, as the VLAN changes caused, and no row failed. The lab was returned to C1 with every baseline check passing. + +With this retest, every smoke-pass row in C1 and C4 either passes, is a skip listed above, or is the accepted tagged-side cost of V09. + +## First lab run, November 30, 2026 + +The first run of the full matrix, at the epic branch head plus the harness, stopped during cell C1 because of harness faults. No C1 result counts as acceptance. The run did find the following, by row: + +| Row | Finding | Disposition | +| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| V11, V13 | `edge_lb` claimed frames whose tag the kernel carried as metadata on the untagged public side. It claimed none whose tag was in packet data. | Accepted in the [contract's frame handling note](../../designs/vlan-transport/contract.md#frame-handling-per-mode) | +| V17 | `galactic-nat` reported its uplinks' bond members, not the logical interfaces, as its sides | Code fix under #1399 | +| V18 | `galactic-gateway` and `galactic-nat` logged each invalid VLAN interface with its rule, but stayed ready | Code fix under #1399 ([#1548](https://github.com/datum-cloud/galactic/pull/1548)) | +| V18 | `galactic-nat` accepted an uplink listed twice | Contract §1 rule 2 now requires `sides_overlap`; [#1548](https://github.com/datum-cloud/galactic/pull/1548) | +| V07 | One `fib_no_neigh` drop on the edge after a neighbour flush, with every flow answered | Reproduced in the smoke pass: [#1550](https://github.com/datum-cloud/galactic/issues/1550) | +| V10, V12, XM, NAA | Passed | Rerun in the smoke pass | +| V01 to V06, V08, V16 | The traffic checks passed, but no wire capture was summarised and the neighbour check misread its file | Harness faults, fixed | +| V17, V19 | The harness expected a parent on untagged sides and sides the lab does not configure, and unset gateway settings the contract never auto-detects | Harness faults, fixed | +| V21 | Reverting an untagged side on a plain NIC parent left its addresses on the bond member | Harness fault, fixed | + +The harness faults, all fixed before the smoke pass: + +- `capture-stop` interrupted itself through `pkill -f`, so no capture was summarised. +- A revert left an untagged NIC parent's addresses on its bond member, and turned on transmit checksum offload, which containerlab creates off. +- Several checks expected values the contract or the lab does not give. + +`verify:nat-active-active`, which had failed once during a lab recovery before this run, passed on the epic branch three times. diff --git a/docs/designs/vlan-transport/acceptance.md b/docs/designs/vlan-transport/acceptance.md index be9bd6e5..0c545986 100644 --- a/docs/designs/vlan-transport/acceptance.md +++ b/docs/designs/vlan-transport/acceptance.md @@ -18,7 +18,27 @@ Performance and recovery targets are relative to the untagged baseline that [#14 | L | Containerlab with a tagged variant, run from `deploy/containerlab`, generic and native XDP on veth-backed bonds | Variant: [#1401](https://github.com/datum-cloud/galactic/issues/1401). Automation: [#1405](https://github.com/datum-cloud/galactic/issues/1405) | | H | Hardware with the target NICs and bonds; named by the epic's open hardware decision | [#1406](https://github.com/datum-cloud/galactic/issues/1406) | -`task verify:vlan-transport` in `deploy/containerlab` runs the L rows, taking a cell and row filter, and writes a row-by-row report ([README](../../../deploy/containerlab/README.md#acceptance-run)). It drives the lab variant in `deploy/containerlab/scripts/vlan-transport.sh`. No L row has run yet; [#1405](https://github.com/datum-cloud/galactic/issues/1405) runs them. +`task verify:vlan-transport` in `deploy/containerlab` runs the L rows, taking a cell and row filter, and writes a row-by-row report ([README](../../../deploy/containerlab/README.md#acceptance-run)). It drives the lab variant in `deploy/containerlab/scripts/vlan-transport.sh`. The [lab acceptance report](../../archive/benchmarks/vlan-transport-acceptance-2026-11-30.md) records what has run. + +### Lab scope for #1405 + +[#1405](https://github.com/datum-cloud/galactic/issues/1405) runs a tagged smoke pass in environment L, about two hours: + +```sh +task verify:vlan-transport CELL="C1 C4" ROWS="XM NAA V01-V20 POST" XDP_MODES=native OFFLOADS=on CNI_SELECT=by-node +``` + +C1 is the untagged control and the baseline for C4's V09. Everything else in the L column moves to [#1406](https://github.com/datum-cloud/galactic/issues/1406) hardware qualification as an explicit gap, not a pass: + +| Moved to #1406 | Rows | +| ----------------------------------------------- | ---------- | +| Cells C2, C3, C5, C6, C4 with other IDs (C4ALT) | Every row | +| Active-backup bonds (C1AB, C4AB) | Every row | +| Generic XDP mode | Every row | +| VLAN receive and transmit offload off | Every row | +| Reconfiguration and recovery, in every cell | V21 to V28 | + +The harness still runs all of them: `task verify:vlan-transport` with no filters runs the full matrix. ## Configuration cells @@ -69,7 +89,7 @@ Run each row in every cell, in native and generic XDP mode where the environment | V06 | Control plane | BGP sessions on each side establish and stay up; ND and ARP resolve on each logical interface; node management traffic works. | P8 | L, H | [#1401](https://github.com/datum-cloud/galactic/issues/1401) baseline, [#1405](https://github.com/datum-cloud/galactic/issues/1405) | | V07 | Cold and warm neighbours | Repeat V01 to V04 after flushing the next hop's neighbour entry: the first packets take the kernel fallback (`neigh_fallbacks` rises) and later ones stay in XDP. | P1, P3–P5 | L | [#1403](https://github.com/datum-cloud/galactic/issues/1403) | | V08 | MTU, TCP, UDP and ICMP errors | At the side's IP MTU, full-size packets deliver in V01 to V05; one byte over draws the existing Packet Too Big or Fragmentation Needed where the gateway or CNI sends one today, and is otherwise dropped and counted. The wire frame is IP MTU + 18 bytes when tagged. | P1–P7 | L, H | [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | -| V09 | Throughput and latency | Per direction, against the untagged baseline: throughput at least 90%, p99 latency at most baseline plus 10%. | P1–P7 | H, L | [#1406](https://github.com/datum-cloud/galactic/issues/1406) | +| V09 | Throughput and latency | Per direction, against the untagged baseline: throughput at least 90%, p99 latency at most baseline plus 10%. A tagged side on a native host may miss both, an accepted cost ([contract §8](contract.md#measurement-and-recovery-targets)). | P1–P7 | H, L | [#1406](https://github.com/datum-cloud/galactic/issues/1406) | ### Same-node gateway delivery @@ -81,14 +101,14 @@ Required with `GALACTIC_GATEWAY_LOCAL_DELIVERY` on ([contract §3](contract.md#3 ## Isolation -| ID | Criterion | Executable check and pass condition | Env | Owner | -| --- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| V11 | Wrong VLAN | Send VIP, shard and SID traffic on each side with a VLAN ID that is not that side's. No Galactic program claims it; no backend, shard or tenant receives it. | U, L | [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | -| V12 | Priority-tagged, double-tagged, 802.1ad, malformed | As V11 with VLAN ID 0, two tags, an 802.1ad outer tag, and a truncated tag header. None is claimed or delivered. | U, L | [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | -| V13 | Unexpected tagged or untagged | Untagged traffic on a tagged side and tagged traffic on an untagged side, addressed to a VIP, shard or SID: not claimed or delivered. Valid untagged traffic in untagged mode passes (V01 to V05 in C1). | U, L | [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | -| V14 | Two VLANs on one parent | In C5, run V01 to V05 together, plus V11 between the two VLANs. Each VLAN's traffic is claimed only for its own side, on both tc and XDP paths. How XDP tells the VLANs apart is contract question Q3. | L, H | [#1401](https://github.com/datum-cloud/galactic/issues/1401) feasibility, [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | -| V15 | Unrelated trunk traffic | A third VLAN on a side's parent, carrying ordinary host traffic, reaches its own netdevice in both directions with its own tag; Galactic counters show it unclaimed. | L, H | [#1402](https://github.com/datum-cloud/galactic/issues/1402) | -| V16 | No leakage, no cross-tenant delivery | Across every V01 to V15 capture: zero frames with the other side's tag, zero tagged frames at tenants. Two VPCs with identical prefixes on tagged sides: zero cross-VPC packets, including after restart and with cold neighbours. Absolute. | L, H | [#1405](https://github.com/datum-cloud/galactic/issues/1405) | +| ID | Criterion | Executable check and pass condition | Env | Owner | +| --- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| V11 | Wrong VLAN | Send VIP, shard and SID traffic on each side with a VLAN ID that is not that side's. No Galactic program claims it; no backend, shard or tenant receives it. | U, L | [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | +| V12 | Priority-tagged, double-tagged, 802.1ad, malformed | As V11 with VLAN ID 0, two tags, an 802.1ad outer tag, and a truncated tag header. None is claimed or delivered. | U, L | [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | +| V13 | Unexpected tagged or untagged | Untagged traffic on a tagged side and tagged traffic on an untagged side, addressed to a VIP, shard or SID: not claimed or delivered. On an untagged side this holds for a tag in packet data ([contract §6 note](contract.md#frame-handling-per-mode)). Valid untagged traffic in untagged mode passes (V01 to V05 in C1). | U, L | [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | +| V14 | Two VLANs on one parent | In C5, run V01 to V05 together, plus V11 between the two VLANs. Each VLAN's traffic is claimed only for its own side, on both tc and XDP paths. How XDP tells the VLANs apart is contract question Q3. | L, H | [#1401](https://github.com/datum-cloud/galactic/issues/1401) feasibility, [#1402](https://github.com/datum-cloud/galactic/issues/1402), [#1403](https://github.com/datum-cloud/galactic/issues/1403) | +| V15 | Unrelated trunk traffic | A third VLAN on a side's parent, carrying ordinary host traffic, reaches its own netdevice in both directions with its own tag; Galactic counters show it unclaimed. | L, H | [#1402](https://github.com/datum-cloud/galactic/issues/1402) | +| V16 | No leakage, no cross-tenant delivery | Across every V01 to V15 capture: zero frames with the other side's tag, zero tagged frames at tenants. Two VPCs with identical prefixes on tagged sides: zero cross-VPC packets, including after restart and with cold neighbours. Absolute. | L, H | [#1405](https://github.com/datum-cloud/galactic/issues/1405) | ## Validation and diagnostics diff --git a/docs/designs/vlan-transport/contract.md b/docs/designs/vlan-transport/contract.md index 2b2b3422..cfaaa950 100644 --- a/docs/designs/vlan-transport/contract.md +++ b/docs/designs/vlan-transport/contract.md @@ -45,7 +45,7 @@ The settings are defined in `internal/config/gateway.go:39`, `:51`, `internal/co Rules: 1. **Explicit selection when detection is ambiguous.** Unset, `galactic-cni` and `galactic-nat` auto-detect the interfaces that carry the IPv6 default route and BGP-learned routes (`ResolveInterfaces` and `DetectUplinks`, `internal/plumbing/ebpf/attach/interfaces.go:66`, `:95`). Auto-detection cannot tell public from fabric. On an edge node whose two sides use different logical interfaces, the operator names every interface of both sides explicitly. Auto-detection stays supported where a node has one side, or where both sides share one untagged interface as they do today. -2. **No side overwrites the other.** The public and fabric logical interfaces of one node must be different netdevices. `galactic-gateway` already refuses internal interfaces that resolve onto its public targets (`cmd/galactic-gateway/gateway.go:158`); the same rule applies to every component and to tagged sides. Two VLANs on one parent are different netdevices and are allowed (see [§6](#6-supported-topologies)). +2. **No side overwrites the other.** The public and fabric logical interfaces of one node must be different netdevices. `galactic-gateway` already refuses internal interfaces that resolve onto its public targets (`cmd/galactic-gateway/gateway.go:158`); the same rule applies to every component and to tagged sides. Two VLANs on one parent are different netdevices and are allowed (see [§6](#6-supported-topologies)). `galactic-nat` has no public and fabric split, so for it the rule means refusing an uplink listed twice, as `sides_overlap` ([#1548](https://github.com/datum-cloud/galactic/pull/1548)). 3. **No shared-ID assumption.** No component compares or copies a VLAN ID between sides. A side's ID is read only from its own logical interface. ## 2. Routed public adjacency @@ -179,19 +179,26 @@ Other requirements: ### Frame handling per mode -| Frame received on a side | Untagged mode | Tagged mode | -| --------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| Untagged | Processed | Not claimed by any Galactic program; the kernel handles it as parent traffic | -| Tagged with this side's ID | Not claimed; the kernel handles it (no VLAN netdevice exists) | Processed | -| Tagged with another ID | Not claimed | Not claimed; delivered to that VLAN's own netdevice or dropped by the kernel | -| Priority-tagged (VLAN ID 0) | Not claimed | Not claimed | -| Two tags, or 802.1ad outer tag | Not claimed | Not claimed | -| Malformed tag or truncated header | Not claimed | Not claimed | +| Frame received on a side | Untagged mode | Tagged mode | +| --------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| Untagged | Processed | Not claimed by any Galactic program; the kernel handles it as parent traffic | +| Tagged with this side's ID | Not claimed; the kernel handles it (no VLAN netdevice exists); see note | Processed | +| Tagged with another ID | Not claimed; see note | Not claimed; delivered to that VLAN's own netdevice or dropped by the kernel | +| Priority-tagged (VLAN ID 0) | Not claimed | Not claimed | +| Two tags, or 802.1ad outer tag | Not claimed | Not claimed | +| Malformed tag or truncated header | Not claimed | Not claimed | "Not claimed" means no Galactic program forwards, translates or delivers the frame to a tenant. It continues to the kernel unchanged, so unrelated trunk traffic keeps its intended path. A Galactic program never forwards a frame between the two sides at Layer 2, and never delivers a frame to a tenant with a transit tag. Other programs on the parent, such as a cluster CNI's VLAN filter, are outside this contract and can still drop a VLAN's frames there, for example until they admit a VLAN netdevice added later. `TestVLANTransport_UnrelatedVLANHostTraffic` (`internal/plumbing/ebpf/edgeattach`) shows Galactic's own hooks carry such a VLAN both ways. +**Note: receive VLAN offload on an untagged side.** The two noted rows hold when the tag is in packet data. With receive VLAN offload on, a single 802.1Q tag is in skb metadata, which native XDP on the untagged side's interface cannot read. The side may then claim the frame as untagged when it is addressed to that side's VIP, shard or SID. This is accepted: + +- Q8 excludes any other VLAN on an untagged side's parent, so such a frame can only come from the one peer on that link. +- It reaches only what the same peer reaches untagged, and tenant isolation is unaffected. + +[Acceptance row V13](acceptance.md#isolation) stays strict for a tag in packet data. A device-bound program could read the tag with `bpf_xdp_metadata_rx_vlan_tag` and close the gap. That is a possible [#1406](https://github.com/datum-cloud/galactic/issues/1406) follow-up, only if a target NIC needs it. + ## 7. Ownership | Resource | Owner | @@ -231,7 +238,9 @@ Targets are relative to the untagged baseline that [#1401](https://github.com/da | Latency, p99 per direction | At most the untagged p99 plus 10% | As above | | Recovery after each event in [§5](#reconfiguration) | At most the untagged baseline for the same event plus 1 s | Tagging must not add a recovery step. The 1 s covers netdevice recreation and the 20 ms sampling uncertainty. | -On a host whose mode is native, a tagged side runs its XDP hooks in generic mode, which builds an skb for every frame before the program runs. Its throughput and latency can therefore miss the targets above against a native untagged baseline, even though nothing falls back to the kernel stack. [#1405](https://github.com/datum-cloud/galactic/issues/1405) and [#1406](https://github.com/datum-cloud/galactic/issues/1406) measure that cost. A host already in generic mode, such as one with a `bnxt_en` NIC, pays nothing extra. +On a host whose mode is native, a tagged side runs its XDP hooks in generic mode on its VLAN netdevice, which builds an skb for every frame before the program runs. Its throughput and latency may therefore miss the targets above against a native untagged baseline, even though nothing falls back to the kernel stack. This cost is accepted. A host already in generic mode, such as one with a `bnxt_en` NIC, pays nothing extra. + +The [lab](../../archive/benchmarks/vlan-transport-acceptance-2026-11-30.md) measured it on veth bonds in cell C4, against the earlier C1 baseline of its smoke pass: 64% to 75% of the untagged tenant throughput, 89% to 92% for NAT, and a p99 latency 9% to 17% higher. [#1406](https://github.com/datum-cloud/galactic/issues/1406) measures it on the target hardware. [#1401](https://github.com/datum-cloud/galactic/issues/1401) records the baselines. If a baseline itself fails, it is discovery evidence, not acceptance, and the target is revisited in the epic. diff --git a/internal/plumbing/ebpf/edgeattach/vlan_conntrack_root_test.go b/internal/plumbing/ebpf/edgeattach/vlan_conntrack_root_test.go index d87c1796..ac1e766d 100644 --- a/internal/plumbing/ebpf/edgeattach/vlan_conntrack_root_test.go +++ b/internal/plumbing/ebpf/edgeattach/vlan_conntrack_root_test.go @@ -195,8 +195,8 @@ func TestVLANTransport_ColdNeighborReplyEscapesConntrack(t *testing.T) { ether uint16 } families := []family{ - {name: "ipv6", vip: vtVIP, client: vtClient, router: vtPubRtr, ether: 0x86DD}, - {name: "ipv4", vip: vtVIP4, client: vtClient4, router: vtPubRtr4, ether: 0x0800}, + {name: vtFamV6, vip: vtVIP, client: vtClient, router: vtPubRtr, ether: 0x86DD}, + {name: vtFamV4, vip: vtVIP4, client: vtClient4, router: vtPubRtr4, ether: 0x0800}, } for modeName, mode := range vtHostModes(t) { for _, topo := range []vtTopo{ diff --git a/internal/plumbing/ebpf/edgeattach/vlan_local_exchange_root_test.go b/internal/plumbing/ebpf/edgeattach/vlan_local_exchange_root_test.go index ab568a18..d3956e69 100644 --- a/internal/plumbing/ebpf/edgeattach/vlan_local_exchange_root_test.go +++ b/internal/plumbing/ebpf/edgeattach/vlan_local_exchange_root_test.go @@ -82,8 +82,8 @@ func vxFamilies() []vxFamily { seen := [16]byte{0, 0x64, 0xff, 0x9b} copy(seen[12:], c4[:]) return []vxFamily{ - {name: "ipv6", vip: vtVIP, client: vtClient, seen: vtClient}, - {name: "ipv4", vip: vtVIP4, client: vtClient4, seen: netip.AddrFrom16(seen)}, + {name: vtFamV6, vip: vtVIP, client: vtClient, seen: vtClient}, + {name: vtFamV4, vip: vtVIP4, client: vtClient4, seen: netip.AddrFrom16(seen)}, } } diff --git a/internal/plumbing/ebpf/edgeattach/vlan_root_test.go b/internal/plumbing/ebpf/edgeattach/vlan_root_test.go index 0bb22635..823350ad 100644 --- a/internal/plumbing/ebpf/edgeattach/vlan_root_test.go +++ b/internal/plumbing/ebpf/edgeattach/vlan_root_test.go @@ -45,6 +45,10 @@ import ( // parent. Each case runs once per host mode, as GALACTIC_XDP_MODE forces it. // All addresses are documentation or unique local ranges. const ( + // The address family names that subtests are called by. + vtFamV4 = "ipv4" + vtFamV6 = "ipv6" + vtPubVID = 101 vtOtherVID = 202 vtFabVID = 303 @@ -978,8 +982,8 @@ func TestVLANTransport_ColdClientNeighborReturnFallsBack(t *testing.T) { frame func(net.HardwareAddr, netip.Addr, netip.Addr, uint16, uint16, []byte) []byte } families := []family{ - {name: "ipv6", vip: vtVIP, client: vtClient, router: vtPubRtr, ether: 0x86DD, frame: vtFrame}, - {name: "ipv4", vip: vtVIP4, client: vtClient4, router: vtPubRtr4, ether: 0x0800, frame: vtFrame4}, + {name: vtFamV6, vip: vtVIP, client: vtClient, router: vtPubRtr, ether: 0x86DD, frame: vtFrame}, + {name: vtFamV4, vip: vtVIP4, client: vtClient4, router: vtPubRtr4, ether: 0x0800, frame: vtFrame4}, } for modeName, mode := range vtHostModes(t) { for _, topo := range []vtTopo{