[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
This commit is contained in:
parent
9cd9ff72ea
commit
2bf1806a34
226
device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json
Normal file
226
device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json
Normal file
@ -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": {}
|
||||
}
|
20
device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/pcie.yaml
Normal file
20
device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/pcie.yaml
Normal file
@ -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'
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
@ -321,10 +342,20 @@ class Fan(FanBase):
|
||||
"""
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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,8 +23,57 @@ 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)
|
||||
@ -35,13 +86,6 @@ class RealDrawer(NokiaFanDrawer):
|
||||
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'
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,6 +365,7 @@ 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
|
||||
|
||||
@ -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)
|
||||
return None
|
||||
|
||||
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 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)
|
||||
return None
|
||||
|
||||
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 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
|
||||
|
@ -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()))
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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/
|
||||
|
Loading…
Reference in New Issue
Block a user