diff --git a/Dockerfile.bookworm b/Dockerfile.bookworm index 9d1ffda..b2e9eee 100644 --- a/Dockerfile.bookworm +++ b/Dockerfile.bookworm @@ -2,15 +2,21 @@ FROM debian:bookworm ARG DEBIAN_FRONTEND=noninteractive ARG VPP_INSTALL_SKIP_SYSCTL=true ARG REPO=release -RUN apt-get update -RUN apt-get -y install curl procps tcpdump iproute2 iptables binutils \ - bridge-utils iputils-ping netcat-traditional net-tools nmap \ - python3 python3-dev python3-pip +RUN apt-get update && apt-get -y install curl procps tcpdump iproute2 iptables \ + iputils-ping net-tools git python3 python3-pip && apt-get clean + +# Install VPP RUN mkdir -p /var/log/vpp RUN curl -s https://packagecloud.io/install/repositories/fdio/${REPO}/script.deb.sh | bash -RUN apt-get update -RUN apt-get -y install vpp vpp-plugin-core -RUN apt-get -y clean -COPY files/startup.conf /etc/vpp/startup.conf -COPY files/*.vpp /etc/vpp/ -CMD ["/usr/bin/vpp","-c","/etc/vpp/startup.conf"] +RUN apt-get update && apt-get -y install vpp vpp-plugin-core && apt-get clean + +# Build vppcfg +RUN pip install --break-system-packages build netaddr yamale argparse pyyaml ipaddress +RUN git clone https://github.com/pimvanpelt/vppcfg.git && cd vppcfg && python3 -m build && \ + pip install --break-system-packages dist/vppcfg-*-py3-none-any.whl + +# Config files +COPY files/startup.conf files/*.vpp /etc/vpp/ +COPY files/init-container.sh /sbin/ +RUN chmod 755 /sbin/init-container.sh +CMD ["/sbin/init-container.sh"] diff --git a/files/init-container.sh b/files/init-container.sh new file mode 100755 index 0000000..5ea0a35 --- /dev/null +++ b/files/init-container.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +CONFIG=${CONFIG:="/etc/vpp/startup.conf"} +NETNS=${NETNS:="dataplane"} + +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 + +echo "Starting VPP" +exec /usr/bin/vpp -c $CONFIG diff --git a/files/startup.conf b/files/startup.conf index 1082e55..735f0bd 100644 --- a/files/startup.conf +++ b/files/startup.conf @@ -37,3 +37,11 @@ plugins { plugin linux_nl_plugin.so { enable } plugin sflow_plugin.so { enable } } + +linux-cp { + default netns dataplane + lcp-sync + lcp-auto-subint + del-static-on-link-down + del-dynamic-on-link-down +}