19715ab84SPatrick Williams# Service processor discovery through Avahi 2*f4febd00SPatrick Williams 39715ab84SPatrick WilliamsAuthor: Ratan Gupta 49715ab84SPatrick Williams 59715ab84SPatrick WilliamsOther contributors: Asmitha KR 69715ab84SPatrick Williams 79715ab84SPatrick WilliamsCreated: 2019-07-12 89715ab84SPatrick Williams 99715ab84SPatrick Williams# Background and References 109715ab84SPatrick Williams 11*f4febd00SPatrick Williams[1] https://www.engineersgarage.com/Articles/IoT-Service-Discovery-Protocols [2] 12*f4febd00SPatrick Williamshttp://www.zeroconf.org/ZeroconfAndUPnP.html : comparison of mDns v/s UPnP. [3] 13*f4febd00SPatrick Williamshttps://www.avahi.org/ [4] 14*f4febd00SPatrick Williamshttps://github.com/lathiat/avahi/blob/master/avahi-daemon/example.service 15*f4febd00SPatrick Williams 16*f4febd00SPatrick WilliamsApple’s Bonjour uses mDNS and DNS-SD. Linux’s Avahi uses IPv4LL, mDNS, and 17*f4febd00SPatrick WilliamsDNS-SD. Linux’s systemd uses resolve hostnames on a network via DNS, mDNS, and 18*f4febd00SPatrick WilliamsLMMNR. 199715ab84SPatrick Williams 209715ab84SPatrick Williams## Problem Description 21*f4febd00SPatrick Williams 22*f4febd00SPatrick WilliamsIn a network where there are thousands of system, Management console should be 23*f4febd00SPatrick Williamsable to discover the server. We have a requirement where the management console 24*f4febd00SPatrick Williamswants to discover the vendor-specific server. 259715ab84SPatrick Williams 269715ab84SPatrick Williamseg: Management console wants to discover the low-end server of manufacturer XYZ. 279715ab84SPatrick Williams 289715ab84SPatrick Williams## Proposed Design 29*f4febd00SPatrick Williams 30*f4febd00SPatrick WilliamsCurrently in openBMC, Avahi is being used as service discovery. Avahi is a 31*f4febd00SPatrick Williamssystem which facilitates service discovery on a local network via the 329715ab84SPatrick WilliamsmDNS/DNS-SD protocol suite. BMC publishes the hostname and interface details to 339715ab84SPatrick Williamsthe network using the Avahi service. 349715ab84SPatrick Williams 359715ab84SPatrick WilliamsThe services that are being published by Avahi have various fields like - 369715ab84SPatrick Williamsservice name, type, port, hostname, address, port, and a text record. To solve 379715ab84SPatrick Williamsthe above-listed problem, we are proposing a solution in which the 389715ab84SPatrick Williamsvendor-specific information is included in the text record field of the Avahi 399715ab84SPatrick Williamsservice file. 409715ab84SPatrick Williams 419715ab84SPatrick WilliamsTo do so, currently, in OpenBMC we have the infrastructure where the 429715ab84SPatrick Williamsservice-specific data is passed through a systemd service specific bb file. 439715ab84SPatrick WilliamsDepending on the distro feature(Avahi) enabled or not, it generates the Avahi 449715ab84SPatrick Williamsservice file with the given data. We are enhancing this infrastructure to add 459715ab84SPatrick Williamsthe vendor-specific information in the avahi service file(under txt-record). 469715ab84SPatrick Williams 47146f9098SGeorge KeishingFollowing commits implements the behaviour. 489715ab84SPatrick Williams 490ee8da09SNodeMan97https://gerrit.openbmc.org/c/openbmc/meta-phosphor/+/22950 500ee8da09SNodeMan97https://gerrit.openbmc.org/c/openbmc/meta-ibm/+/22951 519715ab84SPatrick Williams 529715ab84SPatrick WilliamsAs part of avahi discovery response, the client receives the following: 53*f4febd00SPatrick Williams 54*f4febd00SPatrick Williams1. Hostname 55*f4febd00SPatrick Williams2. IP address 56*f4febd00SPatrick Williams3. Service Port 57*f4febd00SPatrick Williams4. Service Type 58*f4febd00SPatrick Williams5. Additional data 599715ab84SPatrick Williams 609715ab84SPatrick Williams### How to do discovery through avahi 619715ab84SPatrick Williams 629715ab84SPatrick WilliamsThe following command may be used to discover the BMC systems in the network. 63*f4febd00SPatrick WilliamsAvahi-browse -rt <service type> e.g. To discover service type : 64*f4febd00SPatrick Williams\_obmc_rest.\_tcp avahi-browse -rt \_obmc_rest.\_tcp Output of the above command 65*f4febd00SPatrick Williamsis as follows avahi-browse -rt \_obmc_rest.\_tcp 66*f4febd00SPatrick Williams 67*f4febd00SPatrick Williams- eth0 IPv6 obmc_rest \_obmc_rest.\_tcp local 68*f4febd00SPatrick Williams- eth0 IPv4 obmc_rest \_obmc_rest.\_tcp local = eth0 IPv6 obmc_rest 69*f4febd00SPatrick Williams \_obmc_rest.\_tcp local hostname = 70*f4febd00SPatrick Williams [witherspoon-cdcb785972fb41f082c7ca747e287fa6.local] address = 71*f4febd00SPatrick Williams [fe80::72e2:84ff:fe14:2390] port = [443] txt = ["Manufacturer=XYZ"] txt = 72*f4febd00SPatrick Williams ["Type=abc"] = eth0 IPv4 obmc_rest \_obmc_rest.\_tcp local hostname = 73*f4febd00SPatrick Williams [witherspoon-cdcb785972fb41f082c7ca747e287fa6.local] address = [9.5.180.233] 74*f4febd00SPatrick Williams port = [443] txt = ["Manufacturer=XYZ"] txt = ["Type=abc"] 759715ab84SPatrick Williams 769715ab84SPatrick Williams## Alternatives Considered 77*f4febd00SPatrick Williams 789715ab84SPatrick WilliamsopenSLP 799715ab84SPatrick Williams 809715ab84SPatrick Williams## Impacts 81*f4febd00SPatrick Williams 829715ab84SPatrick WilliamsNone. 839715ab84SPatrick Williams 849715ab84SPatrick Williams## Testing 85*f4febd00SPatrick Williams 869715ab84SPatrick WilliamsThe path /etc/avahi/services contain all the services that avahi publishes on 879715ab84SPatrick Williamsstartup. 88