Skip to content

Commit 72d9dfd

Browse files
authored
Merge pull request #1 from Azure/master
merge with master
2 parents 50bba03 + 4d3f44b commit 72d9dfd

File tree

45 files changed

+871
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+871
-132
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ dockers/docker-router-advertiser/Dockerfile
5757
dockers/docker-snmp-sv2/Dockerfile
5858
dockers/docker-teamd/Dockerfile
5959
dockers/docker-sonic-mgmt/Dockerfile
60+
dockers/docker-sonic-telemetry/Dockerfile
6061
platform/*/docker-syncd-*/Dockerfile
6162
platform/*/docker-syncd-*-rpc/Dockerfile
6263
platform/vs/docker-sonic-vs/Dockerfile

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ SONIC_BUILD_INSTRUCTION := make \
7070
USERNAME=$(USERNAME) \
7171
SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \
7272
HTTP_PROXY=$(http_proxy) \
73-
HTTPS_PROXY=$(https_proxy)
73+
HTTPS_PROXY=$(https_proxy) \
74+
ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY)
7475

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

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env python
2+
3+
#############################################################################
4+
# Accton
5+
#
6+
# Module contains an implementation of SONiC PSU Base API and
7+
# provides the PSUs status which are available in the platform
8+
#
9+
#############################################################################
10+
11+
import os.path
12+
13+
try:
14+
from sonic_psu.psu_base import PsuBase
15+
except ImportError as e:
16+
raise ImportError (str(e) + "- required module not found")
17+
18+
class PsuUtil(PsuBase):
19+
"""Platform-specific PSUutil class"""
20+
21+
def __init__(self):
22+
PsuBase.__init__(self)
23+
24+
self.psu_path = "/sys/bus/i2c/devices/"
25+
self.psu_presence = "/psu_present"
26+
self.psu_oper_status = "/psu_power_good"
27+
self.psu_mapping = {
28+
1: "57-0038",
29+
2: "58-003b",
30+
}
31+
32+
def get_num_psus(self):
33+
return len(self.psu_mapping)
34+
35+
def get_psu_status(self, index):
36+
if index is None:
37+
return False
38+
39+
status = 0
40+
node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status
41+
try:
42+
with open(node, 'r') as power_status:
43+
status = int(power_status.read())
44+
except IOError:
45+
return False
46+
47+
return status == 1
48+
49+
def get_psu_presence(self, index):
50+
if index is None:
51+
return False
52+
53+
status = 0
54+
node = self.psu_path + self.psu_mapping[index] + self.psu_presence
55+
try:
56+
with open(node, 'r') as presence_status:
57+
status = int(presence_status.read())
58+
except IOError:
59+
return False
60+
61+
return status == 1

device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py

Lines changed: 88 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -20,84 +20,87 @@ class SfpUtil(SfpUtilBase):
2020
QSFP_PORT_END = 72
2121

2222
BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/"
23+
BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/"
24+
BASE_CPLD2_PATH = "/sys/bus/i2c/devices/0-0061/"
25+
BASE_CPLD3_PATH = "/sys/bus/i2c/devices/0-0062/"
2326

2427
_port_to_is_present = {}
2528
_port_to_lp_mode = {}
2629

2730
_port_to_eeprom_mapping = {}
2831
_port_to_i2c_mapping = {
29-
0: [2, 2],
30-
1: [3, 3],
31-
2: [4, 4],
32-
3: [5, 5],
33-
4: [6, 6],
34-
5: [7, 7],
35-
6: [8, 8],
36-
7: [9, 9],
37-
8: [10, 10],
38-
9: [11, 11],
39-
10: [12, 12],
40-
11: [13, 13],
41-
12: [14, 14],
42-
13: [15, 15],
43-
14: [16, 16],
44-
15: [17, 17],
45-
16: [18, 18],
46-
17: [19, 19],
47-
18: [20, 20],
48-
19: [21, 21],
49-
20: [22, 22],
50-
21: [23, 23],
51-
22: [24, 24],
52-
23: [25, 25],
53-
24: [26, 26],
54-
25: [27, 27],
55-
26: [28, 28],
56-
27: [29, 29],
57-
28: [30, 30],
58-
29: [31, 31],
59-
30: [32, 32],
60-
31: [33, 33],
61-
32: [34, 34],
62-
33: [35, 35],
63-
34: [36, 36],
64-
35: [37, 37],
65-
36: [38, 38],
66-
37: [39, 39],
67-
38: [40, 40],
68-
39: [41, 41],
69-
40: [42, 42],
70-
41: [43, 43],
71-
42: [44, 44],
72-
43: [45, 45],
73-
44: [46, 46],
74-
45: [47, 47],
75-
46: [48, 48],
76-
47: [49, 49],
77-
48: [50, 50], #QSFP49
78-
49: [50, 50],
79-
50: [50, 50],
80-
51: [50, 50],
81-
52: [52, 52], #QSFP50
82-
53: [52, 52],
83-
54: [52, 52],
84-
55: [52, 52],
85-
56: [54, 54], #QSFP51
86-
57: [54, 54],
87-
58: [54, 54],
88-
59: [54, 54],
89-
60: [51, 51], #QSFP52
90-
61: [51, 51],
91-
62: [51, 51],
92-
63: [51, 51],
32+
0: [1, 2],
33+
1: [2, 3],
34+
2: [3, 4],
35+
3: [4, 5],
36+
4: [5, 6],
37+
5: [6, 7],
38+
6: [7, 8],
39+
7: [8, 9],
40+
8: [9, 10],
41+
9: [10, 11],
42+
10: [11, 12],
43+
11: [12, 13],
44+
12: [13, 14],
45+
13: [14, 15],
46+
14: [15, 16],
47+
15: [16, 17],
48+
16: [17, 18],
49+
17: [18, 19],
50+
18: [19, 20],
51+
19: [20, 21],
52+
20: [21, 22],
53+
21: [22, 23],
54+
22: [23, 24],
55+
23: [24, 25],
56+
24: [25, 26],
57+
25: [26, 27],
58+
26: [27, 28],
59+
27: [28, 29],
60+
28: [29, 30],
61+
29: [30, 31],
62+
30: [31, 32],
63+
31: [32, 33],
64+
32: [33, 34],
65+
33: [34, 35],
66+
34: [35, 36],
67+
35: [36, 37],
68+
36: [37, 38],
69+
37: [38, 39],
70+
38: [39, 40],
71+
39: [40, 41],
72+
40: [41, 42],
73+
41: [42, 43],
74+
42: [43, 44],
75+
43: [44, 45],
76+
44: [45, 46],
77+
45: [46, 47],
78+
46: [47, 48],
79+
47: [48, 49],
80+
48: [49, 50],#QSFP49
81+
49: [49, 50],
82+
50: [49, 50],
83+
51: [49, 50],
84+
52: [50, 52],#QSFP50
85+
53: [50, 52],
86+
54: [50, 52],
87+
55: [50, 52],
88+
56: [51, 54],#QSFP51
89+
57: [51, 54],
90+
58: [51, 54],
91+
59: [51, 54],
92+
60: [52, 51],#QSFP52
93+
61: [52, 51],
94+
62: [52, 51],
95+
63: [52, 51],
9396
64: [53, 53], #QSFP53
9497
65: [53, 53],
9598
66: [53, 53],
9699
67: [53, 53],
97-
68: [55, 55], #QSFP54
98-
69: [55, 55],
99-
70: [55, 55],
100-
71: [55, 55],
100+
68: [54, 55],#QSFP54
101+
69: [54, 55],
102+
70: [54, 55],
103+
71: [54, 55],
101104
}
102105

103106
@property
@@ -125,12 +128,12 @@ def port_to_eeprom_mapping(self):
125128
return self._port_to_eeprom_mapping
126129

127130
def __init__(self):
128-
eeprom_path = self.BASE_VAL_PATH + "sfp_eeprom"
131+
eeprom_path = self.BASE_OOM_PATH + "eeprom"
129132

130133
for x in range(0, self.port_end+1):
131134
self.port_to_eeprom_mapping[x] = eeprom_path.format(
132-
self._port_to_i2c_mapping[x][0],
133-
self._port_to_i2c_mapping[x][1])
135+
self._port_to_i2c_mapping[x][1]
136+
)
134137

135138
SfpUtilBase.__init__(self)
136139

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

142-
present_path = self.BASE_VAL_PATH + "sfp_is_present"
143-
self.__port_to_is_present = present_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1])
145+
if port_num < 24:
146+
present_path = self.BASE_CPLD2_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0])
147+
else:
148+
present_path = self.BASE_CPLD3_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0])
149+
150+
self.__port_to_is_present = present_path
151+
144152

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

164-
lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode"
165-
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])
172+
lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0])
166173

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

186-
lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode"
187-
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])
193+
lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0])
188194

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

209-
mod_rst_path = self.BASE_VAL_PATH + "sfp_mod_rst"
210-
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])
215+
mod_rst_path = lp_mode_path = self.BASE_CPLD3_PATH + "module_reset_" + str(self._port_to_i2c_mapping[port_num][0])
216+
211217
try:
212-
reg_file = open(self.__port_to_mod_rst, 'r+')
218+
reg_file = open(mod_rst_path, 'r+')
213219
except IOError as e:
214220
print "Error: unable to open file: %s" % str(e)
215221
return False

device/dell/x86_64-dell_s6000_s1220-r0/installer.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ if [ "$install_env" = "onie" ]; then
55
echo "Replace ONIE reboot with Dell reset commands"
66

77
# set I2C GPIO mux
8-
echo 1 > /sys/class/gpio/export
9-
echo 2 > /sys/class/gpio/export
8+
[ -d /sys/class/gpio/gpio1 ] || echo 1 > /sys/class/gpio/export
9+
[ -d /sys/class/gpio/gpio2 ] || echo 2 > /sys/class/gpio/export
1010
echo out > /sys/class/gpio/gpio1/direction
1111
echo out > /sys/class/gpio/gpio2/direction
1212
echo 0 > /sys/class/gpio/gpio1/value

dockers/docker-fpm-quagga/supervisord.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ command=/usr/bin/start.sh
88
priority=1
99
autostart=true
1010
autorestart=false
11+
startsecs=0
1112
stdout_logfile=syslog
1213
stderr_logfile=syslog
1314

@@ -16,6 +17,7 @@ command=/usr/bin/bgpcfgd
1617
priority=2
1718
autostart=false
1819
autorestart=false
20+
startsecs=0
1921
stdout_logfile=syslog
2022
stderr_logfile=syslog
2123

@@ -24,6 +26,7 @@ command=/usr/sbin/rsyslogd -n
2426
priority=3
2527
autostart=false
2628
autorestart=false
29+
startsecs=0
2730
stdout_logfile=syslog
2831
stderr_logfile=syslog
2932

@@ -32,6 +35,7 @@ command=/usr/lib/quagga/zebra -A 127.0.0.1
3235
priority=4
3336
autostart=false
3437
autorestart=false
38+
startsecs=0
3539
stdout_logfile=syslog
3640
stderr_logfile=syslog
3741

@@ -40,6 +44,7 @@ command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F
4044
priority=5
4145
autostart=false
4246
autorestart=false
47+
startsecs=0
4348
stdout_logfile=syslog
4449
stderr_logfile=syslog
4550

@@ -48,5 +53,6 @@ command=fpmsyncd
4853
priority=6
4954
autostart=false
5055
autorestart=false
56+
startsecs=0
5157
stdout_logfile=syslog
5258
stderr_logfile=syslog

dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ command=/usr/bin/start.sh
88
priority=1
99
autostart=true
1010
autorestart=false
11+
startsecs=0
1112
stdout_logfile=syslog
1213
stderr_logfile=syslog
1314

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
#!/usr/bin/env bash
22

3-
# Generate /etc/radvd.conf config file
4-
sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf
5-
63
rm -f /var/run/rsyslogd.pid
74

85
supervisorctl start rsyslogd
96

7+
# Router advertiser should only run on ToR (T0) devices
8+
DEVICE_ROLE=$(sonic-cfggen -d -v "DEVICE_METADATA.localhost.type")
9+
if [ "$DEVICE_ROLE" != "ToRRouter" ]; then
10+
echo "Device role is not ToRRouter. Not starting router advertiser process."
11+
exit 0
12+
fi
13+
14+
# Generate /etc/radvd.conf config file
15+
sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf
16+
1017
# Start the router advertiser
1118
supervisorctl start radvd

0 commit comments

Comments
 (0)