Consolidate FRR+Bird+VPP into /config for bind-mounting; Move to multitool for the linux client, it has SSH
This commit is contained in:
@@ -129,7 +129,7 @@ VPPDEBS=~/src/vpp/build-root
|
|||||||
|
|
||||||
# Step 1: build amd64 on summer, push with platform tag
|
# Step 1: build amd64 on summer, push with platform tag
|
||||||
docker buildx build --platform linux/amd64 \
|
docker buildx build --platform linux/amd64 \
|
||||||
--build-context vppdebs=$VPPDEBS \
|
--no-cache --build-context vppdebs=$VPPDEBS \
|
||||||
--push --tag $IMG:latest-amd64 \
|
--push --tag $IMG:latest-amd64 \
|
||||||
-f docker/Dockerfile docker/
|
-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.
|
# Note: $IMG and $VPPDEBS expand on summer before being sent over SSH -- set them first.
|
||||||
ssh jessica-orb "cd ~/src/vpp-containerlab && \
|
ssh jessica-orb "cd ~/src/vpp-containerlab && \
|
||||||
docker buildx build --platform linux/arm64 \
|
docker buildx build --platform linux/arm64 \
|
||||||
--build-context vppdebs=$VPPDEBS \
|
--no-cache --build-context vppdebs=$VPPDEBS \
|
||||||
--push --tag $IMG:latest-arm64 \
|
--push --tag $IMG:latest-arm64 \
|
||||||
-f docker/Dockerfile docker/"
|
-f docker/Dockerfile docker/"
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ RUN curl -s -o /usr/share/keyrings/cznic-labs-pkg.gpg https://pkg.labs.nic.cz/gp
|
|||||||
|
|
||||||
# Config files
|
# Config files
|
||||||
COPY files/etc/ /etc/
|
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/
|
COPY files/init-container.sh /sbin/
|
||||||
RUN chmod 755 /sbin/init-container.sh
|
RUN chmod 755 /sbin/init-container.sh
|
||||||
CMD ["/sbin/init-container.sh"]
|
CMD ["/sbin/init-container.sh"]
|
||||||
|
|||||||
@@ -1,2 +1,12 @@
|
|||||||
exec /etc/vpp/clab.vpp
|
mpls table add 0
|
||||||
exec /etc/vpp/vppcfg.vpp
|
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
|
||||||
|
|||||||
1
docker/files/etc/vpp/config/manual-post.vpp
Normal file
1
docker/files/etc/vpp/config/manual-post.vpp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
comment { You can add commands here that will execute after vppcfg.vpp }
|
||||||
1
docker/files/etc/vpp/config/manual-pre.vpp
Normal file
1
docker/files/etc/vpp/config/manual-pre.vpp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
comment { You can add commands here that will execute before clab.vpp }
|
||||||
1
docker/files/etc/vpp/config/vppcfg.vpp
Normal file
1
docker/files/etc/vpp/config/vppcfg.vpp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
comment { This file will be overwritten / generated by containerlab upon deploy }
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
STARTUP_CONFIG=${STARTUP_CONFIG:="/etc/vpp/startup.conf"}
|
STARTUP_CONFIG=${STARTUP_CONFIG:="/config/vpp/startup.conf"}
|
||||||
CLAB_VPP_FILE=${CLAB_VPP_FILE:=/etc/vpp/clab.vpp}
|
VPPCFG_YAML_FILE=${VPPCFG_YAML_FILE:=/config/vpp/vppcfg.yaml}
|
||||||
VPPCFG_VPP_FILE=${VPPCFG_VPP_FILE:=/etc/vpp/vppcfg.vpp}
|
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"}
|
NETNS=${NETNS:="dataplane"}
|
||||||
BIRD_ENABLED=${BIRD_ENABLED:="true"}
|
BIRD_ENABLED=${BIRD_ENABLED:="true"}
|
||||||
FRR_ENABLED=${FRR_ENABLED:="false"}
|
FRR_ENABLED=${FRR_ENABLED:="false"}
|
||||||
@@ -11,6 +12,7 @@ echo "Creating dataplane namespace"
|
|||||||
/usr/bin/mkdir -p /etc/netns/$NETNS
|
/usr/bin/mkdir -p /etc/netns/$NETNS
|
||||||
/usr/bin/touch /etc/netns/$NETNS/resolv.conf
|
/usr/bin/touch /etc/netns/$NETNS/resolv.conf
|
||||||
/usr/sbin/ip netns add $NETNS
|
/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"
|
echo "Starting SSH, with credentials root:vpp"
|
||||||
sed -i -e 's,^#PermitRootLogin prohibit-password,PermitRootLogin yes,' /etc/ssh/sshd_config
|
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
|
mkdir -p /run/bird /var/log/bird
|
||||||
chown bird:bird /var/log/bird
|
chown bird:bird /var/log/bird
|
||||||
ROUTERID=$(ip -br a show eth0 | awk '{ print $3 }' | cut -f1 -d/)
|
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
|
sed -i -e "s,.*router id .*,router id $ROUTERID; # Set by container-init.sh," /config/bird/bird.conf
|
||||||
/usr/bin/nsenter --net=/var/run/netns/$NETNS /usr/sbin/bird -u bird -g bird
|
/usr/bin/nsenter --net=/run/netns/$NETNS /usr/sbin/bird -u bird -g vpp -c /config/bird/bird.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$FRR_ENABLED" == "true" ]; then
|
if [ "$FRR_ENABLED" == "true" ]; then
|
||||||
echo "Starting FRRouting in $NETNS"
|
echo "Starting FRRouting in $NETNS"
|
||||||
ROUTERID=$(ip -br a show eth0 | awk '{ print $3 }' | cut -f1 -d/)
|
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
|
/etc/init.d/frr start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -49,10 +51,10 @@ set interface state $IFNAME up
|
|||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Generating $VPPCFG_VPP_FILE"
|
echo "Generating $VPPCFG_YAML_FILE into $VPPCFG_VPP_FILE"
|
||||||
: > $VPPCFG_VPP_FILE
|
: > $VPPCFG_VPP_FILE
|
||||||
if [ -r /etc/vpp/vppcfg.yaml ]; then
|
if [ -r $VPPCFG_YAML_FILE ]; then
|
||||||
vppcfg plan --novpp -c /etc/vpp/vppcfg.yaml -o $VPPCFG_VPP_FILE
|
vppcfg plan --novpp -c $VPPCFG_YAML_FILE -o $VPPCFG_VPP_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting VPP"
|
echo "Starting VPP"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ topology:
|
|||||||
binds:
|
binds:
|
||||||
- config/__clabNodeName__/bird-local.conf:/etc/bird/bird-local.conf:ro
|
- config/__clabNodeName__/bird-local.conf:/etc/bird/bird-local.conf:ro
|
||||||
linux:
|
linux:
|
||||||
image: alpine:latest
|
image: ghcr.io/srl-labs/network-multitool:latest
|
||||||
|
|
||||||
nodes:
|
nodes:
|
||||||
vpp1:
|
vpp1:
|
||||||
|
|||||||
Reference in New Issue
Block a user