Skip to content

Commit

Permalink
Fixed issue#15359 by adding support of IpaddrToIfIndex MIB
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoray committed Jun 30, 2023
1 parent 1109e49 commit 673e072
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/swsssdk/port_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
SONIC_MGMT_PORT_RE_PATTERN = "^eth(\d+)$"
SONIC_ETHERNET_IB_RE_PATTERN = "^Ethernet-IB(\d+)$"
SONIC_ETHERNET_REC_RE_PATTERN = "^Ethernet-Rec(\d+)$"
SONIC_DOCKER_BRD_PATTERN = "^docker(\d+)$"

class BaseIdx:
ethernet_base_idx = 1
Expand All @@ -25,6 +26,7 @@ class BaseIdx:
mgmt_port_base_idx = 10000
ethernet_ib_base_idx = 11000
ethernet_rec_base_idx = 12000
docker_brd_base_idx = 4000

def get_index(if_name):
"""
Expand All @@ -36,6 +38,7 @@ def get_index(if_name):
eth N = N + 10000
Ethernet_IB N = N + 11000
Ethernet_Rec N = N + 12000
docker_brdg N = N + 4000
"""
return get_index_from_str(if_name.decode())

Expand All @@ -50,6 +53,7 @@ def get_index_from_str(if_name):
eth N = N + 10000
Ethernet_IB N = N + 11000
Ethernet_Rec N = N + 12000
docker_brdg N = N + 4000
"""
patterns = {
SONIC_ETHERNET_RE_PATTERN: BaseIdx.ethernet_base_idx,
Expand All @@ -58,7 +62,8 @@ def get_index_from_str(if_name):
SONIC_PORTCHANNEL_RE_PATTERN: BaseIdx.portchannel_base_idx,
SONIC_MGMT_PORT_RE_PATTERN: BaseIdx.mgmt_port_base_idx,
SONIC_ETHERNET_IB_RE_PATTERN: BaseIdx.ethernet_ib_base_idx,
SONIC_ETHERNET_REC_RE_PATTERN: BaseIdx.ethernet_rec_base_idx
SONIC_ETHERNET_REC_RE_PATTERN: BaseIdx.ethernet_rec_base_idx,
SONIC_DOCKER_BRD_PATTERN: BaseIdx.docker_brd_base_idx
}

for pattern, baseidx in patterns.items():
Expand Down

0 comments on commit 673e072

Please sign in to comment.