Skip to content

Commit

Permalink
Updated based on sonic-py-common
Browse files Browse the repository at this point in the history
  • Loading branch information
judyjoseph committed Aug 9, 2020
1 parent a3614b0 commit f5a10e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
8 changes: 3 additions & 5 deletions sonic_platform_base/sonic_sfp/sfputilbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from natsort import natsorted
from portconfig import get_port_config
from sonic_py_common import device_info
from sonic_py_common.interface import backplane_prefix

from . import bcmshell # Dot module supports both Python 2 and Python 3 using explicit relative import methods
from sonic_eeprom import eeprom_dts
Expand Down Expand Up @@ -459,7 +460,7 @@ def read_porttab_mappings(self, porttabfile, asic_inst=0):
portname = line.split()[0]

# Ignore if this is an internal backplane interface
if portname.startswith(daemon_base.get_internal_interface_prefix()):
if portname.startswith(backplane_prefix()):
continue

bcm_port = str(port_pos_in_file)
Expand Down Expand Up @@ -640,10 +641,7 @@ def is_logical_port(self, port):

def get_asic_id_for_logical_port(self, logical_port):
"""Returns the asic_id list of physical ports for the given logical port"""
if logical_port in self.logical_to_asic.keys():
return self.logical_to_asic[logical_port]
else:
return None
return self.logical_to_asic.get(logical_port)

def is_logical_port_ganged_40_by_4(self, logical_port):
physical_port_list = self.logical_to_physical[logical_port]
Expand Down
9 changes: 4 additions & 5 deletions sonic_platform_base/sonic_sfp/sfputilhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from natsort import natsorted
from portconfig import get_port_config
from sonic_py_common import device_info
from sonic_py_common.interface import backplane_prefix

except ImportError as e:
raise ImportError("%s - required module not found" % str(e))

Expand Down Expand Up @@ -126,7 +128,7 @@ def read_porttab_mappings(self, porttabfile, asic_inst=0):
portname = line.split()[0]

# Ignore if this is an internal backplane interface
if portname.startswith(daemon_base.get_internal_interface_prefix()):
if portname.startswith(backplane_prefix()):
continue

bcm_port = str(port_pos_in_file)
Expand Down Expand Up @@ -211,7 +213,4 @@ def is_logical_port(self, port):

def get_asic_id_for_logical_port(self, logical_port):
"""Returns the asic_id list of physical ports for the given logical port"""
if logical_port in self.logical_to_asic.keys():
return self.logical_to_asic[logical_port]
else:
return None
return self.logical_to_asic.get(logical_port)

0 comments on commit f5a10e4

Please sign in to comment.