From 69a3c02233e3d13cba2d38a54b53228948e0defc Mon Sep 17 00:00:00 2001 From: sudhanshukumar22 Date: Wed, 2 Dec 2020 20:47:37 -0800 Subject: [PATCH] docker-lldp: Sonic devices advertise themeselves as simple "debian" over lldp instead of sonic Description: ------------------ Sonic devices advertise themeselves as simple "debian" over lldp instead of sonic log snip: ------------- admin@sonic:~$ show lldp neighbors ------------------------------------------------------------------------------- LLDP neighbors: ------------------------------------------------------------------------------- Interface: Ethernet0, via: LLDP, RID: 3, Time: 0 day, 16:36:30 Chassis: ChassisID: mac b8:6a:97:81:67:74 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 TTL: 120 MgmtIP: 10.59.143.140 MgmtIP: fe80::ba6a:97ff:fe81:6774 Capability: Bridge, on Capability: Router, on Capability: Wlan, off Capability: Station, off Port: PortID: local Eth1/1 PortDescr: Ethernet0 PMD autoneg: supported: no, enabled: no MAU oper type: 10GigBaseCX4 - X copper over 8 pair 100-Ohm balanced cable After the fix: root@sonic:~# tcpdump -i Ethernet16 --direction out -vvv tcpdump: listening on Ethernet16, link-type EN10MB (Ethernet), capture size 262144 bytes 05:33:27.469075 LLDP, length 288 Chassis ID TLV (1), length 7 Subtype MAC address (4): 80:a2:35:f2:7a:e4 (oui Unknown) 0x0000: 0480 a235 f27a e4 Port ID TLV (2), length 9 Subtype Local (7): Eth1/5/1 0x0000: 0745 7468 312f 352f 31 Time to Live TLV (3), length 2: TTL 120s 0x0000: 0078 System Name TLV (5), length 5: sonic 0x0000: 736f 6e69 63 System Description TLV (6), length 173 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 0x0000: 534f 4e69 4320 536f 6674 7761 7265 2056 0x0010: 6572 7369 6f6e 3a20 534f 4e69 432e 736f 0x0020: 6e69 635f 7570 7374 7265 616d 5f31 2e30 0x0030: 5f64 6169 6c79 5f32 3031 3133 305f 3135 0x0040: 3031 5f36 322d 6469 7274 792d 3230 3230 0x0050: 3131 3330 2e32 3033 3532 3920 2d20 4877 0x0060: 536b 753a 2041 6363 746f 6e2d 4153 3738 0x0070: 3136 2d36 3458 202d 2044 6973 7472 6962 0x0080: 7574 696f 6e3a 2044 6562 6961 6e20 3130 0x0090: 2e36 202d 204b 6572 6e65 6c3a 2034 2e31 0x00a0: 392e 302d 392d 322d 616d 6436 34 System Capabilities TLV (7), length 4 System Capabilities [Bridge, WLAN AP, Router, Station Only] (0x009c) Enabled Capabilities [Bridge, Router] (0x0014) root@sonic:~# show lldp neighbors Ethernet16 ------------------------------------------------------------------------------- LLDP neighbors: ------------------------------------------------------------------------------- Interface: Ethernet16, via: LLDP, RID: 10, Time: 0 day, 00:01:00 Chassis: ChassisID: mac 80:a2:35:f2:7a:e4 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 MgmtIP: 10.59.143.187 MgmtIP: fe80::82a2:35ff:fef2:7ae4 Capability: Bridge, on Capability: Router, on Capability: Wlan, off Capability: Station, off Port: PortID: local Eth1/5/4 PortDescr: Ethernet19 TTL: 120 ------------------------------------------------------------------------------- Please see that system description shows the sonic version, along with debian package information. 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