From 039d09d3586ac18858e775307e81d516b1e3a7ed Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Wed, 1 Apr 2026 22:39:08 +0200 Subject: [PATCH] Consolidate FRR+Bird+VPP into /config for bind-mounting; Move to multitool for the linux client, it has SSH --- BUILDING.md | 4 ++-- docker/Dockerfile | 4 +++- docker/files/etc/vpp/bootstrap.vpp | 14 ++++++++++++-- docker/files/etc/vpp/{ => config}/clab.vpp | 0 docker/files/etc/vpp/config/manual-post.vpp | 1 + docker/files/etc/vpp/config/manual-pre.vpp | 1 + docker/files/etc/vpp/config/vppcfg.vpp | 1 + docker/files/init-container.sh | 20 +++++++++++--------- vpp-bird.clab.yml | 2 +- 9 files changed, 32 insertions(+), 15 deletions(-) rename docker/files/etc/vpp/{ => config}/clab.vpp (100%) create mode 100644 docker/files/etc/vpp/config/manual-post.vpp create mode 100644 docker/files/etc/vpp/config/manual-pre.vpp create mode 100644 docker/files/etc/vpp/config/vppcfg.vpp diff --git a/BUILDING.md b/BUILDING.md index 876d349..f1ea3de 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -129,7 +129,7 @@ VPPDEBS=~/src/vpp/build-root # Step 1: build amd64 on summer, push with platform tag docker buildx build --platform linux/amd64 \ - --build-context vppdebs=$VPPDEBS \ + --no-cache --build-context vppdebs=$VPPDEBS \ --push --tag $IMG:latest-amd64 \ -f docker/Dockerfile docker/ @@ -138,7 +138,7 @@ docker buildx build --platform linux/amd64 \ # Note: $IMG and $VPPDEBS expand on summer before being sent over SSH -- set them first. ssh jessica-orb "cd ~/src/vpp-containerlab && \ docker buildx build --platform linux/arm64 \ - --build-context vppdebs=$VPPDEBS \ + --no-cache --build-context vppdebs=$VPPDEBS \ --push --tag $IMG:latest-arm64 \ -f docker/Dockerfile docker/" diff --git a/docker/Dockerfile b/docker/Dockerfile index 3f8c98b..f373af9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -42,11 +42,13 @@ RUN curl -s -o /usr/share/keyrings/frrouting.gpg https://deb.frrouting.org/frr/k # Install Bird2 RUN curl -s -o /usr/share/keyrings/cznic-labs-pkg.gpg https://pkg.labs.nic.cz/gpg && \ echo "deb [signed-by=/usr/share/keyrings/cznic-labs-pkg.gpg] https://pkg.labs.nic.cz/bird2 noble main" \ - > /etc/apt/sources.list.d/cznic-labs-bird2.list && \ + > /etc/apt/sources.list.d/cznic-labs-bird2.list && \ apt -y update && apt -y install bird2 && apt clean # Config files COPY files/etc/ /etc/ +RUN mkdir /config \ + && for i in vpp bird frr; do mv /etc/$i /config/$i; ln -sf /config/$i /etc/$i; done COPY files/init-container.sh /sbin/ RUN chmod 755 /sbin/init-container.sh CMD ["/sbin/init-container.sh"] diff --git a/docker/files/etc/vpp/bootstrap.vpp b/docker/files/etc/vpp/bootstrap.vpp index a403470..6b5ab70 100644 --- a/docker/files/etc/vpp/bootstrap.vpp +++ b/docker/files/etc/vpp/bootstrap.vpp @@ -1,2 +1,12 @@ -exec /etc/vpp/clab.vpp -exec /etc/vpp/vppcfg.vpp +mpls table add 0 +set ip neighbor-config ip4 age 900 +set ip neighbor-config ip6 age 900 +lcp lcp-auto-subint off +lcp lcp-sync on +lcp lcp-sync-unnumbered on +lcp param del-static-on-link-down on +lcp param del-dynamic-on-link-down on +exec /etc/vpp/config/manual-pre.vpp +exec /etc/vpp/config/clab.vpp +exec /etc/vpp/config/vppcfg.vpp +exec /etc/vpp/config/manual-post.vpp diff --git a/docker/files/etc/vpp/clab.vpp b/docker/files/etc/vpp/config/clab.vpp similarity index 100% rename from docker/files/etc/vpp/clab.vpp rename to docker/files/etc/vpp/config/clab.vpp diff --git a/docker/files/etc/vpp/config/manual-post.vpp b/docker/files/etc/vpp/config/manual-post.vpp new file mode 100644 index 0000000..cc94bde --- /dev/null +++ b/docker/files/etc/vpp/config/manual-post.vpp @@ -0,0 +1 @@ +comment { You can add commands here that will execute after vppcfg.vpp } diff --git a/docker/files/etc/vpp/config/manual-pre.vpp b/docker/files/etc/vpp/config/manual-pre.vpp new file mode 100644 index 0000000..e1b4298 --- /dev/null +++ b/docker/files/etc/vpp/config/manual-pre.vpp @@ -0,0 +1 @@ +comment { You can add commands here that will execute before clab.vpp } diff --git a/docker/files/etc/vpp/config/vppcfg.vpp b/docker/files/etc/vpp/config/vppcfg.vpp new file mode 100644 index 0000000..9eb9738 --- /dev/null +++ b/docker/files/etc/vpp/config/vppcfg.vpp @@ -0,0 +1 @@ +comment { This file will be overwritten / generated by containerlab upon deploy } diff --git a/docker/files/init-container.sh b/docker/files/init-container.sh index d765775..66a545b 100755 --- a/docker/files/init-container.sh +++ b/docker/files/init-container.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash -STARTUP_CONFIG=${STARTUP_CONFIG:="/etc/vpp/startup.conf"} -CLAB_VPP_FILE=${CLAB_VPP_FILE:=/etc/vpp/clab.vpp} -VPPCFG_VPP_FILE=${VPPCFG_VPP_FILE:=/etc/vpp/vppcfg.vpp} +STARTUP_CONFIG=${STARTUP_CONFIG:="/config/vpp/startup.conf"} +VPPCFG_YAML_FILE=${VPPCFG_YAML_FILE:=/config/vpp/vppcfg.yaml} +VPPCFG_VPP_FILE=${VPPCFG_VPP_FILE:=/config/vpp/config/vppcfg.vpp} +CLAB_VPP_FILE=${CLAB_VPP_FILE:=/config/vpp/config/clab.vpp} NETNS=${NETNS:="dataplane"} BIRD_ENABLED=${BIRD_ENABLED:="true"} FRR_ENABLED=${FRR_ENABLED:="false"} @@ -11,6 +12,7 @@ echo "Creating dataplane namespace" /usr/bin/mkdir -p /etc/netns/$NETNS /usr/bin/touch /etc/netns/$NETNS/resolv.conf /usr/sbin/ip netns add $NETNS +/usr/bin/nsenter --net=/run/netns/$NETNS /usr/sbin/ip link set lo up echo "Starting SSH, with credentials root:vpp" sed -i -e 's,^#PermitRootLogin prohibit-password,PermitRootLogin yes,' /etc/ssh/sshd_config @@ -22,14 +24,14 @@ if [ "$BIRD_ENABLED" == "true" ]; then mkdir -p /run/bird /var/log/bird chown bird:bird /var/log/bird ROUTERID=$(ip -br a show eth0 | awk '{ print $3 }' | cut -f1 -d/) - sed -i -e "s,.*router id .*,router id $ROUTERID; # Set by container-init.sh," /etc/bird/bird.conf - /usr/bin/nsenter --net=/var/run/netns/$NETNS /usr/sbin/bird -u bird -g bird + sed -i -e "s,.*router id .*,router id $ROUTERID; # Set by container-init.sh," /config/bird/bird.conf + /usr/bin/nsenter --net=/run/netns/$NETNS /usr/sbin/bird -u bird -g vpp -c /config/bird/bird.conf fi if [ "$FRR_ENABLED" == "true" ]; then echo "Starting FRRouting in $NETNS" ROUTERID=$(ip -br a show eth0 | awk '{ print $3 }' | cut -f1 -d/) - sed -i -e "s,^ip router-id .*,ip router-id $ROUTERID," /etc/frr/frr.conf + sed -i -e "s,^ip router-id .*,ip router-id $ROUTERID," /config/frr/frr.conf /etc/init.d/frr start fi @@ -49,10 +51,10 @@ set interface state $IFNAME up EOF done -echo "Generating $VPPCFG_VPP_FILE" +echo "Generating $VPPCFG_YAML_FILE into $VPPCFG_VPP_FILE" : > $VPPCFG_VPP_FILE -if [ -r /etc/vpp/vppcfg.yaml ]; then - vppcfg plan --novpp -c /etc/vpp/vppcfg.yaml -o $VPPCFG_VPP_FILE +if [ -r $VPPCFG_YAML_FILE ]; then + vppcfg plan --novpp -c $VPPCFG_YAML_FILE -o $VPPCFG_VPP_FILE fi echo "Starting VPP" diff --git a/vpp-bird.clab.yml b/vpp-bird.clab.yml index 0ae1e32..2515c8a 100644 --- a/vpp-bird.clab.yml +++ b/vpp-bird.clab.yml @@ -9,7 +9,7 @@ topology: binds: - config/__clabNodeName__/bird-local.conf:/etc/bird/bird-local.conf:ro linux: - image: alpine:latest + image: ghcr.io/srl-labs/network-multitool:latest nodes: vpp1: