Skip to content

Add an async DNS server for use in system tests

Implement a new Python class, AsyncDNSServer, which can be used by ans.py scripts placed in ansX/ system test subdirectories. This enables conveniently starting a not-necessarily-standards-compliant, feature-limited, custom DNS server instance. It can read and serve zone files, but it is also able to evaluate any user-provided query-processing logic, allowing query responses to be changed, delayed, or dropped altogether. These are all actions commonly taken by custom DNS servers written in Python that are used in BIND 9 system tests. Having a single "base" implementation of such a custom DNS server reduces code duplication, improving test maintainability.

DO NOT MERGE is set because this still requires adding comments and potentially also addressing design issues.

Attached is a sample script that uses asyncserver.py to implement a dynamic AXFR generator. It is not meant to be merged, but it is meant to serve as a brief demo of how ready-to-use components can be built on top of the mechanisms included in this MR. (asyncserver_axfr.py is able to work as an ans.py server once it is put into a proper ansX/ subdirectory in bin/tests/system/.)

asyncserver_axfr.py

The script does not demonstrate zone loading, which is arguably one of the most convenient features that asyncserver.py brings.

Merge request reports