コード例 #1
0
ファイル: test.py プロジェクト: zhishupp/knot
def reload_zone(serial, version):
    master.update_zonefile(zone, version)
    master.reload()
    new_serial = master.zone_wait(zone)
    if new_serial != serial:
        set_err("SOA MISMATCH")
        detail_log("!Zone '%s' SOA serial %s != %s" % (zone[0].name, new_serial, serial))
        return
    resp = master.dig("new-record%d.%s" % (version, zone[0].name), "A")
    resp.check(rcode="NOERROR")
コード例 #2
0
ファイル: test.py プロジェクト: dnstap/knot
def reload_zone(serial, version):
    master.update_zonefile(zone, version)
    master.reload()
    new_serial = master.zone_wait(zone)
    if new_serial != serial:
        set_err("SOA MISMATCH")
        detail_log("!Zone '%s' SOA serial %s != %s" % (zone[0].name, new_serial, serial))
        return
    resp = master.dig("new-record%d.%s" % (version, zone[0].name), "A")
    resp.check(rcode="NOERROR")
コード例 #3
0
ファイル: test.py プロジェクト: systemcrash/knot
def check_keys(server, zone_name, expect_keys):
    cmd = Popen([
        dnstest.params.keymgr_bin, "-d", server.dir + "/keys", zone_name,
        "list"
    ],
                stdout=PIPE,
                stderr=PIPE,
                universal_newlines=True)
    (stdout, stderr) = cmd.communicate()
    lines = len(stdout.splitlines())
    if lines != expect_keys:
        set_err("CHECK # of KEYS (%d != %d)" % (lines, expect_keys))
コード例 #4
0
ファイル: test.py プロジェクト: labuwx/knot
def reload_zone(version, exp_serial, exp_version):
    master.update_zonefile(zone, version)

    if random.random() < 0.5:
        master.reload()
    else:
        master.ctl(random.choice(["-f", " "]) + " zone-reload " + zone[0].name,
                   wait=True)

    new_serial = master.zone_wait(zone)
    if new_serial != exp_serial:
        set_err("SOA MISMATCH")
        detail_log("!Zone '%s' SOA serial %s != %s" %
                   (zone[0].name, new_serial, exp_serial))
        return
    resp = master.dig("new-record%d.%s" % (exp_version, zone[0].name), "A")
    resp.check(rcode="NOERROR")
コード例 #5
0
def reload_zone(version, exp_serial, exp_version, msg):
    master.update_zonefile(zone, version)

    opt = random.choice([1, 2, 3])
    if opt == 1:
        master.reload()
    if opt == 2:
        master.ctl("zone-reload " + zone[0].name) # the reload should fail -> no blocking mode, no error
        t.sleep(2)
    if opt == 3:
        master.ctl("-f zone-reload " + zone[0].name, wait=True)
        t.sleep(1) # forced zone-reload does *only schedule* LOAD event

    new_serial = master.zone_wait(zone)
    if new_serial != exp_serial:
        set_err("SOA MISMATCH %s (%d)" % (msg, opt))
        detail_log("!Zone '%s' SOA serial %s != %s" % (zone[0].name, new_serial, exp_serial))
        return
    resp = master.dig("new-record%d.%s" % (exp_version, zone[0].name), "A")
    resp.check(rcode="NOERROR")
コード例 #6
0
resp0.check_count(2, "DNSKEY")
dnskey0 = resp0.resp.answer[0].to_rdataset()[0]
up = master.update(zone[1])
up.delete("junk.bar.zones.catalog1.", "PTR", "cataloged2.")
up.add("junk.bar.zones.catalog1.", 0, "PTR", "cataloged2.")
up.send("NOERROR")
t.sleep(4)
resp1 = slave.dig("cataloged2.", "DNSKEY")
resp1.check_count(2, "DNSKEY")
match = 0
if resp1.count("DNSKEY") > 0:
    for dnskey1 in resp1.resp.answer[0].to_rdataset():
        if dnskey1.to_text() == dnskey0.to_text():
             match = match + 1
if match < 1:
    set_err("ZONE PURGED")
    dnskey1 = dnskey0
else:
    dnskey1 = resp1.resp.answer[0].to_rdataset()[0]

# Check remove-adding the zone: shall effectively purge it
up = master.update(zone[1])
up.delete("junk.bar.zones.catalog1.", "PTR", "cataloged2.")
up.add("junk.bar2.zones.catalog1.", 0, "PTR", "cataloged2.")
up.send("NOERROR")
t.sleep(4)
shutil.copy(t.data_dir + "/cataloged2.zone", master.dir + "/master") # because the purge deletes even zonefile
master.ctl("zone-reload cataloged2.")
t.sleep(6)
resp2 = slave.dig("cataloged2.", "DNSKEY")
resp2.check_count(2, "DNSKEY")
コード例 #7
0
t.link(zone, server)
server.dnssec(zone).enable = True

t.start()

serial = server.zone_wait(zone)

scripts = [
    ("insensitive RRs", "modify-insensitive.awk", False),
    ("NSEC RR", "modify-nsec.awk", True),
    ("LP RR", "modify-lp.awk", True),
]

for name, script, resign in scripts:
    t.sleep(1)
    server.flush()
    server.stop()
    patch_zone(t, server, zone, script)
    server.start()

    new_serial = server.zone_wait(zone)
    signed = new_serial != serial

    if signed != resign:
        set_err("Invalid state after %s change" % name)
        break

    serial = new_serial

t.stop()
コード例 #8
0
ファイル: test.py プロジェクト: gitter-badger/knot
t.link(zone, server)

t.start()

serial = server.zone_wait(zone)

scripts = [
    ("insensitive RRs", "modify-insensitive.awk", False),
    ("NSEC RR", "modify-nsec.awk", True),
    ("LP RR", "modify-lp.awk", True),
]

for name, script, resign in scripts:
    t.sleep(1)
    server.flush()
    server.stop()
    patch_zone(t, server, zone, script)
    server.start()

    new_serial = server.zone_wait(zone)
    signed = new_serial != serial

    if signed != resign:
        set_err("Invalid state after %s change" % name)
        break

    serial = new_serial

t.stop()