[device][accton]: ADD the Accton new device support, AS9716-32D (#3372)

This commit is contained in:
Polly Hsu 2019-08-29 12:39:40 +08:00 committed by lguohan
parent 7bf8fbe601
commit 3323e9b817
8 changed files with 275 additions and 0 deletions

View File

@ -0,0 +1,33 @@
# name lanes alias index speed
Ethernet0 73,74,75,76,77,78,79,80 fourHundredGigE1 0 400000
Ethernet4 65,66,67,68,69,70,71,72 fourHundredGigE2 1 400000
Ethernet8 81,82,83,84,85,86,87,88 fourHundredGigE3 2 400000
Ethernet12 89,90,91,92,93,94,95,96 fourHundredGigE4 3 400000
Ethernet16 97,98,99,100,101,102,103,104 fourHundredGigE5 4 400000
Ethernet20 105,106,107,108,109,110,111,112 fourHundredGigE6 5 400000
Ethernet24 113,114,115,116,117,118,119,120 fourHundredGigE7 6 400000
Ethernet28 121,122,123,124,125,126,127,128 fourHundredGigE8 7 400000
Ethernet32 41,42,43,44,45,46,47,48 fourHundredGigE9 8 400000
Ethernet36 33,34,35,36,37,38,39,40 fourHundredGigE10 9 400000
Ethernet40 49,50,51,52,53,54,55,56 fourHundredGigE11 10 400000
Ethernet44 57,58,59,60,61,62,63,64 fourHundredGigE12 11 400000
Ethernet48 129,130,131,132,133,134,135,136 fourHundredGigE13 12 400000
Ethernet52 137,138,139,140,141,142,143,144 fourHundredGigE14 13 400000
Ethernet56 145,146,147,148,149,150,151,152 fourHundredGigE15 14 400000
Ethernet60 153,154,155,156,157,158,159,160 fourHundredGigE16 15 400000
Ethernet64 169,170,171,172,173,174,175,176 fourHundredGigE17 16 400000
Ethernet68 161,162,163,164,165,166,167,168 fourHundredGigE18 17 400000
Ethernet72 177,178,179,180,181,182,183,184 fourHundredGigE19 18 400000
Ethernet76 185,186,187,188,189,190,191,192 fourHundredGigE20 19 400000
Ethernet80 1,2,3,4,5,6,7,8 fourHundredGigE21 20 400000
Ethernet84 9,10,11,12,13,14,15,16 fourHundredGigE22 21 400000
Ethernet88 17,18,19,20,21,22,23,24 fourHundredGigE23 22 400000
Ethernet92 25,26,27,28,29,30,31,32 fourHundredGigE24 23 400000
Ethernet96 201,202,203,204,205,206,207,208 fourHundredGigE25 24 400000
Ethernet100 193,194,195,196,197,198,199,200 fourHundredGigE26 25 400000
Ethernet104 217,218,219,220,221,222,223,224 fourHundredGigE27 26 400000
Ethernet108 209,210,211,212,213,214,215,216 fourHundredGigE28 27 400000
Ethernet112 233,234,235,236,237,238,239,240 fourHundredGigE29 28 400000
Ethernet116 225,226,227,228,229,230,231,232 fourHundredGigE30 29 400000
Ethernet120 249,250,251,252,253,254,255,256 fourHundredGigE31 30 400000
Ethernet124 241,242,243,244,245,246,247,248 fourHundredGigE32 31 400000

View File

@ -0,0 +1 @@
SAI_INIT_CONFIG_FILE=/etc/bcm/th3-as9716-32x400G.config.bcm

View File

@ -0,0 +1 @@
Accton-AS9716-32D t1

View File

@ -0,0 +1,4 @@
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=115200
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="pcie_aspm=off"

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
try:
import exceptions
import binascii
import time
import optparse
import warnings
import os
import sys
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,61 @@
#!/usr/bin/env python
#############################################################################
# Accton
#
# Module contains an implementation of SONiC PSU Base API and
# provides the PSUs status which are available in the platform
#
#############################################################################
import os.path
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
def __init__(self):
PsuBase.__init__(self)
self.psu_path = "/sys/bus/i2c/devices/"
self.psu_presence = "/psu_present"
self.psu_oper_status = "/psu_power_good"
self.psu_mapping = {
2: "10-0051",
1: "9-0050",
}
def get_num_psus(self):
return len(self.psu_mapping)
def get_psu_status(self, index):
if index is None:
return False
status = 0
node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status
try:
with open(node, 'r') as power_status:
status = int(power_status.read())
except IOError:
return False
return status == 1
def get_psu_presence(self, index):
if index is None:
return False
status = 0
node = self.psu_path + self.psu_mapping[index] + self.psu_presence
try:
with open(node, 'r') as presence_status:
status = int(presence_status.read())
except IOError:
return False
return status == 1

View File

@ -0,0 +1,150 @@
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 0
PORT_END = 33
PORTS_IN_BLOCK = 34
BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/"
BASE_CPLD1_PATH = "/sys/bus/i2c/devices/20-0061/"
BASE_CPLD2_PATH = "/sys/bus/i2c/devices/21-0062/"
_port_to_is_present = {}
_port_to_lp_mode = {}
_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
0: [1, 25],
1: [2, 26],
2: [3, 27],
3: [4, 28],
4: [5, 29],
5: [6, 30],
6: [7, 31],
7: [8, 32],
8: [9, 33],
9: [10, 34],
10: [11, 35],
11: [12, 36],
12: [13, 37],
13: [14, 38],
14: [15, 39],
15: [16, 40],
16: [17, 41],
17: [18, 42],
18: [19, 43],
19: [20, 44],
20: [21, 45],
21: [22, 46],
22: [23, 47],
23: [24, 48],
24: [25, 49],
25: [26, 50],
26: [27, 51],
27: [28, 52],
28: [29, 53],
29: [30, 54],
30: [31, 55],
31: [32, 56],
32: [33, 57],
33: [34, 58],
}
@property
def port_start(self):
return self.PORT_START
@property
def port_end(self):
return self.PORT_END
@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORTS_IN_BLOCK + 1)
@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping
def __init__(self):
eeprom_path = self.BASE_OOM_PATH + "eeprom"
for x in range(0, self.port_end+1):
self.port_to_eeprom_mapping[x] = eeprom_path.format(
self._port_to_i2c_mapping[x][1]
)
SfpUtilBase.__init__(self)
def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
if port_num < 16 :
present_path = self.BASE_CPLD1_PATH + "module_present_" + str(port_num+1)
else:
present_path = self.BASE_CPLD2_PATH + "module_present_" + str(port_num+1)
self.__port_to_is_present = present_path
try:
val_file = open(self.__port_to_is_present)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
content = val_file.readline().rstrip()
val_file.close()
if content == "1":
return True
return False
def get_low_power_mode(self, port_num):
raise NotImplementedError
def set_low_power_mode(self, port_num, lpmode):
raise NotImplementedError
def reset(self, port_num):
if port_num < self.port_start or port_num > self.port_end:
return False
if port_num < 16 :
mod_rst_path = self.BASE_CPLD1_PATH + "module_reset_" + str(port_num+1)
else:
mod_rst_path = self.BASE_CPLD2_PATH + "module_reset_" + str(port_num+1)
self.__port_to_mod_rst = mod_rst_path
try:
reg_file = open(self.__port_to_mod_rst, 'r+')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
reg_value = '1'
reg_file.write(reg_value)
reg_file.close()
return True
def get_transceiver_change_event(self):
"""
TODO: This function need to be implemented
when decide to support monitoring SFP(Xcvrd)
on this platform.
"""
raise NotImplementedError

View File

@ -0,0 +1,4 @@
{
"skip_ledd": true
}