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

[Quanta/device] Modify psuutil.py and config.bcm of IX1B #1985

Merged
merged 4 commits into from
Aug 24, 2018
Merged
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
Expand Up @@ -12,8 +12,11 @@ parity_enable=1
# Control to disable parity correction
parity_correction=1

l2_mem_entries=<40960>
l3_mem_entries=<40960>
ipv6_lpm_128b_enable=1
l3_alpm_enable=2

l2_mem_entries=40960
l3_mem_entries=40960

portmap_1=1:100
portmap_2=5:100
Expand Down
57 changes: 28 additions & 29 deletions device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


import os.path
import commands
import subprocess
import logging

try:
Expand All @@ -17,59 +17,58 @@

def show_log(txt):
if DEBUG == True:
print "[IX1B]"+txt
print("[IX2]"+txt)
return

def exec_cmd(cmd, show):
logging.info('Run :'+cmd)
status, output = commands.getstatusoutput(cmd)
show_log (cmd +"with result:" + str(status))
show_log (" output:"+output)
if status:
logging.info('Failed :'+cmd)
try:
output = subprocess.check_output(cmd, shell=True)
show_log (cmd +"output:"+str(output))
except subprocess.CalledProcessError as e:
logging.info("Failed :"+cmd)
if show:
print('Failed :'+cmd)
return status, output
print("Failed :"+cmd +"returncode = {}, err msg: {}".format(e.returncode, e.output))
return output

def my_log(txt):
if DEBUG == True:
print "[QUANTA DBG]: "+txt
print("[QUANTA DBG]: "+txt)
return

def log_os_system(cmd, show):
logging.info('Run :'+cmd)
status = 1
output = ""
status, output = commands.getstatusoutput(cmd)
my_log (cmd +"with result:" + str(status))
my_log ("cmd:" + cmd)
my_log (" output:"+output)
if status:
try:
output = subprocess.check_output(cmd, shell=True)
my_log (cmd +"output:"+str(output))
except subprocess.CalledProcessError as e:
logging.info('Failed :'+cmd)
if show:
print('Failed :'+cmd)
return status, output
print("Failed :"+cmd +"returncode = {}, err msg: {}".format(e.returncode, e.output))
return output

def gpio16_exist():
ret, ls = log_os_system("ls /sys/class/gpio/ | grep gpio16", 0)
ls = log_os_system("ls /sys/class/gpio/ | grep gpio16", 0)
logging.info('mods:'+ls)
if len(ls) ==0:
return False

def gpio17_exist():
ret, ls = log_os_system("ls /sys/class/gpio/ | grep gpio17", 0)
ls = log_os_system("ls /sys/class/gpio/ | grep gpio17", 0)
logging.info('mods:'+ls)
if len(ls) ==0:
return False

def gpio19_exist():
ret, ls = log_os_system("ls /sys/class/gpio/ | grep gpio19", 0)
ls = log_os_system("ls /sys/class/gpio/ | grep gpio19", 0)
logging.info('mods:'+ls)
if len(ls) ==0:
return False

def gpio20_exist():
ret, ls = log_os_system("ls /sys/class/gpio/ | grep gpio20", 0)
ls = log_os_system("ls /sys/class/gpio/ | grep gpio20", 0)
logging.info('mods:'+ls)
if len(ls) ==0:
return False
Expand All @@ -86,20 +85,20 @@ def __init__(self):
PsuBase.__init__(self)

if gpio16_exist() == False:
status, output = exec_cmd("echo 16 > /sys/class/gpio/export ", 1)
status, output = exec_cmd("echo in > /sys/class/gpio/gpio16/direction ", 1)
output = exec_cmd("echo 16 > /sys/class/gpio/export ", 1)
output = exec_cmd("echo in > /sys/class/gpio/gpio16/direction ", 1)

if gpio17_exist() == False:
status, output = exec_cmd("echo 17 > /sys/class/gpio/export ", 1)
status, output = exec_cmd("echo in > /sys/class/gpio/gpio17/direction ", 1)
output = exec_cmd("echo 17 > /sys/class/gpio/export ", 1)
output = exec_cmd("echo in > /sys/class/gpio/gpio17/direction ", 1)

if gpio19_exist() == False:
status, output = exec_cmd("echo 19 > /sys/class/gpio/export ", 1)
status, output = exec_cmd("echo in > /sys/class/gpio/gpio19/direction ", 1)
output = exec_cmd("echo 19 > /sys/class/gpio/export ", 1)
output = exec_cmd("echo in > /sys/class/gpio/gpio19/direction ", 1)

if gpio20_exist() == False:
status, output = exec_cmd("echo 20 > /sys/class/gpio/export ", 1)
status, output = exec_cmd("echo in > /sys/class/gpio/gpio20/direction ", 1)
output = exec_cmd("echo 20 > /sys/class/gpio/export ", 1)
output = exec_cmd("echo in > /sys/class/gpio/gpio20/direction ", 1)

# Get sysfs attribute
def get_attr_value(self, attr_path):
Expand Down