#!/bin/ksh
-# $OpenBSD: ixp.sh,v 1.1 2023/10/12 09:18:56 claudio Exp $
+# $OpenBSD: ixp.sh,v 1.2 2024/01/28 12:36:21 anton Exp $
set -e
exit 1
fi
+. "${BGPDCONFIGDIR}/util.sh"
+
trap 'error_notify $?' EXIT
echo check if rdomains are busy
route -T ${RDOMAIN2} exec ${BGPD} \
-v -f ${BGPDCONFIGDIR}/bgpd.ixp.rdomain2_4.conf
-sleep 3
-
+wait_until "route -T ${RDOMAIN1} exec bgpctl show rib detail | ! cmp /dev/null -"
route -T ${RDOMAIN1} exec bgpctl show rib detail | grep -v 'Last update:' | \
tee ixp.rdomain1.out
-sleep .2
diff -u ${BGPDCONFIGDIR}/ixp.rdomain1.ok ixp.rdomain1.out
echo OK
+wait_until "route -T ${RDOMAIN2} exec bgpctl show rib detail | ! cmp /dev/null -"
route -T ${RDOMAIN2} exec bgpctl show rib detail | grep -v 'Last update:' | \
tee ixp.rdomain2.out
-sleep .2
diff -u ${BGPDCONFIGDIR}/ixp.rdomain2.ok ixp.rdomain2.out
echo OK
#!/bin/ksh
-# $OpenBSD: network_statement.sh,v 1.8 2023/02/15 14:19:08 claudio Exp $
+# $OpenBSD: network_statement.sh,v 1.9 2024/01/28 12:36:21 anton Exp $
set -e
route -qn -T ${RDOMAIN2} flush || true
ifconfig lo${RDOMAIN1} destroy || true
ifconfig lo${RDOMAIN2} destroy || true
- rm -f ${TMP}
if [ $1 -ne 0 ]; then
echo FAILED
exit 1
fi
}
-wait_until() {
- local _i=0
-
- cat >"$TMP"
- while [ "$_i" -lt 8 ]; do
- sh -x "$TMP" && return 0
- sleep 0.5
- _i="$((_i + 1))"
- done
- echo timeout
- return 1
-}
-
if [ "$(id -u)" -ne 0 ]; then
echo need root privileges >&2
exit 1
fi
-trap 'error_notify $?' EXIT
+. "${BGPDCONFIGDIR}/util.sh"
-TMP="$(mktemp -t bgpd.XXXXXX)"
+trap 'error_notify $?' EXIT
echo check if rdomains are busy
for n in ${RDOMAINS}; do
route -T ${RDOMAIN1} exec bgpctl nei RDOMAIN2 up
sleep 1
-wait_until <<EOF
-route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | grep -q ${PAIR2STATIC}
-EOF
+wait_until "route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | grep -q ${PAIR2STATIC}"
echo test 1
route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | \
route -T ${RDOMAIN2} delete -priority 55 ${PAIR2PRIORITY} \
${PAIR1IP}
-wait_until <<EOF
-route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | ! grep -q ${PAIR2STATIC}
-EOF
+wait_until "route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | ! grep -q ${PAIR2STATIC}"
echo test 2
route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | \
route -T ${RDOMAIN2} add -priority 55 ${PAIR2PRIORITY} \
${PAIR1IP}
-wait_until <<EOF
-route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | grep -q ${PAIR2STATIC}
-EOF
+wait_until "route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | grep -q ${PAIR2STATIC}"
echo test 3
route -T ${RDOMAIN1} exec bgpctl sh rib ${PAIR2STATIC} | \