本文整理汇总了Python中dnstest.test.Test.zone_rnd方法的典型用法代码示例。如果您正苦于以下问题:Python Test.zone_rnd方法的具体用法?Python Test.zone_rnd怎么用?Python Test.zone_rnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dnstest.test.Test
的用法示例。
在下文中一共展示了Test.zone_rnd方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test
# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import zone_rnd [as 别名]
#!/usr/bin/env python3
'''Test for AXFR from Knot to Bind'''
from dnstest.test import Test
t = Test()
master = t.server("knot")
slave = t.server("bind")
zones = t.zone_rnd(10) + t.zone(".") + t.zone("wild.") + \
t.zone("cname-loop.") + t.zone("records.")
t.link(zones, master, slave)
t.start()
master.zones_wait(zones)
slave.zones_wait(zones)
t.xfr_diff(master, slave, zones)
t.end()
示例2: Test
# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import zone_rnd [as 别名]
#!/usr/bin/env python3
'''Test for IXFR from Knot to Bind'''
from dnstest.test import Test
t = Test()
master = t.server("knot")
slave = t.server("bind")
zones = t.zone_rnd(5, records=50) + t.zone("wild.") + \
t.zone("cname-loop.") + t.zone("records.")
t.link(zones, master, slave, ixfr=True)
t.start()
# Wait for AXFR to slave server.
serials_init = master.zones_wait(zones)
slave.zones_wait(zones)
serials_prev = serials_init
for i in range(4):
# Update zone files on master.
for zone in zones:
master.update_zonefile(zone, random=True)
master.reload()
t.sleep(5)
# Wait for IXFR to slave.
示例3: Test
# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import zone_rnd [as 别名]
#!/usr/bin/env python3
'''Test for transition from NSEC to NSEC3 on auto-signed zone using DDNS.'''
from dnstest.utils import *
from dnstest.test import Test
t = Test()
master = t.server("knot")
slave = t.server("bind")
zone = t.zone_rnd(1, dnssec=False)
t.link(zone, master, slave, ddns=True)
t.start()
# Wait for listening server with unsigned zone.
old_serial = master.zone_wait(zone)
slave.zone_wait(zone)
t.xfr_diff(master, slave, zone)
# Check NSEC absence.
master.check_nsec(zone, nonsec=True)
master.stop()
# Enable autosigning.
master.dnssec_enable = True
master.gen_key(zone, ksk=True, alg="NSEC3RSASHA1")
master.gen_key(zone, alg="NSEC3RSASHA1")
master.gen_key(zone, ksk=True, alg="RSASHA256")
示例4: Test
# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import zone_rnd [as 别名]
#!/usr/bin/env python3
"""
Multi-master failover tests.
"""
from dnstest.test import Test
t = Test()
# testing zone
zone = t.zone_rnd(1, dnssec=False, records=1)[0]
zone.update_soa(serial=1, refresh=600, retry=600, expire=3600)
# +---------+ +---------+
# | master1 <-------+ master2 |
# +----^----+ +----^----+
# | |
# | +---------+ |
# +---+ slave +---+
# +---------+
master1 = t.server("knot")
master2 = t.server("bind")
slave = t.server("knot")
# flush zones immediatelly
for server in [master1, master2, slave]:
slave.zonefile_sync = "0"
t.link([zone], master1, master2)
示例5: Test
# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import zone_rnd [as 别名]
#!/usr/bin/env python3
"""Test for AXFR from Bind to Knot"""
from dnstest.test import Test
t = Test()
master = t.server("bind")
slave = t.server("knot")
zones = t.zone_rnd(10) + t.zone(".") + t.zone("records.")
t.link(zones, master, slave)
t.start()
master.zones_wait(zones)
slave.zones_wait(zones)
t.xfr_diff(master, slave, zones)
t.end()
示例6: Test
# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import zone_rnd [as 别名]
#!/usr/bin/env python3
'''Test for IXFR from Knot to Knot'''
from dnstest.test import Test
t = Test()
master = t.server("knot")
slave = t.server("knot")
zones = t.zone_rnd(5, records=50) + t.zone("records.")
t.link(zones, master, slave, ixfr=True)
t.start()
# Wait for AXFR to slave server.
serials_init = master.zones_wait(zones)
slave.zones_wait(zones)
serials_prev = serials_init
for i in range(4):
# Update zone files on master.
for zone in zones:
master.update_zonefile(zone, random=True)
master.reload()
# Wait for IXFR to slave.
serials = master.zones_wait(zones, serials_prev)
slave.zones_wait(zones, serials_prev)
serials_prev = serials
示例7: Test
# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import zone_rnd [as 别名]
resp = master.dig(nsec_zone, "IXFR", serial=serial)
for msg in resp.resp:
for rr in msg.answer:
if rr.rdtype not in [dns.rdatatype.SOA, dns.rdatatype.NSEC, dns.rdatatype.RRSIG]:
return False
if rr.rdtype == dns.rdatatype.RRSIG:
if (not rr.match(rr.name, rr.rdclass, dns.rdatatype.RRSIG, dns.rdatatype.NSEC)) and \
(not rr.match(rr.name, rr.rdclass, dns.rdatatype.RRSIG, dns.rdatatype.SOA)):
# RRSIG covering something else than NSEC or SOA.
return False
return True
t = Test()
master = t.server("knot")
nsec_zone = t.zone_rnd(1, dnssec=True, nsec3=False)
nsec3_zone = t.zone_rnd(1, dnssec=True, nsec3=True)
static_zone = t.zone("example.", storage=".")
t.link(nsec_zone, master)
t.link(nsec3_zone, master)
t.link(static_zone, master)
t.start()
# Get zone serial.
old_nsec_serial = master.zone_wait(nsec_zone)
old_nsec3_serial = master.zone_wait(nsec3_zone)
old_static_serial = master.zone_wait(static_zone)
# Enable autosigning.
master.dnssec_enable = True
示例8: Test
# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import zone_rnd [as 别名]
#!/usr/bin/env python3
'''Test for loading of dumped zone'''
from dnstest.test import Test
t = Test()
master = t.server("bind")
slave = t.server("knot")
reference = t.server("bind")
zones = t.zone_rnd(10) + t.zone(".") + t.zone("wild.") + t.zone("cname-loop.")
t.link(zones, master, slave)
t.link(zones, reference)
t.start()
# Wait for AXFR and dump zones.
master.zones_wait(zones)
slave.zones_wait(zones)
slave.flush()
# Stop master.
master.stop()
# Reload dumped zone files.
slave.stop()
slave.start()