if cls._config_domains is not None:
conf.write("domains:\n")
- for domain, master in cls._config_domains.items():
- conf.write(" - domain: %s\n" % (domain))
- conf.write(" master: %s\n" % (master))
+ for item in cls._config_domains:
+ conf.write(" - domain: %s\n" % (item['domain']))
+ conf.write(" master: %s\n" % (item['master']))
+ if ('notify' in item) :
+ conf.write(" notify: %s\n" % (item['notify']))
ixfrdistcmd = [os.environ['IXFRDISTBIN'], '--config', conffile, '--debug']
import dns.serial
import time
import itertools
+import socket
from ixfrdisttests import IXFRDistTest
from xfrserver.xfrserver import AXFRServer
global xfrServerPort
_xfrDone = 0
- _config_domains = { 'example': '127.0.0.1:' + str(xfrServerPort), # zone for actual XFR testing
- 'example2': '127.0.0.1:1', # bogus port is intentional - zone is intentionally unloadable
- # example3 # intentionally absent for 'unconfigured zone' testing
- 'example4': '127.0.0.1:' + str(xfrServerPort) } # for testing how ixfrdist deals with getting the wrong zone on XFR
+ _config_domains = [
+ # zone for actual XFR testing
+ {"domain" : "example", "master" : "127.0.0.1:" + str(xfrServerPort), 'notify' : "127.0.0.1:" + str(xfrServerPort + 1)},
+ # bogus port is intentional - zone is intentionally unloadable
+ {"domain" : "example2", "master" : "127.0.0.1:1"},
+ # for testing how ixfrdist deals with getting the wrong zone on XFR
+ {"domain" : "example4", "master" : '127.0.0.1:' + str(xfrServerPort)},
+
+ ]
_loaded_serials = []
@classmethod
def checkFullZone(self, serial):
global zones
-
+
# FIXME: 90% duplication from _getRecordsForSerial
zone = []
for i in dns.zone.from_text(zones[serial], relativize=False).iterate_rdatasets():
self.checkIXFR(2,3)
self.checkIXFR(1,3)
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ sock.bind(("127.0.0.1", xfrServerPort + 1))
+ sock.settimeout(2)
+
self.waitUntilCorrectSerialIsLoaded(serial=4, timeout=10, notify=True)
+
+ # recv the forwarded NOTIFY
+ data, addr = sock.recvfrom(4096)
+ received = dns.message.from_wire(data)
+ sock.close()
+
+ notif = dns.message.make_query('example.', 'SOA')
+ notif.set_opcode(dns.opcode.NOTIFY)
+ notif.flags |= dns.flags.AA
+ notif.flags &= ~dns.flags.RD
+ notif.id = received.id
+
+ self.assertEqual(received, notif)
+
self.checkFullZone(4)
self.checkIXFR(3,4)
self.checkIXFR(2,4)