From fce7f8a24f0299379d6cf372e62596e705ba1988 Mon Sep 17 00:00:00 2001 From: carl-nokia <63672637+carl-nokia@users.noreply.github.com> Date: Thu, 11 Feb 2021 16:17:00 -0500 Subject: [PATCH] [Platform][ixs7215]: Platform API test required files with Updates and Improvements (#6738) - Why I did it Enable platform API tests to run successfully by providing required test infrastructure files along with supporting changes. - How I did it Added platform.json along with supporting changes. - Addition of pcie.yaml supporting pcied - Addition of Real fan drawer support vs Virtual - Removal of python2 wheel with support in place for python3 - supporting changes platform api tests --- .../armhf-nokia_ixs7215_52x-r0/platform.json | 226 ++++++++++++++++++ .../plugins/pcie.yaml | 20 ++ .../7215/scripts/nokia-7215init.sh | 4 + .../7215/sonic_platform/chassis.py | 45 ++-- .../7215/sonic_platform/fan.py | 51 +++- .../7215/sonic_platform/fan_drawer.py | 68 +++++- .../7215/sonic_platform/psu.py | 61 +++-- .../7215/sonic_platform/sfp.py | 127 ++++++---- .../7215/sonic_platform/test/test-chassis.py | 2 - .../7215/sonic_platform/test/test-psu.py | 4 +- .../7215/sonic_platform/test/test-sfp.py | 10 +- .../7215/sonic_platform/test/test-thermal.py | 3 +- .../7215/sonic_platform/thermal.py | 19 +- .../7215/sonic_platform/watchdog.py | 2 +- .../sonic-platform-nokia/debian/rules | 4 +- .../debian/sonic-platform-nokia-7215.install | 1 - 16 files changed, 523 insertions(+), 124 deletions(-) create mode 100644 device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json create mode 100644 device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/pcie.yaml diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json new file mode 100644 index 0000000000..d6a28d19b0 --- /dev/null +++ b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json @@ -0,0 +1,226 @@ +{ + "chassis": { + "name": "7215 IXS-T1", + "components": [ + { + "name": "System-CPLD" + }, + { + "name": "U-Boot" + } + ], + "fans": [ + { + "name": "Fan1" + }, + { + "name": "Fan2" + } + ], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "Fan1" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "Fan2" + } + ] + } + ], + "psus": [ + { + "name": "PSU1" + }, + { + "name": "PSU2" + } + ], + "thermals": [ + { + "name": "PCB PHY" + }, + { + "name": "PCB MAC" + }, + { + "name": "ADT7473-CPU" + }, + { + "name": "ADT7473-LOC" + }, + { + "name": "ADT7473-MAC" + }, + { + "name": "CPU Core" + } + ], + "sfps": [ + { + "name": "Ethernet0" + }, + { + "name": "Ethernet1" + }, + { + "name": "Ethernet2" + }, + { + "name": "Ethernet3" + }, + { + "name": "Ethernet4" + }, + { + "name": "Ethernet5" + }, + { + "name": "Ethernet6" + }, + { + "name": "Ethernet7" + }, + { + "name": "Ethernet8" + }, + { + "name": "Ethernet9" + }, + { + "name": "Ethernet10" + }, + { + "name": "Ethernet11" + }, + { + "name": "Ethernet12" + }, + { + "name": "Ethernet13" + }, + { + "name": "Ethernet14" + }, + { + "name": "Ethernet15" + }, + { + "name": "Ethernet16" + }, + { + "name": "Ethernet17" + }, + { + "name": "Ethernet18" + }, + { + "name": "Ethernet19" + }, + { + "name": "Ethernet20" + }, + { + "name": "Ethernet21" + }, + { + "name": "Ethernet22" + }, + { + "name": "Ethernet23" + }, + { + "name": "Ethernet24" + }, + { + "name": "Ethernet25" + }, + { + "name": "Ethernet26" + }, + { + "name": "Ethernet27" + }, + { + "name": "Ethernet28" + }, + { + "name": "Ethernet29" + }, + { + "name": "Ethernet30" + }, + { + "name": "Ethernet31" + }, + { + "name": "Ethernet32" + }, + { + "name": "Ethernet33" + }, + { + "name": "Ethernet34" + }, + { + "name": "Ethernet35" + }, + { + "name": "Ethernet36" + }, + { + "name": "Ethernet37" + }, + { + "name": "Ethernet38" + }, + { + "name": "Ethernet39" + }, + { + "name": "Ethernet40" + }, + { + "name": "Ethernet41" + }, + { + "name": "Ethernet42" + }, + { + "name": "Ethernet43" + }, + { + "name": "Ethernet44" + }, + { + "name": "Ethernet45" + }, + { + "name": "Ethernet46" + }, + { + "name": "Ethernet47" + }, + { + "name": "Ethernet48" + }, + { + "name": "Ethernet49" + }, + { + "name": "Ethernet50" + }, + { + "name": "Ethernet51" + } + ] + }, + "interfaces": {} +} diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/pcie.yaml b/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/pcie.yaml new file mode 100644 index 0000000000..f24086a222 --- /dev/null +++ b/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/pcie.yaml @@ -0,0 +1,20 @@ +- bus: '00' + dev: '01' + fn: '0' + id: '6820' + name: 'PCI bridge: Marvell Technology Group Ltd. Device 6820 (rev 0a)' +- bus: '00' + dev: '02' + fn: '0' + id: '6820' + name: 'PCI bridge: Marvell Technology Group Ltd. Device 6820 (rev 0a)' +- bus: '01' + dev: '00' + fn: '0' + id: c804 + name: 'Ethernet controller: Marvell Technology Group Ltd. Device c804' +- bus: '02' + dev: '00' + fn: '0' + id: c804 + name: 'Ethernet controller: Marvell Technology Group Ltd. Device c804' diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh b/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh index 43cd86d59b..4cad43348e 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh @@ -51,6 +51,10 @@ chmod 644 /sys/class/i2c-adapter/i2c-0/0-0053/eeprom echo eeprom 0x55 > /sys/class/i2c-adapter/i2c-0/new_device echo eeprom 0x56 > /sys/class/i2c-adapter/i2c-0/new_device +# Enumerate psu eeprom devices +echo eeprom 0x51 > /sys/class/i2c-adapter/i2c-1/new_device +echo eeprom 0x52 > /sys/class/i2c-adapter/i2c-1/new_device + # Enable optical SFP Tx i2cset -y -m 0x0f 0 0x41 0x5 0x00 diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py index 7597492cc0..b3ada4c71f 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py @@ -13,7 +13,7 @@ try: from sonic_platform.sfp import Sfp from sonic_platform.eeprom import Eeprom from sonic_platform.fan import Fan - from .fan_drawer import VirtualDrawer + from .fan_drawer import RealDrawer from sonic_platform.psu import Psu from sonic_platform.thermal import Thermal from sonic_platform.component import Component @@ -35,8 +35,8 @@ SFP_PORT_END = 52 PORT_END = 52 # Device counts -MAX_7215_FAN_DRAWER = 1 -MAX_7215_FAN = 2 +MAX_7215_FAN_DRAWERS = 2 +MAX_7215_FANS_PER_DRAWER = 1 MAX_7215_PSU = 2 MAX_7215_THERMAL = 6 @@ -89,9 +89,9 @@ class Chassis(ChassisBase): self._eeprom = Eeprom() # Construct lists fans, power supplies, thermals & components - drawer_num = MAX_7215_FAN_DRAWER - fan_num_per_drawer = MAX_7215_FAN - drawer_ctor = VirtualDrawer + drawer_num = MAX_7215_FAN_DRAWERS + fan_num_per_drawer = MAX_7215_FANS_PER_DRAWER + drawer_ctor = RealDrawer fan_index = 0 for drawer_index in range(drawer_num): drawer = drawer_ctor(drawer_index) @@ -159,14 +159,6 @@ class Chassis(ChassisBase): """ return self._eeprom.part_number_str() - def get_serial(self): - """ - Retrieves the serial number of the chassis (Service tag) - Returns: - string: Serial number of chassis - """ - return self._eeprom.serial_str() - def get_status(self): """ Retrieves the operational status of the chassis @@ -186,7 +178,7 @@ class Chassis(ChassisBase): """ return self._eeprom.base_mac_addr() - def get_serial_number(self): + def get_serial(self): """ Retrieves the hardware serial number for the chassis @@ -307,7 +299,7 @@ class Chassis(ChassisBase): # Write sys led if smbus_present == 0: - sonic_logger.log_info("PMON LED SET ERROR-> smbus present = 0") + sonic_logger.log_warning("PMON LED SET -> smbus present = 0") else: bus = smbus.SMBus(0) DEVICE_ADDRESS = 0x41 @@ -328,7 +320,7 @@ class Chassis(ChassisBase): """ # Read sys led if smbus_present == 0: - sonic_logger.log_info("PMON LED GET ERROR-> smbus present = 0") + sonic_logger.log_warning("PMON LED GET -> smbus present = 0") return False else: bus = smbus.SMBus(0) @@ -372,6 +364,23 @@ class Chassis(ChassisBase): watchdog_device_path = "/dev/watchdog0" self._watchdog = WatchdogImplBase(watchdog_device_path) except Exception as e: - sonic_logger.log_info("Fail to load watchdog {}".format(repr(e))) + sonic_logger.log_warning(" Fail to load watchdog {}".format(repr(e))) return self._watchdog + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py index 0b08f3f6b4..67610a125f 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py @@ -163,7 +163,24 @@ class Fan(FanBase): FAN_DIRECTION_EXHAUST depending on fan direction """ - return 'FAN_DIRECTION_INTAKE' + return 'intake' + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device + Returns: + integer: The 1-based relative physical position in parent device + """ + return self.index + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True + def get_speed(self): """ @@ -176,9 +193,13 @@ class Fan(FanBase): fan_speed = self._get_i2c_register(self.get_fan_speed_reg) if (fan_speed != 'ERR'): - speed = int(fan_speed) + speed_in_rpm = int(fan_speed) else: - speed = 0 + speed_in_rpm = 0 + + speed = 100*speed_in_rpm//MAX_IXS7215_FAN_SPEED + if speed > 100: + speed = 100 return speed @@ -320,11 +341,21 @@ class Fan(FanBase): (off) to 100 (full speed) """ speed = 0 - - fan_speed = self._get_i2c_register(self.get_fan_speed_reg) - if (fan_speed != 'ERR'): - speed = int(fan_speed) - else: - speed = 0 - + + fan_duty = self._get_i2c_register(self.set_fan_speed_reg) + if (fan_duty != 'ERR'): + dutyspeed = int(fan_duty) + if dutyspeed == 0: + speed = 0 + elif dutyspeed == 64: + speed = 25 + elif dutyspeed == 128: + speed = 50 + elif dutyspeed == 255: + speed = 100 + return speed + + + + diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan_drawer.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan_drawer.py index ea0bc71bea..cabb15d455 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan_drawer.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan_drawer.py @@ -8,9 +8,11 @@ try: from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_py_common import logger except ImportError as e: raise ImportError(str(e) + "- required module not found") +sonic_logger = logger.Logger('fan_drawer') class NokiaFanDrawer(FanDrawerBase): def __init__(self, index): @@ -21,10 +23,59 @@ class NokiaFanDrawer(FanDrawerBase): def get_index(self): return self._index - def get_led(self): - return self._led + def get_presence(self): + return self._fan_list[0].get_presence() + def get_model(self): + """ + Retrieves the model number of the Fan Drawer + Returns: + string: Part number of Fan Drawer + """ + return self._fan_list[0].get_model() + def get_serial(self): + """ + Retrieves the serial number of the Fan Drawer + Returns: + string: Serial number of Fan + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the Fan Drawer + Returns: + bool: True if Fan is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_direction(self): + return 'intake' + + def set_status_led(self, color): + return True + + def get_status_led(self, color): + return self._fan_list[0].get_status_led() + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device + Returns: + integer: The 1-based relative physical position in parent device + """ + return self._index + + # For Nokia platforms with fan drawer(s) class RealDrawer(NokiaFanDrawer): def __init__(self, index): @@ -33,15 +84,8 @@ class RealDrawer(NokiaFanDrawer): def get_name(self): return self._name + + + -# For Nokia platforms with no physical fan drawer(s) -class VirtualDrawer(NokiaFanDrawer): - def __init__(self, index): - super(VirtualDrawer, self).__init__(index) - - def get_name(self): - return 'N/A' - - def set_status_led(self, color): - return 'N/A' diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py index 4b8029daaa..ab53abebf9 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py @@ -9,6 +9,7 @@ try: import sys from sonic_platform_base.psu_base import PsuBase + from sonic_py_common import logger except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -23,6 +24,7 @@ try: except ImportError as e: smbus_present = 0 +sonic_logger = logger.Logger('psu') class Psu(PsuBase): """Nokia platform-specific PSU class for 7215 """ @@ -76,7 +78,9 @@ class Psu(PsuBase): Returns: string: Part number of PSU """ - return self.eeprom.modelstr() + return "N/A" +# return self.eeprom.serial_number_str() + def get_serial(self): """ @@ -85,7 +89,9 @@ class Psu(PsuBase): Returns: string: Serial number of PSU """ - return self.eeprom.serial_number_str() + return "N/A" +# return self.eeprom.serial_number_str() + def get_status(self): """ @@ -98,6 +104,7 @@ class Psu(PsuBase): if smbus_present == 0: cmdstatus, psustatus = cmd.getstatusoutput('i2cget -y 0 0x41 0xa') psustatus = int(psustatus, 16) + sonic_logger.log_warning("PMON psu-smbus - presence = 0 ") else: bus = smbus.SMBus(0) DEVICE_ADDRESS = 0x41 @@ -146,29 +153,45 @@ class Psu(PsuBase): psu_voltage = 0.0 return psu_voltage - def get_current(self): - """ - Retrieves present electric current supplied by PSU +# def get_current(self): +# """ +# Retrieves present electric current supplied by PSU +# +# Returns: +# A float number, electric current in amperes, +# e.g. 15.4 +# """ +# psu_current = 0.0 +# +# return psu_current +# +# def get_power(self): +# """ +# Retrieves current energy supplied by PSU +# +# Returns: +# A float number, the power in watts, +# e.g. 302.6 +# """ +# psu_power = 0.0 +# +# return psu_power + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device Returns: - A float number, electric current in amperes, - e.g. 15.4 + integer: The 1-based relative physical position in parent device """ - psu_current = 0.0 + return self.index - return psu_current - - def get_power(self): + def is_replaceable(self): """ - Retrieves current energy supplied by PSU - + Indicate whether this device is replaceable. Returns: - A float number, the power in watts, - e.g. 302.6 + bool: True if it is replaceable. """ - psu_power = 0.0 - - return psu_power + return True def get_powergood_status(self): """ @@ -220,6 +243,6 @@ class Psu(PsuBase): bool: True if status LED state is set successfully, False if not """ - # In IXR7220_D1, the firmware running in the PSU controls the LED + # In ISX7215 , the firmware running in the PSU controls the LED # and the PSU LED state cannot be changed from CPU. return False diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py index 274db04ded..cb9c1b9105 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py @@ -276,6 +276,7 @@ class Sfp(SfpBase): specification_compliance |1*255VCHAR |specification compliance vendor_date |1*255VCHAR |vendor date vendor_oui |1*255VCHAR |vendor OUI + application_advertisement |1*255VCHAR |supported applications advertisement ======================================================================== """ @@ -364,7 +365,8 @@ class Sfp(SfpBase): transceiver_info_dict['nominal_bit_rate'] = str( sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - + transceiver_info_dict['application_advertisement'] = 'N/A' + return transceiver_info_dict def get_transceiver_bulk_status(self): @@ -557,26 +559,20 @@ class Sfp(SfpBase): A Boolean, True if SFP has RX LOS, False if not. """ if self.sfp_type == COPPER_TYPE: - return False + return None + if not self.dom_supported: + return None + rx_los_list = [] - if smbus_present == 0: - sonic_logger.log_info(" PMON - smbus ERROR - ") - cmdstatus, rxlosstatus = cmd.getstatusoutput('i2cget -y 0 0x41 0x4') - rxlosstatus = int(rxlosstatus, 16) + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x02 != 0) else: - bus = smbus.SMBus(0) - DEVICE_ADDRESS = 0x41 - DEVICE_REG = 0x4 - rxlosstatus = bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG) - - pos = [1, 2, 4, 8] - bit_pos = pos[self.index-SFP_PORT_START] - rxlosstatus = rxlosstatus & (bit_pos) - - if rxlosstatus == 0: - return True - - return False + return None + + return rx_los_list def get_tx_fault(self): """ @@ -585,8 +581,21 @@ class Sfp(SfpBase): A Boolean, True if SFP has TX fault, False if not Note : TX fault status is lached until a call to get_tx_fault or a reset. """ + if self.sfp_type == COPPER_TYPE: + return None + if not self.dom_supported: + return None + tx_fault_list = [] + + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + else: + return None + return tx_fault_list - return False def get_tx_disable(self): """ @@ -596,26 +605,20 @@ class Sfp(SfpBase): """ if self.sfp_type == COPPER_TYPE: - return False + return None + if not self.dom_supported: + return None - # Enable optical SFP Tx - if smbus_present == 0: - cmdstatus, disstatus = cmd.getstatusoutput('i2cget -y 0 0x41 0x5') - sonic_logger.log_info(" PMON - smbus ERROR tx- DEBUG ") + tx_disable_list = [] + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0xC0 != 0) else: - bus = smbus.SMBus(0) - DEVICE_ADDRESS = 0x41 - DEVICE_REG = 0x5 - disstatus = bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG) - - pos = [1, 2, 4, 8] - bit_pos = pos[self.index-SFP_PORT_START] - disstatus = disstatus & (bit_pos) - - if disstatus == 0: - return True - - return False + return None + + return tx_disable_list def get_tx_disable_channel(self): """ @@ -663,6 +666,9 @@ class Sfp(SfpBase): Returns: An integer number of current temperature in Celsius """ + if self.sfp_type == COPPER_TYPE: + return None + transceiver_bulk_status = self.get_transceiver_bulk_status() return transceiver_bulk_status.get("temperature", "N/A") @@ -672,6 +678,9 @@ class Sfp(SfpBase): Returns: An integer number of supply voltage in mV """ + if self.sfp_type == COPPER_TYPE: + return None + transceiver_bulk_status = self.get_transceiver_bulk_status() return transceiver_bulk_status.get("voltage", "N/A") @@ -679,18 +688,18 @@ class Sfp(SfpBase): """ Retrieves the TX bias current of this SFP Returns: - A list of four integer numbers, representing TX bias in mA - for channel 0 to channel 4. - Ex. ['110.09', '111.12', '108.21', '112.09'] + """ + if self.sfp_type == COPPER_TYPE: + return None + + tx_bias_list = [] transceiver_bulk_status = self.get_transceiver_bulk_status() - tx1_bs = transceiver_bulk_status.get("tx1bias", "N/A") - tx2_bs = transceiver_bulk_status.get("tx2bias", "N/A") - tx3_bs = transceiver_bulk_status.get("tx3bias", "N/A") - tx4_bs = transceiver_bulk_status.get("tx4bias", "N/A") - tx_bias_list = [tx1_bs, tx2_bs, tx3_bs, tx4_bs] + tx_bias_list.append(transceiver_bulk_status.get("tx1bias", "N/A")) + return tx_bias_list + def get_rx_power(self): """ Retrieves the received optical power for this SFP @@ -803,7 +812,7 @@ class Sfp(SfpBase): A boolean, True if tx_disable is set successfully, False if not """ - return False + return NotImplementedError def tx_disable_channel(self, channel, disable): """ @@ -817,7 +826,7 @@ class Sfp(SfpBase): A boolean, True if successful, False if not """ - return False + return NotImplementedError def set_lpmode(self, lpmode): """ @@ -851,7 +860,7 @@ class Sfp(SfpBase): False if not """ - return False + return NotImplementedError def get_name(self): """ @@ -917,3 +926,23 @@ class Sfp(SfpBase): A boolean value, True if device is operating properly, False if not """ return self.get_presence() + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + + if self.sfp_type == "SFP": + return True + else: + return False + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device + Returns: + integer: The 1-based relative physical position in parent device + """ + return self.index diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py index ee7c21c463..7755961592 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py @@ -23,8 +23,6 @@ def main(): print(" Chassis status: {}".format(chassis.get_status())) - print(" Chassis serial_number: {}".format(chassis.get_serial_number())) - print(" Chassis base_mac: {}".format(chassis.get_base_mac())) print(" Chassis reboot cause: {}\n".format(chassis.get_reboot_cause())) diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-psu.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-psu.py index 1a333aeac4..692430ff29 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-psu.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-psu.py @@ -17,9 +17,7 @@ def main(): psu.get_status_led())) print(" Model: {}, Serial: {}".format(psu.get_model(), psu.get_serial())) - print(" Voltage: {}, Current: {}, Power: {}\n".format(psu.get_voltage(), - psu.get_current(), - psu.get_power())) + print(" Voltage: {}, Current: NO, Power: NO \n".format(psu.get_voltage())) return diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-sfp.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-sfp.py index 01f75562ad..f5437b18f8 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-sfp.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-sfp.py @@ -1,21 +1,25 @@ #!/usr/bin/env python try: - import sonic_platform + from sonic_platform.chassis import Chassis except ImportError as e: raise ImportError(str(e) + "- required module not found") def main(): - PORT_START = 49 + PORT_START = 1 PORT_END = 52 - chassis = sonic_platform.platform.Platform().get_chassis() + chassis = Chassis() for physical_port in range(PORT_START, PORT_END+1): + + print(" ") print(" SFP transceiver tests PORT = ", physical_port) + name = chassis.get_sfp(physical_port).get_name() + print(" SFP transceiver tests NAME = ", name) presence = chassis.get_sfp(physical_port).get_presence() print("TEST 1 - sfp presence [ True ] ", physical_port, presence) diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py index e0259347c0..9e99b0da3f 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py @@ -16,8 +16,7 @@ def main(): thermal.get_status())) print(" Model: {}, Serial: {}".format(thermal.get_model(), thermal.get_serial())) - print(" Temperature: {}C, Low Threshold: {}C, High Threshold: {}C\n".format(thermal.get_temperature(), - thermal.get_low_threshold(), + print(" Temperature: {}C, High Threshold: {}C\n".format(thermal.get_temperature(), thermal.get_high_threshold())) return diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py index 2743520de2..528a6e49d9 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py @@ -10,9 +10,11 @@ try: import os from sonic_platform_base.thermal_base import ThermalBase + from sonic_py_common import logger except ImportError as e: raise ImportError(str(e) + "- required module not found") +sonic_logger = logger.Logger('thermal') class Thermal(ThermalBase): """Nokia platform-specific Thermal class""" @@ -175,7 +177,6 @@ class Thermal(ThermalBase): Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - # Not implemented for this sensor if not self.thermal_high_threshold_file: raise NotImplementedError @@ -224,3 +225,19 @@ class Thermal(ThermalBase): thermal_high_crit_threshold = 0.0 return float("{:.3f}".format(thermal_high_crit_threshold)) + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device + Returns: + integer: The 1-based relative physical position in parent device + """ + return self.index + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/watchdog.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/watchdog.py index 5d75a223c5..75ec3ab177 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/watchdog.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/watchdog.py @@ -15,7 +15,7 @@ from sonic_py_common import logger """ ioctl constants """ IO_READ = 0x80000000 IO_SIZE_INT = 0x00040000 -IO_TYPE_WATCHDOG = 'W' << 8 +IO_TYPE_WATCHDOG = ord('W') << 8 WDR_INT = IO_READ | IO_SIZE_INT | IO_TYPE_WATCHDOG diff --git a/platform/marvell-armhf/sonic-platform-nokia/debian/rules b/platform/marvell-armhf/sonic-platform-nokia/debian/rules index c1e6c1fbfb..b7592c2b51 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/debian/rules +++ b/platform/marvell-armhf/sonic-platform-nokia/debian/rules @@ -14,7 +14,7 @@ SERVICE_DIR := service PLATFORM_DIR := sonic_platform %: - dh $@ --with systemd,python2,python3 --buildsystem=pybuild + dh $@ --with systemd,python3 --buildsystem=pybuild clean: dh_testdir @@ -23,7 +23,6 @@ clean: build: (for mod in $(MODULE_DIRS); do \ - python2 $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \ python3 $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \ done) @@ -42,7 +41,6 @@ binary-indep: dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /usr/local/bin; \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ - python2 $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ python3 $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ done) diff --git a/platform/marvell-armhf/sonic-platform-nokia/debian/sonic-platform-nokia-7215.install b/platform/marvell-armhf/sonic-platform-nokia/debian/sonic-platform-nokia-7215.install index dc4df5540d..ea347d79be 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/debian/sonic-platform-nokia-7215.install +++ b/platform/marvell-armhf/sonic-platform-nokia/debian/sonic-platform-nokia-7215.install @@ -1,7 +1,6 @@ nokia-7215_plt_setup.sh usr/sbin 7215/scripts/nokia-7215init.sh usr/local/bin 7215/service/nokia-7215init.service etc/systemd/system -7215/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/armhf-nokia_ixs7215_52x-r0 7215/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/armhf-nokia_ixs7215_52x-r0 entropy.py etc/ inband_mgmt.sh etc/