From 99809780303784dc0b9faea4f2d0f2a43c449123 Mon Sep 17 00:00:00 2001 From: suresh-rupanagudi Date: Wed, 23 Jun 2021 00:01:14 -0700 Subject: [PATCH] Added loopback interface and changed index for mgmt and portchannel --- src/swsssdk/port_util.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/swsssdk/port_util.py b/src/swsssdk/port_util.py index a37e74ff..54737a58 100644 --- a/src/swsssdk/port_util.py +++ b/src/swsssdk/port_util.py @@ -15,13 +15,15 @@ SONIC_PORTCHANNEL_RE_PATTERN = "^PortChannel(\d+)$" SONIC_MGMT_PORT_RE_PATTERN = "^eth(\d+)$" +SONIC_LOOPBACK_RE_PATTERN = "^Loopback(\d+)$" class BaseIdx: ethernet_base_idx = 1 vlan_interface_base_idx = 2000 ethernet_bp_base_idx = 9000 - portchannel_base_idx = 1000 - mgmt_port_base_idx = 10000 + portchannel_base_idx = 10000 + mgmt_port_base_idx = 1000 + loopback_base_idx = 20000 def get_index(if_name): """ @@ -29,8 +31,9 @@ def get_index(if_name): Ethernet N = N + 1 Vlan N = N + 2000 Ethernet_BP N = N + 9000 - PortChannel N = N + 1000 - eth N = N + 10000 + PortChannel N = N + 10000 + eth N = N + 1000 + loopback N = N + 20000 """ return get_index_from_str(if_name.decode()) @@ -43,13 +46,15 @@ def get_index_from_str(if_name): Ethernet_BP N = N + 9000 PortChannel N = N + 1000 eth N = N + 10000 + loopback N = N + 20000 """ patterns = { SONIC_ETHERNET_RE_PATTERN: BaseIdx.ethernet_base_idx, SONIC_ETHERNET_BP_RE_PATTERN: BaseIdx.ethernet_bp_base_idx, SONIC_VLAN_RE_PATTERN: BaseIdx.vlan_interface_base_idx, SONIC_PORTCHANNEL_RE_PATTERN: BaseIdx.portchannel_base_idx, - SONIC_MGMT_PORT_RE_PATTERN: BaseIdx.mgmt_port_base_idx + SONIC_MGMT_PORT_RE_PATTERN: BaseIdx.mgmt_port_base_idx, + SONIC_LOOPBACK_RE_PATTERN: BaseIdx.loopback_base_idx } for pattern, baseidx in patterns.items():