]> git.proxmox.com Git - mirror_frr.git/commitdiff
debian: rework autopkgtests
authorDavid Lamparter <equinox@diac24.net>
Mon, 17 Dec 2018 17:55:31 +0000 (18:55 +0100)
committerDavid Lamparter <equinox@diac24.net>
Tue, 18 Dec 2018 01:19:14 +0000 (02:19 +0100)
Ditch the old non-working one and add 3 new ones to check:
- that zebra can talk to the kernel at least somewhat
- that SNMP and RPKI modules can be loaded
- that frr-reload.py works

This should catch most build environment SNAFUs.

Signed-off-by: David Lamparter <equinox@diac24.net>
debian/tests/bgpd-snmp-rpki [new file with mode: 0755]
debian/tests/control
debian/tests/daemons [deleted file]
debian/tests/py-frr-reload [new file with mode: 0755]
debian/tests/zebra-lo [new file with mode: 0755]

diff --git a/debian/tests/bgpd-snmp-rpki b/debian/tests/bgpd-snmp-rpki
new file mode 100755 (executable)
index 0000000..91e4bdd
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+
+# enable bgpd with SNMP & RPKI modules
+cat >> /etc/frr/daemons <<EOF
+bgpd=yes
+bgpd_options="-A 127.0.0.1 -Msnmp -Mrpki"
+EOF
+
+service frr restart
+
+# check that it actually started
+killall -0 watchfrr
+killall -0 zebra
+killall -0 bgpd
+
+# just for debugging
+vtysh -c 'show modules'
+
+# ... and SNMP & RPKI should be loaded
+vtysh -c 'show modules' | grep -q snmp
+vtysh -c 'show modules' | grep -q rpki
index 53fd537e2eff2d63a5f9ab9bfb4bca585d7254fd..5990a693707e939b4fe9b027d8825bc5fa1e82aa 100644 (file)
@@ -1,3 +1,11 @@
-Tests: daemons
+Tests: zebra-lo
 Depends: frr
-Restrictions: needs-root
+Restrictions: needs-root, isolation-container
+
+Tests: bgpd-snmp-rpki
+Depends: frr, frr-snmp, frr-rpki-rtrlib
+Restrictions: needs-root, isolation-container
+
+Tests: py-frr-reload
+Depends: frr, frr-pythontools
+Restrictions: needs-root, isolation-container
diff --git a/debian/tests/daemons b/debian/tests/daemons
deleted file mode 100644 (file)
index ac35ecd..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-#---------------
-# Testing frr
-#---------------
-set -e
-
-# modify config file to enable all daemons and copy config files
-CONFIG_FILE=/etc/frr/daemons
-DAEMONS=("zebra" "bgpd" "ospfd" "ospf6d" "ripd" "ripngd" "isisd" "pimd")
-
-for daemon in "${DAEMONS[@]}"
-do
-    sed -i -e "s/${daemon}=no/${daemon}=yes/g" $CONFIG_FILE
-    cp /usr/share/doc/frr/examples/${daemon}.conf.sample /etc/frr/${daemon}.conf
-done
-
-# reload frr
-/etc/init.d/frr restart > /dev/null 2>&1
-
-# check daemons
-for daemon in "${DAEMONS[@]}"
-do
-    echo -n "check $daemon  -  "
-    if pidof -x $daemon > /dev/null; then
-        echo "${daemon} OK"
-    else
-        echo "ERROR: ${daemon} IS NOT RUNNING"
-        exit 1
-    fi
-done
diff --git a/debian/tests/py-frr-reload b/debian/tests/py-frr-reload
new file mode 100755 (executable)
index 0000000..a50647a
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+set -e
+
+# should have been started on install, but policy may have inhibited that
+service frr restart
+
+# these should be running by default
+killall -0 watchfrr
+killall -0 zebra
+killall -0 staticd
+
+# configure interactively, save to file
+vtysh -c 'configure terminal' -c 'ip route 198.51.100.0/28 127.0.0.1'
+vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.0/28 127.0.0.1'
+vtysh -c 'write memory'
+
+grep -q 'ip route 198.51.100.0/28 127.0.0.1' /etc/frr/frr.conf
+
+# configure in file, check interactively
+sed -e '/^ip route 198.51.100.0\/28 127.0.0.1/ c ip route 198.51.100.64/28 127.0.0.1' \
+       -i /etc/frr/frr.conf
+
+service frr reload
+
+vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.64/28 127.0.0.1'
+if vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.0/28 127.0.0.1'; then
+       exit 1
+fi
diff --git a/debian/tests/zebra-lo b/debian/tests/zebra-lo
new file mode 100755 (executable)
index 0000000..ffd9c72
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -e
+
+# should have been started on install, but policy may have inhibited that
+service frr status >/dev/null || service frr restart
+
+# these should be running by default
+killall -0 watchfrr
+killall -0 zebra
+killall -0 staticd
+
+# check vtysh works at all
+vtysh -c 'show version'
+
+# check zebra is properly talking to the kernel
+vtysh -c 'show interface lo' | grep -q LOOPBACK