Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
{% if PORT_ALL.append("Ethernet0") %}{% endif %}
{% if PORT_ALL.append("Ethernet1") %}{% endif %}
{% if PORT_ALL.append("Ethernet2") %}{% endif %}
{% if PORT_ALL.append("Ethernet3") %}{% endif %}
{% for port_idx in range(1,32) %}
{% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %}
{% endfor %}
{%- endmacro %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "12766208",
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "12766208",
"type": "egress",
"mode": "static"
},
"egress_lossy_pool": {
"size": "7326924",
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_lossless_pool]",
"size":"0",
"static_th":"12766208"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"1518",
"dynamic_th":"3"
}
},
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"mode": "static"
},
"egress_lossy_pool": {
"size": "8072396",
"size": "7326924",
"type": "egress",
"mode": "dynamic"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,148 +1 @@
{
"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"
}
},
"PORT_QOS_MAP": {
"Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": {
"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_enable": "3,4"
}
},
"WRED_PROFILE": {
"AZURE_LOSSLESS" : {
"wred_green_enable":"true",
"wred_yellow_enable":"true",
"wred_red_enable":"true",
"ecn":"ecn_all",
"red_max_threshold":"312000",
"red_min_threshold":"104000",
"yellow_max_threshold":"312000",
"yellow_min_threshold":"104000",
"green_max_threshold":"312000",
"green_min_threshold":"104000"
}
},
"QUEUE": {
"Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : {
"scheduler" : "[SCHEDULER|scheduler.0]"
},
"Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3" : {
"wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|4" : {
"wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : {
"scheduler" : "[SCHEDULER|scheduler.1]"
},
"Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : {
"scheduler" : "[SCHEDULER|scheduler.2]"
}
}
}
{%- include 'qos_config.j2' %}
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def __init__(self, index, sfp_type, eeprom_path):
self.sfpDomInfo = sff8472Dom(None,1)
self.qsfp_dd_Info = qsfp_dd_InterfaceId()
self.qsfp_dd_DomInfo = qsfp_dd_Dom()
self.qsfp_dd_app2_list = False

def get_eeprom_sysfs_path(self):
return self.eeprom_path
Expand All @@ -292,18 +293,6 @@ def detect_dom_capability(self):
dom_capability = self.qsfp_dd_Info.parse_dom_capability(qsfp_dom_capability_raw, 0)
if dom_capability['data']['Flat_MEM']['value'] == 'Off':
self.qsfp_dd_app2_list = True
self.dom_rx_power_supported = True
self.dom_tx_power_supported = True
self.dom_tx_bias_supported = True
else:
self.qsfp_dd_app2_list = False
self.dom_rx_power_supported = False
self.dom_tx_power_supported = False
self.dom_tx_bias_supported = False
else:
self.dom_rx_power_supported = False
self.dom_tx_power_supported = False
self.dom_tx_bias_supported = False

def _strip_unit_from_str(self, value_str):
match = re.match(r'(.*)C$|(.*)Volts$|(.*)mA$|(.*)dBm$', value_str)
Expand Down Expand Up @@ -629,7 +618,7 @@ def get_transceiver_info(self):
break
host_electrical, media_interface = self.qsfp_dd_Info.parse_application(sfp_media_type_dict,
sfp_application_type_list[i * 4], sfp_application_type_list[i * 4 + 1])
host_media_list = host_media_list + host_electrical + ' - ' + media_interface
host_media_list = host_media_list + host_electrical + ' - ' + media_interface + ' '
transceiver_info_dict['application_advertisement'] = host_media_list

return transceiver_info_dict
Expand Down Expand Up @@ -1079,8 +1068,6 @@ def get_tx_bias(self):
if self.sfp_type == 'QSFP_DD':
if self.qsfp_dd_DomInfo is None:
return None
if not self.dom_tx_bias_supported:
return None
tx_bias_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXBIAS_OFFSET, QSFP_DD_TXBIAS_WIDTH)
tx_bias_data = self.qsfp_dd_DomInfo.parse_dom_tx_bias(tx_bias_data_raw, 0)

Expand Down Expand Up @@ -1115,8 +1102,6 @@ def get_rx_power(self):
if self.sfp_type == 'QSFP_DD':
if self.qsfp_dd_DomInfo is None:
return None
if not self.dom_rx_power_supported:
return None

offset = 128
rx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_RXPOWER_OFFSET, QSFP_DD_TXPOWER_WIDTH)
Expand Down Expand Up @@ -1154,9 +1139,6 @@ def get_tx_power(self):
if self.qsfp_dd_DomInfo is None:
return None

if not self.dom_tx_power_supported:
return None

tx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXPOWER_OFFSET,
QSFP_DD_TXPOWER_WIDTH)
tx_power_data = self.qsfp_dd_DomInfo.parse_dom_tx_power(tx_power_data_raw, 0)
Expand Down
58 changes: 57 additions & 1 deletion platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@

MLNX_NUM_PSU = 2

DMI_FILE = '/sys/firmware/dmi/entries/2-0/raw'
DMI_HEADER_LEN = 15
DMI_PRODUCT_NAME = "Product Name"
DMI_MANUFACTURER = "Manufacturer"
DMI_VERSION = "Version"
DMI_SERIAL = "Serial Number"
DMI_ASSET_TAG = "Asset Tag"
DMI_LOC = "Location In Chassis"
DMI_TABLE_MAP = {
DMI_PRODUCT_NAME: 0,
DMI_MANUFACTURER: 1,
DMI_VERSION: 2,
DMI_SERIAL: 3,
DMI_ASSET_TAG: 4,
DMI_LOC: 5
}

EEPROM_CACHE_ROOT = '/var/cache/sonic/decode-syseeprom'
EEPROM_CACHE_FILE = 'syseeprom_cache'

Expand Down Expand Up @@ -67,6 +84,9 @@ def __init__(self):
# Initialize Platform name
self.platform_name = device_info.get_platform()

# Initialize DMI data
self.dmi_data = None

# move the initialization of each components to their dedicated initializer
# which will be called from platform
#
Expand Down Expand Up @@ -140,7 +160,6 @@ def initialize_fan(self):
fan = Fan(fan_index, drawer, index + 1)
fan_index += 1
drawer._fan_list.append(fan)
self._fan_list.append(fan)


def initialize_single_sfp(self, index):
Expand Down Expand Up @@ -240,6 +259,18 @@ def get_model(self):
string: Model/part number of device
"""
return self.model

def get_revision(self):
"""
Retrieves the hardware revision of the device

Returns:
string: Revision value of device
"""
if self.dmi_data is None:
self.dmi_data = self._parse_dmi(DMI_FILE)

return self.dmi_data.get(DMI_VERSION, "N/A")

##############################################
# SFP methods
Expand Down Expand Up @@ -394,6 +425,31 @@ def _read_generic_file(self, filename, len):
return '0'


def _parse_dmi(self, filename):
"""
Read DMI data chassis data and returns a dictionary of values

Returns:
A dictionary containing the dmi table of the switch chassis info
"""
result = {}
try:
fileobj = open(filename, "rb")
data = fileobj.read()
fileobj.close()

body = data[DMI_HEADER_LEN:]
records = body.split(b'\x00')

for k, v in DMI_TABLE_MAP.items():
result[k] = records[v].decode("utf-8")

except Exception as e:
logger.log_error("Fail to decode DMI {} due to {}".format(filename, repr(e)))

return result


def _verify_reboot_cause(self, filename):
'''
Open and read the reboot cause file in
Expand Down
Loading