b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt#!/bin/sh
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt#
acce4b333de469c687908f3a04381f2897d242e9Tinderbox User# Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
b66b333f59cf51ef87f973084a5023acd9317fb2Evan HuntSYSTEMTESTTOP=..
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt. $SYSTEMTESTTOP/conf.sh
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
b66b333f59cf51ef87f973084a5023acd9317fb2Evan HuntRNDCCMD="$RNDC -p 9953 -c ../common/rndc.conf"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7204d08a319cf590ae4280b8cc20999320398574Mark Andrewsfor bad in bad-*.conf
7204d08a319cf590ae4280b8cc20999320398574Mark Andrewsdo
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=0
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I: checking that named-checkconf detects error in $bad"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt $CHECKCONF $bad > /dev/null 2>&1
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt if [ $? != 1 ]; then echo "I:failed"; ret=1; fi
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt status=`expr $status + $ret`
7204d08a319cf590ae4280b8cc20999320398574Mark Andrewsdone
7204d08a319cf590ae4280b8cc20999320398574Mark Andrews
7204d08a319cf590ae4280b8cc20999320398574Mark Andrewsfor good in good-*.conf
7204d08a319cf590ae4280b8cc20999320398574Mark Andrewsdo
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=0
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I: checking that named-checkconf detects no error in $good"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt $CHECKCONF $good > /dev/null 2>&1
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt if [ $? != 0 ]; then echo "I:failed"; ret=1; fi
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt status=`expr $status + $ret`
7204d08a319cf590ae4280b8cc20999320398574Mark Andrewsdone
7204d08a319cf590ae4280b8cc20999320398574Mark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews$DIG +short @10.53.0.3 -p 5300 a.example > dig.out
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Hunt# check three different dnstap reopen/roll methods:
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Hunt# ns1: dnstap-reopen; ns2: dnstap -reopen; ns3: dnstap -roll
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsmv ns1/dnstap.out ns1/dnstap.out.save
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsmv ns2/dnstap.out ns2/dnstap.out.save
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrewsif [ -n "$FSTRM_CAPTURE" ] ; then
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $FSTRM_CAPTURE -t protobuf:dnstap.Dnstap -u ns4/dnstap.out \
178dc0e1d617a6ef6387e9942ba9cdb370d1bde2Mark Andrews -w dnstap.out > fstrm_capture.out 2>&1 &
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews fstrm_capture_pid=$!
15bee593e70faca91a00331184fbbbc66080d422Mark Andrewsfi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews$RNDCCMD -s 10.53.0.1 dnstap-reopen | sed 's/^/I:ns1 /'
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Hunt$RNDCCMD -s 10.53.0.2 dnstap -reopen | sed 's/^/I:ns2 /'
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Hunt$RNDCCMD -s 10.53.0.3 dnstap -roll | sed 's/^/I:ns3 /'
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews$RNDCCMD -s 10.53.0.4 dnstap -reopen | sed 's/^/I:ns4 /'
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt$DIG +short @10.53.0.3 -p 5300 a.example > dig.out
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# XXX: file output should be flushed once a second according
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# to the libfstrm source, but it doesn't seem to happen until
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# enough data has accumulated. to get all the output, we stop
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# the name servers, forcing a flush on shutdown. it would be
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# nice to find a better way to do this.
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt$RNDCCMD -s 10.53.0.1 stop | sed 's/^/I:ns1 /'
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt$RNDCCMD -s 10.53.0.2 stop | sed 's/^/I:ns2 /'
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt$RNDCCMD -s 10.53.0.3 stop | sed 's/^/I:ns3 /'
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntsleep 1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7df3f06c0bf0b78a88221348d6af6704d9ece7efMark Andrewsecho "I:checking initial message counts"
7df3f06c0bf0b78a88221348d6af6704d9ece7efMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp1=`$DNSTAPREAD ns1/dnstap.out.save | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp1=`$DNSTAPREAD ns1/dnstap.out.save | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq1=`$DNSTAPREAD ns1/dnstap.out.save | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar1=`$DNSTAPREAD ns1/dnstap.out.save | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq1=`$DNSTAPREAD ns1/dnstap.out.save | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr1=`$DNSTAPREAD ns1/dnstap.out.save | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq1=`$DNSTAPREAD ns1/dnstap.out.save | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr1=`$DNSTAPREAD ns1/dnstap.out.save | grep "RR " | wc -l`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp2=`$DNSTAPREAD ns2/dnstap.out.save | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp2=`$DNSTAPREAD ns2/dnstap.out.save | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq2=`$DNSTAPREAD ns2/dnstap.out.save | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar2=`$DNSTAPREAD ns2/dnstap.out.save | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq2=`$DNSTAPREAD ns2/dnstap.out.save | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr2=`$DNSTAPREAD ns2/dnstap.out.save | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq2=`$DNSTAPREAD ns2/dnstap.out.save | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr2=`$DNSTAPREAD ns2/dnstap.out.save | grep "RR " | wc -l`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Huntmv ns3/dnstap.out.0 ns3/dnstap.out.save
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp3=`$DNSTAPREAD ns3/dnstap.out.save | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp3=`$DNSTAPREAD ns3/dnstap.out.save | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq3=`$DNSTAPREAD ns3/dnstap.out.save | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar3=`$DNSTAPREAD ns3/dnstap.out.save | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq3=`$DNSTAPREAD ns3/dnstap.out.save | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr3=`$DNSTAPREAD ns3/dnstap.out.save | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq3=`$DNSTAPREAD ns3/dnstap.out.save | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr3=`$DNSTAPREAD ns3/dnstap.out.save | grep "RR " | wc -l`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking UDP message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntret=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $udp1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $udp1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $udp2 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $udp2 expected 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $udp3 -eq 4 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $udp3 expected 4"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=`expr $status + $ret`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking TCP message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntret=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $tcp1 -eq 6 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $tcp1 expected 6"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $tcp2 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $tcp2 expected 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $tcp3 -eq 6 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $tcp3 expected 6"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=`expr $status + $ret`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking AUTH_QUERY message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntret=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $aq1 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $aq1 exepcted 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $aq2 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $aq2 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $aq3 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $aq3 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=`expr $status + $ret`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking AUTH_RESPONSE message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntret=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $ar1 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $ar1 expected 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $ar2 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $ar2 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $ar3 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $ar3 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=`expr $status + $ret`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking CLIENT_QUERY message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntret=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $cq1 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $cq1 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $cq2 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $cq2 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $cq3 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $cq3 expected 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=`expr $status + $ret`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking CLIENT_RESPONSE message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntret=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $cr1 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $cr1 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $cr2 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $cr2 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $cr3 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $cr3 expected 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=`expr $status + $ret`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking RESOLVER_QUERY message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntret=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $rq1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $rq1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $rq2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $rq2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $rq3 -eq 3 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $rq3 expected 3"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=`expr $status + $ret`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking RESOLVER_RESPONSE message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntret=0
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $rr1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $rr1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $rr2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $rr2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt[ $rr3 -eq 3 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $rr3 expected 3"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsstatus=`expr $status + $ret`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7df3f06c0bf0b78a88221348d6af6704d9ece7efMark Andrewsecho "I:checking reopened message counts"
7df3f06c0bf0b78a88221348d6af6704d9ece7efMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp1=`$DNSTAPREAD ns1/dnstap.out | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp1=`$DNSTAPREAD ns1/dnstap.out | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq1=`$DNSTAPREAD ns1/dnstap.out | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar1=`$DNSTAPREAD ns1/dnstap.out | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq1=`$DNSTAPREAD ns1/dnstap.out | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr1=`$DNSTAPREAD ns1/dnstap.out | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq1=`$DNSTAPREAD ns1/dnstap.out | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr1=`$DNSTAPREAD ns1/dnstap.out | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp2=`$DNSTAPREAD ns2/dnstap.out | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp2=`$DNSTAPREAD ns2/dnstap.out | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq2=`$DNSTAPREAD ns2/dnstap.out | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar2=`$DNSTAPREAD ns2/dnstap.out | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq2=`$DNSTAPREAD ns2/dnstap.out | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr2=`$DNSTAPREAD ns2/dnstap.out | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq2=`$DNSTAPREAD ns2/dnstap.out | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr2=`$DNSTAPREAD ns2/dnstap.out | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp3=`$DNSTAPREAD ns3/dnstap.out | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp3=`$DNSTAPREAD ns3/dnstap.out | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq3=`$DNSTAPREAD ns3/dnstap.out | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar3=`$DNSTAPREAD ns3/dnstap.out | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq3=`$DNSTAPREAD ns3/dnstap.out | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr3=`$DNSTAPREAD ns3/dnstap.out | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq3=`$DNSTAPREAD ns3/dnstap.out | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr3=`$DNSTAPREAD ns3/dnstap.out | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking UDP message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsret=0
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $udp1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $udp1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $udp2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $udp2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $udp3 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $udp3 expected 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsstatus=`expr $status + $ret`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking TCP message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsret=0
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $tcp1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $tcp1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $tcp2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $tcp2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $tcp3 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $tcp3 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsstatus=`expr $status + $ret`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking AUTH_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsret=0
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $aq1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $aq1 exepcted 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $aq2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $aq2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $aq3 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $aq3 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsstatus=`expr $status + $ret`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking AUTH_RESPONSE message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsret=0
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $ar1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $ar1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $ar2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $ar2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $ar3 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $ar3 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsstatus=`expr $status + $ret`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking CLIENT_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsret=0
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $cq1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $cq1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $cq2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $cq2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $cq3 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $cq3 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsstatus=`expr $status + $ret`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking CLIENT_RESPONSE message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsret=0
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $cr1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $cr1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $cr2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $cr2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $cr3 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $cr3 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsstatus=`expr $status + $ret`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking RESOLVER_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsret=0
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $rq1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $rq1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $rq2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $rq2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $rq3 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $rq3 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsstatus=`expr $status + $ret`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking RESOLVER_RESPONSE message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsret=0
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $rr1 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns1 $rr1 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $rr2 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns2 $rr2 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews[ $rr3 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns3 $rr3 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews}
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsif [ $ret != 0 ]; then echo "I: failed"; fi
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntstatus=`expr $status + $ret`
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpkHAS_PYYAML=0
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpkif [ -n "$PYTHON" ] ; then
b498959ce2ab3d0d807ff7175c0607124e8b421dMark Andrews $PYTHON -c "import yaml" 2> /dev/null && HAS_PYYAML=1
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpkfi
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk
b498959ce2ab3d0d807ff7175c0607124e8b421dMark Andrewsif [ $HAS_PYYAML -ne 0 ] ; then
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk echo "I:checking dnstap-read YAML output"
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk ret=0
b089df4f8433e2deadec7aa7b50a1c80fa66fe48Mark Andrews $PYTHON ydump.py "$DNSTAPREAD" "ns3/dnstap.out.save" > ydump.out || ret=1
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk if [ $ret != 0 ]; then echo "I: failed"; fi
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk status=`expr $status + $ret`
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpkfi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrewsif [ -n "$FSTRM_CAPTURE" ] ; then
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $DIG +short @10.53.0.4 -p 5300 a.example > dig.out
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I:checking unix socket message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews sleep 2
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews kill $fstrm_capture_pid
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews wait
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews udp4=`$DNSTAPREAD dnstap.out | grep "UDP " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews tcp4=`$DNSTAPREAD dnstap.out | grep "TCP " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews aq4=`$DNSTAPREAD dnstap.out | grep "AQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ar4=`$DNSTAPREAD dnstap.out | grep "AR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews cq4=`$DNSTAPREAD dnstap.out | grep "CQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews cr4=`$DNSTAPREAD dnstap.out | grep "CR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews rq4=`$DNSTAPREAD dnstap.out | grep "RQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews rr4=`$DNSTAPREAD dnstap.out | grep "RR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking UDP message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $udp4 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $udp4 expected 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking TCP message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $tcp4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $tcp4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking AUTH_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $aq4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $aq4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking AUTH_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $ar4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $ar4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking CLIENT_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $cq4 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $cq4 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking CLIENT_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $cr4 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $cr4 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking RESOLVER_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $rq4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $rq4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking RESOLVER_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $rr4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $rr4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews mv dnstap.out dnstap.out.save
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $FSTRM_CAPTURE -t protobuf:dnstap.Dnstap -u ns4/dnstap.out \
178dc0e1d617a6ef6387e9942ba9cdb370d1bde2Mark Andrews -w dnstap.out > fstrm_capture.out 2>&1 &
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews fstrm_capture_pid=$!
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $RNDCCMD -s 10.53.0.4 dnstap -reopen | sed 's/^/I:ns4 /'
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $DIG +short @10.53.0.4 -p 5300 a.example > dig.out
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I:checking reopened unix socket message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews sleep 2
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews kill $fstrm_capture_pid
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews wait
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews udp4=`$DNSTAPREAD dnstap.out | grep "UDP " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews tcp4=`$DNSTAPREAD dnstap.out | grep "TCP " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews aq4=`$DNSTAPREAD dnstap.out | grep "AQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ar4=`$DNSTAPREAD dnstap.out | grep "AR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews cq4=`$DNSTAPREAD dnstap.out | grep "CQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews cr4=`$DNSTAPREAD dnstap.out | grep "CR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews rq4=`$DNSTAPREAD dnstap.out | grep "RQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews rr4=`$DNSTAPREAD dnstap.out | grep "RR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking UDP message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $udp4 -eq 2 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $udp4 expected 2"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking TCP message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $tcp4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $tcp4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking AUTH_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $aq4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $aq4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking AUTH_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $ar4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $ar4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking CLIENT_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $cq4 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $cq4 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking CLIENT_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $cr4 -eq 1 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $cr4 expected 1"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking RESOLVER_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $rq4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $rq4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews if [ $ret != 0 ]; then echo "I: failed"; fi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews status=`expr $status + $ret`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking RESOLVER_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ret=0
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews [ $rr4 -eq 0 ] || {
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I:ns4 $rr4 expected 0"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews }
15bee593e70faca91a00331184fbbbc66080d422Mark Andrewsfi
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntecho "I:exit status: $status"
3635d8f9104e70e141a8f191a0e6c1502ceed2f3Mark Andrews[ $status -eq 0 ] || exit 1