[Nokia ixs7215] sfp get_name test case fix (#8507)

Account for sfputil_helper indexing being 0 based

Co-authored-by: Carl Keene <keene@nokia.com>
This commit is contained in:
carl-nokia 2021-08-20 01:31:18 -04:00 committed by GitHub
parent e3a30deea9
commit e3ac64954a
Failed to retrieve any key attached to the committer's account

View File

@ -799,6 +799,9 @@ class Sfp(SfpBase):
Returns:
A boolean, True if tx_disable is set successfully, False if not
"""
if self.sfp_type == COPPER_TYPE:
return False
if smbus_present == 0: # if called from sfputil outside of pmon
cmdstatus, register = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0x5')
if cmdstatus:
@ -888,7 +891,7 @@ class Sfp(SfpBase):
sfputil_helper = SfpUtilHelper()
sfputil_helper.read_porttab_mappings(
self.__get_path_to_port_config_file())
name = sfputil_helper.logical[self.index] or "Unknown"
name = sfputil_helper.logical[self.index-1] or "Unknown"
return name
def get_presence(self):