Refactor the things that are common between bird and frr build types -- no-op for the build/ output

This commit is contained in:
Pim van Pelt
2023-05-31 16:14:33 +00:00
parent 4d964af173
commit f929b836e8
44 changed files with 180 additions and 84 deletions

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -0,0 +1,79 @@
#!/bin/bash
#
# OVS configuration for the `{{ overlay }}` overlay
LAB=${LAB:=0}
BR=vpplan
for p in $(ovs-vsctl list-ifaces $BR); do
ovs-vsctl set port $p vlan_mode=access
done
# Uplink is VLAN 10
ovs-vsctl add port vpp${LAB}-0-0 tag 10
ovs-vsctl add port uplink tag 10
# Link vpp${LAB}-0 <-> vpp${LAB}-1 in VLAN 20
ovs-vsctl add port vpp${LAB}-0-1 tag 20
ovs-vsctl add port vpp${LAB}-1-0 tag 20
# Link vpp${LAB}-1 <-> vpp${LAB}-2 in VLAN 21
ovs-vsctl add port vpp${LAB}-1-1 tag 21
ovs-vsctl add port vpp${LAB}-2-0 tag 21
# Link vpp${LAB}-2 <-> vpp${LAB}-3 in VLAN 22
ovs-vsctl add port vpp${LAB}-2-1 tag 22
ovs-vsctl add port vpp${LAB}-3-0 tag 22
## Wire host${LAB}-0-[0123] to e2 of all VPP machines
ovs-vsctl set port vpp${LAB}-0-2 tag=30
ovs-vsctl set port host${LAB}-0-0 tag=30
ovs-vsctl set port vpp${LAB}-1-2 tag=31
ovs-vsctl set port host${LAB}-0-1 tag=31
ovs-vsctl set port vpp${LAB}-2-2 tag=32
ovs-vsctl set port host${LAB}-0-2 tag=32
ovs-vsctl set port vpp${LAB}-3-2 tag=33
ovs-vsctl set port host${LAB}-0-3 tag=33
## Wire host${LAB}-1-[0123] to e3 of all VPP machines
ovs-vsctl set port vpp${LAB}-0-3 tag=40
ovs-vsctl set port host${LAB}-1-0 tag=40
ovs-vsctl set port vpp${LAB}-1-3 tag=41
ovs-vsctl set port host${LAB}-1-1 tag=41
ovs-vsctl set port vpp${LAB}-2-3 tag=42
ovs-vsctl set port host${LAB}-1-2 tag=42
ovs-vsctl set port vpp${LAB}-3-3 tag=43
ovs-vsctl set port host${LAB}-1-3 tag=43
## Wire tap${LAB}-0-0 as 'rx' tap
MIRROR=mirror-rx
ovs-vsctl set port tap${LAB}-0-0 vlan_mode=native-tagged
[ ovs-vsctl list mirror $MIRROR >/dev/null 2>&1 ] || \
ovs-vsctl -- --id=@m get mirror $MIRROR -- remove bridge $BR mirrors @m
ovs-vsctl --id=@m create mirror name=$MIRROR \
-- --id=@p get port tap${LAB}-0-0 \
-- add bridge $BR mirrors @m \
-- set mirror $MIRROR output-port=@p \
-- set mirror $MIRROR select_dst_port=[] \
-- set mirror $MIRROR select_src_port=[]
for iface in $(ovs-vsctl list-ports $BR); do
[[ $iface == tap* ]] && continue
[[ $iface == uplink ]] && continue
ovs-vsctl add mirror $MIRROR select_dst_port $(ovs-vsctl get port $iface _uuid)
done
## Wire tap${LAB}-0-1 as 'tx' tap
MIRROR=mirror-tx
ovs-vsctl set port tap${LAB}-0-1 vlan_mode=native-tagged
[ ovs-vsctl list mirror $MIRROR >/dev/null 2>&1 ] || \
ovs-vsctl -- --id=@m get mirror $MIRROR -- remove bridge $BR mirrors @m
ovs-vsctl --id=@m create mirror name=$MIRROR \
-- --id=@p get port tap${LAB}-0-1 \
-- add bridge $BR mirrors @m \
-- set mirror $MIRROR output-port=@p \
-- set mirror $MIRROR select_dst_port=[] \
-- set mirror $MIRROR select_src_port=[]
for iface in $(ovs-vsctl list-ports $BR); do
[[ $iface == tap* ]] && continue
[[ $iface == uplink ]] && continue
ovs-vsctl add mirror $MIRROR select_src_port $(ovs-vsctl get port $iface _uuid)
done

1
overlays/bird/common Symbolic link
View File

@ -0,0 +1 @@
../_common/common/

1
overlays/bird/host Symbolic link
View File

@ -0,0 +1 @@
../_common/host

View File

@ -1,79 +0,0 @@
#!/bin/bash
#
# OVS configuration for the `{{ overlay }}` overlay
LAB=${LAB:=0}
BR=vpplan
for p in $(ovs-vsctl list-ifaces $BR); do
ovs-vsctl set port $p vlan_mode=access
done
# Uplink is VLAN 10
ovs-vsctl add port vpp${LAB}-0-0 tag 10
ovs-vsctl add port uplink tag 10
# Link vpp${LAB}-0 <-> vpp${LAB}-1 in VLAN 20
ovs-vsctl add port vpp${LAB}-0-1 tag 20
ovs-vsctl add port vpp${LAB}-1-0 tag 20
# Link vpp${LAB}-1 <-> vpp${LAB}-2 in VLAN 21
ovs-vsctl add port vpp${LAB}-1-1 tag 21
ovs-vsctl add port vpp${LAB}-2-0 tag 21
# Link vpp${LAB}-2 <-> vpp${LAB}-3 in VLAN 22
ovs-vsctl add port vpp${LAB}-2-1 tag 22
ovs-vsctl add port vpp${LAB}-3-0 tag 22
## Wire host${LAB}-0-[0123] to e2 of all VPP machines
ovs-vsctl set port vpp${LAB}-0-2 tag=30
ovs-vsctl set port host${LAB}-0-0 tag=30
ovs-vsctl set port vpp${LAB}-1-2 tag=31
ovs-vsctl set port host${LAB}-0-1 tag=31
ovs-vsctl set port vpp${LAB}-2-2 tag=32
ovs-vsctl set port host${LAB}-0-2 tag=32
ovs-vsctl set port vpp${LAB}-3-2 tag=33
ovs-vsctl set port host${LAB}-0-3 tag=33
## Wire host${LAB}-1-[0123] to e3 of all VPP machines
ovs-vsctl set port vpp${LAB}-0-3 tag=40
ovs-vsctl set port host${LAB}-1-0 tag=40
ovs-vsctl set port vpp${LAB}-1-3 tag=41
ovs-vsctl set port host${LAB}-1-1 tag=41
ovs-vsctl set port vpp${LAB}-2-3 tag=42
ovs-vsctl set port host${LAB}-1-2 tag=42
ovs-vsctl set port vpp${LAB}-3-3 tag=43
ovs-vsctl set port host${LAB}-1-3 tag=43
## Wire tap${LAB}-0-0 as 'rx' tap
MIRROR=mirror-rx
ovs-vsctl set port tap${LAB}-0-0 vlan_mode=native-tagged
[ ovs-vsctl list mirror $MIRROR >/dev/null 2>&1 ] || \
ovs-vsctl -- --id=@m get mirror $MIRROR -- remove bridge $BR mirrors @m
ovs-vsctl --id=@m create mirror name=$MIRROR \
-- --id=@p get port tap${LAB}-0-0 \
-- add bridge $BR mirrors @m \
-- set mirror $MIRROR output-port=@p \
-- set mirror $MIRROR select_dst_port=[] \
-- set mirror $MIRROR select_src_port=[]
for iface in $(ovs-vsctl list-ports $BR); do
[[ $iface == tap* ]] && continue
[[ $iface == uplink ]] && continue
ovs-vsctl add mirror $MIRROR select_dst_port $(ovs-vsctl get port $iface _uuid)
done
## Wire tap${LAB}-0-1 as 'tx' tap
MIRROR=mirror-tx
ovs-vsctl set port tap${LAB}-0-1 vlan_mode=native-tagged
[ ovs-vsctl list mirror $MIRROR >/dev/null 2>&1 ] || \
ovs-vsctl -- --id=@m get mirror $MIRROR -- remove bridge $BR mirrors @m
ovs-vsctl --id=@m create mirror name=$MIRROR \
-- --id=@p get port tap${LAB}-0-1 \
-- add bridge $BR mirrors @m \
-- set mirror $MIRROR output-port=@p \
-- set mirror $MIRROR select_dst_port=[] \
-- set mirror $MIRROR select_src_port=[]
for iface in $(ovs-vsctl list-ports $BR); do
[[ $iface == tap* ]] && continue
[[ $iface == uplink ]] && continue
ovs-vsctl add mirror $MIRROR select_src_port $(ovs-vsctl get port $iface _uuid)
done

View File

@ -0,0 +1 @@
../_common/ovs-config.sh.j2

1
overlays/bird/tap Symbolic link
View File

@ -0,0 +1 @@
../_common/tap

1
overlays/bird/vpp/etc/vpp Symbolic link
View File

@ -0,0 +1 @@
../../../_common/vpp/etc/vpp/

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling FRR"
for i in frr; do
rm -f /etc/systemd/system/multi-user.target.wants/${i}.service
ln -sf /dev/null /etc/systemd/system/${i}.service
done

View File

@ -1 +1 @@
../bird/common/ ../_common/common/

View File

@ -1 +1 @@
../bird/host/ ../_common/host/

View File

@ -1 +1 @@
../bird/ovs-config.sh.j2 ../_common/ovs-config.sh.j2

View File

@ -1 +1 @@
../bird/tap/ ../_common/tap/

View File

@ -1 +1 @@
../../../bird/vpp/etc/vpp/ ../../../_common/vpp/etc/vpp/