[device] accton update driver and sync as5712-54x from 201807. (#2110)
* [platform_accton] Remove dependency on particular version of linux. Signed-off-by: Polly Hsu <polly_hsu@edge-core.com> * [platfrom] as5712-54x: update i2c_client for linux kernel 4.x. Signed-off-by: Polly Hsu <polly_hsu@edge-core.com> * [platform] Update lastest optoe.c from https://github.com/opencomputeproject/oom/blob/master/optoe/optoe.c. Signed-off-by: roy_lee <roy_lee@accton.com> * [platform] rm optoe driver here. For it's inside the kernel. Signed-off-by: roy_lee <roy_lee@accton.com> * [platform] as5712-54x, merge the change of Azure/sonic-buildimage#2002 which is on branch 201807. Signed-off-by: roy_lee <roy_lee@accton.com>
This commit is contained in:
parent
c8e6b15504
commit
593bcb1c1b
@ -2,9 +2,9 @@
|
|||||||
#
|
#
|
||||||
# Platform-specific SFP transceiver interface for SONiC
|
# Platform-specific SFP transceiver interface for SONiC
|
||||||
#
|
#
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
from sonic_sfp.sfputilbase import SfpUtilBase
|
from sonic_sfp.sfputilbase import SfpUtilBase
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
raise ImportError("%s - required module not found" % str(e))
|
raise ImportError("%s - required module not found" % str(e))
|
||||||
@ -21,8 +21,14 @@ class SfpUtil(SfpUtilBase):
|
|||||||
|
|
||||||
BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/"
|
BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/"
|
||||||
BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/"
|
BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/"
|
||||||
BASE_CPLD2_PATH = "/sys/bus/i2c/devices/0-0061/"
|
BASE_CPLD2_PATH = "/sys/bus/i2c/devices/{0}-0061/"
|
||||||
BASE_CPLD3_PATH = "/sys/bus/i2c/devices/0-0062/"
|
BASE_CPLD3_PATH = "/sys/bus/i2c/devices/{0}-0062/"
|
||||||
|
I2C_BUS_ORDER = -1
|
||||||
|
|
||||||
|
#The sidebands of QSFP is different.
|
||||||
|
#present is in-order.
|
||||||
|
#But lp_mode and reset are not.
|
||||||
|
qsfp_sb_map = [1, 3, 5, 2, 4, 6]
|
||||||
|
|
||||||
_port_to_is_present = {}
|
_port_to_is_present = {}
|
||||||
_port_to_lp_mode = {}
|
_port_to_lp_mode = {}
|
||||||
@ -137,19 +143,31 @@ class SfpUtil(SfpUtilBase):
|
|||||||
|
|
||||||
SfpUtilBase.__init__(self)
|
SfpUtilBase.__init__(self)
|
||||||
|
|
||||||
|
#Two i2c buses might get flipped order, check them both.
|
||||||
|
def update_i2c_order(self):
|
||||||
|
if self.I2C_BUS_ORDER < 0:
|
||||||
|
eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
|
||||||
|
if os.path.exists(eeprom_path):
|
||||||
|
self.I2C_BUS_ORDER = 0
|
||||||
|
eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom"
|
||||||
|
if os.path.exists(eeprom_path):
|
||||||
|
self.I2C_BUS_ORDER = 1
|
||||||
|
return self.I2C_BUS_ORDER
|
||||||
|
|
||||||
def get_presence(self, port_num):
|
def get_presence(self, port_num):
|
||||||
# Check for invalid port_num
|
# Check for invalid port_num
|
||||||
if port_num < self.port_start or port_num > self.port_end:
|
if port_num < self.port_start or port_num > self.port_end:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
order = self.update_i2c_order()
|
||||||
if port_num < 24:
|
if port_num < 24:
|
||||||
present_path = self.BASE_CPLD2_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0])
|
present_path = self.BASE_CPLD2_PATH.format(order)
|
||||||
else:
|
else:
|
||||||
present_path = self.BASE_CPLD3_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0])
|
present_path = self.BASE_CPLD3_PATH.format(order)
|
||||||
|
|
||||||
|
present_path = present_path + "module_present_" + str(self._port_to_i2c_mapping[port_num][0])
|
||||||
self.__port_to_is_present = present_path
|
self.__port_to_is_present = present_path
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
val_file = open(self.__port_to_is_present)
|
val_file = open(self.__port_to_is_present)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
@ -165,11 +183,21 @@ class SfpUtil(SfpUtilBase):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def qsfp_sb_remap(self, port_num):
|
||||||
|
qsfp_start = self.qsfp_port_start
|
||||||
|
qsfp_index = self._port_to_i2c_mapping[port_num][0] - qsfp_start
|
||||||
|
qsfp_index = self.qsfp_sb_map[qsfp_index-1]
|
||||||
|
return qsfp_start+qsfp_index
|
||||||
|
|
||||||
def get_low_power_mode(self, port_num):
|
def get_low_power_mode(self, port_num):
|
||||||
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
|
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0])
|
order = self.update_i2c_order()
|
||||||
|
lp_mode_path = self.BASE_CPLD3_PATH.format(order)
|
||||||
|
lp_mode_path = lp_mode_path + "module_lp_mode_"
|
||||||
|
q = self.qsfp_sb_remap(port_num)
|
||||||
|
lp_mode_path = lp_mode_path + str(q)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
val_file = open(lp_mode_path)
|
val_file = open(lp_mode_path)
|
||||||
@ -190,7 +218,11 @@ class SfpUtil(SfpUtilBase):
|
|||||||
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
|
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0])
|
order = self.update_i2c_order()
|
||||||
|
lp_mode_path = self.BASE_CPLD3_PATH.format(order)
|
||||||
|
lp_mode_path = lp_mode_path + "module_lp_mode_"
|
||||||
|
q = self.qsfp_sb_remap(port_num)
|
||||||
|
lp_mode_path = lp_mode_path + str(q)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
reg_file = open(lp_mode_path, 'r+')
|
reg_file = open(lp_mode_path, 'r+')
|
||||||
@ -212,7 +244,11 @@ class SfpUtil(SfpUtilBase):
|
|||||||
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
|
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
mod_rst_path = lp_mode_path = self.BASE_CPLD3_PATH + "module_reset_" + str(self._port_to_i2c_mapping[port_num][0])
|
order = self.update_i2c_order()
|
||||||
|
lp_mode_path = self.BASE_CPLD3_PATH.format(order)
|
||||||
|
mod_rst_path = lp_mode_path + "module_reset_"
|
||||||
|
q = self.qsfp_sb_remap(port_num)
|
||||||
|
mod_rst_path = mod_rst_path + str(q)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
reg_file = open(mod_rst_path, 'r+')
|
reg_file = open(mod_rst_path, 'r+')
|
||||||
@ -220,11 +256,13 @@ class SfpUtil(SfpUtilBase):
|
|||||||
print "Error: unable to open file: %s" % str(e)
|
print "Error: unable to open file: %s" % str(e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
reg_value = '1'
|
#toggle reset
|
||||||
|
reg_file.seek(0)
|
||||||
reg_file.write(reg_value)
|
reg_file.write('0')
|
||||||
|
time.sleep(1)
|
||||||
|
reg_file.seek(0)
|
||||||
|
reg_file.write('1')
|
||||||
reg_file.close()
|
reg_file.close()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_transceiver_change_event(self):
|
def get_transceiver_change_event(self):
|
||||||
@ -234,3 +272,4 @@ class SfpUtil(SfpUtilBase):
|
|||||||
on this platform.
|
on this platform.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,6 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Usage: %(scriptName)s [options] command object
|
Usage: %(scriptName)s [options] command object
|
||||||
|
|
||||||
@ -36,6 +35,7 @@ import sys, getopt
|
|||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
import pickle
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
PROJECT_NAME = 'as5712_54x'
|
PROJECT_NAME = 'as5712_54x'
|
||||||
@ -62,7 +62,7 @@ hwmon_nodes = {'led': ['brightness'] ,
|
|||||||
'fan3': ['fan3_duty_cycle_percentage','fan3_fault', 'fan3_speed_rpm', 'fan3_direction', 'fanr3_fault', 'fanr3_speed_rpm'],
|
'fan3': ['fan3_duty_cycle_percentage','fan3_fault', 'fan3_speed_rpm', 'fan3_direction', 'fanr3_fault', 'fanr3_speed_rpm'],
|
||||||
'fan4': ['fan4_duty_cycle_percentage','fan4_fault', 'fan4_speed_rpm', 'fan4_direction', 'fanr4_fault', 'fanr4_speed_rpm'],
|
'fan4': ['fan4_duty_cycle_percentage','fan4_fault', 'fan4_speed_rpm', 'fan4_direction', 'fanr4_fault', 'fanr4_speed_rpm'],
|
||||||
'fan5': ['fan5_duty_cycle_percentage','fan5_fault', 'fan5_speed_rpm', 'fan5_direction', 'fanr5_fault', 'fanr5_speed_rpm'],
|
'fan5': ['fan5_duty_cycle_percentage','fan5_fault', 'fan5_speed_rpm', 'fan5_direction', 'fanr5_fault', 'fanr5_speed_rpm'],
|
||||||
}
|
}
|
||||||
hwmon_prefix ={'led': led_prefix,
|
hwmon_prefix ={'led': led_prefix,
|
||||||
'fan1': fan_prefix,
|
'fan1': fan_prefix,
|
||||||
'fan2': fan_prefix,
|
'fan2': fan_prefix,
|
||||||
@ -80,12 +80,19 @@ i2c_nodes = {
|
|||||||
'psu': ['psu_present ', 'psu_power_good'] ,
|
'psu': ['psu_present ', 'psu_power_good'] ,
|
||||||
'sfp': ['sfp_is_present ', 'sfp_tx_disable']}
|
'sfp': ['sfp_is_present ', 'sfp_tx_disable']}
|
||||||
|
|
||||||
|
QSFP_START = 48
|
||||||
|
I2C_BUS_ORDER = -1
|
||||||
|
|
||||||
sfp_map = [2, 3, 4, 5, 6, 7, 8, 9, 10,
|
sfp_map = [2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||||
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||||
41, 42, 43, 44, 45, 46, 47, 48, 49,
|
41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||||
50, 52, 54, 51, 53, 55]
|
50, 52, 54, 51, 53, 55]
|
||||||
|
|
||||||
|
port_cpld_path = [ "/sys/bus/i2c/devices/0-0061/"
|
||||||
|
,'/sys/bus/i2c/devices/0-0062/']
|
||||||
|
|
||||||
mknod =[
|
mknod =[
|
||||||
'echo as5712_54x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-0/new_device',
|
'echo as5712_54x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-0/new_device',
|
||||||
'echo as5712_54x_cpld2 0x61 > /sys/bus/i2c/devices/i2c-0/new_device',
|
'echo as5712_54x_cpld2 0x61 > /sys/bus/i2c/devices/i2c-0/new_device',
|
||||||
@ -131,7 +138,7 @@ mknod2 =[
|
|||||||
'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-63/new_device',
|
'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-63/new_device',
|
||||||
|
|
||||||
#EERPOM
|
#EERPOM
|
||||||
'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device',
|
'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device',
|
||||||
]
|
]
|
||||||
|
|
||||||
FORCE = 0
|
FORCE = 0
|
||||||
@ -207,7 +214,7 @@ def show_set_help():
|
|||||||
print cmd +" [led|sfp|fan]"
|
print cmd +" [led|sfp|fan]"
|
||||||
print " use \""+ cmd + " led 0-4 \" to set led color"
|
print " use \""+ cmd + " led 0-4 \" to set led color"
|
||||||
print " use \""+ cmd + " fan 0-100\" to set fan duty percetage"
|
print " use \""+ cmd + " fan 0-100\" to set fan duty percetage"
|
||||||
print " use \""+ cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable"
|
print " use \""+ cmd + " sfp 1-48 {0|1}\" to set sfp# tx_disable"
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def show_eeprom_help():
|
def show_eeprom_help():
|
||||||
@ -289,10 +296,28 @@ def i2c_order_check():
|
|||||||
status, output = log_os_system(tmp, 0)
|
status, output = log_os_system(tmp, 0)
|
||||||
return order
|
return order
|
||||||
|
|
||||||
def device_install():
|
def update_i2c_order():
|
||||||
global FORCE
|
global I2C_BUS_ORDER
|
||||||
|
|
||||||
order = i2c_order_check()
|
order = i2c_order_check()
|
||||||
|
pickle.dump(order, open("/tmp/accton_util.p", "wb")) # save it
|
||||||
|
I2C_BUS_ORDER = order
|
||||||
|
print "[%s]Detected I2C_BUS_ORDER:%d" % (os.path.basename(__file__), I2C_BUS_ORDER)
|
||||||
|
|
||||||
|
def get_i2c_order():
|
||||||
|
global I2C_BUS_ORDER
|
||||||
|
if I2C_BUS_ORDER < 0:
|
||||||
|
if os.path.exists("/tmp/accton_util.p"):
|
||||||
|
I2C_BUS_ORDER = pickle.load(open("/tmp/accton_util.p", "rb"))
|
||||||
|
else:
|
||||||
|
update_i2c_order()
|
||||||
|
|
||||||
|
def device_install():
|
||||||
|
global FORCE
|
||||||
|
global I2C_BUS_ORDER
|
||||||
|
|
||||||
|
update_i2c_order()
|
||||||
|
order = I2C_BUS_ORDER
|
||||||
# if 0x76 is not exist @i2c-0, use reversed bus order
|
# if 0x76 is not exist @i2c-0, use reversed bus order
|
||||||
if order:
|
if order:
|
||||||
for i in range(0,len(mknod2)):
|
for i in range(0,len(mknod2)):
|
||||||
@ -318,7 +343,10 @@ def device_install():
|
|||||||
return status
|
return status
|
||||||
|
|
||||||
for i in range(0,len(sfp_map)):
|
for i in range(0,len(sfp_map)):
|
||||||
status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1)
|
if i < QSFP_START:
|
||||||
|
status, output =log_os_system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1)
|
||||||
|
else:
|
||||||
|
status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1)
|
||||||
if status:
|
if status:
|
||||||
print output
|
print output
|
||||||
if FORCE == 0:
|
if FORCE == 0:
|
||||||
@ -333,13 +361,10 @@ def device_install():
|
|||||||
|
|
||||||
def device_uninstall():
|
def device_uninstall():
|
||||||
global FORCE
|
global FORCE
|
||||||
|
global I2C_BUS_ORDER
|
||||||
|
|
||||||
status, output =log_os_system("ls /sys/bus/i2c/devices/0-0070", 0)
|
get_i2c_order()
|
||||||
if status==0:
|
order = I2C_BUS_ORDER
|
||||||
I2C_ORDER=1
|
|
||||||
else:
|
|
||||||
I2C_ORDER=0
|
|
||||||
|
|
||||||
for i in range(0,len(sfp_map)):
|
for i in range(0,len(sfp_map)):
|
||||||
target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device"
|
target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device"
|
||||||
status, output =log_os_system("echo 0x50 > "+ target, 1)
|
status, output =log_os_system("echo 0x50 > "+ target, 1)
|
||||||
@ -348,7 +373,7 @@ def device_uninstall():
|
|||||||
if FORCE == 0:
|
if FORCE == 0:
|
||||||
return status
|
return status
|
||||||
|
|
||||||
if I2C_ORDER==0:
|
if order == 0:
|
||||||
nodelist = mknod
|
nodelist = mknod
|
||||||
else:
|
else:
|
||||||
nodelist = mknod2
|
nodelist = mknod2
|
||||||
@ -476,7 +501,7 @@ def show_eeprom(index):
|
|||||||
if len(ALL_DEVICE)==0:
|
if len(ALL_DEVICE)==0:
|
||||||
devices_info()
|
devices_info()
|
||||||
node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0]
|
node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0]
|
||||||
node = node.replace(node.split("/")[-1], 'sfp_eeprom')
|
node = node.replace(node.split("/")[-1], 'eeprom')
|
||||||
# check if got hexdump command in current environment
|
# check if got hexdump command in current environment
|
||||||
ret, log = log_os_system("which hexdump", 0)
|
ret, log = log_os_system("which hexdump", 0)
|
||||||
ret, log2 = log_os_system("which busybox hexdump", 0)
|
ret, log2 = log_os_system("which busybox hexdump", 0)
|
||||||
@ -498,6 +523,43 @@ def show_eeprom(index):
|
|||||||
print "**********device no found**********"
|
print "**********device no found**********"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def get_cpld_path(index):
|
||||||
|
global I2C_BUS_ORDER
|
||||||
|
|
||||||
|
if I2C_BUS_ORDER < 0:
|
||||||
|
get_i2c_order()
|
||||||
|
|
||||||
|
if I2C_BUS_ORDER !=0 :
|
||||||
|
return port_cpld_path[index].replace("0-", "1-")
|
||||||
|
else:
|
||||||
|
return port_cpld_path[index]
|
||||||
|
|
||||||
|
def cpld_path_of_port(port_index):
|
||||||
|
if port_index < 1 and port_index > DEVICE_NO['sfp']:
|
||||||
|
return None
|
||||||
|
if port_index < 25:
|
||||||
|
return get_cpld_path(0)
|
||||||
|
else:
|
||||||
|
return get_cpld_path(1)
|
||||||
|
|
||||||
|
def get_path_sfp_tx_dis(port_index):
|
||||||
|
cpld_p = cpld_path_of_port(port_index)
|
||||||
|
if cpld_p == None:
|
||||||
|
return False, ''
|
||||||
|
else:
|
||||||
|
dev = cpld_p+"module_tx_disable_"+str(port_index)
|
||||||
|
return True, dev
|
||||||
|
|
||||||
|
def get_path_sfp_presence(port_index):
|
||||||
|
cpld_p = cpld_path_of_port(port_index)
|
||||||
|
if cpld_p == None:
|
||||||
|
return False, ''
|
||||||
|
else:
|
||||||
|
dev = cpld_p+"module_present_"+str(port_index)
|
||||||
|
return True, dev
|
||||||
|
|
||||||
|
|
||||||
def set_device(args):
|
def set_device(args):
|
||||||
global DEVICE_NO
|
global DEVICE_NO
|
||||||
global ALL_DEVICE
|
global ALL_DEVICE
|
||||||
@ -535,7 +597,9 @@ def set_device(args):
|
|||||||
print ("Current fan duty: " + args[1] +"%")
|
print ("Current fan duty: " + args[1] +"%")
|
||||||
return ret
|
return ret
|
||||||
elif args[0]=='sfp':
|
elif args[0]=='sfp':
|
||||||
if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0:
|
#if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0:
|
||||||
|
#There no tx_disable for QSFP port
|
||||||
|
if int(args[1]) > QSFP_START or int(args[1])==0:
|
||||||
show_set_help()
|
show_set_help()
|
||||||
return
|
return
|
||||||
if len(args)<2:
|
if len(args)<2:
|
||||||
@ -546,14 +610,13 @@ def set_device(args):
|
|||||||
show_set_help()
|
show_set_help()
|
||||||
return
|
return
|
||||||
|
|
||||||
#print ALL_DEVICE[args[0]]
|
port_index = int(args[1])
|
||||||
for i in range(0,len(ALL_DEVICE[args[0]])):
|
ret, dev = get_path_sfp_tx_dis(port_index)
|
||||||
for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]:
|
if ret == False:
|
||||||
if j.find('tx_disable')!= -1:
|
return False
|
||||||
ret, log = log_os_system("echo "+args[2]+" >"+ j, 1)
|
else:
|
||||||
if ret:
|
ret, log = log_os_system("echo "+args[2]+" >"+ dev, 1)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
#get digits inside a string.
|
#get digits inside a string.
|
||||||
@ -562,6 +625,16 @@ def get_value(input):
|
|||||||
digit = re.findall('\d+', input)
|
digit = re.findall('\d+', input)
|
||||||
return int(digit[0])
|
return int(digit[0])
|
||||||
|
|
||||||
|
def print_1_device_traversal(i, j, k):
|
||||||
|
ret, log = log_os_system("cat "+k, 0)
|
||||||
|
func = k.split("/")[-1].strip()
|
||||||
|
func = re.sub(j+'_','',func,1)
|
||||||
|
func = re.sub(i.lower()+'_','',func,1)
|
||||||
|
if ret==0:
|
||||||
|
return func+"="+log+" "
|
||||||
|
else:
|
||||||
|
return func+"="+"X"+" "
|
||||||
|
|
||||||
def device_traversal():
|
def device_traversal():
|
||||||
if system_ready()==False:
|
if system_ready()==False:
|
||||||
print("System's not ready.")
|
print("System's not ready.")
|
||||||
@ -577,15 +650,26 @@ def device_traversal():
|
|||||||
|
|
||||||
for j in sorted(ALL_DEVICE[i].keys(), key=get_value):
|
for j in sorted(ALL_DEVICE[i].keys(), key=get_value):
|
||||||
print " "+j+":",
|
print " "+j+":",
|
||||||
for k in (ALL_DEVICE[i][j]):
|
if i == 'sfp':
|
||||||
ret, log = log_os_system("cat "+k, 0)
|
port_index = int(filter(str.isdigit, j))
|
||||||
func = k.split("/")[-1].strip()
|
for k in (ALL_DEVICE[i][j]):
|
||||||
func = re.sub(j+'_','',func,1)
|
if k.find('tx_disable')!= -1:
|
||||||
func = re.sub(i.lower()+'_','',func,1)
|
ret, k = get_path_sfp_tx_dis(port_index)
|
||||||
if ret==0:
|
if ret == False:
|
||||||
print func+"="+log+" ",
|
continue
|
||||||
else:
|
log = print_1_device_traversal(i, j, k)
|
||||||
print func+"="+"X"+" ",
|
print log,
|
||||||
|
if k.find('present')!= -1:
|
||||||
|
ret, k = get_path_sfp_presence(port_index)
|
||||||
|
if ret == False:
|
||||||
|
continue
|
||||||
|
log = print_1_device_traversal(i, j, k)
|
||||||
|
print log,
|
||||||
|
|
||||||
|
else:
|
||||||
|
for k in (ALL_DEVICE[i][j]):
|
||||||
|
log = print_1_device_traversal(i, j, k)
|
||||||
|
print log,
|
||||||
print
|
print
|
||||||
print("----------------------------------------------------------------")
|
print("----------------------------------------------------------------")
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,40 +2,33 @@ Source: sonic-accton-platform-modules
|
|||||||
Section: main
|
Section: main
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: Accton network <roy_lee@accton.com>, Accton Network <polly_hsu@accton.com>
|
Maintainer: Accton network <roy_lee@accton.com>, Accton Network <polly_hsu@accton.com>
|
||||||
Build-Depends: debhelper (>= 8.0.0), bzip2
|
Build-Depends: debhelper (>= 9), bzip2
|
||||||
Standards-Version: 3.9.3
|
Standards-Version: 3.9.3
|
||||||
|
|
||||||
Package: sonic-platform-accton-as7712-32x
|
Package: sonic-platform-accton-as7712-32x
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-3.16.0-5-amd64
|
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
|
||||||
Package: sonic-platform-accton-as5712-54x
|
Package: sonic-platform-accton-as5712-54x
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-3.16.0-5-amd64
|
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
|
||||||
Package: sonic-platform-accton-as7816-64x
|
Package: sonic-platform-accton-as7816-64x
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-3.16.0-5-amd64
|
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
|
||||||
Package: sonic-platform-accton-as7716-32x
|
Package: sonic-platform-accton-as7716-32x
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-3.16.0-5-amd64
|
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
|
||||||
Package: sonic-platform-accton-as7716-32xb
|
Package: sonic-platform-accton-as7716-32xb
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-3.16.0-5-amd64
|
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
|
||||||
Package: sonic-platform-accton-as7312-54x
|
Package: sonic-platform-accton-as7312-54x
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-3.16.0-5-amd64
|
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
|
||||||
Package: sonic-platform-accton-as7326-56x
|
Package: sonic-platform-accton-as7326-56x
|
||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Depends: linux-image-3.16.0-5-amd64
|
|
||||||
Description: kernel modules for platform devices such as fan, led, sfp
|
Description: kernel modules for platform devices such as fan, led, sfp
|
||||||
|
Loading…
Reference in New Issue
Block a user