当前位置: 首页>>代码示例>>Python>>正文


Python Test.link方法代码示例

本文整理汇总了Python中dnstest.test.Test.link方法的典型用法代码示例。如果您正苦于以下问题:Python Test.link方法的具体用法?Python Test.link怎么用?Python Test.link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dnstest.test.Test的用法示例。


在下文中一共展示了Test.link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3

"""Test for EDNS version"""

from dnstest.test import Test
from dnstest.utils import *

t = Test()

server = t.server("knot")
zone = t.zone("example.com.")

t.link(zone, server)

t.start()

# Supported EDNS version 0.
resp = server.dig("example.com", "SOA", edns=0)
resp.check(rcode="NOERROR", edns_version=0)

# Unsupported EDNS version 1.
resp = server.dig("example.com", "SOA", edns=1)
resp.check(rcode="BADVERS", edns_version=0)
compare(resp.count(section="answer"), 0, "Answer count")
compare(resp.count(section="authority"), 0, "Authority count")
compare(resp.count(section="additional"), 0, "Additional count")


t.end()
开发者ID:gitter-badger,项目名称:knot,代码行数:31,代码来源:test.py

示例2: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
'''Test for EDNS0/NSID identification'''

from dnstest.test import Test

t = Test()

name = "Knot DNS server"
hex_name = "0x01020304"
server1 = t.server("knot", nsid=name)
server2 = t.server("knot", nsid=False)
server3 = t.server("knot")
server4 = t.server("knot", nsid=hex_name)
zone = t.zone("example.com.")

t.link(zone, server1)
t.link(zone, server2)
t.link(zone, server3)
t.link(zone, server4)

t.start()

# 1) Custom identification string.
resp = server1.dig("example.com", "SOA", nsid=True)
resp.check_edns(nsid=name)

# 2) Disabled.
resp = server2.dig("example.com", "SOA", nsid=True)
resp.check_edns()

# 3) FQDN hostname.
开发者ID:gitter-badger,项目名称:knot,代码行数:32,代码来源:test.py

示例3: zone

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3

'''Test for reload of a changed zone (serial up, nochange, serial down). '''

from dnstest.test import Test
from dnstest.utils import set_err, detail_log

t = Test()

master = t.server("knot")

# Zone setup
zone = t.zone("serial.", storage = ".")

t.link(zone, master, ixfr = True)

t.start()

# Load zones
serial = master.zone_wait(zone)

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")
开发者ID:dnstap,项目名称:knot,代码行数:33,代码来源:test.py

示例4:

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
# | 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)
t.link([zone], master1, slave)
t.link([zone], master2, slave)

t.start()

# zone boostrap
for server in [master1, master2, slave]:
    server.zone_wait(zone)

# transfer with fully working topology
master1.zones[zone.name].zfile.update_soa(serial=10)
master1.reload()
for server in [master1, master2, slave]:
    server.zone_wait(zone, serial=9)
开发者ID:gitter-badger,项目名称:knot,代码行数:32,代码来源:test.py

示例5: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
''' Check 'dnstap' query module functionality. '''

import os
import re
from dnstest.test import Test
from dnstest.module import ModDnstap
from dnstest.utils import *

t = Test()

ModDnstap.check()

# Initialize server configuration
knot = t.server("knot")
zone = t.zone("flags.")
t.link(zone, knot)

# Configure 'dnstap' module for all queries (default).
dflt_sink = t.out_dir + "/all.tap"
knot.add_module(None, ModDnstap(dflt_sink))
# Configure 'dnstap' module for flags zone only.
flags_sink = t.out_dir + "/flags.tap"
knot.add_module(zone, ModDnstap(flags_sink))

t.start()

dflt_qname = "dnstap_default_test"
resp = knot.dig(dflt_qname + ".example", "NS")
flags_qname = "dnstap_flags_test"
resp = knot.dig(flags_qname + ".flags", "NS")
开发者ID:gitter-badger,项目名称:knot,代码行数:32,代码来源:test.py

示例6: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [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.
开发者ID:dnstap,项目名称:knot,代码行数:33,代码来源:test.py

示例7: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3
"""
DNSSEC Single-Type Signing Scheme, RFC 6781
"""
from dnstest.utils import *
from dnstest.test import Test

t = Test()

knot = t.server("knot")
zones = t.zone_rnd(4, dnssec=False, records=10)
t.link(zones, knot)
t.start()

# one KSK
knot.gen_key(zones[0], ksk=True, alg="RSASHA256", key_len="512")

# one ZSK
knot.gen_key(zones[1], ksk=False, alg="RSASHA512", key_len="1024")

# multiple KSKs
knot.gen_key(zones[2], ksk=True, alg="RSASHA512", key_len="1024")
knot.gen_key(zones[2], ksk=True, alg="RSASHA256", key_len="512")

# different algorithms: KSK+ZSK pair, one ZSK
knot.gen_key(zones[3], ksk=True, alg="RSASHA256", key_len="1024")
knot.gen_key(zones[3], ksk=False, alg="RSASHA256", key_len="1024")
knot.gen_key(zones[3], ksk=False, alg="RSASHA512", key_len="1024")

knot.dnssec_enable = True
knot.gen_confile()
开发者ID:gitter-badger,项目名称:knot,代码行数:33,代码来源:test.py

示例8: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3

from dnstest.test import Test

t = Test(tsig=True, stress=False)

knot = t.server("knot")
zone = t.zone("example.com")
t.link(zone, knot, ddns=True)

t.start()

zone[0].name = "examPle.com"
update = knot.update(zone)
update.add("kNoT.ExamPle.com.", 60, "TXT", "test")
update.add("test.example.com.", 60, "TXT", "test")
update.send("NOERROR")

resp = knot.dig("knot.example.com.", "TXT")
resp.check(rcode="NOERROR", rdata="test")

t.end()
开发者ID:gitter-badger,项目名称:knot,代码行数:24,代码来源:test.py

示例9: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3

from dnstest.test import Test
import dnstest.utils

t = Test()

ixfr_master = t.server("bind")
ixfr_slave = t.server("knot")

axfr_master = t.server("bind")
axfr_slave = t.server("knot")

zone = t.zone("example.com.", storage=".")

t.link(zone, ixfr_master, ixfr_slave, ixfr=True)
t.link(zone, axfr_master, axfr_slave, ixfr=False)

def prepare(master, slave, zone):
    # Wait for zones.
    serial = master.zone_wait(zone)
    slave.zone_wait(zone)

    # Update master file with the record (new SOA serial).
    master.update_zonefile(zone, version=1)
    master.reload()

    # Wait for zones and compare them.
    master_serial = master.zone_wait(zone, serial)
    return master_serial
开发者ID:idtek,项目名称:knot,代码行数:32,代码来源:test.py

示例10: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3

"""Test for DDNS prerequisites"""

from dnstest.test import Test

t = Test()

srv = t.server("knot")
zone = t.zone("ddns.", storage=".")

t.link(zone, srv, ddns=True)

t.start()

# PREREQ YXDOMAIN
# ===============
# OK
update = srv.update(zone)
update.prereq_yx("existing.ddns.")
update.add("1.ddns.", 1, "TXT", "text")
update.send("NOERROR")
resp = srv.dig("1.ddns.", "TXT")
resp.check("text")

# OK in apex
update = srv.update(zone)
update.prereq_yx("ddns.")
update.add("2.ddns.", 1, "TXT", "text")
update.send("NOERROR")
resp = srv.dig("2.ddns.", "TXT")
开发者ID:gitter-badger,项目名称:knot,代码行数:33,代码来源:test.py

示例11: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3

'''Test for response to IXFR request with newer serial'''

from dnstest.utils import *
from dnstest.test import Test

t = Test()

knot = t.server("knot")
zone = t.zone("example.com.")

t.link(zone, knot, ixfr=True)

t.start()

serial_init = knot.zone_wait(zone)

resp = knot.dig("example.com", "IXFR", serial=serial_init + 1)
resp.check_xfr()

compare(resp.msg_count(), 1, "Only one message")
compare(resp.count("SOA"), 1, "Only one RR in Answer section")
compare(resp.count("ANY"), 1, "Only one RR in the whole message.")

t.end()

开发者ID:gitter-badger,项目名称:knot,代码行数:28,代码来源:test.py

示例12: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3

'''Test for no resigning if the zone is properly signed.'''

from dnstest.utils import *
from dnstest.test import Test

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)
t.link(nsec_zone, master)
t.link(nsec3_zone, master)

t.start()

# Get zone serial.
old_nsec_serial = master.zone_wait(nsec_zone)
old_nsec3_serial = master.zone_wait(nsec3_zone)

# Enable autosigning.
master.dnssec_enable = True
master.use_keys(nsec_zone)
master.use_keys(nsec3_zone)
master.gen_confile()
master.reload()

t.sleep(4)

new_nsec_serial = master.zone_wait(nsec_zone)
开发者ID:dnstap,项目名称:knot,代码行数:33,代码来源:test.py

示例13: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
#!/usr/bin/env python3

'''Test for loading non-existing zone file'''

from dnstest.test import Test

t = Test()

master = t.server("knot")

zones = t.zone("notexist.", exists=False) + t.zone("example.com.")

t.link(zones, master)

t.start()

# Check if the server is answering and zone _isn't_ loaded
resp = master.dig("notexist.", "SOA", udp=True)
resp.check(rcode="SERVFAIL") # Unloadable zone, but in the zone database

# Check if the server is answering and zone is unknown
resp = master.dig("xfiles.", "SOA", udp=True)
resp.check(rcode="REFUSED")

# The other zone should answer without problem
resp = master.dig("example.com.", "SOA", udp=True)
resp.check(rcode="NOERROR")

# Stop master.
master.stop()
开发者ID:gitter-badger,项目名称:knot,代码行数:32,代码来源:test.py

示例14: list

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [as 别名]
    # increase serials so that server accepts them
    serials = list(map(lambda x: x + 1000, serials))
    serials.reverse()
    update_zone(master, slave, zone, rev[1:], change_serial=True, serials=serials)

t = Test()

# Create NSEC and NSEC3 servers
nsec_master = t.server("knot")
nsec3_master = t.server("knot")
nsec_slave = t.server("bind")
nsec3_slave = t.server("bind")

zone = t.zone("example.", storage=".")

t.link(zone, nsec_master, nsec_slave)
t.link(zone, nsec3_master, nsec3_slave)

# Enable autosigning
nsec_master.dnssec_enable = True
nsec_master.gen_key(zone, ksk=True, alg="RSASHA256")
nsec_master.gen_key(zone, alg="RSASHA256")

nsec3_master.dnssec_enable = True
nsec3_master.enable_nsec3(zone)
nsec3_master.gen_key(zone, ksk=True, alg="RSASHA256")
nsec3_master.gen_key(zone, alg="RSASHA256")

t.start()

check_log("============ testing NSEC changes ===============")
开发者ID:idtek,项目名称:knot,代码行数:33,代码来源:test.py

示例15: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import link [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")
开发者ID:dnstap,项目名称:knot,代码行数:33,代码来源:test.py


注:本文中的dnstest.test.Test.link方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。