Skip to content

Commit

Permalink
[BFN] update counts fans and fantrays for platform plagin
Browse files Browse the repository at this point in the history
  • Loading branch information
KostiantynYarovyiBf committed Dec 13, 2021
1 parent 2199c08 commit 0b70b6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ def set_speed(self, percent):

# DeviceBase interface methods:
def get_name(self):
print("self.fan_index ", self.fan_index)
if self.fan_index%2 == 0:
return "FAN-{}R".format(self.fantrayindex)
return "FAN-{}F".format(self.fantrayindex)
return "counter-rotating-fan-{}".format((self.fantrayindex - 1) * self.fan_index + self.fan_index)

def get_presence(self):
return _fan_info_get(self.fan_index, lambda _: True, False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
except ImportError as e:
raise ImportError (str(e) + "- required module not found")

_CONST_MAX_FAN = 2
_MAX_FANTRAY = 5
# Default Montara
_MAX_FAN = 5
_MAX_FANTRAY = 1

_product_dict = {
"x86_64-accton_wedge100bf_32x-r0" : "Montara",
"x86_64-accton_as9516_32d-r0" : "Newport",
"Lx86_64-accton_as9516bf_32d-r0" : "Newport",
"x86_64-accton_as9516bf_32d-r0" : "Newport",
"x86_64-accton_wedge100bf_65x-r0" : "Mavericks"
}

def _fan_info_get_all():
for fan_num in range(1, _CONST_MAX_FAN + 1):
for fan_num in range(1, _MAX_FAN + 1):
def get_data(client, fan_num=fan_num):
return client.pltfm_mgr.pltfm_mgr_fan_info_get(fan_num)
fan_info = thrift_try(get_data)
fan_info = thrift_try(get_data)
if fan_info.fan_num == fan_num:
yield fan_info

Expand All @@ -33,8 +34,6 @@ def __init__(self, fantray_index, modelstr="Montara"):
self.fantrayindex = fantray_index + 1
self._fan_list = [Fan(i.fan_num, self.fantrayindex, modelstr) for i in _fan_info_get_all()]



# DeviceBase interface methods:
def get_name(self):
return f"fantray-{self.fantrayindex}"
Expand Down Expand Up @@ -112,11 +111,12 @@ def get_platform_name():
return _product_dict.get(device_info.get_platform())

def fan_drawer_list_get():
global _MAX_FANTRAY
global _MAX_FANTRAY, _MAX_FAN
platform = get_platform_name()
if platform == "Newport":
_MAX_FANTRAY = 6
_MAX_FANTRAY = 1
_MAX_FAN = 6
if platform == "Mavericks":
_MAX_FANTRAY = 10

_MAX_FANTRAY = 2
_MAX_FAN = 5
return [FanDrawer(i, platform) for i in range(0, _MAX_FANTRAY)]

0 comments on commit 0b70b6d

Please sign in to comment.