[Quanta][IX7,IX8,IX8C] Correct port index (#3327)

Verified with index from 1

Signed-off-by: Jonathan Tsai <jonathan.tsai@quantatw.com>
This commit is contained in:
Jonathan Tsai 2019-08-15 15:46:34 +08:00 committed by lguohan
parent d6b4223bdd
commit d49e1dcdb0
6 changed files with 371 additions and 346 deletions

View File

@ -1,33 +1,33 @@
# name lanes alias index speed
Ethernet0 29,30,31,32 hundredGigE1 0 100000
Ethernet4 33,34,35,36 hundredGigE2 1 100000
Ethernet8 41,42,43,44 hundredGigE3 2 100000
Ethernet12 45,46,47,48 hundredGigE4 3 100000
Ethernet16 1,2,3,4 hundredGigE5 4 100000
Ethernet20 5,6,7,8 hundredGigE6 5 100000
Ethernet24 9,10,11,12 hundredGigE7 6 100000
Ethernet28 13,14,15,16 hundredGigE8 7 100000
Ethernet32 17,18,19,20 hundredGigE9 8 100000
Ethernet36 21,22,23,24 hundredGigE10 9 100000
Ethernet40 25,26,27,28 hundredGigE11 10 100000
Ethernet44 37,38,39,40 hundredGigE12 11 100000
Ethernet48 49,50,51,52 hundredGigE13 12 100000
Ethernet52 53,54,55,56 hundredGigE14 13 100000
Ethernet56 57,58,59,60 hundredGigE15 14 100000
Ethernet60 61,62,63,64 hundredGigE16 15 100000
Ethernet64 65,66,67,68 hundredGigE17 16 100000
Ethernet68 69,70,71,72 hundredGigE18 17 100000
Ethernet72 73,74,75,76 hundredGigE19 18 100000
Ethernet76 77,78,79,80 hundredGigE20 19 100000
Ethernet80 93,94,95,96 hundredGigE21 20 100000
Ethernet84 101,102,103,104 hundredGigE22 21 100000
Ethernet88 105,106,107,108 hundredGigE23 22 100000
Ethernet92 109,110,111,112 hundredGigE24 23 100000
Ethernet96 113,114,115,116 hundredGigE25 24 100000
Ethernet100 117,118,119,120 hundredGigE26 25 100000
Ethernet104 121,122,123,124 hundredGigE27 26 100000
Ethernet108 125,126,127,128 hundredGigE28 27 100000
Ethernet112 81,82,83,84 hundredGigE29 28 100000
Ethernet116 85,86,87,88 hundredGigE30 29 100000
Ethernet120 89,90,91,92 hundredGigE31 30 100000
Ethernet124 97,98,99,100 hundredGigE32 31 100000
Ethernet0 29,30,31,32 hundredGigE1 1 100000
Ethernet4 33,34,35,36 hundredGigE2 2 100000
Ethernet8 41,42,43,44 hundredGigE3 3 100000
Ethernet12 45,46,47,48 hundredGigE4 4 100000
Ethernet16 1,2,3,4 hundredGigE5 5 100000
Ethernet20 5,6,7,8 hundredGigE6 6 100000
Ethernet24 9,10,11,12 hundredGigE7 7 100000
Ethernet28 13,14,15,16 hundredGigE8 8 100000
Ethernet32 17,18,19,20 hundredGigE9 9 100000
Ethernet36 21,22,23,24 hundredGigE10 10 100000
Ethernet40 25,26,27,28 hundredGigE11 11 100000
Ethernet44 37,38,39,40 hundredGigE12 12 100000
Ethernet48 49,50,51,52 hundredGigE13 13 100000
Ethernet52 53,54,55,56 hundredGigE14 14 100000
Ethernet56 57,58,59,60 hundredGigE15 15 100000
Ethernet60 61,62,63,64 hundredGigE16 16 100000
Ethernet64 65,66,67,68 hundredGigE17 17 100000
Ethernet68 69,70,71,72 hundredGigE18 18 100000
Ethernet72 73,74,75,76 hundredGigE19 19 100000
Ethernet76 77,78,79,80 hundredGigE20 20 100000
Ethernet80 93,94,95,96 hundredGigE21 21 100000
Ethernet84 101,102,103,104 hundredGigE22 22 100000
Ethernet88 105,106,107,108 hundredGigE23 23 100000
Ethernet92 109,110,111,112 hundredGigE24 24 100000
Ethernet96 113,114,115,116 hundredGigE25 25 100000
Ethernet100 117,118,119,120 hundredGigE26 26 100000
Ethernet104 121,122,123,124 hundredGigE27 27 100000
Ethernet108 125,126,127,128 hundredGigE28 28 100000
Ethernet112 81,82,83,84 hundredGigE29 29 100000
Ethernet116 85,86,87,88 hundredGigE30 30 100000
Ethernet120 89,90,91,92 hundredGigE31 31 100000
Ethernet124 97,98,99,100 hundredGigE32 32 100000

View File

@ -1,53 +1,58 @@
#!/usr/bin/env python
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
import string
from ctypes import create_string_buffer
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
class SfpUtil(SfpUtilBase):
"""Platform specific SfpUtill class"""
"""Platform-specific SfpUtil class"""
PORT_START = 0
PORT_END = 31
PORT_START = 1
PORT_END = 32
PORTS_IN_BLOCK = 32
_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
0 : 32,
1 : 33,
2 : 34,
3 : 35,
4 : 36,
5 : 37,
6 : 38,
7 : 39,
8 : 40,
9 : 41,
10 : 42,
11 : 43,
12 : 44,
13 : 45,
14 : 46,
15 : 47,
16 : 48,
17 : 49,
18 : 50,
19 : 51,
20 : 52,
21 : 53,
22 : 54,
23 : 55,
24 : 56,
25 : 57,
26 : 58,
27 : 59,
28 : 60,
29 : 61,
30 : 62,
31 : 63,
1 : 32,
2 : 33,
3 : 34,
4 : 35,
5 : 36,
6 : 37,
7 : 38,
8 : 39,
9 : 40,
10 : 41,
11 : 42,
12 : 43,
13 : 44,
14 : 45,
15 : 46,
16 : 47,
17 : 48,
18 : 49,
19 : 50,
20 : 51,
21 : 52,
22 : 53,
23 : 54,
24 : 55,
25 : 56,
26 : 57,
27 : 58,
28 : 59,
29 : 60,
30 : 61,
31 : 62,
32 : 63,
}
@property
@ -68,17 +73,17 @@ class SfpUtil(SfpUtilBase):
def __init__(self):
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom'
for x in range(0, self.port_end+1):
for x in range(self.port_start, self.port_end+1):
self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x])
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:
if port_num < self.port_start or port_num > self.port_end:
return False
try:
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/module_present")
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num)+"/module_present")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -95,7 +100,7 @@ class SfpUtil(SfpUtilBase):
return False
try:
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/lpmode")
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num)+"/lpmode")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -113,7 +118,7 @@ class SfpUtil(SfpUtilBase):
return False
try:
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/lpmode", "r+")
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num)+"/lpmode", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -137,7 +142,7 @@ class SfpUtil(SfpUtilBase):
return False
try:
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/reset", "r+")
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num)+"/reset", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -151,7 +156,7 @@ class SfpUtil(SfpUtilBase):
# Flip the value back write back to the register to take port out of reset
try:
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/reset", "r+")
reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num)+"/reset", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

View File

@ -1,57 +1,57 @@
# name lanes alias index speed
Ethernet0 60 twentyfiveGigE1 0 25000
Ethernet1 59 twentyfiveGigE2 1 25000
Ethernet2 58 twentyfiveGigE3 2 25000
Ethernet3 57 twentyfiveGigE4 3 25000
Ethernet4 64 twentyfiveGigE5 4 25000
Ethernet5 63 twentyfiveGigE6 5 25000
Ethernet6 62 twentyfiveGigE7 6 25000
Ethernet7 61 twentyfiveGigE8 7 25000
Ethernet8 49 twentyfiveGigE9 8 25000
Ethernet9 50 twentyfiveGigE10 9 25000
Ethernet10 51 twentyfiveGigE11 10 25000
Ethernet11 52 twentyfiveGigE12 11 25000
Ethernet12 4 twentyfiveGigE13 12 25000
Ethernet13 3 twentyfiveGigE14 13 25000
Ethernet14 2 twentyfiveGigE15 14 25000
Ethernet15 1 twentyfiveGigE16 15 25000
Ethernet16 8 twentyfiveGigE17 16 25000
Ethernet17 7 twentyfiveGigE18 17 25000
Ethernet18 6 twentyfiveGigE19 18 25000
Ethernet19 5 twentyfiveGigE20 19 25000
Ethernet20 16 twentyfiveGigE21 20 25000
Ethernet21 15 twentyfiveGigE22 21 25000
Ethernet22 14 twentyfiveGigE23 22 25000
Ethernet23 13 twentyfiveGigE24 23 25000
Ethernet24 24 twentyfiveGigE25 24 25000
Ethernet25 23 twentyfiveGigE26 25 25000
Ethernet26 22 twentyfiveGigE27 26 25000
Ethernet27 21 twentyfiveGigE28 27 25000
Ethernet28 32 twentyfiveGigE29 28 25000
Ethernet29 31 twentyfiveGigE30 29 25000
Ethernet30 30 twentyfiveGigE31 30 25000
Ethernet31 29 twentyfiveGigE32 31 25000
Ethernet32 36 twentyfiveGigE33 32 25000
Ethernet33 35 twentyfiveGigE34 33 25000
Ethernet34 34 twentyfiveGigE35 34 25000
Ethernet35 33 twentyfiveGigE36 35 25000
Ethernet36 44 twentyfiveGigE37 36 25000
Ethernet37 43 twentyfiveGigE38 37 25000
Ethernet38 42 twentyfiveGigE39 38 25000
Ethernet39 41 twentyfiveGigE40 39 25000
Ethernet40 86 twentyfiveGigE41 40 25000
Ethernet41 85 twentyfiveGigE42 41 25000
Ethernet42 88 twentyfiveGigE43 42 25000
Ethernet43 87 twentyfiveGigE44 43 25000
Ethernet44 94 twentyfiveGigE45 44 25000
Ethernet45 93 twentyfiveGigE46 45 25000
Ethernet46 96 twentyfiveGigE47 46 25000
Ethernet47 95 twentyfiveGigE48 47 25000
Ethernet48 97,98,99,100 hundredGigE49 48 100000
Ethernet52 105,106,107,108 hundredGigE50 49 100000
Ethernet56 113,114,115,116 hundredGigE51 50 100000
Ethernet60 121,122,123,124 hundredGigE52 51 100000
Ethernet64 77,78,79,80 hundredGigE53 52 100000
Ethernet68 65,66,67,68 hundredGigE54 53 100000
Ethernet72 69,70,71,72 hundredGigE55 54 100000
Ethernet76 125,126,127,128 hundredGigE56 55 100000
Ethernet0 60 twentyfiveGigE1 1 25000
Ethernet1 59 twentyfiveGigE2 2 25000
Ethernet2 58 twentyfiveGigE3 3 25000
Ethernet3 57 twentyfiveGigE4 4 25000
Ethernet4 64 twentyfiveGigE5 5 25000
Ethernet5 63 twentyfiveGigE6 6 25000
Ethernet6 62 twentyfiveGigE7 7 25000
Ethernet7 61 twentyfiveGigE8 8 25000
Ethernet8 49 twentyfiveGigE9 9 25000
Ethernet9 50 twentyfiveGigE10 10 25000
Ethernet10 51 twentyfiveGigE11 11 25000
Ethernet11 52 twentyfiveGigE12 12 25000
Ethernet12 4 twentyfiveGigE13 13 25000
Ethernet13 3 twentyfiveGigE14 14 25000
Ethernet14 2 twentyfiveGigE15 15 25000
Ethernet15 1 twentyfiveGigE16 16 25000
Ethernet16 8 twentyfiveGigE17 17 25000
Ethernet17 7 twentyfiveGigE18 18 25000
Ethernet18 6 twentyfiveGigE19 19 25000
Ethernet19 5 twentyfiveGigE20 20 25000
Ethernet20 16 twentyfiveGigE21 21 25000
Ethernet21 15 twentyfiveGigE22 22 25000
Ethernet22 14 twentyfiveGigE23 23 25000
Ethernet23 13 twentyfiveGigE24 24 25000
Ethernet24 24 twentyfiveGigE25 25 25000
Ethernet25 23 twentyfiveGigE26 26 25000
Ethernet26 22 twentyfiveGigE27 27 25000
Ethernet27 21 twentyfiveGigE28 28 25000
Ethernet28 32 twentyfiveGigE29 29 25000
Ethernet29 31 twentyfiveGigE30 30 25000
Ethernet30 30 twentyfiveGigE31 31 25000
Ethernet31 29 twentyfiveGigE32 32 25000
Ethernet32 36 twentyfiveGigE33 33 25000
Ethernet33 35 twentyfiveGigE34 34 25000
Ethernet34 34 twentyfiveGigE35 35 25000
Ethernet35 33 twentyfiveGigE36 36 25000
Ethernet36 44 twentyfiveGigE37 37 25000
Ethernet37 43 twentyfiveGigE38 38 25000
Ethernet38 42 twentyfiveGigE39 39 25000
Ethernet39 41 twentyfiveGigE40 40 25000
Ethernet40 86 twentyfiveGigE41 41 25000
Ethernet41 85 twentyfiveGigE42 42 25000
Ethernet42 88 twentyfiveGigE43 43 25000
Ethernet43 87 twentyfiveGigE44 44 25000
Ethernet44 94 twentyfiveGigE45 45 25000
Ethernet45 93 twentyfiveGigE46 46 25000
Ethernet46 96 twentyfiveGigE47 47 25000
Ethernet47 95 twentyfiveGigE48 48 25000
Ethernet48 97,98,99,100 hundredGigE49 49 100000
Ethernet52 105,106,107,108 hundredGigE50 50 100000
Ethernet56 113,114,115,116 hundredGigE51 51 100000
Ethernet60 121,122,123,124 hundredGigE52 52 100000
Ethernet64 77,78,79,80 hundredGigE53 53 100000
Ethernet68 65,66,67,68 hundredGigE54 54 100000
Ethernet72 69,70,71,72 hundredGigE55 55 100000
Ethernet76 125,126,127,128 hundredGigE56 56 100000

View File

@ -1,91 +1,101 @@
#!/usr/bin/env python
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
import string
from ctypes import create_string_buffer
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
class SfpUtil(SfpUtilBase):
"""Platform specific SfpUtill class"""
"""Platform-specific SfpUtil class"""
PORT_START = 0
PORT_END = 55
QSFP_PORT_START = 48
PORT_START = 1
PORT_END = 56
PORTS_IN_BLOCK = 56
QSFP_PORT_START = 49
QSFP_PORT_END = 56
_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
0 : 32,
1 : 33,
2 : 34,
3 : 35,
4 : 36,
5 : 37,
6 : 38,
7 : 39,
8 : 40,
9 : 41,
10 : 42,
11 : 43,
12 : 44,
13 : 45,
14 : 46,
15 : 47,
16 : 48,
17 : 49,
18 : 50,
19 : 51,
20 : 52,
21 : 53,
22 : 54,
23 : 55,
24 : 56,
25 : 57,
26 : 58,
27 : 59,
28 : 60,
29 : 61,
30 : 62,
31 : 63,
32 : 64,
33 : 65,
34 : 66,
35 : 67,
36 : 68,
37 : 69,
38 : 70,
39 : 71,
40 : 72,
41 : 73,
42 : 74,
43 : 75,
44 : 76,
45 : 77,
46 : 78,
47 : 79,
48 : 80,#QSFP49
49 : 81,#QSFP50
50 : 82,#QSFP51
51 : 83,#QSFP52
52 : 84,#QSFP53
53 : 85,#QSFP54
54 : 86,#QSFP55
55 : 87,#QSFP56
1 : 32,
2 : 33,
3 : 34,
4 : 35,
5 : 36,
6 : 37,
7 : 38,
8 : 39,
9 : 40,
10 : 41,
11 : 42,
12 : 43,
13 : 44,
14 : 45,
15 : 46,
16 : 47,
17 : 48,
18 : 49,
19 : 50,
20 : 51,
21 : 52,
22 : 53,
23 : 54,
24 : 55,
25 : 56,
26 : 57,
27 : 58,
28 : 59,
29 : 60,
30 : 61,
31 : 62,
32 : 63,
33 : 64,
34 : 65,
35 : 66,
36 : 67,
37 : 68,
38 : 69,
39 : 70,
40 : 71,
41 : 72,
42 : 73,
43 : 74,
44 : 75,
45 : 76,
46 : 77,
47 : 78,
48 : 79,
49 : 80,#QSFP49
50 : 81,#QSFP50
51 : 82,#QSFP51
52 : 83,#QSFP52
53 : 84,#QSFP53
54 : 85,#QSFP54
55 : 86,#QSFP55
56 : 87,#QSFP56
}
@property
def port_start(self):
return self.PORT_START
@property
def port_end(self):
return self.PORT_END
@property
def qsfp_port_start(self):
return self.QSFP_PORT_START
@property
def port_end(self):
return self.PORT_END
def qsfp_port_end(self):
return self.QSFP_PORT_END
@property
def qsfp_ports(self):
@ -97,26 +107,26 @@ class SfpUtil(SfpUtilBase):
def __init__(self):
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom'
for x in range(0, self.port_end+1):
for x in range(self.port_start, self.port_end+1):
self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x])
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:
if port_num < self.port_start or port_num > self.port_end:
return False
try:
if port_num < 48:
reg_file = open("/sys/class/cpld-sfp28/port-"+str(port_num+1)+"/pre_n")
if port_num < self.qsfp_port_start:
reg_file = open("/sys/class/cpld-sfp28/port-"+str(port_num)+"/pre_n")
else:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+34)+"/value")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+34)+"/value")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
reg_value = reg_file.readline().rstrip()
if port_num < 48:
if port_num < self.qsfp_port_start:
if reg_value == '1':
return True
else:
@ -127,11 +137,11 @@ class SfpUtil(SfpUtilBase):
def get_low_power_mode(self, port_num):
# Check for invalid port_num
if port_num < self.qsfp_port_start or port_num > self.port_end:
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False
try:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+35)+"/value")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+35)+"/value")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -145,11 +155,11 @@ class SfpUtil(SfpUtilBase):
def set_low_power_mode(self, port_num, lpmode):
# Check for invalid port_num
if port_num < self.qsfp_port_start or port_num > self.port_end:
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False
try:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+35)+"/value", "r+")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+35)+"/value", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -173,7 +183,7 @@ class SfpUtil(SfpUtilBase):
return False
try:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+32)+"/value", "r+")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+32)+"/value", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -187,7 +197,7 @@ class SfpUtil(SfpUtilBase):
# Flip the value back write back to the register to take port out of reset
try:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+32)+"/value", "r+")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+32)+"/value", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

View File

@ -1,57 +1,57 @@
# name lanes alias index speed
Ethernet0 60 twentyfiveGigE1 0 25000
Ethernet1 59 twentyfiveGigE2 1 25000
Ethernet2 58 twentyfiveGigE3 2 25000
Ethernet3 57 twentyfiveGigE4 3 25000
Ethernet4 64 twentyfiveGigE5 4 25000
Ethernet5 63 twentyfiveGigE6 5 25000
Ethernet6 62 twentyfiveGigE7 6 25000
Ethernet7 61 twentyfiveGigE8 7 25000
Ethernet8 49 twentyfiveGigE9 8 25000
Ethernet9 50 twentyfiveGigE10 9 25000
Ethernet10 51 twentyfiveGigE11 10 25000
Ethernet11 52 twentyfiveGigE12 11 25000
Ethernet12 4 twentyfiveGigE13 12 25000
Ethernet13 3 twentyfiveGigE14 13 25000
Ethernet14 2 twentyfiveGigE15 14 25000
Ethernet15 1 twentyfiveGigE16 15 25000
Ethernet16 8 twentyfiveGigE17 16 25000
Ethernet17 7 twentyfiveGigE18 17 25000
Ethernet18 6 twentyfiveGigE19 18 25000
Ethernet19 5 twentyfiveGigE20 19 25000
Ethernet20 16 twentyfiveGigE21 20 25000
Ethernet21 15 twentyfiveGigE22 21 25000
Ethernet22 14 twentyfiveGigE23 22 25000
Ethernet23 13 twentyfiveGigE24 23 25000
Ethernet24 24 twentyfiveGigE25 24 25000
Ethernet25 23 twentyfiveGigE26 25 25000
Ethernet26 22 twentyfiveGigE27 26 25000
Ethernet27 21 twentyfiveGigE28 27 25000
Ethernet28 32 twentyfiveGigE29 28 25000
Ethernet29 31 twentyfiveGigE30 29 25000
Ethernet30 30 twentyfiveGigE31 30 25000
Ethernet31 29 twentyfiveGigE32 31 25000
Ethernet32 36 twentyfiveGigE33 32 25000
Ethernet33 35 twentyfiveGigE34 33 25000
Ethernet34 34 twentyfiveGigE35 34 25000
Ethernet35 33 twentyfiveGigE36 35 25000
Ethernet36 44 twentyfiveGigE37 36 25000
Ethernet37 43 twentyfiveGigE38 37 25000
Ethernet38 42 twentyfiveGigE39 38 25000
Ethernet39 41 twentyfiveGigE40 39 25000
Ethernet40 86 twentyfiveGigE41 40 25000
Ethernet41 85 twentyfiveGigE42 41 25000
Ethernet42 88 twentyfiveGigE43 42 25000
Ethernet43 87 twentyfiveGigE44 43 25000
Ethernet44 94 twentyfiveGigE45 44 25000
Ethernet45 93 twentyfiveGigE46 45 25000
Ethernet46 96 twentyfiveGigE47 46 25000
Ethernet47 95 twentyfiveGigE48 47 25000
Ethernet48 97,98,99,100 hundredGigE49 48 100000
Ethernet52 105,106,107,108 hundredGigE50 49 100000
Ethernet56 113,114,115,116 hundredGigE51 50 100000
Ethernet60 121,122,123,124 hundredGigE52 51 100000
Ethernet64 77,78,79,80 hundredGigE53 52 100000
Ethernet68 65,66,67,68 hundredGigE54 53 100000
Ethernet72 69,70,71,72 hundredGigE55 54 100000
Ethernet76 125,126,127,128 hundredGigE56 55 100000
Ethernet0 60 twentyfiveGigE1 1 25000
Ethernet1 59 twentyfiveGigE2 2 25000
Ethernet2 58 twentyfiveGigE3 3 25000
Ethernet3 57 twentyfiveGigE4 4 25000
Ethernet4 64 twentyfiveGigE5 5 25000
Ethernet5 63 twentyfiveGigE6 6 25000
Ethernet6 62 twentyfiveGigE7 7 25000
Ethernet7 61 twentyfiveGigE8 8 25000
Ethernet8 49 twentyfiveGigE9 9 25000
Ethernet9 50 twentyfiveGigE10 10 25000
Ethernet10 51 twentyfiveGigE11 11 25000
Ethernet11 52 twentyfiveGigE12 12 25000
Ethernet12 4 twentyfiveGigE13 13 25000
Ethernet13 3 twentyfiveGigE14 14 25000
Ethernet14 2 twentyfiveGigE15 15 25000
Ethernet15 1 twentyfiveGigE16 16 25000
Ethernet16 8 twentyfiveGigE17 17 25000
Ethernet17 7 twentyfiveGigE18 18 25000
Ethernet18 6 twentyfiveGigE19 19 25000
Ethernet19 5 twentyfiveGigE20 20 25000
Ethernet20 16 twentyfiveGigE21 21 25000
Ethernet21 15 twentyfiveGigE22 22 25000
Ethernet22 14 twentyfiveGigE23 23 25000
Ethernet23 13 twentyfiveGigE24 24 25000
Ethernet24 24 twentyfiveGigE25 25 25000
Ethernet25 23 twentyfiveGigE26 26 25000
Ethernet26 22 twentyfiveGigE27 27 25000
Ethernet27 21 twentyfiveGigE28 28 25000
Ethernet28 32 twentyfiveGigE29 29 25000
Ethernet29 31 twentyfiveGigE30 30 25000
Ethernet30 30 twentyfiveGigE31 31 25000
Ethernet31 29 twentyfiveGigE32 32 25000
Ethernet32 36 twentyfiveGigE33 33 25000
Ethernet33 35 twentyfiveGigE34 34 25000
Ethernet34 34 twentyfiveGigE35 35 25000
Ethernet35 33 twentyfiveGigE36 36 25000
Ethernet36 44 twentyfiveGigE37 37 25000
Ethernet37 43 twentyfiveGigE38 38 25000
Ethernet38 42 twentyfiveGigE39 39 25000
Ethernet39 41 twentyfiveGigE40 40 25000
Ethernet40 86 twentyfiveGigE41 41 25000
Ethernet41 85 twentyfiveGigE42 42 25000
Ethernet42 88 twentyfiveGigE43 43 25000
Ethernet43 87 twentyfiveGigE44 44 25000
Ethernet44 94 twentyfiveGigE45 45 25000
Ethernet45 93 twentyfiveGigE46 46 25000
Ethernet46 96 twentyfiveGigE47 47 25000
Ethernet47 95 twentyfiveGigE48 48 25000
Ethernet48 97,98,99,100 hundredGigE49 49 100000
Ethernet52 105,106,107,108 hundredGigE50 50 100000
Ethernet56 113,114,115,116 hundredGigE51 51 100000
Ethernet60 121,122,123,124 hundredGigE52 52 100000
Ethernet64 77,78,79,80 hundredGigE53 53 100000
Ethernet68 65,66,67,68 hundredGigE54 54 100000
Ethernet72 69,70,71,72 hundredGigE55 55 100000
Ethernet76 125,126,127,128 hundredGigE56 56 100000

View File

@ -1,91 +1,101 @@
#!/usr/bin/env python
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
import string
from ctypes import create_string_buffer
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
class SfpUtil(SfpUtilBase):
"""Platform specific SfpUtill class"""
"""Platform-specific SfpUtil class"""
PORT_START = 0
PORT_END = 55
QSFP_PORT_START = 48
PORT_START = 1
PORT_END = 56
PORTS_IN_BLOCK = 56
QSFP_PORT_START = 49
QSFP_PORT_END = 56
_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
0 : 32,
1 : 33,
2 : 34,
3 : 35,
4 : 36,
5 : 37,
6 : 38,
7 : 39,
8 : 40,
9 : 41,
10 : 42,
11 : 43,
12 : 44,
13 : 45,
14 : 46,
15 : 47,
16 : 48,
17 : 49,
18 : 50,
19 : 51,
20 : 52,
21 : 53,
22 : 54,
23 : 55,
24 : 56,
25 : 57,
26 : 58,
27 : 59,
28 : 60,
29 : 61,
30 : 62,
31 : 63,
32 : 64,
33 : 65,
34 : 66,
35 : 67,
36 : 68,
37 : 69,
38 : 70,
39 : 71,
40 : 72,
41 : 73,
42 : 74,
43 : 75,
44 : 76,
45 : 77,
46 : 78,
47 : 79,
48 : 80,#QSFP49
49 : 81,#QSFP50
50 : 82,#QSFP51
51 : 83,#QSFP52
52 : 84,#QSFP53
53 : 85,#QSFP54
54 : 86,#QSFP55
55 : 87,#QSFP56
1 : 32,
2 : 33,
3 : 34,
4 : 35,
5 : 36,
6 : 37,
7 : 38,
8 : 39,
9 : 40,
10 : 41,
11 : 42,
12 : 43,
13 : 44,
14 : 45,
15 : 46,
16 : 47,
17 : 48,
18 : 49,
19 : 50,
20 : 51,
21 : 52,
22 : 53,
23 : 54,
24 : 55,
25 : 56,
26 : 57,
27 : 58,
28 : 59,
29 : 60,
30 : 61,
31 : 62,
32 : 63,
33 : 64,
34 : 65,
35 : 66,
36 : 67,
37 : 68,
38 : 69,
39 : 70,
40 : 71,
41 : 72,
42 : 73,
43 : 74,
44 : 75,
45 : 76,
46 : 77,
47 : 78,
48 : 79,
49 : 80,#QSFP49
50 : 81,#QSFP50
51 : 82,#QSFP51
52 : 83,#QSFP52
53 : 84,#QSFP53
54 : 85,#QSFP54
55 : 86,#QSFP55
56 : 87,#QSFP56
}
@property
def port_start(self):
return self.PORT_START
@property
def port_end(self):
return self.PORT_END
@property
def qsfp_port_start(self):
return self.QSFP_PORT_START
@property
def port_end(self):
return self.PORT_END
def qsfp_port_end(self):
return self.QSFP_PORT_END
@property
def qsfp_ports(self):
@ -97,26 +107,26 @@ class SfpUtil(SfpUtilBase):
def __init__(self):
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom'
for x in range(0, self.port_end+1):
for x in range(self.port_start, self.port_end+1):
self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x])
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:
if port_num < self.port_start or port_num > self.port_end:
return False
try:
if port_num < 48:
reg_file = open("/sys/class/cpld-sfp28/port-"+str(port_num+1)+"/pre_n")
if port_num < self.qsfp_port_start:
reg_file = open("/sys/class/cpld-sfp28/port-"+str(port_num)+"/pre_n")
else:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+34)+"/value")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+34)+"/value")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
reg_value = reg_file.readline().rstrip()
if port_num < 48:
if port_num < self.qsfp_port_start:
if reg_value == '1':
return True
else:
@ -127,11 +137,11 @@ class SfpUtil(SfpUtilBase):
def get_low_power_mode(self, port_num):
# Check for invalid port_num
if port_num < self.qsfp_port_start or port_num > self.port_end:
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False
try:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+35)+"/value")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+35)+"/value")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -145,11 +155,11 @@ class SfpUtil(SfpUtilBase):
def set_low_power_mode(self, port_num, lpmode):
# Check for invalid port_num
if port_num < self.qsfp_port_start or port_num > self.port_end:
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False
try:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+35)+"/value", "r+")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+35)+"/value", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -173,7 +183,7 @@ class SfpUtil(SfpUtilBase):
return False
try:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+32)+"/value", "r+")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+32)+"/value", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
@ -187,7 +197,7 @@ class SfpUtil(SfpUtilBase):
# Flip the value back write back to the register to take port out of reset
try:
reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+32)+"/value", "r+")
reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+32)+"/value", "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False