Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CEL-SEA2]: fix sonic platform module import issue for sea2 #11447

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import chassis
import platform
from . import chassis
from . import platform
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
try:
import sys
from sonic_platform_base.chassis_base import ChassisBase
from common import Common
from sonic_platform.common import Common
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

Expand Down Expand Up @@ -106,7 +106,7 @@ def __initialize_eeprom(self):
self._eeprom = Tlv(self._config)

def __initialize_components(self):
from component import Component
from sonic_platform.component import Component

component_config_path = self._api_common.get_config_path(
self.COMPONENT_CONFIG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def _run_command(self, command):
p = subprocess.Popen(
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err = p.communicate()
if err == '':
status, output = True, raw_data.strip()
if err == b'':
status, output = True, str(raw_data.strip(), 'utf-8')
except Exception:
pass
return status, output
Expand Down Expand Up @@ -131,7 +131,7 @@ def _hex_ver_decode(self, hver, num_of_bits, num_of_points):
bin_val = bin(int(hver, 16))[2:].zfill(num_of_bits)
bit_split = num_of_bits / (num_of_points + 1)
for x in range(0, num_of_points+1):
split_bin = bin_val[c_bit:c_bit+bit_split]
split_bin = bin_val[int(c_bit):int(c_bit+bit_split)]
ver_list.append(str(int(split_bin, 2)))
c_bit += bit_split
return '.'.join(ver_list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

try:
from sonic_platform_base.component_base import ComponentBase
from common import Common
from sonic_platform.common import Common
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

try:
from sonic_platform_base.fan_base import FanBase
from common import Common
from sonic_platform.common import Common
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

Expand Down Expand Up @@ -58,8 +58,9 @@ def get_speed(self):
max_rpm = config['max_rear'] if 'R' in self._name else config['max_front']
raw_speed = self._api_common.get_output(
self._fan_index, config, 0)
speed_percent = int(float(raw_speed) / max_rpm * 100.0)

return int(float(raw_speed) / max_rpm * 100.0)
return speed_percent if speed_percent <= 100 else 100

def get_target_speed(self):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
try:
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

class Pcie(PcieUtil):
"""Celestica Platform-specific PCIe class"""

def __init__(self, platform_path):
PcieUtil.__init__(self, platform_path)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

try:
from sonic_platform_base.psu_base import PsuBase
from common import Common
from sonic_platform.common import Common
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_InterfaceId
from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_Dom
from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper
from common import Common
from sonic_platform.common import Common
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

try:
from sonic_platform_base.thermal_base import ThermalBase
from common import Common
from sonic_platform.common import Common
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

Expand Down