Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-zeroconf 0.75.0 strict=False for _nmos-registration._tcp #829

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:bionic
FROM ubuntu:focal

WORKDIR /home/nmos-testing
ADD . .
Expand All @@ -7,9 +7,9 @@ ADD .git .git
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y wget \
&& wget https://deb.nodesource.com/setup_14.x \
&& chmod 755 setup_14.x \
&& /home/nmos-testing/setup_14.x \
&& wget https://deb.nodesource.com/setup_16.x \
&& chmod 755 setup_16.x \
&& /home/nmos-testing/setup_16.x \
&& apt-get install -y --no-install-recommends \
gcc openssl libssl-dev wget ca-certificates avahi-daemon avahi-utils libnss-mdns libavahi-compat-libdnssd-dev \
python3 python3-pip python3-dev nodejs \
Expand All @@ -26,7 +26,7 @@ RUN apt-get update \
&& rm v3.0.7.tar.gz \
&& npm config set unsafe-perm true \
&& npm install -g AMWA-TV/sdpoker#v0.3.0 \
&& rm /home/nmos-testing/setup_14.x \
&& rm /home/nmos-testing/setup_16.x \
&& apt-get remove -y wget \
&& apt-get clean -y --no-install-recommends \
&& apt-get autoclean -y --no-install-recommends \
Expand Down
2 changes: 1 addition & 1 deletion docs/1.1. Installation - Local.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Please ensure that the following dependencies are installed on your system first.

- Python 3.6 or higher, including the 'pip' package manager
- Python 3.8 or higher, including the 'pip' package manager
- Git
- [testssl.sh](https://testssl.sh) (required for BCP-003-01 testing, see our [README](../testssl/README.md) for instructions)
- [OpenSSL](https://www.openssl.org/) (required for BCP-003-01 OCSP testing)
Expand Down
20 changes: 10 additions & 10 deletions nmostesting/suites/IS0401Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
from ..IS04Utils import IS04Utils
from ..TestHelper import get_default_ip, is_ip_address, load_resolved_schema, check_content_type

# monkey patch zeroconf to allow us to advertise "_nmos-registration._tcp"
from zeroconf import service_type_name
service_type_name.__kwdefaults__['strict'] = False

NODE_API_KEY = "node"
RECEIVER_CAPS_KEY = "receiver-caps"
CAPS_REGISTER_KEY = "caps-register"
Expand Down Expand Up @@ -94,6 +90,10 @@ def tear_down_tests(self):
if self.dns_server:
self.dns_server.reset()

def _strict_service_name(self, info):
# avoid zeroconf._exceptions.BadTypeInNameException: Service name (nmos-registration) must be <= 15 bytes
return len(info.type[1:info.type.find('.')]) <= 15

def _mdns_info(self, port, service_type, txt={}, api_ver=None, api_proto=None, api_auth=None, ip=None):
"""Get an mDNS ServiceInfo object in order to create an advertisement"""
if api_ver is None:
Expand Down Expand Up @@ -192,9 +192,9 @@ def do_registry_basics_prereqs(self):
if CONFIG.DNS_SD_MODE == "multicast":
# Advertise the primary registry and invalid ones at pri 0, and allow the Node to do a basic registration
if self.is04_utils.compare_api_version(self.apis[NODE_API_KEY]["version"], "v1.0") != 0:
self.zc.register_service(registry_mdns[0])
self.zc.register_service(registry_mdns[1])
self.zc.register_service(registry_mdns[2])
self.zc.register_service(registry_mdns[0], strict=self._strict_service_name(registry_mdns[0]))
self.zc.register_service(registry_mdns[1], strict=self._strict_service_name(registry_mdns[1]))
self.zc.register_service(registry_mdns[2], strict=self._strict_service_name(registry_mdns[2]))

# Wait for n seconds after advertising the service for the first POST from a Node
start_time = time.time()
Expand Down Expand Up @@ -226,7 +226,7 @@ def do_registry_basics_prereqs(self):

if CONFIG.DNS_SD_MODE == "multicast":
for info in registry_mdns[3:]:
self.zc.register_service(info)
self.zc.register_service(info, strict=self._strict_service_name(info))

# Kill registries one by one to collect data around failover
self.invalid_registry.disable()
Expand Down Expand Up @@ -1455,7 +1455,7 @@ def test_21(self, test):

if CONFIG.DNS_SD_MODE == "multicast":
# Advertise a registry at pri 0 and allow the Node to do a basic registration
self.zc.register_service(registry_info)
self.zc.register_service(registry_info, strict=self._strict_service_name(registry_info))

# Wait for n seconds after advertising the service for the first POST and then DELETE from a Node
self.primary_registry.wait_for_registration(CONFIG.DNS_SD_ADVERT_TIMEOUT)
Expand Down Expand Up @@ -2160,7 +2160,7 @@ def collect_mdns_announcements(self):

if CONFIG.DNS_SD_MODE == "multicast":
# Advertise a registry at pri 0 and allow the Node to do a basic registration
self.zc.register_service(registry_info)
self.zc.register_service(registry_info, strict=self._strict_service_name(registry_info))

# Wait for n seconds after advertising the service for the first POST from a Node
self.primary_registry.wait_for_registration(CONFIG.DNS_SD_ADVERT_TIMEOUT)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
flask>=2.0.0
wtforms
jsonschema
zeroconf>=0.32.0
zeroconf>=0.75.0
requests
netifaces
gitpython
Expand Down
Loading