Allow similar devices configs sharing (#1933)

* Allow similar devices configs sharing

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>

* Remove unnecessary cp flags

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>

* Remove hw-managment symlink for LS-SN2700 & resolve symlinks during cp

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
This commit is contained in:
stepanblyschak 2018-08-16 20:37:25 +03:00 committed by lguohan
parent 38f3eba695
commit cd9c5e7373
32 changed files with 17 additions and 1317 deletions

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/ACS-MSN2700/

View File

@ -1 +0,0 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2

View File

@ -1 +0,0 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2

View File

@ -1 +0,0 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2

View File

@ -1,17 +0,0 @@
# PG lossless profiles.
# speed cable size xon xoff threshold
10000 5m 34816 18432 16384 0
25000 5m 34816 18432 16384 0
40000 5m 34816 18432 16384 0
50000 5m 34816 18432 16384 0
100000 5m 36864 18432 18432 0
10000 40m 36864 18432 18432 0
25000 40m 39936 18432 21504 0
40000 40m 41984 18432 23552 0
50000 40m 41984 18432 23552 0
100000 40m 54272 18432 35840 0
10000 300m 49152 18432 30720 0
25000 300m 71680 18432 53248 0
40000 300m 94208 18432 75776 0
50000 300m 94208 18432 75776 0
100000 300m 184320 18432 165888 0

View File

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

View File

@ -1,189 +0,0 @@
{%- set PORT_ALL = [] %}
{%- if PORT is not defined %}
{%- for port_idx in range(0,64) %}
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %}
{%- endfor %}
{%- else %}
{%- for port in PORT %}
{%- if PORT_ALL.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set PORT_ACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') %}
{
"TC_TO_PRIORITY_GROUP_MAP": {
"AZURE": {
"0": "0",
"1": "1",
"3": "3",
"4": "4"
}
},
"MAP_PFC_PRIORITY_TO_QUEUE": {
"AZURE": {
"0": "0",
"1": "1",
"3": "3",
"4": "4"
}
},
"TC_TO_QUEUE_MAP": {
"AZURE": {
"0": "0",
"1": "1",
"3": "3",
"4": "4"
}
},
"DSCP_TO_TC_MAP": {
"AZURE": {
"0":"0",
"1":"0",
"2":"0",
"3":"3",
"4":"4",
"5":"0",
"6":"0",
"7":"0",
"8":"1",
"9":"0",
"10":"0",
"11":"0",
"12":"0",
"13":"0",
"14":"0",
"15":"0",
"16":"0",
"17":"0",
"18":"0",
"19":"0",
"20":"0",
"21":"0",
"22":"0",
"23":"0",
"24":"0",
"25":"0",
"26":"0",
"27":"0",
"28":"0",
"29":"0",
"30":"0",
"31":"0",
"32":"0",
"33":"0",
"34":"0",
"35":"0",
"36":"0",
"37":"0",
"38":"0",
"39":"0",
"40":"0",
"41":"0",
"42":"0",
"43":"0",
"44":"0",
"45":"0",
"46":"0",
"47":"0",
"48":"0",
"49":"0",
"50":"0",
"51":"0",
"52":"0",
"53":"0",
"54":"0",
"55":"0",
"56":"0",
"57":"0",
"58":"0",
"59":"0",
"60":"0",
"61":"0",
"62":"0",
"63":"0"
}
},
"SCHEDULER": {
"scheduler.0": {
"type":"DWRR",
"weight": "25"
},
"scheduler.1": {
"type":"DWRR",
"weight": "30"
},
"scheduler.2": {
"type":"DWRR",
"weight": "20"
}
},
"PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": {
"AZURE": {
"0": "0",
"1": "1",
"3": "3",
"4": "4"
}
},
"PORT_QOS_MAP": {
"{{ port_names_active }}": {
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]",
"pfc_enable": "3,4"
}
},
"WRED_PROFILE": {
"AZURE_LOSSY": {
"wred_green_enable":"true",
"wred_yellow_enable":"true",
"ecn":"ecn_all",
"red_max_threshold":"516096",
"red_min_threshold":"516096",
"yellow_max_threshold":"516096",
"yellow_min_threshold":"516096",
"green_max_threshold": "184320",
"green_min_threshold": "184320"
},
"AZURE_LOSSLESS": {
"wred_green_enable":"true",
"wred_yellow_enable":"true",
"ecn":"ecn_all",
"red_max_threshold":"516096",
"red_min_threshold":"516096",
"yellow_max_threshold":"516096",
"yellow_min_threshold":"516096",
"green_max_threshold": "184320",
"green_min_threshold": "184320"
}
},
"QUEUE": {
"{{ port_names_active }}|3-4" : {
"scheduler" : "[SCHEDULER|scheduler.0]",
"wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"{{ port_names_active }}|0" : {
"scheduler" : "[SCHEDULER|scheduler.1]"
},
"{{ port_names_active }}|1" : {
"scheduler" : "[SCHEDULER|scheduler.2]"
}
}
}

View File

@ -1 +0,0 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700.xml

View File

@ -1,243 +0,0 @@
<?xml version="1.0"?>
<root>
<platform_info type="2700">
<!-- Device MAC address -->
<device-mac-address>00:02:03:04:05:00</device-mac-address>
<!-- Number of ports in the following port list -->
<number-of-physical-ports>32</number-of-physical-ports>
<!-- List of ports in the device -->
<ports-list>
<port-info>
<local-port>1</local-port>
<width>4</width>
<module>16</module>
<!-- 0 none, 1=2, 2=4, 3=2,4 -->
<breakout-modes>3</breakout-modes>
<!-- (BITMASK) 4096 - 10Gb , 939524096 - 25Gb , 98368 - 40Gb , 3221225472 - 50Gb , 11534336 - 100Gb-->
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>3</local-port>
<width>4</width>
<module>17</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>5</local-port>
<width>4</width>
<module>18</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>7</local-port>
<width>4</width>
<module>19</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>9</local-port>
<width>4</width>
<module>20</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>11</local-port>
<width>4</width>
<module>21</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>13</local-port>
<width>4</width>
<module>22</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>15</local-port>
<width>4</width>
<module>23</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>17</local-port>
<width>4</width>
<module>24</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>19</local-port>
<width>4</width>
<module>25</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>21</local-port>
<width>4</width>
<module>26</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>23</local-port>
<width>4</width>
<module>27</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>25</local-port>
<width>4</width>
<module>28</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>27</local-port>
<width>4</width>
<module>29</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>29</local-port>
<width>4</width>
<module>30</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>31</local-port>
<width>4</width>
<module>31</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>33</local-port>
<width>4</width>
<module>14</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>35</local-port>
<width>4</width>
<module>15</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>37</local-port>
<width>4</width>
<module>12</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>39</local-port>
<width>4</width>
<module>13</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>41</local-port>
<width>4</width>
<module>10</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>43</local-port>
<width>4</width>
<module>11</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>45</local-port>
<width>4</width>
<module>8</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>47</local-port>
<width>4</width>
<module>9</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>49</local-port>
<width>4</width>
<module>6</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>51</local-port>
<width>4</width>
<module>7</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>53</local-port>
<width>4</width>
<module>4</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>55</local-port>
<width>4</width>
<module>5</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>57</local-port>
<width>4</width>
<module>2</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>59</local-port>
<width>4</width>
<module>3</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>61</local-port>
<width>4</width>
<module>0</module>
<breakout-modes>3</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
<port-info>
<local-port>63</local-port>
<width>4</width>
<module>1</module>
<breakout-modes>1</breakout-modes>
<port-speed>98368</port-speed>
</port-info>
</ports-list>
</platform_info>
</root>

View File

@ -1 +0,0 @@
/etc/mlnx/msn2700

View File

@ -1 +0,0 @@
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq"

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/installer.conf

View File

@ -1,32 +0,0 @@
#!/usr/bin/env python
#############################################################################
# Mellanox
#
# Platform and model specific eeprom subclass, inherits from the base class,
# and provides the followings:
# - the eeprom format definition
# - specific encoder/decoder if there is special need
#############################################################################
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 = "/bsp/eeprom/sys_eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -1,74 +0,0 @@
#!/usr/bin/env python
#############################################################################
# Mellanox
#
# 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/2-0060/"
self.psu_presence = "psu{}_status"
self.psu_oper_status = "psu{}_pg_status"
def get_num_psus(self):
"""
Retrieves the number of PSUs available on the device
:return: An integer, the number of PSUs available on the device
"""
return 2
def get_psu_status(self, index):
"""
Retrieves the oprational status of power supply unit (PSU) defined
by 1-based index <index>
:param index: An integer, 1-based index of the PSU of which to query status
:return: Boolean, True if PSU is operating properly, False if PSU is faulty
"""
if index is None:
return False
status = 0
try:
with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status:
status = int(power_status.read())
except IOError:
return False
return status == 1
def get_psu_presence(self, index):
"""
Retrieves the presence status of power supply unit (PSU) defined
by 1-based index <index>
:param index: An integer, 1-based index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
if index is None:
return False
status = 0
try:
with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status:
status = int(presence_status.read())
except IOError:
return False
return status == 1

View File

@ -1,43 +0,0 @@
#!/usr/bin/env python
import sys, errno
import os
from python_sdk_api.sxd_api import *
from python_sdk_api.sx_api import *
# Check if SFP port number is provided
if len(sys.argv) < 2:
print "SFP module number is missed."
print "Usage: sfplpmget.py <SFP module>"
sys.exit(errno.EINVAL)
# Init SDK API
rc, handle = sx_api_open(None)
if (rc != SX_STATUS_SUCCESS):
print "Failed to open api handle.\nPlease check that SDK is running."
sys.exit(errno.EACCES)
pid = os.getpid()
rc = sxd_access_reg_init(pid, None, 0)
if (rc != 0):
print "Failed to initializing register access.\nPlease check that SDK is running."
sys.exit(errno.EACCES)
# Get SFP module number
sfp_module = int(sys.argv[1])
# Get MCION
mcion = ku_mcion_reg()
mcion.module = sfp_module
meta = sxd_reg_meta_t()
meta.dev_id = 1
meta.swid = 0
meta.access_cmd = SXD_ACCESS_CMD_GET
rc = sxd_access_reg_mcion(mcion, meta, 1, None, None)
assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_mcion failed, rc = %d" % rc
# Get low power mode status
lpm_mask = 1 << 8
lpm_status = (lpm_mask & mcion.module_status_bits) != 0
print "LPM ON" if lpm_status else "LPM OFF"

View File

@ -1,107 +0,0 @@
#!/usr/bin/env python
import sys, errno
import time
import os
from python_sdk_api.sxd_api import *
from python_sdk_api.sx_api import *
def get_log_ports(handle, sfp_module):
port_attributes_list = new_sx_port_attributes_t_arr(64)
port_cnt_p = new_uint32_t_p()
uint32_t_p_assign(port_cnt_p, 64)
rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p)
assert rc == SX_STATUS_SUCCESS, "sx_api_port_device_get failed, rc = %d" % rc
port_cnt = uint32_t_p_value(port_cnt_p)
log_port_list = []
for i in range(0, port_cnt):
port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list, i)
if port_attributes.port_mapping.module_port == sfp_module:
log_port_list.append(port_attributes.log_port)
return log_port_list
def set_sfp_admin_status(handle, meta, sfp_module, sfp_log_port_list, admin_status):
# Get PMAOS
pmaos = ku_pmaos_reg()
pmaos.module = sfp_module
meta.access_cmd = SXD_ACCESS_CMD_GET
rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None)
assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc
# Set admin status to PMAOS
pmaos.ase = 1
pmaos.ee = 1
pmaos.e = 2
pmaos.rst = 0
if admin_status == SX_PORT_ADMIN_STATUS_DOWN:
pmaos.admin_status = 2
else:
pmaos.admin_status = 1
meta.access_cmd = SXD_ACCESS_CMD_SET
rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None)
assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc
# Check if SFP port number is provided
if len(sys.argv) < 3:
print "SFP module number or LPM is missed."
print "Usage: sfplpmset.py <SFP module> <on|off>"
sys.exit(errno.EINVAL)
lpm_enable = None
if sys.argv[2] == 'on':
lpm_enable = True
elif sys.argv[2] == 'off':
lpm_enable = False
else:
print "Unrecognized LPM parameter. Please use <on> or <off> values"
sys.exit(errno.EINVAL)
# Init SDK API
rc, handle = sx_api_open(None)
if (rc != SX_STATUS_SUCCESS):
print "Failed to open api handle.\nPlease check that SDK is running."
sys.exit(errno.EACCES)
pid = os.getpid()
rc = sxd_access_reg_init(pid, None, 0)
if (rc != 0):
print "Failed to initializing register access.\nPlease check that SDK is running."
sys.exit(errno.EACCES);
# Get SFP module and log ports number and LPM status
sfp_module = int(sys.argv[1])
log_port_list = get_log_ports(handle, sfp_module)
if not log_port_list:
print "Failed to get log ports"
sys.exit(errno.EACCES)
# Get PMMP
pmmp = ku_pmmp_reg()
pmmp.module = sfp_module
meta = sxd_reg_meta_t()
meta.dev_id = 1
meta.swid = 0
meta.access_cmd = SXD_ACCESS_CMD_GET
rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None)
assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc
# Disable admin status before LPM settings
set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_DOWN)
# Set low power mode status
lpm_mask = 1 << 8
if lpm_enable:
pmmp.eeprom_override = pmmp.eeprom_override | lpm_mask
else:
pmmp.eeprom_override = pmmp.eeprom_override & (~lpm_mask)
meta.access_cmd = SXD_ACCESS_CMD_SET
rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None)
assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc
# Enable admin status after LPM settings
set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_UP)

View File

@ -1,45 +0,0 @@
#!/usr/bin/env python
import sys, errno
import os
from python_sdk_api.sxd_api import *
from python_sdk_api.sx_api import *
# Check if SFP port number is provided
if len(sys.argv) < 2:
print "SFP module number or LPM is missed."
print "Usage: sfpreset.py <SFP module>"
sys.exit(errno.EINVAL)
# Init SDK API
rc, handle = sx_api_open(None)
if (rc != SX_STATUS_SUCCESS):
print "Failed to open api handle.\nPlease check that SDK is running."
sys.exit(errno.EACCES)
pid = os.getpid()
rc = sxd_access_reg_init(pid, None, 0)
if (rc != 0):
print "Failed to initializing register access.\nPlease check that SDK is running."
sys.exit(errno.EACCES)
# Get SFP module number
sfp_module = int(sys.argv[1])
# Get PMAOS
pmaos = ku_pmaos_reg()
pmaos.module = sfp_module
meta = sxd_reg_meta_t()
meta.dev_id = 1
meta.swid = 0
meta.access_cmd = SXD_ACCESS_CMD_GET
rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None)
assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc
# Reset SFP
pmaos.rst = 1
meta.access_cmd = SXD_ACCESS_CMD_SET
rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None)
assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc
print "Reset flag is set"

View File

@ -1,190 +0,0 @@
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
# parameters for DB connection
REDIS_HOSTNAME = "localhost"
REDIS_PORT = 6379
REDIS_TIMEOUT_USECS = 0
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 0
PORT_END = 31
PORTS_IN_BLOCK = 32
EEPROM_OFFSET = 1
_port_to_eeprom_mapping = {}
db_sel = None
db_sel_timeout = None
db_sel_object = None
db_sel_tbl = None
state_db = None
@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):
eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon7/qsfp{0}_eeprom"
for x in range(0, self.port_end + 1):
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:
reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1))
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
content = reg_file.readline().rstrip()
# content is a string with the qsfp status
if content == "good":
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
lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num)
try:
output = subprocess.check_output(lpm_cmd, shell=True)
if 'LPM ON' in output:
return True
except subprocess.CalledProcessError as e:
print "Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output)
return False
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
curr_lpmode = self.get_low_power_mode(port_num)
if curr_lpmode == lpmode:
return True
lpm = 'on' if lpmode else 'off'
lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm)
sfp_port_names = self.physical_to_logical[port_num]
# Get port admin status
try:
enabled_ports = subprocess.check_output("ip link show up", shell=True)
except subprocess.CalledProcessError as e:
print "Error! Unable to get ports status, err msg: {}".format(e.output)
return False
port_to_disable = []
for port in sfp_port_names:
if port in enabled_ports:
port_to_disable.append(port)
# Disable ports before LPM settings
for port in port_to_disable:
try:
subprocess.check_output("ifconfig {} down".format(port), shell=True)
except subprocess.CalledProcessError as e:
print "Error! Unable to set admin status to DOWN for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output)
return False
time.sleep(3)
# Set LPM
try:
subprocess.check_output(lpm_cmd, shell=True)
except subprocess.CalledProcessError as e:
print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output)
return False
# Enable ports after LPM settings
for port in port_to_disable:
try:
subprocess.check_output("ifconfig {} up".format(port), shell=True)
except subprocess.CalledProcessError as e:
print "Error! Unable to set admin status to UP for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output)
return False
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
lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num)
try:
subprocess.check_output(lpm_cmd, shell=True)
return True
except subprocess.CalledProcessError as e:
print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output)
return False
return False
def get_transceiver_change_event(self, timeout=0):
phy_port_dict = {}
status = True
if self.db_sel == None:
from swsscommon import swsscommon
self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB,
REDIS_HOSTNAME,
REDIS_PORT,
REDIS_TIMEOUT_USECS)
# Subscribe to state table for SFP change notifications
self.db_sel = swsscommon.Select()
self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY')
self.db_sel.addSelectable(self.db_sel_tbl)
self.db_sel_timeout = swsscommon.Select.TIMEOUT
self.db_sel_object = swsscommon.Select.OBJECT
(state, c) = self.db_sel.select(timeout)
if state == self.db_sel_timeout:
status = True
elif state != self.db_sel_object:
status = False
else:
(key, op, fvp) = self.db_sel_tbl.pop()
phy_port_dict[key] = op
return status, phy_port_dict

View File

@ -1,21 +0,0 @@
bus "i2c-7" "i2c-1-mux (chan_id 5)"
chip "lm75-i2c-7-4a"
label temp1 "Ambient Port Temp"
bus "i2c-5" "i2c-1-mux (chan_id 3)"
chip "ucd9200-i2c-5-27"
label in1 "UCD1 vin"
label in2 "ASIC 3.3 vout"
label in3 "ASIC 1.2 vout"
label temp1 "UCD1 Temp"
label temp2 "UCD1 Temp2"
chip "ucd9200-i2c-5-41"
label in1 "UCD2 vin"
label in2 "ASIC Vcore vout"
label temp1 "UCD2 Temp1"
label temp2 "UCD2 Temp2"
bus "i2c-17" "i2c-1-mux (chan_id 7)"
chip "lm75-i2c-17-49"
label temp1 "Ambient Board Temp"

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/sensors.conf

View File

@ -1,17 +0,0 @@
# PG lossless profiles.
# speed cable size xon xoff threshold
10000 5m 34816 18432 16384 0
25000 5m 34816 18432 16384 0
40000 5m 34816 18432 16384 0
50000 5m 34816 18432 16384 0
100000 5m 36864 18432 18432 0
10000 40m 36864 18432 18432 0
25000 40m 39936 18432 21504 0
40000 40m 41984 18432 23552 0
50000 40m 41984 18432 23552 0
100000 40m 54272 18432 35840 0
10000 300m 49152 18432 30720 0
25000 300m 71680 18432 53248 0
40000 300m 94208 18432 75776 0
50000 300m 94208 18432 75776 0
100000 300m 184320 18432 165888 0

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini

View File

@ -1 +0,0 @@
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq"

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/installer.conf

View File

@ -1,21 +0,0 @@
bus "i2c-7" "i2c-1-mux (chan_id 5)"
chip "lm75-i2c-7-4a"
label temp1 "Ambient Port Temp"
bus "i2c-5" "i2c-1-mux (chan_id 3)"
chip "ucd9200-i2c-5-27"
label in1 "UCD1 vin"
label in2 "ASIC 3.3 vout"
label in3 "ASIC 1.2 vout"
label temp1 "UCD1 Temp"
label temp2 "UCD1 Temp2"
chip "ucd9200-i2c-5-41"
label in1 "UCD2 vin"
label in2 "ASIC Vcore vout"
label temp1 "UCD2 Temp1"
label temp2 "UCD2 Temp2"
bus "i2c-17" "i2c-1-mux (chan_id 7)"
chip "lm75-i2c-17-49"
label temp1 "Ambient Board Temp"

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/sensors.conf

View File

@ -1,17 +0,0 @@
# PG lossless profiles.
# speed cable size xon xoff threshold
10000 5m 34816 18432 16384 0
25000 5m 34816 18432 16384 0
40000 5m 34816 18432 16384 0
50000 5m 34816 18432 16384 0
100000 5m 36864 18432 18432 0
10000 40m 36864 18432 18432 0
25000 40m 39936 18432 21504 0
40000 40m 41984 18432 23552 0
50000 40m 41984 18432 23552 0
100000 40m 54272 18432 35840 0
10000 300m 49152 18432 30720 0
25000 300m 71680 18432 53248 0
40000 300m 94208 18432 75776 0
50000 300m 94208 18432 75776 0
100000 300m 184320 18432 165888 0

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini

View File

@ -1 +0,0 @@
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq"

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/installer.conf

View File

@ -1,21 +0,0 @@
bus "i2c-7" "i2c-1-mux (chan_id 5)"
chip "lm75-i2c-7-4a"
label temp1 "Ambient Port Temp"
bus "i2c-5" "i2c-1-mux (chan_id 3)"
chip "ucd9200-i2c-5-27"
label in1 "UCD1 vin"
label in2 "ASIC 3.3 vout"
label in3 "ASIC 1.2 vout"
label temp1 "UCD1 Temp"
label temp2 "UCD1 Temp2"
chip "ucd9200-i2c-5-41"
label in1 "UCD2 vin"
label in2 "ASIC Vcore vout"
label temp1 "UCD2 Temp1"
label temp2 "UCD2 Temp2"
bus "i2c-17" "i2c-1-mux (chan_id 7)"
chip "lm75-i2c-17-49"
label temp1 "Ambient Board Temp"

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/sensors.conf

View File

@ -1,2 +0,0 @@
{%- set default_topo = 't0' %}
{%- include 'buffers_config.j2' %}

View File

@ -0,0 +1 @@
../ACS-MSN2700/buffers.json.j2

View File

@ -1,90 +0,0 @@
{% set default_cable = '5m' %}
{% set ingress_lossless_pool_size = '4194304' %}
{% set ingress_lossy_pool_size = '7340032' %}
{% set egress_lossless_pool_size = '16777152' %}
{% set egress_lossy_pool_size = '7340032' %}
{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
{%- for port_idx in range(0, 32) %}
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %}
{%- endfor %}
{%- endmacro %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "{{ ingress_lossless_pool_size }}",
"type": "ingress",
"mode": "dynamic"
},
"ingress_lossy_pool": {
"size": "{{ ingress_lossy_pool_size }}",
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "{{ egress_lossless_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
"egress_lossy_pool": {
"size": "{{ egress_lossy_pool_size }}",
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossless_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"0"
},
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossy_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_lossless_pool]",
"size":"0",
"dynamic_th":"7"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"4096",
"dynamic_th":"3"
},
"q_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"0",
"dynamic_th":"3"
}
},
{%- endmacro %}
{%- macro generate_profile_lists(port_names) %}
"BUFFER_PORT_INGRESS_PROFILE_LIST": {
"{{ port_names }}": {
"profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]"
}
},
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
"{{ port_names }}": {
"profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]"
}
}
{%- endmacro %}
{%- macro generate_queue_buffers(port_names) %}
"BUFFER_QUEUE": {
"{{ port_names }}|3-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
"{{ port_names }}|0-1": {
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
}
}
{%- endmacro %}

View File

@ -0,0 +1 @@
../ACS-MSN2700/buffers_defaults_t0.j2

View File

@ -1,90 +0,0 @@
{% set default_cable = '5m' %}
{% set ingress_lossless_pool_size = '2097152' %}
{% set ingress_lossy_pool_size = '5242880' %}
{% set egress_lossless_pool_size = '16777152' %}
{% set egress_lossy_pool_size = '5242880' %}
{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
{%- for port_idx in range(0, 32) %}
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %}
{%- endfor %}
{%- endmacro %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "{{ ingress_lossless_pool_size }}",
"type": "ingress",
"mode": "dynamic"
},
"ingress_lossy_pool": {
"size": "{{ ingress_lossy_pool_size }}",
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "{{ egress_lossless_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
"egress_lossy_pool": {
"size": "{{ egress_lossy_pool_size }}",
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossless_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"0"
},
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossy_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_lossless_pool]",
"size":"0",
"dynamic_th":"7"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"4096",
"dynamic_th":"3"
},
"q_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"0",
"dynamic_th":"3"
}
},
{%- endmacro %}
{%- macro generate_profile_lists(port_names) %}
"BUFFER_PORT_INGRESS_PROFILE_LIST": {
"{{ port_names }}": {
"profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]"
}
},
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
"{{ port_names }}": {
"profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]"
}
}
{%- endmacro %}
{%- macro generate_queue_buffers(port_names) %}
"BUFFER_QUEUE": {
"{{ port_names }}|3-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
"{{ port_names }}|0-1": {
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
}
}
{%- endmacro %}

View File

@ -0,0 +1 @@
../ACS-MSN2700/buffers_defaults_t1.j2

View File

@ -1,17 +0,0 @@
# PG lossless profiles.
# speed cable size xon xoff threshold
10000 5m 34816 18432 16384 0
25000 5m 34816 18432 16384 0
40000 5m 34816 18432 16384 0
50000 5m 34816 18432 16384 0
100000 5m 36864 18432 18432 0
10000 40m 36864 18432 18432 0
25000 40m 39936 18432 21504 0
40000 40m 41984 18432 23552 0
50000 40m 41984 18432 23552 0
100000 40m 54272 18432 35840 0
10000 300m 49152 18432 30720 0
25000 300m 71680 18432 53248 0
40000 300m 94208 18432 75776 0
50000 300m 94208 18432 75776 0
100000 300m 184320 18432 165888 0

View File

@ -0,0 +1 @@
../ACS-MSN2700/pg_profile_lookup.ini

View File

@ -1,17 +0,0 @@
# PG lossless profiles.
# speed cable size xon xoff threshold
10000 5m 34816 18432 16384 0
25000 5m 34816 18432 16384 0
40000 5m 34816 18432 16384 0
50000 5m 34816 18432 16384 0
100000 5m 36864 18432 18432 0
10000 40m 36864 18432 18432 0
25000 40m 39936 18432 21504 0
40000 40m 41984 18432 23552 0
50000 40m 41984 18432 23552 0
100000 40m 54272 18432 35840 0
10000 300m 49152 18432 30720 0
25000 300m 71680 18432 53248 0
40000 300m 94208 18432 75776 0
50000 300m 94208 18432 75776 0
100000 300m 184320 18432 165888 0

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini

View File

@ -1 +0,0 @@
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq"

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/installer.conf

View File

@ -1,21 +0,0 @@
bus "i2c-7" "i2c-1-mux (chan_id 5)"
chip "lm75-i2c-7-4a"
label temp1 "Ambient Port Temp"
bus "i2c-5" "i2c-1-mux (chan_id 3)"
chip "ucd9200-i2c-5-27"
label in1 "UCD1 vin"
label in2 "ASIC 3.3 vout"
label in3 "ASIC 1.2 vout"
label temp1 "UCD1 Temp"
label temp2 "UCD1 Temp2"
chip "ucd9200-i2c-5-41"
label in1 "UCD2 vin"
label in2 "ASIC Vcore vout"
label temp1 "UCD2 Temp1"
label temp2 "UCD2 Temp2"
bus "i2c-17" "i2c-1-mux (chan_id 7)"
chip "lm75-i2c-17-49"
label temp1 "Ambient Board Temp"

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/sensors.conf

View File

@ -12,7 +12,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Create a new dir and copy all ONIE-platform-string-named dirs into it
mkdir ./device
cp -r ../../../device/*/* ./device/
cp -r -H ../../../device/*/* ./device/
# Build the package
dpkg-buildpackage -rfakeroot -b -us -uc