Add FRRouting support to VPP Containerlab

This commit is contained in:
Pim van Pelt
2025-05-07 20:31:28 +02:00
parent dc1840a6ec
commit 49b8df9709
11 changed files with 197 additions and 41 deletions

View File

@ -17,9 +17,16 @@ RUN pip install --break-system-packages build netaddr yamale argparse pyyaml ipa
RUN git clone https://git.ipng.ch/ipng/vppcfg.git && cd vppcfg && python3 -m build && \
pip install --break-system-packages dist/vppcfg-*-py3-none-any.whl
# Install FRR
RUN curl -s -o /usr/share/keyrings/frrouting.gpg https://deb.frrouting.org/frr/keys.gpg && \
echo deb '[signed-by=/usr/share/keyrings/frrouting.gpg]' https://deb.frrouting.org/frr bookworm frr-stable \
> /etc/apt/sources.list.d/frr.list && \
apt -y update && apt -y install frr frr-pythontools && apt clean
# Config files
COPY files/etc/vpp/* /etc/vpp/
COPY files/etc/bird/* /etc/bird/
COPY files/etc/frr/* /etc/frr/
COPY files/init-container.sh /sbin/
RUN chmod 755 /sbin/init-container.sh
CMD ["/sbin/init-container.sh"]

View File

@ -0,0 +1,17 @@
# These are the daemons that FRR will use for VPP Containerlab
# NOTE: we need to run in the 'dataplane' network namespace, and use the `dplane_fpm_nl` plugin
bgpd=yes
ospfd=yes
ospf6d=yes
bfdd=yes
ldpd=yes
vtysh_enable=yes
watchfrr_options="--netns=dataplane"
zebra_options=" -A 127.0.0.1 -s 67108864 -M dplane_fpm_nl"
bgpd_options=" -A 127.0.0.1"
ospfd_options=" -A 127.0.0.1"
ospf6d_options=" -A ::1"
staticd_options="-A 127.0.0.1"
bfdd_options=" -A 127.0.0.1"
ldpd_options=" -A 127.0.0.1"

View File

@ -0,0 +1,10 @@
# This is the VPP Containerlab default FRR configuration.
frr defaults traditional
log syslog informational
ip forwarding
ipv6 forwarding
service integrated-vtysh-config
!
ip router-id 192.0.2.1
!

View File

@ -5,6 +5,7 @@ CLAB_VPP_FILE=${CLAB_VPP_FILE:=/etc/vpp/clab.vpp}
VPPCFG_VPP_FILE=${VPPCFG_VPP_FILE:=/etc/vpp/vppcfg.vpp}
NETNS=${NETNS:="dataplane"}
BIRD_ENABLED=${BIRD_ENABLED:="true"}
FRR_ENABLED=${FRR_ENABLED:="false"}
echo "Creating dataplane namespace"
/usr/bin/mkdir -p /etc/netns/$NETNS
@ -25,6 +26,13 @@ if [ "$BIRD_ENABLED" == "true" ]; then
/usr/bin/nsenter --net=/var/run/netns/$NETNS /usr/sbin/bird -u bird -g bird
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
/etc/init.d/frr start
fi
echo "Generating $CLAB_VPP_FILE"
: > $CLAB_VPP_FILE
MTU=9216