Skip to content

Commit

Permalink
[Dell EMC S5296F] Correct LGTM issues
Browse files Browse the repository at this point in the history
Signed-off-by: Howard Persh <[email protected]>
  • Loading branch information
hpersh-dell committed Jul 7, 2020
1 parent d0af265 commit 90a82a7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 26 deletions.
3 changes: 0 additions & 3 deletions device/dell/x86_64-dellemc_s5296f_c3538-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#


import os.path
import logging
import commands
import sys
Expand Down Expand Up @@ -41,9 +40,7 @@ def isDockerEnv(self):
# Fetch a BMC register
def get_pmc_register(self, reg_name):

status = 1
global ipmi_sdr_list
ipmi_dev_node = "/dev/pmi0"
ipmi_cmd = IPMI_PSU_DATA
dockerenv = self.isDockerEnv()
if dockerenv == True:
Expand Down
9 changes: 3 additions & 6 deletions device/dell/x86_64-dellemc_s5296f_c3538-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@

try:
import struct
import sys
import getopt
import time
from sonic_sfp.sfputilbase import SfpUtilBase
from os import *
from mmap import *
import io
from sonic_sfp.sff8436 import sff8436InterfaceId
from sonic_sfp.sff8436 import sff8436Dom
from sonic_sfp.sff8472 import sff8472InterfaceId
from sonic_sfp.sff8472 import sff8472Dom

except ImportError as e:
Expand Down Expand Up @@ -202,7 +199,7 @@ def set_low_power_mode(self, port_num, lpmode):
reg_value = reg_value & ~mask

# Convert our register value back to a hex string and write back
status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset)
self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset)

return True

Expand All @@ -229,15 +226,15 @@ def reset(self, port_num):
reg_value = reg_value & ~mask

# Convert our register value back to a hex string and write back
status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset)
self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset)

# Sleep 1 second to allow it to settle
time.sleep(1)

reg_value = reg_value | mask

# Convert our register value back to a hex string and write back
status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset)
self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset)

return True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
# * PSU


import os
import sys
import logging
import subprocess
import commands

S5296F_MAX_FAN_TRAYS = 4
Expand All @@ -36,7 +34,6 @@

def ipmi_sensor_dump():

status = 1
global ipmi_sdr_list
ipmi_cmd = IPMI_SENSOR_DATA
status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd)
Expand Down Expand Up @@ -95,7 +92,6 @@ def print_temperature_sensors():
def print_fan_tray(tray):

Fan_Status = [' Normal', ' Abnormal']
Airflow_Direction = ['B2F', 'F2B']

print ' Fan Tray ' + str(tray) + ':'

Expand Down Expand Up @@ -153,7 +149,6 @@ def get_psu_presence(index):
:return: Boolean, True if PSU is plugged, False if not
"""
status = 0
ret_status = 1

if index == 1:
status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER)
Expand All @@ -175,16 +170,6 @@ def get_psu_presence(index):

# Print the information for PSU1, PSU2
def print_psu(psu):
Psu_Type = ['Normal', 'Mismatch']
Psu_Input_Type = ['AC', 'DC']
PSU_STATUS_TYPE_BIT = 4
PSU_STATUS_INPUT_TYPE_BIT = 1
PSU_FAN_PRESENT_BIT = 2
PSU_FAN_STATUS_BIT = 1
PSU_FAN_AIR_FLOW_BIT = 0
Psu_Fan_Presence = ['Present', 'Absent']
Psu_Fan_Status = ['Normal', 'Abnormal']
Psu_Fan_Airflow = ['B2F', 'F2B']

# print ' Input: ', Psu_Input_Type[psu_input_type]
# print ' Type: ', Psu_Type[psu_type]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

try:
import struct
import sys
from os import *
from mmap import *

Expand All @@ -22,7 +21,7 @@ def pci_mem_write(mm, offset, data):
def pci_set_value(resource, val, offset):
fd = open(resource, O_RDWR)
mm = mmap(fd, 0)
val = pci_mem_write(mm, offset, val)
pci_mem_write(mm, offset, val)
mm.close()
close(fd)
return val
Expand Down

0 comments on commit 90a82a7

Please sign in to comment.