1# Service processor discovery through Avahi 2 3Author: Ratan Gupta 4 5Other contributors: Asmitha KR 6 7Created: 2019-07-12 8 9# Background and References 10 11[1] https://www.engineersgarage.com/Articles/IoT-Service-Discovery-Protocols [2] 12http://www.zeroconf.org/ZeroconfAndUPnP.html : comparison of mDns v/s UPnP. [3] 13https://www.avahi.org/ [4] 14https://github.com/lathiat/avahi/blob/master/avahi-daemon/example.service 15 16Apple’s Bonjour uses mDNS and DNS-SD. Linux’s Avahi uses IPv4LL, mDNS, and 17DNS-SD. Linux’s systemd uses resolve hostnames on a network via DNS, mDNS, and 18LMMNR. 19 20## Problem Description 21 22In a network where there are thousands of system, Management console should be 23able to discover the server. We have a requirement where the management console 24wants to discover the vendor-specific server. 25 26eg: Management console wants to discover the low-end server of manufacturer XYZ. 27 28## Proposed Design 29 30Currently in openBMC, Avahi is being used as service discovery. Avahi is a 31system which facilitates service discovery on a local network via the 32mDNS/DNS-SD protocol suite. BMC publishes the hostname and interface details to 33the network using the Avahi service. 34 35The services that are being published by Avahi have various fields like - 36service name, type, port, hostname, address, port, and a text record. To solve 37the above-listed problem, we are proposing a solution in which the 38vendor-specific information is included in the text record field of the Avahi 39service file. 40 41To do so, currently, in OpenBMC we have the infrastructure where the 42service-specific data is passed through a systemd service specific bb file. 43Depending on the distro feature(Avahi) enabled or not, it generates the Avahi 44service file with the given data. We are enhancing this infrastructure to add 45the vendor-specific information in the avahi service file(under txt-record). 46 47Following commits implements the behaviour. 48 49https://gerrit.openbmc.org/c/openbmc/meta-phosphor/+/22950 50https://gerrit.openbmc.org/c/openbmc/meta-ibm/+/22951 51 52As part of avahi discovery response, the client receives the following: 53 541. Hostname 552. IP address 563. Service Port 574. Service Type 585. Additional data 59 60### How to do discovery through avahi 61 62The following command may be used to discover the BMC systems in the network. 63Avahi-browse -rt <service type> e.g. To discover service type : 64\_obmc_rest.\_tcp avahi-browse -rt \_obmc_rest.\_tcp Output of the above command 65is as follows avahi-browse -rt \_obmc_rest.\_tcp 66 67- eth0 IPv6 obmc_rest \_obmc_rest.\_tcp local 68- eth0 IPv4 obmc_rest \_obmc_rest.\_tcp local = eth0 IPv6 obmc_rest 69 \_obmc_rest.\_tcp local hostname = 70 [witherspoon-cdcb785972fb41f082c7ca747e287fa6.local] address = 71 [fe80::72e2:84ff:fe14:2390] port = [443] txt = ["Manufacturer=XYZ"] txt = 72 ["Type=abc"] = eth0 IPv4 obmc_rest \_obmc_rest.\_tcp local hostname = 73 [witherspoon-cdcb785972fb41f082c7ca747e287fa6.local] address = [9.5.180.233] 74 port = [443] txt = ["Manufacturer=XYZ"] txt = ["Type=abc"] 75 76## Alternatives Considered 77 78openSLP 79 80## Impacts 81 82None. 83 84## Testing 85 86The path /etc/avahi/services contain all the services that avahi publishes on 87startup. 88