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