- Why I did it This is to back-port Azure 7410 to 202012 branch. Enhance the Python3 support for platform API. Originally, some platform APIs call SDK API which didn't support Python 3. Now the Python 3 APIs have been supported in SDK 4.4.3XXX, Python3 is completely supported by platform API - How I did it Start all platform daemons from python3 1. Remove #/usr/bin/env python at the beginning of each platform API file as the platform API won't be started as daemons but be imported from other daemons. 2. Adjust SDK API calls accordingly Signed-off-by: Stephen Sun <stephens@nvidia.com>
This commit is contained in:
parent
93585b0a0a
commit
346b916c0e
@ -1,7 +1,6 @@
|
||||
{
|
||||
"skip_ledd": true,
|
||||
"skip_fancontrol": true,
|
||||
"delay_xcvrd": true,
|
||||
"python2_daemons": ["xcvrd"]
|
||||
"delay_xcvrd": true
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
@ -1479,9 +1477,12 @@ class SFP(SfpBase):
|
||||
sx_mgmt_phy_mod_pwr_attr = sx_mgmt_phy_mod_pwr_attr_t()
|
||||
sx_mgmt_phy_mod_pwr_attr.power_attr_type = power_attr_type
|
||||
sx_mgmt_phy_mod_pwr_attr_t_p_assign(sx_mgmt_phy_mod_pwr_attr_p, sx_mgmt_phy_mod_pwr_attr)
|
||||
module_id_info = sx_mgmt_module_id_info_t()
|
||||
module_id_info.slot_id = 0
|
||||
module_id_info.module_id = self.sdk_index
|
||||
try:
|
||||
rc = sx_mgmt_phy_mod_pwr_attr_get(self.sdk_handle, self.sdk_index, sx_mgmt_phy_mod_pwr_attr_p)
|
||||
assert SX_STATUS_SUCCESS == rc, "sx_mgmt_phy_mod_pwr_attr_get failed"
|
||||
rc = sx_mgmt_phy_module_pwr_attr_get(self.sdk_handle, module_id_info, sx_mgmt_phy_mod_pwr_attr_p)
|
||||
assert SX_STATUS_SUCCESS == rc, "sx_mgmt_phy_module_pwr_attr_get failed {}".format(rc)
|
||||
sx_mgmt_phy_mod_pwr_attr = sx_mgmt_phy_mod_pwr_attr_t_p_value(sx_mgmt_phy_mod_pwr_attr_p)
|
||||
pwr_mode_attr = sx_mgmt_phy_mod_pwr_attr.pwr_mode_attr
|
||||
return pwr_mode_attr.admin_pwr_mode_e, pwr_mode_attr.oper_pwr_mode_e
|
||||
@ -1872,9 +1873,12 @@ class SFP(SfpBase):
|
||||
|
||||
refer plugins/sfpreset.py
|
||||
"""
|
||||
rc = sx_mgmt_phy_mod_reset(self.sdk_handle, self.sdk_index)
|
||||
module_id_info = sx_mgmt_module_id_info_t()
|
||||
module_id_info.slot_id = 0
|
||||
module_id_info.module_id = self.sdk_index
|
||||
rc = sx_mgmt_phy_module_reset(self.sdk_handle, module_id_info)
|
||||
if rc != SX_STATUS_SUCCESS:
|
||||
logger.log_warning("sx_mgmt_phy_mod_reset failed, rc = %d" % rc)
|
||||
logger.log_error("Error occurred when resetting SFP module {}, error code {}".format(self.sdk_index, rc))
|
||||
|
||||
return rc == SX_STATUS_SUCCESS
|
||||
|
||||
@ -1982,10 +1986,13 @@ class SFP(SfpBase):
|
||||
sx_mgmt_phy_mod_pwr_attr.pwr_mode_attr = sx_mgmt_phy_mod_pwr_mode_attr
|
||||
sx_mgmt_phy_mod_pwr_attr_p = new_sx_mgmt_phy_mod_pwr_attr_t_p()
|
||||
sx_mgmt_phy_mod_pwr_attr_t_p_assign(sx_mgmt_phy_mod_pwr_attr_p, sx_mgmt_phy_mod_pwr_attr)
|
||||
module_id_info = sx_mgmt_module_id_info_t()
|
||||
module_id_info.slot_id = 0
|
||||
module_id_info.module_id = self.sdk_index
|
||||
try:
|
||||
rc = sx_mgmt_phy_mod_pwr_attr_set(self.sdk_handle, SX_ACCESS_CMD_SET, self.sdk_index, sx_mgmt_phy_mod_pwr_attr_p)
|
||||
rc = sx_mgmt_phy_module_pwr_attr_set(self.sdk_handle, SX_ACCESS_CMD_SET, module_id_info, sx_mgmt_phy_mod_pwr_attr_p)
|
||||
if SX_STATUS_SUCCESS != rc:
|
||||
logger.log_error("sx_mgmt_phy_mod_pwr_attr_set failed, rc = %d" % rc)
|
||||
logger.log_error("Error occurred when setting power mode for SFP module {}, error code {}".format(self.sdk_index, rc))
|
||||
result = False
|
||||
else:
|
||||
result = True
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
'''
|
||||
listen to the SDK for the SFP change event and return to chassis.
|
||||
'''
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Mellanox
|
||||
|
||||
|
Reference in New Issue
Block a user