JIT compile the clab.vpp file based on all veth interfaces except eth0
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
CONFIG=${CONFIG:="/etc/vpp/startup.conf"}
|
STARTUP_CONFIG=${STARTUP_CONFIG:="/etc/vpp/startup.conf"}
|
||||||
|
CLAB_VPP_FILE=${CLAB_VPP_FILE:=/etc/vpp/clab.vpp}
|
||||||
NETNS=${NETNS:="dataplane"}
|
NETNS=${NETNS:="dataplane"}
|
||||||
|
|
||||||
echo "Creating dataplane namespace"
|
echo "Creating dataplane namespace"
|
||||||
@ -8,5 +9,21 @@ echo "Creating dataplane namespace"
|
|||||||
/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
|
||||||
|
|
||||||
|
echo "Generating $CLAB_VPP_FILE"
|
||||||
|
: > $CLAB_VPP_FILE
|
||||||
|
MTU=9216
|
||||||
|
for IFNAME in $(ip -br link show type veth | cut -f1 -d@ | grep -v ^eth0$); do
|
||||||
|
MAC=$(ip -br link show dev $IFNAME | awk '{ print $3 }')
|
||||||
|
echo " * $IFNAME hw-addr $MAC mtu $MTU"
|
||||||
|
ip link set $IFNAME up mtu $MTU
|
||||||
|
cat << EOF >> $CLAB_VPP_FILE
|
||||||
|
create host-interface name $IFNAME hw-addr $MAC
|
||||||
|
set interface name host-$IFNAME $IFNAME
|
||||||
|
set interface mtu $MTU $IFNAME
|
||||||
|
set interface state $IFNAME up
|
||||||
|
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
|
||||||
echo "Starting VPP"
|
echo "Starting VPP"
|
||||||
exec /usr/bin/vpp -c $CONFIG
|
exec /usr/bin/vpp -c $STARTUP_CONFIG
|
||||||
|
Reference in New Issue
Block a user