Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions deploy/containerlab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,29 @@ what lived in its network namespace: its gvpc.clab.yaml links (through
sysctls and exec commands, its peers' bonds, the pass-through XDP programs and
its addresses. The script works for any Kind node of the topology.

### Tagged transport variant

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) except C5, which point-to-point links cannot build. `PUB_VID` and `FAB_VID` override a cell's IDs.
- `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. `apply` gives sjc-worker2 its own copy, `galactic-cni-vt-edge`, and excludes that node from the original.
- `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.
- `VT_SITE=dfw-worker3` re-plumbs only dfw-worker3's public side. It exists for the same-node delivery row, which `verify:edge-listener` runs on dfw. Set `EDGE_CONFORMANCE_UPLINK_DEV=dfw-worker3=bond2.101` so the test pins its VIP through the VLAN.

```bash
task variant:vlan-transport:plan CELL=C4 SELECT=logical # no lab needed
task variant:vlan-transport:apply CELL=C4 SELECT=parent PUB_VID=1234 FAB_VID=3456
task baseline:vlan-transport CELL=C4 SELECT=parent OUT=/tmp/c4 ROWS="V06 V01 V03 V05"
task variant:vlan-transport:revert
```

`baseline:vlan-transport` (`scripts/vlan-transport-baseline.sh`) records the cell's rows. It captures on the receiving end of every transport link, on bond members, so the tag shows whether it travels in the frame or in skb metadata. It also records the gateway and NAT counters that moved and the components' interface log lines. Isolation (`vlan-transport-inject.sh`, with `vlan-inject.py` for raw frames) and interruption timing (`vlan-transport-interrupt.sh`) have their own scripts.

`verify-gateway-ingress*.sh` take `UPLINK_DEV="sjc-worker2=bond1.101"` to pin through a tagged transit-side device.

Hold a containerlab-manager reservation for everything except `plan`, and end with `revert` and the sjc checks: `verify-gateway-ingress*.sh --node sjc-worker2`, `verify:nat-datapath SENDER_SITE=sjc SHARD_NODE=sjc-worker2 SHARD_SITE=sjc`, `verify-ns20.sh` and `verify:bonds`. The [baseline report](../../docs/archive/benchmarks/vlan-transport-baseline-2026-11-30.md) lists which rows have run.

## Notes

- All three Kind clusters use `disableDefaultCNI: true`. Cilium and Multus are installed
Expand Down
46 changes: 46 additions & 0 deletions deploy/containerlab/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,52 @@ tasks:
cmds:
- ./scripts/verify-ns40.sh

# Run every vlan-transport target except plan inside a containerlab-manager
# reservation, and end with variant:vlan-transport:revert (README).
"variant:vlan-transport:plan":
desc: Print what applying a transport cell would change, without touching the lab (CELL=, SELECT=)
requires:
vars: [CELL]
cmds:
- >-
{{if .PUB_VID}}PUB_VID={{.PUB_VID}} {{end}}{{if .FAB_VID}}FAB_VID={{.FAB_VID}} {{end}}
./scripts/vlan-transport.sh plan {{.CELL}} {{.SELECT | default "logical"}}

"variant:vlan-transport:apply":
desc: Apply a transport cell to sjc (CELL=, SELECT=, PUB_VID=, FAB_VID=)
requires:
vars: [CELL]
cmds:
- >-
LAB={{.LAB}} {{if .PUB_VID}}PUB_VID={{.PUB_VID}} {{end}}{{if .FAB_VID}}FAB_VID={{.FAB_VID}} {{end}}
./scripts/vlan-transport.sh apply {{.CELL}} {{.SELECT | default "logical"}}

"variant:vlan-transport:revert":
desc: Return sjc to untagged transport (C1) with its deployed Galactic settings
cmds:
- LAB={{.LAB}} ./scripts/vlan-transport.sh revert

"variant:vlan-transport:offload":
desc: Turn VLAN receive and transmit offload on or off on every sjc transport member (STATE=on|off)
requires:
vars: [STATE]
cmds:
- LAB={{.LAB}} ./scripts/vlan-transport.sh offload {{.STATE}}

"variant:vlan-transport:status":
desc: Show the applied transport cell and sjc's transport interfaces
cmds:
- LAB={{.LAB}} ./scripts/vlan-transport.sh status

"baseline:vlan-transport":
desc: Apply a transport cell and record its traffic rows with captures (CELL=, SELECT=, OUT=, ROWS=); does not revert
requires:
vars: [CELL, OUT]
cmds:
- >-
LAB={{.LAB}} {{if .PUB_VID}}PUB_VID={{.PUB_VID}} {{end}}{{if .FAB_VID}}FAB_VID={{.FAB_VID}} {{end}}
./scripts/vlan-transport-baseline.sh {{.CELL}} {{.SELECT | default "logical"}} {{.OUT}} {{.ROWS | default "V06 V01 V03 V05 V07"}}

clean:
desc: Destroy the lab and delete artifacts
cmds:
Expand Down
38 changes: 38 additions & 0 deletions deploy/containerlab/resources/vlan-transport/cells.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Configuration cells for the tagged/untagged transport variant
# (scripts/vlan-transport.sh), from docs/designs/vlan-transport/acceptance.md.
# Each cell sets, per side, the VLAN ID (empty: untagged) and the kind of
# parent the side's logical interface sits on. VLAN IDs are synthetic and
# overridable at apply time (PUB_VID=, FAB_VID=), so a run can prove that the
# operator-selected ID, not a fixture constant, is what reaches the wire.
#
# The variant runs on the sjc site. Contract name to lab interface:
# bondpub sjc-worker2 bond0 (peer tr2 bond1) public side
# bondfab sjc-worker2 bond1 (peer sjc-worker bond0) fabric side
# PARENT=nic takes each side's first bond member out of its bond on both ends
# and uses that veth as a plain NIC.
#
# C5 (two VLANs on one parent) is not a lab cell: the lab's links are
# point-to-point, so one parent cannot reach both the external router and the
# compute node. Its kernel behaviour is measured by the vlanprobe root test
# (internal/plumbing/ebpf/vlanprobe).

# cell public-VID fabric-VID parent
C1_PUB_VID=
C1_FAB_VID=
C1_PARENT=bond

C2_PUB_VID=101
C2_FAB_VID=
C2_PARENT=bond

C3_PUB_VID=
C3_FAB_VID=202
C3_PARENT=bond

C4_PUB_VID=101
C4_FAB_VID=202
C4_PARENT=bond

C6_PUB_VID=101
C6_FAB_VID=202
C6_PARENT=nic
14 changes: 14 additions & 0 deletions deploy/containerlab/scripts/verify-gateway-ingress-ipv4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ case "${1:-}" in
esac

transit() { docker exec "clab-${LAB}-$1" "${@:2}"; }

uplink_dev() {
local pair
local list=${UPLINK_DEV:-}
for pair in ${list//,/ }; do
if [ "${pair%%=*}" = "$1" ]; then
echo "${pair#*=}"
return
fi
done
echo "$2"
}
client() { docker exec "clab-${LAB}-remote-host" "$@"; }

unpin_all() {
Expand Down Expand Up @@ -361,6 +373,8 @@ for site in "${SITES[@]}"; do
[ -z "${only}" ] || [ "${only}" = "${gw}" ] || continue
want_pins=$((want_pins + 1))
read -r tr nexthop dev <<<"${UPLINK[${gw}]}"
# UPLINK_DEV: see the README's tagged transport variant section.
dev=$(uplink_dev "${gw}" "${dev}")
echo "--- ${site}: ${vip} through ${gw} (pinned on ${tr}) ---"
if ! transit "${tr}" ip -4 route replace "${vip}/32" via "${nexthop}" dev "${dev}"; then
fail "could not pin ${vip} to ${gw} on ${tr}"
Expand Down
14 changes: 14 additions & 0 deletions deploy/containerlab/scripts/verify-gateway-ingress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ esac

transit() { docker exec "clab-${LAB}-$1" "${@:2}"; }

uplink_dev() {
local pair
local list=${UPLINK_DEV:-}
for pair in ${list//,/ }; do
if [ "${pair%%=*}" = "$1" ]; then
echo "${pair#*=}"
return
fi
done
echo "$2"
}

unpin_all() {
local site tr
for site in "${SITES[@]}"; do
Expand Down Expand Up @@ -172,6 +184,8 @@ for site in "${SITES[@]}"; do
[ -z "${only}" ] || [ "${only}" = "${gw}" ] || continue
checked=$((checked + 1))
read -r tr nexthop dev <<<"${UPLINK[${gw}]}"
# UPLINK_DEV: see the README's tagged transport variant section.
dev=$(uplink_dev "${gw}" "${dev}")
echo "--- ${site}: ${vip} through ${gw} (pinned on ${tr}) ---"
transit "${tr}" ip -6 route replace "${vip}/128" via "${nexthop}" dev "${dev}"

Expand Down
80 changes: 80 additions & 0 deletions deploy/containerlab/scripts/vlan-inject.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env python3
# vlan-inject.py -- send crafted IPv6/UDP frames with chosen 802.1Q/802.1ad
# headers out of one interface, for the isolation rows of the tagged
# transport baseline (docs/designs/vlan-transport/acceptance.md V11 to V13).
# Runs inside a lab node (tr2 or a Kind node), which has python3. Standard
# library only.
#
# vlan-inject.py IFACE DST_MAC SRC_IP6 DST_IP6 DPORT CASE COUNT
#
# CASE is one of:
# untagged no tag
# q:VID one 802.1Q tag
# prio 802.1Q with VLAN ID 0 (priority tag)
# qq:VID1:VID2 two 802.1Q tags
# ad:VID1:VID2 802.1ad outer tag, 802.1Q inner tag
# trunc:VID 802.1Q tag with the frame cut inside the tag header
import socket
import struct
import sys


def csum(data):
if len(data) % 2:
data += b"\0"
s = sum(struct.unpack("!%dH" % (len(data) // 2), data))
while s >> 16:
s = (s & 0xFFFF) + (s >> 16)
return (~s) & 0xFFFF


def ipv6_udp(src, dst, sport, dport, payload):
s = socket.inet_pton(socket.AF_INET6, src)
d = socket.inet_pton(socket.AF_INET6, dst)
length = 8 + len(payload)
udp = struct.pack("!HHHH", sport, dport, length, 0) + payload
pseudo = s + d + struct.pack("!I3xB", length, 17)
c = csum(pseudo + udp) or 0xFFFF
udp = udp[:6] + struct.pack("!H", c) + udp[8:]
hdr = struct.pack("!IHBB", 6 << 28, length, 17, 64) + s + d
return hdr + udp


def tags(case):
kind, _, rest = case.partition(":")
ids = [int(x) for x in rest.split(":")] if rest else []
if kind == "untagged":
return b"", False
if kind == "q":
return struct.pack("!HH", 0x8100, ids[0]), False
if kind == "prio":
return struct.pack("!HH", 0x8100, 0), False
if kind == "qq":
return struct.pack("!HHHH", 0x8100, ids[0], 0x8100, ids[1]), False
if kind == "ad":
return struct.pack("!HHHH", 0x88A8, ids[0], 0x8100, ids[1]), False
if kind == "trunc":
return struct.pack("!HH", 0x8100, ids[0]), True
raise SystemExit("unknown case " + case)


def main():
iface, dst_mac, src, dst, dport, case, count = sys.argv[1:8]
sock = socket.socket(socket.AF_PACKET, socket.SOCK_RAW)
sock.bind((iface, 0))
src_mac = sock.getsockname()[4]
dmac = bytes.fromhex(dst_mac.replace(":", ""))
tag, truncate = tags(case)
sent = 0
for i in range(int(count)):
body = ipv6_udp(src, dst, 40000 + i, int(dport), b"vlan-inject %s %d" % (case.encode(), i))
frame = dmac + src_mac + tag + struct.pack("!H", 0x86DD) + body
if truncate:
frame = dmac + src_mac + tag[:3]
sock.send(frame)
sent += 1
print("sent %d %s frames on %s" % (sent, case, iface))


if __name__ == "__main__":
main()
Loading
Loading