ci: cram: add test for tr181-dnssd

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 <yuce.kurum@mind.be>
Signed-off-by: Yüce Kürüm <yuce.kurum_ext@softathome.com>
This commit is contained in:
Yüce Kürüm 2024-07-26 14:49:06 +02:00 committed by Petr Štetiar
parent bcd1eac75c
commit 2e2fd3200b
No known key found for this signature in database
GPG Key ID: 58EE120F30CC02D3

View File

@ -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