Skip to content

Commit

Permalink
Add support as4630-54pe device and sdk cfg (#2928)
Browse files Browse the repository at this point in the history
* Add to support as4630-54pe platform

* Add as4630 monitor psu/fan status

* Add support as4630-54pe device and sdk cfg
  • Loading branch information
jostar-yang authored and lguohan committed May 24, 2019
1 parent 62ef859 commit b44eef9
Show file tree
Hide file tree
Showing 9 changed files with 733 additions and 0 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# name lanes alias index
Ethernet0 26 thousandE1 0
Ethernet1 25 thousandE2 1
Ethernet2 28 thousandE3 2
Ethernet3 27 thousandE4 3
Ethernet4 30 thousandE5 4
Ethernet5 29 thousandE6 5
Ethernet6 32 thousandE7 6
Ethernet7 31 thousandE8 7
Ethernet8 38 thousandE9 8
Ethernet9 37 thousandE10 9
Ethernet10 40 thousandE11 10
Ethernet11 39 thousandE12 11
Ethernet12 34 thousandE13 12
Ethernet13 33 thousandE14 13
Ethernet14 36 thousandE15 14
Ethernet15 35 thousandE16 15
Ethernet16 46 thousandE17 16
Ethernet17 45 thousandE18 17
Ethernet18 48 thousandE19 18
Ethernet19 47 thousandE20 19
Ethernet20 42 thousandE21 20
Ethernet21 41 thousandE22 21
Ethernet22 44 thousandE23 22
Ethernet23 43 thousandE24 23
Ethernet24 2 thousandE25 24
Ethernet25 1 thousandE26 25
Ethernet26 4 thousandE27 26
Ethernet27 3 thousandE28 27
Ethernet28 6 thousandE29 28
Ethernet29 5 thousandE30 29
Ethernet30 8 thousandE31 30
Ethernet31 7 thousandE32 31
Ethernet32 10 thousandE33 32
Ethernet33 9 thousandE34 33
Ethernet34 12 thousandE35 34
Ethernet35 11 thousandE36 35
Ethernet36 14 thousandE37 36
Ethernet37 13 thousandE38 37
Ethernet38 16 thousandE39 38
Ethernet39 15 thousandE40 39
Ethernet40 18 thousandE41 40
Ethernet41 17 thousandE42 41
Ethernet42 20 thousandE43 42
Ethernet43 19 thousandE44 43
Ethernet44 22 thousandE45 44
Ethernet45 21 thousandE46 45
Ethernet46 24 thousandE47 46
Ethernet47 23 thousandE48 47
Ethernet48 67 twentyfiveGigE49 48
Ethernet49 66 twentyfiveGigE50 49
Ethernet50 65 twentyfiveGigE51 50
Ethernet51 68 twentyfiveGigE52 51
Ethernet52 73,74,75,76 hundredGigE53 52
Ethernet56 69,70,71,72 hundredGigE54 56
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/hx5-as4630-48x1G+4x25G+2x100G.bcm
1 change: 1 addition & 0 deletions device/accton/x86_64-accton_as4630_54pe-r0/default_sku
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Accton-AS4630-54PE t1
3 changes: 3 additions & 0 deletions device/accton/x86_64-accton_as4630_54pe-r0/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=115200
2 changes: 2 additions & 0 deletions device/accton/x86_64-accton_as4630_54pe-r0/led_proc_init.soc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
led start
led auto on
21 changes: 21 additions & 0 deletions device/accton/x86_64-accton_as4630_54pe-r0/plugins/eeprom.py
Original file line number Diff line number Diff line change
@@ -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/1-0057/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)
61 changes: 61 additions & 0 deletions device/accton/x86_64-accton_as4630_54pe-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
@@ -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 = {
1: "10-0050",
2: "11-0051",
}

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
103 changes: 103 additions & 0 deletions device/accton/x86_64-accton_as4630_54pe-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# 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 = 48
PORT_END = 53
PORTS_IN_BLOCK = 54

BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/"
BASE_CPLD_PATH = "/sys/bus/i2c/devices/3-0060/"

_port_to_is_present = {}
_port_to_lp_mode = {}

_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
48: [18],
49: [19],
50: [20],
51: [21],
52: [22],
53: [23],
}

@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):
if x < 48:
self.port_to_eeprom_mapping[x] = eeprom_path.format(0)
else:
self.port_to_eeprom_mapping[x] = eeprom_path.format(
self._port_to_i2c_mapping[x][0])

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

present_path = self.BASE_CPLD_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()

# content is a string, either "0" or "1"
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):
raise NotImplementedError

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

0 comments on commit b44eef9

Please sign in to comment.