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 @@
{{ node.hostname }}

View File

@ -0,0 +1,7 @@
127.0.0.1 localhost
127.0.1.1 {{node.hostname}}.lab.ipng.ch {{node.hostname}}
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

View File

@ -0,0 +1,28 @@
-*%%=
=%@@@@@:
:%@@@@@@@*
:*@@@@@@@@@@ .=+-
:=*#%@@@@@@@@@@@@@+ .+@@@@#
.+@@@@@@@@@@@@@@@@@@@@##@@@@@@@=
+@@@@@@@@@@@%*+@@@@@@@@@@@@@@@@@*
=@@@@@@@@@#=: *@@@@%#*+*@@@@@@@#
-%@@@@@@@*- ::. :*@@@@@@@@@
=%@@@@@@@+ *@@@@@@@@@@@*
:*@@@@@@@@+ %@@@@@@@@@@@@@@+.
-*@@@@@@@@@+ +%@@@@@@@@@@@@@@@*.
.-+%@@@@@@@@@#- =@@@@@@@@@@@@@@@+
:=*%@@@@@@@@%*=: @@@@@@@@@@@@@@@@#
:+#@@@@@@@#*+-: :*%@@@@@@%%@@@@@@@@@@@@@@@@@#
.=#@@%#*+=-. :##%%@@@@@@@@@@@@@@@@@@@@@@@@@#
.-=-: ..:-=+*#%@@@@@@@@@@@@@@-
..::--==++***##%%%%@@@@@@@@@@@@@@@@%%%##***+==-::. .-=*#@@@@@@@@*
.:=+*#%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#*+-: :=+#@@@%
..:--=+**#%@@@@@@@@@@@@@@@@@@@@@@%#*##%@@@@@@@@@@@@@@@#+-. .-+-
.:=+*#%@@@@@@@@@@@@@@@@#+=:..-=+#%@@@@@@@@@@@@#+-.
.:=+#%@@@@@@@@@@@@@@@#+-. :-+#@@@@@@@@@@@%=
https://ipng.ch/ :-+#@@@@@@@@@@@@@@@#+-. .-+*%@%*-.
IPng Networks GmbH :=*%@@@@@@@@@@@@@%*-
:=*%@@@@@@@#+-.
Restricted access. Authorized users only. :=+-.
All connections are monitored and recorded. Contact <noc@ipng.ch> for details.

View File

@ -0,0 +1,7 @@
domain lab.ipng.ch
search{% for domain in lab.nameserver.search %} {{domain}}{%endfor %}
{% for resolver in lab.nameserver.addresses %}
nameserver {{resolver}}
{%endfor%}

View File

@ -0,0 +1,16 @@
network:
version: 2
renderer: networkd
ethernets:
enp1s0:
optional: true
accept-ra: false
dhcp4: false
mtu: 9000
addresses: [ {{node.mgmt.ipv4}}, {{node.mgmt.ipv6}} ]
routes:
- to: 0.0.0.0/0
via: {{lab.mgmt.gw4}}
- to: ::/0
via: {{lab.mgmt.gw6}}

View File

@ -0,0 +1,6 @@
domain lab.ipng.ch
search{% for domain in lab.nameserver.search %} {{domain}}{%endfor %}
nameserver 194.1.163.3
nameserver 194.1.163.4

View File

@ -0,0 +1,11 @@
# pim@ipng.nl - absynth, bfib, gripe, spongebob, homenet
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8X6oRdLn7PckWIRL+Fgp46qN+fglQLBJIvPHJ2P277v4tx/qlELaT8w45YyEPrUZ4XbbNIB4P59H63wPxIpk/d15k0C7Zx3kTESaEQuts3fne3ZFmrWm0dLD2yDTiB0zCraiQ5a0w++xuGEC3wdWPV+FHZh5Ea+WCd91g2xXPHJeosAQzBBBBaC9Shhx91h6lbCm4evvgqLnwt7JgnI2N4w2qr13lDDaRD4BXfyFrtLSTdhBgYEaFnUd6Afz5ilfDYXQW/yTSHZOIQ/vNVFpFxYrtmwHDdrSMiDpz0FE/4LLBG/rFl2VvRTmTEyjvwpGpEVaivMOLo/jRc3TA7jKB pim@ipng.nl
# pim's M1 macbookpro SeKEY
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKDP/hLZusPNfKTy3t9bbbOHyczX+UACc4rYstc3QEDBDfxBnCZcMKN5Mv10o+q/+ap7wyFhONlz/qcUhEMbI1k=
{% if lab.ssh is defined and 'ipng' in lab.ssh %}
{% for key in lab.ssh.ipng | default([]) %}
{{ key }}
{% endfor %}
{% endif %}

View File

@ -0,0 +1,11 @@
# pim@ipng.nl - absynth, bfib, gripe, spongebob, homenet
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8X6oRdLn7PckWIRL+Fgp46qN+fglQLBJIvPHJ2P277v4tx/qlELaT8w45YyEPrUZ4XbbNIB4P59H63wPxIpk/d15k0C7Zx3kTESaEQuts3fne3ZFmrWm0dLD2yDTiB0zCraiQ5a0w++xuGEC3wdWPV+FHZh5Ea+WCd91g2xXPHJeosAQzBBBBaC9Shhx91h6lbCm4evvgqLnwt7JgnI2N4w2qr13lDDaRD4BXfyFrtLSTdhBgYEaFnUd6Afz5ilfDYXQW/yTSHZOIQ/vNVFpFxYrtmwHDdrSMiDpz0FE/4LLBG/rFl2VvRTmTEyjvwpGpEVaivMOLo/jRc3TA7jKB pim@ipng.nl
# pim's M1 macbookpro SeKEY
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKDP/hLZusPNfKTy3t9bbbOHyczX+UACc4rYstc3QEDBDfxBnCZcMKN5Mv10o+q/+ap7wyFhONlz/qcUhEMbI1k=
{% if lab.ssh is defined and 'root' in lab.ssh %}
{% for key in lab.ssh.root | default ([]) %}
{{ key }}
{% endfor %}
{% endif %}

View File

@ -0,0 +1,7 @@
#!/bin/bash
echo " * Fixing permissions"
chown -R root. /root/
chown -R ipng. /home/ipng/
[ -r /etc/rc.local ] && chmod 755 /etc/rc.local

View File

@ -0,0 +1 @@
../../../tap/root/lab-build/disable-vpp

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

View File

@ -0,0 +1,4 @@
#!/bin/sh
ip link set enp16s0f0 alias mirror-rx mtu 9216 up
ip link set enp16s0f1 alias mirror-tx mtu 9216 up

View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " * Disabling VPP, Bird and FRR"
for i in vpp vppcfg bird-dataplane 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,12 @@
comment { Apply system defaults from the build }
exec /etc/vpp/config/defaults.vpp
exec /etc/vpp/config/loopback.vpp
exec /etc/vpp/config/interface.vpp
exec /etc/vpp/config/lcp.vpp
exec /etc/vpp/config/mpls.vpp
comment { exec /etc/vpp/config/flowprobe.vpp }
comment { Allow user to set persistent manual configs }
exec /etc/vpp/config/manual.vpp

View File

@ -0,0 +1,6 @@
set logging class linux-cp rate-limit 1000 level warn syslog-level notice
lcp default netns dataplane
lcp lcp-sync on
lcp lcp-auto-subint off

View File

@ -0,0 +1,11 @@
comment { Generate full IPFIX stats, send them to lab.ipng.ch }
set ipfix exporter collector 194.1.163.86 src {{node.loopback.ipv4.split("/")[0]}} port 4739 path-mtu 1450 template-interval 30
flowprobe params record l2 l3 l4 active 10 passive 60
flowprobe feature add-del GigabitEthernet10/0/0 l2 both
flowprobe feature add-del GigabitEthernet10/0/1 l2 both
flowprobe feature add-del GigabitEthernet10/0/2 l2 both
flowprobe feature add-del GigabitEthernet10/0/3 l2 both

View File

@ -0,0 +1,41 @@
{% if node.id == 0 %}
comment { Gi10/0/0 is connected to lab.ipng.ch:lab{{lab.id}} }
set interface mtu 9000 GigabitEthernet10/0/0
set interface mtu packet 9000 GigabitEthernet10/0/0
set interface ip address GigabitEthernet10/0/0 2001:678:d78:2{{lab.id}}1::{{node.id}}:fffe/112
set interface ip address GigabitEthernet10/0/0 192.168.{{10+lab.id}}.{{5+2*node.id}}/31
set interface state GigabitEthernet10/0/0 up
{% else %}
comment { Gi10/0/0 is connected to vpp{{lab.id}}-{{node.id-1}}:Gi10/0/1 }
set interface mtu 9000 GigabitEthernet10/0/0
set interface mtu packet 9000 GigabitEthernet10/0/0
set interface ip address GigabitEthernet10/0/0 2001:678:d78:2{{lab.id}}1::{{node.id}}:{{lab.id}}{{node.id}}/112
set interface ip address GigabitEthernet10/0/0 192.168.{{10+lab.id}}.{{5+2*node.id}}/31
set interface state GigabitEthernet10/0/0 up
{% endif %}
{% if node.id < 3 %}
comment { Gi10/0/1 is connected to vpp{{lab.id}}-{{node.id+1}}:Gi10/0/0 }
set interface mtu 9000 GigabitEthernet10/0/1
set interface mtu packet 9000 GigabitEthernet10/0/1
set interface ip address GigabitEthernet10/0/1 2001:678:d78:2{{lab.id}}1::{{node.id+1}}:{{lab.id}}{{node.id}}/112
set interface ip address GigabitEthernet10/0/1 192.168.{{10+lab.id}}.{{6+2*node.id}}/31
set interface state GigabitEthernet10/0/1 up
{% else %}
comment { Gi10/0/1 is free to use }
set interface mtu 9000 GigabitEthernet10/0/1
set interface mtu packet 9000 GigabitEthernet10/0/1
set interface state GigabitEthernet10/0/1 down
{% endif %}
comment { Gi10/0/2 is free to use }
set interface mtu 9000 GigabitEthernet10/0/2
set interface mtu packet 9000 GigabitEthernet10/0/2
set interface state GigabitEthernet10/0/2 down
comment { Gi10/0/3 is free to use }
set interface mtu 9000 GigabitEthernet10/0/3
set interface mtu packet 9000 GigabitEthernet10/0/3
set interface state GigabitEthernet10/0/3 down

View File

@ -0,0 +1,8 @@
comment { Create one LinuxCP Interface Pair for each phy }
lcp create loop0 host-if loop0
lcp create GigabitEthernet10/0/0 host-if e0
lcp create GigabitEthernet10/0/1 host-if e1
lcp create GigabitEthernet10/0/2 host-if e2
lcp create GigabitEthernet10/0/3 host-if e3

View File

@ -0,0 +1,7 @@
comment { Create a loopback interface }
create loopback interface instance 0
set interface state loop0 up
set interface ip address loop0 {{ node.loopback.ipv4 }}
set interface ip address loop0 {{ node.loopback.ipv6 }}

View File

@ -0,0 +1,3 @@
comment { Put any config for {{ node.hostname }} you'd like here. }
comment { It will persist across restarts of VPP and reboots of the VM. }

View File

@ -0,0 +1,8 @@
mpls table add 0
{% if node.id > 0 %}
set interface mpls GigabitEthernet10/0/0 enable
{% endif %}
{% if node.id < 3 %}
set interface mpls GigabitEthernet10/0/1 enable
{% endif %}