From 2e2fd3200b5286cd94ffbf006de18a2489153242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C3=BCce=20K=C3=BCr=C3=BCm?= Date: Fri, 26 Jul 2024 14:49:06 +0200 Subject: [PATCH] ci: cram: add test for tr181-dnssd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are no tests for checking the DNS Service Discovery functionality. In order to properly test tr181-dnssd we need to extract the services from the responses. `nmap -sU --script=dns-service-discovery -p5353 192.168.1.1` is supposed to that, but advertised services don't show up in the command output. We can still see them in the packet capture: 14:40:31.631478 IP 192.168.1.2.53064 > 192.168.1.1.5353: 0 PTR (QM)? _services._dns-sd._udp.local. (46) 14:40:31.634862 IP 192.168.1.1.5353 > 224.0.0.251.5353: 0*- [0q] 1/0/0 A 192.168.1.1 (44) 14:40:31.634862 IP 192.168.1.1.5353 > 224.0.0.251.5353: 0*- [0q] 1/0/0 PTR _mqtt._tcp.local. (70) 14:40:31.634862 IP 192.168.1.1.5353 > 224.0.0.251.5353: 0*- [0q] 1/0/0 PTR prplOS.lan._mqtt._tcp.local. (69) 14:40:31.634862 IP 192.168.1.1.5353 > 224.0.0.251.5353: 0*- [0q] 2/0/0 SRV prplOS.lan.local.:0 1648 29296, TXT "From=sah" (123) Until we can find a way to properly check the advertised services, let's at least make sure that the basic functionality is there. For this purpose: - Check DM entry. - Check firewall rules - Check if service responds Signed-off-by: Yüce Kürüm Signed-off-by: Yüce Kürüm --- .../acceleration-plan-components/067-dnssd.t | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .gitlab/tests/cram/generic/acceleration-plan-components/067-dnssd.t diff --git a/.gitlab/tests/cram/generic/acceleration-plan-components/067-dnssd.t b/.gitlab/tests/cram/generic/acceleration-plan-components/067-dnssd.t new file mode 100644 index 0000000000..4eba161448 --- /dev/null +++ b/.gitlab/tests/cram/generic/acceleration-plan-components/067-dnssd.t @@ -0,0 +1,41 @@ +Create R alias: + + $ alias R="${CRAM_REMOTE_COMMAND:-}" + +Check the root datamodel settings: + + $ R "ba-cli --json DNSSD.? | sed -n '2p'" | jq --sort-keys '.[0]' + { + "DNSSD.": { + "AdvertiseNumberOfEntries": 1, + "AdvertisedInterfaces": "Device.IP.Interface.3.", + "Enable": 1, + "ServiceNumberOfEntries": 0, + "Status": "Enabled" + }, + "DNSSD.Advertise.1.": { + "Alias": "usp-agt-mqtt", + "ApplicationProtocol": "mqtt", + "Enable": 1, + "InstanceName": "usp-agt-mqtt", + "Port": 0, + "Status": "Enabled", + "TextRecordNumberOfEntries": 1, + "TransportProtocol": "TCP" + }, + "DNSSD.Advertise.1.TextRecord.1.": { + "Key": "From", + "Value": "sah" + } + } + +Check that firewall is configured properly: + + $ R "iptables -nL | grep 5353" + ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp spt:5353 + ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:5353 + +Check that DNS-Based Service Discovery service is responding: + + $ sudo nmap -Pn -p5353 -sU 192.168.1.1 2>&1 | grep zeroconf + 5353/udp open|filtered zeroconf