Re: ospf6d: add basic regress tests

2019-12-23 Thread Denis Fondras
On Mon, Dec 23, 2019 at 03:53:23PM +0100, Claudio Jeker wrote:
> On Mon, Dec 23, 2019 at 03:24:31PM +0100, Remi Locherer wrote:
> > On Sun, Dec 22, 2019 at 08:36:41PM +0100, Denis Fondras wrote:
> > > Add basic regress test to ospf6d.
> > 
> > Works for me. OK remi@
> > 
> > The tests also succeed when I reduce the sleep from 120 to 60.
> > A few lines end with a space. I marked them below.
> 
> I would suggest to minimize hold times etc. and reduce the timeout as
> much as possible. Regress test should not wait uneccessary long.
> 

Thank you guys. sleep 50s is the best I have come with so far.


> > > 
> > > Index: ospf6d/Makefile
> > > ===
> > > RCS file: ospf6d/Makefile
> > > diff -N ospf6d/Makefile
> > > --- /dev/null 1 Jan 1970 00:00:00 -
> > > +++ ospf6d/Makefile   22 Dec 2019 19:27:27 -
> > > @@ -0,0 +1,10 @@
> > > +# $OpenBSD$
> > > +
> > > +REGRESS_TARGETS  =   network_statement
> > > +
> > > +OSPF6D ?=/usr/sbin/ospf6d
> > > +
> > > +network_statement:
> > > + ${SUDO} ksh ${.CURDIR}/$@.sh ${OSPF6D} ${.CURDIR} 11 12 pair11 pair12
> > > +
> > > +.include 
> > > Index: ospf6d/network_statement.sh
> > > ===
> > > RCS file: ospf6d/network_statement.sh
> > > diff -N ospf6d/network_statement.sh
> > > --- /dev/null 1 Jan 1970 00:00:00 -
> > > +++ ospf6d/network_statement.sh   22 Dec 2019 19:27:27 -
> > > @@ -0,0 +1,107 @@
> > > +#!/bin/ksh
> > > +#$OpenBSD$
> > > +set -e
> > > +
> > > +OSPF6D=$1
> > > +OSPF6DCONFIGDIR=$2
> > > +RDOMAIN1=$3
> > > +RDOMAIN2=$4
> > > +PAIR1=$5
> > > +PAIR2=$6
> > > +
> > > +RDOMAINS="${RDOMAIN1} ${RDOMAIN2}"
> > > +PAIRS="${PAIR1} ${PAIR2}"
> > > +PAIR1IP=2001:db8::${RDOMAIN1}
> > > +PAIR2IP=2001:db8::${RDOMAIN2}
> > > +PAIR1PREFIX=2001:db8:${RDOMAIN1}::
> > > +PAIR2PREFIX=2001:db8:${RDOMAIN2}::
> > > +PAIR2PREFIX2=2001:db8:${RDOMAIN2}:${RDOMAIN2}::
> > > +
> > > +error_notify() {
> > > + echo cleanup
> > > + pkill -T ${RDOMAIN1} ospf6d || true
> > > + pkill -T ${RDOMAIN2} ospf6d || true
> > > + sleep 1
> > > + ifconfig ${PAIR2} destroy || true
> > > + ifconfig ${PAIR1} destroy || true
> > > + ifconfig vether${RDOMAIN1} destroy || true
> > > + ifconfig vether${RDOMAIN2} destroy || true
> > > + route -qn -T ${RDOMAIN1} flush || true
> > > + route -qn -T ${RDOMAIN2} flush || true
> > > + ifconfig lo${RDOMAIN1} destroy || true
> > > + ifconfig lo${RDOMAIN2} destroy || true
> > > + rm ospf6d.1.conf ospf6d.2.conf
> > > + if [ $1 -ne 0 ]; then
> > > + echo FAILED
> > > + exit 1
> > > + else
> > > + echo SUCCESS
> > > + fi
> > > +}
> > > +
> > > +if [ "$(id -u)" -ne 0 ]; then 
> > ^
> > 
> > > + echo need root privileges >&2
> > > + exit 1
> > > +fi
> > > +
> > > +trap 'error_notify $?' EXIT
> > > +
> > > +echo check if rdomains are busy
> > > +for n in ${RDOMAINS}; do
> > > + if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then
> > > + echo routing domain ${n} is already used >&2
> > > + exit 1
> > > + fi
> > > +done
> > > +
> > > +echo check if interfaces are busy
> > > +for n in ${PAIRS}; do
> > > + /sbin/ifconfig "${n}" >/dev/null 2>&1 && \
> > > + ( echo interface ${n} is already used >&2; exit 1 )
> > > +done
> > > +
> > > +set -x
> > > +
> > > +echo setup
> > > +ifconfig ${PAIR1} inet6 rdomain ${RDOMAIN1} ${PAIR1IP}/64 up
> > > +ifconfig ${PAIR2} inet6 rdomain ${RDOMAIN2} ${PAIR2IP}/64 up
> > > +ifconfig ${PAIR1} patch ${PAIR2}
> > > +ifconfig lo${RDOMAIN1} inet 127.0.0.1/8
> > > +ifconfig lo${RDOMAIN2} inet 127.0.0.1/8
> > > +ifconfig vether${RDOMAIN1} inet6 rdomain ${RDOMAIN1} ${PAIR1PREFIX}/64 up
> > > +ifconfig vether${RDOMAIN2} inet6 rdomain ${RDOMAIN2} ${PAIR2PREFIX}/64 up
> > > +ifconfig vether${RDOMAIN2} inet6 rdomain ${RDOMAIN2} ${PAIR2PREFIX2}/64 
> > > up
> > > +sed "s/{RDOMAIN1}/${RDOMAIN1}/g;s/{PAIR1}/${PAIR1}/g" \
> > > +ospf6d.network_statement.rdomain1.conf > ospf6d.1.conf
> > > +chmod 0600 ospf6d.1.conf
> > > +sed "s/{RDOMAIN2}/${RDOMAIN2}/g;s/{PAIR2}/${PAIR2}/g" \
> > > +ospf6d.network_statement.rdomain2.conf > ospf6d.2.conf
> > > +chmod 0600 ospf6d.2.conf 
> >^
> > 
> > > +
> > > +echo add routes
> > > +route -T ${RDOMAIN2} add -inet6 default ${PAIR2PREFIX}1
> > > +route -T ${RDOMAIN2} add 2001:db8:::/126 ${PAIR2PREFIX}2
> > > +route -T ${RDOMAIN2} add 2001:db8:fffe::/64 ${PAIR2PREFIX}3 -label toOSPF
> > > +
> > > +echo start ospf6d
> > > +route -T ${RDOMAIN1} exec ${OSPF6D} \
> > > +-v -f ${OSPF6DCONFIGDIR}/ospf6d.1.conf
> > > +route -T ${RDOMAIN2} exec ${OSPF6D} \
> > > +-v -f ${OSPF6DCONFIGDIR}/ospf6d.2.conf
> > > +
> > > +sleep 120
> > > +
> > > +echo tests
> > > +route -T ${RDOMAIN1} exec ospf6ctl sh fib
> > > +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> > > +grep ${PAIR2PREFIX}/64
> > > +route -T ${RDOMAIN1} exec os

Re: ospf6d: add basic regress tests

2019-12-23 Thread Claudio Jeker
On Mon, Dec 23, 2019 at 03:24:31PM +0100, Remi Locherer wrote:
> On Sun, Dec 22, 2019 at 08:36:41PM +0100, Denis Fondras wrote:
> > Add basic regress test to ospf6d.
> 
> Works for me. OK remi@
> 
> The tests also succeed when I reduce the sleep from 120 to 60.
> A few lines end with a space. I marked them below.

I would suggest to minimize hold times etc. and reduce the timeout as
much as possible. Regress test should not wait uneccessary long.

> > 
> > Index: ospf6d/Makefile
> > ===
> > RCS file: ospf6d/Makefile
> > diff -N ospf6d/Makefile
> > --- /dev/null   1 Jan 1970 00:00:00 -
> > +++ ospf6d/Makefile 22 Dec 2019 19:27:27 -
> > @@ -0,0 +1,10 @@
> > +# $OpenBSD$
> > +
> > +REGRESS_TARGETS=   network_statement
> > +
> > +OSPF6D ?=  /usr/sbin/ospf6d
> > +
> > +network_statement:
> > +   ${SUDO} ksh ${.CURDIR}/$@.sh ${OSPF6D} ${.CURDIR} 11 12 pair11 pair12
> > +
> > +.include 
> > Index: ospf6d/network_statement.sh
> > ===
> > RCS file: ospf6d/network_statement.sh
> > diff -N ospf6d/network_statement.sh
> > --- /dev/null   1 Jan 1970 00:00:00 -
> > +++ ospf6d/network_statement.sh 22 Dec 2019 19:27:27 -
> > @@ -0,0 +1,107 @@
> > +#!/bin/ksh
> > +#  $OpenBSD$
> > +set -e
> > +
> > +OSPF6D=$1
> > +OSPF6DCONFIGDIR=$2
> > +RDOMAIN1=$3
> > +RDOMAIN2=$4
> > +PAIR1=$5
> > +PAIR2=$6
> > +
> > +RDOMAINS="${RDOMAIN1} ${RDOMAIN2}"
> > +PAIRS="${PAIR1} ${PAIR2}"
> > +PAIR1IP=2001:db8::${RDOMAIN1}
> > +PAIR2IP=2001:db8::${RDOMAIN2}
> > +PAIR1PREFIX=2001:db8:${RDOMAIN1}::
> > +PAIR2PREFIX=2001:db8:${RDOMAIN2}::
> > +PAIR2PREFIX2=2001:db8:${RDOMAIN2}:${RDOMAIN2}::
> > +
> > +error_notify() {
> > +   echo cleanup
> > +   pkill -T ${RDOMAIN1} ospf6d || true
> > +   pkill -T ${RDOMAIN2} ospf6d || true
> > +   sleep 1
> > +   ifconfig ${PAIR2} destroy || true
> > +   ifconfig ${PAIR1} destroy || true
> > +   ifconfig vether${RDOMAIN1} destroy || true
> > +   ifconfig vether${RDOMAIN2} destroy || true
> > +   route -qn -T ${RDOMAIN1} flush || true
> > +   route -qn -T ${RDOMAIN2} flush || true
> > +   ifconfig lo${RDOMAIN1} destroy || true
> > +   ifconfig lo${RDOMAIN2} destroy || true
> > +   rm ospf6d.1.conf ospf6d.2.conf
> > +   if [ $1 -ne 0 ]; then
> > +   echo FAILED
> > +   exit 1
> > +   else
> > +   echo SUCCESS
> > +   fi
> > +}
> > +
> > +if [ "$(id -u)" -ne 0 ]; then 
> ^
> 
> > +   echo need root privileges >&2
> > +   exit 1
> > +fi
> > +
> > +trap 'error_notify $?' EXIT
> > +
> > +echo check if rdomains are busy
> > +for n in ${RDOMAINS}; do
> > +   if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then
> > +   echo routing domain ${n} is already used >&2
> > +   exit 1
> > +   fi
> > +done
> > +
> > +echo check if interfaces are busy
> > +for n in ${PAIRS}; do
> > +   /sbin/ifconfig "${n}" >/dev/null 2>&1 && \
> > +   ( echo interface ${n} is already used >&2; exit 1 )
> > +done
> > +
> > +set -x
> > +
> > +echo setup
> > +ifconfig ${PAIR1} inet6 rdomain ${RDOMAIN1} ${PAIR1IP}/64 up
> > +ifconfig ${PAIR2} inet6 rdomain ${RDOMAIN2} ${PAIR2IP}/64 up
> > +ifconfig ${PAIR1} patch ${PAIR2}
> > +ifconfig lo${RDOMAIN1} inet 127.0.0.1/8
> > +ifconfig lo${RDOMAIN2} inet 127.0.0.1/8
> > +ifconfig vether${RDOMAIN1} inet6 rdomain ${RDOMAIN1} ${PAIR1PREFIX}/64 up
> > +ifconfig vether${RDOMAIN2} inet6 rdomain ${RDOMAIN2} ${PAIR2PREFIX}/64 up
> > +ifconfig vether${RDOMAIN2} inet6 rdomain ${RDOMAIN2} ${PAIR2PREFIX2}/64 up
> > +sed "s/{RDOMAIN1}/${RDOMAIN1}/g;s/{PAIR1}/${PAIR1}/g" \
> > +ospf6d.network_statement.rdomain1.conf > ospf6d.1.conf
> > +chmod 0600 ospf6d.1.conf
> > +sed "s/{RDOMAIN2}/${RDOMAIN2}/g;s/{PAIR2}/${PAIR2}/g" \
> > +ospf6d.network_statement.rdomain2.conf > ospf6d.2.conf
> > +chmod 0600 ospf6d.2.conf 
>^
> 
> > +
> > +echo add routes
> > +route -T ${RDOMAIN2} add -inet6 default ${PAIR2PREFIX}1
> > +route -T ${RDOMAIN2} add 2001:db8:::/126 ${PAIR2PREFIX}2
> > +route -T ${RDOMAIN2} add 2001:db8:fffe::/64 ${PAIR2PREFIX}3 -label toOSPF
> > +
> > +echo start ospf6d
> > +route -T ${RDOMAIN1} exec ${OSPF6D} \
> > +-v -f ${OSPF6DCONFIGDIR}/ospf6d.1.conf
> > +route -T ${RDOMAIN2} exec ${OSPF6D} \
> > +-v -f ${OSPF6DCONFIGDIR}/ospf6d.2.conf
> > +
> > +sleep 120
> > +
> > +echo tests
> > +route -T ${RDOMAIN1} exec ospf6ctl sh fib
> > +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> > +grep ${PAIR2PREFIX}/64
> > +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> > +grep ${PAIR2PREFIX2}/64
> > +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> > +grep "2001:db8:::/126"
> > +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> > +grep "::/0"
> > +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> > +grep "2001:db8:fffe::/64"
> > +
> > +exit 0
> > Index: ospf6d/ospf6d.network_statement.rdomain1.co

Re: ospf6d: add basic regress tests

2019-12-23 Thread Remi Locherer
On Sun, Dec 22, 2019 at 08:36:41PM +0100, Denis Fondras wrote:
> Add basic regress test to ospf6d.

Works for me. OK remi@

The tests also succeed when I reduce the sleep from 120 to 60.
A few lines end with a space. I marked them below.

Remi

> 
> Index: ospf6d/Makefile
> ===
> RCS file: ospf6d/Makefile
> diff -N ospf6d/Makefile
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ ospf6d/Makefile   22 Dec 2019 19:27:27 -
> @@ -0,0 +1,10 @@
> +# $OpenBSD$
> +
> +REGRESS_TARGETS  =   network_statement
> +
> +OSPF6D ?=/usr/sbin/ospf6d
> +
> +network_statement:
> + ${SUDO} ksh ${.CURDIR}/$@.sh ${OSPF6D} ${.CURDIR} 11 12 pair11 pair12
> +
> +.include 
> Index: ospf6d/network_statement.sh
> ===
> RCS file: ospf6d/network_statement.sh
> diff -N ospf6d/network_statement.sh
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ ospf6d/network_statement.sh   22 Dec 2019 19:27:27 -
> @@ -0,0 +1,107 @@
> +#!/bin/ksh
> +#$OpenBSD$
> +set -e
> +
> +OSPF6D=$1
> +OSPF6DCONFIGDIR=$2
> +RDOMAIN1=$3
> +RDOMAIN2=$4
> +PAIR1=$5
> +PAIR2=$6
> +
> +RDOMAINS="${RDOMAIN1} ${RDOMAIN2}"
> +PAIRS="${PAIR1} ${PAIR2}"
> +PAIR1IP=2001:db8::${RDOMAIN1}
> +PAIR2IP=2001:db8::${RDOMAIN2}
> +PAIR1PREFIX=2001:db8:${RDOMAIN1}::
> +PAIR2PREFIX=2001:db8:${RDOMAIN2}::
> +PAIR2PREFIX2=2001:db8:${RDOMAIN2}:${RDOMAIN2}::
> +
> +error_notify() {
> + echo cleanup
> + pkill -T ${RDOMAIN1} ospf6d || true
> + pkill -T ${RDOMAIN2} ospf6d || true
> + sleep 1
> + ifconfig ${PAIR2} destroy || true
> + ifconfig ${PAIR1} destroy || true
> + ifconfig vether${RDOMAIN1} destroy || true
> + ifconfig vether${RDOMAIN2} destroy || true
> + route -qn -T ${RDOMAIN1} flush || true
> + route -qn -T ${RDOMAIN2} flush || true
> + ifconfig lo${RDOMAIN1} destroy || true
> + ifconfig lo${RDOMAIN2} destroy || true
> + rm ospf6d.1.conf ospf6d.2.conf
> + if [ $1 -ne 0 ]; then
> + echo FAILED
> + exit 1
> + else
> + echo SUCCESS
> + fi
> +}
> +
> +if [ "$(id -u)" -ne 0 ]; then 
^

> + echo need root privileges >&2
> + exit 1
> +fi
> +
> +trap 'error_notify $?' EXIT
> +
> +echo check if rdomains are busy
> +for n in ${RDOMAINS}; do
> + if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then
> + echo routing domain ${n} is already used >&2
> + exit 1
> + fi
> +done
> +
> +echo check if interfaces are busy
> +for n in ${PAIRS}; do
> + /sbin/ifconfig "${n}" >/dev/null 2>&1 && \
> + ( echo interface ${n} is already used >&2; exit 1 )
> +done
> +
> +set -x
> +
> +echo setup
> +ifconfig ${PAIR1} inet6 rdomain ${RDOMAIN1} ${PAIR1IP}/64 up
> +ifconfig ${PAIR2} inet6 rdomain ${RDOMAIN2} ${PAIR2IP}/64 up
> +ifconfig ${PAIR1} patch ${PAIR2}
> +ifconfig lo${RDOMAIN1} inet 127.0.0.1/8
> +ifconfig lo${RDOMAIN2} inet 127.0.0.1/8
> +ifconfig vether${RDOMAIN1} inet6 rdomain ${RDOMAIN1} ${PAIR1PREFIX}/64 up
> +ifconfig vether${RDOMAIN2} inet6 rdomain ${RDOMAIN2} ${PAIR2PREFIX}/64 up
> +ifconfig vether${RDOMAIN2} inet6 rdomain ${RDOMAIN2} ${PAIR2PREFIX2}/64 up
> +sed "s/{RDOMAIN1}/${RDOMAIN1}/g;s/{PAIR1}/${PAIR1}/g" \
> +ospf6d.network_statement.rdomain1.conf > ospf6d.1.conf
> +chmod 0600 ospf6d.1.conf
> +sed "s/{RDOMAIN2}/${RDOMAIN2}/g;s/{PAIR2}/${PAIR2}/g" \
> +ospf6d.network_statement.rdomain2.conf > ospf6d.2.conf
> +chmod 0600 ospf6d.2.conf 
   ^

> +
> +echo add routes
> +route -T ${RDOMAIN2} add -inet6 default ${PAIR2PREFIX}1
> +route -T ${RDOMAIN2} add 2001:db8:::/126 ${PAIR2PREFIX}2
> +route -T ${RDOMAIN2} add 2001:db8:fffe::/64 ${PAIR2PREFIX}3 -label toOSPF
> +
> +echo start ospf6d
> +route -T ${RDOMAIN1} exec ${OSPF6D} \
> +-v -f ${OSPF6DCONFIGDIR}/ospf6d.1.conf
> +route -T ${RDOMAIN2} exec ${OSPF6D} \
> +-v -f ${OSPF6DCONFIGDIR}/ospf6d.2.conf
> +
> +sleep 120
> +
> +echo tests
> +route -T ${RDOMAIN1} exec ospf6ctl sh fib
> +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> +grep ${PAIR2PREFIX}/64
> +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> +grep ${PAIR2PREFIX2}/64
> +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> +grep "2001:db8:::/126"
> +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> +grep "::/0"
> +route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
> +grep "2001:db8:fffe::/64"
> +
> +exit 0
> Index: ospf6d/ospf6d.network_statement.rdomain1.conf
> ===
> RCS file: ospf6d/ospf6d.network_statement.rdomain1.conf
> diff -N ospf6d/ospf6d.network_statement.rdomain1.conf
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ ospf6d/ospf6d.network_statement.rdomain1.conf 22 Dec 2019 19:27:27 
> -
> @@ -0,0 +1,10 @@
> +router-id 1.1.1.1
> +rdomain {RDOMAIN1}
> +
> +fib-priority 62
> +
> +area 10.0.0.1 {
> + 

ospf6d: add basic regress tests

2019-12-22 Thread Denis Fondras
Add basic regress test to ospf6d.

Index: ospf6d/Makefile
===
RCS file: ospf6d/Makefile
diff -N ospf6d/Makefile
--- /dev/null   1 Jan 1970 00:00:00 -
+++ ospf6d/Makefile 22 Dec 2019 19:27:27 -
@@ -0,0 +1,10 @@
+# $OpenBSD$
+
+REGRESS_TARGETS=   network_statement
+
+OSPF6D ?=  /usr/sbin/ospf6d
+
+network_statement:
+   ${SUDO} ksh ${.CURDIR}/$@.sh ${OSPF6D} ${.CURDIR} 11 12 pair11 pair12
+
+.include 
Index: ospf6d/network_statement.sh
===
RCS file: ospf6d/network_statement.sh
diff -N ospf6d/network_statement.sh
--- /dev/null   1 Jan 1970 00:00:00 -
+++ ospf6d/network_statement.sh 22 Dec 2019 19:27:27 -
@@ -0,0 +1,107 @@
+#!/bin/ksh
+#  $OpenBSD$
+set -e
+
+OSPF6D=$1
+OSPF6DCONFIGDIR=$2
+RDOMAIN1=$3
+RDOMAIN2=$4
+PAIR1=$5
+PAIR2=$6
+
+RDOMAINS="${RDOMAIN1} ${RDOMAIN2}"
+PAIRS="${PAIR1} ${PAIR2}"
+PAIR1IP=2001:db8::${RDOMAIN1}
+PAIR2IP=2001:db8::${RDOMAIN2}
+PAIR1PREFIX=2001:db8:${RDOMAIN1}::
+PAIR2PREFIX=2001:db8:${RDOMAIN2}::
+PAIR2PREFIX2=2001:db8:${RDOMAIN2}:${RDOMAIN2}::
+
+error_notify() {
+   echo cleanup
+   pkill -T ${RDOMAIN1} ospf6d || true
+   pkill -T ${RDOMAIN2} ospf6d || true
+   sleep 1
+   ifconfig ${PAIR2} destroy || true
+   ifconfig ${PAIR1} destroy || true
+   ifconfig vether${RDOMAIN1} destroy || true
+   ifconfig vether${RDOMAIN2} destroy || true
+   route -qn -T ${RDOMAIN1} flush || true
+   route -qn -T ${RDOMAIN2} flush || true
+   ifconfig lo${RDOMAIN1} destroy || true
+   ifconfig lo${RDOMAIN2} destroy || true
+   rm ospf6d.1.conf ospf6d.2.conf
+   if [ $1 -ne 0 ]; then
+   echo FAILED
+   exit 1
+   else
+   echo SUCCESS
+   fi
+}
+
+if [ "$(id -u)" -ne 0 ]; then 
+   echo need root privileges >&2
+   exit 1
+fi
+
+trap 'error_notify $?' EXIT
+
+echo check if rdomains are busy
+for n in ${RDOMAINS}; do
+   if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then
+   echo routing domain ${n} is already used >&2
+   exit 1
+   fi
+done
+
+echo check if interfaces are busy
+for n in ${PAIRS}; do
+   /sbin/ifconfig "${n}" >/dev/null 2>&1 && \
+   ( echo interface ${n} is already used >&2; exit 1 )
+done
+
+set -x
+
+echo setup
+ifconfig ${PAIR1} inet6 rdomain ${RDOMAIN1} ${PAIR1IP}/64 up
+ifconfig ${PAIR2} inet6 rdomain ${RDOMAIN2} ${PAIR2IP}/64 up
+ifconfig ${PAIR1} patch ${PAIR2}
+ifconfig lo${RDOMAIN1} inet 127.0.0.1/8
+ifconfig lo${RDOMAIN2} inet 127.0.0.1/8
+ifconfig vether${RDOMAIN1} inet6 rdomain ${RDOMAIN1} ${PAIR1PREFIX}/64 up
+ifconfig vether${RDOMAIN2} inet6 rdomain ${RDOMAIN2} ${PAIR2PREFIX}/64 up
+ifconfig vether${RDOMAIN2} inet6 rdomain ${RDOMAIN2} ${PAIR2PREFIX2}/64 up
+sed "s/{RDOMAIN1}/${RDOMAIN1}/g;s/{PAIR1}/${PAIR1}/g" \
+ospf6d.network_statement.rdomain1.conf > ospf6d.1.conf
+chmod 0600 ospf6d.1.conf
+sed "s/{RDOMAIN2}/${RDOMAIN2}/g;s/{PAIR2}/${PAIR2}/g" \
+ospf6d.network_statement.rdomain2.conf > ospf6d.2.conf
+chmod 0600 ospf6d.2.conf 
+
+echo add routes
+route -T ${RDOMAIN2} add -inet6 default ${PAIR2PREFIX}1
+route -T ${RDOMAIN2} add 2001:db8:::/126 ${PAIR2PREFIX}2
+route -T ${RDOMAIN2} add 2001:db8:fffe::/64 ${PAIR2PREFIX}3 -label toOSPF
+
+echo start ospf6d
+route -T ${RDOMAIN1} exec ${OSPF6D} \
+-v -f ${OSPF6DCONFIGDIR}/ospf6d.1.conf
+route -T ${RDOMAIN2} exec ${OSPF6D} \
+-v -f ${OSPF6DCONFIGDIR}/ospf6d.2.conf
+
+sleep 120
+
+echo tests
+route -T ${RDOMAIN1} exec ospf6ctl sh fib
+route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
+grep ${PAIR2PREFIX}/64
+route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
+grep ${PAIR2PREFIX2}/64
+route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
+grep "2001:db8:::/126"
+route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
+grep "::/0"
+route -T ${RDOMAIN1} exec ospf6ctl sh rib | \
+grep "2001:db8:fffe::/64"
+
+exit 0
Index: ospf6d/ospf6d.network_statement.rdomain1.conf
===
RCS file: ospf6d/ospf6d.network_statement.rdomain1.conf
diff -N ospf6d/ospf6d.network_statement.rdomain1.conf
--- /dev/null   1 Jan 1970 00:00:00 -
+++ ospf6d/ospf6d.network_statement.rdomain1.conf   22 Dec 2019 19:27:27 
-
@@ -0,0 +1,10 @@
+router-id 1.1.1.1
+rdomain {RDOMAIN1}
+
+fib-priority 62
+
+area 10.0.0.1 {
+   interface lo{RDOMAIN1}
+   interface vether{RDOMAIN1}
+   interface {PAIR1}
+}
Index: ospf6d/ospf6d.network_statement.rdomain2.conf
===
RCS file: ospf6d/ospf6d.network_statement.rdomain2.conf
diff -N ospf6d/ospf6d.network_statement.rdomain2.conf
--- /dev/null   1 Jan 1970 00:00:00 -
+++ ospf6d/ospf6d.network_statement.rdomain2.conf   22 Dec 2019 19:27:27 
-
@@ -0,0 +1,12 @@
+router-id 2.2.2.2
+rdomain {RDOMAIN2