From f4edba16bb049c938ef3dfee1a4e46b19dcaeb54 Mon Sep 17 00:00:00 2001 From: Mahesh Maddikayala <10645050+smaheshm@users.noreply.github.com> Date: Wed, 20 Jan 2021 15:31:50 -0800 Subject: [PATCH] [ecnconfig] handle backend port names when extracting port I/F ID from the port name (#1361) --- scripts/ecnconfig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/ecnconfig b/scripts/ecnconfig index 96061dc5d1d2..f2e05376ecc4 100755 --- a/scripts/ecnconfig +++ b/scripts/ecnconfig @@ -198,7 +198,11 @@ class EcnQ(object): port_table = self.config_db.get_table(DEVICE_NEIGHBOR_TABLE_NAME) self.ports_key = port_table.keys() - self.ports_key = sorted(self.ports_key, key = lambda k: int(k[8:])) + # In multi-ASIC platforms backend ethernet ports are identified as + # 'Ethernet-BPxy'. Add 1024 to sort backend ports to the end. + self.ports_key.sort( + key = lambda k: int(k[8:]) if "BP" not in k else int(k[11:]) + 1024 + ) def set(self, enable): if os.geteuid() != 0: