From c111a68e743e5305c7299e01502a9c2cc07492e5 Mon Sep 17 00:00:00 2001 From: sudhanshukumar22 <51457531+sudhanshukumar22@users.noreply.github.com> Date: Thu, 7 Jan 2021 01:54:57 +0530 Subject: [PATCH] [docker-lldp]: sonic advertise meaningful SysDescription instead of debian (#6114) Sonic devices advertise meaningful system description along with Debian package information. before the fix: ------------- admin@sonic:~$ show lldp neighbors ------------------------------------------------------------------------------- LLDP neighbors: ------------------------------------------------------------------------------- Interface: Ethernet0, via: LLDP, RID: 3, Time: 0 day, 16:36:30 SysName: sonic SysDescr: Debian GNU/Linux 9 (stretch) Linux 4.9.0-11-2-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64 ------------------------------------------------------------------------------- After the fix: root@sonic:~# show lldp neighbors Ethernet16 ------------------------------------------------------------------------------- LLDP neighbors: ------------------------------------------------------------------------------- Interface: Ethernet16, via: LLDP, RID: 10, Time: 0 day, 00:01:00 SysName: sonic SysDescr: SONiC Software Version: SONiC.sonic_upstream_1.0_daily_201130_1501_62-dirty-20201130.203529 - HwSku: Accton-AS7816-64X - Distribution: Debian 10.6 - Kernel: 4.19.0-9-2-amd64 ------------------------------------------------------------------------------- Signed-off-by: sudhanshukumar22 --- dockers/docker-lldp/Dockerfile.j2 | 1 + dockers/docker-lldp/lldpdSysDescr.conf.j2 | 1 + dockers/docker-lldp/start.sh | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 dockers/docker-lldp/lldpdSysDescr.conf.j2 diff --git a/dockers/docker-lldp/Dockerfile.j2 b/dockers/docker-lldp/Dockerfile.j2 index 297f7766519b..a1c7a1c1bee2 100644 --- a/dockers/docker-lldp/Dockerfile.j2 +++ b/dockers/docker-lldp/Dockerfile.j2 @@ -43,6 +43,7 @@ COPY ["start.sh", "/usr/bin/"] COPY ["waitfor_lldp_ready.sh", "/usr/bin/"] COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"] COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"] +COPY ["lldpdSysDescr.conf.j2", "/usr/share/sonic/templates/"] COPY ["lldpd", "/etc/default/"] COPY ["lldpmgrd", "/usr/bin/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] diff --git a/dockers/docker-lldp/lldpdSysDescr.conf.j2 b/dockers/docker-lldp/lldpdSysDescr.conf.j2 new file mode 100644 index 000000000000..047b3c68b34f --- /dev/null +++ b/dockers/docker-lldp/lldpdSysDescr.conf.j2 @@ -0,0 +1 @@ +configure system description "SONiC Software Version: SONiC.{{ build_version }} - HwSku: {{ DEVICE_METADATA['localhost']['hwsku'] }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }}" diff --git a/dockers/docker-lldp/start.sh b/dockers/docker-lldp/start.sh index b2c82d6d0437..5a489884aea9 100755 --- a/dockers/docker-lldp/start.sh +++ b/dockers/docker-lldp/start.sh @@ -1,4 +1,10 @@ #!/usr/bin/env bash +CFGGEN_PARAMS=" \ + -d \ + -t /usr/share/sonic/templates/lldpd.conf.j2 \ + -y /etc/sonic/sonic_version.yml \ + -t /usr/share/sonic/templates/lldpdSysDescr.conf.j2 \ +" if [ "${RUNTIME_OWNER}" == "" ]; then RUNTIME_OWNER="kube" @@ -10,7 +16,7 @@ then ${CTR_SCRIPT} -f lldp -o ${RUNTIME_OWNER} -v ${IMAGE_VERSION} fi -sonic-cfggen -d -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf +sonic-cfggen $CFGGEN_PARAMS > /etc/lldpd.conf mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status