0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2000, 2001, 2004, 2007, 2011-2016 Internet Systems Consortium, Inc. ("ISC")
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/.
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews# Wait up to 10 seconds for the servers to finish starting before testing.
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews $DIG +tcp example @10.53.0.2 soa -p 5300 > dig.out.ns2.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews grep "status: NOERROR" dig.out.ns2.test$n > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews grep "flags:.* aa[ ;]" dig.out.ns2.test$n > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews $DIG +tcp example @10.53.0.3 soa -p 5300 > dig.out.ns3.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews grep "status: NOERROR" dig.out.ns3.test$n > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews grep "flags:.* aa[ ;]" dig.out.ns3.test$n > /dev/null || ret=1
10c12aa5493f34920585164c5fb54a7ac9109fbdMark Andrews nr=`grep 'x[0-9].*sending notify to' ns2/named.run | wc -l`
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsecho "I:checking initial status ($n)"
813d6c9781d1fb48bb5c1d6d3415e65f7be5eeb0Andreas Gustafsson$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews @10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsgrep "10.0.0.1" dig.out.ns2.test$n > /dev/null || ret=1
813d6c9781d1fb48bb5c1d6d3415e65f7be5eeb0Andreas Gustafsson$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews @10.53.0.3 a -p 5300 > dig.out.ns3.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsgrep "10.0.0.1" dig.out.ns3.test$n > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
10c12aa5493f34920585164c5fb54a7ac9109fbdMark Andrewsecho "I:checking startup notify rate limit ($n)"
10c12aa5493f34920585164c5fb54a7ac9109fbdMark Andrewsgrep 'x[0-9].*sending notify to' ns2/named.run |
10c12aa5493f34920585164c5fb54a7ac9109fbdMark Andrews sed 's/.*:\([0-9][0-9]\)\..*/\1/' | uniq -c | awk '{print $1}' > log.out
10c12aa5493f34920585164c5fb54a7ac9109fbdMark Andrews# the notifies should span at least 4 seconds
10c12aa5493f34920585164c5fb54a7ac9109fbdMark Andrewswc -l log.out | awk '$1 < 4 { exit(1) }' || ret=1
10c12aa5493f34920585164c5fb54a7ac9109fbdMark Andrews# ... with no more than 5 in any one second
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewssleep 1 # make sure filesystem time stamp is newer for reload.
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecickiif [ ! "$CYGWIN" ]; then
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki echo "I:reloading with example2 using HUP and waiting up to 45 seconds"
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki echo "I:reloading with example2 using rndc and waiting up to 45 seconds"
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
f9b167290a56481a75528491ced77e9ce8c6181dMukund Sivaraman grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 2$' ns3/named.run > /dev/null && break
c6eb92beb1951b0634c349b24891522c273e9f69Mark Andrewsecho "I:checking notify message was logged ($n)"
c6eb92beb1951b0634c349b24891522c273e9f69Mark Andrewsgrep 'notify from 10.53.0.2#[0-9][0-9]*: serial 2$' ns3/named.run > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsecho "I:checking example2 loaded ($n)"
813d6c9781d1fb48bb5c1d6d3415e65f7be5eeb0Andreas Gustafsson$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews @10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsgrep "10.0.0.2" dig.out.ns2.test$n > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsecho "I:checking example2 contents have been transferred after HUP reload ($n)"
813d6c9781d1fb48bb5c1d6d3415e65f7be5eeb0Andreas Gustafsson$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews @10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsgrep "10.0.0.2" dig.out.ns2.test$n > /dev/null || ret=1
813d6c9781d1fb48bb5c1d6d3415e65f7be5eeb0Andreas Gustafsson$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews @10.53.0.3 a -p 5300 > dig.out.ns3.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsgrep "10.0.0.2" dig.out.ns3.test$n > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
f9b167290a56481a75528491ced77e9ce8c6181dMukund Sivaramanecho "I:stopping master and restarting with example4 then waiting up to 45 seconds"
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews$PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns2
f9b167290a56481a75528491ced77e9ce8c6181dMukund Sivaraman grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 4$' ns3/named.run > /dev/null && break
c6eb92beb1951b0634c349b24891522c273e9f69Mark Andrewsecho "I:checking notify message was logged ($n)"
c6eb92beb1951b0634c349b24891522c273e9f69Mark Andrewsgrep 'notify from 10.53.0.2#[0-9][0-9]*: serial 4$' ns3/named.run > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsecho "I:checking example4 loaded ($n)"
813d6c9781d1fb48bb5c1d6d3415e65f7be5eeb0Andreas Gustafsson$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews @10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsgrep "10.0.0.4" dig.out.ns2.test$n > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsecho "I:checking example4 contents have been transfered after restart ($n)"
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews @10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsgrep "10.0.0.4" dig.out.ns2.test$n > /dev/null || ret=1
813d6c9781d1fb48bb5c1d6d3415e65f7be5eeb0Andreas Gustafsson$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews @10.53.0.3 a -p 5300 > dig.out.ns3.test$n || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrewsgrep "10.0.0.4" dig.out.ns3.test$n > /dev/null || ret=1
2da036f2315fe375ee83fe79893bd52cbf07a8a1Mark Andrews$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
d040fa2f1c9c3045420ee25933b699290ab19250Mark Andrewsecho "I:checking notify to alternate port with master inheritance"
d040fa2f1c9c3045420ee25933b699290ab19250Mark Andrewsserver 10.53.0.2 5300
d040fa2f1c9c3045420ee25933b699290ab19250Mark Andrewsupdate add added.x21 0 in txt "test string"
d040fa2f1c9c3045420ee25933b699290ab19250Mark Andrews $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd added.x21.\
d040fa2f1c9c3045420ee25933b699290ab19250Mark Andrews @10.53.0.4 txt -p 5301 > dig.out.ns4.test$n || ret=1
d040fa2f1c9c3045420ee25933b699290ab19250Mark Andrews grep "test string" dig.out.ns4.test$n > /dev/null && break
d040fa2f1c9c3045420ee25933b699290ab19250Mark Andrewsgrep "test string" dig.out.ns4.test$n > /dev/null || ret=1
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrewsecho "I:checking notify to multiple views using tsig"
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrewsserver 10.53.0.5 5300
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrewskey a aaaaaaaaaaaaaaaaaaaa
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrewsupdate add added.x21 0 in txt "test string"
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrews $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd added.x21.\
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrews $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd added.x21.\
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrews grep "test string" dig.out.b.ns5.test$n > /dev/null &&
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrews grep "test string" dig.out.c.ns5.test$n > /dev/null &&
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrewsgrep "test string" dig.out.b.ns5.test$n > /dev/null || ret=1
f8eb4e5bfd1129d7639af5c2c768f53f0895952aMark Andrewsgrep "test string" dig.out.c.ns5.test$n > /dev/null || ret=1
1e8c2e72e7d0f48ac37b9b15712e638631b3b619Brian Wellingtonecho "I:exit status: $status"