-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ingrasys] update port_config.ini and sfputil for ingrasys platforms (#…
…952) * [Ingrasys] update port_config.ini and sfputil for ingrasys platforms - What I did Update port_config.ini on S8810-32Q/S8900-54XC/S8900-64XC/S9100-C32 platforms - How I did it Update alias field and add port field in port_config.ini - How to verify it Check with the "sfputil show eeprom" command. If no error occurs, it is passed. - Description for the changelog Update port_config.ini on S8810-32Q/S8900-54XC/S8900-64XC/S9100-C32 platforms * [Ingrasys] remove debug message in sfputil.py on S8810-32Q - What I did remove debug message in sfputil.py on S8810-32Q - How I did it remove print in get_low_power_mode() and set_low_power_mode() - How to verify it There should be no debug message when executing "sfputil show lpmode" and "sfputil lpmode on Ethernet0"command. - Description for the changelog remove debug message in sfputil.py on S8810-32Q - A picture of a cute animal (not mandatory but encouraged)
- Loading branch information
1 parent
686e227
commit e4cae4e
Showing
6 changed files
with
540 additions
and
257 deletions.
There are no files selected for viewing
66 changes: 33 additions & 33 deletions
66
device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
# name lanes alias | ||
Ethernet0 37,38,39,40 | ||
Ethernet4 33,34,35,36 | ||
Ethernet8 45,46,47,48 | ||
Ethernet12 41,42,43,44 | ||
Ethernet16 53,54,55,56 | ||
Ethernet20 49,50,51,52 | ||
Ethernet24 61,62,63,64 | ||
Ethernet28 57,58,59,60 | ||
Ethernet32 69,70,71,72 | ||
Ethernet36 65,66,67,68 | ||
Ethernet40 77,78,79,80 | ||
Ethernet44 73,74,75,76 | ||
Ethernet48 85,86,87,88 | ||
Ethernet52 81,82,83,84 | ||
Ethernet56 93,94,95,96 | ||
Ethernet60 89,90,91,92 | ||
Ethernet64 101,102,103,104 | ||
Ethernet68 97,98,99,100 | ||
Ethernet72 109,110,111,112 | ||
Ethernet76 105,106,107,108 | ||
Ethernet80 117,118,119,120 | ||
Ethernet84 113,114,115,116 | ||
Ethernet88 125,126,127,128 | ||
Ethernet92 121,122,123,124 | ||
Ethernet96 5,6,7,8 | ||
Ethernet100 1,2,3,4 | ||
Ethernet104 13,14,15,16 | ||
Ethernet108 9,10,11,12 | ||
Ethernet112 21,22,23,24 | ||
Ethernet116 17,18,19,20 | ||
Ethernet120 29,30,31,32 | ||
Ethernet124 25,26,27,28 | ||
# name lanes alias port | ||
Ethernet0 37,38,39,40 Ethernet1/1 0 | ||
Ethernet4 33,34,35,36 Ethernet2/1 1 | ||
Ethernet8 45,46,47,48 Ethernet3/1 2 | ||
Ethernet12 41,42,43,44 Ethernet4/1 3 | ||
Ethernet16 53,54,55,56 Ethernet5/1 4 | ||
Ethernet20 49,50,51,52 Ethernet6/1 5 | ||
Ethernet24 61,62,63,64 Ethernet7/1 6 | ||
Ethernet28 57,58,59,60 Ethernet8/1 7 | ||
Ethernet32 69,70,71,72 Ethernet9/1 8 | ||
Ethernet36 65,66,67,68 Ethernet10/1 9 | ||
Ethernet40 77,78,79,80 Ethernet11/1 10 | ||
Ethernet44 73,74,75,76 Ethernet12/1 11 | ||
Ethernet48 85,86,87,88 Ethernet13/1 12 | ||
Ethernet52 81,82,83,84 Ethernet14/1 13 | ||
Ethernet56 93,94,95,96 Ethernet15/1 14 | ||
Ethernet60 89,90,91,92 Ethernet16/1 15 | ||
Ethernet64 101,102,103,104 Ethernet17/1 16 | ||
Ethernet68 97,98,99,100 Ethernet18/1 17 | ||
Ethernet72 109,110,111,112 Ethernet19/1 18 | ||
Ethernet76 105,106,107,108 Ethernet20/1 19 | ||
Ethernet80 117,118,119,120 Ethernet21/1 20 | ||
Ethernet84 113,114,115,116 Ethernet22/1 21 | ||
Ethernet88 125,126,127,128 Ethernet23/1 22 | ||
Ethernet92 121,122,123,124 Ethernet24/1 23 | ||
Ethernet96 5,6,7,8 Ethernet25/1 24 | ||
Ethernet100 1,2,3,4 Ethernet26/1 25 | ||
Ethernet104 13,14,15,16 Ethernet27/1 26 | ||
Ethernet108 9,10,11,12 Ethernet28/1 27 | ||
Ethernet112 21,22,23,24 Ethernet29/1 28 | ||
Ethernet116 17,18,19,20 Ethernet30/1 29 | ||
Ethernet120 29,30,31,32 Ethernet31/1 30 | ||
Ethernet124 25,26,27,28 Ethernet32/1 31 |
200 changes: 143 additions & 57 deletions
200
device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,147 @@ | ||
#!/usr/bin/env python | ||
# sfputil.py | ||
# | ||
# Platform-specific SFP transceiver interface for SONiC | ||
# | ||
|
||
try: | ||
from sonic_sfp.sfputilbase import sfputilbase | ||
except ImportError, e: | ||
raise ImportError (str(e) + "- required module not found") | ||
|
||
|
||
class sfputil(sfputilbase): | ||
"""Platform specific sfputil class""" | ||
|
||
port_start = 0 | ||
port_end = 31 | ||
ports_in_block = 32 | ||
|
||
port_to_eeprom_mapping = {} | ||
#FIXME | ||
port_to_i2c_mapping = { | ||
0: 18, | ||
1: 19, | ||
2: 20, | ||
3: 21, | ||
4: 22, | ||
5: 23, | ||
6: 24, | ||
7: 25, | ||
8: 26, | ||
9: 27, | ||
10: 28, | ||
11: 29, | ||
12: 30, | ||
13: 31, | ||
14: 32, | ||
15: 33, | ||
16: 34, | ||
17: 35, | ||
18: 36, | ||
19: 37, | ||
20: 38, | ||
21: 39, | ||
22: 40, | ||
23: 41, | ||
24: 42, | ||
25: 43, | ||
26: 44, | ||
27: 45, | ||
28: 46, | ||
29: 47, | ||
30: 48, | ||
31: 49 | ||
} | ||
|
||
_qsfp_ports = range(0, ports_in_block + 1) | ||
|
||
def __init__(self, port_num): | ||
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 = 31 | ||
PORTS_IN_BLOCK = 32 | ||
|
||
EEPROM_OFFSET = 18 | ||
|
||
ABS_GPIO_BASE = 224 | ||
#INT_GPIO_BASE = 192 | ||
LP_GPIO_BASE = 160 | ||
RST_GPIO_BASE = 128 | ||
|
||
BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" | ||
BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" | ||
|
||
_port_to_eeprom_mapping = {} | ||
|
||
@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(0, self.PORTS_IN_BLOCK + 1) | ||
|
||
@property | ||
def port_to_eeprom_mapping(self): | ||
return self._port_to_eeprom_mapping | ||
|
||
def __init__(self): | ||
# Override port_to_eeprom_mapping for class initialization | ||
eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' | ||
eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" | ||
|
||
for x in range(self.port_start, self.port_end + 1): | ||
port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) | ||
self.port_to_eeprom_mapping[x] = port_eeprom_path | ||
sfputilbase.__init__(self, port_num) | ||
self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) | ||
|
||
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 | ||
|
||
try: | ||
abs_device_file = self.BASE_VAL_PATH.format( | ||
port_num + self.ABS_GPIO_BASE) | ||
val_file = open(abs_device_file) | ||
except IOError as e: | ||
print "Error: unable to open file: %s" % str(e) | ||
return False | ||
|
||
content = val_file.readline().rstrip() | ||
|
||
# content is a string, either "0" or "1" | ||
if content == "1": | ||
return True | ||
|
||
return False | ||
|
||
def get_low_power_mode(self, port_num): | ||
# Check for invalid port_num | ||
if port_num < self.port_start or port_num > self.port_end: | ||
return False | ||
|
||
try: | ||
lpmode_val_device_file = self.BASE_VAL_PATH.format( | ||
port_num + self.LP_GPIO_BASE) | ||
val_file = open(lpmode_val_device_file) | ||
except IOError as e: | ||
print "Error: unable to open file: %s" % str(e) | ||
return False | ||
|
||
content = val_file.readline().rstrip() | ||
|
||
# content is a string, either "0" or "1" | ||
if content == "1": | ||
return True | ||
|
||
return False | ||
|
||
def set_low_power_mode(self, port_num, lpmode): | ||
# Check for invalid port_num | ||
if port_num < self.port_start or port_num > self.port_end: | ||
return False | ||
|
||
try: | ||
lpmode_val_device_file = self.BASE_VAL_PATH.format( | ||
port_num + self.LP_GPIO_BASE) | ||
val_file = open(lpmode_val_device_file, "w") | ||
except IOError as e: | ||
print "Error: unable to open file: %s" % str(e) | ||
return False | ||
|
||
val_file.write("1" if lpmode is True else "0") | ||
val_file.close() | ||
|
||
return True | ||
|
||
def reset(self, port_num): | ||
# Check for invalid port_num | ||
if port_num < self.port_start or port_num > self.port_end: | ||
return False | ||
|
||
try: | ||
reset_val_device_file = self.BASE_VAL_PATH.format( | ||
port_num + self.RST_GPIO_BASE) | ||
val_file = open(reset_val_device_file, "w") | ||
except IOError as e: | ||
print "Error: unable to open file: %s" % str(e) | ||
return False | ||
|
||
val_file.write("1") | ||
val_file.close() | ||
|
||
# Sleep 1 second to allow it to settle | ||
time.sleep(1) | ||
|
||
try: | ||
reset_val_device_file = self.BASE_VAL_PATH.format( | ||
port_num + self.RST_GPIO_BASE) | ||
val_file = open(reset_val_device_file, "w") | ||
except IOError as e: | ||
print "Error: unable to open file: %s" % str(e) | ||
return False | ||
|
||
val_file.write("0") | ||
val_file.close() | ||
|
||
return True |
110 changes: 55 additions & 55 deletions
110
device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
# name lanes alias | ||
Ethernet0 1 | ||
Ethernet1 2 | ||
Ethernet2 3 | ||
Ethernet3 4 | ||
Ethernet4 5 | ||
Ethernet5 6 | ||
Ethernet6 7 | ||
Ethernet7 8 | ||
Ethernet8 9 | ||
Ethernet9 10 | ||
Ethernet10 11 | ||
Ethernet11 12 | ||
Ethernet12 21 | ||
Ethernet13 22 | ||
Ethernet14 23 | ||
Ethernet15 24 | ||
Ethernet16 33 | ||
Ethernet17 34 | ||
Ethernet18 35 | ||
Ethernet19 36 | ||
Ethernet20 37 | ||
Ethernet21 38 | ||
Ethernet22 39 | ||
Ethernet23 40 | ||
Ethernet24 41 | ||
Ethernet25 42 | ||
Ethernet26 43 | ||
Ethernet27 44 | ||
Ethernet28 49 | ||
Ethernet29 50 | ||
Ethernet30 51 | ||
Ethernet31 52 | ||
Ethernet32 53 | ||
Ethernet33 54 | ||
Ethernet34 55 | ||
Ethernet35 56 | ||
Ethernet36 65 | ||
Ethernet37 66 | ||
Ethernet38 67 | ||
Ethernet39 68 | ||
Ethernet40 69 | ||
Ethernet41 70 | ||
Ethernet42 71 | ||
Ethernet43 72 | ||
Ethernet44 81 | ||
Ethernet45 82 | ||
Ethernet46 83 | ||
Ethernet47 84 | ||
Ethernet48 85,86,87,88 | ||
Ethernet52 97,98,99,100 | ||
Ethernet56 101,102,103,104 | ||
Ethernet60 105,106,107,108 | ||
Ethernet64 109,110,111,112 | ||
Ethernet68 117,118,119,120 | ||
# name lanes alias port | ||
Ethernet0 1 Ethernet1 0 | ||
Ethernet1 2 Ethernet2 1 | ||
Ethernet2 3 Ethernet3 2 | ||
Ethernet3 4 Ethernet4 3 | ||
Ethernet4 5 Ethernet5 4 | ||
Ethernet5 6 Ethernet6 5 | ||
Ethernet6 7 Ethernet7 6 | ||
Ethernet7 8 Ethernet8 7 | ||
Ethernet8 9 Ethernet9 8 | ||
Ethernet9 10 Ethernet10 9 | ||
Ethernet10 11 Ethernet11 10 | ||
Ethernet11 12 Ethernet12 11 | ||
Ethernet12 21 Ethernet13 12 | ||
Ethernet13 22 Ethernet14 13 | ||
Ethernet14 23 Ethernet15 14 | ||
Ethernet15 24 Ethernet16 15 | ||
Ethernet16 33 Ethernet17 16 | ||
Ethernet17 34 Ethernet18 17 | ||
Ethernet18 35 Ethernet19 18 | ||
Ethernet19 36 Ethernet20 19 | ||
Ethernet20 37 Ethernet21 20 | ||
Ethernet21 38 Ethernet22 21 | ||
Ethernet22 39 Ethernet23 22 | ||
Ethernet23 40 Ethernet24 23 | ||
Ethernet24 41 Ethernet25 24 | ||
Ethernet25 42 Ethernet26 25 | ||
Ethernet26 43 Ethernet27 26 | ||
Ethernet27 44 Ethernet28 27 | ||
Ethernet28 49 Ethernet29 28 | ||
Ethernet29 50 Ethernet30 29 | ||
Ethernet30 51 Ethernet31 30 | ||
Ethernet31 52 Ethernet32 31 | ||
Ethernet32 53 Ethernet33 32 | ||
Ethernet33 54 Ethernet34 33 | ||
Ethernet34 55 Ethernet35 34 | ||
Ethernet35 56 Ethernet36 35 | ||
Ethernet36 65 Ethernet37 36 | ||
Ethernet37 66 Ethernet38 37 | ||
Ethernet38 67 Ethernet39 38 | ||
Ethernet39 68 Ethernet40 39 | ||
Ethernet40 69 Ethernet41 40 | ||
Ethernet41 70 Ethernet42 41 | ||
Ethernet42 71 Ethernet43 42 | ||
Ethernet43 72 Ethernet44 43 | ||
Ethernet44 81 Ethernet45 44 | ||
Ethernet45 82 Ethernet46 45 | ||
Ethernet46 83 Ethernet47 46 | ||
Ethernet47 84 Ethernet48 47 | ||
Ethernet48 85,86,87,88 Ethernet49/1 48 | ||
Ethernet52 97,98,99,100 Ethernet50/1 49 | ||
Ethernet56 101,102,103,104 Ethernet51/1 50 | ||
Ethernet60 105,106,107,108 Ethernet52/1 51 | ||
Ethernet64 109,110,111,112 Ethernet53/1 52 | ||
Ethernet68 117,118,119,120 Ethernet54/1 53 |
Oops, something went wrong.