[sonic-utilities] Update submodule; Build and install as a Python 3 wheel (#5926)

Submodule updates include the following commits:

* src/sonic-utilities 9dc58ea...f9eb739 (18):
  > Remove unnecessary calls to str.encode() now that the package is Python 3; Fix deprecation warning (#1260)
  > [generate_dump] Ignoring file/directory not found Errors (#1201)
  > Fixed porstat rate and util issues (#1140)
  > fix error: interface counters is mismatch after warm-reboot (#1099)
  > Remove unnecessary calls to str.decode() now that the package is Python 3 (#1255)
  > [acl-loader] Make list sorting compliant with Python 3 (#1257)
  > Replace hard-coded fast-reboot with variable. And some typo corrections (#1254)
  > [configlet][portconfig] Remove calls to dict.has_key() which is not available in Python 3 (#1247)
  > Remove unnecessary conversions to list() and calls to dict.keys() (#1243)
  > Clean up LGTM alerts (#1239)
  > Add 'requests' as install dependency in setup.py (#1240)
  > Convert to Python 3 (#1128)
  > Fix mock SonicV2Connector in python3: use decode_responses mode so caller code will be the same as python2 (#1238)
  > [tests] Do not trim from PATH if we did not append to it; Clean up/fix shebangs in scripts (#1233)
  > Updates to bgp config and show commands with BGP_INTERNAL_NEIGHBOR table (#1224)
  > [cli]: NAT show commands newline issue after migrated to Python3 (#1204)
  > [doc]: Update Command-Reference.md (#1231)
  > Added 'import sys' in feature.py file (#1232)

* src/sonic-py-swsssdk 9d9f0c6...1664be9 (2):
  > Fix: no need to decode() after redis client scan, so it will work for both python2 and python3 (#96)
  > FieldValueMap `contains`(`in`)  will also work when migrated to libswsscommon(C++ with SWIG wrapper) (#94)

- Also fix Python 3-related issues:
    - Use integer (floor) division in config_samples.py (sonic-config-engine)
    - Replace print statement with print function in eeprom.py plugin for x86_64-kvm_x86_64-r0 platform
    - Update all platform plugins to be compatible with both Python 2 and Python 3
    - Remove shebangs from plugins files which are not intended to be executable
    - Replace tabs with spaces in Python plugin files and fix alignment, because Python 3 is more strict
    - Remove trailing whitespace from plugins files
This commit is contained in:
Joe LeVeque 2020-11-25 10:28:36 -08:00 committed by GitHub
parent fad481edc1
commit 7f4ab8fbd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
341 changed files with 6627 additions and 6717 deletions

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -15,6 +15,7 @@ except ImportError as e:
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
@ -49,7 +50,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -76,7 +77,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -108,7 +109,7 @@ class SfpUtil(SfpUtilBase):
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -138,7 +139,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -159,11 +160,12 @@ class SfpUtil(SfpUtilBase):
return int(rev, 2)
data = {'present': 0}
def get_transceiver_change_event(self, timeout=0):
port_dict = {}
if timeout == 0:
cd_ms = sys.maxint
cd_ms = sys.maxsize
else:
cd_ms = timeout
@ -192,4 +194,3 @@ class SfpUtil(SfpUtilBase):
else:
return True, {}
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -114,7 +114,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -150,7 +150,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -180,7 +180,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -210,7 +210,7 @@ class SfpUtil(SfpUtilBase):
else:
return False # High Power Mode if "Power set" bit is 0
except IOError as err:
print "Error: unable to open file: %s" % str(err)
print("Error: unable to open file: %s" % str(err))
return False
finally:
if eeprom is not None:
@ -238,7 +238,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as err:
print "Error: unable to open file: %s" % str(err)
print("Error: unable to open file: %s" % str(err))
return False
finally:
if eeprom is not None:
@ -257,7 +257,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(mod_rst_path, 'r+', buffering=0)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -285,7 +285,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -294,8 +294,8 @@ class SfpUtil(SfpUtilBase):
rev = "".join(rev[::-1])
return int(rev, 16)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
@ -305,7 +305,6 @@ class SfpUtil(SfpUtilBase):
timeout = 1000
timeout = (timeout) / float(1000) # Convert to secs
if now < (self.data['last'] + timeout) and self.data['valid']:
return True, {}
@ -333,7 +332,6 @@ class SfpUtil(SfpUtilBase):
return True, {}
return False, {}
def __init__(self):
eeprom_path = self.BASE_OOM_PATH + "eeprom"
@ -343,7 +341,3 @@ class SfpUtil(SfpUtilBase):
)
SfpUtilBase.__init__(self)

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -65,7 +65,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -107,7 +107,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -130,7 +130,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
if content == "1":
@ -159,7 +159,7 @@ class SfpUtil(SfpUtilBase):
else:
return False # High Power Mode if "Power set" bit is 0
except IOError as err:
print "Error: unable to open file: %s" % str(err)
print("Error: unable to open file: %s" % str(err))
return False
finally:
if eeprom is not None:
@ -187,7 +187,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as err:
print "Error: unable to open file: %s" % str(err)
print("Error: unable to open file: %s" % str(err))
return False
finally:
if eeprom is not None:
@ -207,7 +207,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(mod_rst_path, 'r+', buffering=0)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -233,7 +233,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -242,14 +242,14 @@ class SfpUtil(SfpUtilBase):
rev = "".join(rev[::-1])
return int(rev, 16)
data = {'present': 0}
def get_transceiver_change_event(self, timeout=2000):
port_dict = {}
port = 0
if timeout == 0:
cd_ms = sys.maxint
cd_ms = sys.maxsize
else:
cd_ms = timeout

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -114,7 +114,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -160,7 +160,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -190,7 +190,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
if content == "1":
@ -220,7 +220,7 @@ class SfpUtil(SfpUtilBase):
else:
return False # High Power Mode if "Power set" bit is 0
except IOError as err:
print "Error: unable to open file: %s" % str(err)
print("Error: unable to open file: %s" % str(err))
return False
finally:
if eeprom is not None:
@ -248,7 +248,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as err:
print "Error: unable to open file: %s" % str(err)
print("Error: unable to open file: %s" % str(err))
return False
finally:
if eeprom is not None:
@ -268,7 +268,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(mod_rst_path, 'r+', buffering=0)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -296,7 +296,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -305,8 +305,8 @@ class SfpUtil(SfpUtilBase):
rev = "".join(rev[::-1])
return int(rev, 16)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
@ -316,7 +316,6 @@ class SfpUtil(SfpUtilBase):
timeout = 1000
timeout = (timeout) / float(1000) # Convert to secs
if now < (self.data['last'] + timeout) and self.data['valid']:
return True, {}
@ -343,4 +342,3 @@ class SfpUtil(SfpUtilBase):
else:
return True, {}
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -14,6 +14,7 @@ except ImportError as e:
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
@ -67,7 +68,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -81,8 +82,8 @@ class SfpUtil(SfpUtilBase):
SfpUtilBase.__init__(self)
# For port 49~54 are QSFP, here presumed they're all split to 4 lanes.
def get_cage_num(self, port_num):
cage_num = port_num
if (port_num >= self.PORT_START):
@ -106,7 +107,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -125,7 +126,7 @@ class SfpUtil(SfpUtilBase):
try:
val_file = open(lp_mode_path)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
content = val_file.readline().rstrip()
@ -158,7 +159,7 @@ class SfpUtil(SfpUtilBase):
else:
return False # High Power Mode if "Power set" bit is 0
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -186,7 +187,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -203,7 +204,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(port_ps, mode="w", buffering=0)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -223,7 +224,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open("/sys/bus/i2c/devices/3-0062/module_present_all")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -248,6 +249,7 @@ class SfpUtil(SfpUtilBase):
return int(rev, 16)
data = {'valid': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=0):
start_time = time.time()
@ -260,13 +262,13 @@ class SfpUtil(SfpUtilBase):
elif timeout > 0:
timeout = timeout / float(1000) # Convert to secs
else:
print "get_transceiver_change_event:Invalid timeout value", timeout
print("get_transceiver_change_event:Invalid timeout value", timeout)
return False, {}
end_time = start_time + timeout
if start_time > end_time:
print 'get_transceiver_change_event:' \
'time wrap / invalid timeout value', timeout
print('get_transceiver_change_event:'
'time wrap / invalid timeout value', timeout)
return False, {} # Time wrap or possibly incorrect timeout
@ -301,5 +303,5 @@ class SfpUtil(SfpUtilBase):
if timeout > 0:
time.sleep(timeout)
return True, {}
print "get_transceiver_change_event: Should not reach here."
print("get_transceiver_change_event: Should not reach here.")
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -14,6 +14,7 @@ except ImportError as e:
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
@ -127,7 +128,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -141,8 +142,8 @@ class SfpUtil(SfpUtilBase):
SfpUtilBase.__init__(self)
# For port 49~54 are QSFP, here presumed they're all split to 4 lanes.
def get_cage_num(self, port_num):
cage_num = port_num
if (port_num >= self.QSFP_PORT_START):
@ -173,7 +174,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -195,7 +196,7 @@ class SfpUtil(SfpUtilBase):
try:
val_file = open(lp_mode_path)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
content = val_file.readline().rstrip()
@ -228,7 +229,7 @@ class SfpUtil(SfpUtilBase):
else:
return False # High Power Mode if "Power set" bit is 0
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -256,7 +257,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -275,7 +276,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(port_ps, mode='w', buffering=0)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -300,7 +301,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -325,6 +326,7 @@ class SfpUtil(SfpUtilBase):
return int(rev, 16)
data = {'valid': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=0):
start_time = time.time()
@ -337,13 +339,13 @@ class SfpUtil(SfpUtilBase):
elif timeout > 0:
timeout = timeout / float(1000) # Convert to secs
else:
print "get_transceiver_change_event:Invalid timeout value", timeout
print("get_transceiver_change_event:Invalid timeout value", timeout)
return False, {}
end_time = start_time + timeout
if start_time > end_time:
print 'get_transceiver_change_event:' \
'time wrap / invalid timeout value', timeout
print('get_transceiver_change_event:'
'time wrap / invalid timeout value', timeout)
return False, {} # Time wrap or possibly incorrect timeout
@ -378,7 +380,5 @@ class SfpUtil(SfpUtilBase):
if timeout > 0:
time.sleep(timeout)
return True, {}
print "get_transceiver_change_event: Should not reach here."
print("get_transceiver_change_event: Should not reach here.")
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -10,12 +7,13 @@ try:
import sys
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -88,7 +88,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -120,7 +120,6 @@ class SfpUtil(SfpUtilBase):
if port_num < self.port_start or port_num > self.port_end:
return False
cpld_path = self.get_cpld_dev_path(port_num)
present_path = cpld_path + "/module_present_"
present_path += str(self._port_to_i2c_mapping[port_num][0])
@ -133,7 +132,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -155,7 +154,7 @@ class SfpUtil(SfpUtilBase):
content = reg_file.readline().rstrip()
reg_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -185,7 +184,7 @@ class SfpUtil(SfpUtilBase):
else:
return False # High Power Mode if "Power set" bit is 0
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -213,7 +212,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -231,7 +230,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(_path, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
reg_file.seek(0)
@ -258,7 +257,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -267,8 +266,8 @@ class SfpUtil(SfpUtilBase):
rev = "".join(rev[::-1])
return int(rev, 16)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
@ -278,7 +277,6 @@ class SfpUtil(SfpUtilBase):
timeout = 1000
timeout = (timeout) / float(1000) # Convert to secs
if now < (self.data['last'] + timeout) and self.data['valid']:
return True, {}
@ -305,5 +303,3 @@ class SfpUtil(SfpUtilBase):
else:
return True, {}
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -21,8 +21,8 @@ class PsuUtil(PsuBase):
def __init__(self):
PsuBase.__init__(self)
# Get sysfs attribute
def get_attr_value(self, attr_path):
retval = 'ERR'
@ -89,4 +89,3 @@ class PsuUtil(PsuBase):
status = 1
return status

View File

@ -1,14 +1,13 @@
#!/usr/bin/env python
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
class SfpUtil(SfpUtilBase):
"""Platform specific SfpUtill class"""
@ -75,7 +74,7 @@ class SfpUtil(SfpUtilBase):
53: 26,
}
_qsfp_ports = range(_qsfp_port_start, _ports_in_block + 1)
_qsfp_ports = list(range(_qsfp_port_start, _ports_in_block + 1))
_present_status = dict()
@ -91,7 +90,7 @@ class SfpUtil(SfpUtilBase):
def reset(self, port_num):
# Check for invalid port_num
if port_num < self._qsfp_port_start or port_num > self._port_end:
print "Error: port %d is not qsfp port" % port_num
print("Error: port %d is not qsfp port" % port_num)
return False
path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset"
@ -100,7 +99,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -132,7 +131,7 @@ class SfpUtil(SfpUtilBase):
reg_value = reg_file.readline().rstrip()
reg_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if reg_value == '1':
@ -170,4 +169,3 @@ class SfpUtil(SfpUtilBase):
time.sleep(2)
return True, ret_present

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
#
# Module contains an implementation of SONiC Platform Base API and

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Component contains an implementation of SONiC Platform Base API and
# provides the components firmware management function
@ -18,6 +16,7 @@ except ImportError as e:
BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version"
class Component(DeviceBase):
"""Platform-specific Component class"""
@ -31,7 +30,7 @@ class Component(DeviceBase):
# Run bash command and print output to stdout
try:
process = subprocess.Popen(
shlex.split(command), stdout=subprocess.PIPE)
shlex.split(command), universal_newlines=True, stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Platform and model specific eeprom subclass, inherits from the base class,
# and provides the followings:
@ -11,10 +9,14 @@ try:
import glob
import os
import sys
import imp
import re
from array import array
if sys.version_info.major == 3:
from io import StringIO
else:
from cStringIO import StringIO
from sonic_platform_base.sonic_eeprom import eeprom_dts
from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo
except ImportError as e:

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
#
# Module contains an implementation of SONiC Platform Base API and
@ -21,6 +19,7 @@ FANTRAY_NAME_LIST = ["FANTRAY-1", "FANTRAY-2",
"FANTRAY-3", "FANTRAY-4", "FANTRAY-5"]
FAN_NAME_LIST = ["front", "rear"]
class Fan(FanBase):
"""Platform-specific Fan class"""

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Module contains an implementation of SONiC Platform Base API and
# provides the platform information
@ -12,6 +10,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Platform(PlatformBase):
"""Platform-specific Platform class"""

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# psuutil.py
# Platform-specific PSU status interface for SONiC
@ -17,6 +15,7 @@ except ImportError as e:
FAN_MAX_RPM = 9600
PSU_NAME_LIST = ["PSU-0", "PSU-1"]
class Psu(PsuBase):
"""Platform-specific Psu class"""
@ -27,7 +26,6 @@ class Psu(PsuBase):
self.index = psu_index
PsuBase.__init__(self)
def get_fan(self):
"""
Retrieves object representing the fan module contained in this PSU

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Sfp contains an implementation of SONiC Platform Base API and
# provides the sfp device status which are available in the platform
@ -105,6 +103,7 @@ qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance
'Fibre Channel link length/Transmitter Technology',
'Fibre Channel transmission media', 'Fibre Channel Speed')
class Sfp(SfpBase):
"""Platform-specific Sfp class"""
@ -168,7 +167,7 @@ class Sfp(SfpBase):
52: 25,
53: 26,
}
_sfp_port = range(48, PORT_END + 1)
_sfp_port = list(range(48, PORT_END + 1))
RESET_PATH = "/sys/bus/i2c/devices/{}-0050/sfp_port_reset"
PRS_PATH = "/sys/bus/i2c/devices/{}-0050/sfp_is_present"

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,9 +1,7 @@
#!/usr/bin/env python
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
@ -50,7 +48,7 @@ class sfputil(SfpUtilBase):
24: 49,
}
_qsfp_ports = range(0, ports_in_block + 1)
_qsfp_ports = list(range(0, ports_in_block + 1))
def __init__(self):
# Override port_to_eeprom_mapping for class initialization
@ -71,7 +69,7 @@ class sfputil(SfpUtilBase):
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -103,7 +101,7 @@ class sfputil(SfpUtilBase):
reg_value = reg_file.readline().rstrip()
reg_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if reg_value == '1':
@ -121,7 +119,7 @@ class sfputil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(0, self.ports_in_block + 1)
return list(range(0, self.ports_in_block + 1))
@property
def port_to_eeprom_mapping(self):

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -107,7 +107,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -148,7 +148,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -174,11 +174,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -207,7 +208,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -225,7 +226,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
reg_value = '0'

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -107,7 +107,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -148,7 +148,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
# content is a string, either "0" or "1"
@ -175,11 +175,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -208,7 +209,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -226,7 +227,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
reg_value = '0'

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/4-0057/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -16,6 +16,7 @@ except ImportError as e:
SFP_STATUS_REMOVED = '0'
SFP_STATUS_INSERTED = '1'
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
@ -81,7 +82,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -120,7 +121,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -146,11 +147,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -179,7 +181,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -206,7 +208,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node[0])
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
cpld_bm = reg_file.readline().rstrip().zfill(node[1]/4)
bitmap.append(cpld_bm)
@ -216,6 +218,7 @@ class SfpUtil(SfpUtilBase):
return int(rev, 16)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
@ -249,5 +252,3 @@ class SfpUtil(SfpUtilBase):
else:
return True, {}
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -15,6 +15,7 @@ except ImportError as e:
SFP_STATUS_REMOVED = '0'
SFP_STATUS_INSERTED = '1'
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
@ -113,7 +114,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -151,7 +152,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -177,12 +178,13 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -211,7 +213,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -231,7 +233,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(self.__port_to_mod_rst, 'r+', buffering=0)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -243,6 +245,7 @@ class SfpUtil(SfpUtilBase):
reg_file.close()
return True
@property
def _get_present_bitmap(self):
nodes = []
@ -262,7 +265,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(node[0])
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap = reg_file.readline().rstrip()
bitmap = bin(int(bitmap, 16))[2:].zfill(node[1])
@ -274,6 +277,7 @@ class SfpUtil(SfpUtilBase):
return int(bitmaps, 0)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Cavium
#
@ -10,7 +8,6 @@
#############################################################################
try:
import exceptions
import binascii
import time
import optparse
@ -20,9 +17,10 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256

View File

@ -5,7 +5,7 @@ try:
import string
from ctypes import create_string_buffer
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
@ -16,10 +16,9 @@ class SfpUtil(SfpUtilBase):
_port_end = 31
ports_in_block = 32
_port_to_eeprom_mapping = {}
_qsfp_ports = range(0, ports_in_block + 1)
_qsfp_ports = list(range(0, ports_in_block + 1))
def __init__(self):
# Override port_to_eeprom_mapping for class initialization
@ -45,7 +44,7 @@ class SfpUtil(SfpUtilBase):
reg_value = reg_file.readline().rstrip()
reg_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if reg_value == '1':
@ -63,7 +62,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(0, self.ports_in_block + 1)
return list(range(0, self.ports_in_block + 1))
@property
def port_to_eeprom_mapping(self):
@ -95,11 +94,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -128,7 +128,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -1,11 +1,9 @@
#!/usr/bin/env python
try:
import time
import string
from ctypes import create_string_buffer
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
# from xcvrd
@ -56,7 +54,7 @@ class SfpUtil(SfpUtilBase):
24: 49,
}
_qsfp_ports = range(0, ports_in_block + 1)
_qsfp_ports = list(range(0, ports_in_block + 1))
def __init__(self):
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom'
@ -76,7 +74,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(port_ps, 'w', buffering=0)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -102,7 +100,7 @@ class SfpUtil(SfpUtilBase):
reg_value = reg_file.readline().rstrip()
reg_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if reg_value == '1':
@ -120,7 +118,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.port_start, self.ports_in_block + 1)
return list(range(self.port_start, self.ports_in_block + 1))
@property
def port_to_eeprom_mapping(self):
@ -144,11 +142,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -177,7 +176,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -197,7 +196,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -207,6 +206,7 @@ class SfpUtil(SfpUtilBase):
return int(rev, 16)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
@ -239,4 +239,3 @@ class SfpUtil(SfpUtilBase):
else:
return True, {}
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -74,7 +74,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -103,7 +103,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -129,11 +129,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -162,7 +163,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -178,7 +179,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(self.__port_to_mod_rst, 'r+')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
reg_value = '1'
@ -199,7 +200,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -209,6 +210,7 @@ class SfpUtil(SfpUtilBase):
return int(rev, 16)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
@ -241,4 +243,3 @@ class SfpUtil(SfpUtilBase):
else:
return True, {}
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -6,8 +6,8 @@
try:
import time
import os
import sys, getopt
import commands
import sys
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
@ -73,7 +73,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -93,7 +93,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -118,8 +118,6 @@ class SfpUtil(SfpUtilBase):
SfpUtilBase.__init__(self)
def get_low_power_mode(self, port_num):
raise NotImplementedError
@ -131,7 +129,7 @@ class SfpUtil(SfpUtilBase):
return False
mod_rst_cmd = "ipmitool raw 0x34 0x11 " + str(port_num+1) + " 0x11 0x1"
(status, output) = commands.getstatusoutput (mod_rst_cmd)
subprocess.check_output(mod_rst_cmd, universal_newlines=True)
return True
def get_transceiver_change_event(self):

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -77,7 +77,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -106,7 +106,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -132,11 +132,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -165,7 +166,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -182,7 +183,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(self.__port_to_mod_rst, 'r+', buffering=0)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# toggle reset
@ -208,7 +209,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -218,6 +219,7 @@ class SfpUtil(SfpUtilBase):
return int(rev, 16)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
@ -227,7 +229,6 @@ class SfpUtil(SfpUtilBase):
timeout = 1000
timeout = (timeout) / float(1000) # Convert to secs
if now < (self.data['last'] + timeout) and self.data['valid']:
return True, {}
@ -253,4 +254,3 @@ class SfpUtil(SfpUtilBase):
else:
return True, {}
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -1,17 +1,16 @@
#!/usr/bin/env python
try:
import time
import string
from ctypes import create_string_buffer
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
# from xcvrd
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
class SfpUtil(SfpUtilBase):
"""Platform specific SfpUtill class"""
@ -86,7 +85,7 @@ class SfpUtil(SfpUtilBase):
51: 87,
52: 88, }
_qsfp_ports = range(0, ports_in_block + 1)
_qsfp_ports = list(range(0, ports_in_block + 1))
def __init__(self):
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom'
@ -105,7 +104,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# HW will clear reset after set.
@ -128,7 +127,7 @@ class SfpUtil(SfpUtilBase):
reg_value = reg_file.readline().rstrip()
reg_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if reg_value == '1':
@ -146,7 +145,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(0, self.ports_in_block + 1)
return list(range(0, self.ports_in_block + 1))
@property
def port_to_eeprom_mapping(self):
@ -170,11 +169,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -203,7 +203,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -223,7 +223,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(node)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
bitmap += reg_file.readline().rstrip() + " "
reg_file.close()
@ -232,8 +232,8 @@ class SfpUtil(SfpUtilBase):
rev = "".join(rev[::-1])
return int(rev, 16)
data = {'valid': 0, 'last': 0, 'present': 0}
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
@ -267,4 +267,3 @@ class SfpUtil(SfpUtilBase):
else:
return True, {}
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,9 +8,10 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
def eeprom_check():
filepath = "/sys/bus/i2c/devices/0-0057/eeprom"
if os.path.isfile(filepath):
@ -21,8 +19,10 @@ def eeprom_check():
else:
return 0 # now board, 0x56
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
ret = eeprom_check()
if ret == 1:
@ -31,4 +31,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder):
self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -6,7 +6,7 @@
try:
import time
import os
import sys, getopt
import sys
from ctypes import create_string_buffer
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
@ -75,7 +75,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
@ -107,7 +107,7 @@ class SfpUtil(SfpUtilBase):
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False
if content == "1":
@ -133,11 +133,12 @@ class SfpUtil(SfpUtilBase):
if ((lpmode & 0x3) == 0x3):
return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1
else:
return False # High Power Mode if one of the following conditions is matched:
# High Power Mode if one of the following conditions is matched:
# 1. "Power override" bit is 0
# 2. "Power override" bit is 1 and "Power set" bit is 0
return False
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -169,7 +170,7 @@ class SfpUtil(SfpUtilBase):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
@ -189,7 +190,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(self.__port_to_mod_rst, 'r+')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
reg_value = '1'
@ -212,7 +213,7 @@ class SfpUtil(SfpUtilBase):
try:
val_file = open(cpld_i2c_path)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
for k in range(start_i, end_i):
port_dict[k] = 0
@ -246,13 +247,13 @@ class SfpUtil(SfpUtilBase):
elif timeout > 0:
timeout = timeout / float(1000) # Convert to secs
else:
print "get_transceiver_change_event:Invalid timeout value", timeout
print("get_transceiver_change_event:Invalid timeout value", timeout)
return False, {}
end_time = start_time + timeout
if start_time > end_time:
print 'get_transceiver_change_event:' \
'time wrap / invalid timeout value', timeout
print('get_transceiver_change_event:'
'time wrap / invalid timeout value', timeout)
return False, {} # Time wrap or possibly incorrect timeout
@ -264,7 +265,7 @@ class SfpUtil(SfpUtilBase):
port_dict = self.get_cpld_interrupt()
present = 0
for key, value in port_dict.iteritems():
for key, value in port_dict.items():
if value == 1:
present = self.get_presence(key)
change_status = 1
@ -285,5 +286,5 @@ class SfpUtil(SfpUtilBase):
if timeout > 0:
time.sleep(timeout)
return True, {}
print "get_evt_change_event: Should not reach here."
print("get_evt_change_event: Should not reach here.")
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
super(board, self).__init__(self.eeprom_path, 0x200, '', True)

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#
# led_control.py
#
# Platform-specific LED control functionality for SONiC
@ -17,7 +15,7 @@ try:
from socket import *
from select import *
from minipack.pimutil import PimUtil
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + " - required module not found")
@ -25,7 +23,6 @@ class LedControl(LedControlBase):
"""Platform specific LED control class"""
SONIC_PORT_NAME_PREFIX = "Ethernet"
def __init__(self):
pim = PimUtil()
pim.init_pim_fpga()
@ -56,4 +53,3 @@ class LedControl(LedControlBase):
pim.set_port_led(port_idx, led_mode, new_control) # port linkup, led is green
# port linkdown, led is off

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -7,7 +7,7 @@ try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
import os
import sys, getopt
import sys
from minipack.pimutil import PimUtil
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
@ -36,7 +36,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORT_END + 1)
return list(range(self.PORT_START, self.PORT_END + 1))
@property
def port_to_eeprom_mapping(self):
@ -54,7 +54,6 @@ class SfpUtil(SfpUtilBase):
bus = base + index
return bus
def __init__(self):
for x in range(0, self.port_end):
self.port_to_eeprom_mapping[x] = self.LOCAL_OOM_PATH % x
@ -107,13 +106,13 @@ class SfpUtil(SfpUtilBase):
elif timeout > 0:
timeout = timeout / float(1000) # Convert to secs
else:
print "get_transceiver_change_event:Invalid timeout value", timeout
print("get_transceiver_change_event:Invalid timeout value", timeout)
return False, {}
end_time = start_time + timeout
if start_time > end_time:
print 'get_transceiver_change_event:' \
'time wrap / invalid timeout value', timeout
print('get_transceiver_change_event:'
'time wrap / invalid timeout value', timeout)
return False, {} # Time wrap or possibly incorrect timeout
@ -121,7 +120,7 @@ class SfpUtil(SfpUtilBase):
change_status = 0
port_dict = pim.get_qsfp_interrupt()
present = 0
for key, value in port_dict.iteritems():
for key, value in port_dict.items():
if value == 1:
present = self.get_presence(key)
change_status = 1
@ -142,5 +141,5 @@ class SfpUtil(SfpUtilBase):
if timeout > 0:
time.sleep(timeout)
return True, {}
print "get_evt_change_event: Should not reach here."
print("get_evt_change_event: Should not reach here.")
return False, {}

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,18 +1,15 @@
#!/usr/bin/env python
#
# led_control.py
#
# Platform-specific LED control functionality for SONiC
#
# try:
# from sonic_led.led_control_base import LedControlBase
# import swsssdk
# except ImportError, e:
# except ImportError as e:
# raise ImportError (str(e) + " - required module not found")
import time
class LedControlBase(object):
# __metaclass__ = abc.ABCMeta
@ -26,6 +23,7 @@ class LedControlBase(object):
"""
return
### Zion specified ###
read_fan_fault = 0
is_fan_all_OK = 0
@ -35,14 +33,18 @@ is_thermal_high = 0
is_reset_button_push = 0
##########################
def sysled_task():
while True:
system_led_check()
time.sleep(5)
### Zion specified ###
def system_led_check():
global read_fan_fault, read_power_status, is_fan_all_OK, is_power_all_OK, is_thermal_high, is_reset_button_push
is_fan_all_OK = 1
is_power_all_OK = 0
is_thermal_high = 0
@ -96,7 +98,6 @@ def system_led_check():
else:
f11.write("1")
with open("/sys/bus/i2c/devices/1-005e/psu1_power_good", "r") as f1:
read_power_status = f1.read()
with open("/sys/bus/i2c/devices/9-005f/sys_pwr", "w") as f11:
@ -128,7 +129,6 @@ def system_led_check():
else:
f11.write("4")
with open("/sys/bus/i2c/devices/9-005f/swi_ctrl", "r") as f5:
is_reset_button_push = f5.read()
if str(is_reset_button_push) == "1\n":
@ -184,14 +184,15 @@ class LedControl(LedControlBase):
swss = swsssdk.SonicV2Connector()
swss.connect(swss.APPL_DB)
lanes = swss.get(swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes')
lanes = swss.get(
swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes')
# SONiC port nums are 0-based and increment by 4
# Arista QSFP indices are 1-based and increment by 1
return (((sonic_port_num/4) + 1), sonic_port_num % 4, len(lanes.split(',')))
# Concrete implementation of port_link_state_change() method
def port_link_state_change_bk(self, port, state):
qsfp_index, lane_index, lanes = self._port_name_to_qsfp_index(port)
@ -203,9 +204,11 @@ class LedControl(LedControlBase):
# whereas indices 25-32 are not breakout-capable, and only have one
if qsfp_index <= self.QSFP_BREAKOUT_END_IDX:
# assuming 40G, then we need to control four lanes
led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes) ]
led_sysfs_paths = [self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(
qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes)]
else:
led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ]
led_sysfs_paths = [
self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index)]
for led_sysfs_path in led_sysfs_paths:
led_file = open(led_sysfs_path, "w")

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Alphanetworks
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -1,9 +1,7 @@
#!/usr/bin/env python
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
@ -26,7 +24,8 @@ class SfpUtil(SfpUtilBase):
port_reset_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_port_reset"
present_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_is_present"
_qsfp_ports = range(first_port, port_num + 1)
_qsfp_ports = list(range(first_port, port_num + 1))
@property
def port_start(self):
return self.first_port
@ -37,7 +36,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.first_port, self.port_num + 1)
return list(range(self.first_port, self.port_num + 1))
@property
def port_to_eeprom_mapping(self):
@ -72,7 +71,7 @@ class SfpUtil(SfpUtilBase):
try:
reg_file = open(port_path, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# reset
@ -101,11 +100,10 @@ class SfpUtil(SfpUtilBase):
path = self.present_path
port_path = path.format(self.port_to_i2cbus_mapping[i2c_index], (index + 1))
try:
reg_file = open(port_path)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
reg_value = reg_file.readline().rstrip()
@ -113,4 +111,3 @@ class SfpUtil(SfpUtilBase):
return True
return False

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
@ -11,11 +8,13 @@ try:
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom"
# Two i2c buses might get flipped order, check them both.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#
# led_control.py
#
# Platform-specific LED control functionality for SONiC
@ -8,11 +6,12 @@
# try:
# from sonic_led.led_control_base import LedControlBase
# import swsssdk
# except ImportError, e:
# except ImportError as e:
# raise ImportError (str(e) + " - required module not found")
import time
class LedControlBase(object):
# __metaclass__ = abc.ABCMeta
@ -26,6 +25,7 @@ class LedControlBase(object):
"""
return
### Goreme specified ###
read_fan_fault = 0
is_fan_all_OK = 0
@ -35,12 +35,15 @@ is_thermal_high = 0
is_reset_button_push = 0
##########################
def sysled_task():
while True:
system_led_check()
time.sleep(5)
########## Goreme System LED checking
# Goreme System LED checking
def system_led_check():
global read_fan_fault, read_power_status, is_fan_all_OK, is_power_all_OK, is_thermal_high, is_reset_button_push
is_fan_all_OK = 1
@ -70,7 +73,6 @@ def system_led_check():
else:
f11.write("4")
with open("/sys/bus/i2c/devices/0-005e/psu1_power_good", "r") as f1:
read_power_status = f1.read()
if str(read_power_status) != str("1\n"):
@ -94,7 +96,6 @@ def system_led_check():
else:
f11.write("4")
with open("/sys/bus/i2c/devices/8-005f/swi_ctrl", "r") as f5:
is_reset_button_push = f5.read()
if str(is_reset_button_push) == "1\n":
@ -120,6 +121,7 @@ def system_led_check():
return
##########
class LedControl(LedControlBase):
"""Platform specific LED control class"""
PORT_TABLE_PREFIX = "PORT_TABLE:"
@ -149,15 +151,15 @@ class LedControl(LedControlBase):
swss = swsssdk.SonicV2Connector()
swss.connect(swss.APPL_DB)
lanes = swss.get(swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes')
lanes = swss.get(
swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes')
# SONiC port nums are 0-based and increment by 4
# Arista QSFP indices are 1-based and increment by 1
return (((sonic_port_num/4) + 1), sonic_port_num % 4, len(lanes.split(',')))
# Concrete implementation of port_link_state_change() method
def port_link_state_change_bk(self, port, state):
qsfp_index, lane_index, lanes = self._port_name_to_qsfp_index(port)
@ -169,9 +171,11 @@ class LedControl(LedControlBase):
# whereas indices 25-32 are not breakout-capable, and only have one
if qsfp_index <= self.QSFP_BREAKOUT_END_IDX:
# assuming 40G, then we need to control four lanes
led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes) ]
led_sysfs_paths = [self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(
qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes)]
else:
led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ]
led_sysfs_paths = [
self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index)]
for led_sysfs_path in led_sysfs_paths:
led_file = open(led_sysfs_path, "w")

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Alphanetworks
#
@ -15,6 +13,7 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""

View File

@ -1,9 +1,7 @@
#!/usr/bin/env python
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
@ -30,7 +28,7 @@ class SfpUtil(SfpUtilBase):
present_path_1 = "/sys/bus/i2c/devices/{0}-0020/sfp{1}_is_present"
present_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_is_present"
_qsfp_ports = range(first_port, port_num)
_qsfp_ports = list(range(first_port, port_num))
@property
def port_start(self):
@ -42,7 +40,7 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
return range(self.first_port, self.port_num + 1)
return list(range(self.first_port, self.port_num + 1))
@property
def port_to_eeprom_mapping(self):
@ -84,7 +82,7 @@ class SfpUtil(SfpUtilBase):
reg_file = open(port_path, 'w')
except IOError as e:
if cpld_index < 5:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
# reset
@ -116,12 +114,11 @@ class SfpUtil(SfpUtilBase):
path = self.present_path
port_path = path.format(self.port_to_i2cbus_mapping[cpld_index], index)
try:
reg_file = open(port_path)
except IOError as e:
if cpld_index < 5:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
reg_value = reg_file.readline().rstrip()
@ -129,4 +126,3 @@ class SfpUtil(SfpUtilBase):
return True
return False

View File

@ -1,11 +1,13 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import arista.platforms
from arista.utils.sonic_reboot import reboot
def main():
# reboot the system
reboot()
if __name__ == "__main__":
main()

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#
# Arista eeprom processing for SONiC
# Uses the arista driver library to obtain the TlvInfoDecoder

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#
# Arista LED controls for SONiC
#

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#
# Arista PSU interface for SONiC
#

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#
# Arista SFP transceiver interface for SONiC
#

View File

@ -1,6 +1,3 @@
#!/usr/bin/python
try:
import importlib
import time
@ -23,13 +20,24 @@ try:
from thrift.protocol import TMultiplexedProtocol
from argparse import ArgumentParser
if sys.version_info.major == 3:
from io import StringIO
else:
from cStringIO import StringIO
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
if sys.version_info.major == 3:
STRING_TYPE = str
else:
STRING_TYPE = basestring
eeprom_default_dict = {
"prod_name": ("Product Name", "0x21", 12),
"odm_pcba_part_num": ("Part Number", "0x22", 13),
@ -76,6 +84,7 @@ pltfm_mgr = None
EEPROM_SYMLINK = "/var/run/platform/eeprom/syseeprom"
EEPROM_STATUS = "/var/run/platform/eeprom/status"
class board(eeprom_tlvinfo.TlvInfoDecoder):
RETRIES = 35
@ -114,8 +123,10 @@ class board(eeprom_tlvinfo.TlvInfoDecoder):
transport = TTransport.TBufferedTransport(transport)
bprotocol = TBinaryProtocol.TBinaryProtocol(transport)
pltfm_mgr_client_module = importlib.import_module(".".join(["pltfm_mgr_rpc", "pltfm_mgr_rpc"]))
pltfm_mgr_protocol = TMultiplexedProtocol.TMultiplexedProtocol(bprotocol, "pltfm_mgr_rpc")
pltfm_mgr_client_module = importlib.import_module(
".".join(["pltfm_mgr_rpc", "pltfm_mgr_rpc"]))
pltfm_mgr_protocol = TMultiplexedProtocol.TMultiplexedProtocol(
bprotocol, "pltfm_mgr_rpc")
pltfm_mgr = pltfm_mgr_client_module.Client(pltfm_mgr_protocol)
transport.open()
@ -139,7 +150,7 @@ class board(eeprom_tlvinfo.TlvInfoDecoder):
f.close()
eeprom_params = ""
for attr, val in eeprom.__dict__.iteritems():
for attr, val in eeprom.__dict__.items():
if val is None:
continue
@ -147,13 +158,14 @@ class board(eeprom_tlvinfo.TlvInfoDecoder):
if elem is None:
continue
if isinstance(val, basestring):
if isinstance(val, STRING_TYPE):
value = val.replace('\0', '')
else:
value = str(val)
if attr == "sys_mfg_date":
value = datetime.datetime.strptime(value, '%m-%d-%y').strftime('%m/%d/%Y 00:00:00')
value = datetime.datetime.strptime(
value, '%m-%d-%y').strftime('%m/%d/%Y 00:00:00')
product = product_dict.get(value)
if product is not None:
@ -164,9 +176,9 @@ class board(eeprom_tlvinfo.TlvInfoDecoder):
orig_stdout = sys.stdout
sys.stdout = StringIO()
new_e = eeprom_tlvinfo.TlvInfoDecoder.set_eeprom(self, "", [eeprom_params])
new_e = eeprom_tlvinfo.TlvInfoDecoder.set_eeprom(
self, "", [eeprom_params])
sys.stdout = orig_stdout
eeprom_base.EepromDecoder.write_eeprom(self, new_e)
return True

View File

@ -177,7 +177,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_sys_tmp_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_sys_tmp_get failed: unknown result")
def pltfm_mgr_sys_eeprom_get(self):
self.send_pltfm_mgr_sys_eeprom_get()
@ -205,7 +206,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_sys_eeprom_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_sys_eeprom_get failed: unknown result")
def pltfm_mgr_pwr_supply_present_get(self, ps_num):
"""
@ -238,7 +240,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_pwr_supply_present_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_pwr_supply_present_get failed: unknown result")
def pltfm_mgr_pwr_supply_info_get(self, ps_num):
"""
@ -271,7 +274,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_pwr_supply_info_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_pwr_supply_info_get failed: unknown result")
def pltfm_mgr_pwr_rail_info_get(self, ps_num):
"""
@ -304,7 +308,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_pwr_rail_info_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_pwr_rail_info_get failed: unknown result")
def pltfm_mgr_fan_speed_set(self, fan_num, percent):
"""
@ -339,7 +344,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_fan_speed_set failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_fan_speed_set failed: unknown result")
def pltfm_mgr_fan_info_get(self, fan_num):
"""
@ -372,7 +378,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_fan_info_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_fan_info_get failed: unknown result")
def pltfm_mgr_qsfp_presence_get(self, port_num):
"""
@ -405,7 +412,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_presence_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_qsfp_presence_get failed: unknown result")
def pltfm_mgr_qsfp_info_get(self, port_num):
"""
@ -438,7 +446,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_info_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_qsfp_info_get failed: unknown result")
def pltfm_mgr_qsfp_get_max_port(self):
self.send_pltfm_mgr_qsfp_get_max_port()
@ -466,7 +475,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_get_max_port failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_qsfp_get_max_port failed: unknown result")
def pltfm_mgr_qsfp_reset(self, port_num, reset):
"""
@ -534,7 +544,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_lpmode_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_qsfp_lpmode_get failed: unknown result")
def pltfm_mgr_qsfp_lpmode_set(self, port_num, lpmode):
"""
@ -569,7 +580,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_lpmode_set failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_qsfp_lpmode_set failed: unknown result")
def pltfm_mgr_sensor_info_get(self, options):
"""
@ -602,7 +614,8 @@ class Client(Iface):
return result.success
if result.ouch is not None:
raise result.ouch
raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_sensor_info_get failed: unknown result")
raise TApplicationException(TApplicationException.MISSING_RESULT,
"pltfm_mgr_sensor_info_get failed: unknown result")
class Processor(Iface, TProcessor):
@ -1020,7 +1033,7 @@ class pltfm_mgr_dummy_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1079,7 +1092,7 @@ class pltfm_mgr_dummy_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1121,7 +1134,7 @@ class pltfm_mgr_sys_tmp_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1194,7 +1207,7 @@ class pltfm_mgr_sys_tmp_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1236,7 +1249,7 @@ class pltfm_mgr_sys_eeprom_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1309,7 +1322,7 @@ class pltfm_mgr_sys_eeprom_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1369,7 +1382,7 @@ class pltfm_mgr_pwr_supply_present_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1441,7 +1454,7 @@ class pltfm_mgr_pwr_supply_present_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1501,7 +1514,7 @@ class pltfm_mgr_pwr_supply_info_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1574,7 +1587,7 @@ class pltfm_mgr_pwr_supply_info_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1634,7 +1647,7 @@ class pltfm_mgr_pwr_rail_info_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1707,7 +1720,7 @@ class pltfm_mgr_pwr_rail_info_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1779,7 +1792,7 @@ class pltfm_mgr_fan_speed_set_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1851,7 +1864,7 @@ class pltfm_mgr_fan_speed_set_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1911,7 +1924,7 @@ class pltfm_mgr_fan_info_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1984,7 +1997,7 @@ class pltfm_mgr_fan_info_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2044,7 +2057,7 @@ class pltfm_mgr_qsfp_presence_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2116,7 +2129,7 @@ class pltfm_mgr_qsfp_presence_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2176,7 +2189,7 @@ class pltfm_mgr_qsfp_info_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2213,7 +2226,8 @@ class pltfm_mgr_qsfp_info_get_result(object):
break
if fid == 0:
if ftype == TType.STRING:
self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.success = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 1:
@ -2248,7 +2262,7 @@ class pltfm_mgr_qsfp_info_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2290,7 +2304,7 @@ class pltfm_mgr_qsfp_get_max_port_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2362,7 +2376,7 @@ class pltfm_mgr_qsfp_get_max_port_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2434,7 +2448,7 @@ class pltfm_mgr_qsfp_reset_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2506,7 +2520,7 @@ class pltfm_mgr_qsfp_reset_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2566,7 +2580,7 @@ class pltfm_mgr_qsfp_lpmode_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2638,7 +2652,7 @@ class pltfm_mgr_qsfp_lpmode_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2710,7 +2724,7 @@ class pltfm_mgr_qsfp_lpmode_set_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2782,7 +2796,7 @@ class pltfm_mgr_qsfp_lpmode_set_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2817,7 +2831,8 @@ class pltfm_mgr_sensor_info_get_args(object):
break
if fid == 1:
if ftype == TType.STRING:
self.options = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.options = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
@ -2842,7 +2857,7 @@ class pltfm_mgr_sensor_info_get_args(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -2879,7 +2894,8 @@ class pltfm_mgr_sensor_info_get_result(object):
break
if fid == 0:
if ftype == TType.STRING:
self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.success = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 1:
@ -2914,7 +2930,7 @@ class pltfm_mgr_sensor_info_get_result(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):

View File

@ -171,7 +171,7 @@ class pltfm_mgr_sys_tmp_t(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -274,37 +274,44 @@ class pltfm_mgr_eeprom_t(object):
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.prod_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.prod_name = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.prod_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.prod_part_num = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.sys_asm_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.sys_asm_part_num = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.bfn_pcba_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.bfn_pcba_part_num = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.STRING:
self.bfn_pcbb_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.bfn_pcbb_part_num = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.STRING:
self.odm_pcba_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.odm_pcba_part_num = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.STRING:
self.odm_pcba_ser_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.odm_pcba_ser_num = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 9:
@ -324,42 +331,50 @@ class pltfm_mgr_eeprom_t(object):
iprot.skip(ftype)
elif fid == 12:
if ftype == TType.STRING:
self.prod_ser_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.prod_ser_num = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 13:
if ftype == TType.STRING:
self.prod_ast_tag = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.prod_ast_tag = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 14:
if ftype == TType.STRING:
self.sys_mfger = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.sys_mfger = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 15:
if ftype == TType.STRING:
self.sys_mfg_date = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.sys_mfg_date = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 16:
if ftype == TType.STRING:
self.pcb_mfger = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.pcb_mfger = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 17:
if ftype == TType.STRING:
self.assembled_at = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.assembled_at = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 18:
if ftype == TType.STRING:
self.loc_mac_addr = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.loc_mac_addr = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 19:
if ftype == TType.STRING:
self.ext_mac_addr = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.ext_mac_addr = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 20:
@ -369,7 +384,8 @@ class pltfm_mgr_eeprom_t(object):
iprot.skip(ftype)
elif fid == 21:
if ftype == TType.STRING:
self.location = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.location = iprot.readString().decode(
'utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 22:
@ -401,23 +417,28 @@ class pltfm_mgr_eeprom_t(object):
oprot.writeFieldEnd()
if self.sys_asm_part_num is not None:
oprot.writeFieldBegin('sys_asm_part_num', TType.STRING, 4)
oprot.writeString(self.sys_asm_part_num.encode('utf-8') if sys.version_info[0] == 2 else self.sys_asm_part_num)
oprot.writeString(self.sys_asm_part_num.encode('utf-8')
if sys.version_info[0] == 2 else self.sys_asm_part_num)
oprot.writeFieldEnd()
if self.bfn_pcba_part_num is not None:
oprot.writeFieldBegin('bfn_pcba_part_num', TType.STRING, 5)
oprot.writeString(self.bfn_pcba_part_num.encode('utf-8') if sys.version_info[0] == 2 else self.bfn_pcba_part_num)
oprot.writeString(self.bfn_pcba_part_num.encode('utf-8')
if sys.version_info[0] == 2 else self.bfn_pcba_part_num)
oprot.writeFieldEnd()
if self.bfn_pcbb_part_num is not None:
oprot.writeFieldBegin('bfn_pcbb_part_num', TType.STRING, 6)
oprot.writeString(self.bfn_pcbb_part_num.encode('utf-8') if sys.version_info[0] == 2 else self.bfn_pcbb_part_num)
oprot.writeString(self.bfn_pcbb_part_num.encode('utf-8')
if sys.version_info[0] == 2 else self.bfn_pcbb_part_num)
oprot.writeFieldEnd()
if self.odm_pcba_part_num is not None:
oprot.writeFieldBegin('odm_pcba_part_num', TType.STRING, 7)
oprot.writeString(self.odm_pcba_part_num.encode('utf-8') if sys.version_info[0] == 2 else self.odm_pcba_part_num)
oprot.writeString(self.odm_pcba_part_num.encode('utf-8')
if sys.version_info[0] == 2 else self.odm_pcba_part_num)
oprot.writeFieldEnd()
if self.odm_pcba_ser_num is not None:
oprot.writeFieldBegin('odm_pcba_ser_num', TType.STRING, 8)
oprot.writeString(self.odm_pcba_ser_num.encode('utf-8') if sys.version_info[0] == 2 else self.odm_pcba_ser_num)
oprot.writeString(self.odm_pcba_ser_num.encode('utf-8')
if sys.version_info[0] == 2 else self.odm_pcba_ser_num)
oprot.writeFieldEnd()
if self.prod_state is not None:
oprot.writeFieldBegin('prod_state', TType.I16, 9)
@ -483,7 +504,7 @@ class pltfm_mgr_eeprom_t(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -651,7 +672,7 @@ class pltfm_mgr_pwr_supply_info_t(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -891,7 +912,7 @@ class pltfm_mgr_pwr_rail_info_t(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -987,7 +1008,7 @@ class pltfm_mgr_fan_info_t(object):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
@ -1050,7 +1071,7 @@ class InvalidPltfmMgrOperation(TException):
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
for key, value in list(self.__dict__.items())]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
try:
import os
import sys
@ -22,6 +20,7 @@ thrift_server = 'localhost'
transport = None
pltfm_mgr = None
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
@ -35,8 +34,10 @@ class PsuUtil(PsuBase):
transport = TTransport.TBufferedTransport(transport)
bprotocol = TBinaryProtocol.TBinaryProtocol(transport)
pltfm_mgr_client_module = importlib.import_module(".".join(["pltfm_mgr_rpc", "pltfm_mgr_rpc"]))
pltfm_mgr_protocol = TMultiplexedProtocol.TMultiplexedProtocol(bprotocol, "pltfm_mgr_rpc")
pltfm_mgr_client_module = importlib.import_module(
".".join(["pltfm_mgr_rpc", "pltfm_mgr_rpc"]))
pltfm_mgr_protocol = TMultiplexedProtocol.TMultiplexedProtocol(
bprotocol, "pltfm_mgr_rpc")
pltfm_mgr = pltfm_mgr_client_module.Client(pltfm_mgr_protocol)
transport.open()
@ -93,4 +94,3 @@ class PsuUtil(PsuBase):
return False
return status

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
try:
import os
import sys
@ -25,6 +23,7 @@ pltfm_mgr = None
SFP_EEPROM_CACHE = "/var/run/platform/sfp/cache"
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
@ -51,11 +50,11 @@ class SfpUtil(SfpUtilBase):
@property
def qsfp_ports(self):
self.update_port_info()
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1))
@property
def port_to_eeprom_mapping(self):
print "dependency on sysfs has been removed"
print("dependency on sysfs has been removed")
raise Exception()
def __init__(self):
@ -80,7 +79,7 @@ class SfpUtil(SfpUtilBase):
if self.QSFP_PORT_END == 0:
self.thrift_setup()
self.QSFP_PORT_END = pltfm_mgr.pltfm_mgr_qsfp_get_max_port();
self.QSFP_PORT_END = pltfm_mgr.pltfm_mgr_qsfp_get_max_port()
self.PORT_END = self.QSFP_PORT_END
self.PORTS_IN_BLOCK = self.QSFP_PORT_END
self.thrift_teardown()
@ -127,8 +126,8 @@ class SfpUtil(SfpUtilBase):
presence = pltfm_mgr.pltfm_mgr_qsfp_presence_get(port_num)
self.thrift_teardown()
except Exception as e:
print e.__doc__
print e.message
print(e.__doc__)
print(e.message)
return presence
@ -200,7 +199,7 @@ class SfpUtil(SfpUtilBase):
elif timeout > 0:
timeout = timeout / float(1000) # Convert to secs
else:
print "get_transceiver_change_event:Invalid timeout value", timeout
print("get_transceiver_change_event:Invalid timeout value", timeout)
return False, {}
while forever or timeout > 0:
@ -249,4 +248,3 @@ class SfpUtil(SfpUtilBase):
self.thrift_teardown()
return eeprom_path

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Broadcom XLR/GTS 'eeprom' support
#
@ -16,7 +14,7 @@ import os
try:
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
import os.path
try:

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
try:
import time
import os

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Celestica Haliburton
#
@ -11,7 +9,7 @@
try:
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
@ -20,4 +18,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
import os.path
try:

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
try:
import time
import os
@ -69,7 +67,7 @@ class SfpUtil(SfpUtilBase):
52: 16
}
_port_to_eeprom_mapping = {}
_sfp_port = range(49, PORT_END + 1)
_sfp_port = list(range(49, PORT_END + 1))
@property
def port_start(self):
@ -95,7 +93,6 @@ class SfpUtil(SfpUtilBase):
self.port_to_eeprom_mapping[x] = port_eeprom_path
SfpUtilBase.__init__(self)
def get_presence(self, port_num):
sfp_modabs_path = '/sys/devices/platform/e1031.smc/SFP/sfp_modabs'

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#
@ -43,7 +41,7 @@ class Component(ComponentBase):
# Run bash command and print output to stdout
try:
process = subprocess.Popen(
shlex.split(command), stdout=subprocess.PIPE)
shlex.split(command), universal_newlines=True, stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
@ -68,7 +66,7 @@ class Component(ComponentBase):
# Retrieves the cpld register value
cmd = "echo {1} > {0}; cat {0}".format(GETREG_PATH, register)
p = subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err = p.communicate()
if err is not '':
return None

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Celestica Haliburton
#
@ -13,13 +11,17 @@ try:
import glob
import os
import sys
import imp
import re
from array import array
if sys.version_info.major == 3:
from io import StringIO
else:
from cStringIO import StringIO
from sonic_platform_base.sonic_eeprom import eeprom_dts
from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
CACHE_ROOT = '/var/cache/sonic/decode-syseeprom'

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#
@ -84,7 +82,7 @@ class Psu(PsuBase):
if vout_label_path:
dir_name = os.path.dirname(vout_label_path)
basename = os.path.basename(vout_label_path)
in_num = filter(str.isdigit, basename)
in_num = list(filter(str.isdigit, basename))
vout_path = os.path.join(
dir_name, voltage_name.format(in_num))
vout_val = self.__read_txt_file(vout_path)
@ -107,7 +105,7 @@ class Psu(PsuBase):
if curr_label_path:
dir_name = os.path.dirname(curr_label_path)
basename = os.path.basename(curr_label_path)
cur_num = filter(str.isdigit, basename)
cur_num = list(filter(str.isdigit, basename))
cur_path = os.path.join(
dir_name, current_name.format(cur_num))
cur_val = self.__read_txt_file(cur_path)
@ -130,7 +128,7 @@ class Psu(PsuBase):
if pw_label_path:
dir_name = os.path.dirname(pw_label_path)
basename = os.path.basename(pw_label_path)
pw_num = filter(str.isdigit, basename)
pw_num = list(filter(str.isdigit, basename))
pw_path = os.path.join(
dir_name, current_name.format(pw_num))
pw_val = self.__read_txt_file(pw_path)

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#
@ -81,7 +79,7 @@ class Sfp(SfpBase):
51: 17,
52: 16
}
_sfp_port = range(49, PORT_END + 1)
_sfp_port = list(range(49, PORT_END + 1))
PRS_PATH = "/sys/devices/platform/e1031.smc/SFP/sfp_modabs"
PLATFORM_ROOT_PATH = '/usr/share/sonic/device'
PMON_HWSKU_PATH = '/usr/share/sonic/hwsku'

Some files were not shown because too many files have changed in this diff Show More