Skip to content

Commit

Permalink
Merge pull request #1 from Azure/master
Browse files Browse the repository at this point in the history
merge with master
  • Loading branch information
simonJi2018 authored Apr 8, 2018
2 parents 50bba03 + 4d3f44b commit 72d9dfd
Show file tree
Hide file tree
Showing 45 changed files with 871 additions and 132 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dockers/docker-router-advertiser/Dockerfile
dockers/docker-snmp-sv2/Dockerfile
dockers/docker-teamd/Dockerfile
dockers/docker-sonic-mgmt/Dockerfile
dockers/docker-sonic-telemetry/Dockerfile
platform/*/docker-syncd-*/Dockerfile
platform/*/docker-syncd-*-rpc/Dockerfile
platform/vs/docker-sonic-vs/Dockerfile
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ SONIC_BUILD_INSTRUCTION := make \
USERNAME=$(USERNAME) \
SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \
HTTP_PROXY=$(http_proxy) \
HTTPS_PROXY=$(https_proxy)
HTTPS_PROXY=$(https_proxy) \
ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY)

.PHONY: sonic-slave-build sonic-slave-bash init reset

Expand Down
61 changes: 61 additions & 0 deletions device/accton/x86_64-accton_as5712_54x-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: "57-0038",
2: "58-003b",
}

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
170 changes: 88 additions & 82 deletions device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,84 +20,87 @@ class SfpUtil(SfpUtilBase):
QSFP_PORT_END = 72

BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/"
BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/"
BASE_CPLD2_PATH = "/sys/bus/i2c/devices/0-0061/"
BASE_CPLD3_PATH = "/sys/bus/i2c/devices/0-0062/"

_port_to_is_present = {}
_port_to_lp_mode = {}

_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
0: [2, 2],
1: [3, 3],
2: [4, 4],
3: [5, 5],
4: [6, 6],
5: [7, 7],
6: [8, 8],
7: [9, 9],
8: [10, 10],
9: [11, 11],
10: [12, 12],
11: [13, 13],
12: [14, 14],
13: [15, 15],
14: [16, 16],
15: [17, 17],
16: [18, 18],
17: [19, 19],
18: [20, 20],
19: [21, 21],
20: [22, 22],
21: [23, 23],
22: [24, 24],
23: [25, 25],
24: [26, 26],
25: [27, 27],
26: [28, 28],
27: [29, 29],
28: [30, 30],
29: [31, 31],
30: [32, 32],
31: [33, 33],
32: [34, 34],
33: [35, 35],
34: [36, 36],
35: [37, 37],
36: [38, 38],
37: [39, 39],
38: [40, 40],
39: [41, 41],
40: [42, 42],
41: [43, 43],
42: [44, 44],
43: [45, 45],
44: [46, 46],
45: [47, 47],
46: [48, 48],
47: [49, 49],
48: [50, 50], #QSFP49
49: [50, 50],
50: [50, 50],
51: [50, 50],
52: [52, 52], #QSFP50
53: [52, 52],
54: [52, 52],
55: [52, 52],
56: [54, 54], #QSFP51
57: [54, 54],
58: [54, 54],
59: [54, 54],
60: [51, 51], #QSFP52
61: [51, 51],
62: [51, 51],
63: [51, 51],
0: [1, 2],
1: [2, 3],
2: [3, 4],
3: [4, 5],
4: [5, 6],
5: [6, 7],
6: [7, 8],
7: [8, 9],
8: [9, 10],
9: [10, 11],
10: [11, 12],
11: [12, 13],
12: [13, 14],
13: [14, 15],
14: [15, 16],
15: [16, 17],
16: [17, 18],
17: [18, 19],
18: [19, 20],
19: [20, 21],
20: [21, 22],
21: [22, 23],
22: [23, 24],
23: [24, 25],
24: [25, 26],
25: [26, 27],
26: [27, 28],
27: [28, 29],
28: [29, 30],
29: [30, 31],
30: [31, 32],
31: [32, 33],
32: [33, 34],
33: [34, 35],
34: [35, 36],
35: [36, 37],
36: [37, 38],
37: [38, 39],
38: [39, 40],
39: [40, 41],
40: [41, 42],
41: [42, 43],
42: [43, 44],
43: [44, 45],
44: [45, 46],
45: [46, 47],
46: [47, 48],
47: [48, 49],
48: [49, 50],#QSFP49
49: [49, 50],
50: [49, 50],
51: [49, 50],
52: [50, 52],#QSFP50
53: [50, 52],
54: [50, 52],
55: [50, 52],
56: [51, 54],#QSFP51
57: [51, 54],
58: [51, 54],
59: [51, 54],
60: [52, 51],#QSFP52
61: [52, 51],
62: [52, 51],
63: [52, 51],
64: [53, 53], #QSFP53
65: [53, 53],
66: [53, 53],
67: [53, 53],
68: [55, 55], #QSFP54
69: [55, 55],
70: [55, 55],
71: [55, 55],
68: [54, 55],#QSFP54
69: [54, 55],
70: [54, 55],
71: [54, 55],
}

@property
Expand Down Expand Up @@ -125,12 +128,12 @@ def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping

def __init__(self):
eeprom_path = self.BASE_VAL_PATH + "sfp_eeprom"
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][0],
self._port_to_i2c_mapping[x][1])
self._port_to_i2c_mapping[x][1]
)

SfpUtilBase.__init__(self)

Expand All @@ -139,8 +142,13 @@ def get_presence(self, port_num):
if port_num < self.port_start or port_num > self.port_end:
return False

present_path = self.BASE_VAL_PATH + "sfp_is_present"
self.__port_to_is_present = present_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1])
if port_num < 24:
present_path = self.BASE_CPLD2_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0])
else:
present_path = self.BASE_CPLD3_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0])

self.__port_to_is_present = present_path


try:
val_file = open(self.__port_to_is_present)
Expand All @@ -161,11 +169,10 @@ def get_low_power_mode(self, port_num):
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False

lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode"
self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1])
lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0])

try:
val_file = open(self.__port_to_lp_mode)
val_file = open(lp_mode_path)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
Expand All @@ -183,11 +190,10 @@ def set_low_power_mode(self, port_num, lpmode):
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False

lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode"
self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1])
lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0])

try:
reg_file = open(self.__port_to_lp_mode, 'r+')
reg_file = open(lp_mode_path, 'r+')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
Expand All @@ -206,10 +212,10 @@ def reset(self, port_num):
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False

mod_rst_path = self.BASE_VAL_PATH + "sfp_mod_rst"
self.__port_to_mod_rst = mod_rst_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1])
mod_rst_path = lp_mode_path = self.BASE_CPLD3_PATH + "module_reset_" + str(self._port_to_i2c_mapping[port_num][0])

try:
reg_file = open(self.__port_to_mod_rst, 'r+')
reg_file = open(mod_rst_path, 'r+')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
Expand Down
4 changes: 2 additions & 2 deletions device/dell/x86_64-dell_s6000_s1220-r0/installer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ if [ "$install_env" = "onie" ]; then
echo "Replace ONIE reboot with Dell reset commands"

# set I2C GPIO mux
echo 1 > /sys/class/gpio/export
echo 2 > /sys/class/gpio/export
[ -d /sys/class/gpio/gpio1 ] || echo 1 > /sys/class/gpio/export
[ -d /sys/class/gpio/gpio2 ] || echo 2 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1/direction
echo out > /sys/class/gpio/gpio2/direction
echo 0 > /sys/class/gpio/gpio1/value
Expand Down
6 changes: 6 additions & 0 deletions dockers/docker-fpm-quagga/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog

Expand All @@ -16,6 +17,7 @@ command=/usr/bin/bgpcfgd
priority=2
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog

Expand All @@ -24,6 +26,7 @@ command=/usr/sbin/rsyslogd -n
priority=3
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog

Expand All @@ -32,6 +35,7 @@ command=/usr/lib/quagga/zebra -A 127.0.0.1
priority=4
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog

Expand All @@ -40,6 +44,7 @@ command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F
priority=5
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog

Expand All @@ -48,5 +53,6 @@ command=fpmsyncd
priority=6
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog

Expand Down
13 changes: 10 additions & 3 deletions dockers/docker-router-advertiser/start.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/usr/bin/env bash

# Generate /etc/radvd.conf config file
sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf

rm -f /var/run/rsyslogd.pid

supervisorctl start rsyslogd

# Router advertiser should only run on ToR (T0) devices
DEVICE_ROLE=$(sonic-cfggen -d -v "DEVICE_METADATA.localhost.type")
if [ "$DEVICE_ROLE" != "ToRRouter" ]; then
echo "Device role is not ToRRouter. Not starting router advertiser process."
exit 0
fi

# Generate /etc/radvd.conf config file
sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf

# Start the router advertiser
supervisorctl start radvd
Loading

0 comments on commit 72d9dfd

Please sign in to comment.