]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check synth-from-dnssec XML counters
authorMark Andrews <marka@isc.org>
Thu, 28 Oct 2021 22:41:31 +0000 (09:41 +1100)
committerPetr Špaček <pspacek@isc.org>
Thu, 2 Dec 2021 13:18:41 +0000 (14:18 +0100)
bin/tests/system/synthfromdnssec/clean.sh
bin/tests/system/synthfromdnssec/ns1/named.conf.in
bin/tests/system/synthfromdnssec/ns2/named.conf.in
bin/tests/system/synthfromdnssec/ns3/named.conf.in
bin/tests/system/synthfromdnssec/ns4/named.conf.in
bin/tests/system/synthfromdnssec/ns5/named.conf.in
bin/tests/system/synthfromdnssec/ns6/named.conf.in
bin/tests/system/synthfromdnssec/tests.sh

index b02e421536ee3c2f8eaf71be5c73a08610e92d5c..9d247e78bf396ef15912a97854248cc1c8543428 100644 (file)
@@ -39,3 +39,4 @@ rm -f ./wild.out ./insecure.wild.out
 rm -f ./wildcname.out ./insecure.wildcname.out
 rm -f ./minimal.nxdomain.out
 rm -f ./black.out
+rm -f ./xml.out*
index 192979965fa82f64bd4acc66dfeefa9d9ddf8a4d..7f157df3ff59f580c9bc33b5e0ed179a32419a43 100644 (file)
@@ -33,6 +33,10 @@ controls {
        inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
+statistics-channels {
+       inet 10.53.0.1 port @EXTRAPORT1@ allow { any; };
+};
+
 zone "." {
        type primary;
        file "root.db.signed";
index ffb32b9ae1878d65caa0b68da2ba9e089eee60fb..201ab7735e24731017c91ca5e46f6be6cea3ae91 100644 (file)
@@ -33,6 +33,10 @@ controls {
        inet 10.53.0.2 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
+statistics-channels {
+       inet 10.53.0.2 port @EXTRAPORT1@ allow { any; };
+};
+
 zone "." {
        type hint;
        file "root.hints";
index fcc44a2d8a53f72341aec22e57b16b1035ef5c81..1fa6f3f27a74538e5d04cecba6f012349eb7313a 100644 (file)
@@ -33,6 +33,10 @@ controls {
        inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
+statistics-channels {
+       inet 10.53.0.3 port @EXTRAPORT1@ allow { any; };
+};
+
 zone "." {
        type hint;
        file "root.hints";
index 32e4845c355f4072423306d912df2637013a9b28..06fc825f5ad0c8235144422f35ad648042ae2b5f 100644 (file)
@@ -34,6 +34,10 @@ controls {
        inet 10.53.0.4 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
+statistics-channels {
+       inet 10.53.0.4 port @EXTRAPORT1@ allow { any; };
+};
+
 zone "." {
        type hint;
        file "root.hints";
index 0dc554aa0e4a8822f01c4c313de433ca5a843f6f..85672b47807a28ef702e076c149d082207c385f8 100644 (file)
@@ -34,6 +34,10 @@ controls {
        inet 10.53.0.5 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
+statistics-channels {
+       inet 10.53.0.5 port @EXTRAPORT1@ allow { any; };
+};
+
 zone "." {
        type hint;
        file "root.hints";
index 0b2c712a0034d616f8726cd17a74bf5aa7aafb19..76cb5f64d68265dcc86c261576456910c3abce9d 100644 (file)
@@ -34,6 +34,10 @@ controls {
        inet 10.53.0.6 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
+statistics-channels {
+       inet 10.53.0.6 port @EXTRAPORT1@ allow { any; };
+};
+
 zone "." {
        type hint;
        file "root.hints";
index 51db3e97ed2809275dd09926ffec28263e87c8a3..a7cd51266d97d2d1a7062916a3e35d83bab2c656 100644 (file)
@@ -424,6 +424,71 @@ do
        if [ $ret != 0 ]; then echo_i "failed"; fi
        status=$((status+ret))
    done
+
+   if ${FEATURETEST} --have-libxml2 && [ -x "${CURL}" ] ; then
+       echo_i "getting XML statisistcs for (synth-from-dnssec ${description};) ($n)"
+       ret=0
+       xml=xml.out$n
+       ${CURL} http://10.53.0.${ns}:${EXTRAPORT1}/xml/v3/server > $xml 2>/dev/null || ret=1
+       n=$((n+1))
+       if [ $ret != 0 ]; then echo_i "failed"; fi
+       status=$((status+ret))
+
+       echo_i "check XML for 'CoveringNSEC' with (synth-from-dnssec ${description};) ($n)"
+       ret=0
+       counter=$(sed -n 's;.*<view name="_default">.*\(<counter name="CoveringNSEC">[0-9]*</counter>\).*</view><view.*;\1;gp' $xml)
+       count=$(echo "$counter" | grep CoveringNSEC | wc -l)
+       test $count = 1 || ret=1
+       zero=$(echo "$counter" | grep ">0<" | wc -l)
+       if [ ${synth} = yes ]
+       then
+           test $zero = 0 || ret=1
+       else
+           test $zero = 1 || ret=1
+       fi
+       n=$((n+1))
+       if [ $ret != 0 ]; then echo_i "failed"; fi
+       status=$((status+ret))
+
+       echo_i "check XML for 'CacheNSECNodes' with (synth-from-dnssec ${description};) ($n)"
+       ret=0
+       counter=$(sed -n 's;.*<view name="_default">.*\(<counter name="CacheNSECNodes">[0-9]*</counter>\).*</view><view.*;\1;gp' $xml)
+       count=$(echo "$counter" | grep CacheNSECNodes | wc -l)
+       test $count = 1 || ret=1
+       zero=$(echo "$counter" | grep ">0<" | wc -l)
+       if [ ${ad} = yes ]
+       then
+           test $zero = 0 || ret=1
+       else
+           test $zero = 1 || ret=1
+       fi
+       n=$((n+1))
+       if [ $ret != 0 ]; then echo_i "failed"; fi
+       status=$((status+ret))
+
+       for synthesized in SynthNXDOMAIN SynthNODATA SynthWILDCARD
+       do
+           case $synthesized in
+           SynthNXDOMAIN) count=1;;
+           SynthNODATA) count=2;;
+           SynthWILDCARD) count=2;;
+           esac
+
+           echo_i "check XML for '$synthesized}' with (synth-from-dnssec ${description};) ($n)"
+           ret=0
+           if [ ${synth} = yes ]
+           then
+               grep '<counter name="'$synthesized'">'$count'</counter>' $xml > /dev/null || ret=1
+           else
+               grep '<counter name="'$synthesized'">'0'</counter>' $xml > /dev/null || ret=1
+           fi
+           n=$((n+1))
+           if [ $ret != 0 ]; then echo_i "failed"; fi
+           status=$((status+ret))
+       done
+   else
+       echo_i "Skipping XML statistics checks"
+   fi
 done
 
 echo_i "check redirect response (+dnssec) (synth-from-dnssec <default>;) ($n)"