From ee90393157cc2d4d3cbcc9b58083dea2267f8ac9 Mon Sep 17 00:00:00 2001 From: asmithakarun Date: Mon, 24 Jun 2019 05:28:05 -0500 Subject: Enhance Discovery class infrastructure The service files contains a 'txt' field, where service-specific data can be added. Addition of this text record facilitates unique identification of IBM BMCs in a network. The idea of this commit is to enhance the bbclass to append a new text record in the avahi static service files. This text record is added only for avahi and not slp. Tested By: The additional data should be in the form of 'Key=Value', else the build will be terminated with the corresponding error. The following possibilities are tested: 1. Key=Value => True 2. Key= => False 3. Key=Value| => True 4. =Value => False 5. Key=Value= => False 6. == => False (From meta-phosphor rev: 2d6aedfb652bc0e6c7657dae586349823e3fb26d) Signed-off-by: asmithakarun Change-Id: Ie0b8466a10097d7fdbfd0c8849a0c0d7145e3923 Signed-off-by: Brad Bishop --- .../classes/obmc-phosphor-discovery-service.bbclass | 20 +++++++++++++------- .../recipes-phosphor/console/obmc-console_git.bb | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'meta-phosphor') diff --git a/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass b/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass index 313402ff3..e912beadc 100644 --- a/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass +++ b/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass @@ -7,7 +7,6 @@ python() { slp_enabled = bb.utils.contains( 'DISTRO_FEATURES', 'slp', True, False, d) - if not avahi_enabled and not slp_enabled: return @@ -28,7 +27,7 @@ python() { for service in listvar_to_list(d, 'REGISTERED_SERVICES_%s' % pkg): if avahi_enabled: set_append(d, 'RRECOMMENDS_%s' % pkg, 'avahi-daemon') - svc_name, svc_type, svc_port = service.split(':') + svc_name, svc_type, svc_port, svc_txt_data = service.split(':') set_append(d, 'FILES_%s' % pkg, os.path.join( syscnfdir, 'avahi', @@ -37,7 +36,7 @@ python() { if slp_enabled: set_append(d, 'RRECOMMENDS_%s' % pkg, 'slpd-lite') - svc_name, svc_type, svc_port = service.split(':') + svc_name, svc_type, svc_port, svc_txt_data = service.split(':') set_append(d, 'FILES_%s' % pkg, os.path.join( syscnfdir, 'slp', @@ -64,7 +63,8 @@ python discovery_services_postinstall() { if not os.path.exists(slp_service_dir): os.makedirs(slp_service_dir) - def register_service_avahi(d, service_name, service_type, service_port): + def register_service_avahi(d, service_name, service_type, service_port, service_txt_data): + service_txt_data = service_txt_data.split('|') service_file = os.path.join( avahi_service_dir, '%s.service' % service_name) @@ -76,10 +76,16 @@ python discovery_services_postinstall() { fd.write(' \n') fd.write(' %s\n' % service_type) fd.write(' %s\n' % service_port) + for txt_record in service_txt_data: + if txt_record: + key, value = txt_record.split('=') + if key.strip() and value.strip(): + fd.write(' %s\n' % txt_record) + else: + bb.fatal('Invalid Additional data : \'%s\'. Ignoring!' % txt_record) fd.write(' \n') fd.write('\n') - def register_service_slp(d, service_name, service_type, service_port): service_file = os.path.join( slp_service_dir, @@ -91,12 +97,12 @@ python discovery_services_postinstall() { for service in listvar_to_list(d, 'REGISTERED_SERVICES_%s' % pkg): svc_info = service.split(":") try: - svc_name, svc_type, svc_port = svc_info + svc_name, svc_type, svc_port, svc_txt_data = svc_info except: continue if avahi_enabled: avahi_svc_type = "_" + svc_name + "._" + svc_type - register_service_avahi(d, svc_name, avahi_svc_type, svc_port) + register_service_avahi(d, svc_name, avahi_svc_type, svc_port, svc_txt_data) if slp_enabled: register_service_slp(d, svc_name, svc_type, svc_port) diff --git a/meta-phosphor/recipes-phosphor/console/obmc-console_git.bb b/meta-phosphor/recipes-phosphor/console/obmc-console_git.bb index 7316d8ee6..7d11bffe0 100644 --- a/meta-phosphor/recipes-phosphor/console/obmc-console_git.bb +++ b/meta-phosphor/recipes-phosphor/console/obmc-console_git.bb @@ -21,7 +21,7 @@ SRC_URI += "file://${BPN}.conf" SRCREV = "c5ce2cbd12e395749c3b4abedf0d81f49b402b70" PV = "1.0+git${SRCPV}" -REGISTERED_SERVICES_${PN} += "obmc_console:tcp:2200" +REGISTERED_SERVICES_${PN} += "obmc_console:tcp:2200:" OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0" SYSTEMD_SUBSTITUTIONS += "OBMC_CONSOLE_HOST_TTY:${OBMC_CONSOLE_HOST_TTY}:${PN}-ssh@.service" SYSTEMD_SUBSTITUTIONS += "OBMC_CONSOLE_HOST_TTY:${OBMC_CONSOLE_HOST_TTY}:${PN}-ssh.socket" -- cgit v1.2.3