diff options
-rw-r--r-- | tests-extra/tests/ddns/basic/test.py | 155 | ||||
-rw-r--r-- | tests-extra/tests/ddns/prereq/test.py | 54 | ||||
-rw-r--r-- | tests-extra/tools/dnstest/update.py | 4 |
3 files changed, 113 insertions, 100 deletions
diff --git a/tests-extra/tests/ddns/basic/test.py b/tests-extra/tests/ddns/basic/test.py index 32eafb739..3a210e8a8 100644 --- a/tests-extra/tests/ddns/basic/test.py +++ b/tests-extra/tests/ddns/basic/test.py @@ -6,7 +6,11 @@ from dnstest.utils import * from dnstest.test import Test import random -t = Test() +KNSUPDATE = random.choice([True, False]) +detail_log("Using knsupdate %s\n" % str(KNSUPDATE)) +PROTOS = [Proto.TCP, Proto.TLS] + ([Proto.QUIC] if KNSUPDATE else []) + +t = Test(tls=True, quic=True, knsupdate=KNSUPDATE) def check_soa(master, prev_soa): soa_resp = master.dig("ddns.", "SOA") @@ -18,12 +22,12 @@ def verify(master, zone, dnssec): master.flush(wait=True) master.zone_verify(zone) -def do_normal_tests(master, zone, dnssec=False): +def do_normal_tests(master, zone, dnssec=False, proto=Proto.TCP): # add node check_log("Node addition") up = master.update(zone) up.add("rrtest.ddns.", 3600, "A", "1.2.3.4") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "A") resp.check(rcode="NOERROR", rdata="1.2.3.4") verify(master, zone, dnssec) @@ -32,7 +36,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Node update - new record") up = master.update(zone) up.add("rrtest.ddns.", 3600, "A", "1.2.3.5") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "A") resp.check(rcode="NOERROR", rdata="1.2.3.4") resp.check(rcode="NOERROR", rdata="1.2.3.5") @@ -43,7 +47,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("rrtest.ddns.", 3600, "A", "1.2.3.7") up.add("rrtest.ddns.", 3600, "A", "1.2.3.0") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "A") resp.check(rcode="NOERROR", rdata="1.2.3.0") resp.check(rcode="NOERROR", rdata="1.2.3.4") @@ -55,7 +59,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Node update - new rrset") up = master.update(zone) up.add("rrtest.ddns.", 3600, "TXT", "abcedf") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "TXT") resp.check(rcode="NOERROR", rdata="abcedf") resp = master.dig("rrtest.ddns.", "A") @@ -69,7 +73,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Node update - rrset removal") up = master.update(zone) up.delete("rrtest.ddns.", "TXT") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "TXT") resp.check(rcode="NOERROR") compare(resp.count(section="answer"), 0, "TXT rrset removal") @@ -84,7 +88,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Node update - record removal") up = master.update(zone) up.delete("rrtest.ddns.", "A", "1.2.3.5") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "A") resp.check(rcode="NOERROR", nordata="1.2.3.5") resp.check(rcode="NOERROR", rdata="1.2.3.0") @@ -97,7 +101,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.delete("rrtest.ddns.", "A", "1.2.3.0") up.delete("rrtest.ddns.", "A", "1.2.3.7") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "A") resp.check(rcode="NOERROR", nordata="1.2.3.0") resp.check(rcode="NOERROR", nordata="1.2.3.7") @@ -109,7 +113,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.delete("rrtest.ddns.", "ANY") up.add("rrtest.ddns.", 7, "A", "1.2.3.8") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "A") resp.check(rcode="NOERROR", rdata="1.2.3.8") verify(master, zone, dnssec) @@ -118,7 +122,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Node removal") up = master.update(zone) up.delete("rrtest.ddns.", "ANY") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest.ddns.", "A") resp.check(rcode="NXDOMAIN") verify(master, zone, dnssec) @@ -128,7 +132,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("deleg.ddns.", 3600, "NS", "a.deleg.ddns.") up.add("a.deleg.ddns.", 3600, "A", "1.2.3.4") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("deleg.ddns.", "NS") resp.check_record(section="authority", rtype="NS", rdata="a.deleg.ddns.") resp.check_record(section="additional", rtype="A", rdata="1.2.3.4") @@ -138,7 +142,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Delegation w/o glue") up = master.update(zone) up.add("deleglue.ddns.", 3600, "NS", "a.deleglue.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("deleglue.ddns.", "NS") resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.") resp.check_no_rr(section="additional", rname="a.deleglue.ddns.", rtype="A") @@ -148,7 +152,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Glue for existing delegation") up = master.update(zone) up.add("a.deleglue.ddns.", 3600, "A", "10.20.30.40") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("deleglue.ddns.", "NS") resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.") resp.check_record(section="additional", rtype="A", rdata="10.20.30.40") @@ -158,7 +162,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Remove delegation, keep glue") up = master.update(zone) up.delete("deleglue.ddns.", "NS") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("deleglue.ddns.", "NS") resp.check(rcode="NOERROR") resp.check_record(section="authority", rtype="SOA") @@ -172,7 +176,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Add delegation to existing glue") up = master.update(zone) up.add("deleglue.ddns.", 3600, "NS", "a.deleglue.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("deleglue.ddns.", "NS") resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.") resp.check_record(section="additional", rtype="A", rdata="10.20.30.40") @@ -183,7 +187,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("a.deleglue.ddns.", 3600, "NS", "a.deleglue.ddns.") up.delete("deleglue.ddns.", "NS", "a.deleglue.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("x.a.deleglue.ddns.", "A") resp.check(rcode="NOERROR") resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.") @@ -195,7 +199,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.delete("a.deleglue.ddns.", "NS", "a.deleglue.ddns.") up.add("deleglue.ddns.", 3600, "NS", "a.deleglue.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("deleglue.ddns.", "NS") resp.check(rcode="NOERROR") resp.check_record(section="authority", rtype="NS", rdata="a.deleglue.ddns.") @@ -206,7 +210,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("glueless SVCB") up = master.update(zone) up.add("svcb.ddns.", 3600, "SVCB", "0 target.svcb.svcbtarget.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec) resp.check(rcode="NOERROR") resp.check_count(0, rtype="AAAA", section="additional") @@ -216,7 +220,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("target.svcb.svcbtarget.ddns.", 3600, "AAAA", "1::2") up.add("target.svcb.svcbtarget.ddns.", 3600, "SVCB", "2 . alpn=h2") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec) resp.check(rcode="NOERROR") resp.check_count(1, rtype="AAAA", section="additional") @@ -229,7 +233,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.delete("target.svcb.svcbtarget.ddns.", "AAAA") up.delete("target.svcb.svcbtarget.ddns.", "SVCB") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec) resp.check(rcode="NOERROR") resp.check_count(0, rtype="AAAA", section="additional") @@ -239,7 +243,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("SVCB wildcard glue") up = master.update(zone) up.add("*.svcbtarget.ddns.", 3600, "AAAA", "1::3") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec) resp.check(rcode="NOERROR") resp.check_record(section="additional", name="*.svcbtarget.ddns.", rtype="AAAA", ttl=3600, rdata="1::3") @@ -251,7 +255,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("SVCB shuffle") up.delete("svcb.ddns.", "SVCB") up.add("svcb.ddns.", 3600, "SVCB", "1 target.svcb.svcbtarget.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec) resp.check(rcode="NOERROR") resp.check_record(section="additional", name="*.svcbtarget.ddns.", rtype="AAAA", ttl=3600, rdata="1::3") @@ -263,7 +267,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Remove wildcard glue") up = master.update(zone) up.delete("*.svcbtarget.ddns.", "AAAA", "1::3") - up.send("NOERROR") + up.send("NOERROR", proto) t.sleep(1) # wait for zone_update_cleanup to trigger lost glue resp = master.dig("svcb.ddns.", "SVCB", dnssec=dnssec) resp.check(rcode="NOERROR") @@ -272,13 +276,13 @@ def do_normal_tests(master, zone, dnssec=False): # now remove SVCB in order to make ldns-verify work up = master.update(zone) up.delete("svcb.ddns.", "SVCB") - up.send() + up.send(proto=proto) # Add double-wildcard MX check_log("Double-wildcard MX") up = master.update(zone) up.add("double.wc.mx.ddns.", 3600, "MX", "1 a.*.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("double.wc.mx.ddns.", "MX", dnssec=dnssec) resp.check(rcode="NOERROR") resp.check_count(1, rtype="MX", section="answer") @@ -288,7 +292,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Double-wildcard glue") up = master.update(zone) up.add("*.*.ddns.", 3600, "AAAA", "3::5") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("double.wc.mx.ddns.", "MX", dnssec=dnssec) resp.check(rcode="NOERROR") resp.check_count(1, rtype="MX", section="answer") @@ -300,7 +304,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.delete("double.wc.mx.ddns.", "MX") up.add("double.wc.mx.ddns.", 3600, "MX", "2 a.*.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("double.wc.mx.ddns.", "MX", dnssec=dnssec) resp.check(rcode="NOERROR") resp.check_count(1, rtype="MX", section="answer") @@ -311,7 +315,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Remove double-wildcard glue") up = master.update(zone) up.delete("*.*.ddns.", "AAAA") - up.send("NOERROR") + up.send("NOERROR", proto) t.sleep(1) # wait for zone_update_cleanup to trigger lost glue resp = master.dig("double.wc.mx.ddns.", "MX", dnssec=dnssec) resp.check(rcode="NOERROR") @@ -322,7 +326,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Add CNAME to A node") up = master.update(zone) up.add("dns1.ddns.", "3600", "CNAME", "ignore.me.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("dns1.ddns.", "CNAME") compare(resp.count(), 0, "Added CNAME when it shouldn't") verify(master, zone, dnssec) @@ -333,7 +337,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("rrtest2.ddns.", "3600", "MX", "10 something.ddns.") up.add("rrtest2.ddns.", "3600", "CNAME", "ignore.me.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest2.ddns.", "ANY") resp.check(rcode="NOERROR") resp.check_record(rtype="MX", rdata="10 something.ddns.") @@ -345,7 +349,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Add A to CNAME node") up = master.update(zone) up.add("cname.ddns.", "3600", "A", "1.2.3.4") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("cname.ddns.", "ANY") resp.check(rcode="NOERROR") resp.check_record(rtype="A", nordata="1.2.3.4") @@ -357,7 +361,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("rrtest3.ddns.", "3600", "CNAME", "dont.ignore.me.ddns.") up.add("rrtest3.ddns.", "3600", "TXT", "ignore") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest3.ddns.", "ANY") resp.check(rcode="NOERROR") resp.check_record(rtype="TXT", nordata="ignore") @@ -368,7 +372,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("CNAME to CNAME addition") up = master.update(zone) up.add("cname.ddns.", 3600, "CNAME", "new-cname.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("cname.ddns.", "CNAME") resp.check(rcode="NOERROR", rdata="new-cname.ddns.") resp.check(rcode="NOERROR", nordata="mail.ddns.") @@ -379,9 +383,9 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("rrtest4.ddns.", "3600", "CNAME", "ignore.me.ddns.") up.add("rrtest4.ddns.", "3600", "CNAME", "dont.ignore.me.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("rrtest3.ddns.", "ANY") - resp.check(rcode="NOERROR") + resp.check(rcode="NOERROR") resp.check_record(rtype="CNAME", rdata="dont.ignore.me.ddns.") resp.check_record(rtype="CNAME", nordata="ignore.me.ddns") verify(master, zone, dnssec) @@ -391,7 +395,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("ddns.", 3600, "SOA", "dns1.ddns. hostmaster.ddns. 2011111213 10800 3600 1209600 7200") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "SOA") resp.check(rcode="NOERROR", rdata="dns1.ddns. hostmaster.ddns. 2011111213 10800 3600 1209600 7200") @@ -405,7 +409,7 @@ def do_normal_tests(master, zone, dnssec=False): "dns1.ddns. hostmaster.ddns. 2012111213 10800 3600 1209600 7200") up.delete("ddns.", "SOA", "dns1.ddns. hostmaster.ddns. 2012111213 10800 3600 1209600 7200") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "SOA") resp.check(rcode="NOERROR", rdata="dns1.ddns. hostmaster.ddns. 2012111213 10800 3600 1209600 7200") @@ -418,7 +422,7 @@ def do_normal_tests(master, zone, dnssec=False): up.add("ddns.", 3600, "SOA", "dns1.ddns. hostmaster.ddns. 2013111213 10800 3600 1209600 7200") up.delete("ddns.", "SOA") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "SOA") resp.check(rcode="NOERROR") resp.check_record(rtype="SOA", rdata="dns1.ddns. hostmaster.ddns. 2013111213 10800 3600 1209600 7200") @@ -429,7 +433,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("ddns.", 3600, "SOA", "dns1.ddns. hostmaster.ddns. 2010111213 10800 3600 1209600 7200") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "SOA") resp.check(rcode="NOERROR", rdata="dns1.ddns. hostmaster.ddns. 2013111213 10800 3600 1209600 7200") @@ -440,7 +444,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("ddns.", 1800, "SOA", "dns1.ddns. hostmaster.ddns. 2014111213 10800 1800 1209600 7200") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "SOA") resp.check(rcode="NOERROR", rdata="dns1.ddns. hostmaster.ddns. 2014111213 10800 1800 1209600 7200") @@ -451,7 +455,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("testaddrem.ddns.", 3600, "TXT", "record") up.delete("testaddrem.ddns.", "TXT", "record") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("testaddrem.ddns.", "TXT") resp.check(rcode="NXDOMAIN") verify(master, zone, dnssec) @@ -461,7 +465,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("testaddrem.ddns.", 3600, "TXT", "record") up.delete("testaddrem.ddns.", "TXT") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("testaddrem.ddns.", "TXT") resp.check(rcode="NXDOMAIN") verify(master, zone, dnssec) @@ -470,14 +474,14 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Remove non-existent record") up = master.update(zone) up.delete("testaddrem.ddns.", "TXT", "record") - up.send("NOERROR") + up.send("NOERROR", proto) verify(master, zone, dnssec) # remove NS from APEX (NS should stay) check_log("Remove NS") up = master.update(zone) up.delete("ddns.", "NS") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check(rcode="NOERROR") resp.check_record(rtype="NS", rdata="dns1.ddns.") @@ -488,7 +492,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Remove all NS") up = master.update(zone) up.delete("ddns.", "ANY") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check(rcode="NOERROR") resp.check_record(rtype="NS", rdata="dns1.ddns.") @@ -503,7 +507,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.delete("ddns.", "NS") up.add("ddns.", 3600, "NS", "dns3.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check(rcode="NOERROR") resp.check_record(rtype="NS", rdata="dns1.ddns.") @@ -519,7 +523,7 @@ def do_normal_tests(master, zone, dnssec=False): up.delete("ddns.", "NS", "dns2.ddns.") up.delete("ddns.", "NS", "dns3.ddns.") up.add("ddns.", 3600, "NS", "dns4.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check(rcode="NOERROR", nordata="dns1.ddns.") resp.check(nordata="dns2.ddns.") @@ -534,7 +538,7 @@ def do_normal_tests(master, zone, dnssec=False): up.add("ddns.", 3600, "NS", "dns5.ddns.") up.delete("ddns.", "NS", "dns3.ddns.") up.delete("ddns.", "NS", "dns4.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check(rcode="NOERROR", nordata="dns3.ddns.") resp.check(nordata="dns4.ddns.") @@ -546,7 +550,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("ddns.", 3600, "NS", "dns1.ddns.") up.delete("ddns.", "NS", "dns5.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check(rcode="NOERROR", nordata="dns5.ddns.") resp.check_record(rtype="NS", rdata="dns1.ddns.") @@ -557,7 +561,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.delete("ddns.", "NS", "dns1.ddns.") up.add("ddns.", 3600, "NS", "dns2.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check(rcode="NOERROR") resp.check_record(rtype="NS", rdata="dns1.ddns.") @@ -569,7 +573,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.delete("ddns.", "NS", "dns1.ddns.") up.delete("ddns.", "NS", "dns2.ddns.") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check(rcode="NOERROR", nordata="dns1.ddns.") resp.check_record(rtype="NS", rdata="dns2.ddns.") @@ -580,7 +584,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("ddns.", 3600, "NS", "dns1.ddns.") up.delete("ddns.", "NS") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "NS") resp.check_record(rtype="NS", rdata="dns1.ddns.") resp.check_record(rtype="NS", rdata="dns2.ddns.") @@ -590,7 +594,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Add empty generic record") up = master.update(zone) up.add("empty.ddns.", 300, "TYPE999", "\# 0") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("empty.ddns.", "TYPE999") resp.check_record(rtype="TYPE999", rdata="\# 0") verify(master, zone, dnssec) @@ -599,7 +603,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Add NAPTR record") up = master.update(zone) up.add("3.1.1.1.1.1.1.1.1.2.7.9.9.ddns.", 172800, "NAPTR", "1 1 \"u\" \"E2U+sip\" \"!^.*$!sip:123@freeswitch.org!\" .") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("3.1.1.1.1.1.1.1.1.2.7.9.9.ddns.", "NAPTR") resp.check_record(rtype="NAPTR", rdata="1 1 \"u\" \"E2U+sip\" \"!^.*$!sip:123@freeswitch.org!\" .") verify(master, zone, dnssec) @@ -608,7 +612,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("Add TXT into apex") up = master.update(zone) up.add("ddns.", 300, "TXT", "This is apeeex!") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("ddns.", "TXT") resp.check_record(rtype="TXT", rdata="This is apeeex!") verify(master, zone, dnssec) @@ -619,7 +623,7 @@ def do_normal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("deleg.ddns.", 3600, "DS", "54576 10 2 397E50C85EDE9CDE33F363A9E66FD1B216D788F8DD438A57A423A386869C8F06") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("deleg.ddns.", "NS", dnssec=True) resp.check(rcode="NOERROR") resp.check_record(section="authority", rtype="DS", @@ -632,7 +636,7 @@ def do_normal_tests(master, zone, dnssec=False): check_log("glue augmentation") up = master.update(zone) up.add("a.deleg.ddns.", 3600, "AAAA", "1::2") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("xy.deleg.ddns.", "A", dnssec=True) resp.check_rr(section="authority", rname="deleg.ddns.", rtype="NS") resp.check_rr(section="authority", rname="deleg.ddns.", rtype="RRSIG") @@ -640,7 +644,7 @@ def do_normal_tests(master, zone, dnssec=False): resp.check_no_rr(section="additional", rname="a.deleg.ddns.", rtype="RRSIG") verify(master, zone, dnssec) -def do_refusal_tests(master, zone, dnssec=False): +def do_refusal_tests(master, zone, dnssec=False, proto=Proto.TCP): # Store initial SOA soa_resp = master.dig("ddns.", "SOA") prev_soa = soa_resp.resp.answer @@ -649,35 +653,35 @@ def do_refusal_tests(master, zone, dnssec=False): check_log("Out-of-zone data") up = master.update(zone) up.add("what.the.hell.am.i.doing.here.", "3600", "TXT", "I don't belong here") - up.send("NOTZONE") + up.send("NOTZONE", proto) check_soa(master, prev_soa) # Remove 'all' SOA, ignore check_log("Remove all SOA") up = master.update(zone) up.delete("ddns.", "SOA") - up.send("NOERROR") + up.send("NOERROR", proto) check_soa(master, prev_soa) # Remove specific SOA, ignore check_log("Remove specific SOA") up = master.update(zone) up.delete("ddns.", "SOA", "dns1.ddns. hostmaster.ddns. 2011111213 10800 3600 1209600 7200") - up.send("NOERROR") + up.send("NOERROR", proto) check_soa(master, prev_soa) # Out-of-apex NSEC3PARAM check_log("Out-of-apex NSEC3PARAM") up = master.update(zone) up.add("mx.ddns.", 3600, "NSEC3PARAM", "1 0 0 -") - up.send("REFUSED") + up.send("REFUSED", proto) check_soa(master, prev_soa) # Added NSEC3PARAM check_log("Added NSEC3PARAM") up = master.update(zone) up.add("ddns.", 3600, "NSEC3PARAM", "1 0 0 -") - up.send("REFUSED" if master.dnssec(zone).nsec3 else "NOERROR") + up.send("REFUSED" if master.dnssec(zone).nsec3 else "NOERROR", proto) resp = master.dig("ddns.", "NSEC3PARAM") resp.check_count(1, "NSEC3PARAM") if master.dnssec(zone).nsec3: @@ -692,7 +696,7 @@ def do_refusal_tests(master, zone, dnssec=False): up = master.update(zone) up.add("nonapex.ddns.", "3600", "DNSKEY", "256 3 5 AwEAAbs0AlA6xWQn/lECfGt3S6TaeEmgJfEVVEMh06iNMNWMRHOfbqLF h3N52Ob7trmzlrzGlGLPnAZJvMB8lsFGC5CtaLUBD+4xCh5tl5QifZ+y o+MJvPGlVQI2cs7aMWV9CyFrRmuRcJaSZU2uBz9KFJ955UCq/WIy5KqS 7qaKLzzN") - up.send("NOERROR") + up.send("NOERROR", proto) resp = master.dig("nonapex.ddns.", "DNSKEY") resp.check(rcode="NOERROR", rdata="256 3 5 AwEAAbs0AlA6xWQn/lECfGt3S6TaeEmgJfEVVEMh06iNMNWMRHOfbqLF h3N52Ob7trmzlrzGlGLPnAZJvMB8lsFGC5CtaLUBD+4xCh5tl5QifZ+y o+MJvPGlVQI2cs7aMWV9CyFrRmuRcJaSZU2uBz9KFJ955UCq/WIy5KqS 7qaKLzzN") @@ -715,18 +719,21 @@ master_nsec3.dnssec(zone).nsec3_opt_out = (random.random() < 0.5) t.start() # DNSSEC-less test -check_log("============ Plain test ===========") -do_normal_tests(master_plain, zone) -do_refusal_tests(master_plain, zone) +proto = random.choice(PROTOS) +check_log("============ Plain test (%s) ===========" % proto) +do_normal_tests(master_plain, zone, proto=proto) +do_refusal_tests(master_plain, zone, proto=proto) # DNSSEC with NSEC test -check_log("============ NSEC test ============") -do_normal_tests(master_nsec, zone, dnssec=True) -do_refusal_tests(master_nsec, zone, dnssec=True) +proto = random.choice(PROTOS) +check_log("============ NSEC test (%s) ============" % proto) +do_normal_tests(master_nsec, zone, dnssec=True, proto=proto) +do_refusal_tests(master_nsec, zone, dnssec=True, proto=proto) # DNSSEC with NSEC3 test -check_log("============ NSEC3 test ===========") -do_normal_tests(master_nsec3, zone, dnssec=True) -do_refusal_tests(master_nsec3, zone, dnssec=True) +proto = random.choice(PROTOS) +check_log("============ NSEC3 test (%s) ===========" % proto) +do_normal_tests(master_nsec3, zone, dnssec=True, proto=proto) +do_refusal_tests(master_nsec3, zone, dnssec=True, proto=proto) t.end() diff --git a/tests-extra/tests/ddns/prereq/test.py b/tests-extra/tests/ddns/prereq/test.py index 43c478115..3ef03cff5 100644 --- a/tests-extra/tests/ddns/prereq/test.py +++ b/tests-extra/tests/ddns/prereq/test.py @@ -2,10 +2,16 @@ '''Test for DDNS prerequisites''' +from dnstest.utils import * from dnstest.test import Test +import random -t = Test() +KNSUPDATE = random.choice([True, False]) +PROTOS = [Proto.TCP, Proto.TLS] + ([Proto.QUIC] if KNSUPDATE else []) +PROTO = random.choice(PROTOS) +detail_log("Using knsupdate %s %s\n" % (str(KNSUPDATE), str(PROTO))) +t = Test(tls=True, quic=True, knsupdate=KNSUPDATE) srv = t.server("knot") zone = t.zone("ddns.", storage=".") @@ -19,7 +25,7 @@ t.start() update = srv.update(zone) update.prereq_yx("existing.ddns.") update.add("1.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("1.ddns.", "TXT") resp.check("text") @@ -27,7 +33,7 @@ resp.check("text") update = srv.update(zone) update.prereq_yx("ddns.") update.add("2.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("2.ddns.", "TXT") resp.check("text") @@ -35,7 +41,7 @@ resp.check("text") update = srv.update(zone) update.prereq_yx("nonexistent.ddns.") update.add("3.ddns.", 1, "TXT", "text") -update.send("NXDOMAIN") +update.send("NXDOMAIN", proto=PROTO) resp = srv.dig("3.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -43,7 +49,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_yx("nonexistent.") update.add("4.ddns.", 1, "TXT", "text") -update.send("NOTZONE") +update.send("NOTZONE", proto=PROTO) resp = srv.dig("4.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -53,7 +59,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_nx("nonexistent.ddns.") update.add("4.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("4.ddns.", "TXT") resp.check("text") @@ -61,7 +67,7 @@ resp.check("text") update = srv.update(zone) update.prereq_nx("existing.ddns.") update.add("5.ddns.", 1, "TXT", "text") -update.send("YXDOMAIN") +update.send("YXDOMAIN", proto=PROTO) resp = srv.dig("5.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -69,7 +75,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_nx("nonexistent.") update.add("6.ddns.", 1, "TXT", "text") -update.send("NOTZONE") +update.send("NOTZONE", proto=PROTO) resp = srv.dig("6.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -79,7 +85,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_nx("nonexistent.ddns.", "TYPE65535") update.add("7.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("7.ddns.", "TXT") resp.check("text") @@ -87,7 +93,7 @@ resp.check("text") update = srv.update(zone) update.prereq_nx("existing.ddns.", "TYPE65535") update.add("8.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("8.ddns.", "TXT") resp.check("text") @@ -95,7 +101,7 @@ resp.check("text") update = srv.update(zone) update.prereq_nx("existing.ddns.", "A") update.add("9.ddns.", 1, "TXT", "text") -update.send("YXRRSET") +update.send("YXRRSET", proto=PROTO) resp = srv.dig("9.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -103,7 +109,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_nx("nonexistent.", "TYPE65535") update.add("10.ddns.", 1, "TXT", "text") -update.send("NOTZONE") +update.send("NOTZONE", proto=PROTO) resp = srv.dig("10.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -111,7 +117,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_nx("a.wildcard.ddns.", "TYPE65535") update.add("11.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("11.ddns.", "TXT") resp.check("text") @@ -119,7 +125,7 @@ resp.check("text") update = srv.update(zone) update.prereq_nx("a.wildcard.ddns.", "A") update.add("12.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("12.ddns.", "TXT") resp.check("text") @@ -127,7 +133,7 @@ resp.check("text") update = srv.update(zone) update.prereq_nx("*.wildcard.ddns.", "A") update.add("13.ddns.", 1, "TXT", "text") -update.send("YXRRSET") +update.send("YXRRSET", proto=PROTO) resp = srv.dig("13.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -137,7 +143,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_yx("nonexistent.ddns.", "TYPE65535") update.add("13.ddns.", 1, "TXT", "text") -update.send("NXRRSET") +update.send("NXRRSET", proto=PROTO) resp = srv.dig("13.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -145,7 +151,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_yx("existing.ddns.", "TYPE65535") update.add("14.ddns.", 1, "TXT", "text") -update.send("NXRRSET") +update.send("NXRRSET", proto=PROTO) resp = srv.dig("14.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -153,7 +159,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_yx("existing.ddns.", "A") update.add("15.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("15.ddns.", "TXT") resp.check("text") @@ -161,7 +167,7 @@ resp.check("text") update = srv.update(zone) update.prereq_yx("existing.ddns.", "A", "1.2.3.4") update.add("16.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("16.ddns.", "TXT") resp.check("text") @@ -169,7 +175,7 @@ resp.check("text") update = srv.update(zone) update.prereq_yx("existing.ddns.", "A", "1.2.3.255") update.add("17.ddns.", 1, "TXT", "text") -update.send("NXRRSET") +update.send("NXRRSET", proto=PROTO) resp = srv.dig("17.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -177,7 +183,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_yx("nonexistent.", "TYPE65535") update.add("18.ddns.", 1, "TXT", "text") -update.send("NOTZONE") +update.send("NOTZONE", proto=PROTO) resp = srv.dig("18.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -185,7 +191,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_yx("a.wildcard.ddns.", "TYPE65535") update.add("19.ddns.", 1, "TXT", "text") -update.send("NXRRSET") +update.send("NXRRSET", proto=PROTO) resp = srv.dig("19.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -193,7 +199,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_yx("a.wildcard.ddns.", "A") update.add("20.ddns.", 1, "TXT", "text") -update.send("NXRRSET") +update.send("NXRRSET", proto=PROTO) resp = srv.dig("20.ddns.", "TXT") resp.check(rcode="NXDOMAIN") @@ -201,7 +207,7 @@ resp.check(rcode="NXDOMAIN") update = srv.update(zone) update.prereq_yx("*.wildcard.ddns.", "A") update.add("21.ddns.", 1, "TXT", "text") -update.send("NOERROR") +update.send("NOERROR", proto=PROTO) resp = srv.dig("21.ddns.", "TXT") resp.check("text") diff --git a/tests-extra/tools/dnstest/update.py b/tests-extra/tools/dnstest/update.py index c697da98d..f38680b84 100644 --- a/tests-extra/tools/dnstest/update.py +++ b/tests-extra/tools/dnstest/update.py @@ -24,8 +24,8 @@ class Update(object): def prereq_yx(self, owner, *args): self.upd.present(owner, *args) - def prereq_nx(self, owner, rtype=None): - self.upd.absent(owner, rtype) + def prereq_nx(self, owner, *args): + self.upd.absent(owner, *args) def send(self, rcode="NOERROR", proto=Proto.TCP): if type(rcode) is not str and rcode is not None: |