From b87dba8106937c2dfd08198956ce3734798f8c26 Mon Sep 17 00:00:00 2001 From: vedganes Date: Tue, 15 Dec 2020 15:15:08 -0500 Subject: [PATCH 1/4] [voqinband]Support for inband port as regular port Signed-off-by: vedganes Inband port is avaialable in PORT table. But regular port handlings are not applicable for Inband port. Changes are to make lldp to consider Inband port and to avoid regular port handling on Inband port. --- dockers/docker-lldp/supervisord.conf.j2 | 4 ++-- platform/vs/docker-sonic-vs/start.sh | 10 ++++++++++ src/sonic-py-common/sonic_py_common/interface.py | 9 ++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dockers/docker-lldp/supervisord.conf.j2 b/dockers/docker-lldp/supervisord.conf.j2 index 3a84caee304..c20f73d8058 100644 --- a/dockers/docker-lldp/supervisord.conf.j2 +++ b/dockers/docker-lldp/supervisord.conf.j2 @@ -45,9 +45,9 @@ dependent_startup_wait_for=rsyslogd:running # - `-ddd` means to stay in foreground, log warnings and info to console # - `-dddd` means to stay in foreground, log all to console {% if DEVICE_METADATA['localhost']['sub_role'] is defined and DEVICE_METADATA['localhost']['sub_role']|length %} -command=/usr/sbin/lldpd -d -I Ethernet* -C Ethernet* +command=/usr/sbin/lldpd -d -I Ethernet*,Inband* -C Ethernet* {% else %} -command=/usr/sbin/lldpd -d -I Ethernet*,eth0 -C eth0 +command=/usr/sbin/lldpd -d -I Ethernet*,Inband*,eth0 -C eth0 {% endif %} priority=3 autostart=false diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 7ee70efa081..b4adbc2fd34 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -90,6 +90,16 @@ fi if [ "$conn_chassis_db" == "1" ]; then if [ -f /usr/share/sonic/virtual_chassis/coreportindexmap.ini ]; then cp /usr/share/sonic/virtual_chassis/coreportindexmap.ini /usr/share/sonic/hwsku/ + + pushd /usr/share/sonic/hwsku + + # filter available front panel ports in coreportindexmap.ini + [ -f coreportindexmap.ini.orig ] || cp coreportindexmap.ini coreportindexmap.ini.orig + for p in $(ip link show | grep -oE "eth[0-9]+" | grep -v eth0); do + grep ^$p: coreportindexmap.ini.orig + done > coreportindexmap.ini + + popd fi fi diff --git a/src/sonic-py-common/sonic_py_common/interface.py b/src/sonic-py-common/sonic_py_common/interface.py index 10452c61312..3935d00c7d4 100644 --- a/src/sonic-py-common/sonic_py_common/interface.py +++ b/src/sonic-py-common/sonic_py_common/interface.py @@ -13,7 +13,8 @@ "PortChannel": "PortChannel", "Vlan": "Vlan", "Loopback": "Loopback", - "Ethernet-Backplane": "Ethernet-BP" + "Ethernet-Backplane": "Ethernet-BP", + "Inband": "Inband" } VLAN_SUB_INTERFACE_SEPARATOR = '.' @@ -48,6 +49,12 @@ def loopback_prefix(): """ return SONIC_INTERFACE_PREFIXES["Loopback"] +def inband_prefix(): + """ + Retrieves the SONIC Broadcom recycle port inband interface name prefix. + """ + return SONIC_INTERFACE_PREFIXES["Inband"] + def get_interface_table_name(interface_name): """Get table name by interface_name prefix """ From 68eeceebc84ff503c34141d70ead06ef2d59b569 Mon Sep 17 00:00:00 2001 From: vedganes Date: Mon, 21 Dec 2020 13:27:17 -0500 Subject: [PATCH 2/4] [inbandif]Inband if support - code review comments fix -1 Signed-off-by: vedganes Fixed code review comments --- src/sonic-py-common/sonic_py_common/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-common/sonic_py_common/interface.py b/src/sonic-py-common/sonic_py_common/interface.py index 3935d00c7d4..b263811b28e 100644 --- a/src/sonic-py-common/sonic_py_common/interface.py +++ b/src/sonic-py-common/sonic_py_common/interface.py @@ -51,7 +51,7 @@ def loopback_prefix(): def inband_prefix(): """ - Retrieves the SONIC Broadcom recycle port inband interface name prefix. + Retrieves the SONIC recycle port inband interface name prefix. """ return SONIC_INTERFACE_PREFIXES["Inband"] From d9e446ff30566cf3019116c3ed2e57c17970e31f Mon Sep 17 00:00:00 2001 From: vedganes Date: Tue, 19 Jan 2021 22:19:06 -0500 Subject: [PATCH 3/4] [inbandif] Avoid lldp on inband interface Signed-off-by: vedganes Changes to avoid LLDP config on Inband interface. Since port type inband interfaces are recycle ports (or may normal ports) used for asic-to-asic communication, LLDP is not configured on these interfaces. --- dockers/docker-lldp/lldpmgrd | 5 +++++ dockers/docker-lldp/supervisord.conf.j2 | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dockers/docker-lldp/lldpmgrd b/dockers/docker-lldp/lldpmgrd index 61d6034faa1..4b28e15cfc3 100755 --- a/dockers/docker-lldp/lldpmgrd +++ b/dockers/docker-lldp/lldpmgrd @@ -94,6 +94,11 @@ class LldpManager(daemon_base.DaemonBase): """ port_desc = None + # Skip port name prefixed with "Inband". These are recycle ports exposed in PORT_TABLE for + # asic-to-asic communication in VOQ based chassis system. We do not configure LLDP on these. + if 'Inband' in port_name: + return + # Retrieve all entires for this port from the Port table port_table = swsscommon.Table(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) (status, fvp) = port_table.get(port_name) diff --git a/dockers/docker-lldp/supervisord.conf.j2 b/dockers/docker-lldp/supervisord.conf.j2 index c20f73d8058..3a84caee304 100644 --- a/dockers/docker-lldp/supervisord.conf.j2 +++ b/dockers/docker-lldp/supervisord.conf.j2 @@ -45,9 +45,9 @@ dependent_startup_wait_for=rsyslogd:running # - `-ddd` means to stay in foreground, log warnings and info to console # - `-dddd` means to stay in foreground, log all to console {% if DEVICE_METADATA['localhost']['sub_role'] is defined and DEVICE_METADATA['localhost']['sub_role']|length %} -command=/usr/sbin/lldpd -d -I Ethernet*,Inband* -C Ethernet* +command=/usr/sbin/lldpd -d -I Ethernet* -C Ethernet* {% else %} -command=/usr/sbin/lldpd -d -I Ethernet*,Inband*,eth0 -C eth0 +command=/usr/sbin/lldpd -d -I Ethernet*,eth0 -C eth0 {% endif %} priority=3 autostart=false From b513a1e9b2bb08b0b05e5ec08b60c484103860aa Mon Sep 17 00:00:00 2001 From: vedganes Date: Fri, 5 Feb 2021 20:22:42 -0500 Subject: [PATCH 4/4] [voq/inband]Code review comments fix - 2 Signed-off-by: vedganes (1) Based on review comments Recyle port HLD (Azure/SONiC#742) the inband port name prefix is changed from Inband to "Ethernet-IB" similar to what we have for Ethernet-BP (Ethernet-Backplane) in multi-asic design. Changes are done in interface.py to handle this changed name (2) Code review comments fix for lldpmgrd --- dockers/docker-lldp/lldpmgrd | 5 +++-- src/sonic-py-common/sonic_py_common/interface.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dockers/docker-lldp/lldpmgrd b/dockers/docker-lldp/lldpmgrd index 4b28e15cfc3..2cf73408f41 100755 --- a/dockers/docker-lldp/lldpmgrd +++ b/dockers/docker-lldp/lldpmgrd @@ -22,6 +22,7 @@ try: from sonic_py_common import daemon_base from swsscommon import swsscommon + from sonic_py_common.interface import inband_prefix except ImportError as err: raise ImportError("%s - required module not found" % str(err)) @@ -94,9 +95,9 @@ class LldpManager(daemon_base.DaemonBase): """ port_desc = None - # Skip port name prefixed with "Inband". These are recycle ports exposed in PORT_TABLE for + # Skip inband interface prefixes. These are recycle ports exposed in PORT_TABLE for # asic-to-asic communication in VOQ based chassis system. We do not configure LLDP on these. - if 'Inband' in port_name: + if port_name.startswith(inband_prefix()): return # Retrieve all entires for this port from the Port table diff --git a/src/sonic-py-common/sonic_py_common/interface.py b/src/sonic-py-common/sonic_py_common/interface.py index b263811b28e..b56326e82aa 100644 --- a/src/sonic-py-common/sonic_py_common/interface.py +++ b/src/sonic-py-common/sonic_py_common/interface.py @@ -14,7 +14,7 @@ "Vlan": "Vlan", "Loopback": "Loopback", "Ethernet-Backplane": "Ethernet-BP", - "Inband": "Inband" + "Ethernet-Inband": "Ethernet-IB" } VLAN_SUB_INTERFACE_SEPARATOR = '.' @@ -53,7 +53,7 @@ def inband_prefix(): """ Retrieves the SONIC recycle port inband interface name prefix. """ - return SONIC_INTERFACE_PREFIXES["Inband"] + return SONIC_INTERFACE_PREFIXES["Ethernet-Inband"] def get_interface_table_name(interface_name): """Get table name by interface_name prefix