Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added loopback interface and changed index for mgmt and portchannel #108

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/swsssdk/port_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
SONIC_VLAN_RE_PATTERN = "^Vlan(\d+)$"
SONIC_PORTCHANNEL_RE_PATTERN = "^PortChannel(\d+)$"
SONIC_MGMT_PORT_RE_PATTERN = "^eth(\d+)$"
SONIC_LOOPBACK_RE_PATTERN = "^Loopback(\d+)$"
SONIC_ETHERNET_IB_RE_PATTERN = "^Ethernet-IB(\d+)$"
SONIC_ETHERNET_REC_RE_PATTERN = "^Ethernet-Rec(\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
ethernet_ib_base_idx = 11000
ethernet_rec_base_idx = 12000

Expand All @@ -32,8 +34,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
Ethernet_IB N = N + 11000
Ethernet_Rec N = N + 12000
"""
Expand All @@ -48,6 +51,7 @@ def get_index_from_str(if_name):
Ethernet_BP N = N + 9000
PortChannel N = N + 1000
eth N = N + 10000
loopback N = N + 20000
Ethernet_IB N = N + 11000
Ethernet_Rec N = N + 12000
"""
Expand All @@ -57,6 +61,7 @@ def get_index_from_str(if_name):
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_LOOPBACK_RE_PATTERN: BaseIdx.loopback_base_idx,
SONIC_ETHERNET_IB_RE_PATTERN: BaseIdx.ethernet_ib_base_idx,
SONIC_ETHERNET_REC_RE_PATTERN: BaseIdx.ethernet_rec_base_idx
}
Expand Down