convert filter-aaaa test to python

use pytest for the filter-aaaa test.

In order to implement this, isctest.mark can now test whether IPv6 is
configured by calling testsock6.pl.
This commit is contained in:
Evan Hunt 2025-07-10 01:03:17 -07:00
parent 2a078733c1
commit b234c6d954
24 changed files with 1476 additions and 1654 deletions

View file

@ -11,6 +11,9 @@
* information regarding copyright ownership.
*/
{% set filtertype = filtertype | default("aaaa") %}
{% set family = family | default("v4") %}
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
@ -25,13 +28,19 @@ options {
minimal-responses no;
};
{% if family == "v6" %}
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v6 yes;
filter-@filtertype@ { fd92:7065:b8e:ffff::1; };
};
{% else %}
acl filterees { 10.53.0.1; };
acl filterees { 10.53.0.1; };
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v4 yes;
filter-aaaa { filterees; };
};
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v4 yes;
filter-@filtertype@ { filterees; };
};
{% endif %}
key rndc_key {
secret "1234abcd8765";

View file

@ -1,45 +0,0 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { fd92:7065:b8e:ffff::1; };
recursion no;
dnssec-validation no;
notify yes;
minimal-responses no;
};
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v6 yes;
filter-aaaa { fd92:7065:b8e:ffff::1; };
};
key rndc_key {
secret "1234abcd8765";
algorithm @DEFAULT_HMAC@;
};
controls {
inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
zone "." { type primary; file "root.db"; };
zone "signed" { type primary; file "signed.db.signed"; };
zone "unsigned" { type primary; file "unsigned.db"; };

View file

@ -11,6 +11,9 @@
* information regarding copyright ownership.
*/
{% set filtertype = filtertype | default("aaaa") %}
{% set family = family | default("v4") %}
options {
query-source address 10.53.0.2;
notify-source 10.53.0.2;
@ -25,10 +28,17 @@ options {
minimal-responses no;
};
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v4 yes;
filter-aaaa { 10.53.0.2; };
};
{% if family == "v6" %}
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v6 yes;
filter-@filtertype@ { fd92:7065:b8e:ffff::2; };
};
{% else %}
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v4 yes;
filter-@filtertype@ { 10.53.0.2; };
};
{% endif %}
key rndc_key {
secret "1234abcd8765";

View file

@ -1,44 +0,0 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.2;
notify-source 10.53.0.2;
transfer-source 10.53.0.2;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.2; };
listen-on-v6 { fd92:7065:b8e:ffff::2; };
recursion yes;
dnssec-validation yes;
notify yes;
minimal-responses no;
};
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v6 yes;
filter-aaaa { fd92:7065:b8e:ffff::2; };
};
key rndc_key {
secret "1234abcd8765";
algorithm @DEFAULT_HMAC@;
};
controls {
inet 10.53.0.2 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
zone "." { type hint; file "hints"; };
include "trusted.conf";

View file

@ -11,6 +11,9 @@
* information regarding copyright ownership.
*/
{% set filtertype = filtertype | default("aaaa") %}
{% set family = family | default("v4") %}
options {
query-source address 10.53.0.3;
notify-source 10.53.0.3;
@ -25,10 +28,17 @@ options {
minimal-responses no;
};
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v6 break-dnssec;
filter-aaaa { fd92:7065:b8e:ffff::3; };
};
{% if family == "v6" %}
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v6 break-dnssec;
filter-@filtertype@ { fd92:7065:b8e:ffff::3; };
};
{% else %}
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v4 break-dnssec;
filter-@filtertype@ { 10.53.0.3; };
};
{% endif %}
key rndc_key {
secret "1234abcd8765";

View file

@ -1,44 +0,0 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.3;
notify-source 10.53.0.3;
transfer-source 10.53.0.3;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.3; };
listen-on-v6 { fd92:7065:b8e:ffff::3; };
recursion yes;
dnssec-validation yes;
notify yes;
minimal-responses no;
};
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v4 break-dnssec;
filter-aaaa { 10.53.0.3; };
};
key rndc_key {
secret "1234abcd8765";
algorithm @DEFAULT_HMAC@;
};
controls {
inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
zone "." { type hint; file "hints"; };
include "trusted.conf";

View file

@ -11,6 +11,9 @@
* information regarding copyright ownership.
*/
{% set filtertype = filtertype | default("aaaa") %}
{% set family = family | default("v4") %}
options {
query-source address 10.53.0.4;
notify-source 10.53.0.4;
@ -25,10 +28,17 @@ options {
minimal-responses no;
};
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v4 break-dnssec;
filter-aaaa { 10.53.0.4; };
};
{% if family == "v6" %}
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v6 break-dnssec;
filter-@filtertype@ { fd92:7065:b8e:ffff::4; };
};
{% else %}
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v4 break-dnssec;
filter-@filtertype@ { 10.53.0.4; };
};
{% endif %}
key rndc_key {
secret "1234abcd8765";

View file

@ -1,44 +0,0 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.4;
notify-source 10.53.0.4;
transfer-source 10.53.0.4;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.4; };
listen-on-v6 { fd92:7065:b8e:ffff::4; };
recursion no;
dnssec-validation no;
notify yes;
minimal-responses no;
};
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v6 break-dnssec;
filter-aaaa { fd92:7065:b8e:ffff::4; };
};
key rndc_key {
secret "1234abcd8765";
algorithm @DEFAULT_HMAC@;
};
controls {
inet 10.53.0.4 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
zone "." { type primary; file "root.db"; };
zone "signed" { type primary; file "signed.db.signed"; };
zone "unsigned" { type primary; file "unsigned.db"; };

View file

@ -11,6 +11,8 @@
* information regarding copyright ownership.
*/
{% set filtertype = filtertype | default("aaaa") %}
options {
query-source address 10.53.0.5;
notify-source 10.53.0.5;
@ -30,9 +32,9 @@ options {
minimal-responses no;
};
plugin query "@TOP_BUILDDIR@/filter-aaaa.@DYLIB@" {
filter-aaaa-on-v4 break-dnssec;
filter-aaaa { any; };
plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
filter-@filtertype@-on-v4 break-dnssec;
filter-@filtertype@ { any; };
};
key rndc_key {

View file

@ -13,23 +13,5 @@
. ../conf.sh
copy_setports ns1/named1.conf.in ns1/named.conf
copy_setports ns2/named1.conf.in ns2/named.conf
copy_setports ns3/named1.conf.in ns3/named.conf
copy_setports ns4/named1.conf.in ns4/named.conf
copy_setports ns5/named.conf.in ns5/named.conf
copy_setports conf/good1.conf.in conf/good1.conf
copy_setports conf/good2.conf.in conf/good2.conf
copy_setports conf/good3.conf.in conf/good3.conf
copy_setports conf/good4.conf.in conf/good4.conf
copy_setports conf/good5.conf.in conf/good5.conf
copy_setports conf/bad1.conf.in conf/bad1.conf
copy_setports conf/bad2.conf.in conf/bad2.conf
copy_setports conf/bad3.conf.in conf/bad3.conf
copy_setports conf/bad4.conf.in conf/bad4.conf
copy_setports conf/bad5.conf.in conf/bad5.conf
(cd ns1 && $SHELL -e sign.sh)
(cd ns4 && $SHELL -e sign.sh)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,32 +0,0 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"conf/*.conf",
"dig.out.*",
"ns*/trusted.conf",
"ns1/*.signed",
"ns1/K*",
"ns1/dsset-*",
"ns1/signer.err",
"ns4/*.signed",
"ns4/K*",
"ns4/dsset-*",
"ns4/signer.err",
]
)
def test_filter_aaaa(run_tests_sh):
run_tests_sh()

View file

@ -13,12 +13,12 @@
import os
import platform
import socket
import shutil
import subprocess
import pytest
long_test = pytest.mark.skipif(
not os.environ.get("CI_ENABLE_LONG_TESTS"), reason="CI_ENABLE_LONG_TESTS not set"
)
@ -91,3 +91,15 @@ softhsm2_environment = pytest.mark.skipif(
),
reason="SOFTHSM2_CONF and SOFTHSM2_MODULE environmental variables must be set and pkcs11-tool and softhsm2-util tools present",
)
def have_ipv6():
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
try:
sock.bind(("fd92:7065:b8e:ffff::1", 0))
except OSError:
return False
return True
with_ipv6 = pytest.mark.skipif(not have_ipv6(), reason="IPv6 not available")