From ba5c26a16f4de41767afb2a267067e53f2711301 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Thu, 5 Jan 2023 19:53:52 +0200 Subject: [PATCH 001/113] [submodule]: Advance sonic-sairedis submodule. (#13270) Update sonic-sairedis submodule pointer to include the following: 402eb14 [ppi]: Enable bulk API. (#1171) 86bb828 Switch to using stock gcovr 5.2 (#1174) 1c9ca78 Manage LANES mapping on VOQ system (#1127) 5887d31 Fix for [EVPN] When MAC moves from remote end point to local, ASIC DB fields are not updated properly for the mac #11503Update NotificationProcessor.cpp (#1118) 559bd5b [ci][asan] add DVS tests run with ASAN (#1139) 4ab46b5 Initialize attr variables in Legacy.switch_get and LegacyFdbEntry.fdb_entry_get (#1169) 4e24c77 The meta_sai_validate_fdb_entry() validates the input FDB entry for the (#1154) Signed-off-by: Nazarii Hnydyn --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 342f76f26789..402eb14a6dad 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 342f76f26789b73184f88ee8d3f16ed255703ab7 +Subproject commit 402eb14a6dad7c747c84c08643f2edb8e348ab3f From 06e1a0bc142bbe9f15421d7b6d7c3e4708d0c499 Mon Sep 17 00:00:00 2001 From: Mai Bui Date: Thu, 5 Jan 2023 19:22:09 -0500 Subject: [PATCH 002/113] [device/dell] Mitigation for security vulnerability (#11875) Dependency: [PR (#12065)](https://github.com/sonic-net/sonic-buildimage/pull/12065) needs to merge first. #### Why I did it `commands` module is not protected against malicious input `getstatusoutput` is detected without a static string, uses `shell=True` #### How I did it Eliminate the use of `commands` Use `subprocess.run()`, commands in `subprorcess.run()` are totally static Fix indentation #### How to verify it Tested on DUT [dell_log.txt](https://github.com/sonic-net/sonic-buildimage/files/9561332/dell_log.txt) --- .../plugins/fanutil.py | 29 ++- .../plugins/psuutil.py | 11 +- .../plugins/fanutil.py | 29 ++- .../plugins/psuutil.py | 11 +- .../plugins/psuutil.py | 12 +- .../plugins/psuutil.py | 8 +- .../plugins/psuutil.py | 62 ++--- .../plugins/psuutil.py | 13 +- .../plugins/psuutil.py | 17 +- .../plugins/psuutil.py | 13 +- .../plugins/psuutil.py | 55 ++--- .../plugins/fanutil.py | 98 ++++---- .../plugins/psuutil.py | 168 +++++++------- .../n3248pxe/sonic_platform/component.py | 6 +- .../n3248pxe/sonic_platform/psu.py | 20 +- .../n3248te/sonic_platform/component.py | 6 +- .../n3248te/sonic_platform/psu.py | 20 +- .../s5212f/scripts/platform_sensors.py | 80 ++++--- .../s5212f/sonic_platform/sfp.py | 23 +- .../s5224f/scripts/platform_sensors.py | 58 +++-- .../s5224f/sonic_platform/sfp.py | 23 +- .../s5232f/scripts/platform_sensors.py | 50 ++-- .../s5232f/sonic_platform/sfp.py | 23 +- .../s5248f/scripts/platform_sensors.py | 17 +- .../s5248f/sonic_platform/sfp.py | 25 +- .../s5296f/scripts/platform_sensors.py | 159 ++++++------- .../s5296f/sonic_platform/component.py | 5 +- .../s5296f/sonic_platform/sfp.py | 24 +- .../z9264f/scripts/platform_sensors.py | 6 +- .../z9264f/sonic_platform/sfp.py | 25 +- .../z9332f/scripts/platform_sensors.py | 16 +- .../z9332f/sonic_platform/component.py | 15 +- .../z9332f/sonic_platform/sfp.py | 23 +- .../z9432f/scripts/platform_sensors.py | 216 +++++++++--------- .../z9432f/sonic_platform/component.py | 16 +- .../z9432f/sonic_platform/sfp.py | 23 +- 36 files changed, 722 insertions(+), 683 deletions(-) diff --git a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/fanutil.py b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/fanutil.py index b70d58901330..e4d342923014 100644 --- a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/fanutil.py +++ b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/fanutil.py @@ -3,10 +3,10 @@ # Platform-specific FAN status interface for SONiC # -import commands import sys +from sonic_py_common.general import getstatusoutput_noshell -SENSORS_CMD = "docker exec -i pmon /usr/bin/sensors" +SENSORS_CMD = ["docker", "exec", "-i", "pmon", "/usr/bin/sensors"] DOCKER_SENSORS_CMD = "/usr/bin/sensors" @@ -33,24 +33,23 @@ def isDockerEnv(self): return True def get_num_fans(self): - n3248pxe_MAX_FANTRAYS = 3 - return n3248pxe_MAX_FANTRAYS + n3248pxe_MAX_FANTRAYS = 3 + return n3248pxe_MAX_FANTRAYS def get_presence(self, idx): - sysfs_path = "/sys/devices/platform/dell-n3248pxe-cpld.0/fan" + self._fan_mapping[idx] + "_prs" - return int(open(sysfs_path).read(), 16) + sysfs_path = "/sys/devices/platform/dell-n3248pxe-cpld.0/fan" + self._fan_mapping[idx] + "_prs" + return int(open(sysfs_path).read(), 16) def get_direction(self, idx): - sysfs_path = "/sys/devices/platform/dell-n3248pxe-cpld.0/fan" + self._fan_mapping[idx] + "_dir" - return open(sysfs_path).read() + sysfs_path = "/sys/devices/platform/dell-n3248pxe-cpld.0/fan" + self._fan_mapping[idx] + "_dir" + return open(sysfs_path).read() def get_speed(self, idx): dockerenv = self.isDockerEnv() if not dockerenv: - status, cmd_output = commands.getstatusoutput(SENSORS_CMD) - else : - status, cmd_output = commands.getstatusoutput(DOCKER_SENSORS_CMD) - + status, cmd_output = getstatusoutput_noshell(SENSORS_CMD) + else: + status, cmd_output = getstatusoutput_noshell(DOCKER_SENSORS_CMD) if status: print('Failed to execute sensors command') sys.exit(0) @@ -64,9 +63,9 @@ def get_speed(self, idx): return 0.0 def get_status(self, idx): - sysfs_path = "/sys/devices/platform/dell-n3248pxe-cpld.0/fan" + self._fan_mapping[idx] + "_prs" - return int(open(sysfs_path).read(), 16) + sysfs_path = "/sys/devices/platform/dell-n3248pxe-cpld.0/fan" + self._fan_mapping[idx] + "_prs" + return int(open(sysfs_path).read(), 16) def set_speed(self, idx): - return False + return False diff --git a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/psuutil.py index a9cfd00b9e2d..758068dc4734 100644 --- a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/psuutil.py @@ -3,11 +3,11 @@ # Platform-specific PSU status interface for SONiC # -import commands import os import sys +from sonic_py_common.general import getstatusoutput_noshell -SENSORS_CMD = "docker exec -i pmon /usr/bin/sensors" +SENSORS_CMD = ["docker", "exec", "-i", "pmon", "/usr/bin/sensors"] DOCKER_SENSORS_CMD = "/usr/bin/sensors" try: @@ -95,10 +95,9 @@ def get_psu_presence(self, index): def get_sensor(self): dockerenv = self.isDockerEnv() if not dockerenv: - status, cmd_output = commands.getstatusoutput(SENSORS_CMD) - else : - status, cmd_output = commands.getstatusoutput(DOCKER_SENSORS_CMD) - + status, cmd_output = getstatusoutput_noshell(SENSORS_CMD) + else: + status, cmd_output = getstatusoutput_noshell(DOCKER_SENSORS_CMD) if status: print('Failed to execute sensors command') sys.exit(0) diff --git a/device/dell/x86_64-dellemc_n3248te_c3338-r0/plugins/fanutil.py b/device/dell/x86_64-dellemc_n3248te_c3338-r0/plugins/fanutil.py index 47979b5d7ab5..974d9156e2dc 100644 --- a/device/dell/x86_64-dellemc_n3248te_c3338-r0/plugins/fanutil.py +++ b/device/dell/x86_64-dellemc_n3248te_c3338-r0/plugins/fanutil.py @@ -3,10 +3,10 @@ # Platform-specific FAN status interface for SONiC # -import subprocess import sys +from sonic_py_common.general import getstatusoutput_noshell -SENSORS_CMD = "docker exec -i pmon /usr/bin/sensors" +SENSORS_CMD = ["docker", "exec", "-i", "pmon", "/usr/bin/sensors"] DOCKER_SENSORS_CMD = "/usr/bin/sensors" @@ -33,24 +33,23 @@ def isDockerEnv(self): return True def get_num_fans(self): - N3248TE_MAX_FANTRAYS = 3 - return N3248TE_MAX_FANTRAYS + N3248TE_MAX_FANTRAYS = 3 + return N3248TE_MAX_FANTRAYS def get_presence(self, idx): - sysfs_path = "/sys/devices/platform/dell-n3248te-cpld.0/fan" + self._fan_mapping[idx] + "_prs" - return int(open(sysfs_path).read(), 16) + sysfs_path = "/sys/devices/platform/dell-n3248te-cpld.0/fan" + self._fan_mapping[idx] + "_prs" + return int(open(sysfs_path).read(), 16) def get_direction(self, idx): - sysfs_path = "/sys/devices/platform/dell-n3248te-cpld.0/fan" + self._fan_mapping[idx] + "_dir" - return open(sysfs_path).read() + sysfs_path = "/sys/devices/platform/dell-n3248te-cpld.0/fan" + self._fan_mapping[idx] + "_dir" + return open(sysfs_path).read() def get_speed(self, idx): dockerenv = self.isDockerEnv() if not dockerenv: - status, cmd_output = subprocess.getstatusoutput(SENSORS_CMD) - else : - status, cmd_output = subprocess.getstatusoutput(DOCKER_SENSORS_CMD) - + status, cmd_output = getstatusoutput_noshell(SENSORS_CMD) + else: + status, cmd_output = getstatusoutput_noshell(DOCKER_SENSORS_CMD) if status: print('Failed to execute sensors command') sys.exit(0) @@ -64,9 +63,9 @@ def get_speed(self, idx): return 0.0 def get_status(self, idx): - sysfs_path = "/sys/devices/platform/dell-n3248te-cpld.0/fan" + self._fan_mapping[idx] + "_prs" - return int(open(sysfs_path).read(), 16) + sysfs_path = "/sys/devices/platform/dell-n3248te-cpld.0/fan" + self._fan_mapping[idx] + "_prs" + return int(open(sysfs_path).read(), 16) def set_speed(self, idx): - return False + return False diff --git a/device/dell/x86_64-dellemc_n3248te_c3338-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_n3248te_c3338-r0/plugins/psuutil.py index 13e95ed2549d..c334cc89271d 100644 --- a/device/dell/x86_64-dellemc_n3248te_c3338-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_n3248te_c3338-r0/plugins/psuutil.py @@ -3,11 +3,11 @@ # Platform-specific PSU status interface for SONiC # -import commands import os import sys +from sonic_py_common.general import getstatusoutput_noshell -SENSORS_CMD = "docker exec -i pmon /usr/bin/sensors" +SENSORS_CMD = ["docker", "exec", "-i", "pmon", "/usr/bin/sensors"] DOCKER_SENSORS_CMD = "/usr/bin/sensors" try: @@ -95,10 +95,9 @@ def get_psu_presence(self, index): def get_sensor(self): dockerenv = self.isDockerEnv() if not dockerenv: - status, cmd_output = commands.getstatusoutput(SENSORS_CMD) - else : - status, cmd_output = commands.getstatusoutput(DOCKER_SENSORS_CMD) - + status, cmd_output = getstatusoutput_noshell(SENSORS_CMD) + else: + status, cmd_output = getstatusoutput_noshell(DOCKER_SENSORS_CMD) if status: print('Failed to execute sensors command') sys.exit(0) diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/psuutil.py index 9a71f7b91144..f8c5b0193a4c 100644 --- a/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/psuutil.py @@ -5,11 +5,11 @@ import logging import sys -import subprocess +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe S5212F_MAX_PSUS = 2 -IPMI_PSU_DATA = "docker exec -it pmon ipmitool sdr list" -IPMI_PSU_DATA_DOCKER = "ipmitool sdr list" +IPMI_PSU_DATA = ["docker", "exec", "-it", "pmon", "ipmitool", "sdr", "list"] +IPMI_PSU_DATA_DOCKER = ["ipmitool", "sdr", "list"] PSU_PRESENCE = "PSU{0}_stat" # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" @@ -44,7 +44,7 @@ def get_pmc_register(self, reg_name): if dockerenv == True: ipmi_cmd = IPMI_PSU_DATA_DOCKER - status, ipmi_sdr_list = subprocess.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) @@ -91,6 +91,8 @@ def get_psu_presence(self, index): :param index: An integer, index of the PSU of which to query status :return: Boolean, True if PSU is plugged, False if not """ - cmd_status, psu_status = subprocess.getstatusoutput('ipmitool raw 0x04 0x2d ' + hex(0x30 + index) + " | awk '{print substr($0,9,1)}'") + ipmi_cmd = ["ipmitool", "raw", "0x04", "0x2d", hex(0x30 + index)] + awk_cmd = ['awk', '{print substr($0,9,1)}'] + cmd_status, psu_status = getstatusoutput_noshell_pipe(ipmi_cmd, awk_cmd) return 1 if psu_status == '1' else 0 diff --git a/device/dell/x86_64-dellemc_s5224f_c3538-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_s5224f_c3538-r0/plugins/psuutil.py index 8ae70b9755e1..6613af1661ea 100644 --- a/device/dell/x86_64-dellemc_s5224f_c3538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_s5224f_c3538-r0/plugins/psuutil.py @@ -6,7 +6,7 @@ import logging import sys -import subprocess +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe S5224F_MAX_PSUS = 2 IPMI_PSU_DATA = "docker exec -it pmon ipmitool sdr list" @@ -45,7 +45,7 @@ def get_pmc_register(self, reg_name): if dockerenv == True: ipmi_cmd = IPMI_PSU_DATA_DOCKER - status, ipmi_sdr_list = subprocess.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) @@ -92,6 +92,8 @@ def get_psu_presence(self, index): :param index: An integer, index of the PSU of which to query status :return: Boolean, True if PSU is plugged, False if not """ - cmd_status, psu_status = subprocess.getstatusoutput('ipmitool raw 0x04 0x2d ' + hex(0x30 + index) + " | awk '{print substr($0,9,1)}'") + ipmi_cmd = ["ipmitool", "raw", "0x04", "0x2d", hex(0x30 + index)] + awk_cmd = ['awk', '{print substr($0,9,1)}'] + cmd_status, psu_status = getstatusoutput_noshell_pipe(ipmi_cmd, awk_cmd) return 1 if psu_status == '1' else 0 diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_s5232f_c3538-r0/plugins/psuutil.py index 27042e3122b4..5dc44f9918fd 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/plugins/psuutil.py @@ -4,22 +4,17 @@ # -import os.path import logging import sys - -if sys.version_info[0] < 3: - import commands -else: - import subprocess as commands - +from sonic_py_common.general import getstatusoutput_noshell_pipe S5232F_MAX_PSUS = 2 -IPMI_PSU1_DATA = "docker exec -it pmon ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'" -IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA = "docker exec -it pmon ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'" +IPMI_PSU1_DATA = ["docker", "exec", "-it", "pmon", "ipmitool", "raw", "0x04", "0x2d", "0x31"] +IPMI_PSU1_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x31"] +IPMI_PSU2_DATA = ["docker", "exec", "-it", "pmon", "ipmitool", "raw", "0x04", "0x2d", "0x32"] +IPMI_PSU2_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x32"] PSU_PRESENCE = "PSU{0}_stat" +awk_cmd = ['awk', '{print substr($0,9,1)}'] # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" @@ -44,23 +39,24 @@ def isDockerEnv(self): return False # Fetch a BMC register - def get_pmc_register(self, reg_name): + def get_pmc_register(self, index): status = 1 - ipmi_cmd_1 = IPMI_PSU1_DATA - ipmi_cmd_2 = IPMI_PSU1_DATA + ipmi_cmd = '' dockerenv = self.isDockerEnv() if dockerenv == True: if index == 1: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ipmi_cmd = IPMI_PSU1_DATA_DOCKER elif index == 2: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ipmi_cmd = IPMI_PSU2_DATA_DOCKER else: if index == 1: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA) + ipmi_cmd = IPMI_PSU1_DATA elif index == 2: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA) - + ipmi_cmd = IPMI_PSU2_DATA + if ipmi_cmd != '': + status, ipmi_sdr_list = getstatusoutput_noshell_pipe(ipmi_cmd, awk_cmd) + if status: logging.error('Failed to execute ipmitool') sys.exit(0) @@ -87,22 +83,25 @@ def get_psu_status(self, index): """ # Until psu_status is implemented this is hardcoded temporarily - psu_status = 'f' + psu_status = '' ret_status = 1 + ipmi_cmd = '' dockerenv = self.isDockerEnv() if dockerenv == True: if index == 1: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ipmi_cmd = IPMI_PSU1_DATA_DOCKER elif index == 2: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ipmi_cmd = IPMI_PSU2_DATA_DOCKER else: if index == 1: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA) + ipmi_cmd = IPMI_PSU1_DATA elif index == 2: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA) + ipmi_cmd = IPMI_PSU2_DATA + if ipmi_cmd != '': + ret_status, ipmi_sdr_list = getstatusoutput_noshell_pipe(ipmi_cmd, awk_cmd) if ret_status: - logging.error('Failed to execute ipmitool : ') + logging.error('Failed to execute ipmitool') sys.exit(0) psu_status = ipmi_sdr_list @@ -117,20 +116,23 @@ def get_psu_presence(self, index): """ psu_status = '0' ret_status = 1 + ipmi_cmd = '' dockerenv = self.isDockerEnv() if dockerenv == True: if index == 1: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ipmi_cmd = IPMI_PSU1_DATA_DOCKER elif index == 2: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ipmi_cmd = IPMI_PSU2_DATA_DOCKER else: if index == 1: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA) + ipmi_cmd = IPMI_PSU1_DATA elif index == 2: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA) + ipmi_cmd = IPMI_PSU2_DATA + if ipmi_cmd != '': + ret_status, ipmi_sdr_list = getstatusoutput_noshell_pipe(ipmi_cmd, awk_cmd) if ret_status: - logging.error('Failed to execute ipmitool : ') + logging.error('Failed to execute ipmitool') sys.exit(0) psu_status = ipmi_sdr_list diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_s5248f_c3538-r0/plugins/psuutil.py index 9cd186611486..9a4e20705b32 100644 --- a/device/dell/x86_64-dellemc_s5248f_c3538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_s5248f_c3538-r0/plugins/psuutil.py @@ -4,19 +4,14 @@ # -import os.path import logging import sys - -if sys.version_info[0] < 3: - import commands -else: - import subprocess as commands +from sonic_py_common.general import getstatusoutput_noshell S5248F_MAX_PSUS = 2 -IPMI_PSU_DATA = "docker exec -it pmon ipmitool sdr list" -IPMI_PSU_DATA_DOCKER = "ipmitool sdr list" +IPMI_PSU_DATA = ["docker", "exec", "-it", "pmon", "ipmitool", "sdr", "list"] +IPMI_PSU_DATA_DOCKER = ["ipmitool", "sdr", "list"] PSU_PRESENCE = "PSU{0}_stat" # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" @@ -53,7 +48,7 @@ def get_pmc_register(self, reg_name): if dockerenv == True: ipmi_cmd = IPMI_PSU_DATA_DOCKER - status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) diff --git a/device/dell/x86_64-dellemc_s5296f_c3538-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_s5296f_c3538-r0/plugins/psuutil.py index 8a7b53a626bf..2c39fa793434 100644 --- a/device/dell/x86_64-dellemc_s5296f_c3538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_s5296f_c3538-r0/plugins/psuutil.py @@ -6,16 +6,12 @@ import logging import sys - -if sys.version_info[0] < 3: - import commands -else: - import subprocess as commands +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe S5296F_MAX_PSUS = 2 -IPMI_PSU_DATA = "docker exec -it pmon ipmitool sdr list" -IPMI_PSU_DATA_DOCKER = "ipmitool sdr list" +IPMI_PSU_DATA = ["docker", "exec", "-it", "pmon", "ipmitool", "sdr", "list"] +IPMI_PSU_DATA_DOCKER = ["ipmitool", "sdr", "list"] PSU_PRESENCE = "PSU{0}_stat" # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" @@ -50,7 +46,7 @@ def get_pmc_register(self, reg_name): if dockerenv == True: ipmi_cmd = IPMI_PSU_DATA_DOCKER - status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) @@ -97,6 +93,7 @@ def get_psu_presence(self, index): :param index: An integer, index of the PSU of which to query status :return: Boolean, True if PSU is plugged, False if not """ - cmd_status, psu_status = commands.getstatusoutput( - 'ipmitool raw 0x04 0x2d ' + hex(0x30 + index) + " | awk '{print substr($0,9,1)}'") + ipmi_cmd = ["ipmitool", "raw", "0x04", "0x2d", hex(0x30 + index)] + awk_cmd = ["awk", "{print substr($0,9,1)}"] + cmd_status, psu_status = getstatusoutput_noshell_pipe(ipmi_cmd, awk_cmd) return 1 if psu_status == '1' else 0 diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py index 3a58afda8df4..3f3841095ce9 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py @@ -4,19 +4,14 @@ # -import os.path import logging import sys - -if sys.version_info[0] < 3: - import commands -else: - import subprocess as commands +from sonic_py_common.general import getstatusoutput_noshell Z9264F_MAX_PSUS = 2 -IPMI_PSU_DATA = "docker exec -it pmon ipmitool sdr list" -IPMI_PSU_DATA_DOCKER = "ipmitool sdr list" +IPMI_PSU_DATA = ["docker", "exec", "-it", "pmon", "ipmitool", "sdr", "list"] +IPMI_PSU_DATA_DOCKER = ["ipmitool", "sdr", "list"] PSU_PRESENCE = "PSU{0}_state" # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" @@ -53,7 +48,7 @@ def get_pmc_register(self, reg_name): if dockerenv == True: ipmi_cmd = IPMI_PSU_DATA_DOCKER - status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_z9332f_d1508-r0/plugins/psuutil.py index 435f9b2929ec..a559cfe4742c 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/plugins/psuutil.py @@ -4,25 +4,21 @@ # -import os.path import logging import sys - -if sys.version_info[0] < 3: - import commands -else: - import subprocess as commands +from sonic_py_common.general import getstatusoutput_noshell_pipe Z9332F_MAX_PSUS = 2 -IPMI_PSU1_DATA = "docker exec -it pmon ipmitool raw 0x04 0x2d 0x2f | awk '{print substr($0,9,1)}'" -IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x2f | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA = "docker exec -it pmon ipmitool raw 0x04 0x2d 0x39 | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x39 | awk '{print substr($0,9,1)}'" +IPMI_PSU1_DATA = ["docker", "exec", "-it", "pmon", "ipmitool", "raw", "0x04", "0x2d", "0x2f"] +IPMI_PSU1_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x2f"] +IPMI_PSU2_DATA = ["docker", "exec", "-it", "pmon", "ipmitool", "raw", "0x04", "0x2d", "0x39"] +IPMI_PSU2_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x39"] PSU_PRESENCE = "PSU{0}_Status" # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" ipmi_sdr_list = "" +awk_cmd = ['awk', '{print substr($0,9,1)}'] try: @@ -46,28 +42,24 @@ def isDockerEnv(self): # Fetch a BMC register def get_pmc_register(self, reg_name): - - status = 1 global ipmi_sdr_list - ipmi_dev_node = "/dev/pmi0" - ipmi_cmd_1 = IPMI_PSU1_DATA - ipmi_cmd_2 = IPMI_PSU1_DATA + ipmi_cmd = '' dockerenv = self.isDockerEnv() if dockerenv == True: if index == 1: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ipmi_cmd = IPMI_PSU1_DATA_DOCKER elif index == 2: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ipmi_cmd = IPMI_PSU2_DATA_DOCKER else: if index == 1: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA) + ipmi_cmd = IPMI_PSU1_DATA elif index == 2: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA) - - if status: - logging.error('Failed to execute ipmitool') - sys.exit(0) - + ipmi_cmd = IPMI_PSU2_DATA + if ipmi_cmd != '': + status, ipmi_sdr_list = getstatusoutput_noshell_pipe(ipmi_cmd, awk_cmd) + if status: + logging.error('Failed to execute ipmitool') + sys.exit(0) output = ipmi_sdr_list return output @@ -100,22 +92,23 @@ def get_psu_presence(self, index): :param index: An integer, index of the PSU of which to query status :return: Boolean, True if PSU is plugged, False if not """ + ipmi_cmd = '' status = 0 - ret_status = 1 + # ret_status = 1 global ipmi_sdr_list - ipmi_dev_node = "/dev/pmi0" dockerenv = self.isDockerEnv() if dockerenv == True: if index == 1: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ipmi_cmd = IPMI_PSU1_DATA_DOCKER elif index == 2: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ipmi_cmd = IPMI_PSU2_DATA_DOCKER else: if index == 1: - status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA) + ipmi_cmd = IPMI_PSU1_DATA elif index == 2: - ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA) - + ipmi_cmd = IPMI_PSU2_DATA + if ipmi_cmd != '': + status, ipmi_sdr_list = getstatusoutput_noshell_pipe(ipmi_cmd, awk_cmd) # if ret_status: # print ipmi_sdr_list # logging.error('Failed to execute ipmitool') diff --git a/device/dell/x86_64-dellemc_z9432f_c3758-r0/plugins/fanutil.py b/device/dell/x86_64-dellemc_z9432f_c3758-r0/plugins/fanutil.py index 5dabf2de100b..3788c0d70585 100644 --- a/device/dell/x86_64-dellemc_z9432f_c3758-r0/plugins/fanutil.py +++ b/device/dell/x86_64-dellemc_z9432f_c3758-r0/plugins/fanutil.py @@ -7,7 +7,7 @@ # ############################################################################# import logging -import commands +from sonic_py_common.general import getstatusoutput_noshell try: from sonic_fan.fan_base import FanBase @@ -20,10 +20,10 @@ class FanUtil(FanBase): NUM_FANS_PERTRAY = 2 FANTRAY_NUM_START_IDX = 1 FRU_FAN_START_IDX = 1 - IPMI_FAN_PRESENCE = "ipmitool sensor get FAN{0}_prsnt" - IPMI_FAN_FRONT_SPEED = "ipmitool sdr get Fan{0}_Front_rpm" - IPMI_FAN_REAR_SPEED = "ipmitool sdr get Fan{0}_Rear_rpm" - IPMI_FRU_DATA = "ipmitool fru print {0}" + IPMI_FAN_PRESENCE = ["ipmitool", "sensor", "get", ""] + IPMI_FAN_FRONT_SPEED = ["ipmitool", "sdr", "get", ""] + IPMI_FAN_REAR_SPEED = ["ipmitool", "sdr", "get", ""] + IPMI_FRU_DATA = ["ipmitool", "fru", "print", ""] def __init__(self, log_level=logging.DEBUG): FanBase.__init__(self) @@ -31,59 +31,63 @@ def __init__(self, log_level=logging.DEBUG): def get_fan_status(self,fan_id): try: - ret_status, ipmi_cmd_ret = commands.getstatusoutput(self.IPMI_FAN_PRESENCE.format(fan_id)) - if ret_status == 0: - return(ipmi_cmd_ret.splitlines()[5].strip(' ').strip('[]')) + self.IPMI_FAN_PRESENCE[3] = 'FAN' + str(fan_id) + '_prsnt' + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(self.IPMI_FAN_PRESENCE) + if ret_status == 0: + return(ipmi_cmd_ret.splitlines()[5].strip(' ').strip('[]')) except Exception: - logging.error('Failed to execute : %s'%self.IPMI_FAN_PRESENCE.format(fan_id)) + logging.error('Failed to execute : %s'%(' '.join(self.IPMI_FAN_PRESENCE))) def get_front_fan_speed(self,fan_id): try: - ret_status, ipmi_cmd_ret = commands.getstatusoutput(self.IPMI_FAN_FRONT_SPEED.format(fan_id)) - if ret_status == 0: - rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] - return rdata + self.IPMI_FAN_FRONT_SPEED[3] = 'Fan' + str(fan_id) + '_Front_rpm' + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(self.IPMI_FAN_FRONT_SPEED) + if ret_status == 0: + rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] + return rdata except Exception: - logging.error('Failed to execute : %s'%self.IPMI_FAN_FRONT_SPEED.format(fan_id)) + logging.error('Failed to execute : %s'%(' '.join(self.IPMI_FAN_FRONT_SPEED))) def get_rear_fan_speed(self,fan_id): try: - ret_status, ipmi_cmd_ret = commands.getstatusoutput(self.IPMI_FAN_REAR_SPEED.format(fan_id)) - if ret_status == 0: - rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] - return rdata + self.IPMI_FAN_REAR_SPEED[3] = 'Fan' + str(fan_id) + '_Rear_rpm' + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(self.IPMI_FAN_REAR_SPEED) + if ret_status == 0: + rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] + return rdata except Exception: - logging.error('Failed to execute : %s'%self.IPMI_FAN_REAR_SPEED.format(fan_id)) + logging.error('Failed to execute : %s'%(' '.join(self.IPMI_FAN_REAR_SPEED))) # Read FAN FRU info def get_fan_direction_from_fru(self,fru_id,reg_name): output = None try: - status, ipmi_fru_list = commands.getstatusoutput(self.IPMI_FRU_DATA.format(fru_id)) - if status == 0: - for item in ipmi_fru_list.split("\n"): - if reg_name in item: - output = item.strip() - if output is None: - logging.error('\nFailed to fetch: ' + reg_name + ' sensor ') - output = output.split(':')[1].strip(' ') - if output == 'F2B' or output == 'B2F': - return output + self.IPMI_FRU_DATA[3] = str(fru_id) + status, ipmi_fru_list = getstatusoutput_noshell(self.IPMI_FRU_DATA) + if status == 0: + for item in ipmi_fru_list.split("\n"): + if reg_name in item: + output = item.strip() + if output is None: + logging.error('\nFailed to fetch: ' + reg_name + ' sensor ') + output = output.split(':')[1].strip(' ') + if output == 'F2B' or output == 'B2F': + return output except Exception: - logging.error('Failed to execute:' + ipmi_fru_list) + logging.error('Failed to execute:' + ipmi_fru_list) def get_num_fans(self): return self.num_fans def get_presence(self, index): if index is None: - return False + return False if index < self.FANTRAY_NUM_START_IDX or index > self.FANTRAY_NUM_START_IDX + self.num_fans - 1: - logging.error('Invalid FAN index:%d', index) - return False + logging.error('Invalid FAN index:%d', index) + return False tray_index = ((index-1)/self.NUM_FANS_PERTRAY) + 1 @@ -94,11 +98,11 @@ def get_presence(self, index): def get_status(self, index): if index is None: - return False + return False if index < self.FANTRAY_NUM_START_IDX or index > self.FANTRAY_NUM_START_IDX + self.num_fans - 1: - logging.error('Invalid FAN index:%d', index) - return False + logging.error('Invalid FAN index:%d', index) + return False tray_index = ((index-1)/self.NUM_FANS_PERTRAY) + 1 fantray_front_speed=self.get_front_fan_speed(tray_index) @@ -112,38 +116,38 @@ def get_status(self, index): def get_direction(self, index): if index is None: - return None + return None if index < self.FANTRAY_NUM_START_IDX or index > self.FANTRAY_NUM_START_IDX + self.num_fans - 1: - logging.error('Invalid FAN index:%d', index) - return None + logging.error('Invalid FAN index:%d', index) + return None tray_index = ((index-1)/self.NUM_FANS_PERTRAY) fru_id = self.FRU_FAN_START_IDX + tray_index direction = self.get_fan_direction_from_fru(fru_id,'Board Extra') if direction == 'B2F': - return "INTAKE" + return "INTAKE" elif direction == 'F2B': - return "EXHAUST" + return "EXHAUST" else: - return None + return None def get_speed(self, index): if index is None: - return 0 + return 0 if index < self.FANTRAY_NUM_START_IDX or index > self.FANTRAY_NUM_START_IDX + self.num_fans - 1: - logging.error('Invalid FAN index:%d', index) - return 0 + logging.error('Invalid FAN index:%d', index) + return 0 tray_index = ((index-1)/self.NUM_FANS_PERTRAY) + 1 if (index % 2 != 0): - fantray_speed=self.get_front_fan_speed(tray_index) + fantray_speed=self.get_front_fan_speed(tray_index) else: - fantray_speed=self.get_rear_fan_speed(tray_index) + fantray_speed=self.get_rear_fan_speed(tray_index) if (self.get_presence(index) == True): return int(fantray_speed.strip()) diff --git a/device/dell/x86_64-dellemc_z9432f_c3758-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_z9432f_c3758-r0/plugins/psuutil.py index aaf02fec0c70..897744f69c58 100644 --- a/device/dell/x86_64-dellemc_z9432f_c3758-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_z9432f_c3758-r0/plugins/psuutil.py @@ -3,7 +3,7 @@ # Platform-specific PSU status interface for SONiC # import logging -import commands +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe Z9332F_MAX_PSUS = 2 FRU_PSUL = 11 @@ -18,14 +18,15 @@ class PsuUtil(PsuBase): """Platform-specific PSUutil class""" - IPMI_PSU1_DATA = "ipmitool raw 0x04 0x2d 0x2f | awk '{print substr($0,9,1)}'" - IPMI_PSU2_DATA = "ipmitool raw 0x04 0x2d 0x39 | awk '{print substr($0,9,1)}'" - IPMI_PSU_VOUT = "ipmitool sdr get PSU{0}_VOut" - IPMI_PSU_POUT = "ipmitool sdr get PSU{0}_POut" - IPMI_PSU_COUT = "ipmitool sdr get PSU{0}_COut" - IPMI_PSU_FAN_SPEED = "ipmitool sdr get PSU{0}_Fan" - IPMI_FRU = "ipmitool fru" - IPMI_FRU_DATA = "ipmitool fru print {0}" + IPMI_PSU1_DATA = ["ipmitool", "raw", "0x04", "0x2d", "0x2f"] + IPMI_PSU2_DATA = ["ipmitool", "raw", "0x04", "0x2d", "0x39"] + IPMI_PSU_VOUT = ["ipmitool", "sdr", "get", ""] + IPMI_PSU_POUT = ["ipmitool", "sdr", "get", ""] + IPMI_PSU_COUT = ["ipmitool", "sdr", "get", ""] + IPMI_PSU_FAN_SPEED = ["ipmitool", "sdr", "get", ""] + IPMI_FRU = ["ipmitool", "fru"] + IPMI_FRU_DATA = ["ipmitool", "fru", "print", ""] + awk_cmd = ['awk', '{print substr($0,9,1)}'] def __init__(self): PsuBase.__init__(self) @@ -39,62 +40,66 @@ def isDockerEnv(self): def get_psu_vout(self,index): try: - ret_status, ipmi_cmd_ret = commands.getstatusoutput(self.IPMI_PSU_VOUT.format(index)) - if ret_status == 0: - rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] - return rdata + self.IPMI_PSU_VOUT[3] = 'PSU' + str(index) + '_VOut' + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(self.IPMI_PSU_VOUT) + if ret_status == 0: + rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] + return rdata except Exception: - logging.error('Failed to execute : %s'%self.IPMI_PSU_VOUT.format(index)) + logging.error('Failed to execute : %s'%(' '.join(self.IPMI_PSU_VOUT))) def get_psu_cout(self,index): try: - ret_status, ipmi_cmd_ret = commands.getstatusoutput(self.IPMI_PSU_COUT.format(index)) - if ret_status == 0: - rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] - return rdata + self.IPMI_PSU_COUT[3] = 'PSU' + str(index) + 'POut' + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(self.IPMI_PSU_COUT) + if ret_status == 0: + rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] + return rdata except Exception: - logging.error('Failed to execute : %s'%self.IPMI_PSU_COUT.format(index)) + logging.error('Failed to execute : %s'%(' '.join(self.IPMI_PSU_COUT))) def get_psu_pout(self,index): try: - ret_status, ipmi_cmd_ret = commands.getstatusoutput(self.IPMI_PSU_POUT.format(index)) - if ret_status == 0: - rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] - return rdata + self.IPMI_PSU_POUT[3] = 'PSU' + str(index) + '_COut' + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(self.IPMI_PSU_POUT) + if ret_status == 0: + rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] + return rdata except Exception: - logging.error('Failed to execute : %s'%self.IPMI_PSU_POUT.format(index)) + logging.error('Failed to execute : %s'%(' '.join(self.IPMI_PSU_POUT))) def get_psu_fan_speed(self,index): try: - ret_status, ipmi_cmd_ret = commands.getstatusoutput(self.IPMI_PSU_FAN_SPEED.format(index)) - if ret_status == 0: - rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] - return rdata + self.IPMI_PSU_FAN_SPEED[3] = 'PSU' + str(index) + '_Fan' + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(self.IPMI_PSU_FAN_SPEED) + if ret_status == 0: + rdata = ipmi_cmd_ret.splitlines()[3].split(':')[1].split(' ')[1] + return rdata except Exception: - logging.error('Failed to execute : %s'%self.IPMI_PSU_FAN_SPEED.format(index)) + logging.error('Failed to execute : %s'%(' '.join(self.IPMI_PSU_FAN_SPEED))) #Fetch FRU Data for given fruid def get_psu_airflow(self, index): if index == 1: - fru_id = 'FRU_PSUL' + fru_id = 'FRU_PSUL' else: - fru_id = 'FRU_PSUR' + fru_id = 'FRU_PSUR' - ret_status, ipmi_cmd_ret = commands.getstatusoutput(self.IPMI_FRU) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(self.IPMI_FRU) if ret_status: - logging.error('Failed to execute ipmitool: '+ self.IPMI_FRU) + logging.error('Failed to execute ipmitool: '+ self.IPMI_FRU) found_fru = False for line in ipmi_cmd_ret.splitlines(): if line.startswith('FRU Device Description') and fru_id in line.split(':')[1] : - found_fru = True + found_fru = True if found_fru and line.startswith(' Board Product '): - return ' B2F' if 'PS/IO' in line else ' F2B' + return ' B2F' if 'PS/IO' in line else ' F2B' return '' # Read FRU info @@ -102,21 +107,22 @@ def get_fru_info(self,fru_id,reg_name): output = None Found = False try: - status, ipmi_fru_list = commands.getstatusoutput(self.IPMI_FRU_DATA.format(fru_id)) - if status == 0: - for item in ipmi_fru_list.split("\n"): - if reg_name == item.split(':')[0].strip(' '): - output = item.strip() - output = output.split(':')[1] - Found = True - break; - - if not Found: - logging.error('\nFailed to fetch: ' + reg_name + ' sensor ') - - return output + self.IPMI_FRU_DATA[3] = str(fru_id) + status, ipmi_fru_list = getstatusoutput_noshell(self.IPMI_FRU_DATA) + if status == 0: + for item in ipmi_fru_list.split("\n"): + if reg_name == item.split(':')[0].strip(' '): + output = item.strip() + output = output.split(':')[1] + Found = True + break; + + if not Found: + logging.error('\nFailed to fetch: ' + reg_name + ' sensor ') + + return output except Exception: - logging.error('Failed to execute:' + ipmi_fru_list) + logging.error('Failed to execute:' + ipmi_fru_list) def get_num_psus(self): """ @@ -135,17 +141,18 @@ def get_psu_status(self, index): faulty """ psu_status = '0' - + ipmi_cmd = '' if index == 1: - cmd_status, psu_status = commands.getstatusoutput(self.IPMI_PSU1_DATA) + ipmi_cmd = self.IPMI_PSU1_DATA elif index == 2: - cmd_status, psu_status = commands.getstatusoutput(self.IPMI_PSU2_DATA) + ipmi_cmd = self.IPMI_PSU2_DATA else: - logging.error("Invalid PSU number:" + index) - - if cmd_status: - logging.error('Failed to execute ipmitool') + logging.error("Invalid PSU number:" + index) + if ipmi_cmd != '': + cmd_status, psu_status = getstatusoutput_noshell_pipe(ipmi_cmd, self.awk_cmd) + if cmd_status: + logging.error('Failed to execute ipmitool') return (not int(psu_status, 16) > 1) def get_psu_presence(self, index): @@ -155,82 +162,85 @@ def get_psu_presence(self, index): :param index: An integer, index of the PSU of which to query status :return: Boolean, True if PSU is plugged, False if not """ - psu_status = '0' + psu_status = '0' + ipmi_cmd = '' if index == 1: - cmd_status, psu_status = commands.getstatusoutput(self.IPMI_PSU1_DATA) + ipmi_cmd = self.IPMI_PSU1_DATA elif index == 2: - cmd_status, psu_status = commands.getstatusoutput(self.IPMI_PSU2_DATA) + ipmi_cmd = self.IPMI_PSU2_DATA else: - logging.error("Invalid PSU number:" + index) - + logging.error("Invalid PSU number:" + index) + + if ipmi_cmd != '': + cmd_status, psu_status = getstatusoutput_noshell_pipe(ipmi_cmd, self.awk_cmd) if cmd_status: - logging.error('Failed to execute ipmitool') + logging.error('Failed to execute ipmitool') return (int(psu_status, 16) & 1) def get_output_voltage(self, index): if index is None: - return 0.0 + return 0.0 psuvoltage=self.get_psu_vout(index) return float(psuvoltage.strip()) def get_output_current(self, index): if index is None: - return 0.0 + return 0.0 psucurrent=self.get_psu_cout(index) return float(psucurrent.strip()) def get_output_power(self, index): if index is None: - return 0.0 + return 0.0 psupower=self.get_psu_pout(index) return float(psupower.strip()) def get_fan_rpm(self, index, fan_idx): if index is None: - return 0 + return 0 fanrpm=self.get_psu_fan_speed(index) return int(fanrpm.strip()) def get_serial(self, index): if index is None: - return None + return None if index == 1: - fru_id = FRU_PSUL + fru_id = FRU_PSUL else: - fru_id = FRU_PSUR + fru_id = FRU_PSUR return self.get_fru_info(fru_id,'Board Serial') def get_model(self, index): if index is None: - return None + return None if index == 1: - fru_id = FRU_PSUL + fru_id = FRU_PSUL else: - fru_id = FRU_PSUR + fru_id = FRU_PSUR return self.get_fru_info(fru_id,'Board Part Number') def get_mfr_id(self, index): if index is None: - return None + return None if index == 1: - fru_id = FRU_PSUL + fru_id = FRU_PSUL else: - fru_id = FRU_PSUR + fru_id = FRU_PSUR return self.get_fru_info(fru_id,'Board Mfg') def get_direction(self, index): if index is None: - return None + return None direction=self.get_psu_airflow(index).strip() if direction == 'B2F': - return "INTAKE" + return "INTAKE" elif direction == 'F2B': - return "EXHAUST" + return "EXHAUST" else: - return None + return None diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/component.py index 50b85cc179e4..9982582158f0 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/component.py @@ -19,8 +19,10 @@ def get_bios_version(): return subprocess.check_output(['dmidecode', '-s', 'system-version']).strip().decode() def get_cpld_version(cpld): - mjr_ver=subprocess.check_output('cat /sys/devices/platform/dell-n3248pxe-cpld.0/' + cpld + '_mjr_ver', shell=True).strip()[2:].decode() - mnr_ver=subprocess.check_output('cat /sys/devices/platform/dell-n3248pxe-cpld.0/' + cpld + '_mnr_ver', shell=True).strip()[2:].decode() + mjr_ver_path = "/sys/devices/platform/dell-n3248pxe-cpld.0/" + cpld + '_mjr_ver' + mnr_ver_path = "/sys/devices/platform/dell-n3248pxe-cpld.0/" + cpld + '_mnr_ver' + mjr_ver = subprocess.check_output(['cat', mjr_ver_path]).strip()[2:].decode() + mnr_ver = subprocess.check_output(['cat', mnr_ver_path]).strip()[2:].decode() return (str(mjr_ver) + '.' + str(mnr_ver)) class Component(ComponentBase): diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/psu.py index 74f8a766f6d8..f9a9970016f7 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/psu.py @@ -61,20 +61,24 @@ def get_name(self): def _reload_dps_module(self): try: - del_cmd = "echo 0x56 > /sys/bus/i2c/devices/i2c-{}/delete_device".format(10 + self.index - 1) - os.system(del_cmd) + file = "/sys/bus/i2c/devices/i2c-{}/delete_device".format(10 + self.index - 1) + with open(file, 'w') as f: + f.write("0x56\n") except (IOError, OSError): pass try: - del_cmd = "echo 0x5e > /sys/bus/i2c/devices/i2c-{}/delete_device".format(10 + self.index - 1) - os.system(del_cmd) + file = "/sys/bus/i2c/devices/i2c-{}/delete_device".format(10 + self.index - 1) + with open(file, 'w') as f: + f.write("0x5e\n") except (IOError, OSError): pass try: - ins_cmd = "echo '24c02 0x56' > /sys/bus/i2c/devices/i2c-{}/new_device".format(10 + self.index - 1) - os.system(ins_cmd) - ins_cmd = "echo 'dps460 0x5e' > /sys/bus/i2c/devices/i2c-{}/new_device".format(10 + self.index - 1) - os.system(ins_cmd) + file = "/sys/bus/i2c/devices/i2c-{}/new_device".format(10 + self.index - 1) + with open(file, 'w') as f: + f.write('24c02 0x56\n') + file = "/sys/bus/i2c/devices/i2c-{}/new_device".format(10 + self.index - 1) + with open(file, 'w') as f: + f.write('dps460 0x5e\n') except (IOError, OSError): pass diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/component.py index ccf90f881b0b..c69d5ef34ea0 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/component.py @@ -19,8 +19,10 @@ def get_bios_version(): return subprocess.check_output(['dmidecode', '-s', 'system-version']).strip().decode() def get_cpld_version(cpld): - mjr_ver=subprocess.check_output('cat /sys/devices/platform/dell-n3248te-cpld.0/' + cpld + '_mjr_ver', shell=True).strip()[2:].decode() - mnr_ver=subprocess.check_output('cat /sys/devices/platform/dell-n3248te-cpld.0/' + cpld + '_mnr_ver', shell=True).strip()[2:].decode() + mjr_ver_path = '/sys/devices/platform/dell-n3248te-cpld.0/' + cpld + '_mjr_ver' + mnr_ver_path = '/sys/devices/platform/dell-n3248te-cpld.0/' + cpld + '_mnr_ver' + mjr_ver = subprocess.check_output(['cat', mjr_ver_path]).strip()[2:].decode() + mnr_ver = subprocess.check_output(['cat', mnr_ver_path]).strip()[2:].decode() return (str(mjr_ver) + '.' + str(mnr_ver)) class Component(ComponentBase): diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/psu.py index b2f06785f0dc..6822ed988270 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/psu.py @@ -63,20 +63,24 @@ def get_name(self): def _reload_dps_module(self): try: - del_cmd = "echo 0x56 > /sys/bus/i2c/devices/i2c-{}/delete_device".format(10 + self.index - 1) - os.system(del_cmd) + file = "/sys/bus/i2c/devices/i2c-{}/delete_device".format(10 + self.index - 1) + with open(file, 'w') as f: + f.write('0x56\n') except (IOError, OSError): pass try: - del_cmd = "echo 0x5e > /sys/bus/i2c/devices/i2c-{}/delete_device".format(10 + self.index - 1) - os.system(del_cmd) + file = "/sys/bus/i2c/devices/i2c-{}/delete_device".format(10 + self.index - 1) + with open(file, 'w') as f: + f.write('0x5e\n') except (IOError, OSError): pass try: - ins_cmd = "echo '24c02 0x56' > /sys/bus/i2c/devices/i2c-{}/new_device".format(10 + self.index - 1) - os.system(ins_cmd) - ins_cmd = "echo 'dps460 0x5e' > /sys/bus/i2c/devices/i2c-{}/new_device".format(10 + self.index - 1) - os.system(ins_cmd) + file = "/sys/bus/i2c/devices/i2c-{}/new_device".format(10 + self.index - 1) + with open(file, 'w') as f: + f.write('24c02 0x56\n') + file = "/sys/bus/i2c/devices/i2c-{}/new_device".format(10 + self.index - 1) + with open(file, 'w') as f: + f.write('dps460 0x5e\n') except (IOError, OSError): pass diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/platform_sensors.py index 0fc484be2f07..9df70736c87f 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/platform_sensors.py @@ -13,10 +13,10 @@ import sys import logging -import commands +from sonic_py_common.general import getstatusoutput_noshell S5212F_MAX_FAN_TRAYS = 4 -IPMI_SENSOR_DATA = "ipmitool sdr list" +IPMI_SENSOR_DATA = ["ipmitool", "sdr", "list"] switch_sku = { "0K6MG9":(' AC', ' Exhaust'), @@ -36,7 +36,7 @@ "04T94Y":(' DC', ' Intake') } -ipmi_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_SENSOR_DATA) +ipmi_status, ipmi_sdr_list = getstatusoutput_noshell(IPMI_SENSOR_DATA) def get_pmc_register(reg_name): if ipmi_status: @@ -56,21 +56,21 @@ def print_temperature_sensors(): print("\nOnboard Temperature Sensors:") - print ' PT_Left_temp: ',\ - (get_pmc_register('PT_Left_temp')) - print ' PT_Mid_temp: ',\ - (get_pmc_register('PT_Mid_temp')) - print ' PT_Right_temp: ',\ - (get_pmc_register('PT_Right_temp')) - print ' Broadcom Temp: ',\ - (get_pmc_register('NPU_Near_temp')) - print ' Inlet Airflow Temp: ',\ - (get_pmc_register('ILET_AF_temp')) - print ' CPU Temp: ',\ - (get_pmc_register('CPU_temp')) + print(' PT_Left_temp: ',\ + (get_pmc_register('PT_Left_temp'))) + print(' PT_Mid_temp: ',\ + (get_pmc_register('PT_Mid_temp'))) + print(' PT_Right_temp: ',\ + (get_pmc_register('PT_Right_temp'))) + print(' Broadcom Temp: ',\ + (get_pmc_register('NPU_Near_temp'))) + print(' Inlet Airflow Temp: ',\ + (get_pmc_register('ILET_AF_temp'))) + print(' CPU Temp: ',\ + (get_pmc_register('CPU_temp'))) def get_switch_details(): - status, ipmi_fru = commands.getstatusoutput('/usr/bin/ipmitool fru') + status, ipmi_fru = getstatusoutput_noshell(['/usr/bin/ipmitool', 'fru']) for line in ipmi_fru.splitlines(): info = line.split(':') if 'Board Part Number' in info[0] : @@ -78,7 +78,9 @@ def get_switch_details(): if (partno in switch_sku): return switch_sku[partno] return None -commands.getstatusoutput('echo 0 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') +file = '/sys/module/ipmi_si/parameters/kipmid_max_busy_us' +with open(file, 'w') as f: + f.write('0\n') print_temperature_sensors() # Print the information for 1 Fan Tray @@ -86,40 +88,42 @@ def get_switch_details(): def print_fan_tray(tray): - print ' Fan Tray ' + str(tray) + ':' + print(' Fan Tray ' + str(tray) + ':') if (tray == 1): - print ' Fan1 Speed: ',\ - get_pmc_register('FAN1_Front_rpm') - print ' Fan2 Speed: ',\ - get_pmc_register('FAN1_Rear_rpm') + print(' Fan1 Speed: ',\ + get_pmc_register('FAN1_Front_rpm')) + print(' Fan2 Speed: ',\ + get_pmc_register('FAN1_Rear_rpm')) elif (tray == 2): - print ' Fan1 Speed: ',\ - get_pmc_register('FAN2_Front_rpm') - print ' Fan2 Speed: ',\ - get_pmc_register('FAN2_Rear_rpm') + print(' Fan1 Speed: ',\ + get_pmc_register('FAN2_Front_rpm')) + print(' Fan2 Speed: ',\ + get_pmc_register('FAN2_Rear_rpm')) elif (tray == 3): - print ' Fan1 Speed: ',\ - get_pmc_register('FAN3_Front_rpm') - print ' Fan2 Speed: ',\ - get_pmc_register('FAN3_Rear_rpm') + print(' Fan1 Speed: ',\ + get_pmc_register('FAN3_Front_rpm')) + print(' Fan2 Speed: ',\ + get_pmc_register('FAN3_Rear_rpm')) elif (tray == 4): - print ' Fan1 Speed: ',\ - get_pmc_register('FAN4_Front_rpm') - print ' Fan2 Speed: ',\ - get_pmc_register('FAN4_Rear_rpm') + print(' Fan1 Speed: ',\ + get_pmc_register('FAN4_Front_rpm')) + print(' Fan2 Speed: ',\ + get_pmc_register('FAN4_Rear_rpm')) type, dir = get_switch_details() print('\nFan Trays(Fixed):') -print ' Fan Tray Direction: ', dir +print(' Fan Tray Direction: ', dir) for tray in range(1, S5212F_MAX_FAN_TRAYS + 1): print_fan_tray(tray) print('\nPSU Tray(Fixed):') -print ' PSU Tray Direction: ', dir -print ' PSU Tray Type: ', type +print(' PSU Tray Direction: ', dir) +print(' PSU Tray Type: ', type) -ret_status, ipmi_cmd_ret = commands.getstatusoutput('echo 1000 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') +file = '/sys/module/ipmi_si/parameters/kipmid_max_busy_us' +with open(file, 'w') as f: + f.write('1000\n') diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/sfp.py index 6b8b6c92870b..d1a2b30e961f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/sfp.py @@ -13,7 +13,6 @@ import time import struct import mmap - import subprocess from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: @@ -300,7 +299,6 @@ def reinit_sfp_driver(self): del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) - delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): print(driver_path, "does not exist") @@ -314,22 +312,25 @@ def reinit_sfp_driver(self): #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe2 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe2 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe1 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe1 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe3 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe3 0x50\n') time.sleep(2) except IOError as e: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/platform_sensors.py index 483dd59a5607..f03c2fc9b4df 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/platform_sensors.py @@ -10,25 +10,25 @@ # * FAN trays # * PSU - import sys import logging -import subprocess +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe S5224F_MAX_FAN_TRAYS = 4 S5224F_MAX_PSUS = 2 -IPMI_SENSOR_DATA = "ipmitool sdr list" +IPMI_SENSOR_DATA = ["ipmitool", "sdr", "list"] IPMI_SENSOR_DUMP = "/tmp/sdr" PSU_PRESENCE = "PSU{0}_stat" # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" -IPMI_FAN_PRESENCE = "ipmitool sensor get FAN{0}_prsnt" -IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'" -IPMI_RAW_STORAGE_READ = "ipmitool raw 0x0a 0x11 {0} 0 0 0xa0" -IPMI_FRU = "ipmitool fru" +IPMI_FAN_PRESENCE = ["ipmitool", "sensor", "get", "FAN{0}_prsnt"] +IPMI_PSU1_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x31"] +IPMI_PSU2_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x32"] +awk_cmd = ['awk', '{print substr($0,9,1)}'] +IPMI_RAW_STORAGE_READ = ["ipmitool", "raw", "0x0a", "0x11", "", "0", "0", "0xa0"] +IPMI_FRU = ["ipmitool", "fru"] ipmi_sdr_list = "" # Dump sensor registers @@ -38,7 +38,7 @@ def ipmi_sensor_dump(): global ipmi_sdr_list ipmi_cmd = IPMI_SENSOR_DATA - status, ipmi_sdr_list = subprocess.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) @@ -47,9 +47,10 @@ def ipmi_sensor_dump(): # Fetch a Fan Status def get_fan_status(fan_id): - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_FAN_PRESENCE.format(fan_id)) + IPMI_FAN_PRESENCE[3] = 'FAN' + str(fan_id) + '_prsnt' + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(IPMI_FAN_PRESENCE) if ret_status: - logging.error('Failed to execute : %s'%IPMI_FAN_PRESENCE.format(fan_id)) + logging.error('Failed to execute : %s'% (' '.join(IPMI_FAN_PRESENCE))) sys.exit(0) return(' ' + ipmi_cmd_ret.splitlines()[5].strip(' ').strip('[]')) @@ -75,9 +76,9 @@ def get_pmc_register(reg_name): #Fetch FRU Data for given fruid def get_psu_airflow(psu_id): fru_id = 'PSU' + str(psu_id) + '_fru' - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_FRU) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(IPMI_FRU) if ret_status: - logging.error('Failed to execute ipmitool: '+ IPMI_FRU) + logging.error('Failed to execute ipmitool: '+ ' '.join(IPMI_FRU)) sys.exit(0) found_fru = False for line in ipmi_cmd_ret.splitlines(): @@ -89,9 +90,10 @@ def get_psu_airflow(psu_id): # Fetch FRU on given offset def fetch_raw_fru(dev_id, offset): - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_RAW_STORAGE_READ.format(dev_id)) + IPMI_RAW_STORAGE_READ[3] = str(dev_id) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(IPMI_RAW_STORAGE_READ) if ret_status: - logging.error('Failed to execute ipmitool :' + IPMI_RAW_STORAGE_READ.format(dev_id)) + logging.error('Failed to execute ipmitool :' + ' '.join(IPMI_RAW_STORAGE_READ)) sys.exit(0) return int((ipmi_cmd_ret.splitlines()[int(offset/16)]).split(' ')[(int(offset%16)+1)]) @@ -119,8 +121,11 @@ def print_temperature_sensors(): print (' CPU Temp: ',\ (get_pmc_register('CPU_temp'))) -ret_status, ipmi_cmd_ret = subprocess.getstatusoutput('echo 0 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') -if ret_status: +file = '/sys/module/ipmi_si/parameters/kipmid_max_busy_us' +try: + with open(file, 'w') as f: + f.write('0\n') +except (IOError, FileNotFoundError): logging.error("platform_sensors: Failed to set kipmid_max_busy_us to 0") ipmi_sensor_dump() @@ -212,12 +217,12 @@ def get_psu_presence(index): ret_status = 1 if index == 1: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU1_DATA_DOCKER, awk_cmd) elif index == 2: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU2_DATA_DOCKER, awk_cmd) if ret_status: - logging.error('Failed to execute ipmitool :' + IPMI_PSU1_DATA_DOCKER) + logging.error('Failed to execute ipmitool :' + ' '.join(IPMI_PSU1_DATA_DOCKER)) sys.exit(0) psu_status = ipmi_cmd_ret @@ -234,12 +239,12 @@ def get_psu_status(index): ipmi_cmd_ret = 'f' if index == 1: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU1_DATA_DOCKER, awk_cmd) elif index == 2: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU2_DATA_DOCKER, awk_cmd) if ret_status: - logging.error('Failed to execute ipmitool : ' + IPMI_PSU2_DATA_DOCKER) + logging.error('Failed to execute ipmitool : ' + ' '.join(IPMI_PSU2_DATA_DOCKER)) sys.exit(0) psu_status = ipmi_cmd_ret @@ -316,6 +321,9 @@ def print_psu(psu): print ('\n Total Power: ',\ get_pmc_register('PSU_Total_watt')) -ret_status, ipmi_cmd_ret = subprocess.getstatusoutput('echo 1000 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') -if ret_status: +file = '/sys/module/ipmi_si/parameters/kipmid_max_busy_us' +try: + with open(file, 'w') as f: + f.write('1000\n') +except (IOError, FileNotFoundError): logging.error("platform_sensors: Failed to set kipmid_max_busy_us to 1000") diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/sfp.py index 65eca4926107..0d612854c38c 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/sfp.py @@ -13,7 +13,6 @@ import time import struct import mmap - import subprocess from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: @@ -300,7 +299,6 @@ def reinit_sfp_driver(self): del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) - delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): print(driver_path, "does not exist") @@ -314,22 +312,25 @@ def reinit_sfp_driver(self): #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe2 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe2 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe1 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe1 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe3 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe3 0x50\n') time.sleep(2) except IOError as e: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/scripts/platform_sensors.py index 5db98374039d..a3a4b2f4678e 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/scripts/platform_sensors.py @@ -13,21 +13,23 @@ import sys import logging +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe S5232F_MAX_FAN_TRAYS = 4 S5232F_MAX_PSUS = 2 -IPMI_SENSOR_DATA = "ipmitool sdr list" +IPMI_SENSOR_DATA = ["ipmitool", "sdr", "list"] IPMI_SENSOR_DUMP = "/tmp/sdr" PSU_PRESENCE = "PSU{0}_stat" # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" -IPMI_FAN_PRESENCE = "ipmitool sensor get FAN{0}_prsnt" -IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'" -IPMI_RAW_STORAGE_READ = "ipmitool raw 0x0a 0x11 {0} 0 0 0xa0" -IPMI_FRU = "ipmitool fru" +IPMI_FAN_PRESENCE = ["ipmitool", "sensor", "get", ""] +IPMI_PSU1_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x31"] +IPMI_PSU2_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x32"] +awk_cmd = ['awk', '{print substr($0,9,1)}'] +IPMI_RAW_STORAGE_READ = ["ipmitool", "raw", "0x0a", "0x11", "", "0", "0", "0xa0"] +IPMI_FRU = ["ipmitool", "fru"] ipmi_sdr_list = "" # Dump sensor registers @@ -38,7 +40,7 @@ def ipmi_sensor_dump(): status = 1 global ipmi_sdr_list ipmi_cmd = IPMI_SENSOR_DATA - status, ipmi_sdr_list = subprocess.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute: ' + ipmi_sdr_list) @@ -47,9 +49,10 @@ def ipmi_sensor_dump(): # Fetch a Fan Status def get_fan_status(fan_id): - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_FAN_PRESENCE.format(fan_id)) + IPMI_FAN_PRESENCE[3] = "FAN" + str(fan_id) + "_prsnt" + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(IPMI_FAN_PRESENCE) if ret_status: - logging.error('Failed to execute : %s' % IPMI_FAN_PRESENCE.format(fan_id)) + logging.error('Failed to execute : %s' % ' '.join(IPMI_FAN_PRESENCE)) sys.exit(0) return(' ' + ipmi_cmd_ret.splitlines()[5].strip(' ').strip('[]')) @@ -75,9 +78,9 @@ def get_pmc_register(reg_name): # Fetch FRU Data for given fruid def get_psu_airflow(psu_id): fru_id = 'PSU' + str(psu_id) + '_fru' - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_FRU) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(IPMI_FRU) if ret_status: - logging.error('Failed to execute ipmitool: ' + IPMI_FRU) + logging.error('Failed to execute ipmitool: ' + ' '.join(IPMI_FRU)) sys.exit(0) found_fru = False for line in ipmi_cmd_ret.splitlines(): @@ -89,9 +92,10 @@ def get_psu_airflow(psu_id): # Fetch FRU on given offset def fetch_raw_fru(dev_id, offset): - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_RAW_STORAGE_READ.format(dev_id)) + IPMI_RAW_STORAGE_READ[4] = str(dev_id) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell(IPMI_RAW_STORAGE_READ) if ret_status: - logging.error('Failed to execute ipmitool :' + IPMI_RAW_STORAGE_READ.format(dev_id)) + logging.error('Failed to execute ipmitool :' + ' '.join(IPMI_RAW_STORAGE_READ)) sys.exit(0) return int((ipmi_cmd_ret.splitlines()[offset//16]).split(' ')[(offset%16+1)]) @@ -118,7 +122,9 @@ def print_temperature_sensors(): print(' CPU Temp: ', get_pmc_register('CPU_temp')) -subprocess.getstatusoutput('echo 0 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') +file = '/sys/module/ipmi_si/parameters/kipmid_max_busy_us' +with open(file, 'w') as f: + f.write('0\n') ipmi_sensor_dump() print_temperature_sensors() @@ -209,12 +215,12 @@ def get_psu_presence(index): ret_status = 1 if index == 1: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU1_DATA_DOCKER, awk_cmd) elif index == 2: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU2_DATA_DOCKER, awk_cmd) if ret_status: - logging.error('Failed to execute ipmitool :' + IPMI_PSU1_DATA_DOCKER) + logging.error('Failed to execute ipmitool :' + ' '.join(IPMI_PSU1_DATA_DOCKER)) sys.exit(0) psu_status = ipmi_cmd_ret @@ -232,12 +238,12 @@ def get_psu_status(index): ipmi_cmd_ret = 'f' if index == 1: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU1_DATA_DOCKER, awk_cmd) elif index == 2: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU2_DATA_DOCKER, awk_cmd) if ret_status: - logging.error('Failed to execute ipmitool : ' + IPMI_PSU2_DATA_DOCKER) + logging.error('Failed to execute ipmitool : ' + ' '.join(IPMI_PSU2_DATA_DOCKER)) sys.exit(0) psu_status = ipmi_cmd_ret @@ -330,4 +336,6 @@ def print_psu(psu): print('\n Total Power: ', get_pmc_register('PSU_Total_watt')) -subprocess.getstatusoutput('echo 1000 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') +file = '/sys/module/ipmi_si/parameters/kipmid_max_busy_us' +with open(file, 'w') as f: + f.write('1000\n') diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py index 7b2e9025bbd9..74cfbf1b9310 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py @@ -13,7 +13,6 @@ import time import struct import mmap - import subprocess from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: @@ -278,7 +277,6 @@ def reinit_sfp_driver(self): del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) - delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): print(driver_path, "does not exist") @@ -292,22 +290,25 @@ def reinit_sfp_driver(self): #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe2 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe2 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe1 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe1 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe3 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe3 0x50\n') time.sleep(2) except IOError as e: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/s5248f/scripts/platform_sensors.py index f276e6879d2c..e05ec4c88833 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/scripts/platform_sensors.py @@ -13,11 +13,11 @@ import sys import logging -import subprocess +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe S5248F_MAX_FAN_TRAYS = 4 S5248F_MAX_PSUS = 2 -IPMI_SENSOR_DATA = "ipmitool sdr list" +IPMI_SENSOR_DATA = ["ipmitool", "sdr", "list"] IPMI_SENSOR_DUMP = "/tmp/sdr" FAN_PRESENCE = "FAN{0}_prsnt" @@ -25,8 +25,9 @@ # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" -IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'" +IPMI_PSU1_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x31"] +IPMI_PSU2_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x32"] +awk_cmd = ['awk', '{print substr($0,9,1)}'] ipmi_sdr_list = "" # Dump sensor registers @@ -37,7 +38,7 @@ def ipmi_sensor_dump(): status = 1 global ipmi_sdr_list ipmi_cmd = IPMI_SENSOR_DATA - status, ipmi_sdr_list = subprocess.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) @@ -174,9 +175,9 @@ def get_psu_presence(index): ret_status = 1 if index == 1: - status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU1_DATA_DOCKER, awk_cmd) elif index == 2: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU2_DATA_DOCKER, awk_cmd) #if ret_status: # print ipmi_cmd_ret @@ -186,7 +187,7 @@ def get_psu_presence(index): psu_status = ipmi_cmd_ret if psu_status == '1': - status = 1 + status = 1 return status diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/sfp.py index b568b6fa153e..af29c3a1803e 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/sfp.py @@ -13,7 +13,6 @@ import time import struct import mmap - import subprocess from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: @@ -242,7 +241,7 @@ def get_status(self): """ reset = self.get_reset_status() - if (reset == True): + if (reset is True): status = False else: status = True @@ -278,7 +277,6 @@ def reinit_sfp_driver(self): del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) - delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): print(driver_path, "does not exist") @@ -292,22 +290,25 @@ def reinit_sfp_driver(self): #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe2 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe2 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe1 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe1 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe3 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe3 0x50\n') time.sleep(2) except IOError as e: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/platform_sensors.py index 4c6ef3b229ab..615e8caf1b1c 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/platform_sensors.py @@ -13,11 +13,11 @@ import sys import logging -import commands +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe S5296F_MAX_FAN_TRAYS = 4 S5296F_MAX_PSUS = 2 -IPMI_SENSOR_DATA = "ipmitool sdr list" +IPMI_SENSOR_DATA = ["ipmitool", "sdr", "list"] IPMI_SENSOR_DUMP = "/tmp/sdr" FAN_PRESENCE = "FAN{0}_prsnt" @@ -25,8 +25,9 @@ # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" -IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'" +IPMI_PSU1_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x31"] +IPMI_PSU2_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x32"] +awk_cmd = ['awk', '{print substr($0,9,1)}'] ipmi_sdr_list = "" # Dump sensor registers @@ -36,7 +37,7 @@ def ipmi_sensor_dump(): global ipmi_sdr_list ipmi_cmd = IPMI_SENSOR_DATA - status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) @@ -69,18 +70,18 @@ def print_temperature_sensors(): print("\nOnboard Temperature Sensors:") - print ' PT_Left_temp: ',\ - (get_pmc_register('PT_Left_temp')) - print ' PT_Mid_temp: ',\ - (get_pmc_register('PT_Mid_temp')) - print ' PT_Right_temp: ',\ - (get_pmc_register('PT_Right_temp')) - print ' Broadcom Temp: ',\ - (get_pmc_register('NPU_Near_temp')) - print ' Inlet Airflow Temp: ',\ - (get_pmc_register('ILET_AF_temp')) - print ' CPU Temp: ',\ - (get_pmc_register('CPU_temp')) + print(' PT_Left_temp: ',\ + (get_pmc_register('PT_Left_temp'))) + print(' PT_Mid_temp: ',\ + (get_pmc_register('PT_Mid_temp'))) + print(' PT_Right_temp: ',\ + (get_pmc_register('PT_Right_temp'))) + print(' Broadcom Temp: ',\ + (get_pmc_register('NPU_Near_temp'))) + print(' Inlet Airflow Temp: ',\ + (get_pmc_register('ILET_AF_temp'))) + print(' CPU Temp: ',\ + (get_pmc_register('CPU_temp'))) ipmi_sensor_dump() @@ -93,43 +94,43 @@ def print_fan_tray(tray): Fan_Status = [' Normal', ' Abnormal'] - print ' Fan Tray ' + str(tray) + ':' + print(' Fan Tray ' + str(tray) + ':') if (tray == 1): fan2_status = int(get_pmc_register('FAN1_Rear_stat'), 16) - print ' Fan Speed: ',\ - get_pmc_register('FAN1_Rear_rpm') - print ' Fan State: ',\ - Fan_Status[fan2_status] + print(' Fan Speed: ',\ + get_pmc_register('FAN1_Rear_rpm')) + print(' Fan State: ',\ + Fan_Status[fan2_status]) elif (tray == 2): fan2_status = int(get_pmc_register('FAN2_Rear_stat'), 16) - print ' Fan Speed: ',\ - get_pmc_register('FAN2_Rear_rpm') - print ' Fan State: ',\ - Fan_Status[fan2_status] + print(' Fan Speed: ',\ + get_pmc_register('FAN2_Rear_rpm')) + print(' Fan State: ',\ + Fan_Status[fan2_status]) elif (tray == 3): fan2_status = int(get_pmc_register('FAN3_Rear_stat'), 16) - print ' Fan Speed: ',\ - get_pmc_register('FAN3_Rear_rpm') - print ' Fan State: ',\ - Fan_Status[fan2_status] + print(' Fan Speed: ',\ + get_pmc_register('FAN3_Rear_rpm')) + print(' Fan State: ',\ + Fan_Status[fan2_status]) elif (tray == 4): fan2_status = int(get_pmc_register('FAN4_Rear_stat'), 16) - print ' Fan Speed: ',\ - get_pmc_register('FAN4_Rear_rpm') - print ' Fan State: ',\ - Fan_Status[fan2_status] + print(' Fan Speed: ',\ + get_pmc_register('FAN4_Rear_rpm')) + print(' Fan State: ',\ + Fan_Status[fan2_status]) print('\nFan Trays:') @@ -139,7 +140,7 @@ def print_fan_tray(tray): if (get_pmc_register(fan_presence)): print_fan_tray(tray) else: - print '\n Fan Tray ' + str(tray + 1) + ': Not present' + print('\n Fan Tray ' + str(tray + 1) + ': Not present') def get_psu_presence(index): """ @@ -151,9 +152,9 @@ def get_psu_presence(index): status = 0 if index == 1: - status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU1_DATA_DOCKER, awk_cmd) elif index == 2: - ret_status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU2_DATA_DOCKER, awk_cmd) #if ret_status: # print ipmi_cmd_ret @@ -163,7 +164,7 @@ def get_psu_presence(index): psu_status = ipmi_cmd_ret if psu_status == '1': - status = 1 + status = 1 return status @@ -179,54 +180,54 @@ def print_psu(psu): # psu1_fan_status = int(get_pmc_register('PSU1_status'),16) - print ' PSU1:' - print ' FAN Normal Temperature: ',\ - get_pmc_register('PSU1_temp') - print ' FAN AirFlow Temperature: ',\ - get_pmc_register('PSU1_AF_temp') - print ' FAN RPM: ',\ - get_pmc_register('PSU1_rpm') + print(' PSU1:') + print(' FAN Normal Temperature: ',\ + get_pmc_register('PSU1_temp')) + print(' FAN AirFlow Temperature: ',\ + get_pmc_register('PSU1_AF_temp')) + print(' FAN RPM: ',\ + get_pmc_register('PSU1_rpm')) # print ' FAN Status: ', Psu_Fan_Status[psu1_fan_status] # PSU input & output monitors - print ' Input Voltage: ',\ - get_pmc_register('PSU1_In_volt') - print ' Output Voltage: ',\ - get_pmc_register('PSU1_Out_volt') - print ' Input Power: ',\ - get_pmc_register('PSU1_In_watt') - print ' Output Power: ',\ - get_pmc_register('PSU1_Out_watt') - print ' Input Current: ',\ - get_pmc_register('PSU1_In_amp') - print ' Output Current: ',\ - get_pmc_register('PSU1_Out_amp') + print(' Input Voltage: ',\ + get_pmc_register('PSU1_In_volt')) + print(' Output Voltage: ',\ + get_pmc_register('PSU1_Out_volt')) + print(' Input Power: ',\ + get_pmc_register('PSU1_In_watt')) + print(' Output Power: ',\ + get_pmc_register('PSU1_Out_watt')) + print(' Input Current: ',\ + get_pmc_register('PSU1_In_amp')) + print(' Output Current: ',\ + get_pmc_register('PSU1_Out_amp')) else: # psu2_fan_status = int(get_pmc_register('PSU1_status'),16) - print ' PSU2:' - print ' FAN Normal Temperature: ',\ - get_pmc_register('PSU2_temp') - print ' FAN AirFlow Temperature: ',\ - get_pmc_register('PSU2_AF_temp') - print ' FAN RPM: ',\ - get_pmc_register('PSU2_rpm') + print(' PSU2:') + print(' FAN Normal Temperature: ',\ + get_pmc_register('PSU2_temp')) + print(' FAN AirFlow Temperature: ',\ + get_pmc_register('PSU2_AF_temp')) + print(' FAN RPM: ',\ + get_pmc_register('PSU2_rpm')) # print ' FAN Status: ', Psu_Fan_Status[psu2_fan_status] # PSU input & output monitors - print ' Input Voltage: ',\ - get_pmc_register('PSU2_In_volt') - print ' Output Voltage: ',\ - get_pmc_register('PSU2_Out_volt') - print ' Input Power: ',\ - get_pmc_register('PSU2_In_watt') - print ' Output Power: ',\ - get_pmc_register('PSU2_Out_watt') - print ' Input Current: ',\ - get_pmc_register('PSU2_In_amp') - print ' Output Current: ',\ - get_pmc_register('PSU2_Out_amp') + print(' Input Voltage: ',\ + get_pmc_register('PSU2_In_volt')) + print(' Output Voltage: ',\ + get_pmc_register('PSU2_Out_volt')) + print(' Input Power: ',\ + get_pmc_register('PSU2_In_watt')) + print(' Output Power: ',\ + get_pmc_register('PSU2_Out_watt')) + print(' Input Current: ',\ + get_pmc_register('PSU2_In_amp')) + print(' Output Current: ',\ + get_pmc_register('PSU2_Out_amp')) print('\nPSUs:') @@ -235,8 +236,8 @@ def print_psu(psu): if (get_psu_presence(psu)): print_psu(psu) else: - print '\n PSU ', psu, 'Not present' + print('\n PSU ', psu, 'Not present') -print '\n Total Power: ',\ - get_pmc_register('PSU_Total_watt') +print('\n Total Power: ',\ + get_pmc_register('PSU_Total_watt')) diff --git a/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/component.py index 592cd4e8c459..cc0022e43e3c 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/component.py @@ -14,6 +14,7 @@ import subprocess from sonic_platform_base.component_base import ComponentBase import sonic_platform.hwaccess as hwaccess + from sonic_py_common.general import check_output_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -31,9 +32,7 @@ def get_bmc_version(): """ Returns BMC Version """ bmc_ver = '' try: - bmc_ver = subprocess.check_output( - "ipmitool mc info | awk '/Firmware Revision/ { print $NF }'", - shell=True, text=True).strip() + bmc_ver = check_output_pipe(["ipmitool", "mc", "info"], ["awk", "/Firmware Revision/ { print $NF }"]) except (FileNotFoundError, subprocess.CalledProcessError): pass return bmc_ver diff --git a/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/sfp.py index d87ad3db746c..c94baaec1053 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/sfp.py @@ -257,7 +257,7 @@ def get_status(self): """ reset = self.get_reset_status() - if (reset == True): + if (reset is True): status = False else: status = True @@ -293,7 +293,6 @@ def reinit_sfp_driver(self): del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) - delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): print(driver_path, "does not exist") @@ -307,22 +306,25 @@ def reinit_sfp_driver(self): #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe2 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe2 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe1 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe1 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe3 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe3 0x50\n') time.sleep(2) except IOError as e: diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/platform_sensors.py index bcc13452a828..25b206a1fecb 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/platform_sensors.py @@ -13,11 +13,11 @@ import sys import logging -import subprocess +from sonic_py_common.general import getstatusoutput_noshell Z9264F_MAX_FAN_TRAYS = 4 Z9264F_MAX_PSUS = 2 -IPMI_SENSOR_DATA = "ipmitool sdr list" +IPMI_SENSOR_DATA = ["ipmitool", "sdr", "list"] IPMI_SENSOR_DUMP = "/tmp/sdr" FAN_PRESENCE = "FAN{0}_prsnt" @@ -34,7 +34,7 @@ def ipmi_sensor_dump(): status = 1 global ipmi_sdr_list ipmi_cmd = IPMI_SENSOR_DATA - status, ipmi_sdr_list = subprocess.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py index 2e20fa9e0e0e..a234ba04c17d 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py @@ -13,7 +13,6 @@ import time import struct import mmap - import subprocess from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: @@ -244,7 +243,7 @@ def get_status(self): """ reset = self.get_reset_status() - if (reset == True): + if (reset is True): status = False else: status = True @@ -280,7 +279,6 @@ def reinit_sfp_driver(self): del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) - delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): print(driver_path, "does not exist") @@ -294,22 +292,25 @@ def reinit_sfp_driver(self): #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe2 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe2 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe1 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe1 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe3 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe3 0x50\n') time.sleep(2) except IOError as e: diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/scripts/platform_sensors.py index 1a5778525db2..ecc9f67d3574 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/scripts/platform_sensors.py @@ -13,11 +13,11 @@ import sys import logging -import subprocess +from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe Z9332F_MAX_FAN_TRAYS = 7 Z9332F_MAX_PSUS = 2 -IPMI_SENSOR_DATA = "ipmitool sdr list" +IPMI_SENSOR_DATA = ["ipmitool", "sdr", "list"] IPMI_SENSOR_DUMP = "/tmp/sdr" FAN_PRESENCE = "Fan{0}_Status" @@ -25,9 +25,9 @@ # Use this for older firmware # PSU_PRESENCE="PSU{0}_prsnt" -IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x2f | awk '{print substr($0,9,1)}'" -IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x39 | awk '{print substr($0,9,1)}'" - +IPMI_PSU1_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x2f"] +IPMI_PSU2_DATA_DOCKER = ["ipmitool", "raw", "0x04", "0x2d", "0x39"] +awk_cmd = ['awk', '{print substr($0,9,1)}'] ipmi_sdr_list = "" # Dump sensor registers @@ -38,7 +38,7 @@ def ipmi_sensor_dump(): status = 1 global ipmi_sdr_list ipmi_cmd = IPMI_SENSOR_DATA - status, ipmi_sdr_list = subprocess.getstatusoutput(ipmi_cmd) + status, ipmi_sdr_list = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute:' + ipmi_sdr_list) @@ -130,9 +130,9 @@ def get_psu_presence(index): ret_status = 1 if index == 1: - status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU1_DATA_DOCKER) + status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU1_DATA_DOCKER, awk_cmd) elif index == 2: - ret_status, ipmi_cmd_ret = subprocess.getstatusoutput(IPMI_PSU2_DATA_DOCKER) + ret_status, ipmi_cmd_ret = getstatusoutput_noshell_pipe(IPMI_PSU2_DATA_DOCKER, awk_cmd) #if ret_status: # print ipmi_cmd_ret diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py index 6abe435ca62b..62f4402fd423 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py @@ -18,6 +18,7 @@ import tempfile from sonic_platform_base.component_base import ComponentBase import sonic_platform.hwaccess as hwaccess + from sonic_py_common.general import check_output_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -161,10 +162,10 @@ def _get_available_firmware_version(image_path): return False, "ERROR: File not found" with tempfile.TemporaryDirectory() as tmpdir: - cmd = "sed -e '1,/^exit_marker$/d' {} | tar -x -C {} installer/onie-update.tar.xz".format(image_path, tmpdir) + cmd1 = ["sed", "-e", '1,/^exit_marker$/d', image_path] + cmd2 = ["tar", "-x", "-C", tmpdir, "installer/onie-update.tar.xz"] try: - subprocess.check_call(cmd, stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, shell=True) + check_output_pipe(cmd1, cmd2) except subprocess.CalledProcessError: return False, "ERROR: Unable to extract firmware updater" @@ -200,18 +201,18 @@ def _get_available_firmware_version(image_path): @staticmethod def _stage_firmware_package(image_path): stage_msg = None - cmd = "onie_stage_fwpkg -a {}".format(image_path) + cmd = ["onie_stage_fwpkg", "-a", image_path] try: - subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT, text=True) + subprocess.check_output(cmd, stderr=subprocess.STDOUT, text=True) except subprocess.CalledProcessError as e: if e.returncode != 2: return False, e.output.strip() else: stage_msg = e.output.strip() - cmd = "onie_mode_set -o update" + cmd = ["onie_mode_set", "-o", "update"] try: - subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT, text=True) + subprocess.check_output(cmd, stderr=subprocess.STDOUT, text=True) except subprocess.CalledProcessError as e: return False, e.output.strip() diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py index 693c83743ec1..fbd5b2b8ea19 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py @@ -12,7 +12,6 @@ try: import os import time - import subprocess import mmap from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase @@ -335,7 +334,6 @@ def reinit_sfp_driver(self): self._port_to_i2c_mapping[self.index]) driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format( self._port_to_i2c_mapping[self.index]) - delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): print(driver_path, "does not exist") @@ -349,22 +347,25 @@ def reinit_sfp_driver(self): #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe2 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe2 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe1 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe1 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe3 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe3 0x50\n') time.sleep(2) except IOError as err: diff --git a/platform/broadcom/sonic-platform-modules-dell/z9432f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/z9432f/scripts/platform_sensors.py index 3446a09321de..1d1230019e0c 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9432f/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9432f/scripts/platform_sensors.py @@ -12,20 +12,20 @@ import sys import logging -import commands +from sonic_py_common.general import getstatusoutput_noshell Z9432F_MAX_FAN_TRAYS = 7 Z9432F_MAX_PSUS = 2 -IPMI_SENSOR_DATA = "ipmitool sdr elist" +IPMI_SENSOR_DATA = ["ipmitool", "sdr", "elist"] -IPMI_RAW_STORAGE_READ = "ipmitool raw 0x0a 0x11 {0} {1} 0 1" +IPMI_RAW_STORAGE_READ = ["ipmitool", "raw", "0x0a", "0x11", "", "", "0", "1"] # Dump sensor registers class SdrStatus(object): """ Contains IPMI SDR List """ def __init__(self): ipmi_cmd = IPMI_SENSOR_DATA - status, resp = commands.getstatusoutput(ipmi_cmd) + status, resp = getstatusoutput_noshell(ipmi_cmd) if status: logging.error('Failed to execute: ' + ipmi_cmd) sys.exit(0) @@ -43,14 +43,6 @@ def get(self): # Fetch a Fan Status SDR_STATUS = SdrStatus() -def get_fan_status(fan_id): - """ Get Fan Status of give Id """ - status, cmd_ret = commands.getstatusoutput(IPMI_FAN_PRESENCE.format(fan_id)) - if status: - logging.error('Failed to execute : %s', IPMI_FAN_PRESENCE.format(fan_id)) - sys.exit(0) - return ' ' + cmd_ret.splitlines()[5].strip(' ').strip('[]') - # Fetch a BMC register @@ -62,7 +54,7 @@ def get_pmc_register(reg_name): if reg_name in sdr_status: output = sdr_status[reg_name] else: - print '\nFailed to fetch: ' + reg_name + ' sensor ' + print('\nFailed to fetch: ' + reg_name + ' sensor ') sys.exit(0) logging.basicConfig(level=logging.DEBUG) @@ -71,9 +63,11 @@ def get_pmc_register(reg_name): # Fetch FRU on given offset def fetch_raw_fru(dev_id, offset): """ Fetch RAW value from FRU (dev_id) @ given offset """ - status, cmd_ret = commands.getstatusoutput(IPMI_RAW_STORAGE_READ.format(dev_id, offset)) + IPMI_RAW_STORAGE_READ[4] = str(dev_id) + IPMI_RAW_STORAGE_READ[5] = offset + status, cmd_ret = getstatusoutput_noshell(IPMI_RAW_STORAGE_READ) if status: - logging.error('Failed to execute ipmitool :' + IPMI_RAW_STORAGE_READ.format(dev_id, offset)) + logging.error('Failed to execute ipmitool :' + ' '.join(IPMI_RAW_STORAGE_READ)) return -1 return int(cmd_ret.strip().split(' ')[1]) @@ -83,7 +77,7 @@ def fetch_raw_fru(dev_id, offset): def get_fan_airflow(fan_id): """ Return Airflow of direction of FANTRAY(fan_id) """ airflow_direction = ['Exhaust', 'Intake'] - dir_idx = fetch_raw_fru(fan_id+2, 0x45) + dir_idx = fetch_raw_fru(fan_id+2, "0x45") if dir_idx == -1: return 'N/A' return airflow_direction[dir_idx] @@ -92,7 +86,7 @@ def get_fan_airflow(fan_id): def get_psu_airflow(psu_id): """ Return Airflow Direction of psu_id """ airflow_direction = ['Exhaust', 'Intake'] - dir_idx = fetch_raw_fru(psu_id, 0x2F) + dir_idx = fetch_raw_fru(psu_id, "0x2F") if dir_idx == -1: return 'N/A' return airflow_direction[dir_idx] @@ -103,37 +97,39 @@ def get_psu_airflow(psu_id): def print_temperature_sensors(): """ Prints Temperature Sensor """ - print "\nOnboard Temperature Sensors:" - - print ' PT Left Temp: ',\ - (get_pmc_register('PT_Left_temp')) - print ' NPU Rear Temp: ',\ - (get_pmc_register('NPU_Rear_temp')) - print ' PT Right Temp: ',\ - (get_pmc_register('PT_Right_temp')) - print ' NPU Front Temp: ',\ - (get_pmc_register('NPU_Front_temp')) - print ' FAN Right Temp: ',\ - (get_pmc_register('FAN_Right_temp')) - print ' NPU Temp: ',\ - (get_pmc_register('NPU_temp')) - print ' CPU Temp: ',\ - (get_pmc_register('CPU_temp')) - print ' PSU1 AF Temp: ',\ - (get_pmc_register('PSU1_AF_temp')) - print ' PSU1 Mid Temp: ',\ - (get_pmc_register('PSU1_Mid_temp')) - print ' PSU1 Rear Temp: ',\ - (get_pmc_register('PSU1_Rear_temp')) - print ' PSU2 AF Temp: ',\ - (get_pmc_register('PSU2_AF_temp')) - print ' PSU2 Mid Temp: ',\ - (get_pmc_register('PSU2_Mid_temp')) - print ' PSU2 Rear Temp: ',\ - (get_pmc_register('PSU2_Rear_temp')) - - - commands.getstatusoutput('echo 0 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') + print("\nOnboard Temperature Sensors:") + + print(' PT Left Temp: ',\ + (get_pmc_register('PT_Left_temp'))) + print(' NPU Rear Temp: ',\ + (get_pmc_register('NPU_Rear_temp'))) + print(' PT Right Temp: ',\ + (get_pmc_register('PT_Right_temp'))) + print(' NPU Front Temp: ',\ + (get_pmc_register('NPU_Front_temp'))) + print(' FAN Right Temp: ',\ + (get_pmc_register('FAN_Right_temp'))) + print(' NPU Temp: ',\ + (get_pmc_register('NPU_temp'))) + print(' CPU Temp: ',\ + (get_pmc_register('CPU_temp'))) + print(' PSU1 AF Temp: ',\ + (get_pmc_register('PSU1_AF_temp'))) + print(' PSU1 Mid Temp: ',\ + (get_pmc_register('PSU1_Mid_temp'))) + print(' PSU1 Rear Temp: ',\ + (get_pmc_register('PSU1_Rear_temp'))) + print(' PSU2 AF Temp: ',\ + (get_pmc_register('PSU2_AF_temp'))) + print(' PSU2 Mid Temp: ',\ + (get_pmc_register('PSU2_Mid_temp'))) + print(' PSU2 Rear Temp: ',\ + (get_pmc_register('PSU2_Rear_temp'))) + + + file = '/sys/module/ipmi_si/parameters/kipmid_max_busy_us' + with open(file, 'w') as f: + f.write('0\n') print_temperature_sensors() @@ -144,26 +140,26 @@ def print_fan_tray(fan_tray): """ Prints given Fan Tray information """ fan_status = ['Abnormal', 'Normal'] - print ' Fan Tray ' + str(fan_tray) + ':' + print(' Fan Tray ' + str(fan_tray) + ':') fan_front_status = (get_pmc_register('Fan{0}_Front_state'.format(str(fan_tray))) == '') fan_rear_status = (get_pmc_register('Fan{0}_Rear_state'.format(str(fan_tray))) == '') - print ' Fan1 Speed: ', \ - get_pmc_register('FAN{0}_Front_rpm'.format(str(fan_tray))) - print ' Fan2 Speed: ',\ - get_pmc_register('FAN{0}_Rear_rpm'.format(str(fan_tray))) - print ' Fan1 State: ', fan_status[fan_front_status] - print ' Fan2 State: ', fan_status[fan_rear_status] - print ' Airflow: ', get_fan_airflow(fan_tray) + print(' Fan1 Speed: ', \ + get_pmc_register('FAN{0}_Front_rpm'.format(str(fan_tray)))) + print(' Fan2 Speed: ',\ + get_pmc_register('FAN{0}_Rear_rpm'.format(str(fan_tray)))) + print(' Fan1 State: ', fan_status[fan_front_status]) + print(' Fan2 State: ', fan_status[fan_rear_status]) + print(' Airflow: ', get_fan_airflow(fan_tray)) -print '\nFan Trays:' +print('\nFan Trays:') for tray in range(1, Z9432F_MAX_FAN_TRAYS + 1): if get_pmc_register('FAN{0}_prsnt'.format(str(tray))) == 'Present': print_fan_tray(tray) else: - print ' Fan Tray {}: NOT PRESENT'.format(str(tray)) + print(' Fan Tray {}: NOT PRESENT'.format(str(tray))) def get_psu_status(index): """ @@ -188,67 +184,69 @@ def print_psu(psu_id): # PSU FAN details if psu_id == 1: - print ' PSU1:' - print ' AF Temperature: ',\ - get_pmc_register('PSU1_AF_temp') - print ' Mid Temperature: ',\ - get_pmc_register('PSU1_Mid_temp') - print ' Rear Temperature: ',\ - get_pmc_register('PSU1_Rear_temp') - print ' FAN RPM: ',\ - get_pmc_register('PSU1_rpm') + print(' PSU1:') + print(' AF Temperature: ',\ + get_pmc_register('PSU1_AF_temp')) + print(' Mid Temperature: ',\ + get_pmc_register('PSU1_Mid_temp')) + print(' Rear Temperature: ',\ + get_pmc_register('PSU1_Rear_temp')) + print(' FAN RPM: ',\ + get_pmc_register('PSU1_rpm')) # PSU input & output monitors - print ' Input Voltage: ',\ - get_pmc_register('PSU1_In_volt') - print ' Output Voltage: ',\ - get_pmc_register('PSU1_Out_volt') - print ' Input Power: ',\ - get_pmc_register('PSU1_In_watt') - print ' Output Power: ',\ - get_pmc_register('PSU1_Out_watt') - print ' Input Current: ',\ - get_pmc_register('PSU1_In_amp') - print ' Output Current: ',\ - get_pmc_register('PSU1_Out_amp') + print(' Input Voltage: ',\ + get_pmc_register('PSU1_In_volt')) + print(' Output Voltage: ',\ + get_pmc_register('PSU1_Out_volt')) + print(' Input Power: ',\ + get_pmc_register('PSU1_In_watt')) + print(' Output Power: ',\ + get_pmc_register('PSU1_Out_watt')) + print(' Input Current: ',\ + get_pmc_register('PSU1_In_amp')) + print(' Output Current: ',\ + get_pmc_register('PSU1_Out_amp')) else: - print ' PSU2:' - print ' AF Temperature: ',\ - get_pmc_register('PSU2_AF_temp') - print ' Mid Temperature: ',\ - get_pmc_register('PSU2_Mid_temp') - print ' Rear Temperature: ',\ - get_pmc_register('PSU2_Rear_temp') - print ' FAN RPM: ',\ - get_pmc_register('PSU2_rpm') + print(' PSU2:') + print(' AF Temperature: ',\ + get_pmc_register('PSU2_AF_temp')) + print(' Mid Temperature: ',\ + get_pmc_register('PSU2_Mid_temp')) + print(' Rear Temperature: ',\ + get_pmc_register('PSU2_Rear_temp')) + print(' FAN RPM: ',\ + get_pmc_register('PSU2_rpm')) # PSU input & output monitors - print ' Input Voltage: ',\ - get_pmc_register('PSU2_In_volt') - print ' Output Voltage: ',\ - get_pmc_register('PSU2_Out_volt') - print ' Input Power: ',\ - get_pmc_register('PSU2_In_watt') - print ' Output Power: ',\ - get_pmc_register('PSU2_Out_watt') - print ' Input Current: ',\ - get_pmc_register('PSU2_In_amp') - print ' Output Current: ',\ - get_pmc_register('PSU2_Out_amp') - print ' Airflow: ',\ - get_psu_airflow(psu_id) - - -print '\nPSUs:' + print(' Input Voltage: ',\ + get_pmc_register('PSU2_In_volt')) + print(' Output Voltage: ',\ + get_pmc_register('PSU2_Out_volt')) + print(' Input Power: ',\ + get_pmc_register('PSU2_In_watt')) + print(' Output Power: ',\ + get_pmc_register('PSU2_Out_watt')) + print(' Input Current: ',\ + get_pmc_register('PSU2_In_amp')) + print(' Output Current: ',\ + get_pmc_register('PSU2_Out_amp')) + print(' Airflow: ',\ + get_psu_airflow(psu_id)) + + +print('\nPSUs:') for psu in range(1, Z9432F_MAX_PSUS + 1): psu_status = get_psu_status(psu) if psu_status is not None: - print ' PSU{0}: {1}'.format(psu, psu_status) + print(' PSU{0}: {1}'.format(psu, psu_status)) else: print_psu(psu) -print '\n Total Power: ',\ - get_pmc_register('PSU_Total_watt') - commands.getstatusoutput('echo 1000 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') +print('\n Total Power: ',\ +get_pmc_register('PSU_Total_watt')) +file = '/sys/module/ipmi_si/parameters/kipmid_max_busy_us' +with open(file, 'w') as f: + f.write('1000\n') diff --git a/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/component.py index 42d8d50d0922..8d5ab6c6485e 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/component.py @@ -18,6 +18,7 @@ import tempfile from sonic_platform_base.component_base import ComponentBase import sonic_platform.hwaccess as hwaccess + from sonic_py_common.general import check_output_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -135,10 +136,11 @@ def _get_available_firmware_version(image_path): return False, "ERROR: File not found" with tempfile.TemporaryDirectory() as tmpdir: - cmd = "sed -e '1,/^exit_marker$/d' {} | tar -x -C {} installer/onie-update.tar.xz".format(image_path, tmpdir) + cmd1 = ["sed", "-e", '1,/^exit_marker$/d', image_path] + cmd2 = ["tar", "-x", "-C", tmpdir, "installer/onie-update.tar.xz"] try: - subprocess.check_call(cmd, stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, shell=True) + check_output_pipe(cmd1, cmd2) + except subprocess.CalledProcessError: return False, "ERROR: Unable to extract firmware updater" @@ -166,18 +168,18 @@ def _get_available_firmware_version(image_path): @staticmethod def _stage_firmware_package(image_path): stage_msg = None - cmd = "onie_stage_fwpkg -a {}".format(image_path) + cmd = ["onie_stage_fwpkg", "-a", image_path] try: - subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT, text=True) + subprocess.check_output(cmd, stderr=subprocess.STDOUT, text=True) except subprocess.CalledProcessError as e: if e.returncode != 2: return False, e.output.strip() else: stage_msg = e.output.strip() - cmd = "onie_mode_set -o update" + cmd = ["onie_mode_set", "-o", "update"] try: - subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT, text=True) + subprocess.check_output(cmd, stderr=subprocess.STDOUT, text=True) except subprocess.CalledProcessError as e: return False, e.output.strip() diff --git a/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/sfp.py index eaff8e9b1d44..bc43ba712c6a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/sfp.py @@ -12,7 +12,6 @@ try: import os import time - import subprocess import mmap from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase @@ -302,7 +301,6 @@ def reinit_sfp_driver(self): del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(i2c_bus) new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(i2c_bus) driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(i2c_bus) - delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): print(driver_path, "does not exist") @@ -316,22 +314,25 @@ def reinit_sfp_driver(self): #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe2 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe2 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe1 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe1 0x50\n') time.sleep(2) elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: - subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + with open(del_sfp_path, 'w') as f: + f.write('0x50\n') time.sleep(0.2) - new_device = "echo optoe3 0x50 >" + new_sfp_path - subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + with open(new_sfp_path, 'w') as f: + f.write('optoe3 0x50\n') time.sleep(2) except IOError as err: From 5cc233d1cfe7f8b12bf9bd3bc94f00bb28fe6742 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Thu, 5 Jan 2023 16:24:48 -0800 Subject: [PATCH 003/113] [submodule] Update sonic-gnmi submodule (#13264) #### Why I did it Submodule update for sonic-gnmi Incorporates: d922a07 Zain Budhwani Wed Jan 4 21:27:32 2023 -0800 Fix gnmi cli hang (sonic-net/sonic-gnmi#69) #### How I did it Get latest updates --- src/sonic-gnmi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-gnmi b/src/sonic-gnmi index 43a9179e9de9..d922a076ca34 160000 --- a/src/sonic-gnmi +++ b/src/sonic-gnmi @@ -1 +1 @@ -Subproject commit 43a9179e9de97e1bc02af89299e5d5d2814c70df +Subproject commit d922a076ca3490792009ba67c1fe6436fe01cb11 From 3ebdaefa8c1e85244a7794d2713022722a438165 Mon Sep 17 00:00:00 2001 From: "Richard.Yu" Date: Fri, 6 Jan 2023 11:44:34 +0800 Subject: [PATCH 004/113] [SAIServer]Upgrade SAI server init script (#13175) (#13227) (#13232) Why I did it why In order to apply different config across different platform, and use the code with a unified format, reuse syncd init script to init saiserver. How I did it how Reuse syncd init script How to verify it Test Test in DUT s6000 and dx010 with sonic 202205 --- platform/broadcom/docker-saiserver-brcm.mk | 8 ++++- .../docker-saiserver-brcm/Dockerfile.j2 | 3 ++ .../docker-saiserver-brcm/saiserver_start.sh | 32 +++++++++++++++++++ .../broadcom/docker-saiserver-brcm/start.sh | 11 ------- .../docker-saiserver-brcm/supervisord.conf | 2 +- 5 files changed, 43 insertions(+), 13 deletions(-) create mode 100755 platform/broadcom/docker-saiserver-brcm/saiserver_start.sh diff --git a/platform/broadcom/docker-saiserver-brcm.mk b/platform/broadcom/docker-saiserver-brcm.mk index 2ee39c8600e8..6987e42faa78 100644 --- a/platform/broadcom/docker-saiserver-brcm.mk +++ b/platform/broadcom/docker-saiserver-brcm.mk @@ -3,7 +3,13 @@ DOCKER_SAISERVER_BRCM = docker-saiserver$(SAITHRIFT_VER)-brcm.gz $(DOCKER_SAISERVER_BRCM)_PATH = $(PLATFORM_PATH)/docker-saiserver-brcm $(DOCKER_SAISERVER_BRCM)_DEPENDS += $(SAISERVER) -$(DOCKER_SAISERVER_BRCM)_FILES += $(DSSERVE) $(BCMCMD) + +# Use syncd_init_common.sh to init hardware platform +SYNCD_INIT_COMMON_SCRIPT = syncd_init_common.sh +$(SYNCD_INIT_COMMON_SCRIPT)_PATH = $(SRC_PATH)/sonic-sairedis/syncd/scripts +SONIC_COPY_FILES += $(SYNCD_INIT_COMMON_SCRIPT) + +$(DOCKER_SAISERVER_BRCM)_FILES += $(DSSERVE) $(BCMCMD) $(SYNCD_INIT_COMMON_SCRIPT) $(DOCKER_SAISERVER_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_BRCM) SONIC_BULLSEYE_DOCKERS += $(DOCKER_SAISERVER_BRCM) diff --git a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 index 291369ca1568..2e83500b7ea1 100644 --- a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 @@ -25,7 +25,10 @@ debs/ RUN apt-get install -yf kmod COPY ["files/dsserve", "files/bcmcmd", "start.sh", "bcmsh", "/usr/bin/"] +COPY ["saiserver_start.sh", "/usr/bin/"] +COPY ["files/syncd_init_common.sh", "/usr/bin/"] RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd +RUN chmod +x /usr/bin/saiserver_start.sh /usr/bin/syncd_init_common.sh COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/platform/broadcom/docker-saiserver-brcm/saiserver_start.sh b/platform/broadcom/docker-saiserver-brcm/saiserver_start.sh new file mode 100755 index 000000000000..06fcf6c3f3ae --- /dev/null +++ b/platform/broadcom/docker-saiserver-brcm/saiserver_start.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Copy from src/sonic-sairedis/syncd/scripts/syncd_start.sh +# Re-use the structure for syncd setup +# Use it to start saiserver +# Script to start syncd using supervisord +# + +# Source the file that holds common code for systemd and supervisord +. /usr/bin/syncd_init_common.sh + +get_saiserver_param() +{ + IFS=' ' read -r -a array <<< "$CMD_ARGS" + for index in "${!array[@]}" + do + #echo "$index ${array[index]}" + if [[ "${array[index]}" == *"-p"* ]]; then + SAI_PROFILE="${array[index+1]}" + fi + if [[ "${array[index]}" == *"-m"* ]]; then + PORT_CONFIG="${array[index+1]}" + fi + done +} + +ENABLE_SAITHRIFT=1 +config_syncd +get_saiserver_param + +echo exec /usr/sbin/saiserver -p ${SAI_PROFILE} -f ${PORT_CONFIG} +exec /usr/sbin/saiserver -p ${SAI_PROFILE} -f ${PORT_CONFIG} +#exec ${CMD} ${CMD_ARGS} diff --git a/platform/broadcom/docker-saiserver-brcm/start.sh b/platform/broadcom/docker-saiserver-brcm/start.sh index 81813b57ff9d..6a395866c15d 100755 --- a/platform/broadcom/docker-saiserver-brcm/start.sh +++ b/platform/broadcom/docker-saiserver-brcm/start.sh @@ -1,13 +1,6 @@ #!/usr/bin/env bash HWSKU_DIR=/usr/share/sonic/hwsku -start_bcm() -{ - [ -e /dev/linux-bcm-knet ] || mknod /dev/linux-bcm-knet c 122 0 - [ -e /dev/linux-user-bde ] || mknod /dev/linux-user-bde c 126 0 - [ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0 -} - generate_profile() { # There are two ways to specify the contents of the SAI_INIT_CONFIG_FILE and they are mutually exclusive @@ -35,10 +28,6 @@ generate_profile() } rm -f /var/run/rsyslogd.pid - supervisorctl start rsyslogd - generate_profile -start_bcm - supervisorctl start saiserver diff --git a/platform/broadcom/docker-saiserver-brcm/supervisord.conf b/platform/broadcom/docker-saiserver-brcm/supervisord.conf index 3574cd782b78..d20dac89141b 100644 --- a/platform/broadcom/docker-saiserver-brcm/supervisord.conf +++ b/platform/broadcom/docker-saiserver-brcm/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:saiserver] -command=/usr/sbin/saiserver -p /etc/sai.d/sai.profile -f /usr/share/sonic/hwsku/port_config.ini +command=/usr/bin/saiserver_start.sh priority=3 autostart=false autorestart=false From 689f7d2c4333daa7cd2a075d420fb1d4d95f7b07 Mon Sep 17 00:00:00 2001 From: "Richard.Yu" Date: Fri, 6 Jan 2023 11:45:03 +0800 Subject: [PATCH 005/113] [SAI-PTF][BFN]Enable saiserver test container on bfn container (#13166) Why I did it Enable Test sai api on bfn container with a lightweight container(saiserver). How I did it enable saiserver container on barefoot platform. add docker-saiserver-bfn.mk for building saiserver container in platform/barefoot/docker-saiserver-bfn, add necessary files that needs in saiserver container How to verify it Tested on Intel platform ec9516 Signed-off-by: richardyu-ms Signed-off-by: richardyu-ms --- .azure-pipelines/azure-pipelines-build.yml | 6 ++ .azure-pipelines/build-template.yml | 6 ++ platform/barefoot/docker-saiserver-bfn.mk | 39 ++++++++++ .../barefoot/docker-saiserver-bfn/Dockerfile | 37 --------- .../docker-saiserver-bfn/Dockerfile.j2 | 78 +++++++++++++++++++ .../barefoot/docker-saiserver-bfn/portmap.ini | 33 -------- .../barefoot/docker-saiserver-bfn/profile.ini | 1 - .../docker-saiserver-bfn/ptf_nn_agent.conf | 10 +++ .../docker-saiserver-bfn/sai_tofino.xml | 2 - .../docker-saiserver-bfn/saiserver_start.sh | 32 ++++++++ .../barefoot/docker-saiserver-bfn/start.sh | 8 +- .../docker-saiserver-bfn/supervisord.conf | 3 +- platform/barefoot/libsaithrift-dev.mk | 14 +++- platform/barefoot/rules.mk | 1 + 14 files changed, 189 insertions(+), 81 deletions(-) create mode 100644 platform/barefoot/docker-saiserver-bfn.mk delete mode 100755 platform/barefoot/docker-saiserver-bfn/Dockerfile create mode 100755 platform/barefoot/docker-saiserver-bfn/Dockerfile.j2 delete mode 100644 platform/barefoot/docker-saiserver-bfn/portmap.ini delete mode 100644 platform/barefoot/docker-saiserver-bfn/profile.ini create mode 100644 platform/barefoot/docker-saiserver-bfn/ptf_nn_agent.conf delete mode 100644 platform/barefoot/docker-saiserver-bfn/sai_tofino.xml create mode 100644 platform/barefoot/docker-saiserver-bfn/saiserver_start.sh diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index d21a6066a01b..09a46573fe0f 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -154,6 +154,12 @@ jobs: git stash popd fi + if [ $(GROUP_NAME) == barefoot ]; then + make $BUILD_OPTIONS SAITHRIFT_V2=y ENABLE_SYNCD_RPC=y target/docker-saiserverv2-bfn.gz + pushd ./src/sonic-sairedis/SAI + git stash + popd + fi fi if [ $(syncd_rpc_image) == yes ]; then make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/sonic-$(GROUP_NAME).bin diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 52bff4aa9e51..43db5720a3d6 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -116,6 +116,12 @@ jobs: git stash popd fi + if [ ${{ parameters.platform }} == barefoot ]; then + make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) SAITHRIFT_V2=y ENABLE_SYNCD_RPC=y target/docker-saiserverv2-bfn.gz + pushd ./src/sonic-sairedis/SAI + git stash + popd + fi fi make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/sonic-${{ parameters.platform }}.bin diff --git a/platform/barefoot/docker-saiserver-bfn.mk b/platform/barefoot/docker-saiserver-bfn.mk new file mode 100644 index 000000000000..dde7e8888a57 --- /dev/null +++ b/platform/barefoot/docker-saiserver-bfn.mk @@ -0,0 +1,39 @@ +# docker image for bfn saiserver +# Support two version of saiserver, v2 will use the new sai-ptfv2 +DOCKER_SAISERVER_BFN = docker-saiserver$(SAITHRIFT_VER)-bfn.gz +$(DOCKER_SAISERVER_BFN)_PATH = $(PLATFORM_PATH)/docker-saiserver-bfn + +# Use syncd_init_common.sh to init hardware platform +SYNCD_INIT_COMMON_SCRIPT = syncd_init_common.sh +$(SYNCD_INIT_COMMON_SCRIPT)_PATH = $(SRC_PATH)/sonic-sairedis/syncd/scripts +SONIC_COPY_FILES += $(SYNCD_INIT_COMMON_SCRIPT) + +# Same dependence as syncd +$(DOCKER_SAISERVER_BFN)_DEPENDS += $(SAISERVER) +# Install syncd for reuse the config fun +#$(DOCKER_SAISERVER_BFN)_DEPENDS += $(SYNCD) +$(DOCKER_SAISERVER_BFN)_DEPENDS += $(BFN_SAI) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) $(LIBTHRIFT_0_14_1) +$(DOCKER_SAISERVER_BFN)_FILES += $(SYNCD_INIT_COMMON_SCRIPT) + +# Same dependence as ENABLE_SYNCD_RPC +$(DOCKER_SAISERVER_BFN)_DEPENDS += $(LIBSAITHRIFT_DEV) $(LIBTHRIFT_0_14_1_DEV) + +# Runtime dependency on sai is set only for syncd +#$(SYNCD)_RDEPENDS += $(BFN_SAI) $(WNC_OSW1800_PLATFORM) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) +$(DOCKER_SAISERVER_BFN)_RDEPENDS += $(BFN_SAI) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) + +$(DOCKER_SAISERVER_BFN)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) + +SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_BFN) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_SAISERVER_BFN) + +# Only Support saiserver v2 +$(DOCKER_SAISERVER_BFN)_CONTAINER_NAME = saiserver$(SAITHRIFT_VER) +$(DOCKER_SAISERVER_BFN)_VERSION = 1.0.0+rpc +$(DOCKER_SAISERVER_BFN)_PACKAGE_NAME = saiserver + +$(DOCKER_SAISERVER_BFN)_RUN_OPT += --privileged -t +$(DOCKER_SAISERVER_BFN)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SAISERVER_BFN)_RUN_OPT += -v /var/run/docker-saiserver:/var/run/sswsyncd +$(DOCKER_SAISERVER_BFN)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SAISERVER_BFN)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/barefoot/docker-saiserver-bfn/Dockerfile b/platform/barefoot/docker-saiserver-bfn/Dockerfile deleted file mode 100755 index 6fa5b1818a18..000000000000 --- a/platform/barefoot/docker-saiserver-bfn/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/applibs_*.deb \ - && dpkg_apt /deps/applibs-dev_*.deb \ - && dpkg_apt /deps/sx-complib_*.deb \ - && dpkg_apt /deps/sxd-libs_*.deb \ - && dpkg_apt /deps/sx-scew_*.deb \ - && dpkg_apt /deps/sx-examples_*.deb \ - && dpkg_apt /deps/sx-gen-utils_*.deb \ - && dpkg_apt /deps/python-sdk-api_*.deb \ - && dpkg_apt /deps/iproute2_*.deb \ - && dpkg_apt /deps/mlnx-sai_*.deb \ - && dpkg_apt /deps/libthrift-0.9.3_*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb - -COPY ["deps/saiserver", "start.sh", "/usr/bin/"] - -COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] - -COPY ["profile.ini", "portmap.ini", "/etc/sai/"] - - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps - -ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/barefoot/docker-saiserver-bfn/Dockerfile.j2 b/platform/barefoot/docker-saiserver-bfn/Dockerfile.j2 new file mode 100755 index 000000000000..a17cca1a857e --- /dev/null +++ b/platform/barefoot/docker-saiserver-bfn/Dockerfile.j2 @@ -0,0 +1,78 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages %} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} + +ARG docker_container_name + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY \ +{% for deb in docker_saiserver_bfn_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN apt-get install -y \ + libxml2 \ + libpcap-dev \ + libusb-1.0-0 \ + libcurl3-gnutls \ + libunwind8-dev \ + libc-ares2 \ + libedit2 \ + libgoogle-perftools4 + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + wget \ + cmake \ + libqt5core5a \ + libqt5network5 \ + python3-setuptools \ + python3-pip \ + python-is-python3 \ + libboost-atomic1.74.0 + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_saiserver_bfn_debs.split(' ')) }} + +## Support nanomsg, plesae install those package as needed +## If don't need to run cases inside saiserver locally with nn_agent, plesae remove them. +RUN wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip3 install cffi==1.7.0 \ + && pip3 install --upgrade cffi==1.7.0 \ + && pip3 install wheel \ + && pip3 install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + + +COPY ["start.sh", "/usr/bin/"] +COPY ["saiserver_start.sh", "/usr/bin/"] +COPY ["files/syncd_init_common.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +RUN chmod +x /usr/bin/saiserver_start.sh /usr/bin/syncd_init_common.sh + +## If don't need to run cases inside saiserver locally with nn_agent, plesae remove it. +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/barefoot/docker-saiserver-bfn/portmap.ini b/platform/barefoot/docker-saiserver-bfn/portmap.ini deleted file mode 100644 index 4d3be08ce5f8..000000000000 --- a/platform/barefoot/docker-saiserver-bfn/portmap.ini +++ /dev/null @@ -1,33 +0,0 @@ -# alias lanes -Ethernet1 0,1,2,3 -Ethernet2 4,5,6,7 -Ethernet3 8,9,10,11 -Ethernet4 12,13,14,15 -Ethernet5 16,17,18,19 -Ethernet6 20,21,22,23 -Ethernet7 24,25,26,27 -Ethernet8 28,29,30,31 -Ethernet9 32,33,34,35 -Ethernet10 36,37,38,39 -Ethernet11 40,41,42,43 -Ethernet12 44,45,46,47 -Ethernet13 48,49,50,51 -Ethernet14 52,53,54,55 -Ethernet15 56,57,58,59 -Ethernet16 60,61,62,63 -Ethernet17 64,65,66,67 -Ethernet18 68,69,70,71 -Ethernet19 72,73,74,75 -Ethernet20 76,77,78,79 -Ethernet21 80,81,82,83 -Ethernet22 84,85,86,87 -Ethernet23 88,89,90,91 -Ethernet24 92,93,94,95 -Ethernet25 96,97,98,99 -Ethernet26 100,101,102,103 -Ethernet27 104,105,106,107 -Ethernet28 108,109,110,111 -Ethernet29 112,113,114,115 -Ethernet30 116,117,118,119 -Ethernet31 120,121,122,123 -Ethernet32 124,125,126,127 \ No newline at end of file diff --git a/platform/barefoot/docker-saiserver-bfn/profile.ini b/platform/barefoot/docker-saiserver-bfn/profile.ini deleted file mode 100644 index b20b2c6f0e06..000000000000 --- a/platform/barefoot/docker-saiserver-bfn/profile.ini +++ /dev/null @@ -1 +0,0 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_tofino.xml diff --git a/platform/barefoot/docker-saiserver-bfn/ptf_nn_agent.conf b/platform/barefoot/docker-saiserver-bfn/ptf_nn_agent.conf new file mode 100644 index 000000000000..fa1ed0eb1622 --- /dev/null +++ b/platform/barefoot/docker-saiserver-bfn/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/barefoot/docker-saiserver-bfn/sai_tofino.xml b/platform/barefoot/docker-saiserver-bfn/sai_tofino.xml deleted file mode 100644 index 139597f9cb07..000000000000 --- a/platform/barefoot/docker-saiserver-bfn/sai_tofino.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/platform/barefoot/docker-saiserver-bfn/saiserver_start.sh b/platform/barefoot/docker-saiserver-bfn/saiserver_start.sh new file mode 100644 index 000000000000..06fcf6c3f3ae --- /dev/null +++ b/platform/barefoot/docker-saiserver-bfn/saiserver_start.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Copy from src/sonic-sairedis/syncd/scripts/syncd_start.sh +# Re-use the structure for syncd setup +# Use it to start saiserver +# Script to start syncd using supervisord +# + +# Source the file that holds common code for systemd and supervisord +. /usr/bin/syncd_init_common.sh + +get_saiserver_param() +{ + IFS=' ' read -r -a array <<< "$CMD_ARGS" + for index in "${!array[@]}" + do + #echo "$index ${array[index]}" + if [[ "${array[index]}" == *"-p"* ]]; then + SAI_PROFILE="${array[index+1]}" + fi + if [[ "${array[index]}" == *"-m"* ]]; then + PORT_CONFIG="${array[index+1]}" + fi + done +} + +ENABLE_SAITHRIFT=1 +config_syncd +get_saiserver_param + +echo exec /usr/sbin/saiserver -p ${SAI_PROFILE} -f ${PORT_CONFIG} +exec /usr/sbin/saiserver -p ${SAI_PROFILE} -f ${PORT_CONFIG} +#exec ${CMD} ${CMD_ARGS} diff --git a/platform/barefoot/docker-saiserver-bfn/start.sh b/platform/barefoot/docker-saiserver-bfn/start.sh index 16457d13e03a..ce82391c9b86 100755 --- a/platform/barefoot/docker-saiserver-bfn/start.sh +++ b/platform/barefoot/docker-saiserver-bfn/start.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash +# +# Same method from platform/barefoot/docker-syncd-bfn/start.sh +# +. /opt/bfn/install/bin/dma_setup.sh +# . /opt/bfn/install/bin/bf_kdrv_mod_load /opt/bfn/install -rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd - supervisorctl start saiserver - diff --git a/platform/barefoot/docker-saiserver-bfn/supervisord.conf b/platform/barefoot/docker-saiserver-bfn/supervisord.conf index e09ac3cbb449..4400184e5395 100644 --- a/platform/barefoot/docker-saiserver-bfn/supervisord.conf +++ b/platform/barefoot/docker-saiserver-bfn/supervisord.conf @@ -20,7 +20,8 @@ stdout_logfile=syslog stderr_logfile=syslog [program:saiserver] -command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +environment=LD_LIBRARY_PATH="/opt/bfn/install/lib" +command=/usr/bin/saiserver_start.sh priority=3 autostart=false autorestart=false diff --git a/platform/barefoot/libsaithrift-dev.mk b/platform/barefoot/libsaithrift-dev.mk index 0fb5ca0cb81d..a35cf13e5e2a 100644 --- a/platform/barefoot/libsaithrift-dev.mk +++ b/platform/barefoot/libsaithrift-dev.mk @@ -1,10 +1,16 @@ # libsaithrift-dev package SAI_VER = 0.9.4 -LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb +LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) \ $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) \ $(BFN_SAI) +# Support two version of saithift for syncd-rpc +# Support two different versions of thrift +# Only saithriftv2 will build saithriftv2 +ifeq ($(SAITHRIFT_V2),y) +$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SAITHRIFT_VER=v2 GEN_SAIRPC_OPTS="--adapter_logger" +endif #$(LIBSAIVS) $(LIBSAIVS_DEV) $(LIBSAIMETADATA) $(LIBSAIMETADATA_DEV) @@ -13,13 +19,13 @@ $(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) \ $(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1) $(BFN_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) -PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +PYTHON_SAITHRIFT = python-saithrift$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) -SAISERVER = saiserver_$(SAI_VER)_amd64.deb +SAISERVER = saiserver$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb $(SAISERVER)_RDEPENDS += $(LIBTHRIFT_0_14_1) $(BFN_SAI) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) -SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +SAISERVER_DBG = saiserver$(SAITHRIFT_VER)-dbg_$(SAI_VER)_amd64.deb $(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/barefoot/rules.mk b/platform/barefoot/rules.mk index 3eaa35fdb2c3..58f52f5ffd56 100644 --- a/platform/barefoot/rules.mk +++ b/platform/barefoot/rules.mk @@ -16,6 +16,7 @@ include $(PLATFORM_PATH)/bfn-platform.mk #include $(PLATFORM_PATH)/bfn-platform-wnc.mk #include $(PLATFORM_PATH)/bfn-platform-ingrasys.mk include $(PLATFORM_PATH)/bfn-modules.mk +include $(PLATFORM_PATH)/docker-saiserver-bfn.mk SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT) \ $(DOCKER_FPM) From 9f36a9b6e5609237cdac5e7cfe055aef6e60eeb1 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Fri, 6 Jan 2023 13:56:49 +0800 Subject: [PATCH 006/113] [submodule] Advance sonic-utilities submodule pointer (#13113) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 49fc3896a0ef..b34a540cca55 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 49fc3896a0ef907ff337467a3e04d2501ef850fd +Subproject commit b34a540cca5555ab3aa74e19e81f24c2a20d311b From 2c410b4aaf010168cda4a9e6efb6a5a4fda1598e Mon Sep 17 00:00:00 2001 From: kellyyeh <42761586+kellyyeh@users.noreply.github.com> Date: Fri, 6 Jan 2023 14:43:24 -0800 Subject: [PATCH 007/113] [dhcpmon] Fix dhcpmon socket filter and tx count issue (#13065) Why I did it Fix issue caused by dualtor support PR [dhcpmon] Open different socket for dual tor to enable interface filtering #11201 Improve code How I did it On single ToR, packets received count was duplicated due to socket filter set to "inbound" Tx count not increasing due to filter set to "inbound". Added an outbound socket to count tx packets Added vlan member interface mapping for Ethernet interface to vlan interface lookup in reference to PR Fix multiple vlan issue sonic-dhcp-relay#27 Exit when socket fails to initialize to allow dhcp_relay docker to restart How to verify it Tested on vstestbed single tor and dual tor, sent packets and verify printed out dhcpmon rx and tx counters is correct Correct number of tx increases Tx does not increase when ToR is on standby --- src/dhcpmon/src/dhcp_device.cpp | 316 ++++++++++++++++++-------------- src/dhcpmon/src/dhcp_device.h | 8 +- src/dhcpmon/src/dhcp_mon.cpp | 2 +- 3 files changed, 185 insertions(+), 141 deletions(-) diff --git a/src/dhcpmon/src/dhcp_device.cpp b/src/dhcpmon/src/dhcp_device.cpp index 8ec91b057b64..f4f23526e136 100644 --- a/src/dhcpmon/src/dhcp_device.cpp +++ b/src/dhcpmon/src/dhcp_device.cpp @@ -41,6 +41,7 @@ #define DHCP_OPTIONS_HEADER_SIZE 240 /** Offset of DHCP GIADDR */ #define DHCP_GIADDR_OFFSET 24 +#define CLIENT_IF_PREFIX "Ethernet" #define OP_LDHA (BPF_LD | BPF_H | BPF_ABS) /** bpf ldh Abs */ #define OP_LDHI (BPF_LD | BPF_H | BPF_IND) /** bpf ldh Ind */ @@ -51,19 +52,54 @@ #define OP_JSET (BPF_JMP | BPF_JSET | BPF_K) /** bpf jset */ #define OP_LDXB (BPF_LDX | BPF_B | BPF_MSH) /** bpf ldxb */ +std::shared_ptr mConfigDbPtr = std::make_shared ("CONFIG_DB", 0); std::shared_ptr mStateDbPtr = std::make_shared ("STATE_DB", 0); std::shared_ptr mStateDbMuxTablePtr = std::make_shared ( mStateDbPtr.get(), "HW_MUX_CABLE_TABLE" ); -swss::DBConnector configDb("CONFIG_DB", 0); + +/* interface to vlan mapping */ +std::unordered_map vlan_map; + +/** Berkeley Packet Filter program for "udp and (port 67 or port 68)". + * This program is obtained using the following command tcpdump: + * `tcpdump -dd "outbound and udp and (port 67 or port 68)"` + */ +static struct sock_filter dhcp_outbound_bpf_code[] = { + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0xfffff004}, // (000) ldh #fffff004 + {.code = OP_JEQ, .jt = 0, .jf = 22, .k = 0x00000004}, // (001) jeq #0x04 jt 0 jf 22 + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x0000000c}, // (002) ldh [12] + {.code = OP_JEQ, .jt = 0, .jf = 7, .k = 0x000086dd}, // (003) jeq #0x86dd jt 2 jf 9 + {.code = OP_LDB, .jt = 0, .jf = 0, .k = 0x00000014}, // (004) ldb [20] + {.code = OP_JEQ, .jt = 0, .jf = 18, .k = 0x00000011}, // (005) jeq #0x11 jt 4 jf 22 + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000036}, // (006) ldh [54] + {.code = OP_JEQ, .jt = 15, .jf = 0, .k = 0x00000043}, // (007) jeq #0x43 jt 21 jf 6 + {.code = OP_JEQ, .jt = 14, .jf = 0, .k = 0x00000044}, // (008) jeq #0x44 jt 21 jf 7 + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000038}, // (009) ldh [56] + {.code = OP_JEQ, .jt = 12, .jf = 11, .k = 0x00000043}, // (010) jeq #0x43 jt 21 jf 20 + {.code = OP_JEQ, .jt = 0, .jf = 12, .k = 0x00000800}, // (011) jeq #0x800 jt 10 jf 22 + {.code = OP_LDB, .jt = 0, .jf = 0, .k = 0x00000017}, // (012) ldb [23] + {.code = OP_JEQ, .jt = 0, .jf = 10, .k = 0x00000011}, // (013) jeq #0x11 jt 12 jf 22 + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000014}, // (014) ldh [20] + {.code = OP_JSET, .jt = 8, .jf = 0, .k = 0x00001fff}, // (015) jset #0x1fff jt 22 jf 14 + {.code = OP_LDXB, .jt = 0, .jf = 0, .k = 0x0000000e}, // (016) ldxb 4*([14]&0xf) + {.code = OP_LDHI, .jt = 0, .jf = 0, .k = 0x0000000e}, // (017) ldh [x + 14] + {.code = OP_JEQ, .jt = 4, .jf = 0, .k = 0x00000043}, // (018) jeq #0x43 jt 21 jf 17 + {.code = OP_JEQ, .jt = 3, .jf = 0, .k = 0x00000044}, // (019) jeq #0x44 jt 21 jf 18 + {.code = OP_LDHI, .jt = 0, .jf = 0, .k = 0x00000010}, // (020) ldh [x + 16] + {.code = OP_JEQ, .jt = 1, .jf = 0, .k = 0x00000043}, // (021) jeq #0x43 jt 21 jf 20 + {.code = OP_JEQ, .jt = 0, .jf = 1, .k = 0x00000044}, // (022) jeq #0x44 jt 21 jf 22 + {.code = OP_RET, .jt = 0, .jf = 0, .k = 0x00040000}, // (023) ret #262144 + {.code = OP_RET, .jt = 0, .jf = 0, .k = 0x00000000}, // (024) ret #0 +}; /** Berkeley Packet Filter program for "udp and (port 67 or port 68)". * This program is obtained using the following command tcpdump: * `tcpdump -dd "inbound and udp and (port 67 or port 68)"` */ -static struct sock_filter dhcp_bpf_code[] = { +static struct sock_filter dhcp_inbound_bpf_code[] = { {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0xfffff004}, // (000) ldh #fffff004 - {.code = OP_JEQ, .jt = 22, .jf = 0, .k = 0x00000004}, // (001) jeq #0x04 jt 22 jf 0 + {.code = OP_JEQ, .jt = 22, .jf = 0, .k = 0x00000004}, // (001) jeq #0x04 jt 22 jf 0 {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x0000000c}, // (002) ldh [12] {.code = OP_JEQ, .jt = 0, .jf = 7, .k = 0x000086dd}, // (003) jeq #0x86dd jt 2 jf 9 {.code = OP_LDB, .jt = 0, .jf = 0, .k = 0x00000014}, // (004) ldb [20] @@ -90,8 +126,11 @@ static struct sock_filter dhcp_bpf_code[] = { }; /** Filter program socket struct */ -static struct sock_fprog dhcp_sock_bfp = { - .len = sizeof(dhcp_bpf_code) / sizeof(*dhcp_bpf_code), .filter = dhcp_bpf_code +static struct sock_fprog dhcp_outbound_sock_bfp = { + .len = sizeof(dhcp_outbound_bpf_code) / sizeof(*dhcp_outbound_bpf_code), .filter = dhcp_outbound_bpf_code +}; +static struct sock_fprog dhcp_inbound_sock_bfp = { + .len = sizeof(dhcp_inbound_bpf_code) / sizeof(*dhcp_inbound_bpf_code), .filter = dhcp_inbound_bpf_code }; /** Aggregate device of DHCP interfaces. It contains aggregate counters from @@ -107,6 +146,17 @@ static dhcp_message_type_t monitored_msgs[] = { DHCP_MESSAGE_TYPE_ACK }; +void update_vlan_mapping(std::string vlan, std::shared_ptr mConfigDbPtr) { + auto match_pattern = std::string("VLAN_MEMBER|") + vlan + std::string("|*"); + auto keys = mConfigDbPtr->keys(match_pattern); + for (auto &itr : keys) { + auto found = itr.find_last_of('|'); + auto interface = itr.substr(found + 1); + vlan_map[interface] = vlan; + syslog(LOG_INFO, "add <%s, %s> into interface vlan map\n", interface.c_str(), vlan.c_str()); + } +} + /** Number of monitored DHCP message type */ static uint8_t monitored_msg_sz = sizeof(monitored_msgs) / sizeof(*monitored_msgs); @@ -163,9 +213,62 @@ static void handle_dhcp_option_53(dhcp_device_context_t *context, } /** - * @code read_callback(fd, event, arg); + * @code client_packet_handler(dhcp_device_context_t *context, ssize_t buffer_sz); + * + * @brief packet handler to process received rx and tx packets + * + * @param context pointer to device (interface) context + * @param buffer_sz buffer that stores received packet data + * + * @return none + */ +static void client_packet_handler(dhcp_device_context_t *context, ssize_t buffer_sz) +{ + struct ether_header *ethhdr = (struct ether_header*) context->buffer; + struct ip *iphdr = (struct ip*) (context->buffer + IP_START_OFFSET); + struct udphdr *udp = (struct udphdr*) (context->buffer + UDP_START_OFFSET); + uint8_t *dhcphdr = context->buffer + DHCP_START_OFFSET; + int dhcp_option_offset = DHCP_START_OFFSET + DHCP_OPTIONS_HEADER_SIZE; + + if (((unsigned)buffer_sz > UDP_START_OFFSET + sizeof(struct udphdr) + DHCP_OPTIONS_HEADER_SIZE) && + (ntohs(udp->len) > DHCP_OPTIONS_HEADER_SIZE)) + { + int dhcp_sz = ntohs(udp->len) < buffer_sz - UDP_START_OFFSET - sizeof(struct udphdr) ? + ntohs(udp->len) : buffer_sz - UDP_START_OFFSET - sizeof(struct udphdr); + int dhcp_option_sz = dhcp_sz - DHCP_OPTIONS_HEADER_SIZE; + const u_char *dhcp_option = context->buffer + dhcp_option_offset; + dhcp_packet_direction_t dir = (ethhdr->ether_shost[0] == context->mac[0] && + ethhdr->ether_shost[1] == context->mac[1] && + ethhdr->ether_shost[2] == context->mac[2] && + ethhdr->ether_shost[3] == context->mac[3] && + ethhdr->ether_shost[4] == context->mac[4] && + ethhdr->ether_shost[5] == context->mac[5]) ? + DHCP_TX : DHCP_RX; + int offset = 0; + while ((offset < (dhcp_option_sz + 1)) && dhcp_option[offset] != 255) { + if (dhcp_option[offset] == OPTION_DHCP_MESSAGE_TYPE) { + if (offset < (dhcp_option_sz + 2)) { + handle_dhcp_option_53(context, &dhcp_option[offset], dir, iphdr, dhcphdr); + } + break; // break while loop since we are only interested in Option 53 + } + + if (dhcp_option[offset] == 0) { // DHCP Option Padding + offset++; + } else { + offset += dhcp_option[offset + 1] + 2; + } + } + } else { + syslog(LOG_WARNING, "read_callback(%s): read length (%ld) is too small to capture DHCP options", + context->intf, buffer_sz); + } +} + +/** + * @code read_tx_callback(fd, event, arg); * - * @brief callback for libevent which is called every time out in order to read queued packet capture + * @brief callback for libevent which is called every time out in order to read queued outgoing packet capture * * @param fd socket to read from * @param event libevent triggered event @@ -173,68 +276,20 @@ static void handle_dhcp_option_53(dhcp_device_context_t *context, * * @return none */ -static void read_callback(int fd, short event, void *arg) +static void read_tx_callback(int fd, short event, void *arg) { dhcp_device_context_t *context = (dhcp_device_context_t*) arg; ssize_t buffer_sz; - while ((event == EV_READ) && - ((buffer_sz = recv(fd, context->buffer, context->snaplen, MSG_DONTWAIT)) > 0)) { - struct ether_header *ethhdr = (struct ether_header*) context->buffer; - struct ip *iphdr = (struct ip*) (context->buffer + IP_START_OFFSET); - struct udphdr *udp = (struct udphdr*) (context->buffer + UDP_START_OFFSET); - uint8_t *dhcphdr = context->buffer + DHCP_START_OFFSET; - int dhcp_option_offset = DHCP_START_OFFSET + DHCP_OPTIONS_HEADER_SIZE; - - if (((unsigned)buffer_sz > UDP_START_OFFSET + sizeof(struct udphdr) + DHCP_OPTIONS_HEADER_SIZE) && - (ntohs(udp->len) > DHCP_OPTIONS_HEADER_SIZE)) { - int dhcp_sz = ntohs(udp->len) < buffer_sz - UDP_START_OFFSET - sizeof(struct udphdr) ? - ntohs(udp->len) : buffer_sz - UDP_START_OFFSET - sizeof(struct udphdr); - int dhcp_option_sz = dhcp_sz - DHCP_OPTIONS_HEADER_SIZE; - const u_char *dhcp_option = context->buffer + dhcp_option_offset; - dhcp_packet_direction_t dir = (ethhdr->ether_shost[0] == context->mac[0] && - ethhdr->ether_shost[1] == context->mac[1] && - ethhdr->ether_shost[2] == context->mac[2] && - ethhdr->ether_shost[3] == context->mac[3] && - ethhdr->ether_shost[4] == context->mac[4] && - ethhdr->ether_shost[5] == context->mac[5]) ? - DHCP_TX : DHCP_RX; - int offset = 0; - int stop_dhcp_processing = 0; - while ((offset < (dhcp_option_sz + 1)) && dhcp_option[offset] != 255) { - switch (dhcp_option[offset]) - { - case 53: - if (offset < (dhcp_option_sz + 2)) { - handle_dhcp_option_53(context, &dhcp_option[offset], dir, iphdr, dhcphdr); - } - stop_dhcp_processing = 1; // break while loop since we are only interested in Option 53 - break; - default: - break; - } - - if (stop_dhcp_processing == 1) { - break; - } - - if (dhcp_option[offset] == 0) { // DHCP Option Padding - offset++; - } else { - offset += dhcp_option[offset + 1] + 2; - } - } - } else { - syslog(LOG_WARNING, "read_callback(%s): read length (%ld) is too small to capture DHCP options", - context->intf, buffer_sz); - } + while ((buffer_sz = recv(fd, context->buffer, context->snaplen, MSG_DONTWAIT)) > 0) { + client_packet_handler(context, buffer_sz); } } /** - * @code read_callback_dual_tor(fd, event, arg); + * @code read_rx_callback(fd, event, arg); * - * @brief callback for libevent which is called every time out in order to read queued packet capture when dual tor mode is enabled + * @brief callback for libevent which is called every time out in order to read queued incoming packet capture * * @param fd socket to read from * @param event libevent triggered event @@ -242,72 +297,37 @@ static void read_callback(int fd, short event, void *arg) * * @return none */ -static void read_callback_dual_tor(int fd, short event, void *arg) +static void read_rx_callback(int fd, short event, void *arg) { dhcp_device_context_t *context = (dhcp_device_context_t*) arg; ssize_t buffer_sz; struct sockaddr_ll sll; socklen_t slen = sizeof sll; - while ((event == EV_READ) && - ((buffer_sz = recvfrom(fd, context->buffer, context->snaplen, MSG_DONTWAIT, (struct sockaddr *)&sll, &slen)) > 0)) + while ((buffer_sz = recvfrom(fd, context->buffer, context->snaplen, MSG_DONTWAIT, (struct sockaddr *)&sll, &slen)) > 0) { - std::string member_table = std::string("VLAN_MEMBER|") + context->intf + "|"; char interfaceName[IF_NAMESIZE]; - char *interface = if_indextoname(sll.sll_ifindex, interfaceName); - std::string state; - std::string intf(interface); - mStateDbMuxTablePtr->hget(intf, "state", state); - if (state != "standby" && configDb.exists(member_table.append(interface))) { - struct ether_header *ethhdr = (struct ether_header*) context->buffer; - struct ip *iphdr = (struct ip*) (context->buffer + IP_START_OFFSET); - struct udphdr *udp = (struct udphdr*) (context->buffer + UDP_START_OFFSET); - uint8_t *dhcphdr = context->buffer + DHCP_START_OFFSET; - int dhcp_option_offset = DHCP_START_OFFSET + DHCP_OPTIONS_HEADER_SIZE; - - if (((unsigned)buffer_sz > UDP_START_OFFSET + sizeof(struct udphdr) + DHCP_OPTIONS_HEADER_SIZE) && - (ntohs(udp->len) > DHCP_OPTIONS_HEADER_SIZE)) - { - int dhcp_sz = ntohs(udp->len) < buffer_sz - UDP_START_OFFSET - sizeof(struct udphdr) ? - ntohs(udp->len) : buffer_sz - UDP_START_OFFSET - sizeof(struct udphdr); - int dhcp_option_sz = dhcp_sz - DHCP_OPTIONS_HEADER_SIZE; - const u_char *dhcp_option = context->buffer + dhcp_option_offset; - dhcp_packet_direction_t dir = (ethhdr->ether_shost[0] == context->mac[0] && - ethhdr->ether_shost[1] == context->mac[1] && - ethhdr->ether_shost[2] == context->mac[2] && - ethhdr->ether_shost[3] == context->mac[3] && - ethhdr->ether_shost[4] == context->mac[4] && - ethhdr->ether_shost[5] == context->mac[5]) ? - DHCP_TX : DHCP_RX; - int offset = 0; - int stop_dhcp_processing = 0; - while ((offset < (dhcp_option_sz + 1)) && dhcp_option[offset] != 255) { - switch (dhcp_option[offset]) - { - case 53: - if (offset < (dhcp_option_sz + 2)) { - handle_dhcp_option_53(context, &dhcp_option[offset], dir, iphdr, dhcphdr); - } - stop_dhcp_processing = 1; // break while loop since we are only interested in Option 53 - break; - default: - break; - } - - if (stop_dhcp_processing == 1) { - break; - } - - if (dhcp_option[offset] == 0) { // DHCP Option Padding - offset++; - } else { - offset += dhcp_option[offset + 1] + 2; - } - } - } else { - syslog(LOG_WARNING, "read_callback(%s): read length (%ld) is too small to capture DHCP options", - context->intf, buffer_sz); + if (if_indextoname(sll.sll_ifindex, interfaceName) == NULL) { + syslog(LOG_WARNING, "invalid input interface index %d\n", sll.sll_ifindex); + continue; + } + std::string intf(interfaceName); + auto vlan = vlan_map.find(intf); + if (vlan == vlan_map.end()) { + if (intf.find(CLIENT_IF_PREFIX) != std::string::npos) { + syslog(LOG_WARNING, "invalid input interface %s\n", interfaceName); + } + continue; + } + + if (dual_tor_sock) { + std::string state; + mStateDbMuxTablePtr->hget(intf, "state", state); + if (state != "standby") { + client_packet_handler(context, buffer_sz); } + } else { + client_packet_handler(context, buffer_sz); } } } @@ -495,22 +515,33 @@ static int init_socket(dhcp_device_context_t *context, const char *intf) int rv = -1; do { - context->sock = socket(AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, htons(ETH_P_ALL)); - if (context->sock < 0) { + context->rx_sock = socket(AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, htons(ETH_P_ALL)); + context->tx_sock = socket(AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, htons(ETH_P_ALL)); + if (context->rx_sock < 0 || context->tx_sock < 0) { syslog(LOG_ALERT, "socket: failed to open socket with '%s'\n", strerror(errno)); - break; + exit(1); } - struct sockaddr_ll addr; - memset(&addr, 0, sizeof(addr)); - addr.sll_ifindex = 0; // any interface - addr.sll_family = AF_PACKET; - addr.sll_protocol = htons(ETH_P_ALL); - if (bind(context->sock, (struct sockaddr *) &addr, sizeof(addr))) { + struct sockaddr_ll rx_addr; + memset(&rx_addr, 0, sizeof(rx_addr)); + rx_addr.sll_ifindex = 0; // any interface + rx_addr.sll_family = AF_PACKET; + rx_addr.sll_protocol = htons(ETH_P_ALL); + if (bind(context->rx_sock, (struct sockaddr *) &rx_addr, sizeof(rx_addr))) { syslog(LOG_ALERT, "bind: failed to bind to interface '%s' with '%s'\n", intf, strerror(errno)); break; } + struct sockaddr_ll tx_addr; + memset(&tx_addr, 0, sizeof(tx_addr)); + tx_addr.sll_ifindex = if_nametoindex(intf); + tx_addr.sll_family = AF_PACKET; + tx_addr.sll_protocol = htons(ETH_P_ALL); + if (bind(context->tx_sock, (struct sockaddr *) &tx_addr, sizeof(tx_addr))) { + syslog(LOG_ALERT, "bind: failed to bind to interface '%s' with '%s'\n", intf, strerror(errno)); + exit(1); + } + strncpy(context->intf, intf, sizeof(context->intf) - 1); context->intf[sizeof(context->intf) - 1] = '\0'; @@ -644,17 +675,18 @@ int dhcp_device_start_capture(dhcp_device_context_t *context, in_addr_t giaddr_ip) { int rv = -1; - struct event *ev; + struct event *rx_ev; + struct event *tx_ev; do { if (context == NULL) { syslog(LOG_ALERT, "NULL interface context pointer'\n"); - break; + exit(1); } if (snaplen < UDP_START_OFFSET + sizeof(struct udphdr) + DHCP_OPTIONS_HEADER_SIZE) { syslog(LOG_ALERT, "dhcp_device_start_capture(%s): snap length is too low to capture DHCP options", context->intf); - break; + exit(1); } context->giaddr_ip = giaddr_ip; @@ -662,25 +694,31 @@ int dhcp_device_start_capture(dhcp_device_context_t *context, context->buffer = (uint8_t *) malloc(snaplen); if (context->buffer == NULL) { syslog(LOG_ALERT, "malloc: failed to allocate memory for socket buffer '%s'\n", strerror(errno)); - break; + exit(1); } context->snaplen = snaplen; - if (setsockopt(context->sock, SOL_SOCKET, SO_ATTACH_FILTER, &dhcp_sock_bfp, sizeof(dhcp_sock_bfp)) != 0) { + if (setsockopt(context->rx_sock, SOL_SOCKET, SO_ATTACH_FILTER, &dhcp_inbound_sock_bfp, sizeof(dhcp_inbound_sock_bfp)) != 0) { syslog(LOG_ALERT, "setsockopt: failed to attach filter with '%s'\n", strerror(errno)); - break; + exit(1); } - if (dual_tor_sock) - ev = event_new(base, context->sock, EV_READ | EV_PERSIST, read_callback_dual_tor, context); - else - ev = event_new(base, context->sock, EV_READ | EV_PERSIST, read_callback, context); + if (setsockopt(context->tx_sock, SOL_SOCKET, SO_ATTACH_FILTER, &dhcp_outbound_sock_bfp, sizeof(dhcp_outbound_sock_bfp)) != 0) { + syslog(LOG_ALERT, "setsockopt: failed to attach filter with '%s'\n", strerror(errno)); + exit(1); + } + + update_vlan_mapping(context->intf, mConfigDbPtr); - if (ev == NULL) { + rx_ev = event_new(base, context->rx_sock, EV_READ | EV_PERSIST, read_rx_callback, context); + tx_ev = event_new(base, context->tx_sock, EV_READ | EV_PERSIST, read_tx_callback, context); + + if (rx_ev == NULL || tx_ev == NULL) { syslog(LOG_ALERT, "event_new: failed to allocate memory for libevent event '%s'\n", strerror(errno)); - break; + exit(1); } - event_add(ev, NULL); + event_add(rx_ev, NULL); + event_add(tx_ev, NULL); rv = 0; } while (0); diff --git a/src/dhcpmon/src/dhcp_device.h b/src/dhcpmon/src/dhcp_device.h index a2b2a789fca6..2e376ac77e6f 100644 --- a/src/dhcpmon/src/dhcp_device.h +++ b/src/dhcpmon/src/dhcp_device.h @@ -35,6 +35,11 @@ typedef enum DHCP_MESSAGE_TYPE_COUNT } dhcp_message_type_t; +enum +{ + OPTION_DHCP_MESSAGE_TYPE = 53, +}; + /** packet direction */ typedef enum { @@ -71,7 +76,8 @@ typedef enum /** DHCP device (interface) context */ typedef struct { - int sock; /** Raw socket associated with this device/interface */ + int rx_sock; /** Raw socket associated with this device/interface to count rx packets */ + int tx_sock; /** Raw socket associated with this device/interface to count tx packets*/ in_addr_t ip; /** network address of this device (interface) */ uint8_t mac[ETHER_ADDR_LEN]; /** hardware address of this device (interface) */ in_addr_t giaddr_ip; /** Gateway IP address */ diff --git a/src/dhcpmon/src/dhcp_mon.cpp b/src/dhcpmon/src/dhcp_mon.cpp index 4860b2b06a55..662f507c2b5e 100644 --- a/src/dhcpmon/src/dhcp_mon.cpp +++ b/src/dhcpmon/src/dhcp_mon.cpp @@ -99,7 +99,7 @@ static void check_dhcp_relay_health(dhcp_mon_state_t *state_data) case DHCP_MON_STATUS_UNHEALTHY: if (++state_data->count > dhcp_unhealthy_max_count) { auto duration = state_data->count * window_interval_sec; - std::string vlan(context->intf); + std::string vlan(context->intf); syslog(LOG_ALERT, state_data->msg, duration, context->intf); if (state_data->check_type == DHCP_MON_CHECK_POSITIVE) { event_params_t params = { From 2c02a76d4f8923965fa65adfa49f2006550aa21b Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Fri, 6 Jan 2023 16:33:04 -0800 Subject: [PATCH 008/113] Revert incorrect submodule changes in #13056 (#13262) Undo submodule updates that were incorrectly done in #13056. Partial revert of d57de09 The following submodule changes are being reverted to the version that were present before the above PR got merged: src/sonic-linux-kernel to 34f26b35839d7c0c09d48176c4ec33197344643c src/sonic-frr/frr to 79188bf710e92acf42fb5b9b0a2e9593a5ee9b05 Signed-off-by: Saikrishna Arcot sarcot@microsoft.com --- src/sonic-frr/frr | 2 +- src/sonic-linux-kernel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-frr/frr b/src/sonic-frr/frr index c69608a68083..79188bf710e9 160000 --- a/src/sonic-frr/frr +++ b/src/sonic-frr/frr @@ -1 +1 @@ -Subproject commit c69608a68083d1017257977bd0260bebdb12322f +Subproject commit 79188bf710e92acf42fb5b9b0a2e9593a5ee9b05 diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index dbe40633f195..34f26b35839d 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit dbe40633f195fa8495f6d34d4c2048dfd9764830 +Subproject commit 34f26b35839d7c0c09d48176c4ec33197344643c From 9ecd27ddbbbc252c50e1ccdeb9a8e35c67ce7e25 Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Fri, 6 Jan 2023 18:36:37 -0800 Subject: [PATCH 009/113] During build time mask only those feature/services that are disabled excplicitly (#13283) What I did: Fix : #13117 How I did: During build time mask only those feature/services that are disabled explicitly. Some of the features ((eg: teamd/bgp/dhcp-relay/mux/etc..)) state is determine run-time so for those feature by default service will be up and running and then later hostcfgd will mask them if needed. So Default behavior will be init_cfg.json.j2 during build time make state as disabled then mask the service init_cfg.json.j2 during build time make state as another jinja2 template render string than do no mask the service init_cfg.json.j2 during build time make state as enabled then do not mask the service How I verify: Manual Verification. Signed-off-by: Abhishek Dosi --- files/build_scripts/mask_disabled_services.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/files/build_scripts/mask_disabled_services.py b/files/build_scripts/mask_disabled_services.py index 5c1a3695802f..291b8d7e0748 100755 --- a/files/build_scripts/mask_disabled_services.py +++ b/files/build_scripts/mask_disabled_services.py @@ -4,10 +4,20 @@ import subprocess INIT_CFG_FILE_PATH = '/etc/sonic/init_cfg.json' +WARM_OR_FAST_BOOT_DATAPLANE_NEEDED_SERVICES = ['database', 'swss', 'syncd', 'teamd', 'bgp'] with open(INIT_CFG_FILE_PATH) as init_cfg_file: init_cfg = json.load(init_cfg_file) if 'FEATURE' in init_cfg: for feature_name, feature_props in init_cfg['FEATURE'].items(): - if 'state' in feature_props and feature_props['state'] != 'enabled' and feature_props['state'] != 'always_enabled': - subprocess.run(['systemctl', 'mask', '{}.service'.format(feature_name)]) + # For warm/fast boot we want to have all crtical dataplane needed service + # to start immediately before hostcfgd can render `state` field unless the `state` field is marked disabled + # explicitly during build time rendering of init_cfg.json + if feature_name in WARM_OR_FAST_BOOT_DATAPLANE_NEEDED_SERVICES: + if 'state' in feature_props and (feature_props['state'] == 'disabled' or feature_props['state'] == 'always_disabled'): + subprocess.run(['systemctl', 'mask', '{}.service'.format(feature_name)]) + # For other services by default mask out the service if not enable explicitly. This service can get enable later on when + # hostcfgd render the state as enable. This should not cause dataplane impact. + else: + if 'state' in feature_props and feature_props['state'] != 'enabled' and feature_props['state'] != 'always_enabled': + subprocess.run(['systemctl', 'mask', '{}.service'.format(feature_name)]) From 19010a36ea62cce4b767e5c6049422233b513995 Mon Sep 17 00:00:00 2001 From: Guilt Date: Sun, 8 Jan 2023 05:39:11 +0100 Subject: [PATCH 010/113] [build] Fix isc-dhcp full version in rules.mk (#13288) During the build process, a dsc file is retrieved from the URL: http://deb.debian.org/debian/pool/main/i/isc-dhcp/isc-dhcp_4.4.1-2.3.dsc Depending on the DNS resolution, the server reached may respond with a HTTP 404 error code, what stops the build process. In all cases, the URL http://deb.debian.org/debian/pool/main/i/isc-dhcp/ no more lists this DSC file but one with a different format. The suffix "+deb11u1" is now appended to identify the debian version. - append this suffix to the make file rules of isc-dhcp Signed-off-by: Guillaume Lambert --- rules/isc-dhcp.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 1a1ad54678b8..0951836470ce 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -1,7 +1,7 @@ # isc-dhcp packages ISC_DHCP_VERSION = 4.4.1 -ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-2.3 +ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-2.3+deb11u1 export ISC_DHCP_VERSION ISC_DHCP_VERSION_FULL From 063495e95306059b0f4961b90c0299163f9d28e1 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Sat, 7 Jan 2023 20:40:05 -0800 Subject: [PATCH 011/113] [submodule]: update sonic-swss-common head (#13295) 9e1176d Zain Budhwani Fri Jan 6 09:00:11 2023 -0800 Refactor eventpublisher deinit (sonic-net/sonic-swss-common#734) b9a9dbb Liu Shilong Thu Jan 5 10:12:49 2023 +0800 Simplify azure pipeline build template (sonic-net/sonic-swss-common#729) 01fc252 siqbal1986 Wed Jan 4 11:03:53 2023 -0800 Added customer monitoring tables in app db and state db (sonic-net/sonic-swss-common#725) 28dc42a Liu Shilong Wed Dec 28 11:19:32 2022 +0800 Fix sonic-slave docker image environment issue. (sonic-net/sonic-swss-common#727) 1d7607a Saikrishna Arcot Fri Dec 23 11:11:33 2022 -0800 Switch to using stock gcovr 5.2 (sonic-net/sonic-swss-common#726) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 70b36090eee5..9e1176d381db 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 70b36090eee5ffa771fbc1afd82476eccbbe96c3 +Subproject commit 9e1176d381db6084fbc2705559c3d49ebdd88e53 From 95c148d83ddd5782d2a5316671e420562867f6d0 Mon Sep 17 00:00:00 2001 From: Dmytro Lytvynenko Date: Sun, 8 Jan 2023 06:50:34 +0200 Subject: [PATCH 012/113] [platform-common] submodule update (#13269) 9df998bbec12083dd88104657d2fd8f67e217bc3 Don't read AUX_MON_TYPE if memory model is flat (#339) --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 676b329efd1b..9df998bbec12 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 676b329efd1b8cbe30b6e874308cd1ccf69466f8 +Subproject commit 9df998bbec12083dd88104657d2fd8f67e217bc3 From b195e476516cd0bd30ee026176ecd8c9cfa4a377 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 7 Jan 2023 21:07:20 -0800 Subject: [PATCH 013/113] [github]: update codeowner from Azure teams to sonic-net teams (#13243) Signed-off-by: Guohan Lu --- .github/CODEOWNERS | 87 +++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5a3aad7b8f69..f553a042f9a6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -19,9 +19,9 @@ /Makefile.work @qiluo-msft @xumia @lguohan /slave.mk @qiluo-msft @xumia @lguohan /scripts @qiluo-msft @xumia @lguohan -/src/sonic-build-hooks/ @Azure/sonic-build -/src/debootstrap/ @Azure/sonic-build -/src/sonic-fips/ @Azure/sonic-build +/src/sonic-build-hooks/ @sonic-net/sonic-build +/src/debootstrap/ @sonic-net/sonic-build +/src/sonic-fips/ @sonic-net/sonic-build # installer /installer/ @qiluo-msft @@ -35,76 +35,77 @@ /dockers/docker-snmp/ @qiluo-msft # kernel -/src/sonic-linux-kernel/ @Azure/sonic-kernel +/src/sonic-linux-kernel/ @sonic-net/sonic-kernel # devices -/device/ @Azure/sonic-platform -/src/sonic-platform-common/ @Azure/sonic-platform -/src/sonic-platform-daemons/ @Azure/sonic-platform -/src/sonic-platform-pde/ @Azure/sonic-platform -/src/lm-sensors/ @Azure/sonic-platform -/src/flashrom/ @Azure/sonic-platform +/device/ @sonic-net/sonic-platform +/src/sonic-platform-common/ @sonic-net/sonic-platform +/src/sonic-platform-daemons/ @sonic-net/sonic-platform +/src/sonic-platform-pde/ @sonic-net/sonic-platform +/src/lm-sensors/ @sonic-net/sonic-platform +/src/flashrom/ @sonic-net/sonic-platform # common library /src/initramfs-tools/ @qiluo-msft -/src/redis-dump-load/ @Azure/sonic-management -/src/sonic-py-common/ @Azure/sonic-management -/src/sonic-py-swsssdk/ @Azure/sonic-management -/src/sonic-swss-common/ @Azure/sonic-management -/src/bash/ @Azure/sonic-management -/src/tacacs/ @Azure/sonic-management -/src/radius/ @Azure/sonic-management -/src/swig/ @Azure/sonic-management -/src/socat/ @Azure/sonic-management +/src/redis-dump-load/ @sonic-net/sonic-management +/src/sonic-py-common/ @sonic-net/sonic-management +/src/sonic-py-swsssdk/ @sonic-net/sonic-management +/src/sonic-swss-common/ @sonic-net/sonic-management +/src/bash/ @sonic-net/sonic-management +/src/tacacs/ @sonic-net/sonic-management +/src/radius/ @sonic-net/sonic-management +/src/swig/ @sonic-net/sonic-management +/src/socat/ @sonic-net/sonic-management # redis -/src/redis/ @Azure/sonic-management -/src/hiredis/ @Azure/sonic-management +/src/redis/ @sonic-net/sonic-management +/src/hiredis/ @sonic-net/sonic-management # yang /src/sonic-yang-models/ @praveen-li @dgsudharsan @rathnasabapathyv @venkatmahalingam @qiluo-msft -/src/sonic-yang-mgmt/ @Azure/sonic-management -/src/libyang/ @Azure/sonic-management -/src/libyang1/ @Azure/sonic-management -/src/libyang2/ @Azure/sonic-management +/src/sonic-yang-mgmt/ @sonet-net/sonic-management +/src/libyang/ @sonic-net/sonic-management +/src/libyang1/ @sonic-net/sonic-management +/src/libyang2/ @sonic-net/sonic-management # bgpcfgd /src/sonic-bgpcfgd/ @StormLiangMS # sonic-config-engine -/src/sonic-config-engine/ @Azure/sonic-management +/src/sonic-config-engine/ @sonic-net/sonic-management # sonic-utilities -/src/sonic-utilities/ @Azure/sonic-management +/src/sonic-utilities/ @sonic-net/sonic-management # sonic-telemetry -/src/sonic-telemetry/ @Azure/sonic-management +/dockers/docker-sonic-telemetry @sonic-net/sonic-management +/src/sonic-telemetry/ @sonic-net/sonic-management # snmp -/src/sonic-snmpagent/ @Azure/sonic-management -/src/snmpd/ @Azure/sonic-management +/src/sonic-snmpagent/ @sonic-net/sonic-management +/src/snmpd/ @sonic-net/sonic-management # dhcp relay -/src/dhcp6relay/ @Azure/sonic-fundamentals -/src/dhcpmon/ @Azure/sonic-fundamentals -/src/isc-dhcp/ @Azure/sonic-fundamentals +/src/dhcp6relay/ @sonic-net/sonic-fundamentals +/src/dhcpmon/ @sonic-net/sonic-fundamentals +/src/isc-dhcp/ @sonic-net/sonic-fundamentals # sflow -/src/sflow/ @Azure/sonic-dataplane +/src/sflow/ @sonic-net/sonic-dataplane # sonic restapi -/src/sonic-restapi/ @Azure/sonic-dataplane +/src/sonic-restapi/ @sonic-net/sonic-dataplane # sonic swss -/src/sonic-swss/ @Azure/sonic-dataplane +/src/sonic-swss/ @sonic-net/sonic-dataplane # linux networking, e.g., libnl3, iproute2, ifupdown2, ethtool -/src/libnl3/ @Azure/sonic-dataplane -/src/iproute2/ @Azure/sonic-dataplane -/src/ifupdown2/ @Azure/sonic-dataplane -/src/ethtool/ @Azure/sonic-dataplane +/src/libnl3/ @sonic-net/sonic-dataplane +/src/iproute2/ @sonic-net/sonic-dataplane +/src/ifupdown2/ @sonic-net/sonic-dataplane +/src/ethtool/ @sonic-net/sonic-dataplane # ptf -/src/ptf/ @Azure/sonic-fundamentals -/src/ptf-py3/ @Azure/sonic-fundamentals -/src/scapy/ @Azure/sonic-fundamentals +/src/ptf/ @sonic-net/sonic-fundamentals +/src/ptf-py3/ @sonic-net/sonic-fundamentals +/src/scapy/ @sonic-net/sonic-fundamentals From 4b933bd56647cce808201c8f47350ef29cc5905f Mon Sep 17 00:00:00 2001 From: centecqianj <110279455+centecqianj@users.noreply.github.com> Date: Sun, 8 Jan 2023 13:10:03 +0800 Subject: [PATCH 014/113] [Centec arm64] Solve the abnormal console speed of centec-arm64 switch board (#13126) The console of the centec-arm64 board is ttyAMA0.The current regular expression cannot be correctly parsed. Signed-off-by: centecqianj --- files/image_config/platform/rc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 8692ff6484cd..15dec204eb4d 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -182,7 +182,7 @@ value_extract() { program_console_speed() { - speed=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+,[0-9]+' | cut -d "," -f2) + speed=$(cat /proc/cmdline | grep -Eo 'console=tty(S|AMA)[0-9]+,[0-9]+' | cut -d "," -f2) if [ -z "$speed" ]; then CONSOLE_SPEED=9600 else From 3c9837b484d3b01e5487936efa72548d2972a85e Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks <81281940+pettershao-ragilenetworks@users.noreply.github.com> Date: Sun, 8 Jan 2023 13:12:13 +0800 Subject: [PATCH 015/113] ]pmon]: Import requests libraries for Ragile platform (#13171) if there is no request, you need to use curl to get data from bmc, and each query needs to start a curl process. pmon is a circular query, which will pull up multiple processes in a loop, which consumes a lot. Using request does not need to pull up the process. --- dockers/docker-platform-monitor/Dockerfile.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 14fd2447793d..1c6b484814c7 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -41,6 +41,9 @@ RUN pip3 install grpcio==1.39.0 \ # Barefoot platform vendors' sonic_platform packages import these Python libraries RUN pip3 install thrift==0.13.0 netifaces +# Ragile platform vendors' sonic_platform packages import these Python libraries +RUN pip3 install requests + # We install the libpci module in order to be able to do PCI transactions RUN pip3 install libpci From 24758dfe0ae2303082ae01b652d12c7a9be8f417 Mon Sep 17 00:00:00 2001 From: Yutong Zhang <90831468+yutongzhang-microsoft@users.noreply.github.com> Date: Sun, 8 Jan 2023 18:10:17 -0800 Subject: [PATCH 016/113] Improve the display of pipeline. (#13123) The display of azure pipeline is not specific now, such as when the step Run test fails, the display of itself shows successful, but the display of step Kvmdump shows fails, but actually, the step Kvmdump doesn't fail. I improve the display of azure pipeline in this pr, each step has its own success or failure, and is shown in azure pipeline. Why I did it The display of azure pipeline is not specific now, such as when the step Run test fails, the display of itself shows successful, but the display of step Kvmdump shows fails, but actually, the step Kvmdump doesn't fail. I improve the display of azure pipeline in this pr, each step has its own success or failure, and is shown in azure pipeline. How I did it 1. Each step has its own signature of success or failure. 2. Using the chain of responsibility pattern to manage all status. 3. Modify the expected-state in each step. --- .azure-pipelines/run-test-scheduler-template.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/run-test-scheduler-template.yml b/.azure-pipelines/run-test-scheduler-template.yml index fc6b2d122052..ad5a1b1c6ef8 100644 --- a/.azure-pipelines/run-test-scheduler-template.yml +++ b/.azure-pipelines/run-test-scheduler-template.yml @@ -81,7 +81,7 @@ steps: echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to sonictestbedtools@microsoft.com" echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID" # When "LOCK_TESTBED" finish, it changes into "PREPARE_TESTBED" - python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-states PREPARE_TESTBED EXECUTING KVMDUMP FINISHED CANCELLED FAILED + python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state LOCK_TESTBED env: TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) displayName: Lock testbed @@ -94,7 +94,7 @@ steps: echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to sonictestbedtools@microsoft.com" echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID" # When "PREPARE_TESTBED" finish, it changes into "EXECUTING" - python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-states EXECUTING KVMDUMP FINISHED CANCELLED FAILED + python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state PREPARE_TESTBED env: TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) displayName: Prepare testbed @@ -105,7 +105,7 @@ steps: echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to sonictestbedtools@microsoft.com" echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID" # When "EXECUTING" finish, it changes into "KVMDUMP", "FAILED", "CANCELLED" or "FINISHED" - python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-states KVMDUMP FINISHED CANCELLED FAILED + python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state EXECUTING env: TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) displayName: Run test @@ -116,7 +116,7 @@ steps: echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to sonictestbedtools@microsoft.com" echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID" # When "KVMDUMP" finish, it changes into "FAILED", "CANCELLED" or "FINISHED" - python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-states FINISHED CANCELLED FAILED + python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state KVMDUMP condition: succeededOrFailed() env: TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) From a5d71576db27b6c699986e84a7167a23f80f1292 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Mon, 9 Jan 2023 13:27:15 +0800 Subject: [PATCH 017/113] [ci] Fix docker-sonic-slave pipeline template build options. (#13290) Why I did it docker-sonic-slave pipeline has a different tag with PR build. It leads to ENABLE_DOCKER_BASE_PUll=y not work. How I did it set reproducible build option in bash. How to verify it --- .azure-pipelines/docker-sonic-slave-template.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/docker-sonic-slave-template.yml b/.azure-pipelines/docker-sonic-slave-template.yml index 828f958e5ed2..063f75453114 100644 --- a/.azure-pipelines/docker-sonic-slave-template.yml +++ b/.azure-pipelines/docker-sonic-slave-template.yml @@ -53,7 +53,8 @@ jobs: containerRegistry: ${{ parameters.registry_conn }} - bash: | set -ex - image_tag=$(BLDENV=${{ parameters.dist }} make -f Makefile.work showtag PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} | grep sonic-slave | tail -n 1) + build_options="$(VERSION_CONTROL_OPTIONS)" + image_tag=$(BLDENV=${{ parameters.dist }} make -f Makefile.work showtag $build_options PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} | grep sonic-slave | tail -n 1) image_latest=$(echo $(echo $image_tag | awk -F: '{print$1}'):latest) if echo ${{ parameters.pool }} | grep ${{ parameters.arch }};then image_latest=$(echo ${image_latest} | sed 's/:/-${{ parameters.arch }}:/') @@ -65,7 +66,7 @@ jobs: exit 0 fi - DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker BLDENV=${{ parameters.dist }} make -f Makefile.work configure PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} $args || docker image ls $image_tag + DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker BLDENV=${{ parameters.dist }} make -f Makefile.work configure $build_options PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} $args || docker image ls $image_tag if [[ "$(Build.Reason)" == "PullRequest" ]];then exit 0 fi From ce88a38185b72c5a5d52cd58e30b141ec592dcc7 Mon Sep 17 00:00:00 2001 From: Hua Liu <58683130+liuh-80@users.noreply.github.com> Date: Tue, 10 Jan 2023 03:37:43 +0800 Subject: [PATCH 018/113] Fix code issue when SonicV2Connector.get() return None. (#13250) Fix code issue when SonicV2Connector.get() return None. #### Why I did it When database key does not exist, SonicV2Connector.get() will return None. Code will break if not check return value. #### How I did it Check SonicV2Connector.get() return value before use it. #### How to verify it Pass all E2E test case. --- .../plugins/led_control.py | 8 +++++++- .../plugins/led_control.py | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py index 7ce532554f95..cd1f77a2778b 100644 --- a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py @@ -187,9 +187,15 @@ def _port_name_to_qsfp_index(self, port_name): lanes = swss.get( swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') + # SonicV2Connector.get() will return None when key does not exist. + if lanes: + lanes_len = len(lanes.split(',')) + else: + lanes_len = 0 + # SONiC port nums are 0-based and increment by 4 # Arista QSFP indices are 1-based and increment by 1 - return (((sonic_port_num/4) + 1), sonic_port_num % 4, len(lanes.split(','))) + return (((sonic_port_num/4) + 1), sonic_port_num % 4, lanes_len) # Concrete implementation of port_link_state_change() method diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py index e7c8d3bc1e2d..67d381d97315 100644 --- a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py @@ -154,9 +154,16 @@ def _port_name_to_qsfp_index(self, port_name): lanes = swss.get( swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') + # SonicV2Connector.get() will return None when key does not exist. + if lanes: + lanes_len = len(lanes.split(',')) + else: + lanes_len = 0 + + # SONiC port nums are 0-based and increment by 4 # Arista QSFP indices are 1-based and increment by 1 - return (((sonic_port_num/4) + 1), sonic_port_num % 4, len(lanes.split(','))) + return (((sonic_port_num/4) + 1), sonic_port_num % 4, lanes_len) # Concrete implementation of port_link_state_change() method From bc7b35473edee1681293bc09c4b4f62add134721 Mon Sep 17 00:00:00 2001 From: lixiaoyuner <35456895+lixiaoyuner@users.noreply.github.com> Date: Tue, 10 Jan 2023 23:56:44 +0800 Subject: [PATCH 019/113] Add k8s support feature set and Add platform label for scheduler usage (#12997) Why I did it We plan to pilot k8s feature, need to fix several bugs including enable telemetry feature and add platform label. How I did it Add support feature set, only enable telemetry container upgrade for now Add platform label for scheduler usage Remove CNI installation code, it would be auto installed when install kubeadm How to verify it After sonic device join k8s cluster, show node labels to check if platform label is visible. Signed-off-by: Yun Li yunli1@microsoft.com --- Makefile.work | 1 - build_debian.sh | 1 - rules/config | 3 +-- src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py | 6 ++++++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile.work b/Makefile.work index 6f57130b6ab9..11f9e50b4f4d 100644 --- a/Makefile.work +++ b/Makefile.work @@ -485,7 +485,6 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ INCLUDE_KUBERNETES=$(INCLUDE_KUBERNETES) \ KUBERNETES_VERSION=$(KUBERNETES_VERSION) \ - KUBERNETES_CNI_VERSION=$(KUBERNETES_CNI_VERSION) \ K8s_GCR_IO_PAUSE_VERSION=$(K8s_GCR_IO_PAUSE_VERSION) \ INCLUDE_KUBERNETES_MASTER=$(INCLUDE_KUBERNETES_MASTER) \ SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ diff --git a/build_debian.sh b/build_debian.sh index 8a4817c166d6..7c83d28b5103 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -283,7 +283,6 @@ then ## Install Kubernetes echo '[INFO] Install kubernetes' install_kubernetes ${KUBERNETES_VERSION} - sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubernetes-cni=${KUBERNETES_CNI_VERSION} else echo '[INFO] Skipping Install kubernetes' fi diff --git a/rules/config b/rules/config index c72c572ab6fb..d37699433dcf 100644 --- a/rules/config +++ b/rules/config @@ -175,7 +175,7 @@ INCLUDE_ROUTER_ADVERTISER ?= y # INCLUDE_KUBERNETES - if set to y kubernetes packages are installed to be able to # run as worker node in kubernetes cluster. -INCLUDE_KUBERNETES = n +INCLUDE_KUBERNETES ?= n KUBE_DOCKER_PROXY = http://172.16.1.1:3128/ @@ -185,7 +185,6 @@ KUBE_DOCKER_PROXY = http://172.16.1.1:3128/ # NOTE: As a worker node it has to run version compatible to kubernetes master. # KUBERNETES_VERSION = 1.22.2-00 -KUBERNETES_CNI_VERSION = 0.8.7-00 K8s_GCR_IO_PAUSE_VERSION = 3.5 # INCLUDE_KUBERNETES_MASTER - if set to y kubernetes packages are installed o be able diff --git a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py index b6e9249fcb11..84c23f9f0eba 100755 --- a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py +++ b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py @@ -99,6 +99,8 @@ USE_K8S_PROXY: "" } +ENABLED_FEATURE_SET = {"telemetry", "snmp"} + def log_debug(m): msg = "{}: {}".format(inspect.stack()[1][3], m) syslog.syslog(syslog.LOG_DEBUG, msg) @@ -260,6 +262,8 @@ def run(self): key, op, fvs = subscriber.pop() if not key: continue + if subscriber.getTableName() == FEATURE_TABLE and key not in ENABLED_FEATURE_SET: + continue log_debug("Received message : '%s'" % str((key, op, fvs))) for callback in (self.callbacks [subscriber.getDbConnector().getDbName()] @@ -280,6 +284,8 @@ def set_node_labels(server): labels["sonic_version"] = version_info['build_version'] labels["hwsku"] = device_info.get_hwsku() if not UNIT_TESTING else "mock" labels["deployment_type"] = dep_type + platform = device_info.get_platform() + labels["worker.sonic/platform"] = platform if platform is not None else "" server.mod_db_entry(STATE_DB_NAME, KUBE_LABEL_TABLE, KUBE_LABEL_SET_KEY, labels) From 5c8aa8f5dea14b4399acbac829626e5abd99bbf2 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Tue, 10 Jan 2023 15:47:22 -0800 Subject: [PATCH 020/113] Update sonic-host-services submodule (#13307) This is primarily to fix the armhf build failure due to deepdiff python module getting updated. 1eb7a5b Pin deepdiff to version 6.2.2 ae09e3f [caclmgrd][dualtor] add iptables rule for dualtor gRPC to allow packets getting forwarded from loopback IP 00cb8cb [hostcfgd] Optimize the hostcfgs by moving the definition cmds into the loop to optimize the enable/disable service command run. Signed-off-by: Saikrishna Arcot Signed-off-by: Saikrishna Arcot --- src/sonic-host-services | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-host-services b/src/sonic-host-services index 4a2ef99630ee..121330a287d1 160000 --- a/src/sonic-host-services +++ b/src/sonic-host-services @@ -1 +1 @@ -Subproject commit 4a2ef99630ee02e104643bf356cafd6a1228b882 +Subproject commit 121330a287d139439ef4a539b84822292e3a654d From d7b2bdb996917166e1e0f6f48dc22f97fff28abe Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Wed, 11 Jan 2023 09:34:53 +0200 Subject: [PATCH 021/113] [submodule] Advance sonic-swss-common pointer (#13321) Update sonic-swss-common submodule pointer to include the following: a4987b9 Change the dtor of ProducerStateTable to virtual method (#735) 7be565c [hash]: Add GH DB schema. (#733) Signed-off-by: Nazarii Hnydyn --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 9e1176d381db..a4987b931b24 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 9e1176d381db6084fbc2705559c3d49ebdd88e53 +Subproject commit a4987b931b246c141dff91fa2f0e971dbc41820e From 20f47bb5ac66cfc775c73c697f3e9d70fcab73f8 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Wed, 11 Jan 2023 16:00:47 +0800 Subject: [PATCH 022/113] Update docker-sonic-mgmt to buster (#13287) Why I did it docker-sonic-mgmt build is failing. How I did it stretch docker is disabled recently. Update docker-sonic-mgmt to buster. Migrate from sonictest to sonicbld. Because Azure requires migrate vm from uswest2 to uswest3. Fix a build issue when build image. How to verify it --- .azure-pipelines/docker-sonic-mgmt.yml | 9 +++++---- rules/docker-sonic-mgmt.mk | 1 - src/sonic-build-hooks/scripts/buildinfo_base.sh | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/docker-sonic-mgmt.yml b/.azure-pipelines/docker-sonic-mgmt.yml index 35d12f12234d..34adf9d5d48c 100644 --- a/.azure-pipelines/docker-sonic-mgmt.yml +++ b/.azure-pipelines/docker-sonic-mgmt.yml @@ -32,17 +32,18 @@ stages: - stage: Build jobs: - job: Build - pool: sonictest + pool: sonicbld timeoutInMinutes: 360 steps: - template: cleanup.yml - checkout: self clean: true - submodules: recursive - bash: | set -xe - make configure PLATFORM=generic - make target/docker-sonic-mgmt.gz + git submodule update --init --recursive -- src/sonic-platform-daemons src/sonic-genl-packet src/sonic-sairedis src/ptf src/sonic-device-data + + make SONIC_BUILD_JOBS=$(nproc) DEFAULT_CONTAINER_REGISTRY=publicmirror.azurecr.io ENABLE_DOCKER_BASE_PULL=y configure PLATFORM=generic + make SONIC_BUILD_JOBS=$(nproc) DEFAULT_CONTAINER_REGISTRY=publicmirror.azurecr.io ENABLE_DOCKER_BASE_PULL=y target/docker-sonic-mgmt.gz cp target -r $(Build.ArtifactStagingDirectory)/target docker load -i target/docker-sonic-mgmt.gz docker tag docker-sonic-mgmt $REGISTRY_SERVER/docker-sonic-mgmt:latest diff --git a/rules/docker-sonic-mgmt.mk b/rules/docker-sonic-mgmt.mk index 8d6901755f8a..b1aaad348734 100644 --- a/rules/docker-sonic-mgmt.mk +++ b/rules/docker-sonic-mgmt.mk @@ -3,4 +3,3 @@ DOCKER_SONIC_MGMT = docker-sonic-mgmt.gz $(DOCKER_SONIC_MGMT)_PATH = $(DOCKERS_PATH)/docker-sonic-mgmt $(DOCKER_SONIC_MGMT)_DEPENDS += $(SONIC_DEVICE_DATA) $(PTF) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_MGMT) -SONIC_STRETCH_DOCKERS += $(DOCKER_SONIC_MGMT) diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index 52e5194f9cf6..38d2e8881588 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -21,6 +21,7 @@ else PKG_CACHE_PATH=/sonic/target/vcache/${IMAGENAME} fi PKG_CACHE_FILE_NAME=${PKG_CACHE_PATH}/cache.tgz +sudo chown $USER $(dirname $PKG_CACHE_PATH) mkdir -p ${PKG_CACHE_PATH} . ${BUILDINFO_PATH}/scripts/utils.sh From 7873a9131da5467a861f39cc56ac95c2264898fe Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Wed, 11 Jan 2023 22:50:46 +0800 Subject: [PATCH 023/113] [Mellanox] Skip the leftover hardware reboot cause in case of last boot is warm/fast reboot (#13246) - Why I did it In case of warm/fast reboot, the hardware reboot cause will NOT be cleared because CPLD will not be touched in this flow. To not confuse the reboot cause determine logic, the leftover hardware reboot cause shall be skipped by the platform API, platform API will return the 'REBOOT_CAUSE_NON_HARDWARE' instead of the "hardware" reboot cause. - How I did it Check the proc cmdline to see whether the last reboot is a warm or fast reboot, if yes skip checking the leftover hardware reboot cause. - How to verify it a. Manual test: - Perform a power loss - Perform a warm/fast reboot - Check the reboot cause should be "warm-reboot" or "fast-reboot" instead of "power loss" b. Run reboot cause related regression test. Signed-off-by: Kebo Liu --- .../sonic_platform/chassis.py | 25 ++++++++++++++++ .../mlnx-platform-api/tests/test_chassis.py | 29 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 96a7b9e2315a..e13b90d6c0ca 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -30,6 +30,7 @@ from .utils import extract_RJ45_ports_index from . import utils from .device_data import DeviceDataManager + import re except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -61,6 +62,10 @@ REBOOT_CAUSE_FILE_LENGTH = 1 +REBOOT_TYPE_KEXEC_FILE = "/proc/cmdline" +REBOOT_TYPE_KEXEC_PATTERN_WARM = ".*SONIC_BOOT_TYPE=(warm|fastfast).*" +REBOOT_TYPE_KEXEC_PATTERN_FAST = ".*SONIC_BOOT_TYPE=(fast|fast-reboot).*" + # Global logger class instance logger = Logger() @@ -736,6 +741,18 @@ def initialize_reboot_cause(self): self.reboot_by_software = 'reset_sw_reset' self.reboot_cause_initialized = True + def _parse_warmfast_reboot_from_proc_cmdline(self): + if os.path.isfile(REBOOT_TYPE_KEXEC_FILE): + with open(REBOOT_TYPE_KEXEC_FILE) as cause_file: + cause_file_kexec = cause_file.readline() + m = re.search(REBOOT_TYPE_KEXEC_PATTERN_WARM, cause_file_kexec) + if m and m.group(1): + return 'warm-reboot' + m = re.search(REBOOT_TYPE_KEXEC_PATTERN_FAST, cause_file_kexec) + if m and m.group(1): + return 'fast-reboot' + return None + def get_reboot_cause(self): """ Retrieves the cause of the previous reboot @@ -748,6 +765,14 @@ def get_reboot_cause(self): to pass a description of the reboot cause. """ #read reboot causes files in the following order + + # To avoid the leftover hardware reboot cause confusing the reboot cause determine service + # Skip the hardware reboot cause check if warm/fast reboot cause found from cmdline + if utils.is_host(): + reboot_cause = self._parse_warmfast_reboot_from_proc_cmdline() + if reboot_cause: + return self.REBOOT_CAUSE_NON_HARDWARE, '' + if not self.reboot_cause_initialized: self.initialize_reboot_cause() diff --git a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py index 2aa4f78855f3..cffdd437695f 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py @@ -224,6 +224,35 @@ def read_int_from_file(file_path, *args, **kwargs): assert minor == value mock_file_content[file_path] = 0 + utils.is_host = mock.MagicMock(return_value=True) + chassis._parse_warmfast_reboot_from_proc_cmdline = mock.MagicMock(return_value='warm-reboot') + for key, value in chassis.reboot_major_cause_dict.items(): + file_path = os.path.join(REBOOT_CAUSE_ROOT, key) + mock_file_content[file_path] = 1 + major, minor = chassis.get_reboot_cause() + assert major == chassis.REBOOT_CAUSE_NON_HARDWARE + assert minor == '' + mock_file_content[file_path] = 0 + + for key, value in chassis.reboot_minor_cause_dict.items(): + file_path = os.path.join(REBOOT_CAUSE_ROOT, key) + mock_file_content[file_path] = 1 + major, minor = chassis.get_reboot_cause() + assert major == chassis.REBOOT_CAUSE_NON_HARDWARE + assert minor == value + mock_file_content[file_path] = 0 + + def test_parse_warmfast_reboot_from_proc_cmdline(self): + chassis = Chassis() + with mock.patch("builtins.open", mock.mock_open(read_data="SONIC_BOOT_TYPE=warm")): + assert chassis._parse_warmfast_reboot_from_proc_cmdline() == "warm-reboot" + + with mock.patch("builtins.open", mock.mock_open(read_data="SONIC_BOOT_TYPE=fast")): + assert chassis._parse_warmfast_reboot_from_proc_cmdline() == "fast-reboot" + + with mock.patch("builtins.open", mock.mock_open(read_data="SONIC_BOOT_TYPE=None")): + assert chassis._parse_warmfast_reboot_from_proc_cmdline() == None + def test_module(self): from sonic_platform.chassis import ModularChassis # Test get_num_modules, it should not create any SFP objects From e6a01ca5eb2bbbbe6ae6303e55ccc8a9c9b1f2c2 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Thu, 12 Jan 2023 00:54:24 +0800 Subject: [PATCH 024/113] [Bug] Fix SONiC installation failure caused by pip/pip3 not found (#13284) The main issue is the pip/pip3 command cannot be found when the package is being installed by apt-get. When using the dpkg install, the searching path is PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin When using the apt-get install, the searching path is PATH=/usr/sbin:/usr/bin:/sbin:/bin But the pip/pip3 default path is at /usr/local/bin, so dpkg works, but apt-get not work. How I did it Export the path /usr/local/bin for pip/pip3. Make the deb packages can be installed by apt-get. --- files/image_config/platform/rc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 15dec204eb4d..c21a5151aa85 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -289,7 +289,7 @@ if [ -f $FIRST_BOOT_FILE ]; then mv /etc/apt/sources.list /etc/apt/sources.list.rc-local echo "deb [trusted=yes] file:///host/image-$SONIC_VERSION/platform/common /" > /etc/apt/sources.list.d/sonic_debian_extension.list LANG=C DEBIAN_FRONTEND=noninteractive apt-get update - LANG=C DEBIAN_FRONTEND=noninteractive apt-get -y install /host/image-$SONIC_VERSION/platform/$platform/*.deb + LANG=C DEBIAN_FRONTEND=noninteractive apt-get -o DPkg::Path=$PATH:/usr/local/bin -y install /host/image-$SONIC_VERSION/platform/$platform/*.deb # Cleanup rm -f /etc/apt/sources.list.d/sonic_debian_extension.list rm -f /var/lib/apt/lists/_host_image-${SONIC_VERSION}_platform_common_Packages.lz4 From 21e507e22be2b70ea99a1f3f328b52a1715e73f1 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Wed, 11 Jan 2023 11:24:47 -0800 Subject: [PATCH 025/113] [Dash] Fix a typo (#13325) Fix a typo in yang for Dash --- src/sonic-yang-models/yang-models/sonic-dash.yang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-yang-models/yang-models/sonic-dash.yang b/src/sonic-yang-models/yang-models/sonic-dash.yang index dc84bf8d503d..f3c431d0781b 100644 --- a/src/sonic-yang-models/yang-models/sonic-dash.yang +++ b/src/sonic-yang-models/yang-models/sonic-dash.yang @@ -385,7 +385,7 @@ module sonic-dash { } leaf vnet { - when "((current()/../action_type = 'vnet') or (current()/../action_type = 'vnet-direct'))"; + when "((current()/../action_type = 'vnet') or (current()/../action_type = 'vnet_direct'))"; type leafref { path /dash:sonic-dash/dash:DASH_VNET/dash:DASH_VNET_LIST/dash:name; } @@ -399,8 +399,8 @@ module sonic-dash { } leaf overlay_ip { - when "((current()/../action_type = 'vnet') or (current()/../action_type = 'vnet-direct'))"; - description "Overlay IP to use for mapping lookup, if routing_type is vnet-direct"; + when "((current()/../action_type = 'vnet') or (current()/../action_type = 'vnet_direct'))"; + description "Overlay IP to use for mapping lookup, if routing_type is vnet_direct"; type inet:ip-address; } From 97161aeadb4b70a0b912c178694a88834430dcba Mon Sep 17 00:00:00 2001 From: shdasari <53248666+shdasari@users.noreply.github.com> Date: Thu, 12 Jan 2023 06:12:24 +0530 Subject: [PATCH 026/113] SONiC YANG model for RADIUS. (#12749) #### Why I did it Added SONiC YANG model for RADIUS. Fixes https://github.com/sonic-net/sonic-buildimage/issues/12477 #### How I did it Added the RADIUS and RADIUS_SERVER tables for global and per RADIUS server configuration. RADIUS statistics reside in COUNTERS_DB and are not part of the configuration. These are not a part of this PR. #### How to verify it Compiled sonic_yang_mgmt-1.0-py3-none-any.whl. #### Description for the changelog SONiC YANG model for RADIUS. --- src/sonic-yang-models/doc/Configuration.md | 23 ++ src/sonic-yang-models/setup.py | 1 + .../tests/files/sample_config_db.json | 13 ++ .../tests/yang_model_tests/tests/radius.json | 36 +++ .../yang_model_tests/tests_config/radius.json | 139 +++++++++++ .../yang-models/sonic-system-radius.yang | 215 ++++++++++++++++++ 6 files changed, 427 insertions(+) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/radius.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/radius.json create mode 100644 src/sonic-yang-models/yang-models/sonic-system-radius.yang diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index b56b9a2fbcd0..1c25f66a61c2 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -65,6 +65,7 @@ Table of Contents * [WRED_PROFILE](#wred_profile) * [PASSWORD_HARDENING](#password_hardening) * [SYSTEM_DEFAULTS table](#systemdefaults-table) + * [RADIUS](#radius) * [For Developers](#for-developers) * [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template) * [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb) @@ -1969,6 +1970,28 @@ The default value of flags in `SYSTEM_DEFAULTS` table can be set in `init_cfg.js If the values in `config_db.json` is changed by user, it will not be rewritten back by `init_cfg.json` as `config_db.json` is loaded after `init_cfg.json` in [docker_image_ctl.j2](https://github.com/Azure/sonic-buildimage/blob/master/files/build_templates/docker_image_ctl.j2) For the flags that can be changed by reconfiguration, we can update entries in `minigraph.xml`, and parse the new values in to config_db with minigraph parser at reloading minigraph. If there are duplicated entries in `init_cfg.json` and `minigraph.xml`, the values in `minigraph.xml` will overwritten the values defined in `init_cfg.json`. + +### RADIUS + +The RADIUS and RADIUS_SERVER tables define RADIUS configuration parameters. RADIUS table carries global configuration while RADIUS_SERVER table carries per server configuration. + +``` + "RADIUS": { + "global": { + "auth_type": "pap", + "timeout": "5" + } + } + + "RADIUS_SERVER": { + "192.168.1.2": { + "priority": "4", + "retransmit": "2", + "timeout": "5" + } + } +``` + #### 5.2.3 Update value directly in db memory For Developers diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 46e48aae8203..783dfb8be1a1 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -145,6 +145,7 @@ def run(self): './yang-models/sonic-syslog.yang', './yang-models/sonic-system-aaa.yang', './yang-models/sonic-system-tacacs.yang', + './yang-models/sonic-system-radius.yang', './yang-models/sonic-telemetry.yang', './yang-models/sonic-tunnel.yang', './yang-models/sonic-types.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 63e15f052366..2d1f672542c7 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1349,6 +1349,19 @@ "timeout": "10" } }, + "RADIUS": { + "global": { + "auth_type": "pap", + "timeout": "5" + } + }, + "RADIUS_SERVER": { + "192.168.1.2": { + "priority": "4", + "retransmit": "2", + "timeout": "5" + } + }, "NAT_BINDINGS": { "bind1": { "nat_pool": "pool1", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/radius.json b/src/sonic-yang-models/tests/yang_model_tests/tests/radius.json new file mode 100644 index 000000000000..c7e68740881f --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/radius.json @@ -0,0 +1,36 @@ +{ + "RADIUS_TEST": { + "desc": "RADIUS global configuration in the RADIUS table." + }, + "RADIUS_INVALID_SRC_IP_TEST": { + "desc": "Radius global configuration with invalid Src IP value in RADIUS table.", + "eStr": "InvalidValue" + }, + "RADIUS_INVALID_TIMEOUT_TEST": { + "desc": "Radius global configuration with invalid timeout in RADIUS table.", + "eStr": "RADIUS timeout must be 1..60." + }, + "RADIUS_SERVER_TEST" : { + "desc": "Radius server configuration in RADIUS_SERVER table." + }, + "RADIUS_SERVER_INVALID_PRIORITY_TEST": { + "desc": "Radius server configuration with invalid priority value in RADIUS_SERVER table.", + "eStr": "RADIUS priority must be 1..64." + }, + "RADIUS_SERVER_INVALID_TIMEOUT_TEST" : { + "desc": "Radius server configuration with invalid timeout value in RADIUS_SERVER table.", + "eStr": "RADIUS timeout must be 1..60." + }, + "RADIUS_SERVER_INVALID_RETRANSMIT_TEST" : { + "desc": "Radius server configuration with invalid retransmit value in RADIUS_SERVER table.", + "eStr": "RADIUS retransmit must be 0..10." + }, + "RADIUS_SERVER_INVALID_AUTH_TYPE_TEST" : { + "desc": "Radius server configuration with invalid auth type in RADIUS_SERVER table.", + "eStrKey": "InvalidValue" + }, + "RADIUS_SERVER_INVALID_VRF_TEST" : { + "desc": "Radius server configuration with invalid VRF in RADIUS_SERVER table.", + "eStr": "Invalid VRF name" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/radius.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/radius.json new file mode 100644 index 000000000000..3f58635ef753 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/radius.json @@ -0,0 +1,139 @@ +{ + "RADIUS_TEST": { + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS": { + "global": { + "auth_type": "chap", + "timeout": 5, + "passkey": "brcm123" + } + } + } + }, + + "RADIUS_INVALID_SRC_IP_TEST": { + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS": { + "global": { + "auth_type": "chap", + "src_ip": "INVALID" + } + } + } + }, + + "RADIUS_INVALID_TIMEOUT_TEST": { + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS": { + "global": { + "auth_type": "chap", + "timeout": 70 + } + } + } + }, + + "RADIUS_SERVER_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS_SERVER": { + "RADIUS_SERVER_LIST": [ + { + "ipaddress": "192.168.1.1", + "priority": 5, + "timeout": 6, + "auth_type": "chap", + "passkey": "brcm123", + "src_intf": "Ethernet0", + "vrf": "default" + }, + { + "ipaddress": "10.10.10.10", + "priority": 2, + "timeout": 15, + "auth_type": "pap", + "passkey": "sonic_123", + "vrf": "mgmt" + } + ] + } + } + }, + + "RADIUS_SERVER_INVALID_PRIORITY_TEST": { + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS_SERVER": { + "RADIUS_SERVER_LIST": [ + { + "ipaddress": "192.168.1.1", + "priority": 70 + } + ] + } + } + }, + "RADIUS_SERVER_INVALID_TIMEOUT_TEST": { + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS_SERVER": { + "RADIUS_SERVER_LIST": [ + { + "ipaddress": "192.168.1.1", + "timeout": 70 + } + ] + } + } + }, + "RADIUS_SERVER_INVALID_RETRANSMIT_TEST": { + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS_SERVER": { + "RADIUS_SERVER_LIST": [ + { + "ipaddress": "192.168.1.1", + "retransmit": 20 + } + ] + } + } + }, + "RADIUS_SERVER_INVALID_AUTH_TYPE_TEST": { + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS_SERVER": { + "RADIUS_SERVER_LIST": [ + { + "ipaddress": "192.168.1.1", + "auth_type": "123" + } + ] + } + } + }, + "RADIUS_SERVER_INVALID_VRF_TEST": { + "sonic-system-radius:sonic-system-radius": { + "sonic-system-radius:RADIUS_SERVER": { + "RADIUS_SERVER_LIST": [ + { + "ipaddress": "192.168.1.1", + "vrf": "Vrf1" + } + ] + } + } + } + +} diff --git a/src/sonic-yang-models/yang-models/sonic-system-radius.yang b/src/sonic-yang-models/yang-models/sonic-system-radius.yang new file mode 100644 index 000000000000..2bf92f206c6c --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-system-radius.yang @@ -0,0 +1,215 @@ +module sonic-system-radius { + namespace "http://github.com/sonic-net/sonic-system-radius"; + prefix ssys; + yang-version 1.1; + + import ietf-inet-types { + prefix inet; + } + + import sonic-port { + prefix port; + } + + import sonic-portchannel { + prefix lag; + } + +// Comment sonic-vlan import here until libyang back-links issue is resolved for VLAN leaf reference. +// import sonic-vlan { +// prefix vlan; +// } + + import sonic-loopback-interface { + prefix loopback; + } + + import sonic-mgmt_port { + prefix mgmt-port; + } + + import sonic-interface { + prefix interface; + } + + description + "SONiC RADIUS"; + + revision 2022-11-11 { + description "Initial revision."; + } + + typedef auth_type_enumeration { + type enumeration { + enum pap; + enum chap; + enum mschapv2; + } + } + + + container sonic-system-radius { + + container RADIUS { + + container global { + + + leaf passkey { + type string { + length "1..65"; + pattern "[^ #,]*" { + error-message 'RADIUS shared secret (Valid chars are ASCII printable except SPACE, "#", and ",")'; + } + } + description + 'RADIUS global shared secret (Valid chars are ASCII printable except SPACE, "#", and ",")'; + } + + leaf auth_type { + default "pap"; + type auth_type_enumeration; + description + "RADIUS global method used for authenticating the comm. mesg."; + } + + leaf src_ip { + type inet:ip-address; + description + "source IP address (IPv4 or IPv6) for the outgoing RADIUS pkts."; + } + + leaf nas_ip { + type inet:ip-address; + description + "NAS-IP|IPV6-Address attribute for the outgoing RADIUS pkts."; + } + + leaf statistics { + type boolean; + description + "Should statistics collection be enabled/disabled"; + } + + leaf timeout { + default 5; + type uint16 { + range "1..60" { + error-message "RADIUS timeout must be 1..60"; + } + } + } + + leaf retransmit { + default 3; + type uint8 { + range "0..10" { + error-message "RADIUS retransmit must be 0..10"; + } + } + } + } + } + + container RADIUS_SERVER { + + list RADIUS_SERVER_LIST { + key "ipaddress"; + + max-elements 8; + + leaf ipaddress { + type inet:host; + description + "RADIUS server's Domain name or IP address (IPv4 or IPv6)"; + } + + leaf auth_port { + default 1812; + type inet:port-number; + description + "RADIUS authentication port number."; + } + + leaf passkey { + type string { + length "1..65"; + pattern "[^ #,]*" { + error-message 'RADIUS shared secret (Valid chars are ASCII printable except SPACE, "#", and ",")'; + } + } + description + 'RADIUS servers shared secret (Valid chars are ASCII printable except SPACE, "#", and ",")'; + } + + leaf auth_type { + default "pap"; + type auth_type_enumeration; + description + "RADIUS server's method used for authenticating the comm. mesg."; + } + + leaf priority { + type uint8 { + range "1..64" { + error-message "RADIUS priority must be 1..64"; + } + } + description + "RADIUS server's priority"; + } + + leaf timeout { + default 5; + type uint16 { + range "1..60" { + error-message "RADIUS timeout must be 1..60"; + } + } + } + + leaf retransmit { + default 3; + type uint8 { + range "0..10" { + error-message "RADIUS retransmit must be 0..10"; + } + } + } + + leaf vrf { + type string { + pattern "mgmt|default" { + error-message "Error: Invalid VRF name"; + } + } + description + "VRF name"; + + } + + leaf src_intf { + type union { + type leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + type leafref { + path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name"; + } + type string { + pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])'; + } + + type leafref { + path "/loopback:sonic-loopback-interface/loopback:LOOPBACK_INTERFACE/loopback:LOOPBACK_INTERFACE_LIST/loopback:name"; + } + type leafref { + path "/mgmt-port:sonic-mgmt_port/mgmt-port:MGMT_PORT/mgmt-port:MGMT_PORT_LIST/mgmt-port:name"; + } + } + description "Source interface to use for RADIUS server communication."; + } + } + } + } +} From d9c75b3fa28e2266f92d5a07a0bd7f9360ca8b3c Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Thu, 12 Jan 2023 10:46:34 +0200 Subject: [PATCH 027/113] [submodule] Advance sonic-utilities pointer (#13333) Update sonic-utilities submodule pointer to include the following: * fb8f98b Preserve copp tables through DB migration ([#2524](https://github.com/sonic-net/sonic-utilities/pull/2524)) * 4aa512c [sfputil] Firmware download/upgrade CLI support for QSFP-DD (#1947) ([#2349](https://github.com/sonic-net/sonic-utilities/pull/2349)) * f63ef9a Revert sonic-utilities: Update config reload() to verify formatting of an input file (#2529) ([#2586](https://github.com/sonic-net/sonic-utilities/pull/2586)) * 3a09ecb [masic] 'show interfaces counters' reminds to use '-d all' option to check for internal links ([#2466](https://github.com/sonic-net/sonic-utilities/pull/2466)) * 65cf00a [storyteller] add link prober state change to story teller ([#2585](https://github.com/sonic-net/sonic-utilities/pull/2585)) Signed-off-by: dprital --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index b34a540cca55..fb8f98bfa672 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b34a540cca5555ab3aa74e19e81f24c2a20d311b +Subproject commit fb8f98bfa672a80f56398d57a470a02d031d3da3 From bce4aa1412833da8cd9a948449098bda3d8c0384 Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks <81281940+pettershao-ragilenetworks@users.noreply.github.com> Date: Fri, 13 Jan 2023 10:01:47 +0800 Subject: [PATCH 028/113] [ragile] adapter for kernel 5.x (#10762) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why I did it Ragile adapter ra-b6510-32c ra-b6510-48v8c ra-b6910-64c ra-b6920-4s to kernel 5.x Signed-off-by: “pettershao” pettershao@ragilenetworks.com --- .../minigraph.xml | 63 -- .../pddf/pddf-device.json | 74 +- .../RA-B6510-48V8C/sai.profile | 2 +- ...3-ra-b6510-48v8c-48x25G+8x100G.config.bcm} | 287 ++----- .../pddf/pddf-device.json | 604 +++++++++----- .../plugins/eeprom.py | 25 + .../plugins/fanutil.py | 187 +++++ .../plugins/ledutil.py | 59 ++ .../plugins/psuutil.py | 270 +++++++ .../plugins/sfputil.py | 236 ++++++ .../plugins/sysstatutil.py | 82 ++ .../plugins/thermalutil.py | 75 ++ .../pmon_daemon_control.json | 6 +- .../minigraph.xml | 63 -- .../pddf/pddf-device.json | 134 +++- .../plugins/fanutil.py | 2 +- .../pmon_daemon_control.json | 6 +- .../minigraph.xml | 63 -- platform/broadcom/platform-modules-ragile.mk | 2 +- platform/broadcom/rules.mk | 2 +- .../common/modules/csu550.c | 47 +- .../common/modules/fpga_i2c_ocores.c | 11 +- .../common/modules/fpga_pcie_i2c.c | 6 +- .../common/modules/i2c-mux-pca954x.c | 323 +++++++- .../common/modules/i2c-mux-pca9641.c | 16 +- .../common/modules/lpc_cpld_i2c_ocores.c | 10 +- .../common/modules/pmbus.h | 58 +- .../common/modules/ragile_common_module.c | 3 - .../common/script/device_i2c.py | 21 +- ...atform-modules-ragile-ra-b6910-64c.install | 1 + ...tform-modules-ragile-ra-b6910-64c.postinst | 17 + .../debian/rules | 4 +- .../ra-b6510-32c/Makefile | 3 + .../modules/driver/pddf_custom_led_module.c | 53 +- .../ra-b6510-32c/sonic_platform/api.py | 203 +++++ .../ra-b6510-32c/sonic_platform/chassis.py | 120 +-- .../ra-b6510-32c/sonic_platform/component.py | 72 +- .../ra-b6510-32c/sonic_platform/fan.py | 2 + .../ra-b6510-32c/sonic_platform/fan_drawer.py | 70 +- .../ra-b6510-32c/sonic_platform/hwaccess.py | 47 ++ .../ra-b6510-32c/sonic_platform/psu.py | 72 ++ .../ra-b6510-32c/sonic_platform/sfp.py | 754 ++++++++++++------ .../ra-b6510-32c/sonic_platform/sfp_config.py | 23 + .../ra-b6510-32c/sonic_platform/thermal.py | 4 +- .../ra-b6510-48v8c/Makefile | 3 + .../ra-b6510-48v8c/sonic_platform/chassis.py | 147 ++-- .../sonic_platform/component.py | 57 +- .../sonic_platform/fan_drawer.py | 72 +- .../ra-b6510-48v8c/sonic_platform/hwaccess.py | 47 ++ .../ra-b6510-48v8c/sonic_platform/platform.py | 1 - .../ra-b6510-48v8c/sonic_platform/psu.py | 72 ++ .../ra-b6510-48v8c/sonic_platform/sfp.py | 526 +++++++++++- .../sonic_platform/sfp_config.py | 23 + .../ra-b6510-48v8c/sonic_platform/thermal.py | 4 +- .../ra-b6910-64c/Makefile | 3 + .../ra-b6910-64c/setup.py | 3 +- .../ra-b6910-64c/sonic_pcie/__init__.py | 1 + .../ra-b6910-64c/sonic_pcie/pcie_common.py | 107 +++ .../ra-b6910-64c/sonic_platform/chassis.py | 44 +- .../ra-b6910-64c/sonic_platform/fan_drawer.py | 72 +- .../ra-b6910-64c/sonic_platform/pcie.py | 43 + .../ra-b6910-64c/sonic_platform/psu.py | 76 +- .../ra-b6910-64c/sonic_platform/sfp.py | 47 +- .../ra-b6910-64c/sonic_platform/thermal.py | 4 +- .../ra-b6920-4s/Makefile | 3 + .../modules/driver/pddf_custom_led_module.c | 40 +- .../ra-b6920-4s/sonic_platform/chassis.py | 15 +- .../ra-b6920-4s/sonic_platform/fan_drawer.py | 70 +- .../ra-b6920-4s/sonic_platform/psu.py | 76 +- .../ra-b6920-4s/sonic_platform/sfp.py | 295 +------ .../ra-b6920-4s/sonic_platform/thermal.py | 4 +- platform/pddf/platform-modules-pddf.mk | 2 +- src/sonic-device-data/tests/permitted_list | 10 + 73 files changed, 4311 insertions(+), 1738 deletions(-) delete mode 100644 device/ragile/x86_64-ragile_ra-b6510-32c-r0/minigraph.xml rename device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/{td3-b6510-48vs8cq-48x25G+8x100G.config.bcm => td3-ra-b6510-48v8c-48x25G+8x100G.config.bcm} (59%) create mode 100755 device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/eeprom.py create mode 100755 device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/fanutil.py create mode 100755 device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/ledutil.py create mode 100755 device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/psuutil.py create mode 100755 device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/sfputil.py create mode 100755 device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/sysstatutil.py create mode 100755 device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/thermalutil.py delete mode 100644 device/ragile/x86_64-ragile_ra-b6910-64c-r0/minigraph.xml mode change 100755 => 100644 device/ragile/x86_64-ragile_ra-b6910-64c-r0/plugins/fanutil.py delete mode 100644 device/ragile/x86_64-ragile_ra-b6920-4s-r0/minigraph.xml create mode 100644 platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6910-64c.install create mode 100755 platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6910-64c.postinst create mode 100644 platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/api.py create mode 100644 platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/hwaccess.py create mode 100644 platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp_config.py create mode 100755 platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/hwaccess.py create mode 100644 platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config.py create mode 100644 platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_pcie/__init__.py create mode 100644 platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_pcie/pcie_common.py create mode 100644 platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/pcie.py diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/minigraph.xml b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/minigraph.xml deleted file mode 100644 index d33d99d6e76f..000000000000 --- a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/minigraph.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - switch2 - - - - - - - - - - - - - switch2 - RA-B6510-32C - - - - - - - switch2 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - ErspanDestinationIpv4 - - 2.2.2.2 - - - - - - - switch2 - RA-B6510-32C - diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pddf-device.json b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pddf-device.json index 0f337006edad..51f26610495a 100755 --- a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pddf-device.json +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pddf-device.json @@ -1610,6 +1610,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -1618,6 +1619,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -1682,6 +1684,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -1690,6 +1693,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -1754,6 +1758,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -1762,6 +1767,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -1827,6 +1833,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -1835,6 +1842,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -1900,6 +1908,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -1908,6 +1917,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -1973,6 +1983,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -1981,6 +1992,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -2045,6 +2057,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -2053,6 +2066,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -2117,6 +2131,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -2125,6 +2140,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -2189,6 +2205,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -2197,6 +2214,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -2261,6 +2279,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -2269,6 +2288,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -2334,6 +2354,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -2342,6 +2363,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -2407,6 +2429,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -2415,6 +2438,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -2480,6 +2504,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -2488,6 +2513,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -2553,6 +2579,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -2561,6 +2588,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -2625,6 +2653,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -2633,6 +2662,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -2697,6 +2727,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -2705,6 +2736,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD1", "attr_devaddr": "0x30", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -2769,6 +2801,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -2777,6 +2810,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -2841,6 +2875,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -2849,6 +2884,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -2914,6 +2950,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -2922,6 +2959,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -2987,6 +3025,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -2995,6 +3034,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -3060,6 +3100,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -3068,6 +3109,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -3133,6 +3175,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -3141,6 +3184,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -3205,6 +3249,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -3213,6 +3258,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -3277,6 +3323,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x10", @@ -3285,6 +3332,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x14", @@ -3349,6 +3397,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -3357,6 +3406,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -3421,6 +3471,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -3429,6 +3480,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -3494,6 +3546,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -3502,6 +3555,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -3567,6 +3621,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -3575,6 +3630,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -3640,6 +3696,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -3648,6 +3705,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -3713,6 +3771,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -3721,6 +3780,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -3785,6 +3845,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -3793,6 +3854,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -3857,6 +3919,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x11", @@ -3865,6 +3928,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_reset", + "attr_devname": "MAC_BOARD_CPLD2", "attr_devaddr": "0x31", "attr_devtype": "cpld", "attr_offset": "0x15", @@ -4124,7 +4188,7 @@ } }, - "FANTRAY1_LED": { + "FAN1_LED": { "dev_info": { "device_type": "LED", "device_name": "FANTRAY_LED" @@ -4193,7 +4257,7 @@ } }, - "FANTRAY2_LED": { + "FAN2_LED": { "dev_info": { "device_type": "LED", "device_name": "FANTRAY_LED" @@ -4262,7 +4326,7 @@ } }, - "FANTRAY3_LED": { + "FAN3_LED": { "dev_info": { "device_type": "LED", "device_name": "FANTRAY_LED" @@ -4331,7 +4395,7 @@ } }, - "FANTRAY4_LED": { + "FAN4_LED": { "dev_info": { "device_type": "LED", "device_name": "FANTRAY_LED" @@ -4400,7 +4464,7 @@ } }, - "FANTRAY5_LED": { + "FAN5_LED": { "dev_info": { "device_type": "LED", "device_name": "FANTRAY_LED" diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/sai.profile b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/sai.profile index 042c8060d587..352e8c50b053 100755 --- a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/sai.profile +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-ra-b6510-48v8c-48x25G+8x100G.config.bcm diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/td3-ra-b6510-48v8c-48x25G+8x100G.config.bcm similarity index 59% rename from device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm rename to device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/td3-ra-b6510-48v8c-48x25G+8x100G.config.bcm index 69fd8c362987..27656bd3d466 100644 --- a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/RA-B6510-48V8C/td3-ra-b6510-48v8c-48x25G+8x100G.config.bcm @@ -1,8 +1,10 @@ +cancun_dir=/usr/share/sonic/platform/cancun/sdk_6.5.16/ l2_mem_entries=32768 +l3_mem_entries=16384 +l3_alpm_enable=2 +ipv6_lpm_128b_enable=0x1 l2xmsg_mode=0 l3_max_ecmp_mode=1 -l3_mem_entries=49152 -l3_alpm_enable=0 bcm_num_cos=8 bcm_stat_interval=2000000 cdma_timeout_usec=3000000 @@ -10,7 +12,6 @@ core_clock_frequency=1525 dpp_clock_ratio=2:3 help_cli_enable=1 ifp_inports_support_enable=1 -ipv6_lpm_128b_enable=0x1 #lpm_scaling_enable=1 max_vp_lags=0 mem_cache_enable=0 @@ -337,230 +338,62 @@ dport_map_port_107=54 dport_map_port_123=55 dport_map_port_127=56 -serdes_preemphasis_lane0_1=0x0f480d -serdes_preemphasis_lane1_1=0x0f480d -serdes_preemphasis_lane2_1=0x0f480d -serdes_preemphasis_lane3_1=0x0f480d -serdes_preemphasis_lane0_2=0x0f480d -serdes_preemphasis_lane1_2=0x0f480d -serdes_preemphasis_lane2_2=0x0f480d -serdes_preemphasis_lane3_2=0x0f480d -serdes_preemphasis_lane0_3=0x0f480d -serdes_preemphasis_lane1_3=0x0f480d -serdes_preemphasis_lane2_3=0x0f480d -serdes_preemphasis_lane3_3=0x0f480d -serdes_preemphasis_lane0_4=0x0f480d -serdes_preemphasis_lane1_4=0x0f480d -serdes_preemphasis_lane2_4=0x0f480d -serdes_preemphasis_lane3_4=0x0f480d -serdes_preemphasis_lane0_5=0x0f480d -serdes_preemphasis_lane1_5=0x0f480d -serdes_preemphasis_lane2_5=0x0f480d -serdes_preemphasis_lane3_5=0x0f480d -serdes_preemphasis_lane0_6=0x0f480d -serdes_preemphasis_lane1_6=0x0f480d -serdes_preemphasis_lane2_6=0x0f480d -serdes_preemphasis_lane3_6=0x0f480d -serdes_preemphasis_lane0_7=0x0d4b0c -serdes_preemphasis_lane1_7=0x0d4b0c -serdes_preemphasis_lane2_7=0x0d4b0c -serdes_preemphasis_lane3_7=0x0d4b0c -serdes_preemphasis_lane0_8=0x0d4b0c -serdes_preemphasis_lane1_8=0x0d4b0c -serdes_preemphasis_lane2_8=0x0d4b0c -serdes_preemphasis_lane3_8=0x0d4b0c -serdes_preemphasis_lane0_13=0x0d4b0c -serdes_preemphasis_lane1_13=0x0d4b0c -serdes_preemphasis_lane2_13=0x0d4b0c -serdes_preemphasis_lane3_13=0x0d4b0c -serdes_preemphasis_lane0_14=0x0d4b0c -serdes_preemphasis_lane1_14=0x0d4b0c -serdes_preemphasis_lane2_14=0x0d4b0c -serdes_preemphasis_lane3_14=0x0d4b0c -serdes_preemphasis_lane0_15=0x0d4b0c -serdes_preemphasis_lane1_15=0x0d4b0c -serdes_preemphasis_lane2_15=0x0d4b0c -serdes_preemphasis_lane3_15=0x0d4b0c -serdes_preemphasis_lane0_16=0x0d4b0c -serdes_preemphasis_lane1_16=0x0d4b0c -serdes_preemphasis_lane2_16=0x0d4b0c -serdes_preemphasis_lane3_16=0x0d4b0c -serdes_preemphasis_lane0_21=0x0d4b0c -serdes_preemphasis_lane1_21=0x0d4b0c -serdes_preemphasis_lane2_21=0x0d4b0c -serdes_preemphasis_lane3_21=0x0d4b0c -serdes_preemphasis_lane0_22=0x0d4b0c -serdes_preemphasis_lane1_22=0x0d4b0c -serdes_preemphasis_lane2_22=0x0d4b0c -serdes_preemphasis_lane3_22=0x0d4b0c -serdes_preemphasis_lane0_23=0x0d4b0c -serdes_preemphasis_lane1_23=0x0d4b0c -serdes_preemphasis_lane2_23=0x0d4b0c -serdes_preemphasis_lane3_23=0x0d4b0c -serdes_preemphasis_lane0_24=0x0d4b0c -serdes_preemphasis_lane1_24=0x0d4b0c -serdes_preemphasis_lane2_24=0x0d4b0c -serdes_preemphasis_lane3_24=0x0d4b0c -serdes_preemphasis_lane0_29=0x0d4b0c -serdes_preemphasis_lane1_29=0x0d4b0c -serdes_preemphasis_lane2_29=0x0d4b0c -serdes_preemphasis_lane3_29=0x0d4b0c -serdes_preemphasis_lane0_30=0x0d4b0c -serdes_preemphasis_lane1_30=0x0d4b0c -serdes_preemphasis_lane2_30=0x0d4b0c -serdes_preemphasis_lane3_30=0x0d4b0c -serdes_preemphasis_lane0_31=0x0d4b0c -serdes_preemphasis_lane1_31=0x0d4b0c -serdes_preemphasis_lane2_31=0x0d4b0c -serdes_preemphasis_lane3_31=0x0d4b0c -serdes_preemphasis_lane0_32=0x0d4b0c -serdes_preemphasis_lane1_32=0x0d4b0c -serdes_preemphasis_lane2_32=0x0d4b0c -serdes_preemphasis_lane3_32=0x0d4b0c -serdes_preemphasis_lane0_33=0x0d4b0c -serdes_preemphasis_lane1_33=0x0d4b0c -serdes_preemphasis_lane2_33=0x0d4b0c -serdes_preemphasis_lane3_33=0x0d4b0c -serdes_preemphasis_lane0_34=0x0d4b0c -serdes_preemphasis_lane1_34=0x0d4b0c -serdes_preemphasis_lane2_34=0x0d4b0c -serdes_preemphasis_lane3_34=0x0d4b0c -serdes_preemphasis_lane0_35=0x0d4b0c -serdes_preemphasis_lane1_35=0x0d4b0c -serdes_preemphasis_lane2_35=0x0d4b0c -serdes_preemphasis_lane3_35=0x0d4b0c -serdes_preemphasis_lane0_36=0x0d4b0c -serdes_preemphasis_lane1_36=0x0d4b0c -serdes_preemphasis_lane2_36=0x0d4b0c -serdes_preemphasis_lane3_36=0x0d4b0c -serdes_preemphasis_lane0_41=0x0d4b0c -serdes_preemphasis_lane1_41=0x0d4b0c -serdes_preemphasis_lane2_41=0x0d4b0c -serdes_preemphasis_lane3_41=0x0d4b0c -serdes_preemphasis_lane0_42=0x0d4b0c -serdes_preemphasis_lane1_42=0x0d4b0c -serdes_preemphasis_lane2_42=0x0d4b0c -serdes_preemphasis_lane3_42=0x0d4b0c -serdes_preemphasis_lane0_43=0x0d4b0c -serdes_preemphasis_lane1_43=0x0d4b0c -serdes_preemphasis_lane2_43=0x0d4b0c -serdes_preemphasis_lane3_43=0x0d4b0c -serdes_preemphasis_lane0_44=0x0d4b0c -serdes_preemphasis_lane1_44=0x0d4b0c -serdes_preemphasis_lane2_44=0x0d4b0c -serdes_preemphasis_lane3_44=0x0d4b0c -serdes_preemphasis_lane0_49=0x0d4b0c -serdes_preemphasis_lane1_49=0x0d4b0c -serdes_preemphasis_lane2_49=0x0d4b0c -serdes_preemphasis_lane3_49=0x0d4b0c -serdes_preemphasis_lane0_50=0x0d4b0c -serdes_preemphasis_lane1_50=0x0d4b0c -serdes_preemphasis_lane2_50=0x0d4b0c -serdes_preemphasis_lane3_50=0x0d4b0c -serdes_preemphasis_lane0_51=0x0d4b0c -serdes_preemphasis_lane1_51=0x0d4b0c -serdes_preemphasis_lane2_51=0x0d4b0c -serdes_preemphasis_lane3_51=0x0d4b0c -serdes_preemphasis_lane0_52=0x0d4b0c -serdes_preemphasis_lane1_52=0x0d4b0c -serdes_preemphasis_lane2_52=0x0d4b0c -serdes_preemphasis_lane3_52=0x0d4b0c -serdes_preemphasis_lane0_57=0x0d4b0c -serdes_preemphasis_lane1_57=0x0d4b0c -serdes_preemphasis_lane2_57=0x0d4b0c -serdes_preemphasis_lane3_57=0x0d4b0c -serdes_preemphasis_lane0_58=0x0d4b0c -serdes_preemphasis_lane1_58=0x0d4b0c -serdes_preemphasis_lane2_58=0x0d4b0c -serdes_preemphasis_lane3_58=0x0d4b0c -serdes_preemphasis_lane0_59=0x0d4b0c -serdes_preemphasis_lane1_59=0x0d4b0c -serdes_preemphasis_lane2_59=0x0d4b0c -serdes_preemphasis_lane3_59=0x0d4b0c -serdes_preemphasis_lane0_60=0x0d4b0c -serdes_preemphasis_lane1_60=0x0d4b0c -serdes_preemphasis_lane2_60=0x0d4b0c -serdes_preemphasis_lane3_60=0x0d4b0c -serdes_preemphasis_lane0_61=0x0d4b0c -serdes_preemphasis_lane1_61=0x0d4b0c -serdes_preemphasis_lane2_61=0x0d4b0c -serdes_preemphasis_lane3_61=0x0d4b0c -serdes_preemphasis_lane0_62=0x0d4b0c -serdes_preemphasis_lane1_62=0x0d4b0c -serdes_preemphasis_lane2_62=0x0d4b0c -serdes_preemphasis_lane3_62=0x0d4b0c -serdes_preemphasis_lane0_63=0x0d4b0c -serdes_preemphasis_lane1_63=0x0d4b0c -serdes_preemphasis_lane2_63=0x0d4b0c -serdes_preemphasis_lane3_63=0x0d4b0c -serdes_preemphasis_lane0_64=0x0d4b0c -serdes_preemphasis_lane1_64=0x0d4b0c -serdes_preemphasis_lane2_64=0x0d4b0c -serdes_preemphasis_lane3_64=0x0d4b0c -serdes_preemphasis_lane0_67=0x0d4b0c -serdes_preemphasis_lane1_67=0x0d4b0c -serdes_preemphasis_lane2_67=0x0d4b0c -serdes_preemphasis_lane3_67=0x0d4b0c -serdes_preemphasis_lane0_68=0x0d4b0c -serdes_preemphasis_lane1_68=0x0d4b0c -serdes_preemphasis_lane2_68=0x0d4b0c -serdes_preemphasis_lane3_68=0x0d4b0c -serdes_preemphasis_lane0_69=0x0d4b0c -serdes_preemphasis_lane1_69=0x0d4b0c -serdes_preemphasis_lane2_69=0x0d4b0c -serdes_preemphasis_lane3_69=0x0d4b0c -serdes_preemphasis_lane0_70=0x0d4b0c -serdes_preemphasis_lane1_70=0x0d4b0c -serdes_preemphasis_lane2_70=0x0d4b0c -serdes_preemphasis_lane3_70=0x0d4b0c -serdes_preemphasis_lane0_71=0x0d4b0c -serdes_preemphasis_lane1_71=0x0d4b0c -serdes_preemphasis_lane2_71=0x0d4b0c -serdes_preemphasis_lane3_71=0x0d4b0c -serdes_preemphasis_lane0_72=0x0d4b0c -serdes_preemphasis_lane1_72=0x0d4b0c -serdes_preemphasis_lane2_72=0x0d4b0c -serdes_preemphasis_lane3_72=0x0d4b0c -serdes_preemphasis_lane0_73=0x0d4b0c -serdes_preemphasis_lane1_73=0x0d4b0c -serdes_preemphasis_lane2_73=0x0d4b0c -serdes_preemphasis_lane3_73=0x0d4b0c -serdes_preemphasis_lane0_74=0x0d4b0c -serdes_preemphasis_lane1_74=0x0d4b0c -serdes_preemphasis_lane2_74=0x0d4b0c -serdes_preemphasis_lane3_74=0x0d4b0c -serdes_preemphasis_lane0_87=0x0d4b0c -serdes_preemphasis_lane1_87=0x0d4b0c -serdes_preemphasis_lane2_87=0x0d4b0c -serdes_preemphasis_lane3_87=0x0d4b0c -serdes_preemphasis_lane0_79=0x0d4b0c -serdes_preemphasis_lane1_79=0x0d4b0c -serdes_preemphasis_lane2_79=0x0d4b0c -serdes_preemphasis_lane3_79=0x0d4b0c -serdes_preemphasis_lane0_99=0x0d4b0c -serdes_preemphasis_lane1_99=0x0d4b0c -serdes_preemphasis_lane2_99=0x0d4b0c -serdes_preemphasis_lane3_99=0x0d4b0c -serdes_preemphasis_lane0_95=0x0d4b0c -serdes_preemphasis_lane1_95=0x0d4b0c -serdes_preemphasis_lane2_95=0x0d4b0c -serdes_preemphasis_lane3_95=0x0d4b0c -serdes_preemphasis_lane0_115=0x0f480d -serdes_preemphasis_lane1_115=0x0f480d -serdes_preemphasis_lane2_115=0x0f480d -serdes_preemphasis_lane3_115=0x0f480d -serdes_preemphasis_lane0_107=0x0f480d -serdes_preemphasis_lane1_107=0x0f480d -serdes_preemphasis_lane2_107=0x0f480d -serdes_preemphasis_lane3_107=0x0f480d -serdes_preemphasis_lane0_123=0x0f480d -serdes_preemphasis_lane1_123=0x0f480d -serdes_preemphasis_lane2_123=0x0f480d -serdes_preemphasis_lane3_123=0x0f480d -serdes_preemphasis_lane0_127=0x0f480d -serdes_preemphasis_lane1_127=0x0f480d -serdes_preemphasis_lane2_127=0x0f480d -serdes_preemphasis_lane3_127=0x0f480d +serdes_if_type_1=13 +serdes_if_type_2=13 +serdes_if_type_3=13 +serdes_if_type_4=13 +serdes_if_type_5=13 +serdes_if_type_6=13 +serdes_if_type_7=13 +serdes_if_type_8=13 +serdes_if_type_13=13 +serdes_if_type_14=13 +serdes_if_type_15=13 +serdes_if_type_16=13 +serdes_if_type_21=13 +serdes_if_type_22=13 +serdes_if_type_23=13 +serdes_if_type_24=13 +serdes_if_type_29=13 +serdes_if_type_30=13 +serdes_if_type_31=13 +serdes_if_type_32=13 +serdes_if_type_33=13 +serdes_if_type_34=13 +serdes_if_type_35=13 +serdes_if_type_36=13 +serdes_if_type_41=13 +serdes_if_type_42=13 +serdes_if_type_43=13 +serdes_if_type_44=13 +serdes_if_type_49=13 +serdes_if_type_50=13 +serdes_if_type_51=13 +serdes_if_type_52=13 +serdes_if_type_57=13 +serdes_if_type_58=13 +serdes_if_type_59=13 +serdes_if_type_60=13 +serdes_if_type_61=13 +serdes_if_type_62=13 +serdes_if_type_63=13 +serdes_if_type_64=13 +serdes_if_type_67=13 +serdes_if_type_68=13 +serdes_if_type_69=13 +serdes_if_type_70=13 +serdes_if_type_71=13 +serdes_if_type_72=13 +serdes_if_type_73=13 +serdes_if_type_74=13 +serdes_if_type_87=14 +serdes_if_type_79=14 +serdes_if_type_99=14 +serdes_if_type_95=14 +serdes_if_type_115=14 +serdes_if_type_107=14 +serdes_if_type_123=14 +serdes_if_type_127=14 reglist_enable=1 scache_filename=/tmp/scache diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/pddf/pddf-device.json b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/pddf/pddf-device.json index 4fa2582830f7..e9fc701bb8df 100644 --- a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/pddf/pddf-device.json +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/pddf/pddf-device.json @@ -32,7 +32,7 @@ "i2c_gpio", "i2c_algo_bit", "i2c_mux_pca9641", - "i2c_mux_pca954x force_create_bus=1", + "i2c_mux_pca954x force_create_bus=1 close_chan_force_reset=1", "lm75", "optoe", "at24", @@ -54,6 +54,7 @@ ], "custom_kos": [ "ragile_platform", + "ragile_common dfd_my_type=0x404a", "rg_cpld", "rg_fan", "rg_psu", @@ -73,12 +74,12 @@ "CONTROLLERS": [{ "dev_name": "i2c-0", "dev": "SMBUS0" - }, { - "dev_name": "i2c-1", - "dev": "I2C-GPIO0" }, { "dev_name": "i2c-2", "dev": "SMBUS1" + }, { + "dev_name": "i2c-1", + "dev": "I2C-GPIO0" }] } }, @@ -698,7 +699,16 @@ "attr_mask": "0x0", "attr_cmpval": "0xff", "attr_len": "2" - } + }, + { + "attr_name": "psu_temp1_input", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8d", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + } ] } }, @@ -769,7 +779,7 @@ "attr_devaddr": "0x37", "attr_devtype": "cpld", "attr_offset": "0x51", - "attr_mask": "0x8", + "attr_mask": "0x10", "attr_cmpval": "0x0", "attr_len": "1" }, @@ -777,7 +787,7 @@ "attr_name": "psu_model_name", "attr_devaddr": "0x5b", "attr_devtype": "pmbus", - "attr_offset": "0x35", + "attr_offset": "0x9a", "attr_mask": "0x0", "attr_cmpval": "0xff", "attr_len": "12" @@ -787,8 +797,8 @@ "attr_devaddr": "0x37", "attr_devtype": "cpld", "attr_offset": "0x51", - "attr_mask": "0x10", - "attr_cmpval": "0x10", + "attr_mask": "0x20", + "attr_cmpval": "0x20", "attr_len": "1" }, { @@ -1337,7 +1347,7 @@ "PORT1": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT1", "device_parent": "PORT-MUX1" }, @@ -1389,26 +1399,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x1", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x1", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x1", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -1417,7 +1430,7 @@ "PORT2": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT2", "device_parent": "PORT-MUX1" }, @@ -1469,26 +1482,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x2", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x2", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x2", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -1497,7 +1513,7 @@ "PORT3": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT3", "device_parent": "PORT-MUX1" }, @@ -1549,26 +1565,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x4", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x4", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x4", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -1578,7 +1597,7 @@ "PORT4": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT4", "device_parent": "PORT-MUX1" }, @@ -1630,26 +1649,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x8", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x8", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x8", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -1659,7 +1681,7 @@ "PORT5": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT5", "device_parent": "PORT-MUX1" }, @@ -1711,26 +1733,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -1740,7 +1765,7 @@ "PORT6": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT6", "device_parent": "PORT-MUX1" }, @@ -1792,26 +1817,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -1820,7 +1848,7 @@ "PORT7": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT7", "device_parent": "PORT-MUX1" }, @@ -1872,26 +1900,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -1900,7 +1931,7 @@ "PORT8": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT8", "device_parent": "PORT-MUX1" }, @@ -1952,26 +1983,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -1980,7 +2014,7 @@ "PORT9": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT9", "device_parent": "PORT-MUX2" }, @@ -2032,26 +2066,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2060,7 +2097,7 @@ "PORT10": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT10", "device_parent": "PORT-MUX2" }, @@ -2112,26 +2149,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2141,7 +2181,7 @@ "PORT11": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT11", "device_parent": "PORT-MUX2" }, @@ -2193,26 +2233,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2222,7 +2265,7 @@ "PORT12": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT12", "device_parent": "PORT-MUX2" }, @@ -2274,26 +2317,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2303,7 +2349,7 @@ "PORT13": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT13", "device_parent": "PORT-MUX2" }, @@ -2355,26 +2401,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2384,7 +2433,7 @@ "PORT14": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT14", "device_parent": "PORT-MUX2" }, @@ -2436,26 +2485,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2464,7 +2516,7 @@ "PORT15": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT15", "device_parent": "PORT-MUX2" }, @@ -2516,26 +2568,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2544,7 +2599,7 @@ "PORT16": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT16", "device_parent": "PORT-MUX2" }, @@ -2596,26 +2651,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2624,7 +2682,7 @@ "PORT17": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT17", "device_parent": "PORT-MUX3" }, @@ -2676,26 +2734,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2704,7 +2765,7 @@ "PORT18": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT18", "device_parent": "PORT-MUX3" }, @@ -2756,26 +2817,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2785,7 +2849,7 @@ "PORT19": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT19", "device_parent": "PORT-MUX3" }, @@ -2837,26 +2901,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2866,7 +2933,7 @@ "PORT20": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT20", "device_parent": "PORT-MUX3" }, @@ -2918,26 +2985,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -2947,7 +3017,7 @@ "PORT21": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT21", "device_parent": "PORT-MUX3" }, @@ -2999,26 +3069,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3028,7 +3101,7 @@ "PORT22": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT22", "device_parent": "PORT-MUX3" }, @@ -3080,26 +3153,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3108,7 +3184,7 @@ "PORT23": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT23", "device_parent": "PORT-MUX3" }, @@ -3160,26 +3236,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3188,7 +3267,7 @@ "PORT24": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT24", "device_parent": "PORT-MUX3" }, @@ -3240,26 +3319,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3268,7 +3350,7 @@ "PORT25": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT25", "device_parent": "PORT-MUX4" }, @@ -3320,26 +3402,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3348,7 +3433,7 @@ "PORT26": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT26", "device_parent": "PORT-MUX4" }, @@ -3400,26 +3485,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3429,7 +3517,7 @@ "PORT27": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT27", "device_parent": "PORT-MUX4" }, @@ -3481,26 +3569,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3510,7 +3601,7 @@ "PORT28": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT28", "device_parent": "PORT-MUX4" }, @@ -3562,26 +3653,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3591,7 +3685,7 @@ "PORT29": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT29", "device_parent": "PORT-MUX4" }, @@ -3643,26 +3737,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3672,7 +3769,7 @@ "PORT30": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT30", "device_parent": "PORT-MUX4" }, @@ -3724,26 +3821,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3752,7 +3852,7 @@ "PORT31": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT31", "device_parent": "PORT-MUX4" }, @@ -3804,26 +3904,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3832,7 +3935,7 @@ "PORT32": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT32", "device_parent": "PORT-MUX4" }, @@ -3884,26 +3987,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x60", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3912,7 +4018,7 @@ "PORT33": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT33", "device_parent": "PORT-MUX5" }, @@ -3964,26 +4070,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -3992,7 +4101,7 @@ "PORT34": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT34", "device_parent": "PORT-MUX5" }, @@ -4044,26 +4153,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4073,7 +4185,7 @@ "PORT35": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT35", "device_parent": "PORT-MUX5" }, @@ -4125,26 +4237,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4154,7 +4269,7 @@ "PORT36": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT36", "device_parent": "PORT-MUX5" }, @@ -4206,26 +4321,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4235,7 +4353,7 @@ "PORT37": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT37", "device_parent": "PORT-MUX5" }, @@ -4287,26 +4405,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4316,7 +4437,7 @@ "PORT38": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT38", "device_parent": "PORT-MUX5" }, @@ -4368,26 +4489,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4396,7 +4520,7 @@ "PORT39": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT39", "device_parent": "PORT-MUX5" }, @@ -4448,26 +4572,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4476,7 +4603,7 @@ "PORT40": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT40", "device_parent": "PORT-MUX5" }, @@ -4528,26 +4655,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x61", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4556,7 +4686,7 @@ "PORT41": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT41", "device_parent": "PORT-MUX6" }, @@ -4608,26 +4738,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4636,7 +4769,7 @@ "PORT42": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT42", "device_parent": "PORT-MUX6" }, @@ -4688,26 +4821,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4717,7 +4853,7 @@ "PORT43": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT43", "device_parent": "PORT-MUX6" }, @@ -4769,26 +4905,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4798,7 +4937,7 @@ "PORT44": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT44", "device_parent": "PORT-MUX6" }, @@ -4850,26 +4989,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4879,7 +5021,7 @@ "PORT45": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT45", "device_parent": "PORT-MUX6" }, @@ -4931,26 +5073,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -4960,7 +5105,7 @@ "PORT46": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT46", "device_parent": "PORT-MUX6" }, @@ -5012,26 +5157,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5040,7 +5188,7 @@ "PORT47": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT47", "device_parent": "PORT-MUX6" }, @@ -5092,26 +5240,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5120,7 +5271,7 @@ "PORT48": { "dev_info": { - "device_type": "QSFP28", + "device_type": "SFP28", "device_name": "PORT48", "device_parent": "PORT-MUX6" }, @@ -5172,26 +5323,29 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_txdisable", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x62", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5252,18 +5406,20 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_reset", "attr_devaddr": "0x36", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devtype": "cpld", "attr_offset": "0xb9", - "attr_mask": "0x01", + "attr_mask": "0x00", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5324,18 +5480,20 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_reset", "attr_devaddr": "0x36", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devtype": "cpld", "attr_offset": "0xb9", - "attr_mask": "0x02", + "attr_mask": "0x01", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5397,18 +5555,20 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_reset", "attr_devaddr": "0x36", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devtype": "cpld", "attr_offset": "0xb9", - "attr_mask": "0x04", + "attr_mask": "0x02", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5470,18 +5630,20 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_reset", "attr_devaddr": "0x36", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devtype": "cpld", "attr_offset": "0xb9", - "attr_mask": "0x08", + "attr_mask": "0x03", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5543,18 +5705,20 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_reset", "attr_devaddr": "0x36", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devtype": "cpld", "attr_offset": "0xb9", - "attr_mask": "0x10", + "attr_mask": "0x04", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5616,18 +5780,20 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_reset", "attr_devaddr": "0x36", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devtype": "cpld", "attr_offset": "0xb9", - "attr_mask": "0x20", + "attr_mask": "0x05", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5688,18 +5854,20 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_reset", "attr_devaddr": "0x36", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devtype": "cpld", "attr_offset": "0xb9", - "attr_mask": "0x40", + "attr_mask": "0x06", "attr_cmpval": "0x0", "attr_len": "1" }] @@ -5760,18 +5928,20 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }, { "attr_name": "xcvr_reset", "attr_devaddr": "0x36", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devtype": "cpld", "attr_offset": "0xb9", - "attr_mask": "0x80", + "attr_mask": "0x07", "attr_cmpval": "0x0", "attr_len": "1" }] diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/eeprom.py b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/eeprom.py new file mode 100755 index 000000000000..cf7215e0c9ac --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/eeprom.py @@ -0,0 +1,25 @@ +try: + import os + import sys + import json + sys.path.append('/usr/share/sonic/platform/plugins') + import pddfparse + #from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo +except ImportError as 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): + global pddf_obj + global plugin_data + with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd: + plugin_data = json.load(pd) + + pddf_obj = pddfparse.PddfParse() + # system EEPROM always has device name EEPROM1 + self.eeprom_path = pddf_obj.get_path("EEPROM1", "eeprom") + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/fanutil.py b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/fanutil.py new file mode 100755 index 000000000000..58c38d1d7367 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/fanutil.py @@ -0,0 +1,187 @@ +# Sample pddf_fanutil file +# All the supported FAN SysFS aattributes are +#- fan_present +#- fan_direction +#- fan_input +#- fan_pwm +#- fan_fault +# where idx is in the range [1-12] +# + + +import os.path +import sys +sys.path.append('/usr/share/sonic/platform/plugins') +import pddfparse +import json + +try: + from sonic_fan.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanUtil(FanBase): + """PDDF generic FAN util class""" + + def __init__(self): + FanBase.__init__(self) + global pddf_obj + global plugin_data + with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd: + plugin_data = json.load(pd) + + pddf_obj = pddfparse.PddfParse() + self.platform = pddf_obj.get_platform() + + self.num_fans = (self.platform['num_fantrays'] * self.platform['num_fans_pertray']) + + def get_num_fans(self): + return self.num_fans + + def get_presence(self, idx): + # 1 based fan index + if idx < 1 or idx > self.num_fans: + print("Invalid fan index %d\n" % idx) + return False + + attr_name = "fan" + str(idx) + "_present" + output = pddf_obj.get_attr_name_output("FAN-CTRL", attr_name) + if not output: + return False + + mode = output['mode'] + presence = output['status'].rstrip() + + vmap = plugin_data['FAN']['present'][mode]['valmap'] + + if presence in vmap: + status = vmap[presence] + else: + status = False + + return status + + def get_status(self, idx): + # 1 based fan index + if idx < 1 or idx > self.num_fans: + print("Invalid fan index %d\n" % idx) + return False + + speed = self.get_speed(idx) + status = True if (speed != 0) else False + return status + + def get_direction(self, idx): + # 1 based fan index + if idx < 1 or idx > self.num_fans: + print("Invalid fan index %d\n" % idx) + return None + + attr = "fan" + str(idx) + "_direction" + output = pddf_obj.get_attr_name_output("FAN-CTRL", attr) + if not output: + return None + + mode = output['mode'] + val = output['status'] + + val = val.rstrip() + vmap = plugin_data['FAN']['direction'][mode]['valmap'] + + if val in vmap: + direction = vmap[val] + else: + direction = val + + return direction + + def get_directions(self): + num_fan = self.get_num_fan() + + for i in range(1, num_fan+1): + attr = "fan" + str(i) + "_direction" + output = pddf_obj.get_attr_name_output("FAN-CTRL", attr) + if not output: + return None + + mode = output['mode'] + val = output['status'] + + val = val.rstrip() + vmap = plugin_data['FAN']['direction'][mode]['valmap'] + + direction = vmap[str(val)] + + print("FAN-%d direction is %s" % (i, direction)) + + return 0 + + def get_speed(self, idx): + # 1 based fan index + if idx < 1 or idx > self.num_fans: + print("Invalid fan index %d\n" % idx) + return 0 + + attr = "fan" + str(idx) + "_input" + output = pddf_obj.get_attr_name_output("FAN-CTRL", attr) + if not output: + return 0 + + #mode = output['mode'] + val = output['status'].rstrip() + + if val.isalpha(): + return 0 + else: + rpm_speed = int(float(val)) + + return rpm_speed + + def get_speeds(self): + num_fan = self.get_num_fan() + ret = "FAN_INDEX\t\tRPM\n" + + for i in range(1, num_fan+1): + attr1 = "fan" + str(i) + "_input" + output = pddf_obj.get_attr_name_output("FAN-CTRL", attr1) + if not output: + return "" + + #mode = output['mode'] + val = output['status'].rstrip() + + if val.isalpha(): + frpm = 0 + else: + frpm = int(val) + + ret += "FAN-%d\t\t\t%d\n" % (i, frpm) + + return ret + + def set_speed(self, val): + if val < 0 or val > 100: + print("Error: Invalid speed %d. Please provide a valid speed percentage" % val) + return False + + #num_fan = self.num_fans + if 'duty_cycle_to_pwm' not in plugin_data['FAN']: + print("Setting fan speed is not allowed !") + return False + else: + print("setspeed nothing to do") + return False + + #return True + + def dump_sysfs(self): + return pddf_obj.cli_dump_dsysfs('fan') + + def get_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring FAN(fand) + on this platform. + """ + raise NotImplementedError diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/ledutil.py b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/ledutil.py new file mode 100755 index 000000000000..5f9e2e99dbfa --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/ledutil.py @@ -0,0 +1,59 @@ +import sys +sys.path.append('/usr/share/sonic/platform/plugins') +import pddfparse + + +class LedUtil: + color_map = { + "STATUS_LED_COLOR_GREEN": "on", + "STATUS_LED_COLOR_RED": "faulty", + "STATUS_LED_COLOR_OFF": "off" + } + + def __init__(self): + global pddf_obj + pddf_obj = pddfparse.PddfParse() + self.path = "pddf/devices/led" + self.cur_state_path = "pddf/devices/led/cur_state" + + def set_status_led(self, led_device_name, color, color_state="SOLID"): + if (not led_device_name in list(pddf_obj.data.keys())): + status = "ERROR: " + led_device_name + " is not configured" + return (status) + + if (not color in list(self.color_map.keys())): + status = "ERROR: Invalid color" + return (status) + + index = pddf_obj.data[led_device_name]['dev_attr']['index'] + pddf_obj.create_attr('device_name', led_device_name, self.path) + pddf_obj.create_attr('index', index, self.path) + pddf_obj.create_attr( + 'color', self.color_map[color], self.cur_state_path) + pddf_obj.create_attr('color_state', color_state, self.cur_state_path) + pddf_obj.create_attr('dev_ops', 'set_status', self.path) + return ("Executed") + + def get_status_led(self, led_device_name): + if (not led_device_name in list(pddf_obj.data.keys())): + status = "ERROR: " + led_device_name + " is not configured" + return (status) + + index = pddf_obj.data[led_device_name]['dev_attr']['index'] + pddf_obj.create_attr('device_name', led_device_name, self.path) + pddf_obj.create_attr('index', index, self.path) + pddf_obj.create_attr('dev_ops', 'get_status', self.path) + color_f = "/sys/kernel/" + self.cur_state_path + "/color" + color_state_f = "/sys/kernel/" + self.cur_state_path + "/color_state" + + try: + with open(color_f, 'r') as f: + color = f.read().strip("\r\n") + with open(color_state_f, 'r') as f: + color_state = f.read().strip("\r\n") + except IOError: + status = "ERROR :" + color_f + " open failed" + return (status) + status = "%s-%s:\t%s %s\n" % (led_device_name, + index, color, color_state) + return (status) diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/psuutil.py b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/psuutil.py new file mode 100755 index 000000000000..dccb1ac1a155 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/psuutil.py @@ -0,0 +1,270 @@ +# +# Sample pddf_psuutil file +# +# All the supported PSU SysFS aattributes are +#- psu_present +#- psu_model_name +#- psu_power_good +#- psu_mfr_id +#- psu_serial_num +#- psu_fan_dir +#- psu_v_out +#- psu_i_out +#- psu_p_out +#- psu_fan1_speed_rpm +# + +import os.path +import sys +sys.path.append('/usr/share/sonic/platform/plugins') +import pddfparse +import json + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """PDDF generic PSU util class""" + + def __init__(self): + PsuBase.__init__(self) + global pddf_obj + global plugin_data + with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd: + plugin_data = json.load(pd) + + pddf_obj = pddfparse.PddfParse() + self.platform = pddf_obj.get_platform() + + def get_num_psus(self): + return int(self.platform['num_psus']) + + def get_psu_status(self, index): + if index is None: + return False + + device = "PSU" + "%d" % index + output = pddf_obj.get_attr_name_output(device, "psu_power_good") + if not output: + return False + + mode = output['mode'] + val = output['status'] + + val = val.rstrip() + vmap = plugin_data['PSU']['psu_power_good'][mode]['valmap'] + + if val in vmap: + return vmap[val] + else: + return False + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + device = "PSU" + "%d" % index + output = pddf_obj.get_attr_name_output(device, "psu_present") + if not output: + return False + + mode = output['mode'] + status = output['status'] + + vmap = plugin_data['PSU']['psu_present'][mode]['valmap'] + + if status.rstrip('\n') in vmap: + return vmap[status.rstrip('\n')] + else: + return False + + def get_powergood_status(self, idx): + if idx is None: + return False + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return False + + device = "PSU"+"%d" % (idx) + output = pddf_obj.get_attr_name_output(device, "psu_power_good") + if not output: + return False + + mode = output['mode'] + status = output['status'] + + vmap = plugin_data['PSU']['psu_power_good'][mode]['valmap'] + + if status.rstrip('\n') in vmap: + return vmap[status.rstrip('\n')] + else: + return False + + def get_model(self, idx): + if idx is None: + return None + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return None + + device = "PSU"+"%d" % (idx) + output = pddf_obj.get_attr_name_output(device, "psu_model_name") + if not output: + return None + + model = output['status'] + + # strip_non_ascii + stripped = (c for c in model if 0 < ord(c) < 127) + model = ''.join(stripped) + + return model.rstrip('\n') + + def get_mfr_id(self, idx): + if idx is None: + return None + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return None + + device = "PSU"+"%d" % (idx) + output = pddf_obj.get_attr_name_output(device, "psu_mfr_id") + if not output: + return None + + mfr = output['status'] + + return mfr.rstrip('\n') + + def get_serial(self, idx): + if idx is None: + return None + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return None + + device = "PSU"+"%d" % (idx) + output = pddf_obj.get_attr_name_output(device, "psu_serial_num") + if not output: + return None + + serial = output['status'] + + return serial.rstrip('\n') + + def get_direction(self, idx): + if idx is None: + return None + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return None + + device = "PSU"+"%d" % (idx) + output = pddf_obj.get_attr_name_output(device, "psu_fan_dir") + if not output: + return None + + mode = output['mode'] + direction = output['status'].rstrip('\n') + + vmap = plugin_data['PSU']['psu_fan_dir'][mode]['valmap'] + if direction in vmap: + airflow_dir_real = vmap[direction] + else: + airflow_dir_real = direction + + return airflow_dir_real + + def get_output_voltage(self, idx): + if idx is None: + return 0.0 + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return 0.0 + + device = "PSU"+"%d" % (idx) + output = pddf_obj.get_attr_name_output(device, "psu_v_out") + if not output: + return 0.0 + + v_out = output['status'] + + # value returned by the psu driver is in mV + return float(v_out)/1000 + + def get_output_current(self, idx): + if idx is None: + return 0.0 + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return 0.0 + + device = "PSU"+"%d" % (idx) + output = pddf_obj.get_attr_name_output(device, "psu_i_out") + if not output: + return 0.0 + + i_out = output['status'] + + # current in mA + return float(i_out)/1000 + + def get_output_power(self, idx): + if idx is None: + return 0.0 + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return 0.0 + + device = "PSU"+"%d" % (idx) + output = pddf_obj.get_attr_name_output(device, "psu_p_out") + if not output: + return 0.0 + + p_out = output['status'] + + # power is returned in micro watts + return float(p_out)/1000000 + + def get_fan_rpm(self, idx, fan_idx): + if idx is None or fan_idx is None: + return 0 + + if idx < 1 or idx > self.platform['num_psus']: + print("Invalid index %d\n" % idx) + return 0 + + device = "PSU"+"%d" % (idx) + num_fans = pddf_obj.get_num_psu_fans(device) + + if fan_idx < 1 or fan_idx > num_fans: + print("Invalid PSU-fan index %d\n" % fan_idx) + return 0 + + output = pddf_obj.get_attr_name_output(device, "psu_fan"+str(fan_idx)+"_speed_rpm") + if not output: + return 0 + + #mode = output['mode'] + output['status'] = output['status'].rstrip() + if output['status'].isalpha(): + return 0 + else: + speed = int(output['status']) + + return speed + + def dump_sysfs(self): + return pddf_obj.cli_dump_dsysfs('psu') diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/sfputil.py b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/sfputil.py new file mode 100755 index 000000000000..1ca925610822 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/sfputil.py @@ -0,0 +1,236 @@ +import os.path +import sys +sys.path.append('/usr/share/sonic/platform/plugins') +import pddfparse +import json + +try: + import time + from ctypes import create_string_buffer + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform generic PDDF SfpUtil class""" + + _port_to_eeprom_mapping = {} + _port_start = 0 + _port_end = 0 + _port_to_type_mapping = {} + _qsfp_ports = [] + _sfp_ports = [] + + def __init__(self): + SfpUtilBase.__init__(self) + global pddf_obj + global plugin_data + with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd: + plugin_data = json.load(pd) + + pddf_obj = pddfparse.PddfParse() + self.platform = pddf_obj.get_platform() + self._port_start = 0 + self._port_end = self.get_num_ports() + + for port_num in range(self._port_start, self._port_end): + device = "PORT" + "%d" % (port_num+1) + port_eeprom_path = pddf_obj.get_path(device, "eeprom") + self._port_to_eeprom_mapping[port_num] = port_eeprom_path + port_type = pddf_obj.get_device_type(device) + self._port_to_type_mapping[port_num] = port_type + self.populate_port_type(port_num) + + def get_num_ports(self): + return int(self.platform['num_ports']) + + def is_valid_port(self, port_num): + if port_num < self._port_start or port_num > self._port_end: + return False + else: + return True + + def get_presence(self, port_num): + if port_num < self._port_start or port_num > self._port_end: + return False + + device = "PORT" + "%d" % (port_num+1) + output = pddf_obj.get_attr_name_output(device, 'xcvr_present') + if not output: + return False + + #mode = output['mode'] + modpres = output['status'].rstrip() + if 'XCVR' in plugin_data: + if 'xcvr_present' in plugin_data['XCVR']: + ptype = self._port_to_type_mapping[port_num] + vtype = 'valmap-'+ptype + if vtype in plugin_data['XCVR']['xcvr_present']: + vmap = plugin_data['XCVR']['xcvr_present'][vtype] + if modpres in vmap: + return vmap[modpres] + else: + return False + # if plugin_data doesn't specify anything regarding Transceivers + if modpres == '1': + return True + + return False + + def populate_port_type(self, port): + if self._port_to_type_mapping[port] == 'QSFP' or self._port_to_type_mapping[port] == 'QSFP28': + self._qsfp_ports.append(port) + elif self._port_to_type_mapping[port] == 'SFP' or self._port_to_type_mapping[port] == 'SFP28': + self._sfp_ports.append(port) + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return (self._port_end - 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + @property + def qsfp_ports(self): + return self._qsfp_ports + + def reset(self, port_num): + if port_num < self._port_start or port_num > self._port_end: + return False + + device = "PORT" + "%d" % (port_num+1) + port_ps = pddf_obj.get_path(device, "xcvr_reset") + if port_ps is None: + return False + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + try: + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + except IOError as e: + 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 + + if not self.get_presence(port_num): + return False + + device = "PORT" + "%d" % (port_num+1) + output = pddf_obj.get_attr_name_output(device, 'xcvr_lpmode') + if not output: + if port_num not in self.qsfp_ports: + return False # Read from eeprom only for QSFP ports + try: + eeprom = None + eeprom = open(self.port_to_eeprom_mapping[port_num], "rb") + # check for valid connector type + eeprom.seek(2) + ctype = eeprom.read(1) + if ctype in ['21', '23']: + return False + + eeprom.seek(93) + lpmode = ord(eeprom.read(1)) + + if ((lpmode & 0x3) == 0x3): + return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1 + else: + # High Power Mode if one of the following conditions is matched: + # 1. "Power override" bit is 0 + # 2. "Power override" bit is 1 and "Power set" bit is 0 + return False + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if eeprom is not None: + eeprom.close() + time.sleep(0.01) + else: + #mode = output['mode'] + status = int(output['status'].rstrip()) + + if status == 1: + return True + else: + 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 + + if not self.get_presence(port_num): + return False # Port is not present, unable to set the eeprom + + device = "PORT" + "%d" % (port_num+1) + port_ps = pddf_obj.get_path(device, "xcvr_lpmode") + if port_ps is None: + if port_num not in self.qsfp_ports: + return False # Write to eeprom only for QSFP ports + try: + eeprom = None + eeprom = open(self.port_to_eeprom_mapping[port_num], "r+b") + # check for valid connector type + eeprom.seek(2) + ctype = eeprom.read(1) + if ctype in ['21', '23']: + return False + + # Fill in write buffer + regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode + buffer = create_string_buffer(1) + buffer[0] = chr(regval) + + # Write to eeprom + eeprom.seek(93) + eeprom.write(buffer[0]) + return True + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if eeprom is not None: + eeprom.close() + time.sleep(0.01) + else: + try: + f = open(port_ps, 'w') + if lpmode: + f.write('1') + else: + f.write('0') + f.close() + return True + except IOError as e: + return False + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + + def dump_sysfs(self): + return pddf_obj.cli_dump_dsysfs('xcvr') diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/sysstatutil.py b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/sysstatutil.py new file mode 100755 index 000000000000..af4dd5915361 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/sysstatutil.py @@ -0,0 +1,82 @@ +import os.path +import sys +sys.path.append('/usr/share/sonic/platform/plugins') +import pddfparse +import json + + +class SYSStatusUtil(): + """Platform-specific SYSStatus class""" + + def __init__(self): + global pddf_obj + global plugin_data + with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd: + plugin_data = json.load(pd) + + pddf_obj = pddfparse.PddfParse() + + def get_board_info(self): + device = "SYSSTATUS" + node = pddf_obj.get_path(device, "board_info") + if node is None: + return False + try: + with open(node, 'r') as f: + status = f.read() + print("board_info : %s" % status) + except IOError: + return False + + def get_cpld_versio(self): + device = "SYSSTATUS" + node = pddf_obj.get_path(device, "cpld1_version") + if node is None: + return False + try: + with open(node, 'r') as f: + status = f.read() + print("cpld1_version : %s" % status) + except IOError: + return False + + def get_power_module_status(self): + device = "SYSSTATUS" + node = pddf_obj.get_path(device, "power_module_status") + if node is None: + return False + try: + with open(node, 'r') as f: + status = f.read() + print("power_module_status : %s" % status) + except IOError: + return False + + def get_system_reset_status(self): + device = "SYSSTATUS" + for i in range(1, 8): + node = pddf_obj.get_path(device, "system_reset"+str(i)) + if node is None: + return False + try: + with open(node, 'r') as f: + status = f.read() + print("system_reset%s : %s" % (i, status)) + except IOError: + print("system_reset%s not supported" % i) + + def get_misc_status(self): + device = "SYSSTATUS" + for i in range(1, 3): + node = pddf_obj.get_path(device, "misc"+str(i)) + if node is None: + return False + try: + with open(node, 'r') as f: + status = f.read() + print("misc%s : %s" % (i, status)) + except IOError: + print("system_reset%s not supported" % i) + + def dump_sysfs(self): + return pddf_obj.cli_dump_dsysfs('sys-status') diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/thermalutil.py b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/thermalutil.py new file mode 100755 index 000000000000..6aef47b7e924 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/plugins/thermalutil.py @@ -0,0 +1,75 @@ +import os.path +import sys +import json +sys.path.append('/usr/share/sonic/platform/plugins') +import pddfparse + + +class ThermalUtil: + def __init__(self): + global pddf_obj + global plugin_data + with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd: + plugin_data = json.load(pd) + + pddf_obj = pddfparse.PddfParse() + self.platform = pddf_obj.get_platform() + self.num_thermals = self.platform['num_temps'] + self.info = [] + + def get_num_thermals(self): + return (self.num_thermals) + + def get_thermal_info(self): + list = [] + pddf_obj.get_device_list(list, "TEMP_SENSOR") + list.sort() + for dev in list: + data = {} + device_name = dev['dev_info']['device_name'] + topo_info = dev['i2c']['topo_info'] + label = "%s-i2c-%d-%x" % (topo_info['dev_type'], + int(topo_info['parent_bus'], 0), int(topo_info['dev_addr'], 0)) + attr_list = dev['i2c']['attr_list'] + data['device_name'] = device_name + data['label'] = label + for attr in attr_list: + attr_name = attr['attr_name'] + node = pddf_obj.get_path(device_name, attr_name) + if node is None: + return False + try: + with open(node, 'r') as f: + attr_value = int(f.read()) + except IOError: + return False + data[attr_name] = attr_value/float(1000) + self.info.append(data) + + def show_thermal_temp_values(self, idx): + if idx < 1 or idx > self.num_thermals: + print("Invalid temperature sensor idx %d" % idx) + return None + self.get_thermal_info() + thermal_name = "TEMP"+"%d" % idx + label = "" + value = "" + for temp in self.info: + if thermal_name == temp['device_name']: + label = temp['label'] + value = "temp1\t %+.1f C (high = %+.1f C, hyst = %+.1f C)" % ( + temp['temp1_input'], temp['temp1_max'], temp['temp1_max_hyst']) + else: + continue + + return (label, value) + + def show_temp_values(self): + self.get_thermal_info() + for temp in self.info: + print(temp['label']) + print("temp1\t %+.1f C (high = %+.1f C, hyst = %+.1f C)" % + (temp['temp1_input'], temp['temp1_max'], temp['temp1_max_hyst'])) + + def dump_sysfs(self): + return pddf_obj.cli_dump_dsysfs('temp-sensors') diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/pmon_daemon_control.json b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/pmon_daemon_control.json index 590def37b276..50c21289d260 100644 --- a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/pmon_daemon_control.json +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/pmon_daemon_control.json @@ -1,5 +1,3 @@ { - "skip_ledd": true, - "skip_xcvrd": false, - "skip_psud": false -} \ No newline at end of file + "skip_ledd": true +} diff --git a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/minigraph.xml b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/minigraph.xml deleted file mode 100644 index e6b05e400606..000000000000 --- a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/minigraph.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - switch2 - - - - - - - - - - - - - switch2 - RA-B6910-64C - - - - - - - switch2 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - ErspanDestinationIpv4 - - 2.2.2.2 - - - - - - - switch2 - RA-B6910-64C - diff --git a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/pddf/pddf-device.json b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/pddf/pddf-device.json index 3f5aae68c544..a5cf533a7f90 100644 --- a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/pddf/pddf-device.json +++ b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/pddf/pddf-device.json @@ -73,12 +73,12 @@ "CONTROLLERS": [{ "dev_name": "i2c-0", "dev": "SMBUS0" - }, { - "dev_name": "i2c-1", - "dev": "I2C-GPIO0" }, { "dev_name": "i2c-2", "dev": "SMBUS1" + }, { + "dev_name": "i2c-1", + "dev": "I2C-GPIO0" }] } }, @@ -1370,6 +1370,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -1378,6 +1379,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -1451,6 +1453,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -1459,6 +1462,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -1532,6 +1536,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -1540,6 +1545,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -1614,6 +1620,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -1622,6 +1629,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -1696,6 +1704,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -1704,6 +1713,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -1778,6 +1788,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -1786,6 +1797,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -1859,6 +1871,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -1867,6 +1880,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -1940,6 +1954,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -1948,6 +1963,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -2021,6 +2037,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -2029,6 +2046,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -2102,6 +2120,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -2110,6 +2129,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -2184,6 +2204,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -2192,6 +2213,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -2266,6 +2288,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -2274,6 +2297,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -2348,6 +2372,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -2356,6 +2381,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -2430,6 +2456,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -2438,6 +2465,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -2511,6 +2539,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -2519,6 +2548,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -2592,6 +2622,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -2600,6 +2631,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -2673,6 +2705,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -2681,6 +2714,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -2754,6 +2788,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -2762,6 +2797,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -2836,6 +2872,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -2844,6 +2881,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -2918,6 +2956,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -2926,6 +2965,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -3000,6 +3040,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -3008,6 +3049,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -3082,6 +3124,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -3090,6 +3133,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -3163,6 +3207,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -3171,6 +3216,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -3244,6 +3290,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x30", @@ -3252,6 +3299,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x40", @@ -3325,6 +3373,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -3333,6 +3382,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -3406,6 +3456,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -3414,6 +3465,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -3488,6 +3540,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -3496,6 +3549,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -3570,6 +3624,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -3578,6 +3633,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -3652,6 +3708,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -3660,6 +3717,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -3734,6 +3792,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -3742,6 +3801,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -3815,6 +3875,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -3823,6 +3884,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -3896,6 +3958,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x31", @@ -3904,6 +3967,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x41", @@ -3977,6 +4041,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -3985,6 +4050,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -4058,6 +4124,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -4066,6 +4133,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -4140,6 +4208,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -4148,6 +4217,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -4222,6 +4292,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -4230,6 +4301,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -4304,6 +4376,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -4312,6 +4385,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -4386,6 +4460,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -4394,6 +4469,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -4467,6 +4543,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -4475,6 +4552,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -4548,6 +4626,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -4556,6 +4635,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -4629,6 +4709,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -4637,6 +4718,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -4710,6 +4792,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -4718,6 +4801,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -4792,6 +4876,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -4800,6 +4885,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -4874,6 +4960,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -4882,6 +4969,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -4956,6 +5044,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -4964,6 +5053,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -5038,6 +5128,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -5046,6 +5137,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -5119,6 +5211,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -5127,6 +5220,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -5200,6 +5294,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -5208,6 +5303,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD1_B", "attr_devaddr": "0x34", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -5281,6 +5377,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -5289,6 +5386,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -5362,6 +5460,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -5370,6 +5469,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -5444,6 +5544,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -5452,6 +5553,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -5526,6 +5628,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -5534,6 +5637,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -5608,6 +5712,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -5616,6 +5721,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -5690,6 +5796,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -5698,6 +5805,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -5771,6 +5879,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -5779,6 +5888,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -5852,6 +5962,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x32", @@ -5860,6 +5971,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x42", @@ -5933,6 +6045,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -5941,6 +6054,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -6014,6 +6128,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -6022,6 +6137,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -6095,6 +6211,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -6103,6 +6220,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -6176,6 +6294,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -6184,6 +6303,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -6257,6 +6377,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -6265,6 +6386,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -6338,6 +6460,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -6346,6 +6469,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -6419,6 +6543,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -6427,6 +6552,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x43", @@ -6500,6 +6626,7 @@ }, "attr_list": [{ "attr_name": "xcvr_present", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x33", @@ -6508,6 +6635,7 @@ "attr_len": "1" }, { "attr_name": "xcvr_intr_status", + "attr_devname": "MAC_BOARD_CPLD2_B", "attr_devaddr": "0x36", "attr_devtype": "cpld", "attr_offset": "0x43", diff --git a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/plugins/fanutil.py b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/plugins/fanutil.py old mode 100755 new mode 100644 index c2944e7b5b89..b03c57ebd8ea --- a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/plugins/fanutil.py +++ b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/plugins/fanutil.py @@ -166,7 +166,7 @@ def set_speed(self, val): print("Error: Invalid speed %d. Please provide a valid speed percentage" % val) return False - num_fan = self.num_fans + #num_fan = self.num_fans if 'duty_cycle_to_pwm' not in plugin_data['FAN']: print("Setting fan speed is not allowed !") return False diff --git a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/pmon_daemon_control.json b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/pmon_daemon_control.json index b8d554f3a8b8..94592fa8cebc 100644 --- a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/pmon_daemon_control.json +++ b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/pmon_daemon_control.json @@ -1,5 +1,3 @@ { - "skip_ledd": true, - "skip_xcvrd": false, - "skip_psud": false -} \ No newline at end of file + "skip_ledd": true +} diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/minigraph.xml b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/minigraph.xml deleted file mode 100644 index 4aa22016c11a..000000000000 --- a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/minigraph.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - switch2 - - - - - - - - - - - - - switch2 - RA-B6920-4S - - - - - - - switch2 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - ErspanDestinationIpv4 - - 2.2.2.2 - - - - - - - switch2 - RA-B6920-4S - diff --git a/platform/broadcom/platform-modules-ragile.mk b/platform/broadcom/platform-modules-ragile.mk index 74ce1b04f475..12236b1e72ce 100644 --- a/platform/broadcom/platform-modules-ragile.mk +++ b/platform/broadcom/platform-modules-ragile.mk @@ -4,7 +4,7 @@ export RAGILE_RA_B6510_48V8C_PLATFORM_MODULE_VERSION RAGILE_RA_B6510_48V8C_PLATFORM_MODULE = platform-modules-ragile-ra-b6510-48v8c_$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE_VERSION)_amd64.deb $(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ragile -$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(PDDF_PLATFORM_MODULE) $(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)_PLATFORM = x86_64-ragile_ra-b6510-48v8c-r0 SONIC_DPKG_DEBS += $(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE) SONIC_STRETCH_DEBS += $(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 28d1cf1a4df5..dde11b58f591 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -14,7 +14,7 @@ include $(PLATFORM_PATH)/platform-modules-quanta.mk include $(PLATFORM_PATH)/platform-modules-juniper.mk #include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.mk #include $(PLATFORM_PATH)/platform-modules-ruijie.mk -#include $(PLATFORM_PATH)/platform-modules-ragile.mk +include $(PLATFORM_PATH)/platform-modules-ragile.mk #include $(PLATFORM_PATH)/platform-modules-tencent.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/csu550.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/csu550.c index 3df7c73ecad0..b1d1a9847218 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/csu550.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/csu550.c @@ -29,8 +29,15 @@ #include #include #include +#include #include "pmbus.h" +struct pmbus_device_info { + int pages; + u32 flags; +}; + +static const struct i2c_device_id pmbus_id[]; /* * Find sensor groups and status registers on each page. @@ -114,7 +121,7 @@ static int pmbus_identify(struct i2c_client *client, } if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) { - int vout_mode; + int vout_mode, i; vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE); if (vout_mode >= 0 && vout_mode != 0xff) { @@ -123,6 +130,11 @@ static int pmbus_identify(struct i2c_client *client, break; case 1: info->format[PSC_VOLTAGE_OUT] = vid; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + for (i = 0; i < info->pages; i++) { + info->vrm_version[i] = vr11; + } +#endif break; case 2: info->format[PSC_VOLTAGE_OUT] = direct; @@ -156,6 +168,7 @@ static int pmbus_identify(struct i2c_client *client, return ret; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) static int pmbus_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct pmbus_driver_info *info; @@ -182,7 +195,34 @@ static int pmbus_probe(struct i2c_client *client, const struct i2c_device_id *id return pmbus_do_probe(client, id, info); } +#else +static int pmbus_probe(struct i2c_client *client) +{ + struct pmbus_driver_info *info; + struct pmbus_platform_data *pdata = NULL; + struct device *dev = &client->dev; + struct pmbus_device_info *device_info; + info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + device_info = (struct pmbus_device_info *)i2c_match_id(pmbus_id, client)->driver_data; + if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) { + pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data), GFP_KERNEL); + if (!pdata) { + return -ENOMEM; + } + pdata->flags = PMBUS_SKIP_STATUS_CHECK; + } + + info->pages = device_info->pages; + info->identify = pmbus_identify; + dev->platform_data = pdata; + + return pmbus_do_probe(client, info); +} +#endif static const struct i2c_device_id pmbus_id[] = { {"csu550", 0}, {"csu800", 1}, @@ -194,8 +234,11 @@ MODULE_DEVICE_TABLE(i2c, pmbus_id); /* This is the driver that will be inserted */ static struct i2c_driver pmbus_driver = { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) .probe = pmbus_probe, - .remove = pmbus_do_remove, +#else + .probe_new = pmbus_probe, +#endif .id_table = pmbus_id, .driver = { .name = "pmbus", diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.c index 81068a14029e..7857f854d60e 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.c @@ -25,10 +25,10 @@ #include #include #include -#include +#include "fpga_i2c_ocores.h" #include #include - +#include struct ocores_i2c { void __iomem *base; @@ -835,8 +835,13 @@ static int rg_ocores_i2c_probe(struct platform_device *pdev) /* add in known devices to the bus */ if (pdata) { - for (i = 0; i < pdata->num_devices; i++) + for (i = 0; i < pdata->num_devices; i++) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + i2c_new_client_device(&i2c->adap, pdata->devices + i); +#else i2c_new_device(&i2c->adap, pdata->devices + i); +#endif + } } oc_debug_sysfs_init(pdev); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c index 82ae9f558f50..669198ca59fd 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c @@ -11,9 +11,9 @@ #include #include -#include -#include -#include +#include "fpga_i2c_ocores.h" +#include "fpga_pcie_i2c.h" +#include "fpga_reg_defs.h" #include #include diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c index f7b6bb952bf9..76270a94ec8b 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c @@ -40,7 +40,13 @@ #include #include #include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +#include +#include +#else #include +#endif #include #include #include @@ -63,7 +69,12 @@ extern int pca9641_setmuxflag(int nr, int flag); int force_create_bus = 0; +static int close_chan_force_reset = 0; +static int select_chan_check = 0; + module_param(force_create_bus, int, S_IRUGO | S_IWUSR); +module_param(close_chan_force_reset, int, S_IRUGO | S_IWUSR); +module_param(select_chan_check, int, S_IRUGO | S_IWUSR); enum pca_type { pca_9540, @@ -86,14 +97,15 @@ struct chip_desc { } muxtype; }; - - - struct pca954x { const struct chip_desc *chip; u8 last_chan; /* last register value */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + s32 idle_state; +#else u8 deselect; +#endif struct i2c_client *client; struct irq_domain *irq; @@ -157,7 +169,20 @@ static const struct i2c_device_id pca954x_id[] = { { } }; MODULE_DEVICE_TABLE(i2c, pca954x_id); - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +static const struct of_device_id pca954x_of_match[] = { + { .compatible = "nxp,pca9540", .data = &chips[pca_9540] }, + { .compatible = "nxp,pca9542", .data = &chips[pca_9542] }, + { .compatible = "nxp,pca9543", .data = &chips[pca_9543] }, + { .compatible = "nxp,pca9544", .data = &chips[pca_9544] }, + { .compatible = "nxp,pca9545", .data = &chips[pca_9545] }, + { .compatible = "nxp,pca9546", .data = &chips[pca_9546] }, + { .compatible = "nxp,pca9547", .data = &chips[pca_9547] }, + { .compatible = "nxp,pca9548", .data = &chips[pca_9548] }, + {} +}; +MODULE_DEVICE_TABLE(of, pca954x_of_match); +#else #ifdef CONFIG_OF static const struct of_device_id pca954x_of_match[] = { { .compatible = "nxp,pca9540", .data = &chips[pca_9540] }, @@ -172,6 +197,7 @@ static const struct of_device_id pca954x_of_match[] = { }; MODULE_DEVICE_TABLE(of, pca954x_of_match); #endif +#endif /* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() for this as they will try to lock adapter a second time */ @@ -204,37 +230,59 @@ static int pca954x_reg_write(struct i2c_adapter *adap, return ret; } -static int pca954x_setmuxflag(struct i2c_client *client, int flag) +static int pca954x_reg_read(struct i2c_adapter *adap, + struct i2c_client *client, u8 *val) { - struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); - pca9641_setmuxflag(adap->nr, flag); - return 0; -} + int ret = -ENODEV; + u8 tmp_val; -static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) -{ - struct pca954x *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - const struct chip_desc *chip = data->chip; - u8 regval; - int ret = 0; + if (adap->algo->master_xfer) { + struct i2c_msg msg; - /* we make switches look like muxes, not sure how to be smarter */ - if (chip->muxtype == pca954x_ismux) - regval = chan | chip->enable; - else - regval = 1 << chan; + msg.addr = client->addr; + msg.flags = I2C_M_RD; + msg.len = 1; + msg.buf = &tmp_val; + ret = __i2c_transfer(adap, &msg, 1); - /* Only select the channel if its different from the last channel */ - if (data->last_chan != regval) { - pca954x_setmuxflag(client, 0); - ret = pca954x_reg_write(muxc->parent, client, regval); - data->last_chan = ret < 0 ? 0 : regval; + if (ret >= 0 && ret != 1) { + ret = -EREMOTEIO; + } else { + *val = tmp_val; + } + } else { + union i2c_smbus_data data; + ret = adap->algo->smbus_xfer(adap, client->addr, + client->flags, + I2C_SMBUS_READ, + 0, I2C_SMBUS_BYTE, &data); + + if (!ret) { + tmp_val = data.byte; + *val = tmp_val; + } } return ret; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +static u8 pca954x_regval(struct pca954x *data, u8 chan) +{ + /* We make switches look like muxes, not sure how to be smarter. */ + if (data->chip->muxtype == pca954x_ismux) + return chan | data->chip->enable; + else + return 1 << chan; +} +#endif + +static int pca954x_setmuxflag(struct i2c_client *client, int flag) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + pca9641_setmuxflag(adap->nr, flag); + return 0; +} typedef void (*pca954x_hw_do_reset_func_t)(int busid, int addr); pca954x_hw_do_reset_func_t g_notify_to_do_reset = NULL; @@ -1132,6 +1180,179 @@ static int pca954x_do_reset(struct i2c_adapter *adap, ret = 0; return ret; } + +static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + const struct chip_desc *chip = data->chip; + u8 regval; + int ret = 0; + u8 read_val; + int rv; + + read_val = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + regval = pca954x_regval(data, chan); +#else + /* we make switches look like muxes, not sure how to be smarter */ + if (chip->muxtype == pca954x_ismux) + regval = chan | chip->enable; + else + regval = 1 << chan; +#endif + + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + pca954x_setmuxflag(client, 0); + ret = pca954x_reg_write(muxc->parent, client, regval); + data->last_chan = ret < 0 ? 0 : regval; + } + + if (select_chan_check) { /* check chan */ + ret = pca954x_reg_read(muxc->parent, client, &read_val); + /* read failed or chan not open, reset pca9548 */ + if ((ret < 0) || (read_val != data->last_chan)) { + dev_warn(&client->dev, "pca954x open channle %u failed, do reset.\n", chan); + PCA954X_DEBUG("ret = %d, read_val = %d, last_chan = %d.\n", ret, read_val, data->last_chan); + rv = pca954x_do_reset(client->adapter, client, chan); + if (rv >= 0) { + PCA954X_DEBUG("pca954x_do_reset success, rv = %d.\n", rv); + } else { + PCA954X_DEBUG("pca954x_do_reset failed, rv = %d.\n", rv); + } + if (ret >= 0) { + ret = -EIO; /* chan not match, return IO error */ + } + } + } + + return ret; +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + s32 idle_state; + int ret, rv; + struct i2c_client * new_client; + + if (close_chan_force_reset) { + data->last_chan = 0; + ret = pca954x_do_reset(client->adapter, client, chan); + if (ret < 0) { + dev_warn(&client->dev, "pca954x do reset failed %d.\n", ret); + } + return ret; + } else { + idle_state = READ_ONCE(data->idle_state); + if (idle_state >= 0) + /* Set the mux back to a predetermined channel */ + return pca954x_select_chan(muxc, idle_state); + if (idle_state == MUX_IDLE_DISCONNECT) { + /* Deselect active channel */ + data->last_chan = 0; + ret = pca954x_reg_write(muxc->parent, client, + data->last_chan); + if (ret < 0) { + new_client =(struct i2c_client *) client; + dev_warn(&new_client->dev, "pca954x close chn failed, do reset.\n"); + rv = pca954x_do_reset(client->adapter, client, chan); + if (rv == 0) { + ret = 0; + } + } + return ret; + } + } + + /* otherwise leave as-is */ + + return 0; +} + +static ssize_t idle_state_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + + return sprintf(buf, "%d\n", READ_ONCE(data->idle_state)); +} + +static ssize_t idle_state_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int val; + int ret; + + ret = kstrtoint(buf, 0, &val); + if (ret < 0) + return ret; + + if (val != MUX_IDLE_AS_IS && val != MUX_IDLE_DISCONNECT && + (val < 0 || val >= data->chip->nchans)) + return -EINVAL; + + i2c_lock_bus(muxc->parent, I2C_LOCK_SEGMENT); + + WRITE_ONCE(data->idle_state, val); + /* + * Set the mux into a state consistent with the new + * idle_state. + */ + if (data->last_chan || val != MUX_IDLE_DISCONNECT) + ret = pca954x_deselect_mux(muxc, 0); + + i2c_unlock_bus(muxc->parent, I2C_LOCK_SEGMENT); + + return ret < 0 ? ret : count; +} + +static DEVICE_ATTR_RW(idle_state); + +static irqreturn_t pca954x_irq_handler(int irq, void *dev_id) +{ + struct pca954x *data = dev_id; + unsigned long pending; + int ret, i; + + ret = i2c_smbus_read_byte(data->client); + if (ret < 0) + return IRQ_NONE; + + pending = (ret >> PCA954X_IRQ_OFFSET) & (BIT(data->chip->nchans) - 1); + for_each_set_bit(i, &pending, data->chip->nchans) + handle_nested_irq(irq_linear_revmap(data->irq, i)); + + return IRQ_RETVAL(pending); +} + +static int pca954x_init(struct i2c_client *client, struct pca954x *data) +{ + int ret; + + if (data->idle_state >= 0) + data->last_chan = pca954x_regval(data, data->idle_state); + else + data->last_chan = 0; /* Disconnect multiplexer */ + + ret = i2c_smbus_write_byte(client, data->last_chan); + if (ret < 0) + data->last_chan = 0; + + return ret; +} + +#else static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) { struct pca954x *data = i2c_mux_priv(muxc); @@ -1178,6 +1399,7 @@ static irqreturn_t pca954x_irq_handler(int irq, void *dev_id) } return handled ? IRQ_HANDLED : IRQ_NONE; } +#endif static void pca954x_irq_mask(struct irq_data *idata) { @@ -1274,7 +1496,9 @@ static int pca954x_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); +#endif struct device_node *of_node = client->dev.of_node; bool idle_disconnect_dt; struct gpio_desc *gpio; @@ -1302,7 +1526,25 @@ static int pca954x_probe(struct i2c_client *client, gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + data->idle_state = MUX_IDLE_AS_IS; + if (device_property_read_u32(&client->dev, "idle-state", &data->idle_state)) { + if (device_property_read_bool(&client->dev, "i2c-mux-idle-disconnect")) + data->idle_state = MUX_IDLE_DISCONNECT; + } + + /* + * Write the mux register at addr to verify + * that the mux is in fact present. This also + * initializes the mux to a channel + * or disconnected state. + */ + ret = pca954x_init(client, data); + if (ret < 0) { + dev_warn(&client->dev, "probe failed\n"); + return -ENODEV; + } +#else /* Write the mux register at addr to verify * that the mux is in fact present. This also * initializes the mux to disconnected state. @@ -1311,7 +1553,7 @@ static int pca954x_probe(struct i2c_client *client, dev_warn(&client->dev, "probe failed\n"); return -ENODEV; } - +#endif match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev); if (match) data->chip = of_device_get_match_data(&client->dev); @@ -1329,6 +1571,9 @@ static int pca954x_probe(struct i2c_client *client, /* Now create an adapter for each channel */ for (num = 0; num < data->chip->nchans; num++) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + ret = i2c_mux_add_adapter(muxc, 0, num, 0); +#else bool idle_disconnect_pd = false; force = 0; /* dynamic adap number */ @@ -1347,10 +1592,17 @@ static int pca954x_probe(struct i2c_client *client, idle_disconnect_dt) << num; ret = i2c_mux_add_adapter(muxc, force, num, class); +#endif if (ret) goto fail_del_adapters; } - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + /* + * The attr probably isn't going to be needed in most cases, + * so don't fail completely on error. + */ + device_create_file(&client->dev, &dev_attr_idle_state); +#endif dev_info(&client->dev, "registered %d multiplexed busses for I2C %s %s\n", num, data->chip->muxtype == pca954x_ismux @@ -1376,7 +1628,9 @@ static int pca954x_remove(struct i2c_client *client) } irq_domain_remove(data->irq); } - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + device_remove_file(&client->dev, &dev_attr_idle_state); +#endif i2c_mux_del_adapters(muxc); return 0; } @@ -1387,9 +1641,18 @@ static int pca954x_resume(struct device *dev) struct i2c_client *client = to_i2c_client(dev); struct i2c_mux_core *muxc = i2c_get_clientdata(client); struct pca954x *data = i2c_mux_priv(muxc); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + int ret; + ret = pca954x_init(client, data); + if (ret < 0) + dev_err(&client->dev, "failed to verify mux presence\n"); + + return ret; +#else data->last_chan = 0; return i2c_smbus_write_byte(client, 0); +#endif } #endif diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c index 501cfef8a91b..4988fcc7f2c3 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c @@ -23,7 +23,12 @@ #include #include #include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +#include +#else #include +#endif /* * The PCA9541 is a bus master selector. It supports two I2C masters connected @@ -546,7 +551,9 @@ static int pca9541_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct i2c_adapter *adap = client->adapter; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); +#endif struct i2c_mux_core *muxc; struct pca9541 *data; int force; @@ -573,11 +580,11 @@ static int pca9541_probe(struct i2c_client *client, } /* Create mux adapter */ - +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) force = 0; if (pdata) force = pdata->modes[0].adap_id; - +#endif if (detect_id == 0) { muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), I2C_MUX_ARBITRATOR, @@ -589,8 +596,11 @@ static int pca9541_probe(struct i2c_client *client, data->client = client; i2c_set_clientdata(client, muxc); - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + ret = i2c_mux_add_adapter(muxc, 0, 0, 0); +#else ret = i2c_mux_add_adapter(muxc, force, 0, 0); +#endif if (ret) return ret; } else { diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.c index 7115fdabec1d..e15bed475d2f 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.c @@ -25,10 +25,11 @@ #include #include #include -#include +#include "lpc_cpld_i2c_ocores.h" #include #include #include +#include #define OCORES_FLAG_POLL BIT(0) @@ -768,8 +769,13 @@ static int rg_ocores_i2c_probe(struct platform_device *pdev) /* add in known devices to the bus */ if (pdata) { LPC_CPLD_I2C_DEBUG_VERBOSE("i2c device %d.\n", pdata->num_devices); - for (i = 0; i < pdata->num_devices; i++) + for (i = 0; i < pdata->num_devices; i++) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) + i2c_new_client_device(&i2c->adap, pdata->devices + i); +#else i2c_new_device(&i2c->adap, pdata->devices + i); +#endif + } } oc_debug_sysfs_init(pdev); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/pmbus.h b/platform/broadcom/sonic-platform-modules-ragile/common/modules/pmbus.h index 39b778a4734b..cd5550ab41b3 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/pmbus.h +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/pmbus.h @@ -24,6 +24,7 @@ #include #include +#include /* * Registers @@ -35,6 +36,8 @@ enum pmbus_regs { PMBUS_CLEAR_FAULTS = 0x03, PMBUS_PHASE = 0x04, + PMBUS_WRITE_PROTECT = 0x10, + PMBUS_CAPABILITY = 0x19, PMBUS_QUERY = 0x1A, @@ -130,6 +133,23 @@ enum pmbus_regs { PMBUS_MFR_DATE = 0x9D, PMBUS_MFR_SERIAL = 0x9E, + PMBUS_MFR_VIN_MIN = 0xA0, + PMBUS_MFR_VIN_MAX = 0xA1, + PMBUS_MFR_IIN_MAX = 0xA2, + PMBUS_MFR_PIN_MAX = 0xA3, + PMBUS_MFR_VOUT_MIN = 0xA4, + PMBUS_MFR_VOUT_MAX = 0xA5, + PMBUS_MFR_IOUT_MAX = 0xA6, + PMBUS_MFR_POUT_MAX = 0xA7, + + PMBUS_IC_DEVICE_ID = 0xAD, + PMBUS_IC_DEVICE_REV = 0xAE, + + PMBUS_MFR_MAX_TEMP_1 = 0xC0, + PMBUS_MFR_MAX_TEMP_2 = 0xC1, + PMBUS_MFR_MAX_TEMP_3 = 0xC2, + + /* * Virtual registers. * Useful to support attributes which are not supported by standard PMBus @@ -217,6 +237,19 @@ enum pmbus_regs { PMBUS_VIRT_PWM_ENABLE_2, PMBUS_VIRT_PWM_ENABLE_3, PMBUS_VIRT_PWM_ENABLE_4, + /* Samples for average + * + * Drivers wanting to expose functionality for changing the number of + * samples used for average values should implement support in + * {read,write}_word_data callback for either PMBUS_VIRT_SAMPLES if it + * applies to all types of measurements, or any number of specific + * PMBUS_VIRT_*_SAMPLES registers to allow for individual control. + */ + PMBUS_VIRT_SAMPLES, + PMBUS_VIRT_IN_SAMPLES, + PMBUS_VIRT_CURR_SAMPLES, + PMBUS_VIRT_POWER_SAMPLES, + PMBUS_VIRT_TEMP_SAMPLES, }; /* @@ -224,6 +257,15 @@ enum pmbus_regs { */ #define PB_OPERATION_CONTROL_ON BIT(7) +/* + * WRITE_PROTECT + */ +#define PB_WP_ALL BIT(7) /* all but WRITE_PROTECT */ +#define PB_WP_OP BIT(6) /* all but WP, OPERATION, PAGE */ +#define PB_WP_VOUT BIT(5) /* all but WP, OPERATION, PAGE, VOUT, ON_OFF */ + +#define PB_WP_ANY (PB_WP_ALL | PB_WP_OP | PB_WP_VOUT) + /* * CAPABILITY */ @@ -347,7 +389,7 @@ enum pmbus_sensor_classes { }; #define PMBUS_PAGES 32 /* Per PMBus specification */ - +#define PMBUS_PHASES 8 /* Maximum number of phases per page */ /* Functionality bit mask */ #define PMBUS_HAVE_VIN BIT(0) #define PMBUS_HAVE_VCAP BIT(1) @@ -371,16 +413,23 @@ enum pmbus_sensor_classes { #define PMBUS_HAVE_STATUS_VMON BIT(19) #define PMBUS_HAVE_PWM12 BIT(20) #define PMBUS_HAVE_PWM34 BIT(21) - +#define PMBUS_HAVE_SAMPLES BIT(22) +#define PMBUS_PHASE_VIRTUAL BIT(30) #define PMBUS_PAGE_VIRTUAL BIT(31) enum pmbus_data_format { linear = 0, direct, vid }; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +enum vrm_version { vr11 = 0, vr12, vr13, imvp9, amd625mv }; +#else enum vrm_version { vr11 = 0, vr12, vr13 }; +#endif struct pmbus_driver_info { int pages; /* Total number of pages */ enum pmbus_data_format format[PSC_NUM_CLASSES]; enum vrm_version vrm_version[PMBUS_PAGES]; + u8 phases[PMBUS_PAGES];/* Number of phases per page */ + u32 pfunc[PMBUS_PHASES];/* Functionality, per phase */ /* * Support one set of coefficients for each sensor type * Used for chips providing data in direct mode. @@ -417,6 +466,7 @@ struct pmbus_driver_info { /* Regulator functionality, if supported by this chip driver. */ int num_regulators; const struct regulator_desc *reg_desc; + const struct attribute_group **groups; }; /* Regulator ops */ @@ -450,8 +500,12 @@ int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg, void pmbus_clear_faults(struct i2c_client *client); bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info); +#else int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, struct pmbus_driver_info *info); +#endif int pmbus_do_remove(struct i2c_client *client); const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client *client); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/ragile_common_module.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/ragile_common_module.c index e4fc735643dd..f28852ec3317 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/ragile_common_module.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/ragile_common_module.c @@ -37,9 +37,6 @@ module_param(g_common_debug_verbose, int, S_IRUGO | S_IWUSR); int dfd_get_my_card_type(void) { - int type; - int cnt; - if (dfd_my_type != 0) { RAGILE_COMMON_DEBUG_VERBOSE("my_type = 0x%x\r\n", dfd_my_type); return dfd_my_type; diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/script/device_i2c.py b/platform/broadcom/sonic-platform-modules-ragile/common/script/device_i2c.py index a76539019cc9..a30dd7d86a41 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/script/device_i2c.py +++ b/platform/broadcom/sonic-platform-modules-ragile/common/script/device_i2c.py @@ -5,7 +5,7 @@ import os import time import subprocess -from ragileconfig import GLOBALCONFIG, GLOBALINITPARAM, MAC_LED_RESET, STARTMODULE, i2ccheck_params +from ragileconfig import * from ragileutil import rgpciwr, rgi2cset, io_wr from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe @@ -96,13 +96,6 @@ def starthal_ledctrl(): if len(rets) == 0: subprocess.Popen(cmd) -def start_dev_monitor(): - if STARTMODULE.get('dev_monitor',0) == 1: - cmd = ["dev_monitor.py", "start"] - rets = get_pid("dev_monitor.py") - if len(rets) == 0: - subprocess.Popen(cmd) - def start_slot_monitor(): if STARTMODULE.get('slot_monitor',0) == 1: cmd = ["slot_monitor.py", "start"] @@ -127,16 +120,6 @@ def stophal_ledctrl(): subprocess.call(cmd) return True - -def stop_dev_monitor(): - u'''disable the fan timer service''' - if STARTMODULE.get('dev_monitor',0) == 1: - rets = get_pid("dev_monitor.py") # - for ret in rets: - cmd = ["kill", ret] - subprocess.call(cmd) - return True - def stop_slot_monitor(): u'''disable slot timer service''' if STARTMODULE.get('slot_monitor',0) == 1: @@ -259,7 +242,6 @@ def otherinit(): def unload_driver(): u'''remove devices and drivers''' - stop_dev_monitor() # disable removable device driver monitors stop_fan_ctrl() # disable fan-control service removedevs() # remove other devices removedrivers() # remove drivers @@ -311,7 +293,6 @@ def load_driver(): starthal_ledctrl() # enable LED control if STARTMODULE['avscontrol'] == 1: start_avs_ctrl() # avs voltage-adjustment - start_dev_monitor() # enable removable device driver monitors start_slot_monitor() # slot insertion and removal initialization monitor otherinit(); # other initialization, QSFP initialization if STARTMODULE.get("macledreset", 0) == 1: diff --git a/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6910-64c.install b/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6910-64c.install new file mode 100644 index 000000000000..770cabc331e5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6910-64c.install @@ -0,0 +1 @@ +ra-b6910-64c/scripts/pddf_post_driver_install.sh /usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6910-64c.postinst b/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6910-64c.postinst new file mode 100755 index 000000000000..0d9d6a34d2a5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6910-64c.postinst @@ -0,0 +1,17 @@ +#!/bin/sh +# postinst + +kernel_version=$(uname -r) + +if [ -e /boot/System.map-${kernel_version} ]; then + depmod -a -F /boot/System.map-${kernel_version} ${kernel_version} || true +fi + +# enable platform-service +depmod -a +# systemctl enable platform-modules-ra-b6510-48v8c.service +# systemctl start platform-modules-ra-b6510-48v8c.service +systemctl enable pddf-platform-init.service +systemctl start pddf-platform-init.service + +#DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-ragile/debian/rules b/platform/broadcom/sonic-platform-modules-ragile/debian/rules index e32da1faa711..7e5aa13b2e04 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/debian/rules +++ b/platform/broadcom/sonic-platform-modules-ragile/debian/rules @@ -18,7 +18,7 @@ export INSTALL_MOD_DIR top_srcdir KVERSION KERNEL_SRC CC KBUILD_OUTPUT include $(CUSTOM_RULES_DIR)/rule-ragile.mk -#all product need common +#all products need common COMPILE_DIRS = $(MODULE_DIRS) clean_dirs = $(MODULE_DIRS) @@ -64,7 +64,7 @@ $(COMPILE_DIRS): common_build cp -r $(MOD_SRC_DIR)/$@/build/* debian/platform-modules-ragile-$@/ binary: binary-indep - @echo "=======================================================" + @echo "======================================================" binary-indep: # Resuming debhelper scripts diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/Makefile b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/Makefile index 46415e74ab7d..f197dce8cdd9 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/Makefile +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/Makefile @@ -8,6 +8,9 @@ INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/ KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers +ifeq "5.10.0" "$(word 1, $(sort 5.10.0 $(KERNEL_VERSION)))" +KBUILD_EXTRA_SYMBOLS += $(PWD)/../../../pddf/i2c/Module.symvers.PDDF +endif export KBUILD_EXTRA_SYMBOLS all: diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_led_module.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_led_module.c index 5776735ef4fa..d9968f9151a1 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_led_module.c +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_led_module.c @@ -22,12 +22,13 @@ #include #include #include -#include "pddf_led_defs.h" -#include "pddf_client_defs.h" #include #include #include +#include #include +#include "../../../../../pddf/i2c/modules/include/pddf_led_defs.h" +#include "../../../../../pddf/i2c/modules/include/pddf_client_defs.h" #define DEBUG 0 LED_OPS_DATA sys_led_ops_data[1]={0}; @@ -48,11 +49,16 @@ LED_OPS_DATA* dev_list[LED_TYPE_MAX] = { int num_psus = 0; int num_fantrays = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +extern int board_i2c_cpld_read_new(unsigned short cpld_addr, char *name, u8 reg); +extern int board_i2c_cpld_write_new(unsigned short cpld_addr, char *name, u8 reg, u8 value); +#else extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg); extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); +extern void *get_device_table(char *name); +#endif extern ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, char *buf); extern ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -extern void *get_device_table(char *name); static LED_STATUS find_state_index(const char* state_str) { int index; @@ -151,6 +157,7 @@ static void print_led_data(LED_OPS_DATA *ptr, LED_STATUS state) } } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val) { int ret; @@ -181,11 +188,10 @@ int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val) *sys_val = (uint32_t)ret; ret = 0; } - return ret; } +#endif - ssize_t get_status_led(struct device_attribute *da) { int ret=0; @@ -203,6 +209,7 @@ ssize_t get_status_led(struct device_attribute *da) temp_data_ptr->device_name, temp_data_ptr->index); return (-1); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) ret = get_sys_val(ops_ptr, &sys_val); if (ret < 0) { pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); @@ -210,7 +217,11 @@ ssize_t get_status_led(struct device_attribute *da) } /* keep ret as old value */ ret = 0; - +#else + sys_val = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset); + if (sys_val < 0) + return sys_val; +#endif strcpy(temp_data.cur_state.color, "None"); for (state=0; statedata[state].bits.mask_bits); @@ -228,6 +239,7 @@ ssize_t get_status_led(struct device_attribute *da) return(ret); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val) { int ret; @@ -257,6 +269,7 @@ int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val) return ret; } +#endif ssize_t set_status_led(struct device_attribute *da) { @@ -288,12 +301,18 @@ ssize_t set_status_led(struct device_attribute *da) } if(ops_ptr->data[cur_state].swpld_addr != 0x0) { - ret = get_sys_val(ops_ptr, &sys_val); - if (ret < 0) { - pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); - return (-1); - } - +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) + ret = get_sys_val(ops_ptr, &sys_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); + return (-1); + } +#else + sys_val = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset); + if (sys_val < 0) { + return sys_val; + } +#endif new_val = (sys_val & ops_ptr->data[cur_state].bits.mask_bits) | (ops_ptr->data[cur_state].value << ops_ptr->data[cur_state].bits.pos); @@ -303,16 +322,24 @@ ssize_t set_status_led(struct device_attribute *da) return (-1); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) ret = set_sys_val(ops_ptr, new_val); if (ret < 0) { pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot set sys val\n", __func__); return (-1); } +#else + board_i2c_cpld_write_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset, new_val); +#endif pddf_dbg(LED, KERN_INFO "Set color:%s; 0x%x:0x%x sys_val:0x%x new_val:0x%x read:0x%x\n", LED_STATUS_STR[cur_state], ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset, sys_val, new_val, - ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset)); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) + ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset)); +#else + ret = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset)); +#endif if (ret < 0) { pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: Error %d in reading from cpld(0x%x) offset 0x%x\n", __FUNCTION__, ret, ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/api.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/api.py new file mode 100644 index 000000000000..134e3a9872e0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/api.py @@ -0,0 +1,203 @@ +############################################################################# +# PDDF +# Module contains an implementation of SONiC pddfapi Base API and +# provides the pddfpai information +# +############################################################################# + + +try: + from sonic_platform_pddf_base.pddfapi import PddfApi +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class newapi(PddfApi): + """ + PDDF Platform-Specific pddfapi Class + """ + + def __init__(self): + PddfApi.__init__(self) + + + def show_attr_eeprom_device(self, dev, ops): + ret = [] + attr_name = ops['attr'] + attr_list = dev['i2c']['attr_list'] + KEY = "eeprom" + dsysfs_path = "" + + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] + + for attr in attr_list: + if attr_name == attr['attr_name'] or attr_name == 'all': + if 'drv_attr_name' in attr.keys(): + real_name = attr['drv_attr_name'] + else: + real_name = attr['attr_name'] + + dsysfs_path = self.show_device_sysfs(dev, ops) + \ + "/%d-00%02x" % (int(dev['i2c']['topo_info']['parent_bus'], 0), + int(dev['i2c']['topo_info']['dev_addr'], 0)) + \ + "/%s" % real_name + if dsysfs_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(dsysfs_path) + ret.append(dsysfs_path) + return ret + + def show_attr_psu_i2c_device(self, dev, ops): + target = ops['target'] + attr_name = ops['attr'] + ret = [] + KEY = "psu" + dsysfs_path = "" + + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] + + if target == 'all' or target == dev['dev_info']['virt_parent']: + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] + for attr in attr_list: + if attr_name == attr['attr_name'] or attr_name == 'all': + if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio": + # Check and enable the gpio from class + attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset']) + if (os.path.exists(attr_path)): + if attr_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(attr_path) + ret.append(attr_path) + else: + if 'drv_attr_name' in attr.keys(): + real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] + else: + real_name = attr['attr_name'] + real_dev = dev + + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%02x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ + "/%s" % real_name + if dsysfs_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(dsysfs_path) + ret.append(dsysfs_path) + return ret + + + def show_attr_fan_device(self, dev, ops): + ret = [] + attr_name = ops['attr'] + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] + KEY = "fan" + dsysfs_path = "" + + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] + + for attr in attr_list: + if attr_name == attr['attr_name'] or attr_name == 'all': + if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio": + # Check and enable the gpio from class + attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset']) + if (os.path.exists(attr_path)): + if attr_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(attr_path) + ret.append(attr_path) + else: + if 'drv_attr_name' in attr.keys(): + real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] + else: + real_name = attr['attr_name'] + real_dev = dev + + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%02x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ + "/%s" % real_name + if dsysfs_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(dsysfs_path) + ret.append(dsysfs_path) + return ret + + # This is only valid for LM75 + def show_attr_temp_sensor_device(self, dev, ops): + ret = [] + if 'i2c' not in dev.keys(): + return ret + attr_name = ops['attr'] + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] + KEY = "temp-sensors" + dsysfs_path = "" + + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] + + for attr in attr_list: + if attr_name == attr['attr_name'] or attr_name == 'all': + path = self.show_device_sysfs(dev, ops)+"/%d-00%02x/" % (int(dev['i2c']['topo_info']['parent_bus'], 0), + int(dev['i2c']['topo_info']['dev_addr'], 0)) + if 'drv_attr_name' in attr.keys(): + real_name = attr['drv_attr_name'] + else: + real_name = attr['attr_name'] + + if (os.path.exists(path)): + full_path = glob.glob(path + 'hwmon/hwmon*/' + real_name)[0] + dsysfs_path = full_path + if dsysfs_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(dsysfs_path) + ret.append(full_path) + return ret + + def show_attr_xcvr_i2c_device(self, dev, ops): + target = ops['target'] + attr_name = ops['attr'] + ret = [] + dsysfs_path = "" + KEY = "xcvr" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] + + if target == 'all' or target == dev['dev_info']['virt_parent']: + attr_list = dev['i2c']['attr_list'] + for attr in attr_list: + if attr_name == attr['attr_name'] or attr_name == 'all': + if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio": + # Check and enable the gpio from class + attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset']) + if (os.path.exists(attr_path)): + if attr_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(attr_path) + ret.append(attr_path) + else: + if 'drv_attr_name' in attr.keys(): + real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] + else: + real_name = attr['attr_name'] + real_dev = dev + + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%02x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ + "/%s" % real_name + if dsysfs_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(dsysfs_path) + ret.append(dsysfs_path) + return ret + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/chassis.py index ae8e74186825..9082bbd2570b 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/chassis.py @@ -7,36 +7,49 @@ try: import time from sonic_platform_pddf_base.pddf_chassis import PddfChassis - from sonic_platform.fan_drawer import FanDrawer + from .component import Component + from sonic_platform.sfp import * + from .sfp_config import * except ImportError as e: raise ImportError(str(e) + "- required module not found") -PORT_START = 0 -PORTS_IN_BLOCK = 32 -FAN_NUM_PER_DRAWER = 2 - class Chassis(PddfChassis): """ PDDF Platform-specific Chassis class """ - SFP_STATUS_INSERTED = "1" - SFP_STATUS_REMOVED = "0" - port_dict = {} + STATUS_INSERTED = "1" + STATUS_REMOVED = "0" + sfp_present_dict = {} def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + for i in range(0,5): + self._component_list.append(Component(i)) + + try: + self._sfp_list = [] + sfp_config = get_sfp_config() + self.port_start_index = sfp_config.get("port_index_start", 0) + self.port_num = sfp_config.get("port_num", 0) + # fix problem with first index is 1, we add a fake sfp node + if self.port_start_index == 1: + self._sfp_list.append(Sfp(1)) + + # sfp id always start at 1 + for index in range(1, self.port_num + 1): + self._sfp_list.append(Sfp(index)) + + for i in range(self.port_start_index, self.port_start_index + self.port_num): + self.sfp_present_dict[i] = self.STATUS_REMOVED - # fan drawer - temp = [] - drawer_index = 0 - for idx, fan in enumerate(self.get_all_fans()): - temp.append(fan) - if (idx + 1) % FAN_NUM_PER_DRAWER == 0: - drawer = FanDrawer(drawer_index + 1, temp) - self.get_all_fan_drawers().append(drawer) - temp = [] - drawer_index += 1 + except Exception as err: + print("SFP init error: %s" % str(err)) + + def get_revision(self): + val = ord(self._eeprom.revision_str()) + test = "{}".format(val) + return test def get_reboot_cause(self): """ @@ -52,17 +65,9 @@ def get_reboot_cause(self): return (self.REBOOT_CAUSE_NON_HARDWARE, None) def get_change_event(self, timeout=0): - change_event_dict = {"fan": {}, "sfp": {}} - sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout) - change_event_dict["sfp"] = sfp_change_dict - if sfp_status is True: - return True, change_event_dict - - return False, {} + change_event_dict = {"sfp": {}} - def get_transceiver_change_event(self, timeout=0): start_time = time.time() - currernt_port_dict = {} forever = False if timeout == 0: @@ -70,25 +75,23 @@ def get_transceiver_change_event(self, timeout=0): elif timeout > 0: timeout = timeout / float(1000) # Convert to secs else: - print("get_transceiver_change_event:Invalid timeout value", timeout) - return False, {} + print("get_change_event:Invalid timeout value", timeout) + return False, change_event_dict end_time = start_time + timeout if start_time > end_time: print( - "get_transceiver_change_event:" "time wrap / invalid timeout value", + "get_change_event:" "time wrap / invalid timeout value", timeout, ) - return False, {} # Time wrap or possibly incorrect timeout - - while timeout >= 0: - # Check for OIR events and return updated port_dict - for index in range(PORT_START, PORTS_IN_BLOCK): - if self._sfp_list[index].get_presence(): - currernt_port_dict[index] = self.SFP_STATUS_INSERTED - else: - currernt_port_dict[index] = self.SFP_STATUS_REMOVED - if currernt_port_dict == self.port_dict: + return False, change_event_dict # Time wrap or possibly incorrect timeout + try: + while timeout >= 0: + # check for sfp + sfp_change_dict = self.get_transceiver_change_event() + if sfp_change_dict : + change_event_dict["sfp"] = sfp_change_dict + return True, change_event_dict if forever: time.sleep(1) else: @@ -98,11 +101,34 @@ def get_transceiver_change_event(self, timeout=0): else: if timeout > 0: time.sleep(timeout) - return True, {} + return True, change_event_dict + except Exception as e: + print(e) + print("get_change_event: Should not reach here.") + return False, change_event_dict + + def get_transceiver_change_event(self): + cur_sfp_present_dict = {} + ret_dict = {} + + # Check for OIR events and return ret_dict + for i in range(self.port_start_index, self.port_start_index + self.port_num): + sfp = self._sfp_list[i] + if sfp.get_presence(): + cur_sfp_present_dict[i] = self.STATUS_INSERTED + else: - # Update reg value - self.port_dict = currernt_port_dict - print(self.port_dict) - return True, self.port_dict - print("get_transceiver_change_event: Should not reach here.") - return False, {} + cur_sfp_present_dict[i] = self.STATUS_REMOVED + + # Update reg value + if cur_sfp_present_dict == self.sfp_present_dict: + return ret_dict + + for index, status in cur_sfp_present_dict.items(): + if self.sfp_present_dict[index] != status: + ret_dict[index] = status + + self.sfp_present_dict = cur_sfp_present_dict + + return ret_dict + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/component.py index beb701cb5902..7d139eb8feda 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/component.py @@ -9,22 +9,67 @@ try: from sonic_platform_base.component_base import ComponentBase - from sonic_platform.regutil import Reg - from sonic_platform.logger import logger + import sonic_platform.hwaccess as hwaccess from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError(str(e) + "- required module not found") +def get_cpld_version(bus, i2caddr): + return '{}{}{}{}'.format(hwaccess.i2c_get(bus, i2caddr, 1), + hwaccess.i2c_get(bus, i2caddr, 2), + hwaccess.i2c_get(bus, i2caddr, 3), + hwaccess.i2c_get(bus, i2caddr, 0) + ) + +def get_cpu_cpld_version(): + return get_cpld_version(6, 0x0d) + +def get_fan_cpld_version(): + return get_cpld_version(2, 0x0d) + +def get_cpld1_version(): + return get_cpld_version(8, 0x30) + +def get_cpld2_version(): + return get_cpld_version(8, 0x31) + +def get_fpga_version(): + version = hwaccess.pci_get_value('/sys/bus/pci/devices/0000:08:00.0/resource0', 0) + datetime = hwaccess.pci_get_value('/sys/bus/pci/devices/0000:08:00.0/resource0',4) + return "%08x-%08x"%(version,datetime) + +COMPONENT_LIST= [ + ['CPU CPLD', + 'cpu board', + get_cpu_cpld_version + ], + + ['CPU FAN CPLD', + 'cpu fan', + get_fan_cpld_version + ], + + ['MAC1 CPLD', + 'mac1 board', + get_cpld1_version + ], + + ['MAC2 CPLD', + 'mac2 board', + get_cpld2_version + ], + ['FPGA', + 'fpga version', + get_fpga_version + ] + ] class Component(ComponentBase): """ Ragile Platform-specific Component class""" - def __init__(self, index, config=None): - self.index = index - self.name = config.get("name") - self._reg_fm_ver = Reg(config.get("firmware_version")) - self.description = config.get("desc") - self.slot = config.get("slot") + def __init__(self, component_index=0): + ComponentBase.__init__(self) + self.index = component_index def get_name(self): """ @@ -33,7 +78,7 @@ def get_name(self): Returns: A string containing the name of the component """ - return self.name + return COMPONENT_LIST[self.index][0] def get_description(self): """ @@ -42,7 +87,7 @@ def get_description(self): Returns: A string containing the description of the component """ - return self.description + return COMPONENT_LIST[self.index][1] def get_firmware_version(self): """ @@ -51,12 +96,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - try: - return self._reg_fm_ver.decode() - except Exception as e: - logger.error(str(e)) - - return "" + return COMPONENT_LIST[self.index][2]() def install_firmware(self, image_path): """ diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan.py index b3dd67ed52cb..d91e42dfda86 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan.py @@ -1,5 +1,6 @@ try: from sonic_platform_pddf_base.pddf_fan import PddfFan + from . import api except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -10,6 +11,7 @@ class Fan(PddfFan): def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, is_psu_fan=False, psu_index=0): # idx is 0-based PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) + self.pddf_obj = api.newapi() # Provide the functions/variables below for which implementation is to be overwritten # Since psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'intake' diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan_drawer.py index 2f83b66df94a..d03fd656f4d7 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan_drawer.py @@ -1,69 +1,17 @@ -# -# fan_drawer -# +#!/usr/bin/env python + try: - from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer except ImportError as e: raise ImportError(str(e) + "- required module not found") -class FanDrawer(FanDrawerBase): - # Device type definition. Note, this is a constant. - DEVICE_TYPE = "fan_drawer" - - def __init__(self, index, fan_list): - FanDrawerBase.__init__(self) - - self._fan_list = fan_list - self._index = index - - def get_name(self): - """ - Retrieves the name of the device - Returns: - string: The name of the device - """ - - return "fan drawer {}".format(self._index) - - def get_num_fans(self): - """ - Retrieves the number of fans available on this fan drawer - Returns: - An integer, the number of fan modules available on this fan drawer - """ - return len(self._fan_list) - - def get_all_fans(self): - """ - Retrieves all fan modules available on this fan drawer - Returns: - A list of objects derived from FanBase representing all fan - modules available on this fan drawer - """ - return self._fan_list - - def set_status_led(self, color): - """ - Sets the state of the fan drawer status LED - Args: - color: A string representing the color with which to set the - fan drawer status LED - Returns: - bool: True if status LED state is set successfully, False if not - """ - if self.get_num_fans() > 0: - return self._fan_list[0].set_status_led(color) - return False +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" - def get_status_led(self): - """ - Gets the state of the fan drawer LED - Returns: - A string, one of the predefined STATUS_LED_COLOR_* strings above - """ - if self.get_num_fans() > 0: - return self._fan_list[0].get_status_led() - return "N/A" + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + # Provide the functions/variables below for which implementation is to be overwritten \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/hwaccess.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/hwaccess.py new file mode 100644 index 000000000000..c604d9c61164 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/hwaccess.py @@ -0,0 +1,47 @@ +# Helper functions to access hardware + +import os +import struct +import mmap +import subprocess + +# Read PCI device + +def pci_mem_read(mm, offset): + mm.seek(offset) + read_data_stream = mm.read(4) + return struct.unpack('I',read_data_stream)[0] + +def pci_get_value(resource, offset): + with open(resource, 'r+b') as fd: + mm = mmap.mmap(fd.fileno(), 0) + val = pci_mem_read(mm, offset) + mm.close() + return val + +def pci_mem_write(memmap, offset, data): + """ Write PCI device """ + memmap.seek(offset) + memmap.write(struct.pack('I', data)) + +def pci_set_value(resource, val, offset): + """ Set a value to PCI device """ + with open(resource, 'w+b') as filed: + memmap = None + try: + memmap = mmap.mmap(filed.fileno(), 0) + pci_mem_write(memmap, offset, val) + except EnvironmentError: + pass + if memmap is not None: + memmap.close() + +# Read I2C device + +def i2c_get(bus, i2caddr, ofs): + try: + valx = int(subprocess.check_output(['/usr/sbin/i2cget','-f', '-y', str(bus), str(i2caddr), str(ofs)]), 16) + return "{:02x}".format(valx) + except (FileNotFoundError, subprocess.CalledProcessError): + return -1 + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/psu.py index 240af5d2d1b5..71eacf763ff1 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/psu.py @@ -1,5 +1,7 @@ try: from sonic_platform_pddf_base.pddf_psu import PddfPsu + from sonic_py_common.general import getstatusoutput_noshell + import time except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -29,4 +31,74 @@ def get_type(self): A string, the type of PSU (AC/DC) """ return "DC" + + def runcmd(self, cmd): + time_retry = 6 + result_msg = "" + time_delay = 0.01 + while time_retry: + try: + val, result_msg = getstatusoutput_noshell(cmd.split(" ")) + if val is False: + time_retry -=1 + time.sleep(time_delay) + continue + else: + return val, result_msg + except Exception as e: + time_retry -= 1 + result_msg = str(e) + time.sleep(time_delay) + + return False, result_msg + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + + v_out = 0 + label_t = "psu_v_out" + device = "PSU{}".format(self.psu_index) + #print(device) + pddf_obj_data = self.pddf_obj.data + + if device in pddf_obj_data.keys(): + pmbusloc = pddf_obj_data[device]['i2c']['interface'] + + for val in pmbusloc: + dev_name = val['dev'] + pmbus_loc = pddf_obj_data[dev_name] + i2cloc = pmbus_loc['i2c']['attr_list'] + parentbus = pmbus_loc['i2c']['topo_info'] + + for item_t in i2cloc: + if item_t['attr_name'] == label_t: + parentbus_id = int(parentbus['parent_bus'], 16) + vout_mode_cmd = "i2cget -f -y {} {} 0x20 bp".format(parentbus_id, parentbus['dev_addr']) + ret_t, val_voutmode = self.runcmd(vout_mode_cmd) + if ret_t is False: + return 0.0 + v_out_cmd = "i2cget -f -y {} {} {} wp".format(parentbus_id, parentbus['dev_addr'], item_t['attr_offset']) + ret_t, val_p_out = self.runcmd(v_out_cmd) + if ret_t is False: + return 0.0 + val_voutmode_t = int(val_voutmode, 16) + val_p_out_t = int(val_p_out, 16) * 1000 + + import ctypes + val_voutmode_t_t = ctypes.c_int8(val_voutmode_t << 3).value >>3 + + if (val_voutmode_t_t) < 0: + val_p_out_t_f = val_p_out_t>> (-val_voutmode_t_t) + else: + val_p_out_t_f = val_p_out_t << val_voutmode_t_t + + return float(val_p_out_t_f)/1000 + + return float(v_out)/1000 diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp.py index ea8e256fe6ef..c1d4cb998a6e 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp.py @@ -1,287 +1,525 @@ -#!/usr/bin/env python +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +# +# *_device.py config version instruction: +# ver 1.0 - platform api: +# "presence_cpld": { +# "dev_id": { +# [dev_id]: { +# "offset": { +# [offset]: [port_id] +# } +# } +# } +# } +# "reset_cpld": { +# "dev_id": { +# [dev_id]: { +# "offset": { +# [offset]: [port_id] +# } +# } +# } +# } +# ver 2.0 - rg_plat: +# "presence_path": "/xx/rg_plat/xx[port_id]/present" +# "eeprom_path": "/sys/bus/i2c/devices/i2c-[bus]/[bus]-0050/eeprom" +# "reset_path": "/xx/rg_plat/xx[port_id]/reset" +############################################################################# +import sys +import time +import syslog +import traceback +from abc import abstractmethod try: - #from sonic_platform_pddf_base.pddf_sfp import * - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_pddf_base.pddf_sfp import PddfSfp - from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_OFFSET - from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_WIDTH - from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_OFFSET - from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_WIDTH - from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_OFFSET - from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_WIDTH - from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_OFFSET - from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_WIDTH - from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_OFFSET - from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH + import os + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from .sfp_config import * + except ImportError as e: raise ImportError (str(e) + "- required module not found") -XCVR_DOM_CAPABILITY_OFFSET = 92 -XCVR_DOM_CAPABILITY_WIDTH = 2 -QSFP_VERSION_COMPLIANCE_OFFSET = 1 -QSFP_VERSION_COMPLIANCE_WIDTH = 2 -QSFP_OPTION_VALUE_OFFSET = 192 -QSFP_OPTION_VALUE_WIDTH = 4 - -class Sfp(PddfSfp): - """ - PDDF Platform-Specific Sfp class - """ - - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) - self.dom_supported = False - self.__dom_capability_detect() - - def __dom_capability_detect(self): - self.dom_supported = False - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.qsfp_page3_available = False - self.calibration = 0 - if not self.get_presence(): - return - - if self.is_osfp_port: - # Not implement - return - elif self.is_qsfp_port: - self.calibration = 1 - sfpi_obj = sff8436InterfaceId() - if sfpi_obj is None: - self.dom_supported = False - offset = 128 - - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes( - QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH) - qsfp_version_compliance = int( - qsfp_version_compliance_raw[0], 16) - dom_capability = sfpi_obj.parse_dom_capability( - qsfp_dom_capability_raw, 0) - if qsfp_version_compliance >= 0x08: - self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On' - self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On' - self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' - self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On' - else: - self.dom_temp_supported = True - self.dom_volt_supported = True - self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' - self.dom_tx_power_supported = True - - self.dom_supported = True - self.calibration = 1 - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - qsfp_option_value_raw = self.__read_eeprom_specific_bytes( - QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH) - if qsfp_option_value_raw is not None: - optional_capability = sfpd_obj.parse_option_params( - qsfp_option_value_raw, 0) - self.dom_tx_disable_supported = optional_capability[ - 'data']['TxDisable']['value'] == 'On' - dom_status_indicator = sfpd_obj.parse_dom_status_indicator( - qsfp_version_compliance_raw, 1) - self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off' - else: - self.dom_supported = False - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.calibration = 0 - self.qsfp_page3_available = False +LOG_DEBUG_LEVEL = 1 +LOG_WARNING_LEVEL = 2 +LOG_ERROR_LEVEL = 3 + +CONFIG_DB_PATH = "/etc/sonic/config_db.json" + +def getonieplatform(path): + if not os.path.isfile(path): + return "" + machine_vars = {} + with open(path) as machine_file: + for line in machine_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + machine_vars[tokens[0]] = tokens[1].strip() + return machine_vars.get("onie_platform") + +def getplatform_config_db(): + if not os.path.isfile(CONFIG_DB_PATH): + return "" + val = os.popen("sonic-cfggen -j %s -v DEVICE_METADATA.localhost.platform" % CONFIG_DB_PATH).read().strip() + if len(val) <= 0: + return "" + else: + return val + +def getplatform_name(): + if os.path.isfile('/host/machine.conf'): + return getonieplatform('/host/machine.conf') + elif os.path.isfile('/usr/share/sonic/hwsku/machine.conf'): + return getonieplatform('/usr/share/sonic/hwsku/machine.conf') + else: + return getplatform_config_db() + +def get_sfp_config(): + dev = getplatform_name() + return cust_sfp_cfg.get(dev, None) + +class Sfp(SfpOptoeBase): + + OPTOE_DRV_TYPE1 = 1 + OPTOE_DRV_TYPE2 = 2 + OPTOE_DRV_TYPE3 = 3 + + # index must start at 1 + def __init__(self, index, a=None, b=None): + SfpOptoeBase.__init__(self) + self.sfp_type = None + sfp_config = get_sfp_config() + self.log_level_config = sfp_config.get("log_level", LOG_WARNING_LEVEL) + # Init instance of SfpCust + ver = sfp_config.get("ver", None) + if ver is None: + self._sfplog(LOG_ERROR_LEVEL, "Get Ver Config Error!") + vers = int(float(ver)) + if vers == 1: + self._sfp_api = SfpV1(index) + elif vers == 2: + self._sfp_api = SfpV2(index) else: - sfpi_obj = sff8472InterfaceId() - if sfpi_obj is None: - return None - sfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) - if sfp_dom_capability_raw is not None: - sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) - self.dom_supported = (sfp_dom_capability & 0x40 != 0) - if self.dom_supported: - self.dom_temp_supported = True - self.dom_volt_supported = True - self.dom_rx_power_supported = True - self.dom_tx_power_supported = True - if sfp_dom_capability & 0x20 != 0: - self.calibration = 1 - elif sfp_dom_capability & 0x10 != 0: - self.calibration = 2 - else: - self.calibration = 0 - else: - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.calibration = 0 - self.dom_tx_disable_supported = ( - int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) - - # Provide the functions/variables below for which implementation is to be overwritten - - def __read_eeprom_specific_bytes(self, offset, num_bytes): - eeprom_raw = [] - if not self.get_presence(): - return None - for i in range(0, num_bytes): - eeprom_raw.append("0x00") + self._sfplog(LOG_ERROR_LEVEL, "Get SfpVer Error!") - try: - with open(self.eeprom_path, mode="rb", buffering=0) as eeprom: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except Exception as e: - print("Error: Unable to open eeprom_path: %s" % (str(e))) - return None + def get_eeprom_path(self): + return self._sfp_api._get_eeprom_path() + + def read_eeprom(self, offset, num_bytes): + return self._sfp_api.read_eeprom(offset, num_bytes) + + def write_eeprom(self, offset, num_bytes, write_buffer): + return self._sfp_api.write_eeprom(offset, num_bytes, write_buffer) + def get_presence(self): + return self._sfp_api.get_presence() + + def get_transceiver_info(self): + # temporary solution for a sonic202111 bug + transceiver_info = super().get_transceiver_info() try: - if len(raw) == 0: - return None - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + if transceiver_info["vendor_rev"] is not None: + transceiver_info["hardware_rev"] = transceiver_info["vendor_rev"] + return transceiver_info except Exception as e: - print("Error: Exception info: %s" % (str(e))) - return None + print(traceback.format_exc()) - return eeprom_raw + def reset(self): + if self.get_presence() is False: + return False - def get_transceiver_bulk_status(self): - # check present status - if not self.get_presence(): - return None - self.__dom_capability_detect() + if self.sfp_type is None: + self.refresh_xcvr_api() - xcvr_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + if self.sfp_type == 'SFP': + self._sfplog(LOG_ERROR_LEVEL, 'SFP does not support reset') + return False - if self.is_osfp_port: - # Below part is added to avoid fail xcvrd, shall be implemented later - pass - elif self.is_qsfp_port: - # QSFPs - xcvr_dom_info_dict = super(Sfp, self).get_transceiver_bulk_status() + self._sfplog(LOG_DEBUG_LEVEL, 'resetting...') + ret = self._sfp_api.set_reset(True) + if ret: + time.sleep(0.5) + ret = self._sfp_api.set_reset(False) - # pddf_sfp "qsfp_tx_power_support != 'on'" is wrong + return ret - offset = 0 - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None + def get_lpmode(self): + if self.get_presence() is False: + return False - qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes((offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) - if qsfp_dom_rev_raw is not None: - qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) - else: - return None + if self.sfp_type is None: + self.refresh_xcvr_api() - dom_channel_monitor_data = {} - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] + if self.sfp_type == 'SFP': + self._sfplog(LOG_WARNING_LEVEL, 'SFP does not support lpmode') + return False - if (qsfp_dom_rev[0:8] == 'SFF-8636' and self.dom_tx_power_supported is True): - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( - dom_channel_monitor_raw, 0) - else: - return None + #implement in future - xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] - xcvr_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] - xcvr_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] - xcvr_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] - else: - # SFPs - offset = 256 - if not self.dom_supported: - return xcvr_dom_info_dict + return False - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None + def set_lpmode(self, lpmode): + if self.get_presence() is False: + return False - sfpd_obj._calibration_type = self.calibration + if self.sfp_type is None or self._xcvr_api is None: + self.refresh_xcvr_api() - dom_temperature_raw = self.__read_eeprom_specific_bytes((offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + if self.sfp_type == 'QSFP-DD': + return SfpOptoeBase.set_lpmode(self, lpmode) + elif self.sfp_type == 'QSFP': + if lpmode: + return self._xcvr_api.set_power_override(True, lpmode) else: - return None + return self._xcvr_api.set_power_override(False, lpmode) + else: + self._sfplog(LOG_WARNING_LEVEL, 'SFP does not support lpmode') + return False + + def set_optoe_write_max(self, write_max): + """ + This func is declared and implemented by SONiC but we're not supported + so override it as NotImplemented + """ + self._sfplog(LOG_DEBUG_LEVEL, "set_optoe_write_max NotImplemented") + pass + + def refresh_xcvr_api(self): + """ + Updates the XcvrApi associated with this SFP + """ + self._xcvr_api = self._xcvr_api_factory.create_xcvr_api() + class_name = self._xcvr_api.__class__.__name__ + optoe_type = None + # set sfp_type + if (class_name == 'CmisApi'): + self.sfp_type = 'QSFP-DD' + optoe_type = self.OPTOE_DRV_TYPE3 + elif (class_name == 'Sff8472Api'): + self.sfp_type = 'SFP' + optoe_type = self.OPTOE_DRV_TYPE2 + elif (class_name == 'Sff8636Api' or class_name == 'Sff8436Api'): + self.sfp_type = 'QSFP' + optoe_type = self.OPTOE_DRV_TYPE1 + + if optoe_type is not None: + # set optoe driver + self._sfp_api.set_optoe_type(optoe_type) + + def _sfplog(self, log_level, msg): + if log_level >= self.log_level_config: + try: + syslog.openlog("Sfp") + if log_level == LOG_DEBUG_LEVEL: + syslog.syslog(syslog.LOG_DEBUG, msg) + elif log_level == LOG_WARNING_LEVEL: + syslog.syslog(syslog.LOG_DEBUG, msg) + elif log_level == LOG_ERROR_LEVEL: + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + except Exception as e: + print(traceback.format_exc()) + +class SfpCust(): + def __init__(self, index): + self.eeprom_path = None + self._init_config(index) + + def _init_config(self, index): + sfp_config = get_sfp_config() + self.log_level_config = sfp_config.get("log_level", LOG_WARNING_LEVEL) + self._port_id = index + self.eeprom_retry_times = sfp_config.get("eeprom_retry_times", 0) + self.eeprom_retry_break_sec = sfp_config.get("eeprom_retry_break_sec", 0) + + def combine_format_str(self, str, key): + count_format = str.count('%') + if count_format > 0: + args_k = [] + for i in range(count_format): + args_k.append(key) + return str % (tuple(args_k)) + else: + return str - dom_voltage_raw = self.__read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - else: - return None + def _get_eeprom_path(self): + return self.eeprom_path or None - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value'] - xcvr_dom_info_dict['rx2power'] = 'N/A' - xcvr_dom_info_dict['rx3power'] = 'N/A' - xcvr_dom_info_dict['rx4power'] = 'N/A' - xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] - xcvr_dom_info_dict['tx2bias'] = 'N/A' - xcvr_dom_info_dict['tx3bias'] = 'N/A' - xcvr_dom_info_dict['tx4bias'] = 'N/A' - xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] - xcvr_dom_info_dict['tx2power'] = 'N/A' - xcvr_dom_info_dict['tx3power'] = 'N/A' - xcvr_dom_info_dict['tx4power'] = 'N/A' - - xcvr_dom_info_dict['rx_los'] = self.get_rx_los() - xcvr_dom_info_dict['tx_fault'] = self.get_tx_fault() - xcvr_dom_info_dict['reset_status'] = self.get_reset_status() - xcvr_dom_info_dict['lp_mode'] = self.get_lpmode() - - return xcvr_dom_info_dict - - def get_transceiver_threshold_info(self): - # check present status - if not self.get_presence(): - return None - self.__dom_capability_detect() - - xcvr_dom_threshold_info_dict = dict.fromkeys(self.threshold_dict_keys, 'N/A') - - if self.is_osfp_port: - # Below part is added to avoid fail xcvrd, shall be implemented later - pass - elif self.is_qsfp_port: - # QSFPs - if not self.dom_supported or not self.qsfp_page3_available: - return xcvr_dom_threshold_info_dict - - return super(Sfp, self).get_transceiver_threshold_info() + @abstractmethod + def get_presence(self): + pass - else: - # SFPs - if not self.dom_supported: - return xcvr_dom_threshold_info_dict + def read_eeprom(self, offset, num_bytes): + try: + for i in range(self.eeprom_retry_times): + with open(self._get_eeprom_path(), mode='rb', buffering=0) as f: + f.seek(offset) + result = f.read(num_bytes) + # temporary solution for a sonic202111 bug + if len(result) < num_bytes: + result = result[::-1].zfill(num_bytes)[::-1] + if result != None: + return bytearray(result) + else: + time.sleep(self.eeprom_retry_break_sec) + continue + + except Exception as e: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + return None - return super(Sfp, self).get_transceiver_threshold_info() - return xcvr_dom_threshold_info_dict + def write_eeprom(self, offset, num_bytes, write_buffer): + try: + for i in range(self.eeprom_retry_times): + ret = SfpOptoeBase.write_eeprom(self, offset, num_bytes, write_buffer) + if ret is False: + time.sleep(self.eeprom_retry_break_sec) + continue + break + + return ret + + except Exception as e: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + + @abstractmethod + def set_optoe_type(self, class_name): + pass + + @abstractmethod + def set_reset(self, reset): + pass + + def _convert_str_range_to_int_arr(self, range_str): + if not range_str: + return [] + + int_range_strs = range_str.split(',') + range_res = [] + for int_range_str in int_range_strs: + if '-' in int_range_str: + range_s = int(int_range_str.split('-')[0]) + range_e = int(int_range_str.split('-')[1]) + 1 + else: + range_s = int(int_range_str) + range_e = int(int_range_str) + 1 + + range_res = range_res + list(range(range_s, range_e)) + + return range_res + + def _sfplog(self, log_level, msg): + if log_level >= self.log_level_config: + try: + syslog.openlog("SfpCust") + if log_level == LOG_DEBUG_LEVEL: + syslog.syslog(syslog.LOG_DEBUG, msg) + elif log_level == LOG_WARNING_LEVEL: + syslog.syslog(syslog.LOG_DEBUG, msg) + elif log_level == LOG_ERROR_LEVEL: + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + except Exception as e: + print(traceback.format_exc()) + +class SfpV1(SfpCust): + def _init_config(self, index): + super()._init_config(index) + sfp_config = get_sfp_config() + + # init presence path + self.presence_cpld = sfp_config.get("presence_cpld", None) + self.presence_val_is_present = sfp_config.get("presence_val_is_present", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path") + + # init reset path + self.reset_cpld = sfp_config.get("reset_cpld", None) + self.reset_val_is_reset = sfp_config.get("reset_val_is_reset", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init cpld path") + + def get_presence(self): + if self.presence_cpld is None: + self._sfplog(LOG_ERROR_LEVEL, "presence_cpld is None!") + return False + try: + dev_id, offset, offset_bit = self._get_sfp_cpld_info(self.presence_cpld) + ret, info = platform_reg_read(0, dev_id, offset, 1) + return (info[0] & (1 << offset_bit) == self.presence_val_is_present) + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + def read_eeprom(self, offset, num_bytes): + try: + for i in range(self.eeprom_retry_times): + ret, info = platform_sfp_read(self._port_id, offset, num_bytes) + if (ret is False + or info is None): + time.sleep(self.eeprom_retry_break_sec) + continue + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + for n in range(0, len(info)): + eeprom_raw[n] = info[n] + # temporary solution for a sonic202111 bug + if len(eeprom_raw) < num_bytes: + eeprom_raw = eeprom_raw[::-1].zfill(num_bytes)[::-1] + return bytearray(eeprom_raw) + except Exception as e: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + return None + + def write_eeprom(self, offset, num_bytes, write_buffer): + try: + for i in range(self.eeprom_retry_times): + # TODO: write_buffer is bytearray, need to convert to int array + val_list = [] + if isinstance(write_buffer, list): + val_list = write_buffer + else: + val_list.append(write_buffer) + ret, info = platform_sfp_write(self._port_id, offset, val_list) + if ret is False: + time.sleep(self.eeprom_retry_break_sec) + continue + return True + except Exception as e: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + return False + + def set_optoe_type(self, optoe_type): + ret, info = platform_get_optoe_type(self._port_id) + if info != optoe_type: + try: + ret, _ = platform_set_optoe_type(self._port_id, optoe_type) + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, "Set optoe err %s" % err) + + def set_reset(self, reset): + if self.reset_cpld is None: + self._sfplog(LOG_ERROR_LEVEL, "reset_cpld is None!") + return False + try: + val = [] + dev_id, offset, offset_bit = self._get_sfp_cpld_info(self.reset_cpld) + ret, info = platform_reg_read(0, dev_id, offset, 1) + if self.reset_val_is_reset == 0: + if reset: + val.append(info[0] & (~(1 << offset_bit))) + else: + val.append(info[0] | (1 << offset_bit)) + else: + if reset: + val.append(info[0] | (1 << offset_bit)) + else: + val.append(info[0] & (~(1 << offset_bit))) + + ret, info = platform_reg_write(0, dev_id, offset, val) + if ret is False: + self._sfplog(LOG_ERROR_LEVEL, "platform_reg_write error!") + return False + + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + return False + + return True + + def _get_sfp_cpld_info(self, cpld_config): + dev_id = 0 + offset = 0 + + for dev_id_temp in cpld_config["dev_id"]: + for offset_temp in cpld_config["dev_id"][dev_id_temp]["offset"]: + port_range_str = cpld_config["dev_id"][dev_id_temp]["offset"][offset_temp] + port_range_int = self._convert_str_range_to_int_arr(port_range_str) + if self._port_id in port_range_int: + dev_id = dev_id_temp + offset = offset_temp + offset_bit = port_range_int.index(self._port_id) + break + + return dev_id, offset, offset_bit + +class SfpV2(SfpCust): + def _init_config(self, index): + super()._init_config(index) + sfp_config = get_sfp_config() + + # init eeprom path + eeprom_path_config = sfp_config.get("eeprom_path", None) + eeprom_path_key = sfp_config.get("eeprom_path_key")[self._port_id - 1] + self.eeprom_path = self.combine_format_str(eeprom_path_config, eeprom_path_key) + self._sfplog(LOG_DEBUG_LEVEL, "Done init eeprom path: %s" % self.eeprom_path) + + # init presence path + presence_path_config = sfp_config.get("presence_path", None) + presence_path_key = sfp_config.get("presence_path_key")[self._port_id - 1] + self.presence_path = self.combine_format_str(presence_path_config, presence_path_key) + self.presence_val_is_present = sfp_config.get("presence_val_is_present", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path: %s" % self.presence_path) + + # init optoe driver path + optoe_driver_path_config = sfp_config.get("optoe_driver_path", None) + optoe_driver_key = sfp_config.get("optoe_driver_key")[self._port_id - 1] + self.dev_class_path = self.combine_format_str(optoe_driver_path_config, optoe_driver_key) + self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path) + + # init txdisable path + txdisable_path_config = sfp_config.get("txdisable_path", None) + if txdisable_path_config is not None: + txdisable_path_key = sfp_config.get("txdisable_path_key")[self._port_id - 1] + self.txdisable_path = self.combine_format_str(txdisable_path_config, txdisable_path_key) + self.txdisable_val_is_on = sfp_config.get("txdisable_val_is_on", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path) + + # init reset path + reset_path_config = sfp_config.get("reset_path", None) + if reset_path_config is not None: + reset_path_key = sfp_config.get("reset_path_key")[self._port_id - 1] + self.reset_path = self.combine_format_str(reset_path_config, reset_path_key) + self.reset_val_is_on = sfp_config.get("reset_val_is_on", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init reset path: %s" % self.reset_path) + + def get_presence(self): + if self.presence_path is None: + self._sfplog(LOG_ERROR_LEVEL, "presence_path is None!") + return False + try: + with open(self.presence_path, "rb") as data: + sysfs_data = data.read(1) + if sysfs_data != "": + result = int(sysfs_data, 16) + return result == self.presence_val_is_present + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + def set_reset(self, reset): + return True + + def set_optoe_type(self, optoe_type): + if self.dev_class_path is None: + self._sfplog(LOG_ERROR_LEVEL, "dev_class_path is None!") + return False + try: + dc_file = open(self.dev_class_path, "r+") + dc_file_val = dc_file.read(1) + if int(dc_file_val) != optoe_type: + dc_str = "%s" % str(optoe_type) + dc_file.write(dc_str) + dc_file.close() + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp_config.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp_config.py new file mode 100644 index 000000000000..1bac5e80c719 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp_config.py @@ -0,0 +1,23 @@ +cust_sfp_cfg = { + 'x86_64-ragile_ra-b6510-32c-r0': { + "ver": '2.1', + "port_index_start": 0, + "port_num": 32, + "log_level": 2, + "eeprom_retry_times": 5, + "eeprom_retry_break_sec": 0.2, + "presence_path": "/sys/bus/i2c/devices/%d-0053/xcvr_present", + "presence_path_key": list(range(32, 64)), + "presence_val_is_present": 1, + "eeprom_path": "/sys/bus/i2c/devices/%d-0050/eeprom", + "eeprom_path_key": list(range(32, 64)), + "optoe_driver_path": "/sys/bus/i2c/devices/%d-0050/dev_class", + "optoe_driver_key": list(range(32, 64)), + "txdisable_path": "/sys/bus/i2c/devices/%d-0053/xcvr_txdisable", + "txdisable_path_key": list(range(32, 64)) , + "txdisable_val_is_on": 0, + "reset_path": "/sys/bus/i2c/devices/%d-0053/xcvr_reset", + "reset_path_key": list(range(32, 64)), + "reset_val_is_on": 0, + }, +} diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/thermal.py index 99b743c6d343..f2a73e5f5db8 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/thermal.py @@ -8,7 +8,7 @@ class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/Makefile b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/Makefile index 9e262d7c095e..bc2010b78e3f 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/Makefile +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/Makefile @@ -8,6 +8,9 @@ INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/ KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers +ifeq "5.10.0" "$(word 1, $(sort 5.10.0 $(KERNEL_VERSION)))" +KBUILD_EXTRA_SYMBOLS += $(PWD)/../../../pddf/i2c/Module.symvers.PDDF +endif export KBUILD_EXTRA_SYMBOLS all: diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/chassis.py index 9267a18f0b50..f179b279cc13 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/chassis.py @@ -7,37 +7,49 @@ try: import time from sonic_platform_pddf_base.pddf_chassis import PddfChassis - from rgutil.logutil import Logger - from sonic_py_common.general import getstatusoutput_noshell + from .component import Component + from sonic_platform.sfp import * + from .sfp_config import * except ImportError as e: raise ImportError(str(e) + "- required module not found") -PORT_START = 0 -PORT_END = 55 -PORTS_IN_BLOCK = 56 - -logger = Logger("CHASSIS", syslog=True) - class Chassis(PddfChassis): """ PDDF Platform-specific Chassis class """ - SFP_STATUS_INSERTED = "1" - SFP_STATUS_REMOVED = "0" - port_dict = {} + STATUS_INSERTED = "1" + STATUS_REMOVED = "0" + sfp_present_dict = {} def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + for i in range(0,3): + self._component_list.append(Component(i)) + + try: + self._sfp_list = [] + sfp_config = get_sfp_config() + self.port_start_index = sfp_config.get("port_index_start", 0) + self.port_num = sfp_config.get("port_num", 0) + # fix problem with first index is 1, we add a fake sfp node + if self.port_start_index == 1: + self._sfp_list.append(Sfp(1)) + + # sfp id always start at 1 + for index in range(1, self.port_num + 1): + self._sfp_list.append(Sfp(index)) + + for i in range(self.port_start_index, self.port_start_index + self.port_num): + self.sfp_present_dict[i] = self.STATUS_REMOVED - self.enable_read = ["i2cset", "-f", "-y", "2", "0x35", "0x2a", "0x01"] - self.disable_read = ["i2cset", "-f", "-y", "2", "0x35", "0x2a", "0x00"] - self.enable_write = ["i2cset", "-f", "-y", "2", "0x35", "0x2b", "0x00"] - self.disable_write = ["i2cset", "-f", "-y", "2", "0x35", "0x2b", "0x01"] - self.enable_erase = ["i2cset", "-f", "-y", "2", "0x35", "0x2c", "0x01"] - self.disable_erase = ["i2cset", "-f", "-y", "2", "0x35", "0x2c", "0x00"] - self.read_value = ["i2cget", "-f", "-y", "2", "0x35", "0x25"] - self.write_value = ["i2cset", "-f", "-y", "2", "0x35", "0x21", "0x0a"] + except Exception as err: + print("SFP init error: %s" % str(err)) + + def get_revision(self): + val = ord(self._eeprom.revision_str()) + test = "{}".format(val) + return test def get_reboot_cause(self): """ @@ -49,47 +61,13 @@ def get_reboot_cause(self): is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used to pass a description of the reboot cause. """ - try: - is_power_loss = False - # enable read - getstatusoutput_noshell(self.disable_write) - getstatusoutput_noshell(self.enable_read) - ret, log = getstatusoutput_noshell(self.read_value) - if ret == 0 and "0x0a" in log: - is_power_loss = True - - # erase i2c and e2 - getstatusoutput_noshell(self.enable_erase) - time.sleep(1) - getstatusoutput_noshell(self.disable_erase) - # clear data - getstatusoutput_noshell(self.enable_write) - getstatusoutput_noshell(self.disable_read) - getstatusoutput_noshell(self.disable_write) - getstatusoutput_noshell(self.enable_read) - # enable write and set data - getstatusoutput_noshell(self.enable_write) - getstatusoutput_noshell(self.disable_read) - getstatusoutput_noshell(self.write_value) - if is_power_loss: - return(self.REBOOT_CAUSE_POWER_LOSS, None) - except Exception as e: - logger.error(str(e)) return (self.REBOOT_CAUSE_NON_HARDWARE, None) def get_change_event(self, timeout=0): - change_event_dict = {"fan": {}, "sfp": {}} - sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout) - change_event_dict["sfp"] = sfp_change_dict - if sfp_status is True: - return True, change_event_dict + change_event_dict = {"sfp": {}} - return False, {} - - def get_transceiver_change_event(self, timeout=0): start_time = time.time() - currernt_port_dict = {} forever = False if timeout == 0: @@ -97,25 +75,23 @@ def get_transceiver_change_event(self, timeout=0): elif timeout > 0: timeout = timeout / float(1000) # Convert to secs else: - print("get_transceiver_change_event:Invalid timeout value", timeout) - return False, {} + print("get_change_event:Invalid timeout value", timeout) + return False, change_event_dict end_time = start_time + timeout if start_time > end_time: print( - "get_transceiver_change_event:" "time wrap / invalid timeout value", + "get_change_event:" "time wrap / invalid timeout value", timeout, ) - return False, {} # Time wrap or possibly incorrect timeout - - while timeout >= 0: - # Check for OIR events and return updated port_dict - for index in range(PORT_START, PORTS_IN_BLOCK): - if self._sfp_list[index].get_presence(): - currernt_port_dict[index] = self.SFP_STATUS_INSERTED - else: - currernt_port_dict[index] = self.SFP_STATUS_REMOVED - if currernt_port_dict == self.port_dict: + return False, change_event_dict # Time wrap or possibly incorrect timeout + try: + while timeout >= 0: + # check for sfp + sfp_change_dict = self.get_transceiver_change_event() + if sfp_change_dict : + change_event_dict["sfp"] = sfp_change_dict + return True, change_event_dict if forever: time.sleep(1) else: @@ -125,11 +101,34 @@ def get_transceiver_change_event(self, timeout=0): else: if timeout > 0: time.sleep(timeout) - return True, {} + return True, change_event_dict + except Exception as e: + print(e) + print("get_change_event: Should not reach here.") + return False, change_event_dict + + def get_transceiver_change_event(self): + cur_sfp_present_dict = {} + ret_dict = {} + + # Check for OIR events and return ret_dict + for i in range(self.port_start_index, self.port_start_index + self.port_num): + sfp = self._sfp_list[i] + if sfp.get_presence(): + cur_sfp_present_dict[i] = self.STATUS_INSERTED + else: - # Update reg value - self.port_dict = currernt_port_dict - print(self.port_dict) - return True, self.port_dict - print("get_transceiver_change_event: Should not reach here.") - return False, {} + cur_sfp_present_dict[i] = self.STATUS_REMOVED + + # Update reg value + if cur_sfp_present_dict == self.sfp_present_dict: + return ret_dict + + for index, status in cur_sfp_present_dict.items(): + if self.sfp_present_dict[index] != status: + ret_dict[index] = status + + self.sfp_present_dict = cur_sfp_present_dict + + return ret_dict + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/component.py index 1d171a58e435..0fd19ccf99b5 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/component.py @@ -9,22 +9,52 @@ try: from sonic_platform_base.component_base import ComponentBase - from sonic_platform.regutil import Reg - from sonic_platform.logger import logger from sonic_py_common.general import getstatusoutput_noshell + import sonic_platform.hwaccess as hwaccess except ImportError as e: raise ImportError(str(e) + "- required module not found") +def get_cpld_version(bus, i2caddr): + return '{}{}{}{}'.format(hwaccess.i2c_get(bus, i2caddr, 1), + hwaccess.i2c_get(bus, i2caddr, 2), + hwaccess.i2c_get(bus, i2caddr, 3), + hwaccess.i2c_get(bus, i2caddr, 0) + ) + +def get_cpu_cpld_version(): + return get_cpld_version(0, 0x0d) + +def get_cpld1_version(): + return get_cpld_version(2, 0x33) + +def get_cpld2_version(): + return get_cpld_version(2, 0x35) + +COMPONENT_LIST= [ + ['CPU CPLD', + 'cpu board', + get_cpu_cpld_version + ], + + ['MAC1 CPLD', + 'mac1 board', + get_cpld1_version + ], + + ['MAC2 CPLD', + 'mac2 board', + get_cpld2_version + ] + ] + + class Component(ComponentBase): """ Ragile Platform-specific Component class""" - def __init__(self, index, config=None): - self.index = index - self.name = config.get("name") - self._reg_fm_ver = Reg(config.get("firmware_version")) - self.description = config.get("desc") - self.slot = config.get("slot") + def __init__(self, component_index=0): + ComponentBase.__init__(self) + self.index = component_index def get_name(self): """ @@ -33,7 +63,7 @@ def get_name(self): Returns: A string containing the name of the component """ - return self.name + return COMPONENT_LIST[self.index][0] def get_description(self): """ @@ -42,7 +72,7 @@ def get_description(self): Returns: A string containing the description of the component """ - return self.description + return COMPONENT_LIST[self.index][1] def get_firmware_version(self): """ @@ -51,12 +81,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - try: - return self._reg_fm_ver.decode() - except Exception as e: - logger.error(str(e)) - - return "" + return COMPONENT_LIST[self.index][2]() def install_firmware(self, image_path): """ diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/fan_drawer.py index 4ff45cb81297..d03fd656f4d7 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/fan_drawer.py @@ -1,71 +1,17 @@ -# -# fan_drawer_base.py -# -# Abstract base class for implementing a platform-specific class with which -# to interact with a fan drawer module in SONiC -# +#!/usr/bin/env python + try: - from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer except ImportError as e: raise ImportError(str(e) + "- required module not found") -class FanDrawer(FanDrawerBase): - """ - Abstract base class for interfacing with a fan drawer - """ - # Device type definition. Note, this is a constant. - DEVICE_TYPE = "fan_drawer" - - def __init__(self, index, fan_list): - FanDrawerBase.__init__(self) - - self._fan_list = fan_list - self._index = index - - def get_name(self): - """ - Retrieves the name of the device - Returns: - string: The name of the device - """ - - return "fan {}".format(self._index) - - def get_num_fans(self): - """ - Retrieves the number of fans available on this fan drawer - Returns: - An integer, the number of fan modules available on this fan drawer - """ - return len(self._fan_list) - - def get_all_fans(self): - """ - Retrieves all fan modules available on this fan drawer - Returns: - A list of objects derived from FanBase representing all fan - modules available on this fan drawer - """ - return self._fan_list - - def set_status_led(self, color): - """ - Sets the state of the fan drawer status LED - Args: - color: A string representing the color with which to set the - fan drawer status LED - Returns: - bool: True if status LED state is set successfully, False if not - """ - return self._fan_list[self._index].set_status_led(color) +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" - def get_status_led(self, color): - """ - Gets the state of the fan drawer LED - Returns: - A string, one of the predefined STATUS_LED_COLOR_* strings above - """ - return self._fan_list[self._index].get_status_led(color) + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + # Provide the functions/variables below for which implementation is to be overwritten \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/hwaccess.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/hwaccess.py new file mode 100755 index 000000000000..c604d9c61164 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/hwaccess.py @@ -0,0 +1,47 @@ +# Helper functions to access hardware + +import os +import struct +import mmap +import subprocess + +# Read PCI device + +def pci_mem_read(mm, offset): + mm.seek(offset) + read_data_stream = mm.read(4) + return struct.unpack('I',read_data_stream)[0] + +def pci_get_value(resource, offset): + with open(resource, 'r+b') as fd: + mm = mmap.mmap(fd.fileno(), 0) + val = pci_mem_read(mm, offset) + mm.close() + return val + +def pci_mem_write(memmap, offset, data): + """ Write PCI device """ + memmap.seek(offset) + memmap.write(struct.pack('I', data)) + +def pci_set_value(resource, val, offset): + """ Set a value to PCI device """ + with open(resource, 'w+b') as filed: + memmap = None + try: + memmap = mmap.mmap(filed.fileno(), 0) + pci_mem_write(memmap, offset, val) + except EnvironmentError: + pass + if memmap is not None: + memmap.close() + +# Read I2C device + +def i2c_get(bus, i2caddr, ofs): + try: + valx = int(subprocess.check_output(['/usr/sbin/i2cget','-f', '-y', str(bus), str(i2caddr), str(ofs)]), 16) + return "{:02x}".format(valx) + except (FileNotFoundError, subprocess.CalledProcessError): + return -1 + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/platform.py index 8595e80692df..6ff9446b951c 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/platform.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/platform.py @@ -5,7 +5,6 @@ # ############################################################################# - try: from sonic_platform_pddf_base.pddf_platform import PddfPlatform except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/psu.py index 240af5d2d1b5..71eacf763ff1 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/psu.py @@ -1,5 +1,7 @@ try: from sonic_platform_pddf_base.pddf_psu import PddfPsu + from sonic_py_common.general import getstatusoutput_noshell + import time except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -29,4 +31,74 @@ def get_type(self): A string, the type of PSU (AC/DC) """ return "DC" + + def runcmd(self, cmd): + time_retry = 6 + result_msg = "" + time_delay = 0.01 + while time_retry: + try: + val, result_msg = getstatusoutput_noshell(cmd.split(" ")) + if val is False: + time_retry -=1 + time.sleep(time_delay) + continue + else: + return val, result_msg + except Exception as e: + time_retry -= 1 + result_msg = str(e) + time.sleep(time_delay) + + return False, result_msg + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + + v_out = 0 + label_t = "psu_v_out" + device = "PSU{}".format(self.psu_index) + #print(device) + pddf_obj_data = self.pddf_obj.data + + if device in pddf_obj_data.keys(): + pmbusloc = pddf_obj_data[device]['i2c']['interface'] + + for val in pmbusloc: + dev_name = val['dev'] + pmbus_loc = pddf_obj_data[dev_name] + i2cloc = pmbus_loc['i2c']['attr_list'] + parentbus = pmbus_loc['i2c']['topo_info'] + + for item_t in i2cloc: + if item_t['attr_name'] == label_t: + parentbus_id = int(parentbus['parent_bus'], 16) + vout_mode_cmd = "i2cget -f -y {} {} 0x20 bp".format(parentbus_id, parentbus['dev_addr']) + ret_t, val_voutmode = self.runcmd(vout_mode_cmd) + if ret_t is False: + return 0.0 + v_out_cmd = "i2cget -f -y {} {} {} wp".format(parentbus_id, parentbus['dev_addr'], item_t['attr_offset']) + ret_t, val_p_out = self.runcmd(v_out_cmd) + if ret_t is False: + return 0.0 + val_voutmode_t = int(val_voutmode, 16) + val_p_out_t = int(val_p_out, 16) * 1000 + + import ctypes + val_voutmode_t_t = ctypes.c_int8(val_voutmode_t << 3).value >>3 + + if (val_voutmode_t_t) < 0: + val_p_out_t_f = val_p_out_t>> (-val_voutmode_t_t) + else: + val_p_out_t_f = val_p_out_t << val_voutmode_t_t + + return float(val_p_out_t_f)/1000 + + return float(v_out)/1000 diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp.py index a216a37afcf8..c1d4cb998a6e 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp.py @@ -1,15 +1,525 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +# +# *_device.py config version instruction: +# ver 1.0 - platform api: +# "presence_cpld": { +# "dev_id": { +# [dev_id]: { +# "offset": { +# [offset]: [port_id] +# } +# } +# } +# } +# "reset_cpld": { +# "dev_id": { +# [dev_id]: { +# "offset": { +# [offset]: [port_id] +# } +# } +# } +# } +# ver 2.0 - rg_plat: +# "presence_path": "/xx/rg_plat/xx[port_id]/present" +# "eeprom_path": "/sys/bus/i2c/devices/i2c-[bus]/[bus]-0050/eeprom" +# "reset_path": "/xx/rg_plat/xx[port_id]/reset" +############################################################################# +import sys +import time +import syslog +import traceback +from abc import abstractmethod + try: - from sonic_platform_pddf_base.pddf_sfp import PddfSfp + import os + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from .sfp_config import * + except ImportError as e: raise ImportError (str(e) + "- required module not found") +LOG_DEBUG_LEVEL = 1 +LOG_WARNING_LEVEL = 2 +LOG_ERROR_LEVEL = 3 + +CONFIG_DB_PATH = "/etc/sonic/config_db.json" + +def getonieplatform(path): + if not os.path.isfile(path): + return "" + machine_vars = {} + with open(path) as machine_file: + for line in machine_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + machine_vars[tokens[0]] = tokens[1].strip() + return machine_vars.get("onie_platform") + +def getplatform_config_db(): + if not os.path.isfile(CONFIG_DB_PATH): + return "" + val = os.popen("sonic-cfggen -j %s -v DEVICE_METADATA.localhost.platform" % CONFIG_DB_PATH).read().strip() + if len(val) <= 0: + return "" + else: + return val + +def getplatform_name(): + if os.path.isfile('/host/machine.conf'): + return getonieplatform('/host/machine.conf') + elif os.path.isfile('/usr/share/sonic/hwsku/machine.conf'): + return getonieplatform('/usr/share/sonic/hwsku/machine.conf') + else: + return getplatform_config_db() + +def get_sfp_config(): + dev = getplatform_name() + return cust_sfp_cfg.get(dev, None) + +class Sfp(SfpOptoeBase): + + OPTOE_DRV_TYPE1 = 1 + OPTOE_DRV_TYPE2 = 2 + OPTOE_DRV_TYPE3 = 3 + + # index must start at 1 + def __init__(self, index, a=None, b=None): + SfpOptoeBase.__init__(self) + self.sfp_type = None + sfp_config = get_sfp_config() + self.log_level_config = sfp_config.get("log_level", LOG_WARNING_LEVEL) + # Init instance of SfpCust + ver = sfp_config.get("ver", None) + if ver is None: + self._sfplog(LOG_ERROR_LEVEL, "Get Ver Config Error!") + vers = int(float(ver)) + if vers == 1: + self._sfp_api = SfpV1(index) + elif vers == 2: + self._sfp_api = SfpV2(index) + else: + self._sfplog(LOG_ERROR_LEVEL, "Get SfpVer Error!") + + def get_eeprom_path(self): + return self._sfp_api._get_eeprom_path() + + def read_eeprom(self, offset, num_bytes): + return self._sfp_api.read_eeprom(offset, num_bytes) + + def write_eeprom(self, offset, num_bytes, write_buffer): + return self._sfp_api.write_eeprom(offset, num_bytes, write_buffer) + + def get_presence(self): + return self._sfp_api.get_presence() + + def get_transceiver_info(self): + # temporary solution for a sonic202111 bug + transceiver_info = super().get_transceiver_info() + try: + if transceiver_info["vendor_rev"] is not None: + transceiver_info["hardware_rev"] = transceiver_info["vendor_rev"] + return transceiver_info + except Exception as e: + print(traceback.format_exc()) + + def reset(self): + if self.get_presence() is False: + return False + + if self.sfp_type is None: + self.refresh_xcvr_api() + + if self.sfp_type == 'SFP': + self._sfplog(LOG_ERROR_LEVEL, 'SFP does not support reset') + return False + + self._sfplog(LOG_DEBUG_LEVEL, 'resetting...') + ret = self._sfp_api.set_reset(True) + if ret: + time.sleep(0.5) + ret = self._sfp_api.set_reset(False) + + return ret + + def get_lpmode(self): + if self.get_presence() is False: + return False + + if self.sfp_type is None: + self.refresh_xcvr_api() + + if self.sfp_type == 'SFP': + self._sfplog(LOG_WARNING_LEVEL, 'SFP does not support lpmode') + return False + + #implement in future + + return False + + def set_lpmode(self, lpmode): + if self.get_presence() is False: + return False + + if self.sfp_type is None or self._xcvr_api is None: + self.refresh_xcvr_api() + + if self.sfp_type == 'QSFP-DD': + return SfpOptoeBase.set_lpmode(self, lpmode) + elif self.sfp_type == 'QSFP': + if lpmode: + return self._xcvr_api.set_power_override(True, lpmode) + else: + return self._xcvr_api.set_power_override(False, lpmode) + else: + self._sfplog(LOG_WARNING_LEVEL, 'SFP does not support lpmode') + return False + + def set_optoe_write_max(self, write_max): + """ + This func is declared and implemented by SONiC but we're not supported + so override it as NotImplemented + """ + self._sfplog(LOG_DEBUG_LEVEL, "set_optoe_write_max NotImplemented") + pass + + def refresh_xcvr_api(self): + """ + Updates the XcvrApi associated with this SFP + """ + self._xcvr_api = self._xcvr_api_factory.create_xcvr_api() + class_name = self._xcvr_api.__class__.__name__ + optoe_type = None + # set sfp_type + if (class_name == 'CmisApi'): + self.sfp_type = 'QSFP-DD' + optoe_type = self.OPTOE_DRV_TYPE3 + elif (class_name == 'Sff8472Api'): + self.sfp_type = 'SFP' + optoe_type = self.OPTOE_DRV_TYPE2 + elif (class_name == 'Sff8636Api' or class_name == 'Sff8436Api'): + self.sfp_type = 'QSFP' + optoe_type = self.OPTOE_DRV_TYPE1 + + if optoe_type is not None: + # set optoe driver + self._sfp_api.set_optoe_type(optoe_type) + + def _sfplog(self, log_level, msg): + if log_level >= self.log_level_config: + try: + syslog.openlog("Sfp") + if log_level == LOG_DEBUG_LEVEL: + syslog.syslog(syslog.LOG_DEBUG, msg) + elif log_level == LOG_WARNING_LEVEL: + syslog.syslog(syslog.LOG_DEBUG, msg) + elif log_level == LOG_ERROR_LEVEL: + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + except Exception as e: + print(traceback.format_exc()) + +class SfpCust(): + def __init__(self, index): + self.eeprom_path = None + self._init_config(index) + + def _init_config(self, index): + sfp_config = get_sfp_config() + self.log_level_config = sfp_config.get("log_level", LOG_WARNING_LEVEL) + self._port_id = index + self.eeprom_retry_times = sfp_config.get("eeprom_retry_times", 0) + self.eeprom_retry_break_sec = sfp_config.get("eeprom_retry_break_sec", 0) + + def combine_format_str(self, str, key): + count_format = str.count('%') + if count_format > 0: + args_k = [] + for i in range(count_format): + args_k.append(key) + return str % (tuple(args_k)) + else: + return str + + def _get_eeprom_path(self): + return self.eeprom_path or None + + @abstractmethod + def get_presence(self): + pass + + def read_eeprom(self, offset, num_bytes): + try: + for i in range(self.eeprom_retry_times): + with open(self._get_eeprom_path(), mode='rb', buffering=0) as f: + f.seek(offset) + result = f.read(num_bytes) + # temporary solution for a sonic202111 bug + if len(result) < num_bytes: + result = result[::-1].zfill(num_bytes)[::-1] + if result != None: + return bytearray(result) + else: + time.sleep(self.eeprom_retry_break_sec) + continue + + except Exception as e: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + return None + + + def write_eeprom(self, offset, num_bytes, write_buffer): + try: + for i in range(self.eeprom_retry_times): + ret = SfpOptoeBase.write_eeprom(self, offset, num_bytes, write_buffer) + if ret is False: + time.sleep(self.eeprom_retry_break_sec) + continue + break + + return ret + + except Exception as e: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + + @abstractmethod + def set_optoe_type(self, class_name): + pass + + @abstractmethod + def set_reset(self, reset): + pass + + def _convert_str_range_to_int_arr(self, range_str): + if not range_str: + return [] + + int_range_strs = range_str.split(',') + range_res = [] + for int_range_str in int_range_strs: + if '-' in int_range_str: + range_s = int(int_range_str.split('-')[0]) + range_e = int(int_range_str.split('-')[1]) + 1 + else: + range_s = int(int_range_str) + range_e = int(int_range_str) + 1 + + range_res = range_res + list(range(range_s, range_e)) + + return range_res + + def _sfplog(self, log_level, msg): + if log_level >= self.log_level_config: + try: + syslog.openlog("SfpCust") + if log_level == LOG_DEBUG_LEVEL: + syslog.syslog(syslog.LOG_DEBUG, msg) + elif log_level == LOG_WARNING_LEVEL: + syslog.syslog(syslog.LOG_DEBUG, msg) + elif log_level == LOG_ERROR_LEVEL: + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + except Exception as e: + print(traceback.format_exc()) + +class SfpV1(SfpCust): + def _init_config(self, index): + super()._init_config(index) + sfp_config = get_sfp_config() + + # init presence path + self.presence_cpld = sfp_config.get("presence_cpld", None) + self.presence_val_is_present = sfp_config.get("presence_val_is_present", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path") + + # init reset path + self.reset_cpld = sfp_config.get("reset_cpld", None) + self.reset_val_is_reset = sfp_config.get("reset_val_is_reset", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init cpld path") + + def get_presence(self): + if self.presence_cpld is None: + self._sfplog(LOG_ERROR_LEVEL, "presence_cpld is None!") + return False + try: + dev_id, offset, offset_bit = self._get_sfp_cpld_info(self.presence_cpld) + ret, info = platform_reg_read(0, dev_id, offset, 1) + return (info[0] & (1 << offset_bit) == self.presence_val_is_present) + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + def read_eeprom(self, offset, num_bytes): + try: + for i in range(self.eeprom_retry_times): + ret, info = platform_sfp_read(self._port_id, offset, num_bytes) + if (ret is False + or info is None): + time.sleep(self.eeprom_retry_break_sec) + continue + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + for n in range(0, len(info)): + eeprom_raw[n] = info[n] + # temporary solution for a sonic202111 bug + if len(eeprom_raw) < num_bytes: + eeprom_raw = eeprom_raw[::-1].zfill(num_bytes)[::-1] + return bytearray(eeprom_raw) + except Exception as e: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + return None + + def write_eeprom(self, offset, num_bytes, write_buffer): + try: + for i in range(self.eeprom_retry_times): + # TODO: write_buffer is bytearray, need to convert to int array + val_list = [] + if isinstance(write_buffer, list): + val_list = write_buffer + else: + val_list.append(write_buffer) + ret, info = platform_sfp_write(self._port_id, offset, val_list) + if ret is False: + time.sleep(self.eeprom_retry_break_sec) + continue + return True + except Exception as e: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + + return False + + def set_optoe_type(self, optoe_type): + ret, info = platform_get_optoe_type(self._port_id) + if info != optoe_type: + try: + ret, _ = platform_set_optoe_type(self._port_id, optoe_type) + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, "Set optoe err %s" % err) + + def set_reset(self, reset): + if self.reset_cpld is None: + self._sfplog(LOG_ERROR_LEVEL, "reset_cpld is None!") + return False + try: + val = [] + dev_id, offset, offset_bit = self._get_sfp_cpld_info(self.reset_cpld) + ret, info = platform_reg_read(0, dev_id, offset, 1) + if self.reset_val_is_reset == 0: + if reset: + val.append(info[0] & (~(1 << offset_bit))) + else: + val.append(info[0] | (1 << offset_bit)) + else: + if reset: + val.append(info[0] | (1 << offset_bit)) + else: + val.append(info[0] & (~(1 << offset_bit))) + + ret, info = platform_reg_write(0, dev_id, offset, val) + if ret is False: + self._sfplog(LOG_ERROR_LEVEL, "platform_reg_write error!") + return False + + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) + return False + + return True + + def _get_sfp_cpld_info(self, cpld_config): + dev_id = 0 + offset = 0 + + for dev_id_temp in cpld_config["dev_id"]: + for offset_temp in cpld_config["dev_id"][dev_id_temp]["offset"]: + port_range_str = cpld_config["dev_id"][dev_id_temp]["offset"][offset_temp] + port_range_int = self._convert_str_range_to_int_arr(port_range_str) + if self._port_id in port_range_int: + dev_id = dev_id_temp + offset = offset_temp + offset_bit = port_range_int.index(self._port_id) + break + + return dev_id, offset, offset_bit + +class SfpV2(SfpCust): + def _init_config(self, index): + super()._init_config(index) + sfp_config = get_sfp_config() + + # init eeprom path + eeprom_path_config = sfp_config.get("eeprom_path", None) + eeprom_path_key = sfp_config.get("eeprom_path_key")[self._port_id - 1] + self.eeprom_path = self.combine_format_str(eeprom_path_config, eeprom_path_key) + self._sfplog(LOG_DEBUG_LEVEL, "Done init eeprom path: %s" % self.eeprom_path) + + # init presence path + presence_path_config = sfp_config.get("presence_path", None) + presence_path_key = sfp_config.get("presence_path_key")[self._port_id - 1] + self.presence_path = self.combine_format_str(presence_path_config, presence_path_key) + self.presence_val_is_present = sfp_config.get("presence_val_is_present", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path: %s" % self.presence_path) + + # init optoe driver path + optoe_driver_path_config = sfp_config.get("optoe_driver_path", None) + optoe_driver_key = sfp_config.get("optoe_driver_key")[self._port_id - 1] + self.dev_class_path = self.combine_format_str(optoe_driver_path_config, optoe_driver_key) + self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path) + + # init txdisable path + txdisable_path_config = sfp_config.get("txdisable_path", None) + if txdisable_path_config is not None: + txdisable_path_key = sfp_config.get("txdisable_path_key")[self._port_id - 1] + self.txdisable_path = self.combine_format_str(txdisable_path_config, txdisable_path_key) + self.txdisable_val_is_on = sfp_config.get("txdisable_val_is_on", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path) + + # init reset path + reset_path_config = sfp_config.get("reset_path", None) + if reset_path_config is not None: + reset_path_key = sfp_config.get("reset_path_key")[self._port_id - 1] + self.reset_path = self.combine_format_str(reset_path_config, reset_path_key) + self.reset_val_is_on = sfp_config.get("reset_val_is_on", 0) + self._sfplog(LOG_DEBUG_LEVEL, "Done init reset path: %s" % self.reset_path) -class Sfp(PddfSfp): - """ - PDDF Platform-Specific Sfp class - """ + def get_presence(self): + if self.presence_path is None: + self._sfplog(LOG_ERROR_LEVEL, "presence_path is None!") + return False + try: + with open(self.presence_path, "rb") as data: + sysfs_data = data.read(1) + if sysfs_data != "": + result = int(sysfs_data, 16) + return result == self.presence_val_is_present + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + def set_reset(self, reset): + return True - # Provide the functions/variables below for which implementation is to be overwritten + def set_optoe_type(self, optoe_type): + if self.dev_class_path is None: + self._sfplog(LOG_ERROR_LEVEL, "dev_class_path is None!") + return False + try: + dc_file = open(self.dev_class_path, "r+") + dc_file_val = dc_file.read(1) + if int(dc_file_val) != optoe_type: + dc_str = "%s" % str(optoe_type) + dc_file.write(dc_str) + dc_file.close() + except Exception as err: + self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config.py new file mode 100644 index 000000000000..d468912fdda3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config.py @@ -0,0 +1,23 @@ +cust_sfp_cfg = { + 'x86_64-ragile_ra-b6510-48v8c-r0': { + "ver": '2.1', + "port_index_start": 0, + "port_num": 56, + "log_level": 2, + "eeprom_retry_times": 5, + "eeprom_retry_break_sec": 0.2, + "presence_path": "/sys/bus/i2c/devices/%d-0053/xcvr_present", + "presence_path_key": list(range(11, 67)), + "presence_val_is_present": 1, + "eeprom_path": "/sys/bus/i2c/devices/%d-0050/eeprom", + "eeprom_path_key": list(range(11, 67)), + "optoe_driver_path": "/sys/bus/i2c/devices/%d-0050/dev_class", + "optoe_driver_key": list(range(11, 67)), + "txdisable_path": "/sys/bus/i2c/devices/%d-0053/xcvr_txdisable", + "txdisable_path_key": list(range(11, 59)) + [0] * 8, + "txdisable_val_is_on": 0, + "reset_path": "/sys/bus/i2c/devices/%d-0053/xcvr_reset", + "reset_path_key": [0]* 48 + list(range(59, 67)), + "reset_val_is_on": 0, + }, +} diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/thermal.py index 99b743c6d343..f2a73e5f5db8 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/thermal.py @@ -8,7 +8,7 @@ class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/Makefile b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/Makefile index 9e262d7c095e..bc2010b78e3f 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/Makefile +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/Makefile @@ -8,6 +8,9 @@ INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/ KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers +ifeq "5.10.0" "$(word 1, $(sort 5.10.0 $(KERNEL_VERSION)))" +KBUILD_EXTRA_SYMBOLS += $(PWD)/../../../pddf/i2c/Module.symvers.PDDF +endif export KBUILD_EXTRA_SYMBOLS all: diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/setup.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/setup.py index 0ed22d770626..bfa58a02c777 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/setup.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/setup.py @@ -13,7 +13,8 @@ packages=[ 'sonic_platform', 'rgutil', - 'eepromutil' + 'eepromutil', + 'sonic_pcie' ], classifiers=[ 'Development Status :: 3 - Alpha', diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_pcie/__init__.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_pcie/__init__.py new file mode 100644 index 000000000000..73e2a89c8d74 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_pcie/__init__.py @@ -0,0 +1 @@ +__all__ = ["pcie_common"] \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_pcie/pcie_common.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_pcie/pcie_common.py new file mode 100644 index 000000000000..56e9d8664a23 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_pcie/pcie_common.py @@ -0,0 +1,107 @@ +# pcie_common.py +# Common PCIE check interfaces for SONIC +# + +import os +import yaml +import subprocess +import re +import sys +from copy import deepcopy +try: + from .pcie import PcieBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PcieUtil(PcieBase): + """Platform-specific PCIEutil class""" + # got the config file path + def __init__(self, path): + self.config_path = path + + # load the config file + def load_config_file(self): + config_file = self.config_path + "/" + "pcie.yaml" + try: + with open(config_file) as conf_file: + self.confInfo = yaml.load(conf_file) + except IOError as e: + print("Error: {}".format(str(e))) + print("Not found config file, please add a config file manually, or generate it by running [pcieutil pcie_generate]") + sys.exit() + + # load current PCIe device + def get_pcie_device(self): + pciDict = {} + pciList = [] + p1 = "^(\w+):(\w+)\.(\w)\s(.*)\s*\(*.*\)*" + p2 = "^.*:.*:.*:(\w+)\s*\(*.*\)*" + command1 = "sudo lspci" + command2 = "sudo lspci -n" + # run command 1 + proc1 = subprocess.Popen(command1, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + output1 = proc1.stdout.readlines() + proc1.communicate() + # run command 2 + proc2 = subprocess.Popen(command2, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + output2 = proc2.stdout.readlines() + proc2.communicate() + + if proc1.returncode > 0: + for line1 in output1: + print(line1.strip()) + return + elif proc2.returncode > 0: + for line2 in output2: + print(line2.strip()) + return + else: + for (line1, line2) in zip(output1, output2): + pciDict.clear() + match1 = re.search(p1, line1.strip()) + match2 = re.search(p2, line2.strip()) + if match1 and match2: + Bus = match1.group(1) + Dev = match1.group(2) + Fn = match1.group(3) + Name = match1.group(4) + Id = match2.group(1) + pciDict["name"] = Name + pciDict["bus"] = Bus + pciDict["dev"] = Dev + pciDict["fn"] = Fn + pciDict["id"] = Id + pciList.append(pciDict) + pciDict = deepcopy(pciDict) + else: + print("CAN NOT MATCH PCIe DEVICE") + return pciList + + # check the sysfs tree for each PCIe device + def check_pcie_sysfs(self, domain=0, bus=0, device=0, func=0): + dev_path = os.path.join('/sys/bus/pci/devices', '%04x:%02x:%02x.%d' % (domain, bus, device, func)) + if os.path.exists(dev_path): + return True + return False + + # check the current PCIe device with config file and return the result + def get_pcie_check(self): + self.load_config_file() + for item_conf in self.confInfo: + bus_conf = item_conf["bus"] + dev_conf = item_conf["dev"] + fn_conf = item_conf["fn"] + if self.check_pcie_sysfs(bus=int(bus_conf, base=16), device=int(dev_conf, base=16), func=int(fn_conf, base=16)): + item_conf["result"] = "Passed" + else: + item_conf["result"] = "Failed" + return self.confInfo + + # generate the config file with current pci device + def dump_conf_yaml(self): + curInfo = self.get_pcie_device() + with open(self.config_path + "/" + "pcie.yaml", "w") as conf_file: + yaml.dump(curInfo, conf_file, default_flow_style=False) + return + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/chassis.py index 396a96420e21..22f6202c5c52 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/chassis.py @@ -9,16 +9,14 @@ try: import time from sonic_platform_pddf_base.pddf_chassis import PddfChassis - from rgutil.logutil import Logger + #from rgutil.logutil import Logger from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError(str(e) + "- required module not found") PORT_START = 0 -PORT_END = 55 PORTS_IN_BLOCK = 56 - -logger = Logger("CHASSIS", syslog=True) +FAN_NUM_PER_DRAWER = 1 class Chassis(PddfChassis): """ @@ -32,14 +30,10 @@ class Chassis(PddfChassis): def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfChassis.__init__(self, pddf_data, pddf_plugin_data) - self.enable_read = ["i2cset", "-f", "-y", "2", "0x35", "0x2a", "0x01"] - self.disable_read = ["i2cset", "-f", "-y", "2", "0x35", "0x2a", "0x00"] - self.enable_write = ["i2cset", "-f", "-y", "2", "0x35", "0x2b", "0x00"] - self.disable_write = ["i2cset", "-f", "-y", "2", "0x35", "0x2b", "0x01"] - self.enable_erase = ["i2cset", "-f", "-y", "2", "0x35", "0x2c", "0x01"] - self.disable_erase = ["i2cset", "-f", "-y", "2", "0x35", "0x2c", "0x00"] - self.read_value = ["i2cget", "-f", "-y", "2", "0x35", "0x25"] - self.write_value = ["i2cset", "-f", "-y", "2", "0x35", "0x21", "0x0a"] + def get_revision(self): + val = ord(self._eeprom.revision_str()) + test = "{}".format(val) + return test def get_reboot_cause(self): """ @@ -51,32 +45,6 @@ def get_reboot_cause(self): is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used to pass a description of the reboot cause. """ - try: - is_power_loss = False - # enable read - getstatusoutput_noshell(self.disable_write) - getstatusoutput_noshell(self.enable_read) - ret, log = getstatusoutput_noshell(self.read_value) - if ret == 0 and "0x0a" in log: - is_power_loss = True - - # erase i2c and e2 - getstatusoutput_noshell(self.enable_erase) - time.sleep(1) - getstatusoutput_noshell(self.disable_erase) - # clear data - getstatusoutput_noshell(self.enable_write) - getstatusoutput_noshell(self.disable_read) - getstatusoutput_noshell(self.disable_write) - getstatusoutput_noshell(self.enable_read) - # enable write and set data - getstatusoutput_noshell(self.enable_write) - getstatusoutput_noshell(self.disable_read) - getstatusoutput_noshell(self.write_value) - if is_power_loss: - return(self.REBOOT_CAUSE_POWER_LOSS, None) - except Exception as e: - logger.error(str(e)) return (self.REBOOT_CAUSE_NON_HARDWARE, None) diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/fan_drawer.py index 4ff45cb81297..d03fd656f4d7 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/fan_drawer.py @@ -1,71 +1,17 @@ -# -# fan_drawer_base.py -# -# Abstract base class for implementing a platform-specific class with which -# to interact with a fan drawer module in SONiC -# +#!/usr/bin/env python + try: - from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer except ImportError as e: raise ImportError(str(e) + "- required module not found") -class FanDrawer(FanDrawerBase): - """ - Abstract base class for interfacing with a fan drawer - """ - # Device type definition. Note, this is a constant. - DEVICE_TYPE = "fan_drawer" - - def __init__(self, index, fan_list): - FanDrawerBase.__init__(self) - - self._fan_list = fan_list - self._index = index - - def get_name(self): - """ - Retrieves the name of the device - Returns: - string: The name of the device - """ - - return "fan {}".format(self._index) - - def get_num_fans(self): - """ - Retrieves the number of fans available on this fan drawer - Returns: - An integer, the number of fan modules available on this fan drawer - """ - return len(self._fan_list) - - def get_all_fans(self): - """ - Retrieves all fan modules available on this fan drawer - Returns: - A list of objects derived from FanBase representing all fan - modules available on this fan drawer - """ - return self._fan_list - - def set_status_led(self, color): - """ - Sets the state of the fan drawer status LED - Args: - color: A string representing the color with which to set the - fan drawer status LED - Returns: - bool: True if status LED state is set successfully, False if not - """ - return self._fan_list[self._index].set_status_led(color) +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" - def get_status_led(self, color): - """ - Gets the state of the fan drawer LED - Returns: - A string, one of the predefined STATUS_LED_COLOR_* strings above - """ - return self._fan_list[self._index].get_status_led(color) + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + # Provide the functions/variables below for which implementation is to be overwritten \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/pcie.py new file mode 100644 index 000000000000..d61925e5ff8c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/pcie.py @@ -0,0 +1,43 @@ +# +# pcie_base.py +# +# Abstract base class for implementing platform-specific +# PCIE functionality for SONiC +# + +try: + import abc + from sonic_pcie import PcieUtil +except ImportError as e: + raise ImportError (str(e) + " - required module not found") + +class PcieBase(object): + def __init__(self, path): + """ + Constructor + Args: + pcieutil file and config file path + """ + self.pcie_util = PcieUtil(path) + + + @abc.abstractmethod + def get_pcie_device(self): + """ + get current device pcie info + + Returns: + A list including pcie device info + """ + return self.pcie_util.get_pcie_device() + + + @abc.abstractmethod + def get_pcie_check(self): + """ + Check Pcie device with config file + + Returns: + A list including pcie device and test result info + """ + return self.pcie_util.get_pcie_check() diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/psu.py index 72a6d8f0825b..71eacf763ff1 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/psu.py @@ -1,9 +1,7 @@ -#!/usr/bin/env python -# - - try: from sonic_platform_pddf_base.pddf_psu import PddfPsu + from sonic_py_common.general import getstatusoutput_noshell + import time except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -33,4 +31,74 @@ def get_type(self): A string, the type of PSU (AC/DC) """ return "DC" + + def runcmd(self, cmd): + time_retry = 6 + result_msg = "" + time_delay = 0.01 + while time_retry: + try: + val, result_msg = getstatusoutput_noshell(cmd.split(" ")) + if val is False: + time_retry -=1 + time.sleep(time_delay) + continue + else: + return val, result_msg + except Exception as e: + time_retry -= 1 + result_msg = str(e) + time.sleep(time_delay) + + return False, result_msg + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + + v_out = 0 + label_t = "psu_v_out" + device = "PSU{}".format(self.psu_index) + #print(device) + pddf_obj_data = self.pddf_obj.data + + if device in pddf_obj_data.keys(): + pmbusloc = pddf_obj_data[device]['i2c']['interface'] + + for val in pmbusloc: + dev_name = val['dev'] + pmbus_loc = pddf_obj_data[dev_name] + i2cloc = pmbus_loc['i2c']['attr_list'] + parentbus = pmbus_loc['i2c']['topo_info'] + + for item_t in i2cloc: + if item_t['attr_name'] == label_t: + parentbus_id = int(parentbus['parent_bus'], 16) + vout_mode_cmd = "i2cget -f -y {} {} 0x20 bp".format(parentbus_id, parentbus['dev_addr']) + ret_t, val_voutmode = self.runcmd(vout_mode_cmd) + if ret_t is False: + return 0.0 + v_out_cmd = "i2cget -f -y {} {} {} wp".format(parentbus_id, parentbus['dev_addr'], item_t['attr_offset']) + ret_t, val_p_out = self.runcmd(v_out_cmd) + if ret_t is False: + return 0.0 + val_voutmode_t = int(val_voutmode, 16) + val_p_out_t = int(val_p_out, 16) * 1000 + + import ctypes + val_voutmode_t_t = ctypes.c_int8(val_voutmode_t << 3).value >>3 + + if (val_voutmode_t_t) < 0: + val_p_out_t_f = val_p_out_t>> (-val_voutmode_t_t) + else: + val_p_out_t_f = val_p_out_t << val_voutmode_t_t + + return float(val_p_out_t_f)/1000 + + return float(v_out)/1000 diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/sfp.py index d9b6e491bef4..2aff4e5fe04b 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/sfp.py @@ -1,10 +1,12 @@ #!/usr/bin/env python - +import time try: from sonic_platform_pddf_base.pddf_sfp import PddfSfp except ImportError as e: raise ImportError (str(e) + "- required module not found") +EEPROM_RETRY = 5 +EEPROM_RETRY_BREAK_SEC = 0.2 class Sfp(PddfSfp): """ @@ -13,5 +15,46 @@ class Sfp(PddfSfp): def __init__(self, index, pddf_data=None, pddf_plugin_data=None): PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + self._xcvr_api = self.get_xcvr_api() + + def get_eeprom_path(self): + return self.eeprom_path + + def read_eeprom(self, offset, num_bytes): + eeprom_raw = None + try: + for i in range(EEPROM_RETRY): + eeprom_raw = PddfSfp.read_eeprom(self, offset, num_bytes) + if eeprom_raw is None: + time.sleep(EEPROM_RETRY_BREAK_SEC) + continue + break + except Exception as e: + print("Error: Unable to read eeprom_path: %s" % (str(e))) + return None + + return eeprom_raw + + def write_eeprom(self, offset, num_bytes, write_buffer): + try: + for i in range(EEPROM_RETRY): + ret = PddfSfp.write_eeprom(self, offset, num_bytes, write_buffer) + if ret is False: + time.sleep(EEPROM_RETRY_BREAK_SEC) + continue + break + except Exception as e: + print("Error: Unable to write eeprom_path: %s" % (str(e))) + return None + + return ret + + def get_power_set(self): + if not self._xcvr_api.get_lpmode_support(): + return False + return self._xcvr_api.get_power_set() - # Provide the functions/variables below for which implementation is to be overwritten + def get_power_override(self): + if not self._xcvr_api.get_power_override_support() or not self._xcvr_api.get_lpmode_support(): + return False + return self._xcvr_api.get_power_override() diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/thermal.py index 5b829fc26caa..77d6ec7ae886 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6910-64c/sonic_platform/thermal.py @@ -11,7 +11,7 @@ class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/Makefile b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/Makefile index 46415e74ab7d..f197dce8cdd9 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/Makefile +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/Makefile @@ -8,6 +8,9 @@ INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/ KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers +ifeq "5.10.0" "$(word 1, $(sort 5.10.0 $(KERNEL_VERSION)))" +KBUILD_EXTRA_SYMBOLS += $(PWD)/../../../pddf/i2c/Module.symvers.PDDF +endif export KBUILD_EXTRA_SYMBOLS all: diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_led_module.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_led_module.c index 97ca23a92324..a789889e2a9a 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_led_module.c +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_led_module.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #define DEBUG 0 @@ -48,11 +49,16 @@ LED_OPS_DATA* dev_list[LED_TYPE_MAX] = { int num_psus = 0; int num_fantrays = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +extern int board_i2c_cpld_read_new(unsigned short cpld_addr, char *name, u8 reg); +extern int board_i2c_cpld_write_new(unsigned short cpld_addr, char *name, u8 reg, u8 value); +#else extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg); extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); +extern void *get_device_table(char *name); +#endif extern ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, char *buf); extern ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -extern void *get_device_table(char *name); static LED_STATUS find_state_index(const char* state_str) { int index; @@ -151,6 +157,7 @@ static void print_led_data(LED_OPS_DATA *ptr, LED_STATUS state) } } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val) { int ret; @@ -187,8 +194,8 @@ int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val) return ret; } - - +#endif + ssize_t get_status_led(struct device_attribute *da) { int ret=0; @@ -206,6 +213,7 @@ ssize_t get_status_led(struct device_attribute *da) temp_data_ptr->device_name, temp_data_ptr->index); return (-1); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) ret = get_sys_val(ops_ptr, &sys_val); if (ret < 0) { pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); @@ -213,7 +221,11 @@ ssize_t get_status_led(struct device_attribute *da) } /* keep ret as old value */ ret = 0; - +#else + sys_val = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset); + if (sys_val < 0) + return sys_val; +#endif strcpy(temp_data.cur_state.color, "None"); for (state=0; statedata[state].bits.mask_bits); @@ -232,6 +244,7 @@ ssize_t get_status_led(struct device_attribute *da) return(ret); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val) { int ret; @@ -266,6 +279,7 @@ int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val) return ret; } +#endif ssize_t set_status_led(struct device_attribute *da) { @@ -297,12 +311,18 @@ ssize_t set_status_led(struct device_attribute *da) } if(ops_ptr->data[cur_state].swpld_addr != 0x0) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) ret = get_sys_val(ops_ptr, &sys_val); if (ret < 0) { pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); return (-1); } - +#else + sys_val = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset); + if (sys_val < 0) { + return sys_val; + } +#endif new_val = (sys_val & ops_ptr->data[cur_state].bits.mask_bits) | (ops_ptr->data[cur_state].value << ops_ptr->data[cur_state].bits.pos); @@ -312,16 +332,24 @@ ssize_t set_status_led(struct device_attribute *da) return (-1); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) ret = set_sys_val(ops_ptr, new_val); if (ret < 0) { pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot set sys val\n", __func__); return (-1); } +#else + board_i2c_cpld_write_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset, new_val); +#endif pddf_dbg(LED, KERN_INFO "Set color:%s; 0x%x:0x%x sys_val:0x%x new_val:0x%x read:0x%x\n", LED_STATUS_STR[cur_state], ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset, sys_val, new_val, - ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset)); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) + ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset)); +#else + ret = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset)); +#endif if (ret < 0) { pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: Error %d in reading from cpld(0x%x) offset 0x%x\n", __FUNCTION__, ret, ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/chassis.py index 5d428f668567..efbb8859f71a 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/chassis.py @@ -7,7 +7,6 @@ try: import time from sonic_platform_pddf_base.pddf_chassis import PddfChassis - from sonic_platform.fan_drawer import FanDrawer except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -27,16 +26,10 @@ class Chassis(PddfChassis): def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfChassis.__init__(self, pddf_data, pddf_plugin_data) - # fan drawer - temp = [] - drawer_index = 0 - for idx, fan in enumerate(self.get_all_fans()): - temp.append(fan) - if (idx + 1) % FAN_NUM_PER_DRAWER == 0: - drawer = FanDrawer(drawer_index + 1, temp) - self.get_all_fan_drawers().append(drawer) - temp = [] - drawer_index += 1 + def get_revision(self): + val = ord(self._eeprom.revision_str()) + test = "{}".format(val) + return test def get_reboot_cause(self): """ diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan_drawer.py index 2f83b66df94a..d03fd656f4d7 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan_drawer.py @@ -1,69 +1,17 @@ -# -# fan_drawer -# +#!/usr/bin/env python + try: - from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer except ImportError as e: raise ImportError(str(e) + "- required module not found") -class FanDrawer(FanDrawerBase): - # Device type definition. Note, this is a constant. - DEVICE_TYPE = "fan_drawer" - - def __init__(self, index, fan_list): - FanDrawerBase.__init__(self) - - self._fan_list = fan_list - self._index = index - - def get_name(self): - """ - Retrieves the name of the device - Returns: - string: The name of the device - """ - - return "fan drawer {}".format(self._index) - - def get_num_fans(self): - """ - Retrieves the number of fans available on this fan drawer - Returns: - An integer, the number of fan modules available on this fan drawer - """ - return len(self._fan_list) - - def get_all_fans(self): - """ - Retrieves all fan modules available on this fan drawer - Returns: - A list of objects derived from FanBase representing all fan - modules available on this fan drawer - """ - return self._fan_list - - def set_status_led(self, color): - """ - Sets the state of the fan drawer status LED - Args: - color: A string representing the color with which to set the - fan drawer status LED - Returns: - bool: True if status LED state is set successfully, False if not - """ - if self.get_num_fans() > 0: - return self._fan_list[0].set_status_led(color) - return False +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" - def get_status_led(self): - """ - Gets the state of the fan drawer LED - Returns: - A string, one of the predefined STATUS_LED_COLOR_* strings above - """ - if self.get_num_fans() > 0: - return self._fan_list[0].get_status_led() - return "N/A" + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + # Provide the functions/variables below for which implementation is to be overwritten \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/psu.py index 57dd5117a2c4..71eacf763ff1 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/psu.py @@ -1,17 +1,19 @@ try: from sonic_platform_pddf_base.pddf_psu import PddfPsu + from sonic_py_common.general import getstatusoutput_noshell + import time except ImportError as e: raise ImportError (str(e) + "- required module not found") class Psu(PddfPsu): """PDDF Platform-Specific PSU class""" - + PLATFORM_PSU_CAPACITY = 1200 def __init__(self, index, pddf_data=None, pddf_plugin_data=None): PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) - + # Provide the functions/variables below for which implementation is to be overwritten def get_maximum_supplied_power(self): """ @@ -29,4 +31,74 @@ def get_type(self): A string, the type of PSU (AC/DC) """ return "DC" + + def runcmd(self, cmd): + time_retry = 6 + result_msg = "" + time_delay = 0.01 + while time_retry: + try: + val, result_msg = getstatusoutput_noshell(cmd.split(" ")) + if val is False: + time_retry -=1 + time.sleep(time_delay) + continue + else: + return val, result_msg + except Exception as e: + time_retry -= 1 + result_msg = str(e) + time.sleep(time_delay) + + return False, result_msg + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + + v_out = 0 + label_t = "psu_v_out" + device = "PSU{}".format(self.psu_index) + #print(device) + pddf_obj_data = self.pddf_obj.data + + if device in pddf_obj_data.keys(): + pmbusloc = pddf_obj_data[device]['i2c']['interface'] + + for val in pmbusloc: + dev_name = val['dev'] + pmbus_loc = pddf_obj_data[dev_name] + i2cloc = pmbus_loc['i2c']['attr_list'] + parentbus = pmbus_loc['i2c']['topo_info'] + + for item_t in i2cloc: + if item_t['attr_name'] == label_t: + parentbus_id = int(parentbus['parent_bus'], 16) + vout_mode_cmd = "i2cget -f -y {} {} 0x20 bp".format(parentbus_id, parentbus['dev_addr']) + ret_t, val_voutmode = self.runcmd(vout_mode_cmd) + if ret_t is False: + return 0.0 + v_out_cmd = "i2cget -f -y {} {} {} wp".format(parentbus_id, parentbus['dev_addr'], item_t['attr_offset']) + ret_t, val_p_out = self.runcmd(v_out_cmd) + if ret_t is False: + return 0.0 + val_voutmode_t = int(val_voutmode, 16) + val_p_out_t = int(val_p_out, 16) * 1000 + + import ctypes + val_voutmode_t_t = ctypes.c_int8(val_voutmode_t << 3).value >>3 + + if (val_voutmode_t_t) < 0: + val_p_out_t_f = val_p_out_t>> (-val_voutmode_t_t) + else: + val_p_out_t_f = val_p_out_t << val_voutmode_t_t + + return float(val_p_out_t_f)/1000 + + return float(v_out)/1000 diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/sfp.py index ea8e256fe6ef..2aff4e5fe04b 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/sfp.py @@ -1,31 +1,12 @@ #!/usr/bin/env python - +import time try: - #from sonic_platform_pddf_base.pddf_sfp import * - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom from sonic_platform_pddf_base.pddf_sfp import PddfSfp - from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_OFFSET - from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_WIDTH - from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_OFFSET - from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_WIDTH - from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_OFFSET - from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_WIDTH - from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_OFFSET - from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_WIDTH - from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_OFFSET - from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH except ImportError as e: raise ImportError (str(e) + "- required module not found") -XCVR_DOM_CAPABILITY_OFFSET = 92 -XCVR_DOM_CAPABILITY_WIDTH = 2 -QSFP_VERSION_COMPLIANCE_OFFSET = 1 -QSFP_VERSION_COMPLIANCE_WIDTH = 2 -QSFP_OPTION_VALUE_OFFSET = 192 -QSFP_OPTION_VALUE_WIDTH = 4 +EEPROM_RETRY = 5 +EEPROM_RETRY_BREAK_SEC = 0.2 class Sfp(PddfSfp): """ @@ -34,254 +15,46 @@ class Sfp(PddfSfp): def __init__(self, index, pddf_data=None, pddf_plugin_data=None): PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) - self.dom_supported = False - self.__dom_capability_detect() - - def __dom_capability_detect(self): - self.dom_supported = False - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.qsfp_page3_available = False - self.calibration = 0 - if not self.get_presence(): - return - - if self.is_osfp_port: - # Not implement - return - elif self.is_qsfp_port: - self.calibration = 1 - sfpi_obj = sff8436InterfaceId() - if sfpi_obj is None: - self.dom_supported = False - offset = 128 - - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes( - QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH) - qsfp_version_compliance = int( - qsfp_version_compliance_raw[0], 16) - dom_capability = sfpi_obj.parse_dom_capability( - qsfp_dom_capability_raw, 0) - if qsfp_version_compliance >= 0x08: - self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On' - self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On' - self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' - self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On' - else: - self.dom_temp_supported = True - self.dom_volt_supported = True - self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' - self.dom_tx_power_supported = True - - self.dom_supported = True - self.calibration = 1 - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - qsfp_option_value_raw = self.__read_eeprom_specific_bytes( - QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH) - if qsfp_option_value_raw is not None: - optional_capability = sfpd_obj.parse_option_params( - qsfp_option_value_raw, 0) - self.dom_tx_disable_supported = optional_capability[ - 'data']['TxDisable']['value'] == 'On' - dom_status_indicator = sfpd_obj.parse_dom_status_indicator( - qsfp_version_compliance_raw, 1) - self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off' - else: - self.dom_supported = False - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.calibration = 0 - self.qsfp_page3_available = False - else: - sfpi_obj = sff8472InterfaceId() - if sfpi_obj is None: - return None - sfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) - if sfp_dom_capability_raw is not None: - sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) - self.dom_supported = (sfp_dom_capability & 0x40 != 0) - if self.dom_supported: - self.dom_temp_supported = True - self.dom_volt_supported = True - self.dom_rx_power_supported = True - self.dom_tx_power_supported = True - if sfp_dom_capability & 0x20 != 0: - self.calibration = 1 - elif sfp_dom_capability & 0x10 != 0: - self.calibration = 2 - else: - self.calibration = 0 - else: - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.calibration = 0 - self.dom_tx_disable_supported = ( - int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) + self._xcvr_api = self.get_xcvr_api() - # Provide the functions/variables below for which implementation is to be overwritten - - def __read_eeprom_specific_bytes(self, offset, num_bytes): - eeprom_raw = [] - if not self.get_presence(): - return None - for i in range(0, num_bytes): - eeprom_raw.append("0x00") + def get_eeprom_path(self): + return self.eeprom_path + def read_eeprom(self, offset, num_bytes): + eeprom_raw = None try: - with open(self.eeprom_path, mode="rb", buffering=0) as eeprom: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) + for i in range(EEPROM_RETRY): + eeprom_raw = PddfSfp.read_eeprom(self, offset, num_bytes) + if eeprom_raw is None: + time.sleep(EEPROM_RETRY_BREAK_SEC) + continue + break except Exception as e: - print("Error: Unable to open eeprom_path: %s" % (str(e))) - return None - - try: - if len(raw) == 0: - return None - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - except Exception as e: - print("Error: Exception info: %s" % (str(e))) + print("Error: Unable to read eeprom_path: %s" % (str(e))) return None return eeprom_raw - def get_transceiver_bulk_status(self): - # check present status - if not self.get_presence(): - return None - self.__dom_capability_detect() - - xcvr_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - - if self.is_osfp_port: - # Below part is added to avoid fail xcvrd, shall be implemented later - pass - elif self.is_qsfp_port: - # QSFPs - xcvr_dom_info_dict = super(Sfp, self).get_transceiver_bulk_status() - - # pddf_sfp "qsfp_tx_power_support != 'on'" is wrong - - offset = 0 - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes((offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) - if qsfp_dom_rev_raw is not None: - qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) - else: - return None - - dom_channel_monitor_data = {} - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - - if (qsfp_dom_rev[0:8] == 'SFF-8636' and self.dom_tx_power_supported is True): - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( - dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] - xcvr_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] - xcvr_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] - xcvr_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] - else: - # SFPs - offset = 256 - if not self.dom_supported: - return xcvr_dom_info_dict - - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None - - sfpd_obj._calibration_type = self.calibration - - dom_temperature_raw = self.__read_eeprom_specific_bytes((offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) - else: - return None - - dom_voltage_raw = self.__read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - else: - return None - - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value'] - xcvr_dom_info_dict['rx2power'] = 'N/A' - xcvr_dom_info_dict['rx3power'] = 'N/A' - xcvr_dom_info_dict['rx4power'] = 'N/A' - xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] - xcvr_dom_info_dict['tx2bias'] = 'N/A' - xcvr_dom_info_dict['tx3bias'] = 'N/A' - xcvr_dom_info_dict['tx4bias'] = 'N/A' - xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] - xcvr_dom_info_dict['tx2power'] = 'N/A' - xcvr_dom_info_dict['tx3power'] = 'N/A' - xcvr_dom_info_dict['tx4power'] = 'N/A' - - xcvr_dom_info_dict['rx_los'] = self.get_rx_los() - xcvr_dom_info_dict['tx_fault'] = self.get_tx_fault() - xcvr_dom_info_dict['reset_status'] = self.get_reset_status() - xcvr_dom_info_dict['lp_mode'] = self.get_lpmode() - - return xcvr_dom_info_dict - - def get_transceiver_threshold_info(self): - # check present status - if not self.get_presence(): + def write_eeprom(self, offset, num_bytes, write_buffer): + try: + for i in range(EEPROM_RETRY): + ret = PddfSfp.write_eeprom(self, offset, num_bytes, write_buffer) + if ret is False: + time.sleep(EEPROM_RETRY_BREAK_SEC) + continue + break + except Exception as e: + print("Error: Unable to write eeprom_path: %s" % (str(e))) return None - self.__dom_capability_detect() - - xcvr_dom_threshold_info_dict = dict.fromkeys(self.threshold_dict_keys, 'N/A') - - if self.is_osfp_port: - # Below part is added to avoid fail xcvrd, shall be implemented later - pass - elif self.is_qsfp_port: - # QSFPs - if not self.dom_supported or not self.qsfp_page3_available: - return xcvr_dom_threshold_info_dict - - return super(Sfp, self).get_transceiver_threshold_info() - else: - # SFPs - if not self.dom_supported: - return xcvr_dom_threshold_info_dict + return ret - return super(Sfp, self).get_transceiver_threshold_info() + def get_power_set(self): + if not self._xcvr_api.get_lpmode_support(): + return False + return self._xcvr_api.get_power_set() - return xcvr_dom_threshold_info_dict + def get_power_override(self): + if not self._xcvr_api.get_power_override_support() or not self._xcvr_api.get_lpmode_support(): + return False + return self._xcvr_api.get_power_override() diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/thermal.py index 99b743c6d343..f2a73e5f5db8 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/thermal.py @@ -8,7 +8,7 @@ class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/pddf/platform-modules-pddf.mk b/platform/pddf/platform-modules-pddf.mk index 33d97e7fb50e..a772f3a1300f 100644 --- a/platform/pddf/platform-modules-pddf.mk +++ b/platform/pddf/platform-modules-pddf.mk @@ -1,5 +1,5 @@ # PDDF Generic Platform modules -#################################################### +##################################################### PDDF_PLATFORM_MODULE_VERSION = 1.1 export PDDF_PLATFORM_MODULE_VERSION diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index 01ed79c41ff8..565f7796afa7 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -308,6 +308,16 @@ sap_rx_polarity_flip sap_tx_polarity_flip sap_mdio_num dport_map_port_9 +cancun_dir +pcie_file +capi_level +phy_pin_compatibility_enable +cfg_int_phy_ctrl +stand_alone_phy_init +sap_rx_polarity_flip +sap_tx_polarity_flip +sap_mdio_num +dport_map_port_9 ifa_enable port_gmii_mode phy_force_firmware_load From 06d55b8027259383f905f08055c26920a7edafc7 Mon Sep 17 00:00:00 2001 From: kenneth-arista <93353051+kenneth-arista@users.noreply.github.com> Date: Thu, 12 Jan 2023 23:48:37 -0800 Subject: [PATCH 029/113] [device/arista] Disabled polled_irq_mode for DNX SKUs (#13349) Disabled polled_irq_mode for all Arista DNX devices as this mode leads to excessive use of the CPU via an unneeded interrupt polling thread. --- .../jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm | 2 +- .../Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm | 2 +- .../jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm | 2 +- .../jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm | 2 +- .../jr2-a7280cr3-32d4-40x100G.config.bcm | 2 +- .../0/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../1/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../0/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../1/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../0/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../1/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C32D4/jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C32D4/jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm index 003579a88692..a195781bf6c0 100644 --- a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C32D4/jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C32D4/jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm @@ -270,7 +270,7 @@ tdma_timeout_usec.BCM8869X=1000000 tslam_timeout_usec.BCM8869X=1000000 appl_enable_intr_init.BCM8869X=1 -polled_irq_mode.BCM8869X=1 +polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 bcm_stat_interval.BCM8869X=1000 diff --git a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm index 03b4b8bbf03e..eb803c09bcef 100644 --- a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm @@ -273,7 +273,7 @@ tdma_timeout_usec.BCM8869X=1000000 tslam_timeout_usec.BCM8869X=1000000 appl_enable_intr_init.BCM8869X=1 -polled_irq_mode.BCM8869X=1 +polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 bcm_stat_interval.BCM8869X=1000 diff --git a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm index f66e7061c6f3..f10480ade949 100644 --- a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm @@ -269,7 +269,7 @@ tdma_timeout_usec.BCM8869X=1000000 tslam_timeout_usec.BCM8869X=1000000 appl_enable_intr_init.BCM8869X=1 -polled_irq_mode.BCM8869X=1 +polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 bcm_stat_interval.BCM8869X=1000 diff --git a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm index 5b2bbbf89254..b74d741cbd06 100644 --- a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm @@ -270,7 +270,7 @@ tdma_timeout_usec.BCM8869X=1000000 tslam_timeout_usec.BCM8869X=1000000 appl_enable_intr_init.BCM8869X=1 -polled_irq_mode.BCM8869X=1 +polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 bcm_stat_interval.BCM8869X=1000 diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm index 3db7f3a5147b..b5a680403015 100644 --- a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm @@ -763,7 +763,7 @@ tdma_timeout_usec.BCM8869X=1000000 tslam_timeout_usec.BCM8869X=1000000 appl_enable_intr_init.BCM8869X=1 -polled_irq_mode.BCM8869X=1 +polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 bcm_stat_interval.BCM8869X=1000 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm index 9be5d8e836f3..e21ebf9092a8 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -634,7 +634,7 @@ tslam_timeout_usec=1000000 ### Interrupts appl_enable_intr_init=1 -polled_irq_mode=1 +polled_irq_mode=0 # reduce CPU load, configure delay 100ms polled_irq_delay=1000 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm index d663352acd5a..8e7fa9ef15f8 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -634,7 +634,7 @@ tslam_timeout_usec=1000000 ### Interrupts appl_enable_intr_init=1 -polled_irq_mode=1 +polled_irq_mode=0 # reduce CPU load, configure delay 100ms polled_irq_delay=1000 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm index 99dfb9e3e264..a3ae8e5d7253 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -652,7 +652,7 @@ tslam_timeout_usec=1000000 ### Interrupts appl_enable_intr_init=1 -polled_irq_mode=1 +polled_irq_mode=0 # reduce CPU load, configure delay 100ms polled_irq_delay=1000 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm index 47610bbb4b48..37c4a869ceb2 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -652,7 +652,7 @@ tslam_timeout_usec=1000000 ### Interrupts appl_enable_intr_init=1 -polled_irq_mode=1 +polled_irq_mode=0 # reduce CPU load, configure delay 100ms polled_irq_delay=1000 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm index 62fe61d49c9c..b2981c29b3c4 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -634,7 +634,7 @@ tslam_timeout_usec=1000000 ### Interrupts appl_enable_intr_init=1 -polled_irq_mode=1 +polled_irq_mode=0 # reduce CPU load, configure delay 100ms polled_irq_delay=1000 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm index 56d425f9f9c2..106554efa89e 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -634,7 +634,7 @@ tslam_timeout_usec=1000000 ### Interrupts appl_enable_intr_init=1 -polled_irq_mode=1 +polled_irq_mode=0 # reduce CPU load, configure delay 100ms polled_irq_delay=1000 From 4539035e90aa830c583f2a24cd0bb2929b59839a Mon Sep 17 00:00:00 2001 From: Ikki Zhu <79439153+qnos@users.noreply.github.com> Date: Fri, 13 Jan 2023 15:51:33 +0800 Subject: [PATCH 030/113] [Seastone] Enhancement fix for PR12200 syseeprom issue (#13344) Why I did it [Seastone] Enhancement fix for PR12200 syseeprom issue. How I did it Enhance the fix through replace the hardcoded devnum to bash variable How to verify it show platform syseeprom or decode-syseeprom --- .../debian/platform-modules-dx010.init | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init index 31bd7e58effc..fab61467da72 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init @@ -147,11 +147,11 @@ start) sleep 0.1 done - # Set pca9548 idle_state - echo -2 > /sys/bus/i2c/devices/i2c-${devnum}/0-0071/idle_state - echo -2 > /sys/bus/i2c/devices/i2c-${devnum}/0-0073/idle_state - echo -2 > /sys/bus/i2c/devices/i2c-${devnum}/0-0077/idle_state - sleep 0.1 + # Set pca9548 idle_state + echo -2 > /sys/bus/i2c/devices/i2c-${devnum}/${devnum}-0071/idle_state + echo -2 > /sys/bus/i2c/devices/i2c-${devnum}/${devnum}-0073/idle_state + echo -2 > /sys/bus/i2c/devices/i2c-${devnum}/${devnum}-0077/idle_state + sleep 0.1 bus_en=8 cfg_r=`i2cget -y -f 8 0x60 0xD1` From e077b5362c3b4d3f43aede0a9e536ff63599a590 Mon Sep 17 00:00:00 2001 From: Graham Hayes Date: Fri, 13 Jan 2023 07:52:40 +0000 Subject: [PATCH 031/113] [Arista] Rely on automatic flash size detection for Raven (#13277) Many of these switches have had flash upgraded beyond 2G however, in boot0 both were assigned 2GB for legacy reasons. Remove the hardcoding of the flash size and let boot0 autodetect the available space. Signed-off-by: Graham Hayes Signed-off-by: Graham Hayes --- files/Aboot/boot0.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index cf09536a5e29..3bb5840e0b13 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -483,7 +483,6 @@ write_platform_specific_cmdline() { if [ "$platform" = "raven" ]; then # Assuming sid=Cloverdale aboot_machine=arista_7050_qx32 - flash_size=2000 cmdline_add modprobe.blacklist=radeon,sp5100_tco cmdline_add acpi=off fi From 22fcc760c488d979d690b400e32b48d344169b25 Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Fri, 13 Jan 2023 15:54:25 +0800 Subject: [PATCH 032/113] [minigraph]: Support port name in ACL table AttachTo attribute (#13105) Why I did it This PR is to update minigraph.py to support both port alias and port name as input of AttachTo attribute of ACL table. Before this change, only port alias is supported. How I did it Add a global variable to store port names Search both port names and port alias wheh parsing the value of AttachTo. How to verify it Verified by a new unit test case test_minigraph_acl_attach_to_ports Verified by copying the new minigraph.py to a testbed and run conflg load_minigraph. --- src/sonic-config-engine/minigraph.py | 13 ++++++++++--- .../tests/simple-sample-graph-case.xml | 2 +- .../tests/test_minigraph_case.py | 8 ++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 9cd43b6b0ab8..ecfb2c3cd851 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -674,10 +674,14 @@ def parse_dpg(dpg, hname): acl_intfs.extend(vlan_member_list[member]) else: acl_intfs.append(member) - elif member in port_alias_map: - acl_intfs.append(port_alias_map[member]) + elif (member in port_alias_map) or (member in port_names_map): + if member in port_alias_map: + acl_intf = port_alias_map[member] + else: + acl_intf = member + acl_intfs.append(acl_intf) # Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface - if port_alias_map[member] in intfs_inpc: + if acl_intf in intfs_inpc: print("Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface", file=sys.stderr) elif member.lower().startswith('erspan') or member.lower().startswith('egress_erspan') or member.lower().startswith('erspan_dscp'): if 'dscp' in member.lower(): @@ -1396,6 +1400,8 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw docker_routing_config_mode = child.text (ports, alias_map, alias_asic_map) = get_port_config(hwsku=hwsku, platform=platform, port_config_file=port_config_file, asic_name=asic_name, hwsku_config_file=hwsku_config_file) + + port_names_map.update(ports) port_alias_map.update(alias_map) port_alias_asic_map.update(alias_asic_map) @@ -2064,6 +2070,7 @@ def parse_asic_meta_get_devices(root): return local_devices +port_names_map = {} port_alias_map = {} port_alias_asic_map = {} diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index 4165647a9aa3..6692e306653d 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -180,7 +180,7 @@ - PortChannel01 + PortChannel01;fortyGigE0/8;Ethernet12 DataAcl DataPlane diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 90731e0855a7..b1c203536b5d 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -467,6 +467,14 @@ def test_minigraph_mirror_dscp(self): expected_ports.sort() ) + def test_minigraph_acl_attach_to_ports(self): + """ + The test case is to verify ACL table can be bound to both port names and alias + """ + result = minigraph.parse_xml(self.sample_graph, port_config_file=self.port_config) + expected_dataacl_ports = ['PortChannel01','fortyGigE0/8','Ethernet12'] + self.assertEqual(result['ACL_TABLE']['DATAACL']['ports'].sort(), expected_dataacl_ports.sort()) + def test_parse_device_desc_xml_mgmt_interface(self): # Regular device_desc.xml with both IPv4 and IPv6 mgmt address result = minigraph.parse_device_desc_xml(self.sample_simple_device_desc) From 5e4a866e3311f859b9fe479aa379b38521de9725 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Fri, 13 Jan 2023 16:16:35 +0800 Subject: [PATCH 033/113] [Build] Support Debian snapshot mirror to improve build stability (#13097) Why I did it [Build] Support Debian snapshot mirror to improve build stability It is to enhance the reproducible build, supports the Debian snapshot mirror. It guarantees all the docker images using the same Debian mirror snapshot and fixes the temporary build failure which is caused by remote Debain mirror indexes changed during the build. It is also to fix the version conflict issue caused by no fixed versions of some of the Debian packages. How I did it Add a new feature to support the Debian snapshot mirror. How to verify it --- Makefile.work | 2 ++ rules/config | 3 ++ scripts/build_mirror_config.sh | 28 +++++++++++++++++++ scripts/generate_buildinfo_config.sh | 1 + scripts/versions_manager.py | 9 ++++-- slave.mk | 1 + .../scripts/buildinfo_base.sh | 27 +++++++++++++++++- .../scripts/collect_version_files | 10 +++++++ 8 files changed, 77 insertions(+), 4 deletions(-) diff --git a/Makefile.work b/Makefile.work index 11f9e50b4f4d..71e83e9eb1b8 100644 --- a/Makefile.work +++ b/Makefile.work @@ -198,6 +198,7 @@ $(shell \ SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ SONIC_VERSION_CACHE_SOURCE=$(SONIC_VERSION_CACHE_SOURCE) \ DBGOPT='$(DBGOPT)' \ + MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \ scripts/generate_buildinfo_config.sh) # Generate the slave Dockerfile, and prepare build info for it @@ -533,6 +534,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \ MIRROR_URLS=$(MIRROR_URLS) \ MIRROR_SECURITY_URLS=$(MIRROR_SECURITY_URLS) \ GZ_COMPRESS_PROGRAM=$(GZ_COMPRESS_PROGRAM) \ + MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \ $(SONIC_OVERRIDE_BUILD_VARS) .PHONY: sonic-slave-build sonic-slave-bash init reset diff --git a/rules/config b/rules/config index d37699433dcf..c01adc0f5390 100644 --- a/rules/config +++ b/rules/config @@ -234,6 +234,9 @@ TRUSTED_GPG_URLS = https://packages.trafficmanager.net/debian/public_key.gpg,htt # docker: docker base images SONIC_VERSION_CONTROL_COMPONENTS ?= none +# MIRROR_SNAPSHOT - support mirror snapshot flag +MIRROR_SNAPSHOT ?= n + # SONIC_VERSION_CACHE allows the .deb,.py, wget, git, docker and go files to be stored in the cache path. This allows the submodules to # cache standard installation package and restored back to avoid the package download every time. # SONIC_VERSION_CACHE - Method of deb package caching diff --git a/scripts/build_mirror_config.sh b/scripts/build_mirror_config.sh index 5f94e701cbde..a1e5900a48b8 100755 --- a/scripts/build_mirror_config.sh +++ b/scripts/build_mirror_config.sh @@ -5,16 +5,40 @@ CONFIG_PATH=$1 export ARCHITECTURE=$2 export DISTRIBUTION=$3 +DEFAULT_MIRROR_URL_PREFIX=http://packages.trafficmanager.net +MIRROR_VERSION_FILE=files/build/versions/default/versions-mirror +[ -f target/versions/default/versions-mirror ] && MIRROR_VERSION_FILE=target/versions/default/versions-mirror + # The default mirror urls DEFAULT_MIRROR_URLS=http://debian-archive.trafficmanager.net/debian/,http://packages.trafficmanager.net/debian/debian/ DEFAULT_MIRROR_SECURITY_URLS=http://debian-archive.trafficmanager.net/debian-security/,http://packages.trafficmanager.net/debian/debian-security/ + # The debian-archive.trafficmanager.net does not support armhf, use debian.org instead if [ "$ARCHITECTURE" == "armhf" ]; then DEFAULT_MIRROR_URLS=http://deb.debian.org/debian/,http://packages.trafficmanager.net/debian/debian/ DEFAULT_MIRROR_SECURITY_URLS=http://deb.debian.org/debian-security/,http://packages.trafficmanager.net/debian/debian-security/ fi +if [ "$MIRROR_SNAPSHOT" == y ]; then + if [ -f $MIRROR_VERSION_FILE ]; then + DEBIAN_TIMESTAMP=$(grep "^debian==" $MIRROR_VERSION_FILE | tail -n 1 | sed 's/.*==//') + DEBIAN_SECURITY_TIMESTAMP=$(grep "^debian-security==" $MIRROR_VERSION_FILE | tail -n 1 | sed 's/.*==//') + elif [ -z "$DEBIAN_TIMESTAMP" ] || [ -z "$DEBIAN_SECURITY_TIMESTAMP" ]; then + DEBIAN_TIMESTAMP=$(curl $DEFAULT_MIRROR_URL_PREFIX/snapshot/debian/latest/timestamp) + DEBIAN_SECURITY_TIMESTAMP=$(curl $DEFAULT_MIRROR_URL_PREFIX/snapshot/debian-security/latest/timestamp) + fi + + DEFAULT_MIRROR_URLS=http://deb.debian.org/debian/,http://packages.trafficmanager.net/snapshot/debian/$DEBIAN_TIMESTAMP/ + DEFAULT_MIRROR_SECURITY_URLS=http://deb.debian.org/debian-security/,http://packages.trafficmanager.net/snapshot/debian-security/$DEBIAN_SECURITY_TIMESTAMP/ + + mkdir -p target/versions/default + if [ ! -f target/versions/default/versions-mirror ]; then + echo "debian==$DEBIAN_TIMESTAMP" > target/versions/default/versions-mirror + echo "debian-security==$DEBIAN_SECURITY_TIMESTAMP" >> target/versions/default/versions-mirror + fi +fi + [ -z "$MIRROR_URLS" ] && MIRROR_URLS=$DEFAULT_MIRROR_URLS [ -z "$MIRROR_SECURITY_URLS" ] && MIRROR_SECURITY_URLS=$DEFAULT_MIRROR_SECURITY_URLS @@ -24,3 +48,7 @@ TEMPLATE=files/apt/sources.list.j2 [ -f $CONFIG_PATH/sources.list.$ARCHITECTURE.j2 ] && TEMPLATE=$CONFIG_PATH/sources.list.$ARCHITECTURE.j2 MIRROR_URLS=$MIRROR_URLS MIRROR_SECURITY_URLS=$MIRROR_SECURITY_URLS j2 $TEMPLATE | sed '/^$/N;/^\n$/D' > $CONFIG_PATH/sources.list.$ARCHITECTURE +if [ "$MIRROR_SNAPSHOT" == y ]; then + # Set the snapshot mirror, and add the SET_REPR_MIRRORS flag + sed -i -e "/^#*deb.*packages.trafficmanager.net/! s/^#*deb/#&/" -e "\$a#SET_REPR_MIRRORS" $CONFIG_PATH/sources.list.$ARCHITECTURE +fi diff --git a/scripts/generate_buildinfo_config.sh b/scripts/generate_buildinfo_config.sh index b0ec54924246..87eb612007ba 100755 --- a/scripts/generate_buildinfo_config.sh +++ b/scripts/generate_buildinfo_config.sh @@ -11,3 +11,4 @@ echo "export SONIC_VERSION_CONTROL_COMPONENTS=$SONIC_VERSION_CONTROL_COMPONENTS" echo "export SONIC_VERSION_CACHE=${SONIC_VERSION_CACHE}" >> $BUILDINFO_CONFIG echo "export SONIC_VERSION_CACHE_SOURCE=${SONIC_VERSION_CACHE_SOURCE}" >> $BUILDINFO_CONFIG echo "export DISTRO=${DISTRO}" >> $BUILDINFO_CONFIG +echo "export MIRROR_SNAPSHOT=$MIRROR_SNAPSHOT" >> $BUILDINFO_CONFIG diff --git a/scripts/versions_manager.py b/scripts/versions_manager.py index 27b757721f25..50fd9452454b 100755 --- a/scripts/versions_manager.py +++ b/scripts/versions_manager.py @@ -562,12 +562,13 @@ def filter(self, ctypes=[]): module.filter(ctypes=ctypes) def get_default_module(self): - if DEFAULT_MODULE in self.modules: - return self.modules[DEFAULT_MODULE] + default_module = self.modules.get(DEFAULT_MODULE, VersionModule(DEFAULT_MODULE, [])) ctypes = self.get_component_types() dists = self.get_dists() components = [] for ctype in ctypes: + if ctype in DEFAULT_OVERWRITE_COMPONENTS: + continue if ctype == 'deb': for dist in dists: versions = self._get_versions(ctype, dist) @@ -579,7 +580,9 @@ def get_default_module(self): common_versions = self._get_common_versions(versions) component = Component(self.verbose, common_versions, ctype) components.append(component) - return VersionModule(self.verbose, DEFAULT_MODULE, components) + module = VersionModule(self.verbose, DEFAULT_MODULE, components) + module.overwrite(default_module, True, True) + return module def get_aggregatable_modules(self): modules = {} diff --git a/slave.mk b/slave.mk index da22f7fb1bc1..2d8006fb8aad 100644 --- a/slave.mk +++ b/slave.mk @@ -87,6 +87,7 @@ export CROSS_BUILD_ENVIRON export BLDENV export BUILD_WORKDIR export GZ_COMPRESS_PROGRAM +export MIRROR_SNAPSHOT ############################################################################### ## Utility rules diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index 38d2e8881588..b42e37bf62b8 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -11,7 +11,7 @@ POST_VERSION_PATH=$BUILDINFO_PATH/post-versions VERSION_DEB_PREFERENCE=$BUILDINFO_PATH/versions/01-versions-deb WEB_VERSION_FILE=$VERSION_PATH/versions-web BUILD_WEB_VERSION_FILE=$BUILD_VERSION_PATH/versions-web -REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/debian' +REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/' DPKG_INSTALLTION_LOCK_FILE=/tmp/.dpkg_installation.lock . $BUILDINFO_PATH/config/buildinfo.config @@ -112,14 +112,39 @@ set_reproducible_mirrors() { # Remove the charater # in front of the line if matched local expression="s/^#\(.*$REPR_MIRROR_URL_PATTERN\)/\1/" + # Add the character # in front of the line, if not match the URL pattern condition + local expression2="/^#*deb.*$REPR_MIRROR_URL_PATTERN/! s/^#*deb/#&/" + local expression3="\$a#SET_REPR_MIRRORS" if [ "$1" = "-d" ]; then # Add the charater # in front of the line if match expression="s/^deb.*$REPR_MIRROR_URL_PATTERN/#\0/" + # Remove the character # in front of the line, if not match the URL pattern condition + expression2="/^#*deb.*$REPR_MIRROR_URL_PATTERN/! s/^#(#*deb)/\1/" + expression3="/#SET_REPR_MIRRORS/d" fi local mirrors="/etc/apt/sources.list $(find /etc/apt/sources.list.d/ -type f)" for mirror in $mirrors; do + if ! grep -iq "$REPR_MIRROR_URL_PATTERN" "$mirror"; then + continue + fi + + # Make sure no duplicate operations on the mirror config file + if ([ "$1" == "-d" ] && ! grep -iq "#SET_REPR_MIRRORS" "$mirror") || + ([ "$1" != "-d" ] && grep -iq "#SET_REPR_MIRRORS" "$mirror"); then + continue + fi + + # Enable or disable the reproducible mirrors $SUDO sed -i "$expression" "$mirror" + + # Enable or disable the none reproducible mirrors + if [ "$MIRROR_SNAPSHOT" == y ]; then + $SUDO sed -ri "$expression2" "$mirror" + fi + + # Add or remove the SET_REPR_MIRRORS flag + $SUDO sed -i "$expression3" "$mirror" done } diff --git a/src/sonic-build-hooks/scripts/collect_version_files b/src/sonic-build-hooks/scripts/collect_version_files index 6e082406da56..081ded342c4d 100755 --- a/src/sonic-build-hooks/scripts/collect_version_files +++ b/src/sonic-build-hooks/scripts/collect_version_files @@ -25,6 +25,13 @@ dpkg-query -W -f '${Package}==${Version}\n' | grep -Ev "${SKIP_VERSION_PACKAGE}" ## Add the the packages purged [ -f $POST_VERSION_PATH/purge-versions-deb ] && cat $POST_VERSION_PATH/purge-versions-deb >> "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" +## Add mirror versions +while read -r line; do + mirror=$(echo "$line" | sed "s/.*\///" | sed "s/_InRelease.*//") + date=$(date --date="$(echo "$line" | cut -d: -f3-)" +%Y-%m-%dT%H:%M:%SZ) + echo "$mirror==$date" >> ${TARGET_PATH}/versions-mirror +done < <(grep Date: /var/lib/apt/lists/*_InRelease 2>/dev/null) + ## Print the unique and sorted result sort -u "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" if [ -e "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" ]; then @@ -33,5 +40,8 @@ fi if [ -e "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" ]; then sort -u "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" fi +if [ -e "${TARGET_PATH}/versions-mirror" ]; then + sort -u "${TARGET_PATH}/versions-mirror" -o "${TARGET_PATH}/versions-mirror" +fi exit 0 From 2d2d9433b3f3a02570534e7f079eba69ce23bcda Mon Sep 17 00:00:00 2001 From: Tomer Shalvi <116184476+tshalvi@users.noreply.github.com> Date: Tue, 17 Jan 2023 18:43:49 +0200 Subject: [PATCH 034/113] Moving multiprocessing.Manager to the correct sub-process (#13377) Why I did it There is a queue in sysmonitor.py that is created based on an object of multiprocessing.Manager. After performing fast-reboot, system health monitor is being shut down, what causes this Manager to be shut down as well, since it is a child-process of healthd. That's why I moved the creation of this Manager from the top of the file to the function Sysmonitor.system_service() (The only place it is used), to make Manager a child-process of Sysmonitor, instead of Healthd. This way both the queue (the Manager) and the processes that uses this queue will be child-processes of the same process, and the problematic scenario of sysmonitor sending messages to a dead queue will not be possible. How I did it Removed the definition of manager as global and moved it to system_service() function How to verify it Perform a fast reboot and verify the traceback issue is fixed --- src/system-health/health_checker/sysmonitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system-health/health_checker/sysmonitor.py b/src/system-health/health_checker/sysmonitor.py index e4dbc68ebf1d..651776d3e0f3 100755 --- a/src/system-health/health_checker/sysmonitor.py +++ b/src/system-health/health_checker/sysmonitor.py @@ -19,7 +19,6 @@ SELECT_TIMEOUT_MSECS = 1000 QUEUE_TIMEOUT = 15 TASK_STOP_TIMEOUT = 10 -mpmgr = multiprocessing.Manager() logger = Logger(log_identifier=SYSLOG_IDENTIFIER) @@ -420,6 +419,7 @@ def system_service(self): self.state_db = swsscommon.SonicV2Connector(host='127.0.0.1') self.state_db.connect(self.state_db.STATE_DB) + mpmgr = multiprocessing.Manager() myQ = mpmgr.Queue() try: monitor_system_bus = MonitorSystemBusTask(myQ) From 5bb8c1a485c22738b29ef9f0bfaa5419742af043 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Tue, 17 Jan 2023 15:03:13 -0800 Subject: [PATCH 035/113] [PTF] Patch PTF library to use correct VXLAN module (#13155) Why I did it The current PTF library contains a typo - when building a VxLAN packet, it uses the VxLAN module directly from the scapy library which will cause test failures. How I did it Patch simple_vxlan_packet to use the VxLAN module wrapped/defined in packet.py from the PTF library. Signed-off-by: Lawrence Lee --- ...se-VXLAN-module-defined-in-packet.py.patch | 26 +++++++++++++++++++ src/ptf.patch/series | 1 + 2 files changed, 27 insertions(+) create mode 100644 src/ptf.patch/0001-Use-VXLAN-module-defined-in-packet.py.patch create mode 100644 src/ptf.patch/series diff --git a/src/ptf.patch/0001-Use-VXLAN-module-defined-in-packet.py.patch b/src/ptf.patch/0001-Use-VXLAN-module-defined-in-packet.py.patch new file mode 100644 index 000000000000..fb09de687d24 --- /dev/null +++ b/src/ptf.patch/0001-Use-VXLAN-module-defined-in-packet.py.patch @@ -0,0 +1,26 @@ +From 5f0df673c8e2d6a8795346127d176d753217bd24 Mon Sep 17 00:00:00 2001 +From: Lawrence Lee +Date: Fri, 23 Dec 2022 19:32:17 +0000 +Subject: [PATCH] Use VXLAN module defined in packet.py + +Signed-off-by: Lawrence Lee +--- + src/ptf/testutils.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ptf/testutils.py b/src/ptf/testutils.py +index 6394ad3..5aa46b0 100755 +--- a/src/ptf/testutils.py ++++ b/src/ptf/testutils.py +@@ -674,7 +674,7 @@ def simple_vxlan_packet(pktlen=300, + scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, id=ip_id, flags=ip_flags, ihl=ip_ihl, options=ip_options)/ \ + udp_hdr + +- pkt = pkt / VXLAN(vni = vxlan_vni, reserved1 = vxlan_reserved1, reserved2 = vxlan_reserved2) ++ pkt = pkt / scapy.VXLAN(vni = vxlan_vni, reserved1 = vxlan_reserved1, reserved2 = vxlan_reserved2) + + if inner_frame: + pkt = pkt / inner_frame +-- +2.25.1 + diff --git a/src/ptf.patch/series b/src/ptf.patch/series new file mode 100644 index 000000000000..1fe54f0e8329 --- /dev/null +++ b/src/ptf.patch/series @@ -0,0 +1 @@ +0001-Use-VXLAN-module-defined-in-packet.py.patch From d55913a679b312cbf23fa63d7d8ef19cde1111f9 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Wed, 18 Jan 2023 13:35:11 +0800 Subject: [PATCH 036/113] [build] Check if patches are applied before applying patches (#13386) Why I did it If make fails, we can't rerun the make process, because existing patches can't apply again. How I did it Check if patches are applied. if yes, don't apply patches again. How to verify it --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index 2d8006fb8aad..cf529dc19856 100644 --- a/slave.mk +++ b/slave.mk @@ -623,7 +623,7 @@ $(addprefix $(FILES_PATH)/, $(SONIC_MAKE_FILES)) : $(FILES_PATH)/% : .platform $ # Remove target to force rebuild rm -f $(addprefix $(FILES_PATH)/, $*) # Apply series of patches if exist - if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi # Build project and take package make DEST=$(shell pwd)/$(FILES_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(FILES_PATH)/$* $(LOG) # Clean up From 63f2ab2cc33f7e8fe028100efaac04ef920160d5 Mon Sep 17 00:00:00 2001 From: Yoush <63637102+youshcentec@users.noreply.github.com> Date: Thu, 19 Jan 2023 01:24:28 +0800 Subject: [PATCH 037/113] [BugFix] Fix the bug that it gets error system-mac of centec platform (#12721) Why I did it When getting system mac of centec platform, it would increase by 1 the last byte of mac, but it could not consider the case of carry. How I did it Firstly, I would replace the ":" with "" of mac to a string. And then, I would convert the mac from string to int and increase by 1, at last convert it to string with inserting ":". --- src/sonic-py-common/sonic_py_common/device_info.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sonic-py-common/sonic_py_common/device_info.py b/src/sonic-py-common/sonic_py_common/device_info.py index 48a7e76e2f81..5fc7f13c3082 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -647,9 +647,10 @@ def get_system_mac(namespace=None): # Align last byte of MAC if necessary if version_info and version_info['asic_type'] == 'centec': - last_byte = mac[-2:] - aligned_last_byte = format(int(int(last_byte, 16) + 1), '02x') - mac = mac[:-2] + aligned_last_byte + mac_tmp = mac.replace(':','') + mac_tmp = "{:012x}".format(int(mac_tmp, 16) + 1) + mac_tmp = re.sub("(.{2})", "\\1:", mac_tmp, 0, re.DOTALL) + mac = mac_tmp[:-1] return mac From 892f26556ce546d3838aa34215c510a1f852df16 Mon Sep 17 00:00:00 2001 From: Jemston Fernando Date: Wed, 18 Jan 2023 23:30:07 +0530 Subject: [PATCH 038/113] [platform]: Fix Belgite platform issues (#13389) As part of platform hardening this commit fixes several platform issues in various components like PSU, FAN, Temperature, LED. --- .../CELESTICA-BELGITE/hwsku.json | 284 +++++++++++++ .../x86_64-cel_belgite-r0/custom_led.bin | Bin 216 -> 220 bytes .../led-source-code/cmicx/custom_led.c | 2 +- .../x86_64-cel_belgite-r0/led_proc_init.soc | 2 +- .../x86_64-cel_belgite-r0/pddf/pd-plugin.json | 8 +- .../pddf/pddf-device.json | 24 +- .../x86_64-cel_belgite-r0/platform.json | 400 +++++++++++++++++- .../platform_components.json | 10 + .../x86_64-cel_belgite-r0/plugins/psuutil.py | 78 ++++ .../x86_64-cel_belgite-r0/plugins/sfputil.py | 142 +++++++ .../pmon_daemon_control.json | 4 +- .../system_health_monitoring_config.json | 8 +- .../belgite/pddf/sonic_platform/chassis.py | 130 ++++-- .../belgite/pddf/sonic_platform/component.py | 67 ++- .../belgite/pddf/sonic_platform/fan.py | 126 ++---- .../belgite/pddf/sonic_platform/psu.py | 18 + .../scripts/pddf_post_device_create.sh | 3 + 17 files changed, 1121 insertions(+), 185 deletions(-) create mode 100644 device/celestica/x86_64-cel_belgite-r0/CELESTICA-BELGITE/hwsku.json create mode 100644 device/celestica/x86_64-cel_belgite-r0/platform_components.json create mode 100644 device/celestica/x86_64-cel_belgite-r0/plugins/psuutil.py create mode 100644 device/celestica/x86_64-cel_belgite-r0/plugins/sfputil.py diff --git a/device/celestica/x86_64-cel_belgite-r0/CELESTICA-BELGITE/hwsku.json b/device/celestica/x86_64-cel_belgite-r0/CELESTICA-BELGITE/hwsku.json new file mode 100644 index 000000000000..160d768bde98 --- /dev/null +++ b/device/celestica/x86_64-cel_belgite-r0/CELESTICA-BELGITE/hwsku.json @@ -0,0 +1,284 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet1": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet2": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet3": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet4": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet5": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet6": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet7": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet8": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet9": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet10": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet11": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet12": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet13": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet14": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet15": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet16": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet17": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet18": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet19": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet20": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet21": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet22": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet23": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet24": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet25": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet26": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet27": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet28": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet29": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet30": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet31": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet32": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet33": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet34": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet35": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet36": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet37": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet38": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet39": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet40": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet41": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet42": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet43": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet44": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet45": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet46": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet47": { + "default_brkout_mode": "1x1000[100,10]", + "autoneg": "on", + "fec": "none" + }, + "Ethernet48": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off", + "fec": "none" + }, + "Ethernet49": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off", + "fec": "none" + }, + "Ethernet50": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off", + "fec": "none" + }, + "Ethernet51": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off", + "fec": "none" + }, + "Ethernet52": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off", + "fec": "none" + }, + "Ethernet53": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off", + "fec": "none" + }, + "Ethernet54": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off", + "fec": "none" + }, + "Ethernet55": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off", + "fec": "none" + } + } +} \ No newline at end of file diff --git a/device/celestica/x86_64-cel_belgite-r0/custom_led.bin b/device/celestica/x86_64-cel_belgite-r0/custom_led.bin index 6973a4c9a73a6d0ee9eaac6150be92d1933ddf5b..c1b5e0e1b1d6df0a03d57ba312715b5ebb0b772e 100644 GIT binary patch delta 114 zcmV-&0FD3H0o(x`@U_N90JRuO765QI03-t?fFqbjeme_5oJI=ZkuVfF3(ymY0Xv%j z0ccxV9YXEUDFA0i059&*=;r|=!(jj;17bHKLSi*Kf?~s9!(zi@!(@QGxJK~3Y>{PS U5Ig`n06PFV06qXf06hRd0NV*BaR2}S delta 126 zcmV-^0D=G90oVa$@U=%qfV3A%765QI03-t?fFqbjeme_5oJJFf0Xv%j0ccxV9YO=p zDFA0i051g5K}HKeSwdMs0x?5q8B+o>1T?Zj>Cpir!(jj;17bHKLSi*Kf?~s9!(zi@ g!(;@!kVf#mXpw1S5IO)n0673V06+jf06zdd0ITmN3IG5A diff --git a/device/celestica/x86_64-cel_belgite-r0/led-source-code/cmicx/custom_led.c b/device/celestica/x86_64-cel_belgite-r0/led-source-code/cmicx/custom_led.c index 92fe25f5b898..712b5503e34b 100755 --- a/device/celestica/x86_64-cel_belgite-r0/led-source-code/cmicx/custom_led.c +++ b/device/celestica/x86_64-cel_belgite-r0/led-source-code/cmicx/custom_led.c @@ -105,7 +105,7 @@ unsigned short portmap[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, - 58, 60, 57, 59, 64, 62, 63, 61 + 60, 58, 59, 57, 62, 64, 61, 63 }; diff --git a/device/celestica/x86_64-cel_belgite-r0/led_proc_init.soc b/device/celestica/x86_64-cel_belgite-r0/led_proc_init.soc index f7192c5b081c..57ee7fedaf2b 100644 --- a/device/celestica/x86_64-cel_belgite-r0/led_proc_init.soc +++ b/device/celestica/x86_64-cel_belgite-r0/led_proc_init.soc @@ -1,3 +1,3 @@ m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin +led auto on led start - diff --git a/device/celestica/x86_64-cel_belgite-r0/pddf/pd-plugin.json b/device/celestica/x86_64-cel_belgite-r0/pddf/pd-plugin.json index 05d724f3622b..454afd239964 100644 --- a/device/celestica/x86_64-cel_belgite-r0/pddf/pd-plugin.json +++ b/device/celestica/x86_64-cel_belgite-r0/pddf/pd-plugin.json @@ -5,7 +5,7 @@ { "i2c": { - "valmap-SFP28": {"1":false, "0":true } + "valmap-SFP+": {"1":false, "0":true } } } }, @@ -29,7 +29,7 @@ { "i2c": { - "valmap": { "F2B":"INTAKE", "B2F":"EXHAUST" } + "valmap": { "0":"INTAKE", "1":"EXHAUST" } } }, "PSU_FAN_MAX_SPEED":"18000" @@ -50,10 +50,6 @@ "valmap": {"1":false, "0":true} } }, - "fan_master_led_color": - { - "colmap": {"green":"green", "red":"amber"} - }, "duty_cycle_to_pwm": "lambda dc: dc*255/100", "pwm_to_duty_cycle": "lambda pwm: pwm/255*100" diff --git a/device/celestica/x86_64-cel_belgite-r0/pddf/pddf-device.json b/device/celestica/x86_64-cel_belgite-r0/pddf/pddf-device.json index 7ccbd41fffea..a97102c1f4cb 100644 --- a/device/celestica/x86_64-cel_belgite-r0/pddf/pddf-device.json +++ b/device/celestica/x86_64-cel_belgite-r0/pddf/pddf-device.json @@ -179,7 +179,7 @@ { "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc5", "attr_mask":"0x18", "attr_cmpval":"0x08", "attr_len":"1"}, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x80", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"1"}, { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] @@ -215,7 +215,7 @@ { "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc5", "attr_mask":"0x18", "attr_cmpval":"0x08", "attr_len":"1"}, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x80", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"1"}, { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] @@ -283,7 +283,7 @@ }, "PORT49": { - "dev_info": { "device_type":"SFP28", "device_name":"PORT49", "device_parent":"MUX2"}, + "dev_info": { "device_type":"SFP+", "device_name":"PORT49", "device_parent":"MUX2"}, "dev_attr": { "dev_idx":"49"}, "i2c": { @@ -324,7 +324,7 @@ }, "PORT50": { - "dev_info": { "device_type":"SFP28", "device_name":"PORT50", "device_parent":"MUX2"}, + "dev_info": { "device_type":"SFP+", "device_name":"PORT50", "device_parent":"MUX2"}, "dev_attr": { "dev_idx":"50"}, "i2c": { @@ -366,7 +366,7 @@ }, "PORT51": { - "dev_info": { "device_type":"SFP28", "device_name":"PORT51", "device_parent":"MUX2"}, + "dev_info": { "device_type":"SFP+", "device_name":"PORT51", "device_parent":"MUX2"}, "dev_attr": { "dev_idx":"51"}, "i2c": { @@ -407,7 +407,7 @@ }, "PORT52": { - "dev_info": { "device_type":"SFP28", "device_name":"PORT52", "device_parent":"MUX2"}, + "dev_info": { "device_type":"SFP+", "device_name":"PORT52", "device_parent":"MUX2"}, "dev_attr": { "dev_idx":"52"}, "i2c": { @@ -449,7 +449,7 @@ }, "PORT53": { - "dev_info": { "device_type":"SFP28", "device_name":"PORT53", "device_parent":"MUX2"}, + "dev_info": { "device_type":"SFP+", "device_name":"PORT53", "device_parent":"MUX2"}, "dev_attr": { "dev_idx":"53"}, "i2c": { @@ -491,7 +491,7 @@ }, "PORT54": { - "dev_info": { "device_type":"SFP28", "device_name":"PORT54", "device_parent":"MUX2"}, + "dev_info": { "device_type":"SFP+", "device_name":"PORT54", "device_parent":"MUX2"}, "dev_attr": { "dev_idx":"54"}, "i2c": { @@ -532,7 +532,7 @@ }, "PORT55": { - "dev_info": { "device_type":"SFP28", "device_name":"PORT55", "device_parent":"MUX2"}, + "dev_info": { "device_type":"SFP+", "device_name":"PORT55", "device_parent":"MUX2"}, "dev_attr": { "dev_idx":"55"}, "i2c": { @@ -573,7 +573,7 @@ }, "PORT56": { - "dev_info": { "device_type":"SFP28", "device_name":"PORT56", "device_parent":"MUX2"}, + "dev_info": { "device_type":"SFP+", "device_name":"PORT56", "device_parent":"MUX2"}, "dev_attr": { "dev_idx":"56"}, "i2c": { @@ -642,7 +642,7 @@ [ {"attr_name":"STATUS_LED_COLOR_AMBER","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x1","swpld_addr_offset":"0x43"}, {"attr_name":"STATUS_LED_COLOR_GREEN","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x2","swpld_addr_offset":"0x43"}, - {"attr_name":"STATUS_LED_COLOR_OFF","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x0","swpld_addr_offset":"0x43"} + {"attr_name":"STATUS_LED_COLOR_OFF","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x3","swpld_addr_offset":"0x43"} ] } }, @@ -666,7 +666,7 @@ "attr_list": [ {"attr_name":"STATUS_LED_COLOR_GREEN","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x1","swpld_addr":"0x32","swpld_addr_offset":"0x37"}, - {"attr_name":"STATUS_LED_COLOR_AMBER","attr_devtype":"cpld","attr_devname":"CPLD1B","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x37"} + {"attr_name":"STATUS_LED_COLOR_AMBER","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x37"} ] } }, diff --git a/device/celestica/x86_64-cel_belgite-r0/platform.json b/device/celestica/x86_64-cel_belgite-r0/platform.json index 1d4a1f9e3420..0e40fe8a88fa 100644 --- a/device/celestica/x86_64-cel_belgite-r0/platform.json +++ b/device/celestica/x86_64-cel_belgite-r0/platform.json @@ -11,10 +11,7 @@ "name": "SWCPLD" }, { - "name": "Main_BIOS" - }, - { - "name": "Backup_BIOS" + "name": "BIOS" } ], "fans": [ @@ -391,5 +388,398 @@ } ] }, - "interfaces": {} + "interfaces": { + "Ethernet0": { + "index": "1", + "lanes": "26", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/1"] + } + }, + "Ethernet1": { + "index": "2", + "lanes": "25", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/2"] + } + }, + "Ethernet2": { + "index": "3", + "lanes": "28", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/3"] + } + }, + "Ethernet3": { + "index": "4", + "lanes": "27", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/4"] + } + }, + "Ethernet4": { + "index": "5", + "lanes": "30", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/5"] + } + }, + "Ethernet5": { + "index": "6", + "lanes": "29", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/6"] + } + }, + "Ethernet6": { + "index": "7", + "lanes": "32", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/7"] + } + }, + "Ethernet7": { + "index": "8", + "lanes": "31", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/8"] + } + }, + "Ethernet8": { + "index": "9", + "lanes": "34", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/9"] + } + }, + "Ethernet9": { + "index": "10", + "lanes": "33", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/10"] + } + }, + "Ethernet10": { + "index": "11", + "lanes": "36", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/11"] + } + }, + "Ethernet11": { + "index": "12", + "lanes": "35", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/12"] + } + }, + "Ethernet12": { + "index": "13", + "lanes": "38", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/13"] + } + }, + "Ethernet13": { + "index": "14", + "lanes": "37", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/14"] + } + }, + "Ethernet14": { + "index": "15", + "lanes": "40", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/15"] + } + }, + "Ethernet15": { + "index": "16", + "lanes": "39", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/16"] + } + }, + "Ethernet16": { + "index": "17", + "lanes": "42", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/17"] + } + }, + "Ethernet17": { + "index": "18", + "lanes": "41", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/18"] + } + }, + "Ethernet18": { + "index": "19", + "lanes": "44", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/19"] + } + }, + "Ethernet19": { + "index": "20", + "lanes": "43", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/20"] + } + }, + "Ethernet20": { + "index": "21", + "lanes": "50", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/21"] + } + }, + "Ethernet21": { + "index": "22", + "lanes": "49", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/22"] + } + }, + "Ethernet22": { + "index": "23", + "lanes": "52", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/23"] + } + }, + "Ethernet23": { + "index": "24", + "lanes": "51", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/24"] + } + }, + "Ethernet24": { + "index": "25", + "lanes": "2", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/25"] + } + }, + "Ethernet25": { + "index": "26", + "lanes": "1", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/26"] + } + }, + "Ethernet26": { + "index": "27", + "lanes": "4", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/27"] + } + }, + "Ethernet27": { + "index": "28", + "lanes": "3", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/28"] + } + }, + "Ethernet28": { + "index": "29", + "lanes": "6", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/29"] + } + }, + "Ethernet29": { + "index": "30", + "lanes": "5", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/30"] + } + }, + "Ethernet30": { + "index": "31", + "lanes": "8", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/31"] + } + }, + "Ethernet31": { + "index": "32", + "lanes": "7", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/32"] + } + }, + "Ethernet32": { + "index": "33", + "lanes": "10", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/33"] + } + }, + "Ethernet33": { + "index": "34", + "lanes": "9", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/34"] + } + }, + "Ethernet34": { + "index": "35", + "lanes": "12", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/35"] + } + }, + "Ethernet35": { + "index": "36", + "lanes": "11", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/36"] + } + }, + "Ethernet36": { + "index": "37", + "lanes": "14", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/37"] + } + }, + "Ethernet37": { + "index": "38", + "lanes": "13", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/38"] + } + }, + "Ethernet38": { + "index": "39", + "lanes": "16", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/39"] + } + }, + "Ethernet39": { + "index": "40", + "lanes": "15", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/40"] + } + }, + "Ethernet40": { + "index": "41", + "lanes": "18", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/41"] + } + }, + "Ethernet41": { + "index": "42", + "lanes": "17", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/42"] + } + }, + "Ethernet42": { + "index": "43", + "lanes": "20", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/43"] + } + }, + "Ethernet43": { + "index": "44", + "lanes": "19", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/44"] + } + }, + "Ethernet44": { + "index": "45", + "lanes": "22", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/45"] + } + }, + "Ethernet45": { + "index": "46", + "lanes": "21", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/46"] + } + }, + "Ethernet46": { + "index": "47", + "lanes": "24", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/47"] + } + }, + "Ethernet47": { + "index": "48", + "lanes": "23", + "breakout_modes": { + "1x1000[100,10]": ["Ethernet1/0/48"] + } + }, + "Ethernet48": { + "index": "49", + "lanes": "60", + "breakout_modes": { + "1x10G[1G]": ["Ethernet1/0/49"] + } + }, + "Ethernet49": { + "index": "50", + "lanes": "58", + "breakout_modes": { + "1x10G[1G]": ["Ethernet1/0/50"] + } + }, + "Ethernet50": { + "index": "51", + "lanes": "59", + "breakout_modes": { + "1x10G[1G]": ["Ethernet1/0/51"] + } + }, + "Ethernet51": { + "index": "52", + "lanes": "57", + "breakout_modes": { + "1x10G[1G]": ["Ethernet1/0/52"] + } + }, + "Ethernet52": { + "index": "53", + "lanes": "62", + "breakout_modes": { + "1x10G[1G]": ["Ethernet1/0/53"] + } + }, + "Ethernet53": { + "index": "54", + "lanes": "64", + "breakout_modes": { + "1x10G[1G]": ["Ethernet1/0/54"] + } + }, + "Ethernet54": { + "index": "55", + "lanes": "61", + "breakout_modes": { + "1x10G[1G]": ["Ethernet1/0/55"] + } + }, + "Ethernet55": { + "index": "56", + "lanes": "63", + "breakout_modes": { + "1x10G[1G]": ["Ethernet1/0/56"] + } + } + } } diff --git a/device/celestica/x86_64-cel_belgite-r0/platform_components.json b/device/celestica/x86_64-cel_belgite-r0/platform_components.json new file mode 100644 index 000000000000..23a4ce41cd67 --- /dev/null +++ b/device/celestica/x86_64-cel_belgite-r0/platform_components.json @@ -0,0 +1,10 @@ +{ + "chassis": { + "E1070": { + "component": { + "SWCPLD": {}, + "BIOS": {} + } + } + } +} diff --git a/device/celestica/x86_64-cel_belgite-r0/plugins/psuutil.py b/device/celestica/x86_64-cel_belgite-r0/plugins/psuutil.py new file mode 100644 index 000000000000..056a3f1b179c --- /dev/null +++ b/device/celestica/x86_64-cel_belgite-r0/plugins/psuutil.py @@ -0,0 +1,78 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + +import os + +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) + + 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 + :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 + + if index == 1: + status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-4/4-0058/psu_power_good" + elif index == 2: + status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-4/4-0059/psu_power_good" + else: + return False + + try: + with open(status_path, 'r') as fd: + status = fd.read().rstrip('\r\n') + if status == '0': + return True + else: + return False + except IOError: + return False + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based 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 + + if index == 1: + status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-4/4-0058/psu_present" + elif index == 2: + status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-4/4-0059/psu_present" + else: + return False + + try: + with open(status_path, 'r') as fd: + status = fd.read().rstrip('\r\n') + if status == '1': + return True + else: + return False + except IOError: + return False diff --git a/device/celestica/x86_64-cel_belgite-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_belgite-r0/plugins/sfputil.py new file mode 100644 index 000000000000..d938bf4c1a26 --- /dev/null +++ b/device/celestica/x86_64-cel_belgite-r0/plugins/sfputil.py @@ -0,0 +1,142 @@ +# Platform-specific SFP transceiver interface for SONiC +# + +try: + 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 = 1 + PORT_END = 56 + SFP_PORT_START = 49 + SFP_PORT_END = 56 + SFP_I2C_BUS_START = 0xa + PORTS_IN_BLOCK = 56 + + _port_to_eeprom_mapping = {} + sfp_status_dict = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return list(range(self.PORT_START, 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/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' + + for port_idx in range(self.SFP_PORT_START, self.SFP_PORT_END + 1): + self._port_to_eeprom_mapping[port_idx] = eeprom_path.format(self.SFP_I2C_BUS_START + (port_idx - self.SFP_PORT_START)) + self.sfp_status_dict[port_idx] = 0 #Initialize all modules as absent/removed + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.SFP_PORT_START or port_num > self.SFP_PORT_END: + return False + + sfp_status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-9/i2c-{0}/{0}-0066/xcvr_present"\ + .format(self.SFP_I2C_BUS_START + (port_num - self.SFP_PORT_START)) + try: + with open(sfp_status_path, 'r') as fd: + status = fd.read().rstrip('\r\n') + if status == '0': + return True + else: + return False + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.SFP_PORT_START or port_num > self.SFP_PORT_END: + return False + + sfp_lpmode_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-9/i2c-{0}/{0}-0066/xcvr_lpmode"\ + .format(self.SFP_I2C_BUS_START + (port_num - self.SFP_PORT_START)) + try: + with open(sfp_lpmode_path, 'r') as fd: + status = fd.read().rstrip('\r\n') + if status == '1': + return True + else: + return False + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.SFP_PORT_START or port_num > self.SFP_PORT_END: + return False + + sfp_lpmode_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-9/i2c-{0}/{0}-0066/xcvr_lpmode"\ + .format(self.SFP_I2C_BUS_START + (port_num - self.SFP_PORT_START)) + try: + with open(sfp_lpmode_path, 'w') as fd: + if lpmode: + fd.write('1') + else: + fd.write('0') + + return True + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + return False + + def reset(self, port_num): + # SFP reset is not supported + return False + + def get_transceiver_change_event(self, timeout=0): + sfp_dict = {} + + SFP_REMOVED = '0' + SFP_INSERTED = '1' + + SFP_PRESENT = True + SFP_ABSENT = False + + start_time = time.time() + time_period = timeout/float(1000) #Convert msecs to secs + + while time.time() < (start_time + time_period) or timeout == 0: + for port_idx in range(self.SFP_PORT_START, self.SFP_PORT_END + 1): + if self.sfp_status_dict[port_idx] == SFP_REMOVED and \ + self.get_presence(port_idx) == SFP_PRESENT: + sfp_dict[str(port_idx)] = SFP_INSERTED + self.sfp_status_dict[port_idx] = SFP_INSERTED + elif self.sfp_status_dict[port_idx] == SFP_INSERTED and \ + self.get_presence(port_idx) == SFP_ABSENT: + sfp_dict[str(port_idx)] = SFP_REMOVED + self.sfp_status_dict[port_idx] = SFP_REMOVED + + if sfp_dict != {}: + return (True, {'sfp':sfp_dict}) + + time.sleep(0.5) + + return (True, {}) # Timeout diff --git a/device/celestica/x86_64-cel_belgite-r0/pmon_daemon_control.json b/device/celestica/x86_64-cel_belgite-r0/pmon_daemon_control.json index 689def2c1e25..32250390cde4 100644 --- a/device/celestica/x86_64-cel_belgite-r0/pmon_daemon_control.json +++ b/device/celestica/x86_64-cel_belgite-r0/pmon_daemon_control.json @@ -1,4 +1,6 @@ { "skip_ledd": true, - "skip_pcied": true + "skip_pcied": true, + "skip_fancontrol": true, + "skip_xcvrd_cmis_mgr": true } diff --git a/device/celestica/x86_64-cel_belgite-r0/system_health_monitoring_config.json b/device/celestica/x86_64-cel_belgite-r0/system_health_monitoring_config.json index 4dc38d035ab4..28b3e30a6699 100644 --- a/device/celestica/x86_64-cel_belgite-r0/system_health_monitoring_config.json +++ b/device/celestica/x86_64-cel_belgite-r0/system_health_monitoring_config.json @@ -3,14 +3,14 @@ "devices_to_ignore": [ "asic", "psu.temperature", - "PSU2 Fan", - "PSU1 Fan" + "PSU1_FAN1", + "PSU2_FAN1" ], "user_defined_checkers": [], "polling_interval": 60, "led_color": { - "fault": "orange", + "fault": "amber", "normal": "green", "booting": "orange_blink" } -} \ No newline at end of file +} diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/chassis.py index 5e2b204e3d0b..ed2e339461ac 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/chassis.py @@ -4,6 +4,7 @@ # ############################################################################# import os +import time try: from sonic_platform_pddf_base.pddf_chassis import PddfChassis @@ -14,26 +15,29 @@ import sys import subprocess from sonic_py_common import device_info + from sonic_platform_base.sfp_base import SfpBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -NUM_COMPONENT = 3 -FAN_DIRECTION_FILE_PATH = "/var/fan_direction" +NUM_COMPONENT = 2 class Chassis(PddfChassis): """ PDDF Platform-specific Chassis class """ + sfp_status_dict = {} def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfChassis.__init__(self, pddf_data, pddf_plugin_data) - vendor_ext = self._eeprom.vendor_ext_str() - with open(FAN_DIRECTION_FILE_PATH, "w+") as f: - f.write(vendor_ext) (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() self.__initialize_components() + self.sfp_port_list = list(range(49, 56+1)) + + for port_idx in self.sfp_port_list: + present = self.get_sfp(port_idx).get_presence() + self.sfp_status_dict[port_idx] = '1' if present else '0' def __initialize_components(self): from sonic_platform.component import Component @@ -121,12 +125,14 @@ def get_reboot_cause(self): description = 'Unkown Reason' return (reboot_cause, description) - - def get_serial(self): - return self._eeprom.serial_number_str() - + def get_revision(self): - return self._eeprom.revision_str() + version_str = self._eeprom.revision_str() + + if version_str != "NA": + return str(bytearray(version_str, 'ascii')[0]) + + return version_str @staticmethod def get_position_in_parent(): @@ -134,19 +140,7 @@ def get_position_in_parent(): @staticmethod def is_replaceable(): - return True - - def get_base_mac(self): - return self._eeprom.base_mac_addr() - - def get_system_eeprom_info(self): - return self._eeprom.system_eeprom_info() - - def get_name(self): - return self.modelstr() - - def get_model(self): - return self._eeprom.part_number_str() + return False def set_status_led(self, color): color_dict = { @@ -155,8 +149,94 @@ def set_status_led(self, color): 'amber': "STATUS_LED_COLOR_AMBER", 'off': "STATUS_LED_COLOR_OFF" } - return self.set_system_led("SYS_LED", color_dict.get(color, "off")) + return self.set_system_led("SYS_LED", color_dict.get(color, "STATUS_LED_COLOR_OFF")) def get_status_led(self): return self.get_system_led("SYS_LED") - + + def get_port_or_cage_type(self, index): + """ + Retrieves sfp port or cage type corresponding to physical port + + Args: + index: An integer (>=0), the index of the sfp to retrieve. + The index should correspond to the physical port in a chassis. + For example:- + 1 for Ethernet0, 2 for Ethernet4 and so on for one platform. + 0 for Ethernet0, 1 for Ethernet4 and so on for another platform. + + Returns: + The masks of all types of port or cage that can be supported on the port + Types are defined in sfp_base.py + Eg. + Both SFP and SFP+ are supported on the port, the return value should be 0x0a + which is 0x02 | 0x08 + """ + if index in range(1, 48+1): + return SfpBase.SFP_PORT_TYPE_BIT_RJ45 + elif index in range(49, 56+1): + return (SfpBase.SFP_PORT_TYPE_BIT_SFP | SfpBase.SFP_PORT_TYPE_BIT_SFP_PLUS) + else: + raise NotImplementedError + + def get_change_event(self, timeout=0): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + + Args: + timeout: Timeout in milliseconds (optional). If timeout == 0, + this method will block until a change is detected. + + Returns: + (bool, dict): + - True if call successful, False if not; + - A nested dictionary where key is a device type, + value is a dictionary with key:value pairs in the format of + {'device_id':'device_event'}, + where device_id is the device ID for this device and + device_event, + status='1' represents device inserted, + status='0' represents device removed. + Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} + indicates that fan 0 has been removed, fan 2 + has been inserted and sfp 11 has been removed. + Specifically for SFP event, besides SFP plug in and plug out, + there are some other error event could be raised from SFP, when + these error happened, SFP eeprom will not be avalaible, XCVRD shall + stop to read eeprom before SFP recovered from error status. + status='2' I2C bus stuck, + status='3' Bad eeprom, + status='4' Unsupported cable, + status='5' High Temperature, + status='6' Bad cable. + """ + + sfp_dict = {} + + SFP_REMOVED = '0' + SFP_INSERTED = '1' + + SFP_PRESENT = True + SFP_ABSENT = False + + start_time = time.time() + time_period = timeout/float(1000) #Convert msecs to secs + + while time.time() < (start_time + time_period) or timeout == 0: + for port_idx in self.sfp_port_list: + if self.sfp_status_dict[port_idx] == SFP_REMOVED and \ + self.get_sfp(port_idx).get_presence() == SFP_PRESENT: + sfp_dict[port_idx] = SFP_INSERTED + self.sfp_status_dict[port_idx] = SFP_INSERTED + elif self.sfp_status_dict[port_idx] == SFP_INSERTED and \ + self.get_sfp(port_idx).get_presence() == SFP_ABSENT: + sfp_dict[port_idx] = SFP_REMOVED + self.sfp_status_dict[port_idx] = SFP_REMOVED + + if sfp_dict: + return True, {'sfp':sfp_dict} + + time.sleep(0.5) + + return True, {'sfp':{}} # Timeout diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/component.py index 7fee0aee58c1..3b68c5759b5a 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/component.py @@ -9,21 +9,19 @@ ############################################################################# import subprocess +import time try: from sonic_platform_base.component_base import ComponentBase - from sonic_py_common.general import getstatusoutput_noshell_pipe #from helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") -SWCPLD_VERSION_PATH = ["i2cget", "-y", "-f", "2", "0x32", "0"] -BIOS_VERSION_PATH_CMD1 = ["dmidecode", "-t", "bios"] -BIOS_VERSION_PATH_CMD2 = ["grep", "Version"] -COMPONENT_NAME_LIST = ["SWCPLD", "Main_BIOS", "Backup_BIOS"] -COMPONENT_DES_LIST = ["Use for boot control and BIOS switch", - "Main basic Input/Output System", - "Backup basic Input/Output System"] +SWCPLD_VERSION_PATH = ['i2cget', '-y', '-f', '2', '0x32', '0'] +BIOS_VERSION_PATH = ['dmidecode', '-s', 'bios-version'] +COMPONENT_NAME_LIST = ["SWCPLD", "BIOS"] +COMPONENT_DES_LIST = ["Used for managing the chassis and SFP+ ports (49-56)", + "Basic Input/Output System"] class Component(ComponentBase): @@ -34,43 +32,32 @@ class Component(ComponentBase): def __init__(self, component_index): ComponentBase.__init__(self) self.index = component_index - #self._api_helper = APIHelper() self.name = self.get_name() - def run_command(self,cmd): - responses = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True).stdout.read() - return responses - def __get_bios_version(self): # Retrieves the BIOS firmware version - result = self.run_command(["i2cget", "-y", "-f", "2", "0x32", "0x19"]) - if result.strip() == "0x01": - if self.name == "Main_BIOS": - _, version = getstatusoutput_noshell_pipe(BIOS_VERSION_PATH_CMD1, BIOS_VERSION_PATH_CMD2) - bios_version = version.strip().split(" ")[1] - return str(bios_version) - elif self.name == "Backup_BIOS": - bios_version = "na" - return bios_version - - elif result.strip() == "0x03": - if self.name == "Backup_BIOS": - _, version = getstatusoutput_noshell_pipe(BIOS_VERSION_PATH_CMD1, BIOS_VERSION_PATH_CMD2) - bios_version = version.strip().split(" ")[1] - return str(bios_version) - elif self.name == "Main_BIOS": - bios_version = "na" - return bios_version + version = "N/A" - def __get_cpld_version(self): - if self.name == "SWCPLD": - ver = self.run_command(SWCPLD_VERSION_PATH) - print("ver is %s" % ver) - ver = ver.strip().split("x")[1] - print("ver2 is %s" % ver) - version = int(ver.strip()) / 10 - return str(version) + try: + p = subprocess.Popen(BIOS_VERSION_PATH, stdout=subprocess.PIPE, universal_newlines=True) + data = p.communicate() + version = data[0].strip() + except IOError: + pass + return version + + def __get_cpld_version(self): + version = "N/A" + try: + p = subprocess.Popen(SWCPLD_VERSION_PATH, stdout=subprocess.PIPE, universal_newlines=True) + data = p.communicate() + ver = int(data[0].strip(), 16) + version = "{0}.{1}".format(ver >> 4, ver & 0x0F) + except (IOError, ValueError): + pass + + return version def get_name(self): """ @@ -96,7 +83,7 @@ def get_firmware_version(self): """ fw_version = None - if "BIOS" in self.name: + if self.name == "BIOS": fw_version = self.__get_bios_version() elif "CPLD" in self.name: fw_version = self.__get_cpld_version() diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/fan.py index d5ee08049d78..5ece7e980980 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/fan.py @@ -9,7 +9,6 @@ # add function:set_status_led, # Solve the problem that when a fan is pulled out, the Fan LED on the front panel is still green Issue-#11525 # ------------------------------------------------------------------ -FAN_DIRECTION_FILE_PATH = "/var/fan_direction" class Fan(PddfFan): @@ -31,11 +30,25 @@ def get_speed_tolerance(self): # Fix the speed vairance to 10 percent. If it changes based on platforms, overwrite # this value in derived pddf fan class return 20 - - + def get_presence(self): - #Overwirte the PDDF Common since the FANs on Belgite are all Fixed and present - return True + if self.is_psu_fan: + #For PSU, FAN must be present when PSU is present + try: + cmd = ['i2cget', '-y', '-f', '0x2', '0x32', '0x41'] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) + data = p.communicate() + status = int(data[0].strip(), 16) + if (self.fans_psu_index == 1 and (status & 0x10) == 0) or \ + (self.fans_psu_index == 2 and (status & 0x20) == 0): + return True + except (IOError, ValueError): + pass + + return False + else: + #Overwirte the PDDF Common since the FANs on Belgite are all Fixed and present + return True def get_direction(self): """ @@ -46,102 +59,35 @@ def get_direction(self): depending on fan direction """ if self.is_psu_fan: - cmd_num = "58" if self.fans_psu_index == 1 else "59" - cmd = ["i2cget", "-y", "-f", "4", "", "0x80"] - cmd[4] = "0x" + cmd_num - res = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True).stdout.read() - # F2B - if res.strip() == "0x01": - direction = "EXHAUST" - else: - direction = "INTAKE" + # Belgite PSU module only has EXHAUST fan + return "EXHAUST" else: - direction = "INTAKE" - with open(FAN_DIRECTION_FILE_PATH, "r") as f: - fan_direction = f.read() - if fan_direction.strip() == "FB": - direction = "EXHAUST" - return direction - - - def get_status(self): - speed = self.get_speed_rpm() - status = True if (speed != 0) else False - return status + return super().get_direction() - def get_target_speed(self): + def get_status_led(self): """ - Retrieves the target (expected) speed of the fan + Gets the state of the fan status LED Returns: - An integer, the percentage of full fan speed, in the range 0 (off) - to 100 (full speed) + A string, one of the predefined STATUS_LED_COLOR_* strings above """ - target_speed = 0 if self.is_psu_fan: - # Target speed not usually supported for PSU fans - target_speed = "N/A" + return "N/A" else: - idx = (self.fantray_index - 1) * 1 + self.fan_index - attr = "fan" + str(idx) + "_pwm" - pwm_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-2/2-0066/" + attr - pwm = 0 - with open(pwm_path, "r") as f: - pwm = f.read() - - percentage = int(pwm.strip()) - speed_percentage = int(round(percentage / 255 * 100)) - target_speed = speed_percentage - - return target_speed + return super().get_status_led() def set_status_led(self, color): - color_dict = {"green": "STATUS_LED_COLOR_GREEN", - "red": "STATUS_LED_COLOR_AMBER"} - color = color_dict.get(color, "off") - index = str(self.fantray_index - 1) - led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" - - result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color) - if result is False: - return False - device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path()) - - self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path()) - return True - - @staticmethod - def get_model(): """ - Retrieves the model number (or part number) of the device - Returns: - string: Model/part number of device - """ - model = "Unknown" - return model + Sets the state of the fan module status LED - @staticmethod - def get_serial(): - """ - Retrieves the serial number of the device - Returns: - string: Serial number of device - """ - serial = "Unknown" - return serial + Args: + color: A string representing the color with which to set the + fan module status LED - def get_position_in_parent(self): - """ - Retrieves the fan/psu fan index number - """ - return self.fantray_index if not self.is_psu_fan else self.fans_psu_index + 4 - - @staticmethod - def is_replaceable(): - """ - Retrieves whether the device is replaceable + Returns: + bool: True if status LED state is set successfully, False if not """ - return False + if self.is_psu_fan: + return False + else: + return super().set_status_led(color) diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/psu.py index 9616d030012f..f1047bed740a 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/psu.py @@ -53,3 +53,21 @@ def get_revision(self): def temperature(self): return self.get_temperature() + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + return 12.6 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + return 11.4 diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/scripts/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-cel/belgite/scripts/pddf_post_device_create.sh index 414eea7a2b40..436cf61d6dbe 100755 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/scripts/pddf_post_device_create.sh +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/scripts/pddf_post_device_create.sh @@ -7,4 +7,7 @@ sleep 0.1 #Set LM75 shutdown enable sudo i2cset -y -f 2 0x32 0x45 0x1 +# set sys led green status +sudo i2cset -y -f 2 0x32 0x43 0xec + echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state From dfaf379e2700c279df67d00f07560b0ec1675c2b Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 18 Jan 2023 10:03:48 -0800 Subject: [PATCH 039/113] [Arista] Update platform library submodules (#13398) - add module reboot APIs for chassis - add supervisor module on linecard (fixes show chassis module midplane-status) - improve RTC update mechanism and sync every 10 mins - fix sbtsi temp sensor presence/thresholds - fix Mineral status leds - remove thermal object on xcvrs - misc fixes --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index a006430d9242..4851b192fb3a 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a006430d92421067cb42c0d1cd2e473ab57a74d1 +Subproject commit 4851b192fb3a4a498d33fb648cb5223cf565ef08 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index a006430d9242..4851b192fb3a 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a006430d92421067cb42c0d1cd2e473ab57a74d1 +Subproject commit 4851b192fb3a4a498d33fb648cb5223cf565ef08 From e1f0d7650ea392332432e8ab9c4bb738c3708a6d Mon Sep 17 00:00:00 2001 From: "Marty Y. Lok" <76118573+mlok-nokia@users.noreply.github.com> Date: Wed, 18 Jan 2023 18:47:02 -0500 Subject: [PATCH 040/113] [Nokia][sonic-platform] Update sonic-platform submodule for Nokia IXR7250E (#13145) fcb45b5 Add MDIPC channel cleanup code at signal-based termination time and don't precache in get_presence unless required 8984b3d Properly synchronize transceiver module presence globally Signed-off-by: mlok Signed-off-by: mlok --- platform/broadcom/sonic-platform-modules-nokia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-nokia b/platform/broadcom/sonic-platform-modules-nokia index 1d53bf42a0d4..fcb45b5b60e0 160000 --- a/platform/broadcom/sonic-platform-modules-nokia +++ b/platform/broadcom/sonic-platform-modules-nokia @@ -1 +1 @@ -Subproject commit 1d53bf42a0d4a673896e7180c3679ea99bc21a00 +Subproject commit fcb45b5b60e025b10cfcd088e009f65254003788 From eba30ff26fe48a89610ab64818d5e964dced939d Mon Sep 17 00:00:00 2001 From: Ikki Zhu <79439153+qnos@users.noreply.github.com> Date: Thu, 19 Jan 2023 08:27:48 +0800 Subject: [PATCH 041/113] [Celestica Seastone] fix multi sonic platform issues (#13356) Why I did it Fix the following issues for Seastone platform: - system-health issue: show system-health detail will not complete #9530, Celestica Seastone DX010-C32: show system-health detail fails with 'Chassis' object has no attribute 'initizalize_system_led' #11322 - show platform firmware updates issue: Celestica Seastone DX010-C32: show platform firmware updates #11317 - other platform optimization How I did it Modify and optimize the platform implememtation. How to verify it Manual run the test commands described in these issues. --- .../platform_components.json | 5 +++-- .../sonic_platform/chassis.py | 16 ++++++++++++++-- .../sonic_platform/component.py | 6 ++++-- .../x86_64-cel_seastone-r0/sonic_platform/psu.py | 2 +- .../system_health_monitoring_config.json | 8 +++----- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/platform_components.json b/device/celestica/x86_64-cel_seastone-r0/platform_components.json index cd89d358d46f..8df07b1320ce 100644 --- a/device/celestica/x86_64-cel_seastone-r0/platform_components.json +++ b/device/celestica/x86_64-cel_seastone-r0/platform_components.json @@ -1,13 +1,14 @@ { "chassis": { - "Celestica-DX010-C32": { + "Seastone-DX010": { "component": { "CPLD1": {}, "CPLD2": {}, "CPLD3": {}, "CPLD4": {}, + "CPLD5": {}, "BIOS": {} } } } -} \ No newline at end of file +} diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py index 2fc2c60fdc34..2e60cd280024 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py @@ -20,7 +20,7 @@ NUM_PSU = 2 NUM_THERMAL = 5 NUM_SFP = 32 -NUM_COMPONENT = 5 +NUM_COMPONENT = 6 RESET_REGISTER = "0x103" HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" @@ -43,6 +43,7 @@ def __init__(self): self.__initialize_psu() self.__initialize_thermals() self.__initialize_components() + self.__initialize_system_led() def __initialize_sfp(self): sfputil_helper = SfpUtilHelper() @@ -85,6 +86,9 @@ def __initialize_components(self): component = Component(index) self._component_list.append(component) + def __initialize_system_led(self): + self.set_status_led(self.STATUS_LED_COLOR_GREEN) + def __get_air_flow(self): air_flow_path = '/usr/share/sonic/device/{}/fan_airflow'.format( self._api_helper.platform) \ @@ -316,6 +320,14 @@ def is_replaceable(self): """ return False + def initizalize_system_led(self): + """ + This function is not defined in chassis base class, + system-health command would invoke chassis.initizalize_system_led(), + add this stub function just to let the command sucessfully execute + """ + pass + def set_status_led(self, color): """ Sets the state of the PSU status LED @@ -344,7 +356,7 @@ def get_status_led(self): """ status = self._api_helper.read_txt_file(STATUS_LED_PATH) status_str = { - '255': self.STATUS_LED_COLOR_GREEN, + '1': self.STATUS_LED_COLOR_GREEN, '0': self.STATUS_LED_COLOR_OFF }.get(status, None) diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/component.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/component.py index da735d2ac097..8b66e7c4b18d 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/component.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/component.py @@ -24,9 +24,11 @@ } GETREG_PATH = "/sys/devices/platform/dx010_cpld/getreg" BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" -COMPONENT_NAME_LIST = ["CPLD1", "CPLD2", "CPLD3", "CPLD4", "BIOS"] +COMPONENT_NAME_LIST = ["CPLD1", "CPLD2", "CPLD3", "CPLD4", "CPLD5", "BIOS"] COMPONENT_DES_LIST = ["Used for managing the CPU", - "Used for managing QSFP+ ports (1-10)", "Used for managing QSFP+ ports (11-20)", "Used for managing QSFP+ ports (22-32)", "Basic Input/Output System"] + "Used for managing QSFP+ ports (1-10)", "Used for managing QSFP+ ports (11-21)", + "Used for misc status and control", "Used for managing QSFP+ ports (22-32)", + "Basic Input/Output System"] class Component(ComponentBase): diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py index 4bb5c95bb1c1..9a674e93e5e2 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py @@ -197,7 +197,7 @@ def set_status_led(self, color): """ set_status_str = { - self.STATUS_LED_COLOR_GREEN: '1', + self.STATUS_LED_COLOR_GREEN: '255', self.STATUS_LED_COLOR_OFF: '0' }.get(color, None) diff --git a/device/celestica/x86_64-cel_seastone-r0/system_health_monitoring_config.json b/device/celestica/x86_64-cel_seastone-r0/system_health_monitoring_config.json index 4dc38d035ab4..c18399188153 100644 --- a/device/celestica/x86_64-cel_seastone-r0/system_health_monitoring_config.json +++ b/device/celestica/x86_64-cel_seastone-r0/system_health_monitoring_config.json @@ -1,10 +1,8 @@ { "services_to_ignore": [], "devices_to_ignore": [ - "asic", - "psu.temperature", - "PSU2 Fan", - "PSU1 Fan" + "PSU-1 FAN-1", + "PSU-2 FAN-1" ], "user_defined_checkers": [], "polling_interval": 60, @@ -13,4 +11,4 @@ "normal": "green", "booting": "orange_blink" } -} \ No newline at end of file +} From e08914769bb176b2c72a33f66d2415e4296fb87a Mon Sep 17 00:00:00 2001 From: Guilt Date: Thu, 19 Jan 2023 18:18:57 +0100 Subject: [PATCH 042/113] [build] Fix SONIC_USERFACL_DOCKERD_FOR_MULTIARCH typo in Makefile.work (#13390) The variable name SONIC_USERFACL_DOCKERD_FOR_MULTIARCH is mispelled in Makefile.work Signed-off-by: Guillaume Lambert --- Makefile.work | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.work b/Makefile.work index 71e83e9eb1b8..a8d3f759360f 100644 --- a/Makefile.work +++ b/Makefile.work @@ -360,19 +360,19 @@ ifeq ($(DOCKER_DATA_ROOT_FOR_MULTIARCH),) endif # Multiarch docker cannot start dockerd service due to iptables cannot run over different arch kernel SONIC_SERVICE_DOCKERD_FOR_MULTIARCH=y - SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH := dockerd --experimental=true --storage-driver=vfs \ + SONIC_NATIVE_DOCKERD_FOR_MULTIARCH := dockerd --experimental=true --storage-driver=vfs \ --data-root=$(DOCKER_DATA_ROOT_FOR_MULTIARCH) --exec-root=/var/run/march/docker/ \ -H unix:///var/run/march/docker.sock -p /var/run/march/docker.pid ifneq ($(DOCKER_CONFIG_FILE_FOR_MULTIARCH),) - SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH += --config-file=$(DOCKER_CONFIG_FILE_FOR_MULTIARCH) + SONIC_NATIVE_DOCKERD_FOR_MULTIARCH += --config-file=$(DOCKER_CONFIG_FILE_FOR_MULTIARCH) endif DOCKER_RUN += -v /var/run/march/docker.sock:/var/run/docker.sock DOCKER_RUN += -v /var/run/march/docker.pid:/var/run/docker.pid DOCKER_RUN += -v /var/run/march/docker:/var/run/docker DOCKER_RUN += -v $(DOCKER_DATA_ROOT_FOR_MULTIARCH):/var/lib/docker - SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH := setfacl -m user:$(USER):rw /var/run/march/docker.sock + SONIC_USERFACL_DOCKERD_FOR_MULTIARCH := setfacl -m user:$(USER):rw /var/run/march/docker.sock #Override Native config to prevent docker service SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD=y @@ -380,7 +380,7 @@ endif DOCKER_MULTIARCH_CHECK := docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes DOCKER_SERVICE_SAFE_KILLER := (MARCH_PID=`ps -eo pid,cmd | grep "[0-9] dockerd.*march" | awk '{print $$1}'`; echo "Killing march docker $$MARCH_PID"; [ -z "$$MARCH_PID" ] || sudo kill -9 "$$MARCH_PID";) - DOCKER_SERVICE_MULTIARCH_CHECK := ($(DOCKER_SERVICE_SAFE_KILLER); sudo rm -fr /var/run/march/; (echo "Starting docker march service..."; sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 2; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);) + DOCKER_SERVICE_MULTIARCH_CHECK := ($(DOCKER_SERVICE_SAFE_KILLER); sudo rm -fr /var/run/march/; (echo "Starting docker march service..."; sudo $(SONIC_NATIVE_DOCKERD_FOR_MULTIARCH) &) &>/dev/null ; sleep 2; sudo $(SONIC_USERFACL_DOCKERD_FOR_MULTIARCH);) # Docker service to load the compiled dockers-*.gz # docker 19.0 version above has path/length restriction, so replaced it with soft link in /tmp/ From 9a0bf56a15ea84663a5d97a014fc8ec41ea631a8 Mon Sep 17 00:00:00 2001 From: Guilt Date: Thu, 19 Jan 2023 18:19:54 +0100 Subject: [PATCH 043/113] [build] Migrate libyang2 sources download from wget to dget (#13394) According to its manual page, "[dget in its] first form, [..] fetches the requested URLs. If this is a .dsc or .changes file, then dget acts as a source-package aware form of wget: it also fetches any files referenced in the .dsc/.changes file. The downloaded source is then checked with dscverify and, if successful, unpacked by dpkg-source." Thus, when possible, dget use is preferable to wget so that sources authenticity can be performed automatically by dscverify" Signed-off-by: Guillaume Lambert --- src/libyang2/Makefile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/libyang2/Makefile b/src/libyang2/Makefile index fab24590a340..c55d15496156 100644 --- a/src/libyang2/Makefile +++ b/src/libyang2/Makefile @@ -2,16 +2,6 @@ SHELL = /bin/bash .SHELLFLAGS += -e -LIBYANG_URL = https://sonicstorage.blob.core.windows.net/debian/pool/main/liby/libyang - -DSC_FILE = libyang2_$(LIBYANG2_FULLVERSION).dsc -ORIG_FILE = libyang2_$(LIBYANG2_VERSION).orig.tar.gz -DEBIAN_FILE = libyang2_$(LIBYANG2_FULLVERSION).debian.tar.xz - -DSC_FILE_URL = $(LIBYANG_URL)/$(DSC_FILE) -ORIG_FILE_URL = $(LIBYANG_URL)/$(ORIG_FILE) -DEBIAN_FILE_URL = $(LIBYANG_URL)/$(DEBIAN_FILE) - MAIN_TARGET = $(LIBYANG2) DERIVED_TARGETS = $(LIBYANG2_DEV) $(LIBYANG2_DBG) $(LIBYANG2_TOOLS) $(LIBYANG2_TOOLS_DBG) @@ -20,10 +10,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -fr ./libyang2-$(LIBYANG2_VERSION) # download debian libyang - wget -NO "$(DSC_FILE)" $(DSC_FILE_URL) - wget -NO "$(ORIG_FILE)" $(ORIG_FILE_URL) - wget -NO "$(DEBIAN_FILE)" $(DEBIAN_FILE_URL) - dpkg-source -x libyang2_$(LIBYANG2_FULLVERSION).dsc + dget https://deb.debian.org/debian/pool/main/liby/libyang2/libyang2_$(LIBYANG2_FULLVERSION).dsc pushd libyang2-$(LIBYANG2_VERSION) #sed -i 's/set(LIBYANG_MAJOR_SOVERSION 1)/set(LIBYANG_MAJOR_SOVERSION 2)/' CMakeLists.txt From e0ed5f968f0c65ee10558b607747e1fcde183526 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 19 Jan 2023 11:08:21 -0800 Subject: [PATCH 044/113] [Arista] add support for hardware sku Arista-7260CX3-D92C16 (#13438) Signed-off-by: Ying Xie Signed-off-by: Ying Xie --- device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D92C16 | 1 + 1 file changed, 1 insertion(+) create mode 120000 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D92C16 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D92C16 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D92C16 new file mode 120000 index 000000000000..fd5bbe75f37c --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D92C16 @@ -0,0 +1 @@ +Arista-7260CX3-D96C16 \ No newline at end of file From d3812621cf5f391b28cdc405787dab46e3b0976b Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Thu, 19 Jan 2023 11:17:12 -0800 Subject: [PATCH 045/113] [linkmgrd] submodule update (#12859) ac24ad1 Liu Shilong Wed Nov 30 18:04:15 2022 +0800 Use github code scanning instead of LGTM (#157) 1c755c4 Jing Zhang Fri Nov 4 17:12:51 2022 -0700 [active-active] Incrementing BOOST_ASIO_STRAND_IMPLEMENTATIONS (#154) sign-off: Jing Zhang zhangjing@microsoft.com --- src/linkmgrd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linkmgrd b/src/linkmgrd index b3501d27daa1..ac24ad14b014 160000 --- a/src/linkmgrd +++ b/src/linkmgrd @@ -1 +1 @@ -Subproject commit b3501d27daa12760e3203c66ea757800d7fe5102 +Subproject commit ac24ad14b0144b1036b8012762f2e1887e4ae532 From 96cecc385a40871a2e253d7858ee280f7c42e46c Mon Sep 17 00:00:00 2001 From: judyjoseph <53951155+judyjoseph@users.noreply.github.com> Date: Thu, 19 Jan 2023 22:42:28 -0800 Subject: [PATCH 046/113] Add explicit dependency on sonic_platform_common (#13446) Why I did it Add explicit dependency on sonic_platform_common in sonic-chassisd mk. This was needed because sonic-chassisd depends on sonic-platform-base which is present in sonic-platform-common wheel package. How I did it Add explicit dependency on sonic_platform_common in sonic-chassisd mk. How to verify it Verified by building all platforms broadcom, mellanox, marvel_arm --- rules/sonic-chassisd.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/sonic-chassisd.mk b/rules/sonic-chassisd.mk index 46a49d359769..6e8a987de2a9 100644 --- a/rules/sonic-chassisd.mk +++ b/rules/sonic-chassisd.mk @@ -2,7 +2,7 @@ SONIC_CHASSISD_PY3 = sonic_chassisd-1.0-py3-none-any.whl $(SONIC_CHASSISD_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-chassisd -$(SONIC_CHASSISD_PY3)_DEPENDS = $(SONIC_PY_COMMON_PY3) +$(SONIC_CHASSISD_PY3)_DEPENDS = $(SONIC_PY_COMMON_PY3) $(SONIC_PLATFORM_COMMON_PY3) $(SONIC_CHASSISD_PY3)_DEBS_DEPENDS = $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) $(SONIC_CHASSISD_PY3)_PYTHON_VERSION = 3 SONIC_PYTHON_WHEELS += $(SONIC_CHASSISD_PY3) From 568e966ff19fa1632b97d148bb6113ff77a562a6 Mon Sep 17 00:00:00 2001 From: mihirpat1 <112018033+mihirpat1@users.noreply.github.com> Date: Fri, 20 Jan 2023 09:46:35 -0800 Subject: [PATCH 047/113] [platform-daemon] Advance submodule head (#13428) a931d6c Prince George Wed Jan 18 19:10:55 2023 -0800 [Xcvrd]: Fix optics insertion/removal not detected (#333) 2211b7e mihirpat1 Wed Jan 18 16:00:22 2023 -0800 Xcvrd should restart if any child thread crashes (#326) 753b550 judyjoseph Tue Jan 17 13:10:09 2023 -0800 Chassisd do an explicit stop of the config_manager (#328) 879d630 Tal Berlowitz Fri Jan 6 01:57:42 2023 +0200 Fix bug where transceiver info is missing after port breakout change (#329) e119b69 Junchao-Mellanox Tue Dec 13 19:54:49 2022 +0800 Remove TODO comments which are no longer needed (#325) Signed-off-by: Mihir Patel --- src/sonic-platform-daemons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 9657a26de312..a931d6c727f4 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 9657a26de312d1eb61f15d13953ec1cd09634443 +Subproject commit a931d6c727f4bf97f893ea52160412a2cb8eca16 From b03a65f331341a6cd91181735a79919ccef3626b Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:11:39 -0800 Subject: [PATCH 048/113] Support both port name and alias in ACL table `AttachTo` attribute (#13444) Why I did it This PR is an enhancement of PR #13105 Because the input string of AttachTo for ACL table can appear in both port name group and port alias group, I added a logic to determine whether the string should be port name or port alias If all the input strings belong to port name group, then we treat all of them as port name If all the input strings belong to port alias, then we treat all of them as port alias If all the input string belongs to both port alias group and port name group, we prefer port alias. The behavior is as before. How I did it Walk through all port names/alias in the input to make a decision. How to verify it Verified by adding UT. --- src/sonic-config-engine/minigraph.py | 48 +- .../simple-sample-graph-case-acl-test.xml | 974 ++++++++++++++++++ .../tests/simple-sample-graph-case.xml | 2 +- ...mple-port-config-duplicated-name-alias.ini | 36 + .../tests/test_minigraph_case.py | 21 +- 5 files changed, 1070 insertions(+), 11 deletions(-) create mode 100644 src/sonic-config-engine/tests/simple-sample-graph-case-acl-test.xml create mode 100644 src/sonic-config-engine/tests/t0-sample-port-config-duplicated-name-alias.ini diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index ecfb2c3cd851..e5f6869b0a58 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -657,6 +657,40 @@ def parse_dpg(dpg, hname): is_mirror = False is_mirror_v6 = False is_mirror_dscp = False + use_port_alias = True + + # Walk through all interface names/alias to determine whether the input string is + # port name or alias.We need this logic because there can be duplicaitons in port alias + # and port names + # The input port name/alias can be either port_name or port_alias. A mix of name and alias is not accepted + port_name_count = 0 + port_alias_count = 0 + total_count = 0 + for member in aclattach: + member = member.strip() + if member in pcs or \ + member in vlans or \ + member.lower().startswith('erspan') or \ + member.lower().startswith('egress_erspan') or \ + member.lower().startswith('erspan_dscp'): + continue + total_count += 1 + if member in port_alias_map: + port_alias_count += 1 + if member in port_names_map: + port_name_count += 1 + # All inputs are port alias + if port_alias_count == total_count: + use_port_alias = True + # All inputs are port name + elif port_name_count == total_count: + use_port_alias = False + # There are both port alias and port name, then port alias is preferred to keep the behavior not changed + else: + use_port_alias = True + # For CTRLPLANE ACL, both counters are 0 + if (port_alias_count != 0) and (port_name_count != 0): + print("Warning: The given port name for ACL " + aclname + " is inconsistent. It must be either port name or alias ", file=sys.stderr) # TODO: Ensure that acl_intfs will only ever contain front-panel interfaces (e.g., # maybe we should explicity ignore management and loopback interfaces?) because we @@ -674,15 +708,15 @@ def parse_dpg(dpg, hname): acl_intfs.extend(vlan_member_list[member]) else: acl_intfs.append(member) - elif (member in port_alias_map) or (member in port_names_map): - if member in port_alias_map: - acl_intf = port_alias_map[member] - else: - acl_intf = member - acl_intfs.append(acl_intf) + elif use_port_alias and (member in port_alias_map): + acl_intfs.append(port_alias_map[member]) # Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface - if acl_intf in intfs_inpc: + if port_alias_map[member] in intfs_inpc: print("Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface", file=sys.stderr) + elif (not use_port_alias) and (member in port_names_map): + acl_intfs.append(member) + if member in intfs_inpc: + print("Warning: ACL " + aclname + " is attached to a LAG member interface " + member + ", instead of LAG interface", file=sys.stderr) elif member.lower().startswith('erspan') or member.lower().startswith('egress_erspan') or member.lower().startswith('erspan_dscp'): if 'dscp' in member.lower(): is_mirror_dscp = True diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case-acl-test.xml b/src/sonic-config-engine/tests/simple-sample-graph-case-acl-test.xml new file mode 100644 index 000000000000..13dbbd17a234 --- /dev/null +++ b/src/sonic-config-engine/tests/simple-sample-graph-case-acl-test.xml @@ -0,0 +1,974 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/4 + + + + + + + + + ab1 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + fc02:2000::1;fc02:2000::2 + 1000 + 1000 + 192.168.0.0/27 + 00:aa:bb:cc:dd:ee + + + ab2 + fortyGigE0/4 + 192.0.0.1 + fc02:2000::3;fc02:2000::4 + 2000 + 2000 + + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + fortyGigE0/0 + 10.0.0.58/31 + + + + fortyGigE0/0 + FC00::75/126 + + + + ab1 + 192.168.0.1/27 + + + + + + PortChannel01;Ethernet20;Ethernet24 + DataAcl_port_name + DataPlane + + + PortChannel01;Ethernet6/1;Ethernet7/1 + DataAcl_port_alias + DataPlane + + + PortChannel01;Ethernet0;Ethernet1;Ethernet2;Ethernet3 + DataAcl_mixed_name_alias_1 + DataPlane + + + PortChannel01;Ethernet1;Ethernet2;Ethernet6/1;Ethernet7/1 + DataAcl_mixed_name_alias_2 + DataPlane + + + Ethernet1 + DataAcl_mixed_name_alias_3 + DataPlane + + + SNMP + SNMP_ACL + SNMP + + + ERSPAN_DSCP + Everflow_dscp + Everflow_dscp + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 10.10.10.2/32 + + 10.10.10.2/32 + + + LoopbackInterface + HostIP1 + Loopback0 + + fe80::0002/128 + + fe80::0002/128 + + + LoopbackInterface + SoCHostIP0 + server2SOC + + 10.10.10.3/32 + + 10.10.10.3/32 + + + LoopbackInterface + SoCHostIP1 + server2SOC + + fe80::0003/128 + + fe80::0003/128 + + + + + + + + server2 + + + + + + + + + + + + + + + DeviceSerialLink + 9600 + switch-t0 + console + true + switch-t1 + 1 + + + DeviceSerialLink + 9600 + switch-t0 + 1 + true + managed_device + console + + + DeviceInterfaceLink + 10000 + switch-t0 + fortyGigE0/0 + switch-01t1 + port1 + + + DeviceInterfaceLink + 10000 + switch-t0 + fortyGigE0/12 + switch-02t1 + port1 + + + DeviceInterfaceLink + 25000 + switch-t0 + fortyGigE0/4 + server1 + port1 + + + DeviceInterfaceLink + 40000 + switch-t0 + fortyGigE0/8 + server2 + port1 + + + LogicalLink + 10000 + false + switch-t0 + fortyGigE0/4 + true + server1-SC + L + true + + + LogicalLink + 0 + false + switch-t0 + MuxTunnel0 + false + switch2-t0 + MuxTunnel0 + true + + + + + ToRRouter +
+ 26.1.1.10/32 +
+ switch-t0 + Force10-S6000 + AAA00PrdStr00 +
+ +
+ 25.1.1.10/32 +
+ + 10.7.0.196/26 + + switch2-t0 + Force10-S6000 +
+ + switch-01t1 +
+ 10.1.0.186/32 +
+ 2 + + + 10.7.0.196/26 + + Force10-S6000 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + server1-SC + smartcable-sku +
+ + Server +
+ 10.10.10.1/32 +
+ + fe80::0001/80 + + + 10.0.0.1/32 + + server1 + server-sku +
+ + Server +
+ 10.10.10.2/32 +
+ + fe80::0002/128 + + + 10.0.0.2/32 + + server2 + server-sku +
+
+
+ + + + + + + GeminiPeeringLink + + True + + + UpperTOR + + switch-t0 + + + LowerTOR + + switch2-t0 + + + switch2-t0:MuxTunnel0;switch-t0:MuxTunnel0 + + + + + + AutoNegotiation + + True + + + switch-01t1:port1;switch-t0:fortyGigE0/0 + + + + + + AutoNegotiation + + True + + + switch-02t1:port1;switch-t0:fortyGigE0/12 + + + + + + AutoNegotiation + + True + + + server1:port1;switch-t0:fortyGigE0/4 + + + + + + AutoNegotiation + + True + + + server2:port1;switch-t0:fortyGigE0/8 + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + ErspanDestinationIpv4 + + 10.0.100.1 + + + NtpResources + + 10.0.10.1;10.0.10.2 + + + + SnmpResources + + 10.0.10.3;10.0.10.4 + + + + SyslogResources + + 10.0.10.5;10.0.10.6 + + + + TacacsServer + + 10.0.10.7;10.0.10.8 + + + KubernetesEnabled + + 0 + + + KubernetesServerIp + + 10.10.10.10 + + + ResourceType + + Storage + + + RedundancyType + + Mixed + + + + + + + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + true + 0 + Force10-S6000 + + + DeviceInterface + + true + 1 + eth0 + false + eth0 + 1000 + + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index 6692e306653d..89b0ca9e0d9d 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -180,7 +180,7 @@ - PortChannel01;fortyGigE0/8;Ethernet12 + PortChannel01;Ethernet0;Ethernet12 DataAcl DataPlane diff --git a/src/sonic-config-engine/tests/t0-sample-port-config-duplicated-name-alias.ini b/src/sonic-config-engine/tests/t0-sample-port-config-duplicated-name-alias.ini new file mode 100644 index 000000000000..dafdb570e9cc --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-port-config-duplicated-name-alias.ini @@ -0,0 +1,36 @@ +# name lanes alias index +Ethernet0 9 Ethernet1 1 +Ethernet1 10 Ethernet2 2 +Ethernet2 11 Ethernet3 3 +Ethernet3 12 Ethernet4 4 +Ethernet4 13,14,15,16 Ethernet6/1 6 +Ethernet8 17,18,19,20 Ethernet7/1 7 +Ethernet12 21,22,23,24 Ethernet8/1 8 +Ethernet16 29,30,31,32 Ethernet9/1 9 +Ethernet20 25,26,27,28 Ethernet10/1 10 +Ethernet24 33,34,35,36 Ethernet11/1 11 +Ethernet28 37,38,39,40 Ethernet12/1 12 +Ethernet32 45,46,47,48 Ethernet13/1 13 +Ethernet36 41,42,43,44 Ethernet14/1 14 +Ethernet40 49,50,51,52 Ethernet15/1 15 +Ethernet44 53,54,55,56 Ethernet16/1 16 +Ethernet48 69,70,71,72 Ethernet17/1 17 +Ethernet52 65,66,67,68 Ethernet18/1 18 +Ethernet56 73,74,75,76 Ethernet19/1 19 +Ethernet60 77,78,79,80 Ethernet20/1 20 +Ethernet64 93,94,95,96 Ethernet21/1 21 +Ethernet68 89,90,91,92 Ethernet22/1 22 +Ethernet72 97,98,99,100 Ethernet23/1 23 +Ethernet76 101,102,103,104 Ethernet24/1 24 +Ethernet80 109,110,111,112 Ethernet25/1 25 +Ethernet84 105,106,107,108 Ethernet26/1 26 +Ethernet88 121,122,123,124 Ethernet27/1 27 +Ethernet92 125,126,127,128 Ethernet28/1 28 +Ethernet96 61,62,63,64 Ethernet29 29 +Ethernet100 57,58,59,60 Ethernet30 30 +Ethernet104 81,82,83,84 Ethernet31 31 +Ethernet108 85,86,87,88 Ethernet32 32 +Ethernet112 117,118,119,120 Ethernet33 33 +Ethernet116 113,114,115,116 Ethernet34 34 +Ethernet120 1,2,3,4 Ethernet35 35 +Ethernet124 5,6,7,8 Ethernet36 36 diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index b1c203536b5d..86bd92ebe362 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -471,9 +471,24 @@ def test_minigraph_acl_attach_to_ports(self): """ The test case is to verify ACL table can be bound to both port names and alias """ - result = minigraph.parse_xml(self.sample_graph, port_config_file=self.port_config) - expected_dataacl_ports = ['PortChannel01','fortyGigE0/8','Ethernet12'] - self.assertEqual(result['ACL_TABLE']['DATAACL']['ports'].sort(), expected_dataacl_ports.sort()) + sample_graph = os.path.join(self.test_dir,'simple-sample-graph-case-acl-test.xml') + port_config_duplicated_name_alias = os.path.join(self.test_dir, 't0-sample-port-config-duplicated-name-alias.ini') + result = minigraph.parse_xml(sample_graph, port_config_file=port_config_duplicated_name_alias) + # TC1: All ports are portchannels or port names + expected_dataacl_ports = ['PortChannel01','Ethernet20','Ethernet24'] + self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_PORT_NAME']['ports']), sorted(expected_dataacl_ports)) + # TC2: All ports are portchanels or port alias + expected_dataacl_ports = ['PortChannel01','Ethernet4','Ethernet8'] + self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_PORT_ALIAS']['ports']), sorted(expected_dataacl_ports)) + # TC3: Duplicated values in port names and alias, but all fall in port names + expected_dataacl_ports = ['PortChannel01','Ethernet0','Ethernet1','Ethernet2','Ethernet3'] + self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_MIXED_NAME_ALIAS_1']['ports']), sorted(expected_dataacl_ports)) + # TC4: Duplicated values in port names and alias, but all fall in port alias + expected_dataacl_ports = ['PortChannel01','Ethernet0','Ethernet1','Ethernet4','Ethernet8'] + self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_MIXED_NAME_ALIAS_2']['ports']), sorted(expected_dataacl_ports)) + # TC5: Same count in port names and alias, port alias is preferred + expected_dataacl_ports = ['Ethernet0'] + self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_MIXED_NAME_ALIAS_3']['ports']), sorted(expected_dataacl_ports)) def test_parse_device_desc_xml_mgmt_interface(self): # Regular device_desc.xml with both IPv4 and IPv6 mgmt address From 439d4eab98255e7cc54b1f1e9638ae6d801fcf53 Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:21:48 -0800 Subject: [PATCH 049/113] [chassis] Fixed critical process not correct for database-chassis docker (#13445) *Critical process for database-chassis is redis-chassis but critical_process contains hard-coded to `redis` program always. Instead using jinja2 template to render critical process list based on database docker type. redis-chassis for database-chassis docker and redis for regular database docker. --- dockers/docker-database/Dockerfile.j2 | 2 +- dockers/docker-database/critical_processes | 1 - dockers/docker-database/critical_processes.j2 | 5 +++++ dockers/docker-database/docker-database-init.sh | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) delete mode 100644 dockers/docker-database/critical_processes create mode 100644 dockers/docker-database/critical_processes.j2 diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index b9d3669c0f49..f5a8ec083675 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -36,12 +36,12 @@ RUN apt-get clean -y && \ ' /etc/redis/redis.conf COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"] +COPY ["critical_processes.j2", "/usr/share/sonic/templates/"] COPY ["docker-database-init.sh", "/usr/local/bin/"] COPY ["database_config.json.j2", "/usr/share/sonic/templates/"] COPY ["database_global.json.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["files/sysctl-net.conf", "/etc/sysctl.d/"] -COPY ["critical_processes", "/etc/supervisor"] COPY ["files/update_chassisdb_config", "/usr/local/bin/"] COPY ["flush_unused_database", "/usr/local/bin/"] diff --git a/dockers/docker-database/critical_processes b/dockers/docker-database/critical_processes deleted file mode 100644 index 53a45931dfc9..000000000000 --- a/dockers/docker-database/critical_processes +++ /dev/null @@ -1 +0,0 @@ -program:redis diff --git a/dockers/docker-database/critical_processes.j2 b/dockers/docker-database/critical_processes.j2 new file mode 100644 index 000000000000..1f524132e938 --- /dev/null +++ b/dockers/docker-database/critical_processes.j2 @@ -0,0 +1,5 @@ +{% if INSTANCES %} +{% for redis_inst, redis_items in INSTANCES.items() %} +program:{{ redis_inst }} +{%- endfor %} +{%- endif %} diff --git a/dockers/docker-database/docker-database-init.sh b/dockers/docker-database/docker-database-init.sh index 9b92b5890c2d..e2c3fcb727d2 100755 --- a/dockers/docker-database/docker-database-init.sh +++ b/dockers/docker-database/docker-database-init.sh @@ -52,6 +52,7 @@ if [[ $DATABASE_TYPE == "chassisdb" ]]; then update_chassisdb_config -j $db_cfg_file_tmp -k -p $chassis_db_port # generate all redis server supervisord configuration file sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf + sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/critical_processes.j2 > /etc/supervisor/critical_processes rm $db_cfg_file_tmp exec /usr/local/bin/supervisord exit 0 @@ -69,6 +70,7 @@ fi # delete chassisdb config to generate supervisord config update_chassisdb_config -j $db_cfg_file_tmp -d sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf +sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/critical_processes.j2 > /etc/supervisor/critical_processes if [[ "$start_chassis_db" != "1" ]] && [[ -z "$chassis_db_address" ]]; then cp $db_cfg_file_tmp $db_cfg_file From 260a2ec3e7c671b716529b0faf9040fc924ecddc Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Fri, 20 Jan 2023 15:34:34 -0800 Subject: [PATCH 050/113] [dualtor][active-active]Killing radv instead of stopping on `active-active` dualtor if config knob is on (#13408) How I did it radv sends a good-bye packet when the service is stopped, which causes a IPv6 route update on SoC side. And this update leads to an interface bouncing and causes traffic disruption even though the ToR device might already be isolated. This PR is to mitigate the traffic disruption issue during planned maintenance, by killing radv instead of stopping. So the cease packet won't be sent. How to verify it Verified on dev clusters: Traffic disruption was no longer reproducible. radv took the killing path if knob was off, radv would take the stopping path sign-off: Jing Zhang zhangjing@microsoft.com --- files/scripts/service_mgmt.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/files/scripts/service_mgmt.sh b/files/scripts/service_mgmt.sh index d400c8472246..c1916aefa088 100755 --- a/files/scripts/service_mgmt.sh +++ b/files/scripts/service_mgmt.sh @@ -26,6 +26,26 @@ function check_fast_boot () fi } +function check_redundant_type() +{ + DEVICE_SUBTYPE=`$SONIC_DB_CLI CONFIG_DB hget "DEVICE_METADATA|localhost" subtype` + if [[ x"$DEVICE_SUBTYPE" == x"DualToR" ]]; then + MUX_CONFIG=`show muxcable config` + if [[ $MUX_CONFIG =~ .*active-active.* ]]; then + ACTIVE_ACTIVE="true" + else + ACTIVE_ACTIVE="false" + fi + else + ACTIVE_ACTIVE="false" + fi + CONFIG_KNOB=`$SONIC_DB_CLI CONFIG_DB hget "MUX_LINKMGR|SERVICE_MGMT" kill_radv` + if [[ x"$CONFIG_KNOB" != x"True" ]]; then + ACTIVE_ACTIVE='false' + fi + debug "DEVICE_SUBTYPE: ${DEVICE_SUBTYPE}, CONFIG_KNOB: ${CONFIG_KNOB}" +} + start() { debug "Starting ${SERVICE}$DEV service..." @@ -43,13 +63,19 @@ stop() { check_warm_boot check_fast_boot + check_redundant_type debug "Warm boot flag: ${SERVICE}$DEV ${WARM_BOOT}." debug "Fast boot flag: ${SERVICE}$DEV ${FAST_BOOT}." # For WARM/FAST boot do not perform service stop if [[ x"$WARM_BOOT" != x"true" ]] && [[ x"$FAST_BOOT" != x"true" ]]; then - /usr/bin/${SERVICE}.sh stop $DEV - debug "Stopped ${SERVICE}$DEV service..." + if [[ x"$SERVICE" == x"radv" ]] && [[ x"$ACTIVE_ACTIVE" == x"true" ]]; then + debug "Killing Docker ${SERVICE}${DEV} for active-active dualtor device..." + /usr/bin/${SERVICE}.sh kill $DEV + else + /usr/bin/${SERVICE}.sh stop $DEV + debug "Stopped ${SERVICE}$DEV service..." + fi else debug "Killing Docker ${SERVICE}${DEV}..." /usr/bin/${SERVICE}.sh kill $DEV From 940e2cd9bf916100f1e4528c8c64d846d8802026 Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:30:02 +0200 Subject: [PATCH 051/113] [Mellanox] Add ASIC simulation version tag to fw.mk (#13470) Signed-off-by: dprital --- platform/mellanox/fw.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 3ce64c1ef30a..d7ac41d06761 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -21,6 +21,8 @@ MLNX_FW_BASE_PATH = $(MLNX_SDK_BASE_PATH) # Place an URL here to FW if you want to download FW instead MLNX_FW_BASE_URL = +SIMX_VERSION = 5.1-1065 + ifneq ($(MLNX_FW_BASE_URL), ) FW_FROM_URL = y else From fd3966a0b8f4cd8e2dff99f159d9091d14946e51 Mon Sep 17 00:00:00 2001 From: "Marty Y. Lok" <76118573+mlok-nokia@users.noreply.github.com> Date: Tue, 24 Jan 2023 14:40:59 -0500 Subject: [PATCH 052/113] [Nokia][sonic-platform] Update sonic-platform submodule for Nokia IXR7250E platform (#13437) Why I did it Update Nokia sonic-platform submodule 81a9c77 [Supervisor] Modifed the get_description to fix the name for Nokia-IXR7250E-SUP-10 card. e49ddfb Fix the LedContorlCommon to get the physical index from port mapping dd143f1 [module] modify the chassis.py and module.py to allow supervisor to retrieve the line card eemprom info How I did it Update Nokia sonic-platform submodule 81a9c77 [Supervisor] Modifed the get_description to fix the name for Nokia-IXR7250E-SUP-10 card. e49ddfb Fix the LedContorlCommon to get the physical index from port mapping dd143f1 [module] modify the chassis.py and module.py to allow supervisor to retrieve the line card eemprom info How to verify it On supervisor, "show chassis module status" should show Nokia-IXR7250E-SUP-10 instead of Nokia-IXR7250-SUP-10 Signed-off-by: mlok --- platform/broadcom/sonic-platform-modules-nokia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-nokia b/platform/broadcom/sonic-platform-modules-nokia index fcb45b5b60e0..81a9c77a22bd 160000 --- a/platform/broadcom/sonic-platform-modules-nokia +++ b/platform/broadcom/sonic-platform-modules-nokia @@ -1 +1 @@ -Subproject commit fcb45b5b60e025b10cfcd088e009f65254003788 +Subproject commit 81a9c77a22bd4147e4041a7359e211d7f51b60a8 From c9a33cb00e6e1989d67131a08844fb901d149cbd Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Tue, 24 Jan 2023 15:30:41 -0800 Subject: [PATCH 053/113] Fix segfault issue inside memory_checker (#13066) #### Why I did it Segfault was occuring when running memory_checker #### How I did it Deinit publisher immediately after publishing #### How to verify it Manual testing --- files/image_config/monit/memory_checker | 16 ++++++++++------ src/sonic-eventd/tools/events_publish_tool.py | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/files/image_config/monit/memory_checker b/files/image_config/monit/memory_checker index 9b427e59d173..5abe9bbc4497 100755 --- a/files/image_config/monit/memory_checker +++ b/files/image_config/monit/memory_checker @@ -24,6 +24,7 @@ import subprocess import sys import syslog import re +import time import docker @@ -58,14 +59,18 @@ def get_command_result(command): return command_stdout.strip() -def publish_events(events_handle, container_name, mem_usage_bytes, threshold_value): + +def publish_events(container_name, mem_usage_bytes, threshold_value): + events_handle = swsscommon.events_init_publisher(EVENTS_PUBLISHER_SOURCE) params = swsscommon.FieldValueMap() params["ctr_name"] = container_name params["mem_usage"] = mem_usage_bytes params["threshold"] = threshold_value swsscommon.event_publish(events_handle, EVENTS_PUBLISHER_TAG, params) + swsscommon.events_deinit_publisher(events_handle) + -def check_memory_usage(events_handle, container_name, threshold_value): +def check_memory_usage(container_name, threshold_value): """Checks the memory usage of a container and writes an alerting messages into the syslog if the memory usage is larger than the threshold value. @@ -100,7 +105,7 @@ def check_memory_usage(events_handle, container_name, threshold_value): syslog.syslog(syslog.LOG_INFO, "[{}]: Memory usage ({} Bytes) is larger than the threshold ({} Bytes)!" .format(container_name, mem_usage_bytes, threshold_value)) # publish event - publish_events(events_handle, container_name, str(mem_usage_bytes), str(threshold_value)) + publish_events(container_name, "{:.2f}".format(mem_usage_bytes), str(threshold_value)) sys.exit(3) else: syslog.syslog(syslog.LOG_ERR, "[memory_checker] Failed to retrieve memory value from '{}'" @@ -160,14 +165,13 @@ def main(): sys.exit(0) running_container_names = get_running_container_names() - events_handle = swsscommon.events_init_publisher(EVENTS_PUBLISHER_SOURCE) if args.container_name in running_container_names: - check_memory_usage(events_handle, args.container_name, args.threshold_value) + check_memory_usage(args.container_name, args.threshold_value) else: syslog.syslog(syslog.LOG_INFO, "[memory_checker] Exits without checking memory usage since container '{}' is not running!" .format(args.container_name)) - swsscommon.events_deinit_publisher(events_handle) + if __name__ == "__main__": main() diff --git a/src/sonic-eventd/tools/events_publish_tool.py b/src/sonic-eventd/tools/events_publish_tool.py index df2cbc8012a1..0d659eb78c14 100644 --- a/src/sonic-eventd/tools/events_publish_tool.py +++ b/src/sonic-eventd/tools/events_publish_tool.py @@ -1,4 +1,4 @@ -from swsscommon.swsscommon import events_init_publisher, event_publish, FieldValueMap +from swsscommon.swsscommon import events_init_publisher, events_deinit_publisher, event_publish, FieldValueMap import time import sys import ipaddress @@ -92,6 +92,7 @@ def main(): publishBGPEvents(publisher_handle, args.count, args.pause) else: publishEventsFromFile(publisher_handle, args.file, args.count, args.pause) + events_deinit_publisher(publisher_handle) if __name__ == "__main__": main() From 2068a2697a65505133f6b0550fc2dc443c5d3a55 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Tue, 24 Jan 2023 15:47:32 -0800 Subject: [PATCH 054/113] Change bgp notification leaf name and mem_usage leaf type (#13012) #### Why I did it Improve naming convention for bgp notification events and change type of leaf for sonic-events-host mem usage from uint64 to decimal64 #### How I did it Replace "-" with "_" Replace uint64 with decimal64 #### How to verify it Run yang model unit tests #### Description for the changelog Change YANG model leaf naming convention for bgp notification --- dockers/docker-fpm-frr/bgp_regex.json | 2 +- .../tests_config/sonic-events-bgp.json | 36 +++++++++---------- .../tests_config/sonic-events-host.json | 10 +++--- .../yang-models/sonic-events-bgp.yang | 6 ++-- .../yang-models/sonic-events-host.yang | 4 ++- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/dockers/docker-fpm-frr/bgp_regex.json b/dockers/docker-fpm-frr/bgp_regex.json index f02ae53ed26f..c657aa89dc66 100644 --- a/dockers/docker-fpm-frr/bgp_regex.json +++ b/dockers/docker-fpm-frr/bgp_regex.json @@ -12,7 +12,7 @@ { "tag": "notification", "regex": "NOTIFICATION: (received|sent) (?:to|from) neighbor ([0-9a-f:.]*[0-9a-f+]*)\\s*.* (\\d*)\/(\\d*)", - "params": [ "is-sent", "ip", "major-code", "minor-code" ] + "params": [ "is_sent", "ip", "major_code", "minor_code" ] } ] diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json index 2fa562f5efa6..ac747180f348 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json @@ -38,10 +38,10 @@ "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MAJOR_CODE": { "sonic-events-bgp:sonic-events-bgp": { "sonic-events-bgp:notification": { - "major-code": "INCORRECT_MAJOR_CODE", - "minor-code": 2, + "major_code": "INCORRECT_MAJOR_CODE", + "minor_code": 2, "ip": "10.0.0.0", - "is-sent": true, + "is_sent": true, "timestamp": "1985-04-12T23:20:50.52Z" } } @@ -49,10 +49,10 @@ "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MINOR_CODE": { "sonic-events-bgp:sonic-events-bgp": { "sonic-events-bgp:notification": { - "major-code": 2, - "minor-code": "INCORRECT_MINOR_CODE", + "major_code": 2, + "minor_code": "INCORRECT_MINOR_CODE", "ip": "10.0.0.0", - "is-sent": true, + "is_sent": true, "timestamp": "1985-04-12T23:20:50.52Z" } } @@ -60,10 +60,10 @@ "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IP": { "sonic-events-bgp:sonic-events-bgp": { "sonic-events-bgp:notification": { - "major-code": 2, - "minor-code": 2, + "major_code": 2, + "minor_code": 2, "ip": "INCORRECT_IP", - "is-sent": true, + "is_sent": true, "timestamp": "1985-04-12T23:20:50.52Z" } } @@ -71,10 +71,10 @@ "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IS-SENT": { "sonic-events-bgp:sonic-events-bgp": { "sonic-events-bgp:notification": { - "major-code": 2, - "minor-code": 2, + "major_code": 2, + "minor_code": 2, "ip": "10.0.0.0", - "is-sent": "INCORRECT_VALUE", + "is_sent": "INCORRECT_VALUE", "timestamp": "1985-04-12T23:20:50.52Z" } } @@ -82,10 +82,10 @@ "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_TIMESTAMP": { "sonic-events-bgp:sonic-events-bgp": { "sonic-events-bgp:notification": { - "major-code": 2, - "minor-code": 2, + "major_code": 2, + "minor_code": 2, "ip": "10.0.0.0", - "is-sent": true, + "is_sent": true, "timestamp": "INCORRECT_TIMESTAMP" } } @@ -93,10 +93,10 @@ "SONIC_EVENTS_BGP_NOTIFICATION_VALID": { "sonic-events-bgp:sonic-events-bgp": { "sonic-events-bgp:notification": { - "major-code": 2, - "minor-code": 2, + "major_code": 2, + "minor_code": 2, "ip": "10.0.0.0", - "is-sent": true, + "is_sent": true, "timestamp": "1985-04-12T23:20:50.52Z" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json index 5c771de041b3..98ee755b510a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json @@ -263,7 +263,7 @@ "sonic-events-host:sonic-events-host": { "sonic-events-host:mem-threshold-exceeded": { "ctr_name": "Invalid$", - "mem_usage": 123456, + "mem_usage": "123456.78", "threshold": 123456, "timestamp": "1985-04-12T23:20:50.52Z" } @@ -273,7 +273,7 @@ "sonic-events-host:sonic-events-host": { "sonic-events-host:mem-threshold-exceeded": { "ctr_name": "invalid-length-for-ctr-name-too-long", - "mem_usage": 123456, + "mem_usage": "123456.78", "threshold": 123456, "timestamp": "1985-04-12T23:20:50.52Z" } @@ -293,7 +293,7 @@ "sonic-events-host:sonic-events-host": { "sonic-events-host:mem-threshold-exceeded": { "ctr_name": "container_name", - "mem_usage": 123456, + "mem_usage": "123456.78", "threshold": "INCORRECT_THRESHOLD", "timestamp": "1985-04-12T23:20:50.52Z" } @@ -303,7 +303,7 @@ "sonic-events-host:sonic-events-host": { "sonic-events-host:mem-threshold-exceeded": { "ctr_name": "container_name", - "mem_usage": 123456, + "mem_usage": "123456.78", "threshold": 123456, "timestamp": "INCORRECT_TIMESTAMP" } @@ -313,7 +313,7 @@ "sonic-events-host:sonic-events-host": { "sonic-events-host:mem-threshold-exceeded": { "ctr_name": "container_name", - "mem_usage": 123456, + "mem_usage": "123456.78", "threshold": 123456, "timestamp": "1985-04-12T23:20:50.52Z" } diff --git a/src/sonic-yang-models/yang-models/sonic-events-bgp.yang b/src/sonic-yang-models/yang-models/sonic-events-bgp.yang index 26d2b85e954f..df9945d783f9 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-bgp.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-bgp.yang @@ -57,12 +57,12 @@ module sonic-events-bgp { The error codes as per IANA. The other params are as in the message"; - leaf major-code { + leaf major_code { type uint8; description "Major IANA error code; [RFC4271][RFC7313]"; } - leaf minor-code { + leaf minor_code { type uint8; description "Minor IANA error code; [RFC4271][RFC7313]"; } @@ -72,7 +72,7 @@ module sonic-events-bgp { description "IP of neighbor associated with this notification"; } - leaf is-sent { + leaf is_sent { type boolean; description "true - if this notification was for sent messages; false if it was for received."; } diff --git a/src/sonic-yang-models/yang-models/sonic-events-host.yang b/src/sonic-yang-models/yang-models/sonic-events-host.yang index cbb129d9fe25..edd98d247c02 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-host.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-host.yang @@ -196,7 +196,9 @@ module sonic-events-host { } leaf mem_usage { - type uint64; + type decimal64 { + fraction-digits 2; + } description "Memory usage of process"; } From 78f249be38e6919062bd2555b81ee2bbaba20fe3 Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Tue, 24 Jan 2023 15:59:54 -0800 Subject: [PATCH 055/113] change default to be on (#13495) Changing the default config knob value to be True for killing radv, due to the reasons below: Killing RADV is to prevent sending the "cease to be advertising interface" protocol packet. RFC 4861 says this ceasing packet as "should" instead of "must", considering that it's fatal to not do this. In active-active scenario, host side might have difficulty distinguish if the "cease to be advertising interface" is for the last interface leaving. 6.2.5. Ceasing To Be an Advertising Interface shutting down the system. In such cases, the router SHOULD transmit one or more (but not more than MAX_FINAL_RTR_ADVERTISEMENTS) final multicast Router Advertisements on the interface with a Router Lifetime field of zero. In the case of a router becoming a host, the system SHOULD also depart from the all-routers IP multicast group on all interfaces on which the router supports IP multicast (whether or not they had been advertising interfaces). In addition, the host MUST ensure that subsequent Neighbor Advertisement messages sent from the interface have the Router flag set to zero. sign-off: Jing Zhang zhangjing@microsoft.com --- files/scripts/service_mgmt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/scripts/service_mgmt.sh b/files/scripts/service_mgmt.sh index c1916aefa088..c529ef92ce5e 100755 --- a/files/scripts/service_mgmt.sh +++ b/files/scripts/service_mgmt.sh @@ -40,7 +40,7 @@ function check_redundant_type() ACTIVE_ACTIVE="false" fi CONFIG_KNOB=`$SONIC_DB_CLI CONFIG_DB hget "MUX_LINKMGR|SERVICE_MGMT" kill_radv` - if [[ x"$CONFIG_KNOB" != x"True" ]]; then + if [[ x"$CONFIG_KNOB" == x"False" ]]; then ACTIVE_ACTIVE='false' fi debug "DEVICE_SUBTYPE: ${DEVICE_SUBTYPE}, CONFIG_KNOB: ${CONFIG_KNOB}" From 03348c44ac40542d652057d119146ba2dd12da97 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Tue, 24 Jan 2023 22:56:13 -0800 Subject: [PATCH 056/113] [yang] Added Tunnel flex counter group (#13483) - Why I did it Fixes https://github.com/sonic-net/sonic-buildimage/issues/13457 Added Tunnel flex counter group - How I did it Added relevant container in sonic-flex_counter yang model - How to verify it Added UT to verify --- src/sonic-yang-models/doc/Configuration.md | 29 ++++++++++++------- .../tests/files/sample_config_db.json | 4 +++ .../tests_config/flex_counter.json | 8 +++++ .../yang-models/sonic-flex_counter.yang | 13 +++++++++ 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 1c25f66a61c2..0cc8ac654558 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -913,17 +913,24 @@ instance is supported in SONiC. ``` { -"FLEX_COUNTER_TABLE": { - "PFCWD": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT": { - "FLEX_COUNTER_STATUS": "enable" - }, - "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" - } - } + "FLEX_COUNTER_TABLE": { + "PFCWD": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "1000" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" + }, + "TUNNEL": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" + } + } } ``` diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 2d1f672542c7..897f31e57238 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1234,6 +1234,10 @@ "FLOW_CNT_ROUTE": { "FLEX_COUNTER_STATUS": "enable", "POLL_INTERVAL": "10000" + }, + "TUNNEL": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" } }, "FLOW_COUNTER_ROUTE_PATTERN": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json index 169a38ff6d7c..87ac2c6987eb 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json @@ -43,6 +43,10 @@ "FLEX_COUNTER_STATUS": "enable", "POLL_INTERVAL": 10000 }, + "TUNNEL": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 + }, "FLOW_CNT_TRAP": { "FLEX_COUNTER_STATUS": "enable", "POLL_INTERVAL": 10000 @@ -98,6 +102,10 @@ "FLEX_COUNTER_STATUS": "enable", "POLL_INTERVAL": 99 }, + "TUNNEL": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, "FLOW_CNT_TRAP": { "FLEX_COUNTER_STATUS": "enable", "POLL_INTERVAL": 99 diff --git a/src/sonic-yang-models/yang-models/sonic-flex_counter.yang b/src/sonic-yang-models/yang-models/sonic-flex_counter.yang index e94aa76ccf42..96745fc5e4a6 100644 --- a/src/sonic-yang-models/yang-models/sonic-flex_counter.yang +++ b/src/sonic-yang-models/yang-models/sonic-flex_counter.yang @@ -228,6 +228,19 @@ module sonic-flex_counter { } } + container TUNNEL { + /* TUNNEL_STAT_COUNTER_FLEX_COUNTER_GROUP */ + leaf FLEX_COUNTER_STATUS { + type flex_status; + } + leaf FLEX_COUNTER_DELAY_STATUS { + type flex_delay_status; + } + leaf POLL_INTERVAL { + type poll_interval; + } + } + } /* end of container FLEX_COUNTER_TABLE */ From d84deafdea2a3c25db8edfcdfa1ec2f4883cf4e1 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 25 Jan 2023 02:17:40 -0800 Subject: [PATCH 057/113] Revert "[build] Migrate libyang2 sources download from wget to dget (#13394)" This reverts commit 9a0bf56a15ea84663a5d97a014fc8ec41ea631a8. --- src/libyang2/Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libyang2/Makefile b/src/libyang2/Makefile index c55d15496156..fab24590a340 100644 --- a/src/libyang2/Makefile +++ b/src/libyang2/Makefile @@ -2,6 +2,16 @@ SHELL = /bin/bash .SHELLFLAGS += -e +LIBYANG_URL = https://sonicstorage.blob.core.windows.net/debian/pool/main/liby/libyang + +DSC_FILE = libyang2_$(LIBYANG2_FULLVERSION).dsc +ORIG_FILE = libyang2_$(LIBYANG2_VERSION).orig.tar.gz +DEBIAN_FILE = libyang2_$(LIBYANG2_FULLVERSION).debian.tar.xz + +DSC_FILE_URL = $(LIBYANG_URL)/$(DSC_FILE) +ORIG_FILE_URL = $(LIBYANG_URL)/$(ORIG_FILE) +DEBIAN_FILE_URL = $(LIBYANG_URL)/$(DEBIAN_FILE) + MAIN_TARGET = $(LIBYANG2) DERIVED_TARGETS = $(LIBYANG2_DEV) $(LIBYANG2_DBG) $(LIBYANG2_TOOLS) $(LIBYANG2_TOOLS_DBG) @@ -10,7 +20,10 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -fr ./libyang2-$(LIBYANG2_VERSION) # download debian libyang - dget https://deb.debian.org/debian/pool/main/liby/libyang2/libyang2_$(LIBYANG2_FULLVERSION).dsc + wget -NO "$(DSC_FILE)" $(DSC_FILE_URL) + wget -NO "$(ORIG_FILE)" $(ORIG_FILE_URL) + wget -NO "$(DEBIAN_FILE)" $(DEBIAN_FILE_URL) + dpkg-source -x libyang2_$(LIBYANG2_FULLVERSION).dsc pushd libyang2-$(LIBYANG2_VERSION) #sed -i 's/set(LIBYANG_MAJOR_SOVERSION 1)/set(LIBYANG_MAJOR_SOVERSION 2)/' CMakeLists.txt From 9a49aec57099a5a5672bb83ef0121e276470df45 Mon Sep 17 00:00:00 2001 From: Lior Avramov <73036155+liorghub@users.noreply.github.com> Date: Wed, 25 Jan 2023 20:50:38 +0200 Subject: [PATCH 058/113] [Mellanox] [ECMP calculator] Add script usage and more information to script description in help option (#13493) Add script usage and more information to script description being printed in help option. - Why I did it Missing information in script description in help option. - How I did it Expand script description and add script usage. - How to verify it Run the script with -h option. --- .../docker-syncd-mlnx/ecmp_calculator/ecmp_calc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx/ecmp_calculator/ecmp_calc.py b/platform/mellanox/docker-syncd-mlnx/ecmp_calculator/ecmp_calc.py index 286a40fd2027..280275529b73 100755 --- a/platform/mellanox/docker-syncd-mlnx/ecmp_calculator/ecmp_calc.py +++ b/platform/mellanox/docker-syncd-mlnx/ecmp_calculator/ecmp_calc.py @@ -482,11 +482,12 @@ def validate_packet_json(self, packet_json): def main(): rc = 0 try: - parser = argparse.ArgumentParser(description="ECMP calculator") - parser.add_argument("-i", "--interface", required=True, help="Ingress interface") - parser.add_argument("-p", "--packet", required=True, help="Packet description") + parser = argparse.ArgumentParser(description="Calculate egress interface for the given packet being routed over ECMP", + usage="/usr/bin/ecmp_calc.py -i -p ") + parser.add_argument("-i", "--interface", required=True, help="ingress interface") + parser.add_argument("-p", "--packet", required=True, help="json file describing a packet") parser.add_argument("-v", "--vrf", help="VRF name") - parser.add_argument("-d", "--debug", default=False, action="store_true", help="Flag for debug") + parser.add_argument("-d", "--debug", default=False, action="store_true", help="when used, debug messages will be printed to stdout") args = parser.parse_args() ecmp_calc = EcmpCalc() From 4cc84c68dccf8bd1c9727aaf160e3b6a618c63f7 Mon Sep 17 00:00:00 2001 From: DavidZagury <32644413+DavidZagury@users.noreply.github.com> Date: Wed, 25 Jan 2023 20:53:39 +0200 Subject: [PATCH 059/113] [Mellanox] Improve FW upgrade logging (#13465) - Why I did it To improve ASIC FW upgrade logging and have information about the cause of FW update failure in the log. - How I did it Added syslog logger support In case the FW update has failed the update tool will give the cause of the failure in the output in the last line, starting with "Fail". When running the tool, in case of a failed update, we will parse the output to retrieve the cause and log it. Device #1: ---------- Device Type: ConnectX6DX Part Number: MCX623106AN-CDA_Ax Description: ConnectX-6 Dx EN adapter card; 100GbE; Dual-port QSFP56; PCIe 4.0/3.0 x16; PSID: MT_0000000359 PCI Device Name: /dev/mst/mt4125_pciconf0 Base GUID: 0c42a103007d22d4 Base MAC: 0c42a17d22d4 Versions: Current Available FW 22.32.0498 22.32.0498 PXE 3.6.0500 3.6.0500 UEFI 14.25.0015 14.25.0015 Status: Forced update required --------- Found 1 device(s) requiring firmware update... Device #1: Updating FW ... FSMST_INITIALIZE - OK Writing Boot image component - OK Fail : The Digest in the signature is wrong - How to verify it mlnx-fw-upgrade.sh --upgrade --- platform/mellanox/mlnx-fw-upgrade.j2 | 46 ++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/platform/mellanox/mlnx-fw-upgrade.j2 b/platform/mellanox/mlnx-fw-upgrade.j2 index 3caaa8bbc685..86fd32e6a89a 100755 --- a/platform/mellanox/mlnx-fw-upgrade.j2 +++ b/platform/mellanox/mlnx-fw-upgrade.j2 @@ -40,6 +40,7 @@ declare -rA FW_FILE_MAP=( \ ) IMAGE_UPGRADE="${NO_PARAM}" +SYSLOG_LOGGER="${NO_PARAM}" VERBOSE_LEVEL="${VERBOSE_MIN}" function PrintHelp() { @@ -48,7 +49,8 @@ function PrintHelp() { echo echo "OPTIONS:" echo " -u, --upgrade Upgrade ASIC firmware using next boot image (useful after SONiC-To-SONiC update)" - echo " -v, --verbose Verbose mode" + echo " -s, --syslog Use syslog logger (enabled when -u|--upgrade)" + echo " -v, --verbose Verbose mode (enabled when -u|--upgrade)" echo " -h, --help Print help" echo echo "Examples:" @@ -63,10 +65,14 @@ function ParseArguments() { case "$1" in -u|--upgrade) IMAGE_UPGRADE="${YES_PARAM}" + SYSLOG_LOGGER="${YES_PARAM}" ;; -v|--verbose) VERBOSE_LEVEL="${VERBOSE_MAX}" ;; + -s|--syslog) + SYSLOG_LOGGER="${YES_PARAM}" + ;; -h|--help) PrintHelp exit "${EXIT_SUCCESS}" @@ -79,6 +85,11 @@ function ParseArguments() { function LogError() { if [[ "${VERBOSE_LEVEL}" -ge "${VERBOSE_ERROR}" ]]; then echo "ERROR: $*" + logger -p "ERROR" -t "${SCRIPT_NAME}" "$*" + fi + + if [[ "${SYSLOG_LOGGER}" = "${YES_PARAM}" ]]; then + logger -p "ERROR" -t "${SCRIPT_NAME}" "$*" fi } @@ -86,18 +97,30 @@ function LogWarning() { if [[ "${VERBOSE_LEVEL}" -ge "${VERBOSE_WARNING}" ]]; then echo "WARNING: $*" fi + + if [[ "${SYSLOG_LOGGER}" = "${YES_PARAM}" ]]; then + logger -p "WARNING" -t "${SCRIPT_NAME}" "$*" + fi } function LogNotice() { if [[ "${VERBOSE_LEVEL}" -ge "${VERBOSE_NOTICE}" ]]; then echo "NOTICE: $*" fi + + if [[ "${SYSLOG_LOGGER}" = "${YES_PARAM}" ]]; then + logger -p "NOTICE" -t "${SCRIPT_NAME}" "$*" + fi } function LogInfo() { if [[ "${VERBOSE_LEVEL}" -ge "${VERBOSE_INFO}" ]]; then echo "INFO: $*" fi + + if [[ "${SYSLOG_LOGGER}" = "${YES_PARAM}" ]]; then + logger -p "INFO" -t "${SCRIPT_NAME}" "$*" + fi } function ExitFailure() { @@ -186,6 +209,23 @@ function RunCmd() { fi } +function RunFwUpdateCmd() { + local ERROR_CODE="${EXIT_SUCCESS}" + local COMMAND="${BURN_CMD} $@" + + if [[ "${VERBOSE_LEVEL}" -eq "${VERBOSE_MAX}" ]]; then + output=$(eval "${COMMAND}") + else + output=$(eval "${COMMAND}") >/dev/null 2>&1 + fi + + ERROR_CODE="$?" + if [[ "${ERROR_CODE}" != "${EXIT_SUCCESS}" ]]; then + failure_msg="${output#*Fail : }" + ExitFailure "FW Update command: ${COMMAND} failed with error: ${failure_msg}" + fi +} + function UpgradeFW() { local -r _FS_MOUNTPOINT="$1" @@ -229,9 +269,9 @@ function UpgradeFW() { local -r _MST_DEVICE="$(GetMstDevice)" if [[ "${_MST_DEVICE}" = "${UNKN_MST}" ]]; then LogWarning "could not find fastest mst device, using default device" - RunCmd "${BURN_CMD} -i ${_FW_FILE}" + RunFwUpdateCmd "-i ${_FW_FILE}" else - RunCmd "${BURN_CMD} -d ${_MST_DEVICE} -i ${_FW_FILE}" + RunFwUpdateCmd "-d ${_MST_DEVICE} -i ${_FW_FILE}" fi fi } From 2f2702f70585c753dd81d93c9ed027fc77d0923d Mon Sep 17 00:00:00 2001 From: Mai Bui Date: Wed, 25 Jan 2023 16:41:08 -0500 Subject: [PATCH 060/113] Revert "[system-health] Remove subprocess with shell=True (#12572)" (#13505) This reverts commit b3a81679684d64ff380ab6f7e761587d9281679b. Due to issue https://github.com/sonic-net/sonic-buildimage/issues/13432 --- src/system-health/health_checker/service_checker.py | 11 +++++------ src/system-health/health_checker/sysmonitor.py | 2 +- src/system-health/health_checker/utils.py | 2 +- src/system-health/tests/test_system_health.py | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/system-health/health_checker/service_checker.py b/src/system-health/health_checker/service_checker.py index ed6c7296fde3..df6005cc0f92 100644 --- a/src/system-health/health_checker/service_checker.py +++ b/src/system-health/health_checker/service_checker.py @@ -26,13 +26,13 @@ class ServiceChecker(HealthChecker): CRITICAL_PROCESSES_PATH = 'etc/supervisor/critical_processes' # Command to get merged directory of a container - GET_CONTAINER_FOLDER_CMD = ['docker', 'inspect', '', '--format', "{{.GraphDriver.Data.MergedDir}}"] + GET_CONTAINER_FOLDER_CMD = 'docker inspect {} --format "{{{{.GraphDriver.Data.MergedDir}}}}"' # Command to query the status of monit service. - CHECK_MONIT_SERVICE_CMD = ['systemctl', 'is-active', 'monit.service'] + CHECK_MONIT_SERVICE_CMD = 'systemctl is-active monit.service' # Command to get summary of critical system service. - CHECK_CMD = ['monit', 'summary', '-B'] + CHECK_CMD = 'monit summary -B' MIN_CHECK_CMD_LINES = 3 # Expect status for different system service category. @@ -172,8 +172,7 @@ def _update_container_critical_processes(self, container, critical_process_list) self.need_save_cache = True def _get_container_folder(self, container): - ServiceChecker.GET_CONTAINER_FOLDER_CMD[2] = str(container) - container_folder = utils.run_command(ServiceChecker.GET_CONTAINER_FOLDER_CMD) + container_folder = utils.run_command(ServiceChecker.GET_CONTAINER_FOLDER_CMD.format(container)) if container_folder is None: return container_folder @@ -339,7 +338,7 @@ def check_process_existence(self, container_name, critical_process_list, config, # We are using supervisorctl status to check the critical process status. We cannot leverage psutil here because # it not always possible to get process cmdline in supervisor.conf. E.g, cmdline of orchagent is "/usr/bin/orchagent", # however, in supervisor.conf it is "/usr/bin/orchagent.sh" - cmd = ['docker', 'exec', str(container_name), 'bash', '-c', "supervisorctl status"] + cmd = 'docker exec {} bash -c "supervisorctl status"'.format(container_name) process_status = utils.run_command(cmd) if process_status is None: for process_name in critical_process_list: diff --git a/src/system-health/health_checker/sysmonitor.py b/src/system-health/health_checker/sysmonitor.py index 651776d3e0f3..dde0b73d1bce 100755 --- a/src/system-health/health_checker/sysmonitor.py +++ b/src/system-health/health_checker/sysmonitor.py @@ -234,7 +234,7 @@ def get_app_ready_status(self, service): #Gets the service properties def run_systemctl_show(self, service): - command = ['systemctl', 'show', str(service), '--property=Id,LoadState,UnitFileState,Type,ActiveState,SubState,Result'] + command = ('systemctl show {} --property=Id,LoadState,UnitFileState,Type,ActiveState,SubState,Result'.format(service)) output = utils.run_command(command) srv_properties = output.split('\n') prop_dict = {} diff --git a/src/system-health/health_checker/utils.py b/src/system-health/health_checker/utils.py index 338ef1d3afe5..00e7754e1ec2 100644 --- a/src/system-health/health_checker/utils.py +++ b/src/system-health/health_checker/utils.py @@ -8,7 +8,7 @@ def run_command(command): :return: Output of the shell command. """ try: - process = subprocess.Popen(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(command, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return process.communicate()[0] except Exception: return None diff --git a/src/system-health/tests/test_system_health.py b/src/system-health/tests/test_system_health.py index 0196efc177a8..2f21be18b9d4 100644 --- a/src/system-health/tests/test_system_health.py +++ b/src/system-health/tests/test_system_health.py @@ -536,10 +536,10 @@ def test_manager(mock_hw_info, mock_service_info, mock_udc_info): manager._set_system_led(chassis) def test_utils(): - output = utils.run_command(['some', 'invalid', 'command']) + output = utils.run_command('some invalid command') assert not output - output = utils.run_command(['ls']) + output = utils.run_command('ls') assert output From fd8d678927bb4ddc00cb0f19d636f17aa64bebff Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Thu, 26 Jan 2023 12:41:22 +0200 Subject: [PATCH 061/113] [Mellanox] Update SDK/FW to 4.5.4150/2010.4150 (#13480) - Why I did it To include latest fixes and new functionality SDK/FW 1. Fixed bug in recovery mechanism in case of I2C error when trying to access the XSFP module. 2. On the NVIDIA Spectrum-2 switch, when receiving a packet with Symbol Errors on ports that are configured to cut-thought mode, a pipeline might get stuck. 3. On the Spectrum-2 and Spectrum-3 switch, if you enable ECN marking and the port is in split mode, traffic sent to the port under congestion (for example, when connecting two ports with a total speed of 50GbE to a single 25GbE port) is not marked. 4. Modifying existing entry/Adding new one when switch is at its maximum capacity (full by maximum allowed entries from any type such as routes, FDB, and so forth), will fail with an error. 5. When many ports are active (e.g., 70 ports up), and the configuration of shared buffer is applied on the fly, occasionally, the firmware might get stuck. 6. When a system has more than 256 ACL rules, on rare occasion, removing/adding rules may cause some ACL rules not to work. 7. On SN2201 system, on RJ45 port, the link might appear in 'down' state even if it operations properly. 8. Layer 4 port information is not initialized for BFD packet event. To address the issue, remote peer UDP port information was added in BFD packet event. 9. When setting LAG as a SPAN analyzer, the distributor mode of the LAG members was not taken into account. It may happen that the LAG member with distributor mode disabled will be set as a SPAN analyzer port. - How I did it Updated SDK/SAI submodule and relevant makefiles with the required versions. - How to verify it Build an image and run tests from "sonic-mgmt". Signed-off-by: Volodymyr Samotiy --- platform/mellanox/fw.mk | 8 ++++---- platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers | 2 +- platform/mellanox/sdk.mk | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index d7ac41d06761..6ce3c8faabca 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -29,22 +29,22 @@ else FW_FROM_URL = n endif -MLNX_SPC_FW_VERSION = 13.2010.4026 +MLNX_SPC_FW_VERSION = 13.2010.4150 MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa $(MLNX_SPC_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) -MLNX_SPC2_FW_VERSION = 29.2010.4026 +MLNX_SPC2_FW_VERSION = 29.2010.4150 MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa $(MLNX_SPC2_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) -MLNX_SPC3_FW_VERSION = 30.2010.4026 +MLNX_SPC3_FW_VERSION = 30.2010.4150 MLNX_SPC3_FW_FILE = fw-SPC3-rel-$(subst .,_,$(MLNX_SPC3_FW_VERSION))-EVB.mfa $(MLNX_SPC3_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC3_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC3_FW_FILE) -MLNX_SPC4_FW_VERSION = 34.2010.4026 +MLNX_SPC4_FW_VERSION = 34.2010.4150 MLNX_SPC4_FW_FILE = fw-SPC4-rel-$(subst .,_,$(MLNX_SPC4_FW_VERSION))-EVB.mfa $(MLNX_SPC4_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC4_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC4_FW_FILE) diff --git a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers index 5edd4865cbf1..c66b48a7aa60 160000 --- a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers +++ b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers @@ -1 +1 @@ -Subproject commit 5edd4865cbf1149430e122bb9a8948ed9f762469 +Subproject commit c66b48a7aa609b4e4a927c5f3fa9039d1a9bde28 diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 15fe0be6705a..8d2b43171fdd 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -16,7 +16,7 @@ # MLNX_SDK_BASE_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel/Switch-SDK-drivers/bin/ MLNX_SDK_PKG_BASE_PATH = $(MLNX_SDK_BASE_PATH)/$(BLDENV)/$(CONFIGURED_ARCH)/ -MLNX_SDK_VERSION = 4.5.4026 +MLNX_SDK_VERSION = 4.5.4150 MLNX_SDK_ISSU_VERSION = 101 MLNX_SDK_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SDK_VERSION))) From 24bdfc1bb2fcd7a5627a11a8ffcacc092438303c Mon Sep 17 00:00:00 2001 From: mihirpat1 <112018033+mihirpat1@users.noreply.github.com> Date: Thu, 26 Jan 2023 11:36:10 -0800 Subject: [PATCH 062/113] [platform-common] Advance submodule head (#13515) Update sonic-platform-common submodule head to include: 38a7a65 mihirpat1 Wed Jan 25 09:49:05 2023 -0800 Change get_tx_bias return type to list (sonic-net/sonic-platform-common#342) ecb7dde qinchuanares Sat Jan 21 11:24:37 2023 -0800 add SOP ROC in bulk status (sonic-net/sonic-platform-common#341) Signed-off-by: Mihir Patel --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 9df998bbec12..38a7a65bd5c6 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 9df998bbec12083dd88104657d2fd8f67e217bc3 +Subproject commit 38a7a65bd5c64662a5d7c9aa4bdcf9920a0c5765 From 77745f55cc859554a4e630f860f86e79e40ea2b9 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Fri, 27 Jan 2023 11:54:44 +0800 Subject: [PATCH 063/113] [FIPS] Upgrade Open-SymCrypt version to 0.6 (#13461) Why I did it [FIPS] Upgrade Open-SymCrypt version to 0.6 Improve the SymCrypt performance Support to download the debug packages from storage account in version 0.6. How I did it Upgrade to symcrypt-openssl from version 0.4 to version 0.6 Changes in https://github.com/sonic-net/sonic-fips: 0c29b23 Upgrade the submodules: SymCrypt and SymCrypt-OpenSSL #40 80022f3 Fix the ARM64 build failure 2e76a3d Disable the unsupported tests Other changes will be added as well: 55b8e0a Merge pull request #35 from xumia/change-license 120c1a7 Upgrade SymCrypt and SymCrypt-OpenSSL 2f9c084 Merge pull request #39 from liuh-80/dev/liuh/update-openssh-version a3be6c5 Revert openssh version e02fa1e Update fips version How to verify it --- rules/sonic-fips.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/sonic-fips.mk b/rules/sonic-fips.mk index 8303918e2e1b..4c925ebf4e3a 100644 --- a/rules/sonic-fips.mk +++ b/rules/sonic-fips.mk @@ -1,6 +1,6 @@ # fips packages -FIPS_VERSION = 0.4 +FIPS_VERSION = 0.6 FIPS_OPENSSL_VERSION = 1.1.1n-0+deb11u3+fips FIPS_OPENSSH_VERSION = 8.4p1-5+deb11u1+fips FIPS_PYTHON_MAIN_VERSION = 3.9 From dabb31c5f6d7c9d3897a14d3851cf7d0de0a4fe6 Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Thu, 26 Jan 2023 20:38:29 -0800 Subject: [PATCH 064/113] [sudoers] add `/usr/local/bin/storyteller` to `READ_ONLY_CMDS` (#13422) Adding /usr/local/bin/storyteller to READ_ONLY_CMDS. So no write access or prompt for password is needed to run storyteller. Tested on 202205 clusters, user who didn't request write access was able to grep log using storyteller. sign-off: Jing Zhang zhangjing@microsoft.com --- files/image_config/sudoers/sudoers | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index fb371c59b8ad..d07d0dcfbcc8 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -42,7 +42,8 @@ Cmnd_Alias READ_ONLY_CMDS = /bin/cat /var/log/syslog*, \ /usr/local/bin/pcieutil *, \ /usr/local/bin/psuutil *, \ /usr/local/bin/sonic-installer list, \ - /usr/local/bin/sfputil show * + /usr/local/bin/sfputil show *, \ + /usr/local/bin/storyteller * Cmnd_Alias PASSWD_CMDS = /usr/local/bin/config tacacs passkey *, \ From c93716a142f47cc5cb684a5a76ace7470b5644a5 Mon Sep 17 00:00:00 2001 From: Devesh Pathak <54966909+devpatha@users.noreply.github.com> Date: Thu, 26 Jan 2023 20:39:13 -0800 Subject: [PATCH 065/113] rsyslog to start after interfaces-config (#13503) Fixes #12408 Why I did it We are running into #12408 very frequently. This results in no syslogs from any containers as rsyslog server could not start. some of the sonic-mgmt scripts look for log statements and error out if log is not present. Interfaces-config service configures the loopback interface along with other interfaces. rsyslog-config reads ip address of loopback interface and generates /etc/rsyslog.conf. When this race condition happens, lo interface ip is not yet programmed and rsyslog-config ends up writing UDP server as null in /etc/rsyslog.conf. How I did it rsyslog-config service is started after interfaces-config service. How to verify it Did multiple reboots and verified that $UDPServerAddress is valid. --- files/image_config/rsyslog/rsyslog-config.service | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/rsyslog/rsyslog-config.service b/files/image_config/rsyslog/rsyslog-config.service index 34c56fb0e00b..4290766da203 100644 --- a/files/image_config/rsyslog/rsyslog-config.service +++ b/files/image_config/rsyslog/rsyslog-config.service @@ -4,6 +4,7 @@ Requires=updategraph.service After=updategraph.service BindsTo=sonic.target After=sonic.target +After=interfaces-config.service [Service] Type=oneshot From fdfb35973fee61a254283b306e88a2feda208981 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Sat, 28 Jan 2023 03:48:14 +0800 Subject: [PATCH 066/113] [submodule] updater sonic-utilities (#13501) Includes below commits ``` 0d5e68f5a [GCU] Ignore bgpraw table in GCU operation (#2628) 22757b1f3 Add interface link-training command into the CLI doc (#2257) f4f857e10 [GCU] Ignore bgpraw in GCU applier (#2623) b5ac60036 [muxcable][config] Add support to enable/disable ceasing to be an advertisement interface when `radv` service is stopped (#2622) 981f9531e [chassis][voq] Add "show fabric reachability" command. (#2528) fba87f43f Revert (#2599) d6d7ab37f [warm-reboot] Use kexec_file_load instead of kexec_load when available (#2608) db4683d40 fix show techsupport error (#2597) 3d8e9c62d [GCU] Prohibit removal of PFC_WD POLL_INTERVAL field (#2545) 163e766cc [techsupport] include APPL_STATE_DB dump (#2607) 8703773eb YANG Validation for ConfigDB Updates: RADIUS_SERVER (#2604) c2d746d4f Remove TODO comment which is no longer relevant (#2600) f09da9983 [show] Add bgpraw to show run all (#2537) 39ac5641b Extend fast-reboot STATE_DB entry timer (#2577) ``` --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index fb8f98bfa672..0d5e68f5a1c6 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit fb8f98bfa672a80f56398d57a470a02d031d3da3 +Subproject commit 0d5e68f5a1c6519d22a518f741af0ba59bbc29b3 From b59f3888ff1582c030d06cffb788e02fa0086f39 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Sun, 29 Jan 2023 19:44:35 +0800 Subject: [PATCH 067/113] [sonic-acl.yang] Add new ACL key BTH_OPCODE and AETH_SYNDROME (#13340) - Why I did it Add new ACL key BTH_OPCODE and AETH_SYNDROME - How I did it Add new ACL key BTH_OPCODE and AETH_SYNDROME - How to verify it manual test unit test --- .../tests/files/sample_config_db.json | 12 ++++- .../tests/yang_model_tests/tests/acl.json | 8 +++ .../yang_model_tests/tests_config/acl.json | 54 +++++++++++++++++++ .../yang-templates/sonic-acl.yang.j2 | 14 +++++ 4 files changed, 87 insertions(+), 1 deletion(-) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 897f31e57238..dffe59f522d9 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -314,6 +314,14 @@ "PACKET_ACTION": "DROP", "IP_TYPE": "IPv4ANY", "SRC_IP": "1.1.1.1/32" + }, + "DATAACL|RULE1": { + "PRIORITY": "999", + "PACKET_ACTION": "FORWARD", + "IP_TYPE": "IPv4ANY", + "SRC_IP": "1.1.1.1/32", + "BTH_OPCODE": "0x11/0xbf", + "AETH_SYNDROME": "0x60/0x60" } }, "DEVICE_METADATA": { @@ -2076,7 +2084,9 @@ "matches": [ "IN_PORTS", "OUT_PORTS", - "SRC_IP" + "SRC_IP", + "BTH_OPCODE", + "AETH_SYNDROME" ], "actions": [ "PACKET_ACTION", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json index 3bfb0611fb2e..b6a7e5b213a6 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json @@ -132,5 +132,13 @@ }, "ACL_RULE_VALID_TCP_FLAGS": { "desc": "Configure ACL_RULE with valid TCP_FLAGS." + }, + "ACL_RULE_WRONG_BTH_OPCODE": { + "desc": "Configure invalid BTH_OPCODE in decimal format.", + "eStrKey" : "Pattern" + }, + "ACL_RULE_WRONG_AETH_SYNDROME": { + "desc": "Configure invalid AETH_SYNDROME in decimal format.", + "eStrKey" : "Pattern" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json index 6c3d3ad3ec64..dee86577e68e 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json @@ -1039,5 +1039,59 @@ ] } } + }, + "ACL_RULE_WRONG_BTH_OPCODE": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "BTH_OPCODE_TEST", + "ETHER_TYPE": "2048", + "PACKET_ACTION": "DROP", + "PRIORITY": 9981, + "BTH_OPCODE": "0x24", + "RULE_NAME": "Rule_19" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "BTH_OPCODE_TEST", + "policy_desc": "BTH_OPCODE_TEST", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L3" + } + ] + } + } + }, + "ACL_RULE_WRONG_AETH_SYNDROME": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "AETH_SYNDROME_TEST", + "ETHER_TYPE": "2048", + "PACKET_ACTION": "DROP", + "PRIORITY": 9981, + "AETH_SYNDROME": "0x24", + "RULE_NAME": "Rule_19" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "AETH_SYNDROME_TEST", + "policy_desc": "AETH_SYNDROME_TEST", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L3" + } + ] + } + } } } diff --git a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 index 2658016575e9..43250a033078 100644 --- a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 @@ -268,6 +268,20 @@ module sonic-acl { range "0..1"; } } + + leaf BTH_OPCODE { + description "RoCEv2 BTH OPCODE field"; + type string { + pattern '0[xX][0-9a-fA-F]{1,2}/0[xX][0-9a-fA-F]{1,2}'; + } + } + + leaf AETH_SYNDROME { + description "RoCEv2 AETH SYNDROME field"; + type string { + pattern '0[xX][0-9a-fA-F]{1,2}/0[xX][0-9a-fA-F]{1,2}'; + } + } } /* end of ACL_RULE_LIST */ } From cabaebb4b023971d118cabbb792986bfcbb92ab6 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Mon, 30 Jan 2023 16:57:39 +0800 Subject: [PATCH 068/113] [action] Update github actions on trigger and label. (#13542) Why I did it github action will report error on forked repos. It is not by design. keep 'Approved for xxx branch' label in auto cherry pick workflow. How I did it Disable github action on folked repos. Keep 'approved for xxx' label in auto cherry pick workflow. How to verify it Which release bra --- .github/workflows/automerge_scan.yml | 1 + .github/workflows/codeql-analysis.yml | 1 + .github/workflows/label.yml | 1 + .github/workflows/pr_cherrypick_poststep.yml | 2 +- .github/workflows/semgrep.yml | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/automerge_scan.yml b/.github/workflows/automerge_scan.yml index d2c970a159dc..b89e594720e7 100644 --- a/.github/workflows/automerge_scan.yml +++ b/.github/workflows/automerge_scan.yml @@ -6,6 +6,7 @@ on: jobs: automerge_scan: + if: github.repository_owner == 'sonic-net' runs-on: ubuntu-latest steps: - name: Debug diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6478fb99f7a5..86f17931383d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,6 +14,7 @@ on: jobs: analyze: + if: github.repository_owner == 'sonic-net' name: Analyze runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 5f8c0279b7e1..b00d61870882 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -20,6 +20,7 @@ on: jobs: label: + if: github.repository_owner == 'sonic-net' runs-on: ubuntu-latest steps: - uses: actions/labeler@main diff --git a/.github/workflows/pr_cherrypick_poststep.yml b/.github/workflows/pr_cherrypick_poststep.yml index 7be0b7d7cbe5..a343bed03ef6 100644 --- a/.github/workflows/pr_cherrypick_poststep.yml +++ b/.github/workflows/pr_cherrypick_poststep.yml @@ -46,4 +46,4 @@ jobs: exit 1 fi gh pr edit $origin_pr_url --add-label "Included in ${base_ref} Branch" - gh pr edit $origin_pr_url --remove-label "Created PR to ${base_ref} Branch,Approved for ${base_ref} Branch" + gh pr edit $origin_pr_url --remove-label "Created PR to ${base_ref} Branch" diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 8ebe082f50a4..975769a50566 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -10,6 +10,7 @@ on: jobs: semgrep: + if: github.repository_owner == 'sonic-net' name: Semgrep runs-on: ubuntu-latest container: From c7ecd92c54a3aaba1f86d61147239a1415f48d69 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Mon, 30 Jan 2023 21:13:10 +0100 Subject: [PATCH 069/113] Clear DNS configuration received from DHCP during networking reconfiguration in Linux. (#13516) - Why I did it fixes #12907 When the management interface IP address configuration changes from dynamic to static the DNS configuration (retrieved from the DHCP server) in /etc/resolv.conf remains uncleared. This leads to a DNS configuration pointing to the wrong nameserver. To make the behavior clear DNS configuration received from DHCP should be cleared. - How I did it Use resolvconf package for managing DNS configuration. It is capable of tracking the source of DNS configuration and puts the configuration retrieved from the DHCP servers into a separate file. This allows the implementation of DNS configuration cleanup retrieved from DHCP during networking reconfiguration. - How to verify it Ensure that the management interface has no static configuration. Check that /etc/resolv.conf has DNS configuration. Configure a static IP address on the management interface. Verify that /etc/resolv.conf has no DNS configuration. Remove the static IP address from the management interface. Verify that /etc/resolv.conf has DNS configuration retrieved form DHCP server. --- build_debian.sh | 9 +++++++-- files/image_config/interfaces/interfaces-config.sh | 3 +++ files/image_config/resolv-config/resolv.conf | 0 files/image_config/resolv-config/resolv.conf.head | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) delete mode 100644 files/image_config/resolv-config/resolv.conf create mode 100644 files/image_config/resolv-config/resolv.conf.head diff --git a/build_debian.sh b/build_debian.sh index 7c83d28b5103..3cecf8ac8435 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -397,7 +397,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in gpg \ jq \ auditd \ - linux-perf + linux-perf \ + resolvconf # default rsyslog version is 8.2110.0 which has a bug on log rate limit, # use backport version @@ -687,7 +688,11 @@ sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS ## Note: -x to skip directories on different file systems, such as /proc sudo du -hsx $FILESYSTEM_ROOT sudo mkdir -p $FILESYSTEM_ROOT/var/lib/docker -sudo cp files/image_config/resolv-config/resolv.conf $FILESYSTEM_ROOT/etc/resolv.conf + +## Clear DNS configuration inherited from the build server +sudo rm -f $FILESYSTEM_ROOT/etc/resolvconf/resolv.conf.d/original +sudo cp files/image_config/resolv-config/resolv.conf.head $FILESYSTEM_ROOT/etc/resolvconf/resolv.conf.d/head + sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -comp zstd -b 1M -e boot -e var/lib/docker -e $PLATFORM_DIR # Ensure admin gid is 1000 diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index f6aa4147a4e4..961349384692 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -60,6 +60,9 @@ for intf_pid in $(ls -1 /var/run/dhclient*.Ethernet*.pid 2> /dev/null); do [[ -f ${intf_pid} ]] && kill `cat ${intf_pid}` && rm -f ${intf_pid} done +[[ -f /var/run/resolvconf/interface/eth0.dhclient ]] && rm -f /var/run/resolvconf/interface/eth0.dhclient +[[ -f /var/run/resolvconf/interface/eth0.ip6.dhclient ]] && rm -f /var/run/resolvconf/interface/eth0.ip6.dhclient + # Read sysctl conf files again sysctl -p /etc/sysctl.d/90-dhcp6-systcl.conf diff --git a/files/image_config/resolv-config/resolv.conf b/files/image_config/resolv-config/resolv.conf deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/files/image_config/resolv-config/resolv.conf.head b/files/image_config/resolv-config/resolv.conf.head new file mode 100644 index 000000000000..db81bded75e9 --- /dev/null +++ b/files/image_config/resolv-config/resolv.conf.head @@ -0,0 +1,2 @@ +# Dynamic resolv.conf(5) file generated by resolvconf(8) +# The content of this file may be overwritten during a config reload. From 8c2d8ea4afeecb507350f00fdec9b258033edb5f Mon Sep 17 00:00:00 2001 From: kenneth-arista <93353051+kenneth-arista@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:13:01 -0800 Subject: [PATCH 070/113] [device/arista] Reduce SDK stat polling freq in DNX devices (#13429) Eariler the SDK stat polling was erroneously set to once every msec which is far more frequent than required by SWSS. The new setting, which is consistent with other vendor SKUs, is once a second. The net result is reduced CPU MHz by syncd. --- .../jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm | 2 +- .../Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm | 2 +- .../jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm | 2 +- .../jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm | 2 +- .../jr2-a7280cr3-32d4-40x100G.config.bcm | 2 +- .../0/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../1/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../0/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../1/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../0/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- .../1/j2p-a7800r3a-36d-36x400G.config.bcm | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C32D4/jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C32D4/jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm index a195781bf6c0..a8e711e7bd09 100644 --- a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C32D4/jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C32D4/jr2-a7280cr3-32d4-32x100G+4x400G.config.bcm @@ -273,7 +273,7 @@ appl_enable_intr_init.BCM8869X=1 polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 -bcm_stat_interval.BCM8869X=1000 +bcm_stat_interval.BCM8869X=1000000 mem_cache_enable_ecc.BCM8869X=1 mem_cache_enable_parity.BCM8869X=1 diff --git a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm index eb803c09bcef..8dbd850d30e6 100644 --- a/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32d4/Arista-7280CR3-C40/jr2-a7280cr3-32d4-40x100G.config.bcm @@ -276,7 +276,7 @@ appl_enable_intr_init.BCM8869X=1 polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 -bcm_stat_interval.BCM8869X=1000 +bcm_stat_interval.BCM8869X=1000000 mem_cache_enable_ecc.BCM8869X=1 mem_cache_enable_parity.BCM8869X=1 diff --git a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm index f10480ade949..f9a5d0f36ff6 100644 --- a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C28S8/jr2-a7280cr3-32p4-28x100G-8x10G.config.bcm @@ -272,7 +272,7 @@ appl_enable_intr_init.BCM8869X=1 polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 -bcm_stat_interval.BCM8869X=1000 +bcm_stat_interval.BCM8869X=1000000 mem_cache_enable_ecc.BCM8869X=1 mem_cache_enable_parity.BCM8869X=1 diff --git a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm index b74d741cbd06..3d4f595f2d30 100644 --- a/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm +++ b/device/arista/x86_64-arista_7280cr3_32p4/Arista-7280CR3-C32P4/jr2-a7280cr3-32p4-32x100G+4x400G.config.bcm @@ -273,7 +273,7 @@ appl_enable_intr_init.BCM8869X=1 polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 -bcm_stat_interval.BCM8869X=1000 +bcm_stat_interval.BCM8869X=1000000 mem_cache_enable_ecc.BCM8869X=1 mem_cache_enable_parity.BCM8869X=1 diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm index b5a680403015..93c5c8d21560 100644 --- a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm @@ -766,7 +766,7 @@ appl_enable_intr_init.BCM8869X=1 polled_irq_mode.BCM8869X=0 polled_irq_delay.BCM8869X=1000 -bcm_stat_interval.BCM8869X=1000 +bcm_stat_interval.BCM8869X=1000000 mem_cache_enable_ecc.BCM8869X=1 mem_cache_enable_parity.BCM8869X=1 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm index e21ebf9092a8..8421a2b9ee08 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -639,7 +639,7 @@ polled_irq_mode=0 polled_irq_delay=1000 # reduce the CPU load over adapter (caused by counter thread) -bcm_stat_interval=1000 +bcm_stat_interval=1000000 # shadow memory mem_cache_enable_ecc=1 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm index 8e7fa9ef15f8..34a77903ebdf 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -639,7 +639,7 @@ polled_irq_mode=0 polled_irq_delay=1000 # reduce the CPU load over adapter (caused by counter thread) -bcm_stat_interval=1000 +bcm_stat_interval=1000000 # shadow memory mem_cache_enable_ecc=1 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm index a3ae8e5d7253..744e33b7e2e4 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -657,7 +657,7 @@ polled_irq_mode=0 polled_irq_delay=1000 # reduce the CPU load over adapter (caused by counter thread) -bcm_stat_interval=1000 +bcm_stat_interval=1000000 # shadow memory mem_cache_enable_ecc=1 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm index 37c4a869ceb2..030a4f83ab10 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -657,7 +657,7 @@ polled_irq_mode=0 polled_irq_delay=1000 # reduce the CPU load over adapter (caused by counter thread) -bcm_stat_interval=1000 +bcm_stat_interval=1000000 # shadow memory mem_cache_enable_ecc=1 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm index b2981c29b3c4..46dcd675d65c 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -639,7 +639,7 @@ polled_irq_mode=0 polled_irq_delay=1000 # reduce the CPU load over adapter (caused by counter thread) -bcm_stat_interval=1000 +bcm_stat_interval=1000000 # shadow memory mem_cache_enable_ecc=1 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm index 106554efa89e..5eb17bc354fb 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -639,7 +639,7 @@ polled_irq_mode=0 polled_irq_delay=1000 # reduce the CPU load over adapter (caused by counter thread) -bcm_stat_interval=1000 +bcm_stat_interval=1000000 # shadow memory mem_cache_enable_ecc=1 From bb48ee92abfa1e0b4afc70204a46f1642b6c86c8 Mon Sep 17 00:00:00 2001 From: Yaqiang Zhu <1512099831@qq.com> Date: Mon, 30 Jan 2023 17:48:01 -0800 Subject: [PATCH 071/113] [dhcp-relay] Add support for dhcp_relay config cli (#13373) Why I did it Currently the config cli of dhcpv4 is may cause confusion and config of dhcpv6 is missing. How I did it Add dhcp_relay config cli and test cases. config dhcp_relay ipv4 helper (add | del) config dhcp_relay ipv6 destination (add | del) Updated docs for it in sonic-utilities: https://github.com/sonic-net/sonic-utilities/pull/2598/files How to verify it Build docker-dhcp-relay.gz with and without INCLUDE_DHCP_RELAY, and check target/docker-dhcp-relay.gz.log --- .../cli-plugin-tests/conftest.py | 5 + .../test_config_dhcp_relay.py | 317 ++++++++++-------- .../test_config_vlan_dhcp_relay.py | 229 +++++++++++++ .../cli/config/plugins/dhcp_relay.py | 189 ++++++++++- 4 files changed, 586 insertions(+), 154 deletions(-) create mode 100644 dockers/docker-dhcp-relay/cli-plugin-tests/test_config_vlan_dhcp_relay.py diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py index 4eb79edd0b60..37aec0b8b251 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py @@ -10,6 +10,11 @@ def mock_cfgdb(): 'Vlan1000': { 'dhcp_servers': ['192.0.0.1'] } + }, + 'DHCP_RELAY': { + 'Vlan1000': { + 'dhcpv6_servers': ['fc02:2000::1'] + } } } diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py index 46acda358b8f..2c9a5c19a93b 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py @@ -1,229 +1,264 @@ -import os import sys -import traceback +from utilities_common.db import Db from unittest import mock - from click.testing import CliRunner -from utilities_common.db import Db - import pytest - -sys.path.append('../cli/config/plugins/') +sys.path.append("../cli/config/plugins/") import dhcp_relay -config_vlan_add_dhcp_relay_output="""\ -Added DHCP relay destination addresses ['192.0.0.100'] to Vlan1000 -Restarting DHCP relay service... -""" - -config_vlan_add_dhcpv6_relay_output="""\ -Added DHCP relay destination addresses ['fc02:2000::1'] to Vlan1000 +config_dhcp_relay_add_output = """\ +Added DHCP relay address [{}] to Vlan1000 Restarting DHCP relay service... """ - -config_vlan_add_multiple_dhcpv6_relay_output="""\ -Added DHCP relay destination addresses ['fc02:2000::1', 'fc02:2000::2', 'fc02:2000::3'] to Vlan1000 -Restarting DHCP relay service... -""" - -config_vlan_del_dhcp_relay_output="""\ -Removed DHCP relay destination addresses ('192.0.0.100',) from Vlan1000 +config_dhcp_relay_del_output = """\ +Removed DHCP relay address [{}] from Vlan1000 Restarting DHCP relay service... """ - -config_vlan_del_dhcpv6_relay_output="""\ -Removed DHCP relay destination addresses ('fc02:2000::1',) from Vlan1000 -Restarting DHCP relay service... -""" - -config_vlan_del_multiple_dhcpv6_relay_output="""\ -Removed DHCP relay destination addresses ('fc02:2000::1', 'fc02:2000::2', 'fc02:2000::3') from Vlan1000 -Restarting DHCP relay service... -""" - -class TestConfigVlanDhcpRelay(object): +expected_dhcp_relay_add_config_db_output = { + "ipv4": { + "dhcp_servers": [ + "192.0.0.1", "192.0.0.3"] + }, + "ipv6": { + "dhcpv6_servers": [ + "fc02:2000::1", "fc02:2000::3"] + } +} +expected_dhcp_relay_del_config_db_output = { + "ipv4": { + "dhcp_servers": [ + "192.0.0.1" + ] + }, + "ipv6": { + "dhcpv6_servers": [ + "fc02:2000::1" + ] + } +} +expected_dhcp_relay_add_multi_config_db_output = { + "ipv4": { + "dhcp_servers": [ + "192.0.0.1", "192.0.0.3", "192.0.0.4", "192.0.0.5" + ] + }, + "ipv6": { + "dhcpv6_servers": [ + "fc02:2000::1", "fc02:2000::3", "fc02:2000::4", "fc02:2000::5" + ] + } +} + +IP_VER_TEST_PARAM_MAP = { + "ipv4": { + "command": "helper", + "ips": [ + "192.0.0.3", + "192.0.0.4", + "192.0.0.5" + ], + "exist_ip": "192.0.0.1", + "nonexist_ip": "192.0.0.2", + "invalid_ip": "192.0.0", + "table": "VLAN" + }, + "ipv6": { + "command": "destination", + "ips": [ + "fc02:2000::3", + "fc02:2000::4", + "fc02:2000::5" + ], + "exist_ip": "fc02:2000::1", + "nonexist_ip": "fc02:2000::2", + "invalid_ip": "fc02:2000:", + "table": "DHCP_RELAY" + } +} + + +@pytest.fixture(scope="module", params=["ipv4", "ipv6"]) +def ip_version(request): + """ + Parametrize Ip version + + Args: + request: pytest request object + + Returns: + Ip version needed for test case + """ + return request.param + + +@pytest.fixture(scope="module", params=["add", "del"]) +def op(request): + """ + Parametrize operate tpye + + Args: + request: pytest request object + + Returns: + Operate tpye + """ + return request.param + + +class TestConfigDhcpRelay(object): def test_plugin_registration(self): cli = mock.MagicMock() dhcp_relay.register(cli) - cli.commands['vlan'].add_command.assert_called_once_with(dhcp_relay.vlan_dhcp_relay) - def test_config_vlan_add_dhcp_relay_with_nonexist_vlanid(self): + def test_config_dhcp_relay_add_del_with_nonexist_vlanid(self, ip_version, op): runner = CliRunner() - with mock.patch('utilities_common.cli.run_command') as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], - ["1001", "192.0.0.100"]) + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands[op], ["1001", IP_VER_TEST_PARAM_MAP[ip_version]["ips"][0]]) print(result.exit_code) - print(result.output) - # traceback.print_tb(result.exc_info[2]) + print(result.stdout) assert result.exit_code != 0 assert "Error: Vlan1001 doesn't exist" in result.output assert mock_run_command.call_count == 0 - def test_config_vlan_add_dhcp_relay_with_invalid_vlanid(self): + def test_config_add_del_dhcp_relay_with_invalid_ip(self, ip_version, op): runner = CliRunner() + invalid_ip = IP_VER_TEST_PARAM_MAP[ip_version]["invalid_ip"] - with mock.patch('utilities_common.cli.run_command') as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], - ["4096", "192.0.0.100"]) - print(result.exit_code) - print(result.output) - # traceback.print_tb(result.exc_info[2]) - assert result.exit_code != 0 - assert "Error: Vlan4096 doesn't exist" in result.output - assert mock_run_command.call_count == 0 - - def test_config_vlan_add_dhcp_relay_with_invalid_ip(self, mock_cfgdb): - runner = CliRunner() - db = Db() - db.cfgdb = mock_cfgdb - - with mock.patch('utilities_common.cli.run_command') as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], - ["1000", "192.0.0.1000"], obj=db) - print(result.exit_code) - print(result.output) - # traceback.print_tb(result.exc_info[2]) - assert result.exit_code != 0 - assert "Error: 192.0.0.1000 is invalid IP address" in result.output - assert mock_run_command.call_count == 0 - - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], - ["1000", "192.0.0."], obj=db) + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands[op], ["1000", invalid_ip]) print(result.exit_code) print(result.output) assert result.exit_code != 0 - assert "Error: 192.0.0. is invalid IP address" in result.output + assert "Error: {} is invalid IP address".format(invalid_ip) in result.output assert mock_run_command.call_count == 0 - def test_config_vlan_add_dhcp_relay_with_exist_ip(self, mock_cfgdb): + def test_config_add_dhcp_with_exist_ip(self, mock_cfgdb, ip_version): runner = CliRunner() db = Db() db.cfgdb = mock_cfgdb + exist_ip = IP_VER_TEST_PARAM_MAP[ip_version]["exist_ip"] - with mock.patch('utilities_common.cli.run_command') as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], - ["1000", "192.0.0.1"], obj=db) + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands["add"], ["1000", exist_ip], obj=db) print(result.exit_code) print(result.output) assert result.exit_code == 0 - assert "192.0.0.1 is already a DHCP relay destination for Vlan1000" in result.output + assert "{} is already a DHCP relay for Vlan1000".format(exist_ip) in result.output assert mock_run_command.call_count == 0 - def test_config_vlan_add_del_dhcp_relay_dest(self, mock_cfgdb): + def test_config_del_nonexist_dhcp_relay(self, mock_cfgdb, ip_version): runner = CliRunner() db = Db() db.cfgdb = mock_cfgdb + nonexist_ip = IP_VER_TEST_PARAM_MAP[ip_version]["nonexist_ip"] - # add new relay dest - with mock.patch("utilities_common.cli.run_command") as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], - ["1000", "192.0.0.100"], obj=db) - print(result.exit_code) - print(result.output) - assert result.exit_code == 0 - assert result.output == config_vlan_add_dhcp_relay_output - assert mock_run_command.call_count == 3 - db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1', '192.0.0.100']}) - - db.cfgdb.set_entry.reset_mock() - - # del relay dest with mock.patch("utilities_common.cli.run_command") as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], - ["1000", "192.0.0.100"], obj=db) + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands["del"], ["1000", nonexist_ip], obj=db) print(result.exit_code) print(result.output) - assert result.exit_code == 0 - assert result.output == config_vlan_del_dhcp_relay_output - assert mock_run_command.call_count == 3 - db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1']}) + assert result.exit_code != 0 + assert "Error: {} is not a DHCP relay for Vlan1000".format(nonexist_ip) in result.output + assert mock_run_command.call_count == 0 - def test_config_vlan_add_del_dhcpv6_relay_dest(self, mock_cfgdb): + def test_config_add_del_dhcp_relay(self, mock_cfgdb, ip_version): runner = CliRunner() db = Db() db.cfgdb = mock_cfgdb + test_ip = IP_VER_TEST_PARAM_MAP[ip_version]["ips"][0] + config_db_table = IP_VER_TEST_PARAM_MAP[ip_version]["table"] - # add new relay dest with mock.patch("utilities_common.cli.run_command") as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], - ["1000", "fc02:2000::1"], obj=db) + # add new dhcp relay + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands["add"], ["1000", test_ip], obj=db) print(result.exit_code) print(result.output) assert result.exit_code == 0 - assert result.output == config_vlan_add_dhcpv6_relay_output + assert result.output == config_dhcp_relay_add_output.format(test_ip) + assert db.cfgdb.get_entry(config_db_table, "Vlan1000") \ + == expected_dhcp_relay_add_config_db_output[ip_version] assert mock_run_command.call_count == 3 - db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1'], 'dhcpv6_servers': ['fc02:2000::1']}) + db.cfgdb.set_entry.assert_called_once_with(config_db_table, "Vlan1000", + expected_dhcp_relay_add_config_db_output[ip_version]) db.cfgdb.set_entry.reset_mock() - - # del relay dest + # del dhcp relay with mock.patch("utilities_common.cli.run_command") as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], - ["1000", "fc02:2000::1"], obj=db) + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands["del"], ["1000", test_ip], obj=db) print(result.exit_code) print(result.output) assert result.exit_code == 0 - assert result.output == config_vlan_del_dhcpv6_relay_output + assert result.output == config_dhcp_relay_del_output.format(test_ip) assert mock_run_command.call_count == 3 - db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1']}) + assert db.cfgdb.get_entry(config_db_table, "Vlan1000") \ + == expected_dhcp_relay_del_config_db_output[ip_version] + db.cfgdb.set_entry.assert_called_once_with(config_db_table, "Vlan1000", + expected_dhcp_relay_del_config_db_output[ip_version]) - def test_config_vlan_add_del_multiple_dhcpv6_relay_dest(self, mock_cfgdb): + def test_config_add_del_multiple_dhcp_relay(self, mock_cfgdb, ip_version): runner = CliRunner() db = Db() db.cfgdb = mock_cfgdb + test_ips = IP_VER_TEST_PARAM_MAP[ip_version]["ips"] + config_db_table = IP_VER_TEST_PARAM_MAP[ip_version]["table"] - # add new relay dest with mock.patch("utilities_common.cli.run_command") as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], - ["1000", "fc02:2000::1", "fc02:2000::2", "fc02:2000::3"], obj=db) + # add new dhcp relay + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands["add"], ["1000"] + test_ips, obj=db) print(result.exit_code) print(result.output) assert result.exit_code == 0 - assert result.output == config_vlan_add_multiple_dhcpv6_relay_output + assert result.output == config_dhcp_relay_add_output.format(",".join(test_ips)) + assert db.cfgdb.get_entry(config_db_table, "Vlan1000") \ + == expected_dhcp_relay_add_multi_config_db_output[ip_version] assert mock_run_command.call_count == 3 - db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1'], 'dhcpv6_servers': ['fc02:2000::1', 'fc02:2000::2', 'fc02:2000::3']}) + db.cfgdb.set_entry.assert_called_once_with(config_db_table, "Vlan1000", + expected_dhcp_relay_add_multi_config_db_output[ip_version]) db.cfgdb.set_entry.reset_mock() - - # del relay dest + # del dhcp relay with mock.patch("utilities_common.cli.run_command") as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], - ["1000", "fc02:2000::1", "fc02:2000::2", "fc02:2000::3"], obj=db) + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands["del"], ["1000"] + test_ips, obj=db) print(result.exit_code) print(result.output) assert result.exit_code == 0 - assert result.output == config_vlan_del_multiple_dhcpv6_relay_output + assert result.output == config_dhcp_relay_del_output.format(",".join(test_ips)) assert mock_run_command.call_count == 3 - db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1']}) + assert db.cfgdb.get_entry(config_db_table, "Vlan1000") \ + == expected_dhcp_relay_del_config_db_output[ip_version] + db.cfgdb.set_entry.assert_called_once_with(config_db_table, "Vlan1000", + expected_dhcp_relay_del_config_db_output[ip_version]) - def test_config_vlan_remove_nonexist_dhcp_relay_dest(self, mock_cfgdb): + def test_config_add_del_duplicate_dhcp_relay(self, mock_cfgdb, ip_version, op): runner = CliRunner() db = Db() db.cfgdb = mock_cfgdb + test_ip = IP_VER_TEST_PARAM_MAP[ip_version]["ips"][0] if op == "add" \ + else IP_VER_TEST_PARAM_MAP[ip_version]["exist_ip"] - with mock.patch('utilities_common.cli.run_command') as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], - ["1000", "192.0.0.100"], obj=db) - print(result.exit_code) - print(result.output) - # traceback.print_tb(result.exc_info[2]) - assert result.exit_code != 0 - assert "Error: 192.0.0.100 is not a DHCP relay destination for Vlan1000" in result.output - assert mock_run_command.call_count == 0 - - def test_config_vlan_remove_dhcp_relay_dest_with_nonexist_vlanid(self, mock_cfgdb): - runner = CliRunner() - db = Db() - db.cfgdb = mock_cfgdb - - with mock.patch('utilities_common.cli.run_command') as mock_run_command: - result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], - ["1001", "192.0.0.1"], obj=Db) + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.dhcp_relay.commands[ip_version] + .commands[IP_VER_TEST_PARAM_MAP[ip_version]["command"]] + .commands[op], ["1000", test_ip, test_ip], obj=db) print(result.exit_code) print(result.output) - # traceback.print_tb(result.exc_info[2]) assert result.exit_code != 0 - assert "Error: Vlan1001 doesn't exist" in result.output + assert "Error: Find duplicate DHCP relay ip {} in {} list".format(test_ip, op) in result.output assert mock_run_command.call_count == 0 diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_vlan_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_vlan_dhcp_relay.py new file mode 100644 index 000000000000..46acda358b8f --- /dev/null +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_vlan_dhcp_relay.py @@ -0,0 +1,229 @@ +import os +import sys +import traceback +from unittest import mock + +from click.testing import CliRunner + +from utilities_common.db import Db + +import pytest + +sys.path.append('../cli/config/plugins/') +import dhcp_relay + +config_vlan_add_dhcp_relay_output="""\ +Added DHCP relay destination addresses ['192.0.0.100'] to Vlan1000 +Restarting DHCP relay service... +""" + +config_vlan_add_dhcpv6_relay_output="""\ +Added DHCP relay destination addresses ['fc02:2000::1'] to Vlan1000 +Restarting DHCP relay service... +""" + +config_vlan_add_multiple_dhcpv6_relay_output="""\ +Added DHCP relay destination addresses ['fc02:2000::1', 'fc02:2000::2', 'fc02:2000::3'] to Vlan1000 +Restarting DHCP relay service... +""" + +config_vlan_del_dhcp_relay_output="""\ +Removed DHCP relay destination addresses ('192.0.0.100',) from Vlan1000 +Restarting DHCP relay service... +""" + +config_vlan_del_dhcpv6_relay_output="""\ +Removed DHCP relay destination addresses ('fc02:2000::1',) from Vlan1000 +Restarting DHCP relay service... +""" + +config_vlan_del_multiple_dhcpv6_relay_output="""\ +Removed DHCP relay destination addresses ('fc02:2000::1', 'fc02:2000::2', 'fc02:2000::3') from Vlan1000 +Restarting DHCP relay service... +""" + +class TestConfigVlanDhcpRelay(object): + def test_plugin_registration(self): + cli = mock.MagicMock() + dhcp_relay.register(cli) + cli.commands['vlan'].add_command.assert_called_once_with(dhcp_relay.vlan_dhcp_relay) + + def test_config_vlan_add_dhcp_relay_with_nonexist_vlanid(self): + runner = CliRunner() + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1001", "192.0.0.100"]) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: Vlan1001 doesn't exist" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_add_dhcp_relay_with_invalid_vlanid(self): + runner = CliRunner() + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["4096", "192.0.0.100"]) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: Vlan4096 doesn't exist" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_add_dhcp_relay_with_invalid_ip(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "192.0.0.1000"], obj=db) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: 192.0.0.1000 is invalid IP address" in result.output + assert mock_run_command.call_count == 0 + + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "192.0.0."], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code != 0 + assert "Error: 192.0.0. is invalid IP address" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_add_dhcp_relay_with_exist_ip(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "192.0.0.1"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert "192.0.0.1 is already a DHCP relay destination for Vlan1000" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_add_del_dhcp_relay_dest(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + # add new relay dest + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "192.0.0.100"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == config_vlan_add_dhcp_relay_output + assert mock_run_command.call_count == 3 + db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1', '192.0.0.100']}) + + db.cfgdb.set_entry.reset_mock() + + # del relay dest + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], + ["1000", "192.0.0.100"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == config_vlan_del_dhcp_relay_output + assert mock_run_command.call_count == 3 + db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1']}) + + def test_config_vlan_add_del_dhcpv6_relay_dest(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + # add new relay dest + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "fc02:2000::1"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == config_vlan_add_dhcpv6_relay_output + assert mock_run_command.call_count == 3 + db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1'], 'dhcpv6_servers': ['fc02:2000::1']}) + + db.cfgdb.set_entry.reset_mock() + + # del relay dest + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], + ["1000", "fc02:2000::1"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == config_vlan_del_dhcpv6_relay_output + assert mock_run_command.call_count == 3 + db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1']}) + + def test_config_vlan_add_del_multiple_dhcpv6_relay_dest(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + # add new relay dest + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "fc02:2000::1", "fc02:2000::2", "fc02:2000::3"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == config_vlan_add_multiple_dhcpv6_relay_output + assert mock_run_command.call_count == 3 + db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1'], 'dhcpv6_servers': ['fc02:2000::1', 'fc02:2000::2', 'fc02:2000::3']}) + + db.cfgdb.set_entry.reset_mock() + + # del relay dest + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], + ["1000", "fc02:2000::1", "fc02:2000::2", "fc02:2000::3"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == config_vlan_del_multiple_dhcpv6_relay_output + assert mock_run_command.call_count == 3 + db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1']}) + + def test_config_vlan_remove_nonexist_dhcp_relay_dest(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], + ["1000", "192.0.0.100"], obj=db) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: 192.0.0.100 is not a DHCP relay destination for Vlan1000" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_remove_dhcp_relay_dest_with_nonexist_vlanid(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], + ["1001", "192.0.0.1"], obj=Db) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: Vlan1001 doesn't exist" in result.output + assert mock_run_command.call_count == 0 diff --git a/dockers/docker-dhcp-relay/cli/config/plugins/dhcp_relay.py b/dockers/docker-dhcp-relay/cli/config/plugins/dhcp_relay.py index 33a798fc8778..57848161f653 100644 --- a/dockers/docker-dhcp-relay/cli/config/plugins/dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli/config/plugins/dhcp_relay.py @@ -1,11 +1,177 @@ import click -import utilities_common.cli as clicommon import ipaddress +import utilities_common.cli as clicommon + +DHCP_RELAY_TABLE = "DHCP_RELAY" +DHCPV6_SERVERS = "dhcpv6_servers" +IPV6 = 6 + +VLAN_TABLE = "VLAN" +DHCPV4_SERVERS = "dhcp_servers" +IPV4 = 4 + + +def validate_ips(ctx, ips, ip_version): + for ip in ips: + try: + ip_address = ipaddress.ip_address(ip) + except Exception: + ctx.fail("{} is invalid IP address".format(ip)) + + if ip_address.version != ip_version: + ctx.fail("{} is not IPv{} address".format(ip, ip_version)) + + +def get_dhcp_servers(db, vlan_name, ctx, table_name, dhcp_servers_str): + table = db.cfgdb.get_entry(table_name, vlan_name) + if len(table.keys()) == 0: + ctx.fail("{} doesn't exist".format(vlan_name)) + + dhcp_servers = table.get(dhcp_servers_str, []) + + return dhcp_servers, table + + +def restart_dhcp_relay_service(): + """ + Restart dhcp_relay service + """ + click.echo("Restarting DHCP relay service...") + clicommon.run_command("systemctl stop dhcp_relay", display_cmd=False) + clicommon.run_command("systemctl reset-failed dhcp_relay", display_cmd=False) + clicommon.run_command("systemctl start dhcp_relay", display_cmd=False) + +def add_dhcp_relay(vid, dhcp_relay_ips, db, ip_version): + table_name = DHCP_RELAY_TABLE if ip_version == 6 else VLAN_TABLE + dhcp_servers_str = DHCPV6_SERVERS if ip_version == 6 else DHCPV4_SERVERS + vlan_name = "Vlan{}".format(vid) + ctx = click.get_current_context() + # Verify ip addresses are valid + validate_ips(ctx, dhcp_relay_ips, ip_version) + dhcp_servers, table = get_dhcp_servers(db, vlan_name, ctx, table_name, dhcp_servers_str) + added_ips = [] + + for dhcp_relay_ip in dhcp_relay_ips: + # Verify ip addresses not duplicate in add list + if dhcp_relay_ip in added_ips: + ctx.fail("Error: Find duplicate DHCP relay ip {} in add list".format(dhcp_relay_ip)) + # Verify ip addresses not exist in DB + if dhcp_relay_ip in dhcp_servers: + click.echo("{} is already a DHCP relay for {}".format(dhcp_relay_ip, vlan_name)) + return + + dhcp_servers.append(dhcp_relay_ip) + added_ips.append(dhcp_relay_ip) + + table[dhcp_servers_str] = dhcp_servers + + db.cfgdb.set_entry(table_name, vlan_name, table) + click.echo("Added DHCP relay address [{}] to {}".format(",".join(dhcp_relay_ips), vlan_name)) + try: + restart_dhcp_relay_service() + except SystemExit as e: + ctx.fail("Restart service dhcp_relay failed with error {}".format(e)) + + +def del_dhcp_relay(vid, dhcp_relay_ips, db, ip_version): + table_name = DHCP_RELAY_TABLE if ip_version == 6 else VLAN_TABLE + dhcp_servers_str = DHCPV6_SERVERS if ip_version == 6 else DHCPV4_SERVERS + vlan_name = "Vlan{}".format(vid) + ctx = click.get_current_context() + # Verify ip addresses are valid + validate_ips(ctx, dhcp_relay_ips, ip_version) + dhcp_servers, table = get_dhcp_servers(db, vlan_name, ctx, table_name, dhcp_servers_str) + removed_ips = [] + + for dhcp_relay_ip in dhcp_relay_ips: + # Verify ip addresses not duplicate in del list + if dhcp_relay_ip in removed_ips: + ctx.fail("Error: Find duplicate DHCP relay ip {} in del list".format(dhcp_relay_ip)) + # Remove dhcp servers if they exist in the DB + if dhcp_relay_ip not in dhcp_servers: + ctx.fail("{} is not a DHCP relay for {}".format(dhcp_relay_ip, vlan_name)) + + dhcp_servers.remove(dhcp_relay_ip) + removed_ips.append(dhcp_relay_ip) + + if len(dhcp_servers) == 0: + del table[dhcp_servers_str] + else: + table[dhcp_servers_str] = dhcp_servers + + db.cfgdb.set_entry(table_name, vlan_name, table) + click.echo("Removed DHCP relay address [{}] from {}".format(",".join(dhcp_relay_ips), vlan_name)) + try: + restart_dhcp_relay_service() + except SystemExit as e: + ctx.fail("Restart service dhcp_relay failed with error {}".format(e)) + + +@click.group(cls=clicommon.AbbreviationGroup, name="dhcp_relay") +def dhcp_relay(): + """config DHCP_Relay information""" + pass + + +@dhcp_relay.group(cls=clicommon.AbbreviationGroup, name="ipv6") +def dhcp_relay_ipv6(): + pass + + +@dhcp_relay_ipv6.group(cls=clicommon.AbbreviationGroup, name="destination") +def dhcp_relay_ipv6_destination(): + pass + + +@dhcp_relay_ipv6_destination.command("add") +@click.argument("vid", metavar="", required=True, type=int) +@click.argument("dhcp_relay_destinations", nargs=-1, required=True) +@clicommon.pass_db +def add_dhcp_relay_ipv6_destination(db, vid, dhcp_relay_destinations): + add_dhcp_relay(vid, dhcp_relay_destinations, db, IPV6) + + +@dhcp_relay_ipv6_destination.command("del") +@click.argument("vid", metavar="", required=True, type=int) +@click.argument("dhcp_relay_destinations", nargs=-1, required=True) +@clicommon.pass_db +def del_dhcp_relay_ipv6_destination(db, vid, dhcp_relay_destinations): + del_dhcp_relay(vid, dhcp_relay_destinations, db, IPV6) + + +@dhcp_relay.group(cls=clicommon.AbbreviationGroup, name="ipv4") +def dhcp_relay_ipv4(): + pass + + +@dhcp_relay_ipv4.group(cls=clicommon.AbbreviationGroup, name="helper") +def dhcp_relay_ipv4_helper(): + pass + + +@dhcp_relay_ipv4_helper.command("add") +@click.argument("vid", metavar="", required=True, type=int) +@click.argument("dhcp_relay_helpers", nargs=-1, required=True) +@clicommon.pass_db +def add_dhcp_relay_ipv4_helper(db, vid, dhcp_relay_helpers): + add_dhcp_relay(vid, dhcp_relay_helpers, db, IPV4) + + +@dhcp_relay_ipv4_helper.command("del") +@click.argument("vid", metavar="", required=True, type=int) +@click.argument("dhcp_relay_helpers", nargs=-1, required=True) +@clicommon.pass_db +def del_dhcp_relay_ipv4_helper(db, vid, dhcp_relay_helpers): + del_dhcp_relay(vid, dhcp_relay_helpers, db, IPV4) + + +# subcommand of vlan @click.group(cls=clicommon.AbbreviationGroup, name='dhcp_relay') def vlan_dhcp_relay(): pass + @vlan_dhcp_relay.command('add') @click.argument('vid', metavar='', required=True, type=int) @click.argument('dhcp_relay_destination_ips', nargs=-1, required=True) @@ -30,8 +196,8 @@ def add_vlan_dhcp_relay_destination(db, vid, dhcp_relay_destination_ips): try: ipaddress.ip_address(ip_addr) if (ip_addr in dhcp_servers) or (ip_addr in dhcpv6_servers): - click.echo("{} is already a DHCP relay destination for {}".format(ip_addr, vlan_name)) - continue + click.echo("{} is already a DHCP relay destination for {}".format(ip_addr, vlan_name)) + continue if clicommon.ipaddress_type(ip_addr) == 4: dhcp_servers.append(ip_addr) else: @@ -51,13 +217,11 @@ def add_vlan_dhcp_relay_destination(db, vid, dhcp_relay_destination_ips): if len(added_servers): click.echo("Added DHCP relay destination addresses {} to {}".format(added_servers, vlan_name)) try: - click.echo("Restarting DHCP relay service...") - clicommon.run_command("systemctl stop dhcp_relay", display_cmd=False) - clicommon.run_command("systemctl reset-failed dhcp_relay", display_cmd=False) - clicommon.run_command("systemctl start dhcp_relay", display_cmd=False) + restart_dhcp_relay_service() except SystemExit as e: ctx.fail("Restart service dhcp_relay failed with error {}".format(e)) + @vlan_dhcp_relay.command('del') @click.argument('vid', metavar='', required=True, type=int) @click.argument('dhcp_relay_destination_ips', nargs=-1, required=True) @@ -79,9 +243,9 @@ def del_vlan_dhcp_relay_destination(db, vid, dhcp_relay_destination_ips): for ip_addr in dhcp_relay_destination_ips: if (ip_addr not in dhcp_servers) and (ip_addr not in dhcpv6_servers): - ctx.fail("{} is not a DHCP relay destination for {}".format(ip_addr, vlan_name)) + ctx.fail("{} is not a DHCP relay destination for {}".format(ip_addr, vlan_name)) if clicommon.ipaddress_type(ip_addr) == 4: - dhcp_servers.remove(ip_addr) + dhcp_servers.remove(ip_addr) else: dhcpv6_servers.remove(ip_addr) @@ -101,17 +265,16 @@ def del_vlan_dhcp_relay_destination(db, vid, dhcp_relay_destination_ips): db.cfgdb.set_entry('VLAN', vlan_name, vlan) click.echo("Removed DHCP relay destination addresses {} from {}".format(dhcp_relay_destination_ips, vlan_name)) try: - click.echo("Restarting DHCP relay service...") - clicommon.run_command("systemctl stop dhcp_relay", display_cmd=False) - clicommon.run_command("systemctl reset-failed dhcp_relay", display_cmd=False) - clicommon.run_command("systemctl start dhcp_relay", display_cmd=False) + restart_dhcp_relay_service() except SystemExit as e: ctx.fail("Restart service dhcp_relay failed with error {}".format(e)) def register(cli): + cli.add_command(dhcp_relay) cli.commands['vlan'].add_command(vlan_dhcp_relay) if __name__ == '__main__': + dhcp_relay() vlan_dhcp_relay() From a096363b4848ee464beab34ac87f7afb0bf72171 Mon Sep 17 00:00:00 2001 From: "Richard.Yu" Date: Tue, 31 Jan 2023 12:23:03 +0800 Subject: [PATCH 072/113] [broadcom]: Set default SYNCD_SHM_SIZE for Broadcom XGS devices (#13297) After upgrade to brcmsai 8.1, the sdk running environment (container) recommended with mininum memory size as below TH4/TD4(ltsw) uses 512MB TH3 used 300MB Helix4/TD2/TD3/TH/TH 256 MB Base on this requirement, adjust the default syncd share memory size and set the memory size for special ACISs in platform_env.conf file for different types of Broadcom ASICs. How I did it Add the platform_env.conf file if none of it for broadcom platform (base on platform_asic file) Add the 'SYNCD_SHM_SIZE' and set the value for ltsw(TD4/TH4) devices set to 512M at least (update the platform_env.conf) for Td2/TH2/TH devices set to 256M for TH3 set to 300M verify How to verify it verify the image with code fix Check with UT Check on lab devices On a problematic device which cannot start successfully Run with the command $ cat /proc/linux-kernel-bde Broadcom Device Enumerator (linux-kernel-bde) Module parameters: maxpayload=128 usemsi=0 dmasize=32M himem=(null) himemaddr=(null) DMA Memory (kernel): 33554432 bytes, 0 used, 33554432 free, local mmap No devices found $ docker rm -f syncd syncd $ sudo /usr/bin/syncd.sh start Cannot get Broadcom Chip Id. Skip set SYNCD_SHM_SIZE. Creating new syncd container with HWSKU Force10-S6000 a4862129a7fea04f00ed71a88715eac65a41cdae51c3158f9cdd7de3ccc3dd31 $ docker inspect syncd | grep -i shm "ShmSize": 67108864, "Tag": "fix_8.1_shm_issue.67873427-9f7ca60a0e", On Normal device $ docker inspect syncd | grep -i shm "ShmSize": 268435456, "Tag": "fix_8.1_shm_issue.67873427-9f7ca60a0e" change the config syncd_shm.ini to b85=128m $ docker rm -f syncd syncd $ sudo /usr/bin/syncd.sh start Creating new syncd container with HWSKU Force10-S6000 3209ffc1e5a7224b99640eb9a286c4c7aa66a2e6a322be32fb7fe2113bb9524c $ docker inspect syncd | grep -i shm "ShmSize": 134217728, "Tag": "fix_8.1_shm_issue.67873427-9f7ca60a0e", change the config under /usr/share/sonic/device/x86_64-dell_s6000_s1220-r0/Force10-S6000/platform_env.conf and run command $ cat /usr/share/sonic/device/x86_64-dell_s6000_s1220-r0/platform_env.conf SYNCD_SHM_SIZE=300m $ sudo /usr/bin/syncd.sh start Creating new syncd container with HWSKU Force10-S6000 897f6fcde1f669ad2caab7da4326079abd7e811bf73f018c6dacc24cf24bfda5 $ docker inspect syncd | grep -i shm "ShmSize": 314572800, "Tag": "fix_8.1_shm_issue.67873427-9f7ca60a0e", Signed-off-by: richardyu-ms --- .../platform_env.conf | 2 +- .../platform_env.conf | 2 +- .../platform_env.conf | 2 +- .../platform_env.conf | 2 +- .../x86_64-broadcom_common/syncd_shm.ini | 14 +++++++++++ files/build_templates/docker_image_ctl.j2 | 23 +++++++++++++++++++ 6 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 device/broadcom/x86_64-broadcom_common/syncd_shm.ini diff --git a/device/arista/x86_64-arista_7050dx4_32s/platform_env.conf b/device/arista/x86_64-arista_7050dx4_32s/platform_env.conf index d72ffde2f262..dd7cf4fe01c5 100644 --- a/device/arista/x86_64-arista_7050dx4_32s/platform_env.conf +++ b/device/arista/x86_64-arista_7050dx4_32s/platform_env.conf @@ -1,2 +1,2 @@ -SYNCD_SHM_SIZE=256m +SYNCD_SHM_SIZE=512m is_ltsw_chip=1 diff --git a/device/arista/x86_64-arista_7050px4_32s/platform_env.conf b/device/arista/x86_64-arista_7050px4_32s/platform_env.conf index d72ffde2f262..dd7cf4fe01c5 100644 --- a/device/arista/x86_64-arista_7050px4_32s/platform_env.conf +++ b/device/arista/x86_64-arista_7050px4_32s/platform_env.conf @@ -1,2 +1,2 @@ -SYNCD_SHM_SIZE=256m +SYNCD_SHM_SIZE=512m is_ltsw_chip=1 diff --git a/device/arista/x86_64-arista_7060dx5_64s/platform_env.conf b/device/arista/x86_64-arista_7060dx5_64s/platform_env.conf index 77174634dce9..dd7cf4fe01c5 100644 --- a/device/arista/x86_64-arista_7060dx5_64s/platform_env.conf +++ b/device/arista/x86_64-arista_7060dx5_64s/platform_env.conf @@ -1,2 +1,2 @@ -SYNCD_SHM_SIZE=128m +SYNCD_SHM_SIZE=512m is_ltsw_chip=1 diff --git a/device/arista/x86_64-arista_7060px5_64s/platform_env.conf b/device/arista/x86_64-arista_7060px5_64s/platform_env.conf index 77174634dce9..dd7cf4fe01c5 100644 --- a/device/arista/x86_64-arista_7060px5_64s/platform_env.conf +++ b/device/arista/x86_64-arista_7060px5_64s/platform_env.conf @@ -1,2 +1,2 @@ -SYNCD_SHM_SIZE=128m +SYNCD_SHM_SIZE=512m is_ltsw_chip=1 diff --git a/device/broadcom/x86_64-broadcom_common/syncd_shm.ini b/device/broadcom/x86_64-broadcom_common/syncd_shm.ini new file mode 100644 index 000000000000..07a68ca0f3ea --- /dev/null +++ b/device/broadcom/x86_64-broadcom_common/syncd_shm.ini @@ -0,0 +1,14 @@ +# This file contains the default memory size for each ASICs in broadcom platform +# Format: ASIC_ID=Memory_size +#b77->td3 +b77=256m +#b85->td2 +b85=256m +#b87->td3 +b87=512m +#b96->th +b96=256m +#b97->th2 +b97=256m +#b98->th3 +b98=300m diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 6ba11ce65082..3017565e3027 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -315,6 +315,29 @@ start() { source $PLATFORM_ENV_CONF fi + {%- if sonic_asic_platform == "broadcom" %} + {%- if docker_container_name == "syncd" %} + # Set the SYNCD_SHM_SIZE if this variable not defined + BRCM_PLATFORM_COMMON_DIR=/usr/share/sonic/device/x86_64-broadcom_common + SYNCD_SHM_INI=$BRCM_PLATFORM_COMMON_DIR/syncd_shm.ini + + readline=$(grep '0x14e4' /proc/linux-kernel-bde) + bcm_chip_id=${readline#*0x14e4:0x} + bcm_chip_id=${bcm_chip_id::3} + + if [ -z "$SYNCD_SHM_SIZE" ]; then + if [ -z "$bcm_chip_id" ]; then + echo "Cannot get Broadcom Chip Id. Skip set SYNCD_SHM_SIZE." + elif [ -f "$SYNCD_SHM_INI" ] && [ "$(grep -m1 "^${bcm_chip_id}=" $SYNCD_SHM_INI)" ]; then + SYNCD_SHM_SIZE=`grep -m1 "^${bcm_chip_id}=" $SYNCD_SHM_INI | awk -F= '{print $2}'` + else + echo "Cannot get SYNCD_SHM_SIZE for chip: [${bcm_chip_id}] in $SYNCD_SHM_INI. Skip set SYNCD_SHM_SIZE." + fi + + fi + {%- endif %} + {%- endif %} + {%- if docker_container_name == "gbsyncd" %} GBSYNCD_CONF=/usr/share/sonic/device/$PLATFORM/gbsyncd.ini GBSYNCD_PLATFORM=gbsyncd-vs From 6ba1a2e411c4e92b17a42cfaf57ca5d286802a00 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Tue, 31 Jan 2023 18:35:17 +0800 Subject: [PATCH 073/113] Fix sonic-slave-* build errors about sudo command not found (#13412) issue #13395 Fix a bug about sudo failure. /usr/local/share/buildinfo/scripts/buildinfo_base.sh: line 24: sudo: command not found Fix an issue about warning message. ./scripts/run_with_retry: line 4: [: : integer expression expected --- scripts/run_with_retry | 4 +++- src/sonic-build-hooks/scripts/buildinfo_base.sh | 17 +++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/run_with_retry b/scripts/run_with_retry index 9e709bbf1bda..0c5696633bd4 100755 --- a/scripts/run_with_retry +++ b/scripts/run_with_retry @@ -1,7 +1,9 @@ #!/bin/bash run_with_retry(){ - [ "$SONIC_BUILD_RETRY_COUNT" -gt 0 ] || SONIC_BUILD_RETRY_COUNT=0 + # set default value and change invalid param input to 0 + (( SONIC_BUILD_RETRY_COUNT > 0 )) || SONIC_BUILD_RETRY_COUNT=0 + (( SONIC_BUILD_RETRY_INTERVAL > 0 )) || SONIC_BUILD_RETRY_INTERVAL=600 [[ "$*" == "" ]] && { echo "run_with_retry: input command can't be empty." 1>&2;exit 1; } for ((i=0; i<=$SONIC_BUILD_RETRY_COUNT; i++)) do diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index b42e37bf62b8..1e334a4a62da 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -15,26 +15,27 @@ REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/' DPKG_INSTALLTION_LOCK_FILE=/tmp/.dpkg_installation.lock . $BUILDINFO_PATH/config/buildinfo.config + +if [ "$(whoami)" != "root" ] && [ -n "$(which sudo)" ];then + SUDO=sudo +else + SUDO='' +fi + if [ -e /vcache ]; then PKG_CACHE_PATH=/vcache/${IMAGENAME} else PKG_CACHE_PATH=/sonic/target/vcache/${IMAGENAME} fi PKG_CACHE_FILE_NAME=${PKG_CACHE_PATH}/cache.tgz -sudo chown $USER $(dirname $PKG_CACHE_PATH) -mkdir -p ${PKG_CACHE_PATH} +$SUDO mkdir -p ${PKG_CACHE_PATH} +$SUDO chown $USER $PKG_CACHE_PATH . ${BUILDINFO_PATH}/scripts/utils.sh URL_PREFIX=$(echo "${PACKAGE_URL_PREFIX}" | sed -E "s#(//[^/]*/).*#\1#") -if [ "$(whoami)" != "root" ] && [ -n "$(which sudo)" ];then - SUDO=sudo -else - SUDO='' -fi - log_err() { echo "$(date "+%F-%H-%M-%S") ERR $1" >> $LOG_PATH/error.log From 874ecab730ea8c299a3f5fb9daf5a9544a3ac0fb Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:14:09 +0200 Subject: [PATCH 074/113] [submodule] Advance sonic-snmpagent pointer (#13557) Update sonic-snmpagent submodule pointer to include the following: * 4f55473 Use github code scanning instead of LGTM ([#274](https://github.com/sonic-net/sonic-snmpagent/pull/274)) Signed-off-by: dprital --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index bf6cd4cc3415..4f55473f4af1 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit bf6cd4cc3415eae42addfa542bbcdae1017416bc +Subproject commit 4f55473f4af1115d86feb1a9ed3ab48dee75d8f8 From 271f5fb2e54670b87fb15face4665539ed6b9778 Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:15:13 +0200 Subject: [PATCH 075/113] [submodule] Advance sonic-py-swsssdk pointer (#13554) Update sonic-py-swsssdk submodule pointer to include the following: * c7411ff [azp] Support Semgrep ([#132](https://github.com/sonic-net/sonic-py-swsssdk/pull/132)) * 6a281c8 Use github code scanning instead of LGTM ([#131](https://github.com/sonic-net/sonic-py-swsssdk/pull/131)) * 0d73e48 Use github code scanning instead of ([#GT](https://github.com/sonic-net/sonic-py-swsssdk/pull/GT)) Signed-off-by: dprital --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index d3584fcec306..c7411ff52f03 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit d3584fcec306a7b56d2c4ee02f7527c1044f298c +Subproject commit c7411ff52f03854b93bb798016e1334c281c4fd0 From a23799cf2a33c824358518cee735e7e9cdd4ec74 Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:15:55 +0200 Subject: [PATCH 076/113] [submodule] Advance sonic-platform-common pointer (#13553) Update sonic-platform-common submodule pointer to include the following: * 01ef800 Add missing sys imports ([#343](https://github.com/sonic-net/sonic-platform-common/pull/343)) Signed-off-by: dprital --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 38a7a65bd5c6..01ef800ca959 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 38a7a65bd5c64662a5d7c9aa4bdcf9920a0c5765 +Subproject commit 01ef800ca9590349e2c9299bcdd339831aa0a79d From 4c3aafcb4d0055926ed48cd8d6408e4cd636de27 Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:16:58 +0200 Subject: [PATCH 077/113] [submodule] Advance sonic-swss pointer (#13551) Update sonic-swss submodule pointer to include the following: * a2a483d [acl] Add new ACL key BTH_OPCODE and AETH_SYNDROME ([#2617](https://github.com/sonic-net/sonic-swss/pull/2617)) * 9d1f66b [bfdorch] add local discriminator to state DB ([#2629](https://github.com/sonic-net/sonic-swss/pull/2629)) * c54b3d1 Vxlan tunnel endpoint custom monitoring APPL DB table. ([#2589](https://github.com/sonic-net/sonic-swss/pull/2589)) * 7f03db2 Fix potential risks ([#2516](https://github.com/sonic-net/sonic-swss/pull/2516)) * 383ee68 [refactor]Refactoring sai handle status ([#2621](https://github.com/sonic-net/sonic-swss/pull/2621)) * cd95972 Fix issue 13341 ARP entry can be out of sync between kernel and APPL_DB if multiple updates are received from RTNL ([#2619](https://github.com/sonic-net/sonic-swss/pull/2619)) * a01470f Remove TODO comments that are no longer relevant ([#2622](https://github.com/sonic-net/sonic-swss/pull/2622)) * d058390 Changed the BFD default detect multiplier to 10x ([#2614](https://github.com/sonic-net/sonic-swss/pull/2614)) * d78b528 [MuxOrch] Enabling neighbor when adding in active state ([#2601](https://github.com/sonic-net/sonic-swss/pull/2601)) * 4ebdad1 [routesync] Fix for stale dynamic neighbor ([#2553](https://github.com/sonic-net/sonic-swss/pull/2553)) * 8857f92 Added new attributes for Vnet and Vxlan ecmp configurations. ([#2584](https://github.com/sonic-net/sonic-swss/pull/2584)) * b6bbc3e Revert [voq][chassis]Add show fabric counters port/queue commands (2522) ([#2611](https://github.com/sonic-net/sonic-swss/pull/2611)) * 52406e2 Add missing parameter to on_switch_shutdown_request method. ([#2567](https://github.com/sonic-net/sonic-swss/pull/2567)) * 4ac9ad9 Increase diff coverage to 80% ([#2599](https://github.com/sonic-net/sonic-swss/pull/2599)) * 8a0bb36 Handle Mac address 'none' ([#2593](https://github.com/sonic-net/sonic-swss/pull/2593)) * f496ab3 [vstest] Only collect stdout of orchagent_restart_check in vstest ([#2597](https://github.com/sonic-net/sonic-swss/pull/2597)) * 1dab495 Avoid aborting orchagent when setting TUNNEL attributes ([#2591](https://github.com/sonic-net/sonic-swss/pull/2591)) * 4395cea Fix neighbor doesn't update all attribute ([#2577](https://github.com/sonic-net/sonic-swss/pull/2577)) Signed-off-by: dprital --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index bdedf694f10b..a2a483d3cb67 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit bdedf694f10b6f8b5ea71fb30eef5d0c3b354409 +Subproject commit a2a483d3cb67a4093bf9550bca0904d96e3791d7 From 410ec8e3957e73d1d8a8f7c58f4c90f51463d742 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Wed, 1 Feb 2023 19:19:04 +0200 Subject: [PATCH 078/113] [swss-common] update submodule (#13579) [swss-common] update submodule (#13579) ``` 6b6842a [NotificationProducer] add pipeline support (#708) 2cb5ea0 Increase the netlink buffer size from 3MB to 16MB. (#739) dacbdad RedisPipeline ignore flush when call dtor from another thread. (#736) ``` --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index a4987b931b24..6b6842a96905 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit a4987b931b246c141dff91fa2f0e971dbc41820e +Subproject commit 6b6842a9690507d300a5beb4c0baff47094c94a5 From 85b978a1ca1a202a031e9be0e5870dc5b294e8c2 Mon Sep 17 00:00:00 2001 From: wenyiz2021 <91497961+wenyiz2021@users.noreply.github.com> Date: Wed, 1 Feb 2023 09:53:22 -0800 Subject: [PATCH 079/113] [Arista] [Platform] Update platform.json for psu led (#13523) Why I did it By specifying 'status_led' 'controllable' to false for psu section, it means the platform is not yet supporting psu status led How I did it specify 'status_led' 'controllable' to false for psu section How to verify it by running test in pdb, manually add {'status_led' : {'controllable' : False}} in dictionary this flag will be able to get False and skip testing: https://github.com/sonic-net/sonic-mgmt/blob/ce290c735d4bae93dfb11053a3ba8f055cb69c08/tests/platform_tests/api/test_psu.py#L337 --- .../x86_64-arista_7800_sup/platform.json | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/device/arista/x86_64-arista_7800_sup/platform.json b/device/arista/x86_64-arista_7800_sup/platform.json index 8dc0a4565258..0f9e91af98e8 100644 --- a/device/arista/x86_64-arista_7800_sup/platform.json +++ b/device/arista/x86_64-arista_7800_sup/platform.json @@ -7,6 +7,9 @@ "psus": [ { "name": "psu1", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu1/1", @@ -21,6 +24,9 @@ }, { "name": "psu2", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu2/1", @@ -35,6 +41,9 @@ }, { "name": "psu3", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu3/1", @@ -49,6 +58,9 @@ }, { "name": "psu4", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu4/1", @@ -63,6 +75,9 @@ }, { "name": "psu5", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu5/1", @@ -77,6 +92,9 @@ }, { "name": "psu6", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu6/1", @@ -91,6 +109,9 @@ }, { "name": "psu7", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu7/1", @@ -105,6 +126,9 @@ }, { "name": "psu8", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu8/1", @@ -119,6 +143,9 @@ }, { "name": "psu9", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu9/1", @@ -133,6 +160,9 @@ }, { "name": "psu10", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu10/1", @@ -147,6 +177,9 @@ }, { "name": "psu11", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu11/1", @@ -161,6 +194,9 @@ }, { "name": "psu12", + "status_led": { + "controllable": false + }, "fans": [ { "name": "psu12/1", From 26af468a99e91a550950d0968038cf7a02298b8b Mon Sep 17 00:00:00 2001 From: anamehra <54692434+anamehra@users.noreply.github.com> Date: Wed, 1 Feb 2023 12:53:45 -0800 Subject: [PATCH 080/113] Add support for platform topology configuration service (#12066) * Add support for platform topology configuration service This service invokes the platform plugin for platform specific topology configuration. The path for platform plugin script is: /usr/share/sonic/device/$PLATFORM/plugins/config-topology.sh If the platform plugin is not available, this service does nothing. Signed-off-by: anamehra --- files/build_templates/config-setup.service.j2 | 2 ++ .../build_templates/sonic_debian_extension.j2 | 5 +++ .../config-topology/config-topology.service | 18 ++++++++++ .../config-topology/config-topology.sh | 34 +++++++++++++++++++ .../systemd-sonic-generator.c | 18 +++++++++- 5 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 files/image_config/config-topology/config-topology.service create mode 100755 files/image_config/config-topology/config-topology.sh diff --git a/files/build_templates/config-setup.service.j2 b/files/build_templates/config-setup.service.j2 index a4b614a5f7fb..02f941d7e485 100644 --- a/files/build_templates/config-setup.service.j2 +++ b/files/build_templates/config-setup.service.j2 @@ -2,6 +2,8 @@ Description=Config initialization and migration service After=rc-local.service After=database.service +After=config-topology.service +Requires=config-topology.service Requires=database.service {% if sonic_asic_platform == 'mellanox' -%} Requires=hw-management.service diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index b2b5f5035cab..8edf79553d7e 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -566,6 +566,11 @@ echo "topology.service" | sudo tee -a $GENERATED_SERVICE_FILE sudo cp $IMAGE_CONFIGS/topology/topology.sh $FILESYSTEM_ROOT/usr/bin {%- endif %} +# Copy platform topology configuration scripts +sudo cp $IMAGE_CONFIGS/config-topology/config-topology.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM +echo "config-topology.service" | sudo tee -a $GENERATED_SERVICE_FILE +sudo cp $IMAGE_CONFIGS/config-topology/config-topology.sh $FILESYSTEM_ROOT/usr/bin + # Copy updategraph script and service file j2 files/build_templates/updategraph.service.j2 | sudo tee $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/updategraph.service sudo cp $IMAGE_CONFIGS/updategraph/updategraph $FILESYSTEM_ROOT/usr/bin/ diff --git a/files/image_config/config-topology/config-topology.service b/files/image_config/config-topology/config-topology.service new file mode 100644 index 000000000000..25c70385a188 --- /dev/null +++ b/files/image_config/config-topology/config-topology.service @@ -0,0 +1,18 @@ +[Unit] +Description=Platform topology configuration service +After=database.service +After=database-chassis.service +Requires=database.service +Requires=database-chassis.service +Before=config-setup.service + +[Service] +Type=oneshot +User=root +RemainAfterExit=yes +ExecStart=/usr/bin/config-topology.sh start +ExecStop=/usr/bin/config-topology.sh stop + +[Install] +WantedBy=multi-user.target + diff --git a/files/image_config/config-topology/config-topology.sh b/files/image_config/config-topology/config-topology.sh new file mode 100755 index 000000000000..9ba06cb87a78 --- /dev/null +++ b/files/image_config/config-topology/config-topology.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# This script is invoked by config-topology.service. +# This script invokes platform plugin script if present +# which could be used for platform specific topology configuration +# +start() { + PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` + #Path to platform topology script + TOPOLOGY_SCRIPT="/usr/share/sonic/device/$PLATFORM/plugins/config-topology.sh" + #if topology script file not present, do nothing and return 0 + [ ! -f $TOPOLOGY_SCRIPT ] && exit 0 + $TOPOLOGY_SCRIPT start +} + +stop() { + PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` + #Path to platform topology script + TOPOLOGY_SCRIPT="/usr/share/sonic/device/$PLATFORM/plugins/config-topology.sh" + #if topology script file not present, do nothing and return 0 + [ ! -f $TOPOLOGY_SCRIPT ] && exit 0 + $TOPOLOGY_SCRIPT stop +} + +# read SONiC immutable variables +[ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment + +case "$1" in + start|stop) + $1 + ;; + *) + echo "Usage: $0 {start|stop}" + ;; +esac diff --git a/src/systemd-sonic-generator/systemd-sonic-generator.c b/src/systemd-sonic-generator/systemd-sonic-generator.c index 9267a48aa4a6..273fd5452b74 100644 --- a/src/systemd-sonic-generator/systemd-sonic-generator.c +++ b/src/systemd-sonic-generator/systemd-sonic-generator.c @@ -104,7 +104,23 @@ static int get_target_lines(char* unit_file, char* target_lines[]) { static bool is_multi_instance_service(char *service_name){ int i; for(i=0; i < num_multi_inst; i++){ - if (strstr(service_name, multi_instance_services[i]) != NULL) { + /* + * The service name may contain @.service or .service. Remove these + * postfixes and extract service name. Compare service name for absolute + * match in multi_instance_services[]. + * This is to prevent services like database-chassis and systemd-timesyncd marked + * as multi instance services as they contain strings 'database' and 'syncd' respectively + * which are multi instance services in multi_instance_services[]. + */ + char *saveptr; + char *token = strtok_r(service_name, "@", &saveptr); + if (token) { + if (strstr(token, ".service") != NULL) { + /* If we are here, service_name did not have '@' delimiter but contains '.service' */ + token = strtok_r(service_name, ".", &saveptr); + } + } + if (strncmp(service_name, multi_instance_services[i], strlen(service_name)) == 0) { return true; } } From 876b96e5e800baeb0424fb1cc3f33319fea8e4b0 Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Thu, 2 Feb 2023 15:38:17 +0800 Subject: [PATCH 081/113] [gearbox] use credo sai v0.8.2 (#13565) Update credo sai package to the latest v0.8.2, which also has the fix for aristanetworks/sonic#52. --- platform/components/docker-gbsyncd-credo.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/components/docker-gbsyncd-credo.mk b/platform/components/docker-gbsyncd-credo.mk index 6f5c69b506e6..34f7101759eb 100644 --- a/platform/components/docker-gbsyncd-credo.mk +++ b/platform/components/docker-gbsyncd-credo.mk @@ -1,9 +1,9 @@ DOCKER_GBSYNCD_PLATFORM_CODE = credo -LIBSAI_CREDO = libsaicredo_0.7.5_amd64.deb -$(LIBSAI_CREDO)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo_0.7.5_amd64.deb?sv=2020-10-02&st=2022-04-14T02%3A21%3A31Z&se=2100-04-15T02%3A21%3A00Z&sr=b&sp=r&sig=iDv9Fprntpw9iVBFYVjW8iygy4qcSWT8O90nAXdXR0A%3D" -LIBSAI_CREDO_OWL = libsaicredo-owl_0.7.5_amd64.deb -$(LIBSAI_CREDO_OWL)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo-owl_0.7.5_amd64.deb?sv=2020-10-02&st=2022-04-14T02%3A23%3A22Z&se=2100-04-15T02%3A23%3A00Z&sr=b&sp=r&sig=58z6E2nPcLIGjqAoxRAo7du%2FzjIBZkFdoXfSzw96Kxc%3D" +LIBSAI_CREDO = libsaicredo_0.8.2_amd64.deb +$(LIBSAI_CREDO)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo_0.8.2_amd64.deb?sv=2021-04-10&st=2023-01-31T04%3A24%3A23Z&se=2100-01-31T04%3A24%3A00Z&sr=b&sp=r&sig=RZPbmaIetvDRtwifrVT4s%2FaQxB%2FBTOyCqXtMtoNRjmY%3D" +LIBSAI_CREDO_OWL = libsaicredo-owl_0.8.2_amd64.deb +$(LIBSAI_CREDO_OWL)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo-owl_0.8.2_amd64.deb?sv=2021-04-10&st=2023-01-31T04%3A25%3A43Z&se=2100-01-31T04%3A25%3A00Z&sr=b&sp=r&sig=%2BdSFujwy0gY%2FiH50Ffi%2FsqZOAHBOFPUcBdR06fHEZkI%3D" ifneq ($($(LIBSAI_CREDO)_URL),) include $(PLATFORM_PATH)/../template/docker-gbsyncd-base.mk From 225bba0cb6b235ec72092cbe11d0e5dbcf8d1a5d Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:27:18 +0200 Subject: [PATCH 082/113] [submodule] Advance sonic-utilities pointer (#13555) Update sonic-utilities submodule pointer to include the following: * 75d233f [system-health] Fix issue: show system-health CLI crashes ([#2635](https://github.com/sonic-net/sonic-utilities/pull/2635)) * 5782da4 Fixed admin state config CLI for Backport interfaces ([#2557](https://github.com/sonic-net/sonic-utilities/pull/2557)) * c4c6808 suppport multi asic for show queue counter ([#2439](https://github.com/sonic-net/sonic-utilities/pull/2439)) * 1b21201 [show_bfd] add local discriminator in show bfd command ([#2625](https://github.com/sonic-net/sonic-utilities/pull/2625)) Signed-off-by: dprital --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 0d5e68f5a1c6..75d233fef15f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 0d5e68f5a1c6519d22a518f741af0ba59bbc29b3 +Subproject commit 75d233fef15f36744785b6e1a7aa0f277c339603 From ee1c32a802d4fab9da0e22a8b803831cdee6f45e Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Thu, 2 Feb 2023 09:07:33 -0800 Subject: [PATCH 083/113] Use tmpfs for /var/log for Arista 7260 (#13587) This is to reduce writes to disk, which then can use the SSD to get worn out faster. Signed-off-by: Saikrishna Arcot --- files/Aboot/boot0.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 3bb5840e0b13..9f729157d991 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -502,6 +502,7 @@ write_platform_specific_cmdline() { if [ "$sid" = "Gardena" ] || [ "$sid" = "GardenaE" ]; then aboot_machine=arista_7260cx3_64 flash_size=28000 + cmdline_add logs_inram=on fi if [ "$sid" = "Alhambra" ]; then aboot_machine=arista_7170_64c From 9d19ac92a37e297ecd30bc4ef24cfe824ff5ccae Mon Sep 17 00:00:00 2001 From: kenneth-arista <93353051+kenneth-arista@users.noreply.github.com> Date: Thu, 2 Feb 2023 10:19:30 -0800 Subject: [PATCH 084/113] [yang-models] Add YANG model for SYSTEM_PORT (#12689) Add YANG model for SYSTEM_PORT. Resolves https://github.com/sonic-net/sonic-buildimage/issues/12458 #### Why I did it YANG model for SYSTEM_PORT in CONFIG_DB was missing. #### How I did it Added new YANG model and associated unit tests. #### How to verify it Passing unit tests --- .../tests/sample-voq-graph.xml | 16 ++-- src/sonic-config-engine/tests/test_cfggen.py | 16 ++-- src/sonic-yang-models/doc/Configuration.md | 44 +++++++++ src/sonic-yang-models/setup.py | 2 + .../tests/files/sample_config_db.json | 74 +++++++++++++++ .../yang_model_tests/tests/system_port.json | 9 ++ .../tests_config/system_port.json | 91 ++++++++++++++++++ .../yang-models/sonic-system-port.yang | 95 +++++++++++++++++++ 8 files changed, 331 insertions(+), 16 deletions(-) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/system_port.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/system_port.json create mode 100644 src/sonic-yang-models/yang-models/sonic-system-port.yang diff --git a/src/sonic-config-engine/tests/sample-voq-graph.xml b/src/sonic-config-engine/tests/sample-voq-graph.xml index b152d74df8a8..b6e8ff1521a0 100644 --- a/src/sonic-config-engine/tests/sample-voq-graph.xml +++ b/src/sonic-config-engine/tests/sample-voq-graph.xml @@ -619,7 +619,7 @@ 8 - Ethernet1/1 + Ethernet0 linecard-1 Asic0 40000 @@ -630,7 +630,7 @@ 8 - Ethernet1/2 + Ethernet4 linecard-1 Asic0 40000 @@ -641,7 +641,7 @@ 8 - Ethernet1/3 + Ethernet8 linecard-1 Asic0 40000 @@ -652,7 +652,7 @@ 8 - Ethernet1/4 + Ethernet12 linecard-1 Asic0 40000 @@ -675,7 +675,7 @@ 8 - Ethernet1/5 + Ethernet0 linecard-2 Asic0 40000 @@ -686,7 +686,7 @@ 8 - Ethernet1/6 + Ethernet4 linecard-2 Asic0 40000 @@ -709,7 +709,7 @@ 8 - Ethernet1/7 + Ethernet8 linecard-2 Asic1 40000 @@ -720,7 +720,7 @@ 8 - Ethernet1/8 + Ethernet12 linecard-2 Asic1 40000 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index d1d5b898b4ff..f1704250539a 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -889,16 +889,16 @@ def test_minigraph_voq_system_ports(self): json.loads(self.run_script(argument)), { "linecard-1|Asic0|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "0", "speed": "1000", "core_index": "0", "system_port_id": "1" }, - "linecard-1|Asic0|Ethernet1/1": { "core_port_index": "1", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "2" }, - "linecard-1|Asic0|Ethernet1/2": { "core_port_index": "2", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "3" }, - "linecard-1|Asic0|Ethernet1/3": { "core_port_index": "3", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "4" }, - "linecard-1|Asic0|Ethernet1/4": { "core_port_index": "4", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "5" }, + "linecard-1|Asic0|Ethernet0": { "core_port_index": "1", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "2" }, + "linecard-1|Asic0|Ethernet4": { "core_port_index": "2", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "3" }, + "linecard-1|Asic0|Ethernet8": { "core_port_index": "3", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "4" }, + "linecard-1|Asic0|Ethernet12": { "core_port_index": "4", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "5" }, "linecard-2|Asic0|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "2", "speed": "1000", "core_index": "0", "system_port_id": "256" }, - "linecard-2|Asic0|Ethernet1/5": { "core_port_index": "1", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "0", "system_port_id": "257" }, - "linecard-2|Asic0|Ethernet1/6": { "core_port_index": "2", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "1", "system_port_id": "258" }, + "linecard-2|Asic0|Ethernet0": { "core_port_index": "1", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "0", "system_port_id": "257" }, + "linecard-2|Asic0|Ethernet4": { "core_port_index": "2", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "1", "system_port_id": "258" }, "linecard-2|Asic1|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "4", "speed": "1000", "core_index": "0", "system_port_id": "259" }, - "linecard-2|Asic1|Ethernet1/7": { "core_port_index": "1", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "0", "system_port_id": "260" }, - "linecard-2|Asic1|Ethernet1/8": { "core_port_index": "2", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "1", "system_port_id": "261" } + "linecard-2|Asic1|Ethernet8": { "core_port_index": "1", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "0", "system_port_id": "260" }, + "linecard-2|Asic1|Ethernet12": { "core_port_index": "2", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "1", "system_port_id": "261" } } ) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 0cc8ac654558..d2227adb2784 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -50,6 +50,7 @@ Table of Contents * [Syslog Rate Limit](#syslog-rate-limit) * [Sflow](#sflow) * [Restapi](#restapi) + * [System Port](#system-port) * [Tacplus Server](#tacplus-server) * [TC to Priority group map](#tc-to-priority-group-map) * [TC to Queue map](#tc-to-queue-map) @@ -1528,6 +1529,49 @@ Container side configuration: } ``` +### System Port +Every port on the system requires a global representation, known as a System Port, +and is listed in this table. + +``` +{ +"SYSTEM_PORT": { + "host227-4|asic0|Ethernet0": { + "core_index": "1", + "core_port_index": "1", + "num_voq": "8", + "speed": "100000", + "switch_id": "0", + "system_port_id": "1" + }, + "host227-4|asic0|Ethernet4": { + "core_index": "1", + "core_port_index": "2", + "num_voq": "8", + "speed": "100000", + "switch_id": "0", + "system_port_id": "2" + }, + "host227-5|asic0|Ethernet0": { + "core_index": "1", + "core_port_index": "1", + "num_voq": "8", + "speed": "100000", + "switch_id": "4", + "system_port_id": "80" + }, + "host227-5|asic0|Ethernet4": { + "core_index": "1", + "core_port_index": "2", + "num_voq": "8", + "speed": "100000", + "switch_id": "4", + "system_port_id": "81" + } + } +} +``` + ### Tacplus Server ``` diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 783dfb8be1a1..69b27bc90f53 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -175,6 +175,7 @@ def run(self): './yang-models/sonic-logger.yang', './yang-models/sonic-port-qos-map.yang', './yang-models/sonic-static-route.yang', + './yang-models/sonic-system-port.yang', './yang-models/sonic-macsec.yang']), ('cvlyang-models', ['./cvlyang-models/sonic-acl.yang', './cvlyang-models/sonic-bgp-common.yang', @@ -241,6 +242,7 @@ def run(self): './cvlyang-models/sonic-logger.yang', './cvlyang-models/sonic-port-qos-map.yang', './cvlyang-models/sonic-static-route.yang', + './cvlyang-models/sonic-system-port.yang', './cvlyang-models/sonic-macsec.yang']), ], zip_safe=False, diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index dffe59f522d9..57a95d867ce0 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1350,6 +1350,80 @@ "login": "local" } }, + "SYSTEM_PORT": { + "host227-4|asic0|Cpu0": { + "core_index": "0", + "core_port_index": "0", + "num_voq": "8", + "speed": "10000", + "switch_id": "0", + "system_port_id": "1" + }, + "host227-4|asic0|Ethernet0": { + "core_index": "1", + "core_port_index": "1", + "num_voq": "8", + "speed": "100000", + "switch_id": "0", + "system_port_id": "2" + }, + "host227-4|asic0|Ethernet4": { + "core_index": "1", + "core_port_index": "2", + "num_voq": "8", + "speed": "100000", + "switch_id": "0", + "system_port_id": "3" + }, + "host227-4|asic1|Cpu0": { + "core_index": "0", + "core_port_index": "0", + "num_voq": "8", + "speed": "10000", + "switch_id": "0", + "system_port_id": "41" + }, + "host227-4|asic1|Ethernet8": { + "core_index": "0", + "core_port_index": "1", + "num_voq": "8", + "speed": "100000", + "switch_id": "2", + "system_port_id": "42" + }, + "host227-4|asic1|Ethernet12": { + "core_index": "0", + "core_port_index": "2", + "num_voq": "8", + "speed": "100000", + "switch_id": "2", + "system_port_id": "43" + }, + "host227-5|asic0|Cpu0": { + "core_index": "0", + "core_port_index": "0", + "num_voq": "8", + "speed": "10000", + "switch_id": "0", + "system_port_id": "81" + }, + "host227-5|asic0|Ethernet0": { + "core_index": "1", + "core_port_index": "1", + "num_voq": "8", + "speed": "100000", + "switch_id": "4", + "system_port_id": "82" + }, + "host227-5|asic0|Ethernet4": { + "core_index": "1", + "core_port_index": "2", + "num_voq": "8", + "speed": "100000", + "switch_id": "4", + "system_port_id": "83" + } + }, "TACPLUS": { "global": { "auth_type": "pap", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/system_port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/system_port.json new file mode 100644 index 000000000000..727373ade25a --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/system_port.json @@ -0,0 +1,9 @@ +{ + "SYSTEM_PORT_POSITIVE_CONFIG": { + "desc": "Configure SYSTEM_PORT positive config." + }, + "SYSTEM_PORT_WRONG_SPEED_PATTERN": { + "desc": "Configure SYSTEM_PORT wrong speed.", + "eStr": ["pattern", "does not satisfy"] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/system_port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/system_port.json new file mode 100644 index 000000000000..28edae5727a1 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/system_port.json @@ -0,0 +1,91 @@ +{ + "SYSTEM_PORT_POSITIVE_CONFIG": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 100000 + }, + { + "admin_status": "up", + "alias": "eth4", + "description": "Ethernet4", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet4", + "speed": 100000 + } + ] + } + }, + "sonic-system-port:sonic-system-port": { + "sonic-system-port:SYSTEM_PORT": { + "SYSTEM_PORT_LIST": [ + { + "hostname": "host123", + "asic_name": "asic0", + "ifname": "Ethernet0", + "core_index": "0", + "core_port_index": "10", + "num_voq": "8", + "speed": "100000", + "switch_id": "0", + "system_port_id": "100" + }, + { + "hostname": "host123", + "asic_name": "asic1", + "ifname": "Ethernet4", + "core_index": "1", + "core_port_index": "20", + "num_voq": "8", + "speed": "100000", + "switch_id": "1", + "system_port_id": "200" + } + ] + } + } + }, + "SYSTEM_PORT_WRONG_SPEED_PATTERN": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 100000 + } + ] + } + }, + "sonic-system-port:sonic-system-port": { + "sonic-system-port:SYSTEM_PORT": { + "SYSTEM_PORT_LIST": [ + { + "hostname": "host456", + "asic_name": "asic0", + "ifname": "Ethernet0", + "core_index": "1", + "core_port_index": "20", + "num_voq": "8", + "speed": "900000", + "switch_id": "1", + "system_port_id": "200" + } + ] + } + } + } + +} diff --git a/src/sonic-yang-models/yang-models/sonic-system-port.yang b/src/sonic-yang-models/yang-models/sonic-system-port.yang new file mode 100644 index 000000000000..804b3313fc18 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-system-port.yang @@ -0,0 +1,95 @@ +module sonic-system-port { + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-system-port"; + prefix system-port; + + import sonic-port { + prefix port; + } + + import sonic-types { + prefix stypes; + } + + description "SYSTEM_PORT YANG Module for SONiC OS"; + + revision 2022-11-10 { + description "First Revision"; + } + + container sonic-system-port { + + container SYSTEM_PORT { + + description "SYSTEM_PORT table of config_db.json"; + + list SYSTEM_PORT_LIST { + + key "hostname asic_name ifname"; + + leaf hostname { + type stypes:hostname; + } + + leaf asic_name { + type string { + pattern "[Aa]sic[0-4]"; + } + } + + leaf ifname { + type union { + type leafref { + path /port:sonic-port/port:PORT/port:PORT_LIST/port:name; + } + type string { + pattern "Cpu0"; + } + } + } + + leaf core_index { + type uint8 { + range 0..7; + } + description "Hardware core index a port is affiliated with."; + } + + leaf core_port_index { + type uint16; + description "Local port index index to an ASIC core."; + } + + leaf num_voq { + type uint8 { + range 1..8; + } + description "Number of VoQs associated with a port."; + } + + leaf speed { + type uint32 { + range 1..800000; + } + description "Port speed in Mbps."; + } + + leaf switch_id { + type uint16; + description "On a VoQ switch, the global ASIC identifier."; + } + + leaf system_port_id { + type uint32; + description "On a VoQ switch, the global port identifier."; + } + } + /* end of list SYSTEM_PORT_LIST */ + } + /* end of container SYSTEM_PORT */ + } + /* end of container sonic-system-port */ +} +/* end of module sonic-system-port */ From d22de8c4415a89802f494a843df1aa17fa998f05 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Thu, 2 Feb 2023 10:20:16 -0800 Subject: [PATCH 085/113] [submodule] Update sonic-sairedis submodule (#13594) Update sonic-sairedis submodule pointer to include the following: * 0434b62 [sai_failure_dump]Invoking dump during SAI failure ([#1198](https://github.com/Azure/sonic-sairedis/pull/1198)) Signed-off-by: dgsudharsan --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 402eb14a6dad..0434b6200982 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 402eb14a6dad7c747c84c08643f2edb8e348ab3f +Subproject commit 0434b620098200ee9024d0f4152b3fe7c2753de2 From 0abc4f0c4ab38e625ab99cdaf0084eaa837088ab Mon Sep 17 00:00:00 2001 From: FuzailBrcm <51665572+FuzailBrcm@users.noreply.github.com> Date: Fri, 3 Feb 2023 00:50:59 +0530 Subject: [PATCH 086/113] [pddd]: Adding support for I2CFPGA in PDDF (#13475) Why I did it Some of the platform vendors use FPGA in the HW design. This FPGA is connected to the CPU via I2C bus. Adding a common module and a driver to be used for such FPGA in PDDF. How I did it Added 'pddf_fpgai2c_module' and 'pddf_fpgai2c_driver' kernel modules which takes the platform dependent data from PDDF JSON files and creates an I2C client for the FPGA. How to verify it Any platform having such an FPGA and brought up using PDDF would use these kernel modules. The detail representation of such a device in PDDF JSON file is covered in the HLD. --- platform/pddf/i2c/debian/rules | 2 +- platform/pddf/i2c/modules/Makefile | 2 +- platform/pddf/i2c/modules/fpgai2c/Makefile | 4 + .../pddf/i2c/modules/fpgai2c/driver/Makefile | 5 + .../fpgai2c/driver/pddf_fpgai2c_driver.c | 228 ++++++++++++++++++ .../i2c/modules/fpgai2c/pddf_fpgai2c_module.c | 220 +++++++++++++++++ .../i2c/modules/include/pddf_client_defs.h | 1 + .../i2c/modules/include/pddf_fpgai2c_defs.h | 30 +++ 8 files changed, 490 insertions(+), 2 deletions(-) create mode 100644 platform/pddf/i2c/modules/fpgai2c/Makefile create mode 100644 platform/pddf/i2c/modules/fpgai2c/driver/Makefile create mode 100644 platform/pddf/i2c/modules/fpgai2c/driver/pddf_fpgai2c_driver.c create mode 100644 platform/pddf/i2c/modules/fpgai2c/pddf_fpgai2c_module.c create mode 100644 platform/pddf/i2c/modules/include/pddf_fpgai2c_defs.h diff --git a/platform/pddf/i2c/debian/rules b/platform/pddf/i2c/debian/rules index edca93ee06a8..3e0bb7c4ffc9 100755 --- a/platform/pddf/i2c/debian/rules +++ b/platform/pddf/i2c/debian/rules @@ -18,7 +18,7 @@ PACKAGE_PRE_NAME := sonic-platform-pddf KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= client cpld cpld/driver cpldmux cpldmux/driver fan fan/driver mux gpio led psu psu/driver sysstatus xcvr xcvr/driver +MODULE_DIRS:= client cpld cpld/driver cpldmux cpldmux/driver fpgai2c fpgai2c/driver fan fan/driver mux gpio led psu psu/driver sysstatus xcvr xcvr/driver MODULE_DIR:= modules UTILS_DIR := utils SERVICE_DIR := service diff --git a/platform/pddf/i2c/modules/Makefile b/platform/pddf/i2c/modules/Makefile index ebfce193c273..71c1db661367 100644 --- a/platform/pddf/i2c/modules/Makefile +++ b/platform/pddf/i2c/modules/Makefile @@ -1 +1 @@ -obj-m := client/ cpld/ cpldmux/ xcvr/ mux/ gpio/ psu/ fan/ led/ sysstatus/ +obj-m := client/ cpld/ cpldmux/ fpgai2c/ xcvr/ mux/ gpio/ psu/ fan/ led/ sysstatus/ diff --git a/platform/pddf/i2c/modules/fpgai2c/Makefile b/platform/pddf/i2c/modules/fpgai2c/Makefile new file mode 100644 index 000000000000..2fe22efb7cf4 --- /dev/null +++ b/platform/pddf/i2c/modules/fpgai2c/Makefile @@ -0,0 +1,4 @@ +obj-m := driver/ +obj-m += pddf_fpgai2c_module.o + +ccflags-y:= -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/fpgai2c/driver/Makefile b/platform/pddf/i2c/modules/fpgai2c/driver/Makefile new file mode 100644 index 000000000000..409bf0aa472b --- /dev/null +++ b/platform/pddf/i2c/modules/fpgai2c/driver/Makefile @@ -0,0 +1,5 @@ +TARGET = pddf_fpgai2c_driver + +obj-m := $(TARGET).o + +ccflags-y := -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/fpgai2c/driver/pddf_fpgai2c_driver.c b/platform/pddf/i2c/modules/fpgai2c/driver/pddf_fpgai2c_driver.c new file mode 100644 index 000000000000..b3092e5ee81d --- /dev/null +++ b/platform/pddf/i2c/modules/fpgai2c/driver/pddf_fpgai2c_driver.c @@ -0,0 +1,228 @@ +/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Description: + * A pddf kernel driver module for FPGA connected to the CPU by I2C bus + */ + +#include +#include +#include +#include +#include +#include "pddf_fpgai2c_defs.h" + +extern PDDF_FPGAI2C_DATA pddf_fpgai2c_data; + + +static LIST_HEAD(fpgai2c_client_list); +static struct mutex list_lock; + +struct fpgai2c_client_node { + struct i2c_client *client; + struct list_head list; +}; + +int board_i2c_fpga_read(unsigned short fpga_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct fpgai2c_client_node *fpga_node = NULL; + int ret = -EPERM; + + + mutex_lock(&list_lock); + + list_for_each(list_node, &fpgai2c_client_list) + { + fpga_node = list_entry(list_node, struct fpgai2c_client_node, list); + + if (fpga_node->client->addr == fpga_addr) { + ret = i2c_smbus_read_byte_data(fpga_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(board_i2c_fpga_read); + +int board_i2c_fpga_write(unsigned short fpga_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct fpgai2c_client_node *fpga_node = NULL; + int ret = -EIO; + + + mutex_lock(&list_lock); + + list_for_each(list_node, &fpgai2c_client_list) + { + fpga_node = list_entry(list_node, struct fpgai2c_client_node, list); + + if (fpga_node->client->addr == fpga_addr) { + ret = i2c_smbus_write_byte_data(fpga_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(board_i2c_fpga_write); + +ssize_t regval_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + int len = 0; + struct i2c_client *client = to_i2c_client(dev); + + mutex_lock(&pddf_fpgai2c_data.fpga_lock); + // Put code here to read the register value and print it + if (pddf_fpgai2c_data.reg_addr!=0) + len = sprintf(buf, "0x%2.2x\n", board_i2c_fpga_read(client->addr, pddf_fpgai2c_data.reg_addr)); + else + len = sprintf(buf, "xx\n"); + + mutex_unlock(&pddf_fpgai2c_data.fpga_lock); + return len; +} + +static DEVICE_ATTR_RO(regval); + +static struct attribute *fpgai2c_attrs[] = { + &dev_attr_regval.attr, + NULL, +}; + +static struct attribute_group fpgai2c_attribute_group = { + .attrs = fpgai2c_attrs, +}; + + + + +/* Addresses scanned for board_i2c_fpga + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static void board_i2c_fpga_add_client(struct i2c_client *client) +{ + struct fpgai2c_client_node *node = kzalloc(sizeof(struct fpgai2c_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate fpgai2c_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &fpgai2c_client_list); + mutex_unlock(&list_lock); +} + +static void board_i2c_fpga_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct fpgai2c_client_node *fpga_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &fpgai2c_client_list) + { + fpga_node = list_entry(list_node, struct fpgai2c_client_node, list); + + if (fpga_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(fpga_node); + } + + mutex_unlock(&list_lock); +} + +static int board_i2c_fpga_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &fpgai2c_attribute_group); + if (status) { + goto exit; + } + + dev_dbg(&client->dev, "chip found\n"); + board_i2c_fpga_add_client(client); + + return 0; + +exit: + return status; +} + +static int board_i2c_fpga_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &fpgai2c_attribute_group); + board_i2c_fpga_remove_client(client); + + return 0; +} + +static const struct i2c_device_id board_i2c_fpga_id[] = { + { "i2c_fpga", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, board_i2c_fpga_id); + +static struct i2c_driver board_i2c_fpga_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "i2c_fpga", + }, + .probe = board_i2c_fpga_probe, + .remove = board_i2c_fpga_remove, + .id_table = board_i2c_fpga_id, + .address_list = normal_i2c, +}; + +static int __init board_i2c_fpga_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&board_i2c_fpga_driver); +} + +static void __exit board_i2c_fpga_exit(void) +{ + i2c_del_driver(&board_i2c_fpga_driver); +} + +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("board_i2c_fpga driver"); +MODULE_LICENSE("GPL"); + +module_init(board_i2c_fpga_init); +module_exit(board_i2c_fpga_exit); diff --git a/platform/pddf/i2c/modules/fpgai2c/pddf_fpgai2c_module.c b/platform/pddf/i2c/modules/fpgai2c/pddf_fpgai2c_module.c new file mode 100644 index 000000000000..303f209dca4a --- /dev/null +++ b/platform/pddf/i2c/modules/fpgai2c/pddf_fpgai2c_module.c @@ -0,0 +1,220 @@ +/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Description: + * A pddf kernel module to create I2C client for an I2CFPGA + */ + +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pddf_client_defs.h" +#include "pddf_fpgai2c_defs.h" + +PDDF_FPGAI2C_DATA pddf_fpgai2c_data={0}; +EXPORT_SYMBOL(pddf_fpgai2c_data); + +static ssize_t do_device_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t store_pddf_fpgai2c_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t show_pddf_fpgai2c_data(struct device *dev, struct device_attribute *da, char *buf); + +extern void *get_device_table(char *name); +extern void delete_device_table(char *name); + + +/* MUX CLIENT DATA */ +PDDF_DATA_ATTR(dev_ops, S_IWUSR, NULL, do_device_operation, PDDF_CHAR, 8, NULL, (void*)&pddf_data); +PDDF_DATA_ATTR(reg_addr, S_IWUSR|S_IRUGO, show_pddf_fpgai2c_data, store_pddf_fpgai2c_data, PDDF_USHORT, sizeof(unsigned short), (void*)&pddf_fpgai2c_data.reg_addr, NULL); + + + +static struct attribute *fpgai2c_attributes[] = { + &attr_dev_ops.dev_attr.attr, + &attr_reg_addr.dev_attr.attr, + NULL +}; + +static const struct attribute_group pddf_fpgai2c_client_data_group = { + .attrs = fpgai2c_attributes, +}; + + +static ssize_t store_pddf_fpgai2c_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int ret = 0; + int num = 0; + PDDF_ATTR *ptr = (PDDF_ATTR *)da; + + ret = kstrtoint(buf,16,&num); + if (ret==0) + { + mutex_lock(&pddf_fpgai2c_data.fpga_lock); + *(unsigned short *)(ptr->addr) = (unsigned short)num; + mutex_unlock(&pddf_fpgai2c_data.fpga_lock); + pddf_dbg(FPGAI2C, KERN_ERR "Stored value: 0x%x, num: 0x%x\n", *(int*)(ptr->addr), num); + } + + return count; +} + +ssize_t show_pddf_fpgai2c_data(struct device *dev, struct device_attribute *da, char *buf) +{ + int ret = 0; + PDDF_ATTR *ptr = (PDDF_ATTR *)da; + pddf_dbg(FPGAI2C, KERN_ERR "[ READ ] DATA ATTR PTR TYPE:%d, ADDR=%p\n", ptr->type, ptr->addr); + + mutex_lock(&pddf_fpgai2c_data.fpga_lock); + ret = sprintf(buf, "0x%x\n", *(unsigned short *)(ptr->addr)); + mutex_unlock(&pddf_fpgai2c_data.fpga_lock); + + return ret; +} + +static ssize_t do_device_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + PDDF_ATTR *ptr = (PDDF_ATTR *)da; + NEW_DEV_ATTR *device_ptr = (NEW_DEV_ATTR *)(ptr->data); + struct i2c_adapter *adapter; + static struct i2c_board_info board_info; + struct i2c_client *client_ptr; + + if (strncmp(buf, "add", strlen(buf)-1)==0) + { + adapter = i2c_get_adapter(device_ptr->parent_bus); + + if (strncmp(device_ptr->dev_type, "i2c_fpga", strlen("i2c_fpga"))==0) + { + board_info = (struct i2c_board_info) { + .platform_data = (void *)NULL, + }; + + board_info.addr = device_ptr->dev_addr; + strcpy(board_info.type, device_ptr->dev_type); + + client_ptr = i2c_new_client_device(adapter, &board_info); + + if (!IS_ERR(client_ptr)) { + i2c_put_adapter(adapter); + pddf_dbg(FPGAI2C, KERN_ERR "Created %s client: 0x%p\n", device_ptr->i2c_name, (void *)client_ptr); + add_device_table(device_ptr->i2c_name, (void*)client_ptr); + } + else { + i2c_put_adapter(adapter); + goto free_data; + } + + } + else + { + printk(KERN_ERR "%s: Unsupported type of fpga device id - unable to add i2c client\n", __FUNCTION__); + } + } + else if (strncmp(buf, "delete", strlen(buf)-1)==0) + { + /*Get the i2c_client handle for the created client*/ + client_ptr = (struct i2c_client *)get_device_table(device_ptr->i2c_name); + if (client_ptr) + { + pddf_dbg(FPGAI2C, KERN_ERR "Removing %s client: 0x%p\n", device_ptr->i2c_name, (void *)client_ptr); + i2c_unregister_device(client_ptr); + delete_device_table(device_ptr->i2c_name); + } + else + { + printk(KERN_ERR "Unable to get the client handle for %s\n", device_ptr->i2c_name); + } + } + else + { + printk(KERN_ERR "PDDF_ERROR: %s: Invalid value for dev_ops %s", __FUNCTION__, buf); + } + +free_data: + /*TODO: free the device_ptr->data is dynamically allocated*/ +#ifdef __STDC_LIB_EXT1__ + memset_s(device_ptr, sizeof(NEW_DEV_ATTR), 0 , sizeof(NEW_DEV_ATTR)); +#else + memset(device_ptr, 0 , sizeof(NEW_DEV_ATTR)); +#endif + + return count; +} + + +static struct kobject *fpgai2c_kobj; + +int __init fpgai2c_data_init(void) +{ + struct kobject *device_kobj; + int ret = 0; + + + pddf_dbg(FPGAI2C, "FPGAI2C_DATA MODULE.. init\n"); + + device_kobj = get_device_i2c_kobj(); + if(!device_kobj) + return -ENOMEM; + + fpgai2c_kobj = kobject_create_and_add("fpgai2c", device_kobj); + if(!fpgai2c_kobj) + return -ENOMEM; + + + ret = sysfs_create_group(fpgai2c_kobj, &pddf_clients_data_group); + if (ret) + { + kobject_put(fpgai2c_kobj); + return ret; + } + pddf_dbg(FPGAI2C, "CREATED PDDF I2C CLIENTS CREATION SYSFS GROUP\n"); + + mutex_init(&pddf_fpgai2c_data.fpga_lock); + + ret = sysfs_create_group(fpgai2c_kobj, &pddf_fpgai2c_client_data_group); + if (ret) + { + sysfs_remove_group(fpgai2c_kobj, &pddf_clients_data_group); + kobject_put(fpgai2c_kobj); + return ret; + } + pddf_dbg(FPGAI2C, "CREATED PDDF I2C CLIENTS CREATION SYSFS GROUP\n"); + return ret; +} + +void __exit fpgai2c_data_exit(void) +{ + pddf_dbg(FPGAI2C, "FPGAI2C_DATA MODULE.. exit\n"); + sysfs_remove_group(fpgai2c_kobj, &pddf_fpgai2c_client_data_group); + sysfs_remove_group(fpgai2c_kobj, &pddf_clients_data_group); + kobject_put(fpgai2c_kobj); + pddf_dbg(FPGAI2C, KERN_ERR "%s: Removed the kobjects for 'fpgai2c'\n",__FUNCTION__); + return; +} + +module_init(fpgai2c_data_init); +module_exit(fpgai2c_data_exit); + +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("fpgai2c platform data"); +MODULE_LICENSE("GPL"); diff --git a/platform/pddf/i2c/modules/include/pddf_client_defs.h b/platform/pddf/i2c/modules/include/pddf_client_defs.h index 1c98a73e6eb6..b9d5090f731f 100644 --- a/platform/pddf/i2c/modules/include/pddf_client_defs.h +++ b/platform/pddf/i2c/modules/include/pddf_client_defs.h @@ -28,6 +28,7 @@ #define CLIENT "PDDF_CLIENT" #define CPLD "PDDF_CPLD" #define CPLDMUX "PDDF_CPLDMUX" +#define FPGAI2C "PDDF_FPGAI2C" #define MUX "PDDF_MUX" #define GPIO "PDDF_GPIO" #define SYSSTATUS "PDDF_SYSSTATUS" diff --git a/platform/pddf/i2c/modules/include/pddf_fpgai2c_defs.h b/platform/pddf/i2c/modules/include/pddf_fpgai2c_defs.h new file mode 100644 index 000000000000..bc3cbc2b7bba --- /dev/null +++ b/platform/pddf/i2c/modules/include/pddf_fpgai2c_defs.h @@ -0,0 +1,30 @@ +/* + * Copyright 2019 Broadcom. + * The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Description: + * Platform FPGA I2C defines/structures header file + */ + +#ifndef __PDDF_FPGAI2C_DEFS_H__ +#define __PDDF_FPGAI2C_DEFS_H__ + +/* FPGAI2C DATA - DATA FOR I2C FPGA CLIENT READ/WRITE*/ +typedef struct FPGAI2C_DATA +{ + struct mutex fpga_lock; + uint16_t reg_addr; +}PDDF_FPGAI2C_DATA; + + +#endif //__PDDF_FPGAI2C_DEFS_H__ From 120aa78b07574bdc0e86940a583699308072610a Mon Sep 17 00:00:00 2001 From: FuzailBrcm <51665572+FuzailBrcm@users.noreply.github.com> Date: Fri, 3 Feb 2023 00:53:30 +0530 Subject: [PATCH 087/113] [pddf]: Modifying the PDDF common platform APIs as per the LED driver changes (#13474) Why I did it LED driver changed due to introduction of FPGA support. The PDDF parser and APIs need to be updated. In turn the common platform APIs also require changes. How I did it Changed the get/set status LED APIs for PSU, fan and fan_drawer. Changed the color strings to plain color name. e.g. 'STATUS_LED_COLOR_GREEN' has been changed to 'green' Added support for LED color get operation via BMC How to verify it Verified the new changes on Accton AS7816-64X platform. root@sonic:/home/admin# root@sonic:/home/admin# show platform summary Platform: x86_64-accton_as7816_64x-r0 HwSKU: Accton-AS7816-64X ASIC: broadcom ASIC Count: 1 Serial Number: AAA1903AAEV Model Number: FP3AT7664000A Hardware Revision: N/A root@sonic:/home/admin# root@sonic:/home/admin# show ver |more SONiC Software Version: SONiC.master.0-dirty-20230111.010655 Distribution: Debian 11.6 Kernel: 5.10.0-18-2-amd64 Build commit: 3176b15ae Build date: Wed Jan 11 09:12:54 UTC 2023 Built by: fk410167@sonic-lvn-csg-006 Platform: x86_64-accton_as7816_64x-r0 HwSKU: Accton-AS7816-64X ASIC: broadcom ASIC Count: 1 Serial Number: AAA1903AAEV Model Number: FP3AT7664000A Hardware Revision: N/A Uptime: 09:24:42 up 4 days, 22:45, 1 user, load average: 1.97, 1.80, 1.51 Date: Mon 23 Jan 2023 09:24:42 Docker images: REPOSITORY TAG IMAGE ID SI ZE docker-orchagent latest 63262c7468d7 38 5MB root@sonic:/home/admin# root@sonic:/home/admin# root@sonic:/home/admin# pddf_ledutil getstatusled LOC_LED off root@sonic:/home/admin# pddf_ledutil getstatusled DIAG_LED green root@sonic:/home/admin# root@sonic:/home/admin# root@sonic:/home/admin# pddf_ledutil setstatusled DIAG_LED red True root@sonic:/home/admin# pddf_ledutil getstatusled DIAG_LED red root@sonic:/home/admin# root@sonic:/home/admin# root@sonic:/home/admin# root@sonic:/home/admin# pddf_ledutil setstatusled DIAG_LED amber Invalid color False root@sonic:/home/admin# pddf_ledutil getstatusled DIAG_LED red root@sonic:/home/admin# root@sonic:/home/admin# root@sonic:/home/admin# pddf_ledutil setstatusled DIAG_LED green True root@sonic:/home/admin# pddf_ledutil getstatusled DIAG_LED green root@sonic:/home/admin# root@sonic:/home/admin# root@sonic:/home/admin# root@sonic:/home/admin# pddf_ledutil getstatusled LOC_LED off root@sonic:/home/admin# pddf_ledutil setstatusled LOC_LED amber True root@sonic:/home/admin# pddf_ledutil getstatusled LOC_LED amber root@sonic:/home/admin# pddf_ledutil setstatusled LOC_LED off True root@sonic:/home/admin# pddf_ledutil getstatusled LOC_LED off root@sonic:/home/admin# --- .../sonic_platform_pddf_base/pddf_chassis.py | 42 +++++----- .../sonic_platform_pddf_base/pddf_fan.py | 53 ++++++------ .../pddf_fan_drawer.py | 24 ++---- .../sonic_platform_pddf_base/pddf_psu.py | 28 +++---- .../sonic_platform_pddf_base/pddfapi.py | 80 ++++++++++--------- 5 files changed, 98 insertions(+), 129 deletions(-) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py index ef211b9933c4..4ed6a22e9f12 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py @@ -193,32 +193,30 @@ def get_reboot_cause(self): ############################################## # System LED methods ############################################## + # APIs used by PDDF. Use them for debugging front panel + # system LED and fantray LED issues def set_system_led(self, led_device_name, color): - result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color) - if result == False: + """ + Sets the color of an LED device in PDDF + Args: + led_device_name: a pre-defined LED device name list used in pddf-device.json. + color: A string representing the color with which to set a LED + Returns: + bool: True if the LED state is set successfully, False if not + """ + result, msg = self.pddf_obj.set_system_led_color(led_device_name, color) + if not result and msg: print(msg) - return (False) - - index = self.pddf_obj.data[led_device_name]['dev_attr']['index'] - device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path()) - self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path()) - return (True) + return (result) def get_system_led(self, led_device_name): - if led_device_name not in self.pddf_obj.data.keys(): - status = "[FAILED] " + led_device_name + " is not configured" - return (status) - - index = self.pddf_obj.data[led_device_name]['dev_attr']['index'] - device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('dev_ops', 'get_status', self.pddf_obj.get_led_path()) - color = self.pddf_obj.get_led_color() - return (color) + """ + Gets the color of an LED device in PDDF + Returns: + string: color of LED or message if failed. + """ + result, output = self.pddf_obj.get_system_led_color(led_device_name) + return (output) ############################################## # Other methods diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py index 6ab45fccd194..e0a0ad1e68b2 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py @@ -297,38 +297,31 @@ def set_speed(self, speed): return status def set_status_led(self, color): - index = str(self.fantray_index-1) - led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" - - result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color) - if result == False: - print(msg) - return (False) - - device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path()) - self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path()) - return (True) + result = False + if self.is_psu_fan: + # Usually no led for psu_fan hence raise a NotImplementedError + raise NotImplementedError + else: + # Usually there is no led for psu_fan + led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" + result, msg = self.pddf_obj.set_system_led_color(led_device_name, color) + return (result) def get_status_led(self): - index = str(self.fantray_index-1) - fan_led_device = "FANTRAY{}".format(self.fantray_index) + "_LED" - - if fan_led_device not in self.pddf_obj.data.keys(): - # Implement a generic status_led color scheme - if self.get_status(): - return self.STATUS_LED_COLOR_GREEN - else: - return self.STATUS_LED_COLOR_OFF - - device_name = self.pddf_obj.data[fan_led_device]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('dev_ops', 'get_status', self.pddf_obj.get_led_path()) - color = self.pddf_obj.get_led_color() - return (color) + if self.is_psu_fan: + # Usually no led for psu_fan hence raise a NotImplementedError + raise NotImplementedError + else: + fan_led_device = "FANTRAY{}".format(self.fantray_index) + "_LED" + if (not fan_led_device in self.pddf_obj.data.keys()): + # Implement a generic status_led color scheme + if self.get_status(): + return self.STATUS_LED_COLOR_GREEN + else: + return self.STATUS_LED_COLOR_OFF + + result, color = self.pddf_obj.get_system_led_color(fan_led_device) + return (color) def get_position_in_parent(self): """ diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py index f88e833408dd..477d343fb1ef 100755 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py @@ -78,33 +78,19 @@ def get_position_in_parent(self): return self.fantray_index def get_status_led(self): - led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" - - if led_device_name not in self.pddf_obj.data.keys(): + fan_led_device = "FANTRAY{}".format(self.fantray_index) + "_LED" + if (not fan_led_device in self.pddf_obj.data.keys()): # Implement a generic status_led color scheme if self.get_status(): return self.STATUS_LED_COLOR_GREEN else: return self.STATUS_LED_COLOR_OFF - device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', str(self.fantray_index-1), self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('dev_ops', 'get_status', self.pddf_obj.get_led_path()) - color = self.pddf_obj.get_led_color() + result, color = self.pddf_obj.get_system_led_color(fan_led_device) return (color) def set_status_led(self, color): result = False led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" - result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color) - if result == False: - print(msg) - return (False) - - device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', str(self.fantray_index-1), self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path()) - self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path()) - return (True) + result, msg = self.pddf_obj.set_system_led_color(led_device_name, color) + return (result) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py index 6803f51e24bf..01d12a81ff52 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py @@ -250,23 +250,17 @@ def get_powergood_status(self): return self.get_status() def set_status_led(self, color): - index = str(self.psu_index-1) + if 'psu_led_color' in self.plugin_data['PSU']: + led_color_map = self.plugin_data['PSU']['psu_led_color']['colmap'] + if color in led_color_map: + # change the color properly + new_color = led_color_map[color] + color = new_color led_device_name = "PSU{}".format(self.psu_index) + "_LED" - - result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color) - if result == False: - print(msg) - return (False) - - device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path()) - self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path()) - return (True) + result, msg = self.pddf_obj.set_system_led_color(led_device_name, color) + return (result) def get_status_led(self): - index = str(self.psu_index-1) psu_led_device = "PSU{}_LED".format(self.psu_index) if psu_led_device not in self.pddf_obj.data.keys(): # Implement a generic status_led color scheme @@ -275,11 +269,7 @@ def get_status_led(self): else: return self.STATUS_LED_COLOR_OFF - device_name = self.pddf_obj.data[psu_led_device]['dev_info']['device_name'] - self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path()) - self.pddf_obj.create_attr('dev_ops', 'get_status', self.pddf_obj.get_led_path()) - color = self.pddf_obj.get_led_color() + result, color = self.pddf_obj.get_system_led_color(psu_led_device) return (color) def get_temperature(self): diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfapi.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfapi.py index 05cd450b312d..a4c6e04ca4f8 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfapi.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfapi.py @@ -16,19 +16,6 @@ dirname = os.path.dirname(os.path.realpath(__file__)) -color_map = { - "STATUS_LED_COLOR_GREEN": "green", - "STATUS_LED_COLOR_RED": "red", - "STATUS_LED_COLOR_AMBER": "amber", - "STATUS_LED_COLOR_BLUE": "blue", - "STATUS_LED_COLOR_GREEN_BLINK": "blinking green", - "STATUS_LED_COLOR_RED_BLINK": "blinking red", - "STATUS_LED_COLOR_AMBER_BLINK": "blinking amber", - "STATUS_LED_COLOR_BLUE_BLINK": "blinking blue", - "STATUS_LED_COLOR_OFF": "off" -} - - class PddfApi(): def __init__(self): if not os.path.exists("/usr/share/sonic/platform"): @@ -123,10 +110,12 @@ def get_led_color(self): color = f.read().strip("\r\n") except IOError: return ("Error") - - return (color_map[color]) + return color def get_led_color_devtype(self, key): + if 'bmc' in self.data[key]: + return 'bmc' + attr_list = self.data[key]['i2c']['attr_list'] for attr in attr_list: if 'attr_devtype' in attr: @@ -163,8 +152,8 @@ def get_led_color_from_gpio(self, led_device_name): for attr in attr_list: if int(attr['value'].strip(), 16) == value: - return(color_map[attr['attr_name']]) - return (color_map['STATUS_LED_COLOR_OFF']) + return (attr['attr_name']) + return ("off") def get_led_color_from_cpld(self, led_device_name): index = self.data[led_device_name]['dev_attr']['index'] @@ -174,6 +163,12 @@ def get_led_color_from_cpld(self, led_device_name): self.create_attr('dev_ops', 'get_status', self.get_led_path()) return self.get_led_color() + def get_led_color_from_bmc(self, led_device_name): + for bmc_attr in self.data[led_device_name]['bmc']['ipmitool']['attr_list']: + if (self.bmc_get_cmd(bmc_attr) == str(int(bmc_attr['value'], 16))): + return (bmc_attr['attr_name']) + return ("off") + def set_led_color_from_gpio(self, led_device_name, color): attr_list = self.data[led_device_name]['i2c']['attr_list'] for attr in attr_list: @@ -196,9 +191,9 @@ def set_led_color_from_gpio(self, led_device_name, color): cmd = "echo {} > {}".format(_value, attr_path) self.runcmd(cmd) except Exception as e: - print("Invalid gpio path : " + attr_path) - return (False) - return (True) + msg = "Invalid gpio path : " + attr_path + return (False, msg) + return (True, "Success") def set_led_color_from_cpld(self, led_device_name, color): index = self.data[led_device_name]['dev_attr']['index'] @@ -207,26 +202,42 @@ def set_led_color_from_cpld(self, led_device_name, color): self.create_attr('index', index, self.get_led_path()) self.create_attr('color', color, self.get_led_cur_state_path()) self.create_attr('dev_ops', 'set_status', self.get_led_path()) - return (True) + return (True, "Success") def get_system_led_color(self, led_device_name): if led_device_name not in self.data.keys(): - status = "[FAILED] " + led_device_name + " is not configured" - return (status) + msg = led_device_name + " is not configured" + return (False, msg) dtype = self.get_led_color_devtype(led_device_name) if dtype == 'gpio': color = self.get_led_color_from_gpio(led_device_name) - elif dtype == 'cpld': + elif dtype == 'bmc': + color = self.get_led_color_from_bmc(led_device_name) + else: + # This case takes care of CPLD as well as I2CFPGA color = self.get_led_color_from_cpld(led_device_name) - return color + + return (True, color) def set_system_led_color(self, led_device_name, color): - result, msg = self.is_supported_sysled_state(led_device_name, color) - if result == False: - print(msg) - return (result) + # Check if the device is configured + if led_device_name not in self.data.keys(): + msg = led_device_name + " is not configured" + return (False, msg) + + # Check for the write permission + if 'flag' in self.data[led_device_name]['dev_attr']: + if self.data[led_device_name]['dev_attr']['flag'] == 'ro': + return (False, "Set LED operation not supported or handled separately") + + found = False + for attr in self.data[led_device_name]['i2c']['attr_list']: + if attr['attr_name'] == color: + found = True + if not found: + return (False, "Invalid color") dtype = self.get_led_color_devtype(led_device_name) @@ -391,7 +402,6 @@ def show_attr_fan_device(self, dev, ops): ret.append(dsysfs_path) return ret - # This is only valid for LM75 def show_attr_temp_sensor_device(self, dev, ops): ret = [] if 'i2c' not in dev.keys(): @@ -412,7 +422,7 @@ def show_attr_temp_sensor_device(self, dev, ops): real_name = attr['attr_name'] if 'topo_info' in dev['i2c']: - path = self.show_device_sysfs(dev, ops)+"/%d-00%x/" % (int(dev['i2c']['topo_info']['parent_bus'], 0), + path = self.show_device_sysfs(dev, ops)+"/%d-00%x/"%(int(dev['i2c']['topo_info']['parent_bus'], 0), int(dev['i2c']['topo_info']['dev_addr'], 0)) if (os.path.exists(path)): full_path = glob.glob(path + 'hwmon/hwmon*/' + real_name)[0] @@ -810,14 +820,6 @@ def dev_parse(self, dev, ops): if attr['device_type'] == 'SYSSTAT': return self.sysstatus_parse(dev, ops) - def is_supported_sysled_state(self, sysled_name, sysled_state): - if sysled_name not in self.data.keys(): - return False, "[FAILED] " + sysled_name + " is not configured" - for attr in self.data[sysled_name]['i2c']['attr_list']: - if attr['attr_name'] == sysled_state: - return True, "supported" - return False, "[FAILED]: Invalid color" - def create_attr(self, key, value, path): cmd = "echo '%s' > /sys/kernel/%s/%s" % (value, path, key) self.runcmd(cmd) From aa048865c9e914c72b1edd64b26261d705dd96ea Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Fri, 3 Feb 2023 10:31:15 +0200 Subject: [PATCH 088/113] [submodule] Advance sonic-linux-kernel pointer (#13558) Update sonic-linux-kernel submodule pointer to include the following: * 4873ade Merge pull request 303 from ([#adhava28/cisco/kernel_confi](https://github.com/sonic-net/sonic-linux-kernel/pull/adhava28/cisco/kernel_confi)) * 19266b4 Review comments ([#ncorporate](https://github.com/sonic-net/sonic-linux-kernel/pull/ncorporate)) * f28140c Merge branch 'master' into ([#isco/kernel_confi](https://github.com/sonic-net/sonic-linux-kernel/pull/isco/kernel_confi)) * 5717c5d Merge pull request 300 from ([#aiarcot895/fix-config-setting-with-existing-value](https://github.com/sonic-net/sonic-linux-kernel/pull/aiarcot895/fix-config-setting-with-existing-value)) * 18a0bf7 Kernel configuration is enabled to support device drivers for sensor devices, gpio devices, MDIO mux devices, ADC, DAC device and Intel SPI ([#ontroller](https://github.com/sonic-net/sonic-linux-kernel/pull/ontroller)) * 7f8d898 Support verifying the value of strings (and not just y/m/n ([#ettings](https://github.com/sonic-net/sonic-linux-kernel/pull/ettings)) * e9206c9 Fix setting a config with an already-existing conflicting ([#alu](https://github.com/sonic-net/sonic-linux-kernel/pull/alu)) Signed-off-by: dprital --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 34f26b35839d..4873adee4c9c 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 34f26b35839d7c0c09d48176c4ec33197344643c +Subproject commit 4873adee4c9c2708c970be2551fe75bfd14a1eee From 0462874eefca0466211fa534b12214993d7b87f3 Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Sun, 5 Feb 2023 16:24:04 +0200 Subject: [PATCH 089/113] [submodule] Advance sonic-swss-common pointer (#13556) Update sonic-swss-common submodule pointer to include the following: * 6b6842a [NotificationProducer] add pipeline support ([#708](https://github.com/sonic-net/sonic-swss-common/pull/708)) * 2cb5ea0 Increase the netlink buffer size from 3MB to 16MB. ([#739](https://github.com/sonic-net/sonic-swss-common/pull/739)) * dacbdad RedisPipeline ignore flush when call dtor from another thread. ([#736](https://github.com/sonic-net/sonic-swss-common/pull/736)) Signed-off-by: dprital From 1ff0c0b685b884c00b30c7298f8dbbd6cfc3dcd5 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Sun, 5 Feb 2023 06:45:49 -0800 Subject: [PATCH 090/113] [Mellanox][sai_failure_dump]Added platform specific script to be invoked during SAI failure dump (#13533) - Why I did it Added platform specific script to be invoked during SAI failure dump. Added some generic changes to mount /var/log/sai_failure_dump as read write in the syncd docker - How I did it Added script in docker-syncd of mellanox and copied it to /usr/bin - How to verify it Manual UT and new sonic-mgmt tests --- files/build_templates/docker_image_ctl.j2 | 1 + .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 1 + .../docker-syncd-mlnx/platform_syncd_dump.sh | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100755 platform/mellanox/docker-syncd-mlnx/platform_syncd_dump.sh diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 3017565e3027..2c7d8a7d6d04 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -526,6 +526,7 @@ start() { -v mlnx_sdk_socket:/var/run/sx_sdk \ -v mlnx_sdk_ready:/tmp \ -v /dev/shm:/dev/shm:rw \ + -v /var/log/sai_failure_dump:/var/log/sai_failure_dump:rw \ -e SX_API_SOCKET_FILE=/var/run/sx_sdk/sx_api.sock \ {%- elif docker_container_name == "pmon" %} -v /var/run/hw-management:/var/run/hw-management:rw \ diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index a23baaec23c3..3d68ba4bc9f7 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -64,6 +64,7 @@ RUN apt-get clean -y && \ COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor/"] +COPY ["platform_syncd_dump.sh", "/usr/bin/"] RUN mkdir -p /etc/supervisor/conf.d/ RUN sonic-cfggen -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf diff --git a/platform/mellanox/docker-syncd-mlnx/platform_syncd_dump.sh b/platform/mellanox/docker-syncd-mlnx/platform_syncd_dump.sh new file mode 100755 index 000000000000..f5dc28647ff5 --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx/platform_syncd_dump.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# +# Script for sai failure dump +# + +# Source the platform specific dump file + +sai_dump_name="sai_sdk_dump_$(date +"%m_%d_%Y_%I_%M_%p")" +sai_dump_path="${DUMPDIR}/$sai_dump_name" +mkdir -p $sai_dump_path +sai_dump_file="${sai_dump_path}/$sai_dump_name" +saisdkdump -f $sai_dump_file +cd "${DUMPDIR}" +tar -cvf "$sai_dump_name".tar $sai_dump_name +gzip "$sai_dump_name".tar +rm -rf $sai_dump_name + +# Update max failure dumps +if grep -q SAI_DUMP_STORE_AMOUNT /usr/share/sonic/hwsku/sai.profile; then + SAI_MAX_FAILURE_DUMPS=$(grep SAI_DUMP_STORE_AMOUNT /usr/share/sonic/hwsku/sai.profile | cut -d '=' -f2) +fi + From c7d6b8ddbb67631eb0af6b07f4d4cf85fbfa4877 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Mon, 6 Feb 2023 17:08:31 +0800 Subject: [PATCH 091/113] [build] Check if patches are applied before applying patches. (#13566) Why I did it If make fails, we can't rerun the make process, because existing patches can't apply again. #13386 missed some change. --- slave.mk | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/slave.mk b/slave.mk index cf529dc19856..dc926087f35a 100644 --- a/slave.mk +++ b/slave.mk @@ -623,11 +623,11 @@ $(addprefix $(FILES_PATH)/, $(SONIC_MAKE_FILES)) : $(FILES_PATH)/% : .platform $ # Remove target to force rebuild rm -f $(addprefix $(FILES_PATH)/, $*) # Apply series of patches if exist - if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG) # Build project and take package make DEST=$(shell pwd)/$(FILES_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(FILES_PATH)/$* $(LOG) # Clean up - if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi $(LOG) # Save the target deb into DPKG cache $(call SAVE_CACHE,$*,$@) @@ -667,12 +667,12 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(a # Remove target to force rebuild rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) # Apply series of patches if exist - if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG) # Build project and take package $(SETUP_OVERLAYFS_FOR_DPKG_ADMINDIR) DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC}" $(ANT_DEB_CONFIG) $(CROSS_COMPILE_FLAGS) make -j$(SONIC_CONFIG_MAKE_JOBS) DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) # Clean up - if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi $(LOG) # Save the target deb into DPKG cache $(call SAVE_CACHE,$*,$@) @@ -707,7 +707,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a # Remove old build logs if they exist rm -f $($*_SRC_PATH)/debian/*.debhelper.log # Apply series of patches if exist - if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG) # Build project pushd $($*_SRC_PATH) $(LOG_SIMPLE) if [ -f ./autogen.sh ]; then ./autogen.sh $(LOG); fi @@ -821,14 +821,14 @@ $(addprefix $(PYTHON_DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(PYTHON_DEBS_PA if [ -z '$($*_CACHE_LOADED)' ] ; then # Apply series of patches if exist - if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG) # Build project pushd $($*_SRC_PATH) $(LOG_SIMPLE) rm -rf deb_dist/* $(LOG) python setup.py --command-packages=stdeb.command bdist_deb $(LOG) popd $(LOG_SIMPLE) # Clean up - if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi $(LOG) # Take built package(s) mv -f $(addprefix $($*_SRC_PATH)/deb_dist/, $* $($*_DERIVED_DEBS)) $(PYTHON_DEBS_PATH) $(LOG) @@ -861,7 +861,7 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA pushd $($*_SRC_PATH) $(LOG_SIMPLE) # apply series of patches if exist - if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi + if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi $(LOG) ifneq ($(CROSS_BUILD_ENVIRON),y) # Use pip instead of later setup.py to install dependencies into user home, but uninstall self pip$($*_PYTHON_VERSION) install . && pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name` @@ -927,7 +927,7 @@ docker-start : $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $(HEADER) # Apply series of patches if exist - if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi + if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi $(LOG) # Prepare docker build info SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) \ @@ -1025,7 +1025,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform if [ -z '$($*.gz_CACHE_LOADED)' ] ; then # Apply series of patches if exist - if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi + if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi $(LOG) mkdir -p $($*.gz_PATH)/debs $(LOG) mkdir -p $($*.gz_PATH)/files $(LOG) mkdir -p $($*.gz_PATH)/python-debs $(LOG) From 7cedb09c96327153b557c3755c554e2680001a01 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Mon, 6 Feb 2023 11:14:47 +0200 Subject: [PATCH 092/113] [hash] Add Generic Hash YANG model (#13253) - Why I did it Added YANG model as part of Generic Hash feature development - How I did it Added YANG model and UTs - How to verify it make configure PLATFORM=mellanox make target/sonic-mellanox.bin Signed-off-by: Nazarii Hnydyn --- src/sonic-yang-models/doc/Configuration.md | 53 +++++++++++++++ src/sonic-yang-models/setup.py | 2 + .../tests/files/sample_config_db.json | 22 ++++++ .../tests/yang_model_tests/tests/hash.json | 13 ++++ .../yang_model_tests/tests_config/hash.json | 50 ++++++++++++++ .../yang-models/sonic-hash.yang | 67 +++++++++++++++++++ .../yang-models/sonic-pbh.yang | 6 +- .../yang-templates/sonic-types.yang.j2 | 28 +++++++- 8 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/hash.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/hash.json create mode 100644 src/sonic-yang-models/yang-models/sonic-hash.yang diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index d2227adb2784..69610f4f46a9 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -27,6 +27,7 @@ Table of Contents * [Device neighbor metada](#device-neighbor-metada) * [DSCP_TO_TC_MAP](#dscp_to_tc_map) * [FLEX_COUNTER_TABLE](#flex_counter_table) + * [Hash](#hash) * [KDUMP](#kdump) * [Kubernetes Master](#kubernetes-master) * [L2 Neighbors](#l2-neighbors) @@ -936,6 +937,58 @@ instance is supported in SONiC. ``` +### Hash + +Generic hash allows user to configure which hash fields are suppose to be used by a hashing algorithm. +The configuration is applied globally for each ECMP and LAG on a switch. + +***ECMP/LAG HASH*** + +``` +{ + "SWITCH_HASH": { + "GLOBAL": { + "ecmp_hash": [ + "DST_MAC", + "SRC_MAC", + "ETHERTYPE", + "IP_PROTOCOL", + "DST_IP", + "SRC_IP", + "L4_DST_PORT", + "L4_SRC_PORT", + "INNER_DST_MAC", + "INNER_SRC_MAC", + "INNER_ETHERTYPE", + "INNER_IP_PROTOCOL", + "INNER_DST_IP", + "INNER_SRC_IP", + "INNER_L4_DST_PORT", + "INNER_L4_SRC_PORT" + ], + "lag_hash": [ + "DST_MAC", + "SRC_MAC", + "ETHERTYPE", + "IP_PROTOCOL", + "DST_IP", + "SRC_IP", + "L4_DST_PORT", + "L4_SRC_PORT", + "INNER_DST_MAC", + "INNER_SRC_MAC", + "INNER_ETHERTYPE", + "INNER_IP_PROTOCOL", + "INNER_DST_IP", + "INNER_SRC_IP", + "INNER_L4_DST_PORT", + "INNER_L4_SRC_PORT" + ] + } + } +} +``` + ### KDUMP ``` diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 69b27bc90f53..2afc3c85f0ac 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -116,6 +116,7 @@ def run(self): './yang-models/sonic-extension.yang', './yang-models/sonic-flex_counter.yang', './yang-models/sonic-feature.yang', + './yang-models/sonic-hash.yang', './yang-models/sonic-system-defaults.yang', './yang-models/sonic-interface.yang', './yang-models/sonic-kdump.yang', @@ -200,6 +201,7 @@ def run(self): './cvlyang-models/sonic-extension.yang', './cvlyang-models/sonic-flex_counter.yang', './cvlyang-models/sonic-feature.yang', + './cvlyang-models/sonic-hash.yang', './cvlyang-models/sonic-system-defaults.yang', './cvlyang-models/sonic-interface.yang', './cvlyang-models/sonic-kdump.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 57a95d867ce0..f9945175cf48 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -324,6 +324,28 @@ "AETH_SYNDROME": "0x60/0x60" } }, + "SWITCH_HASH": { + "GLOBAL": { + "ecmp_hash": [ + "DST_IP", + "SRC_IP", + "IP_PROTOCOL", + "L4_DST_PORT", + "L4_SRC_PORT", + "INNER_DST_IP", + "INNER_SRC_IP" + ], + "lag_hash": [ + "DST_IP", + "SRC_IP", + "IP_PROTOCOL", + "L4_DST_PORT", + "L4_SRC_PORT", + "INNER_DST_IP", + "INNER_SRC_IP" + ] + } + }, "DEVICE_METADATA": { "localhost": { "type": "ToRRouter", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/hash.json b/src/sonic-yang-models/tests/yang_model_tests/tests/hash.json new file mode 100644 index 000000000000..466ef001e65e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/hash.json @@ -0,0 +1,13 @@ +{ + "SWITCH_HASH_VALID": { + "desc": "Configure SWITCH_HASH." + }, + "SWITCH_HASH_INVALID_ECMP_HASH": { + "desc": "Configure invalid ECMP_HASH in SWITCH_HASH.", + "eStrKey": "InvalidValue" + }, + "SWITCH_HASH_INVALID_LAG_HASH": { + "desc": "Configure invalid LAG_HASH in SWITCH_HASH.", + "eStrKey": "InvalidValue" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/hash.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/hash.json new file mode 100644 index 000000000000..67c086f8082d --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/hash.json @@ -0,0 +1,50 @@ +{ + "SWITCH_HASH_VALID": { + "sonic-hash:sonic-hash": { + "sonic-hash:SWITCH_HASH": { + "sonic-hash:GLOBAL": { + "ecmp_hash": [ + "DST_IP", + "SRC_IP", + "IP_PROTOCOL", + "L4_DST_PORT", + "L4_SRC_PORT", + "INNER_DST_IP", + "INNER_SRC_IP" + ], + "lag_hash": [ + "DST_IP", + "SRC_IP", + "IP_PROTOCOL", + "L4_DST_PORT", + "L4_SRC_PORT", + "INNER_DST_IP", + "INNER_SRC_IP" + ] + } + } + } + }, + "SWITCH_HASH_INVALID_ECMP_HASH": { + "sonic-hash:sonic-hash": { + "sonic-hash:SWITCH_HASH": { + "sonic-hash:GLOBAL": { + "ecmp_hash": [ + "INVALID_VALUE" + ] + } + } + } + }, + "SWITCH_HASH_INVALID_LAG_HASH": { + "sonic-hash:sonic-hash": { + "sonic-hash:SWITCH_HASH": { + "sonic-hash:GLOBAL": { + "lag_hash": [ + "INVALID_VALUE" + ] + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-hash.yang b/src/sonic-yang-models/yang-models/sonic-hash.yang new file mode 100644 index 000000000000..84e87cf24310 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-hash.yang @@ -0,0 +1,67 @@ +module sonic-hash { + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-hash"; + prefix hash; + + import sonic-types { + prefix stypes; + } + + description "HASH YANG Module for SONiC OS"; + + revision 2022-09-05 { + description "First Revision"; + } + + typedef hash-field { + description "Represents native hash field"; + type stypes:hash-field { + enum IN_PORT; + enum DST_MAC; + enum SRC_MAC; + enum ETHERTYPE; + enum VLAN_ID; + enum IP_PROTOCOL; + enum DST_IP; + enum SRC_IP; + enum L4_DST_PORT; + enum L4_SRC_PORT; + enum INNER_DST_MAC; + enum INNER_SRC_MAC; + enum INNER_ETHERTYPE; + enum INNER_IP_PROTOCOL; + enum INNER_DST_IP; + enum INNER_SRC_IP; + enum INNER_L4_DST_PORT; + enum INNER_L4_SRC_PORT; + } + } + + container sonic-hash { + + container SWITCH_HASH { + + description "SWITCH_HASH part of config_db.json"; + + container GLOBAL { + + leaf-list ecmp_hash { + description "Hash fields for hashing packets going through ECMP"; + type hash:hash-field; + } + + leaf-list lag_hash { + description "Hash fields for hashing packets going through LAG"; + type hash:hash-field; + } + + } + /* end of container GLOBAL */ + } + /* end of container SWITCH_HASH */ + } + /* end of container sonic-hash */ +} +/* end of module sonic-hash */ diff --git a/src/sonic-yang-models/yang-models/sonic-pbh.yang b/src/sonic-yang-models/yang-models/sonic-pbh.yang index 54c728a939a1..d0c395d4e6a3 100644 --- a/src/sonic-yang-models/yang-models/sonic-pbh.yang +++ b/src/sonic-yang-models/yang-models/sonic-pbh.yang @@ -9,6 +9,10 @@ module sonic-pbh { prefix inet; } + import sonic-types { + prefix stypes; + } + import sonic-port { prefix port; } @@ -25,7 +29,7 @@ module sonic-pbh { typedef hash-field { description "Represents native hash field"; - type enumeration { + type stypes:hash-field { enum INNER_IP_PROTOCOL; enum INNER_L4_DST_PORT; enum INNER_L4_SRC_PORT; diff --git a/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 index 498abb3aae31..ee26a7d67b13 100644 --- a/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 @@ -305,7 +305,33 @@ module sonic-types { } } - + typedef hash-field { + description "Represents native hash field"; + type enumeration { + enum IN_PORT; + enum DST_MAC; + enum SRC_MAC; + enum ETHERTYPE; + enum VLAN_ID; + enum IP_PROTOCOL; + enum DST_IP; + enum SRC_IP; + enum L4_DST_PORT; + enum L4_SRC_PORT; + enum INNER_DST_MAC; + enum INNER_SRC_MAC; + enum INNER_ETHERTYPE; + enum INNER_IP_PROTOCOL; + enum INNER_DST_IP; + enum INNER_DST_IPV4; + enum INNER_DST_IPV6; + enum INNER_SRC_IP; + enum INNER_SRC_IPV4; + enum INNER_SRC_IPV6; + enum INNER_L4_DST_PORT; + enum INNER_L4_SRC_PORT; + } + } {% if yang_model_type == "cvl" %} /* Required for CVL */ From eea54717b80f21fb790f9a7f2b4e37a49e59c72f Mon Sep 17 00:00:00 2001 From: Chun'ang Li <39114813+lerry-lee@users.noreply.github.com> Date: Mon, 6 Feb 2023 22:38:04 +0800 Subject: [PATCH 093/113] Fix rsyslogd start failed cause by rsyslog.conf is emtpy. (#13669) - Why I did it In to-sonic and multi-asic KVM-test, pretest sometimes failed. Reason is rsyslogd process can not start in teamd container. Because rsyslog.conf is empty caused by sonic-cfggen execute failed - How I did it If sonic-cfggen -d execute failed, execute without -d because the template file has the default value. - How to verify it Build image and test it over 40 times, all passed pretest. Signed-off-by: Chun'ang Li --- files/build_templates/docker_image_ctl.j2 | 4 ++++ files/image_config/rsyslog/rsyslog-container.conf.j2 | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 2c7d8a7d6d04..ec94fd420303 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -48,6 +48,10 @@ function updateSyslogConf() python -c "import jinja2, os; paths=['/usr/share/sonic/templates']; loader = jinja2.FileSystemLoader(paths); env = jinja2.Environment(loader=loader, trim_blocks=True); template_file='/usr/share/sonic/templates/rsyslog-container.conf.j2'; template = env.get_template(os.path.basename(template_file)); data=template.render({\"target_ip\":\"$TARGET_IP\",\"container_name\":\"$CONTAINER_NAME\"}); print(data)" > $TMP_FILE {%- else %} sonic-cfggen -d -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\" }" > $TMP_FILE + if [ $? -ne 0 ]; then + echo "Error: Execute sonic-cfggen -d failed. Execute without '-d'." + sonic-cfggen -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\" }" > $TMP_FILE + fi {%- endif %} docker cp $TMP_FILE ${DOCKERNAME}:/etc/rsyslog.conf rm -rf $TMP_FILE diff --git a/files/image_config/rsyslog/rsyslog-container.conf.j2 b/files/image_config/rsyslog/rsyslog-container.conf.j2 index 4e2c90b548b2..a6419eba846a 100644 --- a/files/image_config/rsyslog/rsyslog-container.conf.j2 +++ b/files/image_config/rsyslog/rsyslog-container.conf.j2 @@ -28,9 +28,13 @@ $ModLoad imuxsock # provides support for local system logging {% if rate_limit_interval is defined %} $SystemLogRateLimitInterval {{ rate_limit_interval }} +{% else %} +$SystemLogRateLimitInterval 300 {% endif %} {% if rate_limit_burst is defined %} $SystemLogRateLimitBurst {{ rate_limit_burst }} +{% else %} +$SystemLogRateLimitBurst 20000 {% endif %} #$ModLoad imklog # provides kernel logging support From 35e41687b430e3a9380c196b748ae0e6f62a0d81 Mon Sep 17 00:00:00 2001 From: guxianghong Date: Tue, 7 Feb 2023 01:26:35 +0800 Subject: [PATCH 094/113] [Centec] Upgrade Centec platform containers(syncd/saiserver/syncd-rpc) to bullseye (#13375) Why I did it Upgrade both Centec X86 and ARM64 platform containers(syncd/saiserver/syncd-rpc) to bullseye Optimize Centec X86 platform makefile, change sdk.mk to sai.mk How I did it Modify Makefile and Dockerfile to use bullseye Change filename form sdk.mk to sai.mk, optimize and modify related files How to verify it For Centec X86 platform, compile the code with : a) make configure PLATFORM=centec; b) make all For Centec ARM64 platform, cmpile the code with: a) make configure PLATFORM=centec-arm64 PLATFORM_ARCH=arm64; b) make all Verifiy the sonic-centec.bin and sonic-centec-arm64.bin on Centec chip based board. --- platform/centec-arm64/docker-saiserver-centec.mk | 4 ++-- .../docker-saiserver-centec/Dockerfile.j2 | 4 ++-- platform/centec-arm64/docker-syncd-centec-rpc.mk | 2 +- .../docker-syncd-centec-rpc/Dockerfile.j2 | 9 ++------- platform/centec-arm64/docker-syncd-centec.mk | 2 +- .../centec-arm64/docker-syncd-centec/Dockerfile.j2 | 2 +- platform/centec-arm64/sai.mk | 7 ++++--- platform/centec/docker-saiserver-centec.mk | 4 ++-- .../centec/docker-saiserver-centec/Dockerfile.j2 | 4 ++-- platform/centec/docker-syncd-centec-rpc.mk | 2 +- .../centec/docker-syncd-centec-rpc/Dockerfile.j2 | 9 ++------- platform/centec/docker-syncd-centec.mk | 2 +- platform/centec/docker-syncd-centec/Dockerfile.j2 | 2 +- platform/centec/rules.mk | 2 +- platform/centec/sai.mk | 14 ++++++++++++++ platform/centec/sdk.mk | 10 ---------- 16 files changed, 37 insertions(+), 42 deletions(-) create mode 100644 platform/centec/sai.mk delete mode 100644 platform/centec/sdk.mk diff --git a/platform/centec-arm64/docker-saiserver-centec.mk b/platform/centec-arm64/docker-saiserver-centec.mk index 78b7f44d7fbd..929e4e7ad6e2 100755 --- a/platform/centec-arm64/docker-saiserver-centec.mk +++ b/platform/centec-arm64/docker-saiserver-centec.mk @@ -3,7 +3,7 @@ DOCKER_SAISERVER_CENTEC = docker-saiserver-centec.gz $(DOCKER_SAISERVER_CENTEC)_PATH = $(PLATFORM_PATH)/docker-saiserver-centec $(DOCKER_SAISERVER_CENTEC)_DEPENDS += $(SAISERVER) -$(DOCKER_SAISERVER_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_SAISERVER_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_CENTEC) $(DOCKER_SAISERVER_CENTEC)_CONTAINER_NAME = saiserver @@ -13,4 +13,4 @@ $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /var/run/docker-saiserver:/var/run/ssws $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /host/warmboot:/var/warmboot -SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_CENTEC) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_SAISERVER_CENTEC) diff --git a/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 b/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 index 2e0e8ecca836..2bba1db71fd6 100644 --- a/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name @@ -7,7 +7,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get -y install \ - libboost-atomic1.71-dev \ + libboost-atomic1.74.0 \ libqt5core5a \ libqt5network5 diff --git a/platform/centec-arm64/docker-syncd-centec-rpc.mk b/platform/centec-arm64/docker-syncd-centec-rpc.mk index a2d4f9287735..d029a8735b6f 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc.mk +++ b/platform/centec-arm64/docker-syncd-centec-rpc.mk @@ -24,4 +24,4 @@ $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_CENTEC_RPC) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_SYNCD_CENTEC_RPC) diff --git a/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 index cfb888b9e5c4..9b0125301d92 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 @@ -2,11 +2,6 @@ FROM docker-syncd-centec-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update \ - && apt-get -y install \ - libboost-atomic1.71-dev \ - libqt5core5a \ - libqt5network5 COPY \ {% for deb in docker_syncd_centec_rpc_debs.split(' ') -%} @@ -20,7 +15,7 @@ RUN apt-get purge -y syncd RUN apt-get update \ && apt-get -y install \ net-tools \ - python-pip \ + python3-pip \ python-setuptools \ build-essential \ libssl-dev \ @@ -30,7 +25,7 @@ RUN apt-get update \ cmake \ libqt5core5a \ libqt5network5 \ - libboost-atomic1.71.0 + libboost-atomic1.74.0 RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ {% for deb in docker_syncd_centec_rpc_debs.split(' ') -%} diff --git a/platform/centec-arm64/docker-syncd-centec.mk b/platform/centec-arm64/docker-syncd-centec.mk index e53a1d430861..5a84ca08590e 100755 --- a/platform/centec-arm64/docker-syncd-centec.mk +++ b/platform/centec-arm64/docker-syncd-centec.mk @@ -1,7 +1,7 @@ # docker image for centec syncd DOCKER_SYNCD_PLATFORM_CODE = centec -include $(PLATFORM_PATH)/../template/docker-syncd-base.mk +include $(PLATFORM_PATH)/../template/docker-syncd-bullseye.mk $(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(DOCKER_SYNCD_CENTEC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 index 175d18505d67..580737144681 100755 --- a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/centec-arm64/sai.mk b/platform/centec-arm64/sai.mk index 2a8ee5c45d36..d2242261645e 100755 --- a/platform/centec-arm64/sai.mk +++ b/platform/centec-arm64/sai.mk @@ -3,11 +3,12 @@ export CENTEC_SAI_VERSION = 1.11.0-1 export CENTEC_SAI = libsai_$(CENTEC_SAI_VERSION)_$(PLATFORM_ARCH).deb export CENTEC_SAI_DEV = libsai-dev_$(CENTEC_SAI_VERSION)_$(PLATFORM_ARCH).deb +export CENTEC_SAI_URL_PREFIX = "https://github.com/CentecNetworks/sonic-binaries/raw/master/$(PLATFORM_ARCH)/sai" -$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/sonic-binaries/raw/master/$(PLATFORM_ARCH)/sai/$(CENTEC_SAI) -$(CENTEC_SAI_DEV)_URL = https://github.com/CentecNetworks/sonic-binaries/raw/master/$(PLATFORM_ARCH)/sai/$(CENTEC_SAI_DEV) +$(CENTEC_SAI)_URL = $(CENTEC_SAI_URL_PREFIX)/$(CENTEC_SAI) +$(CENTEC_SAI_DEV)_URL = $(CENTEC_SAI_URL_PREFIX)/$(CENTEC_SAI_DEV) $(eval $(call add_conflict_package,$(CENTEC_SAI_DEV),$(LIBSAIVS_DEV))) SONIC_ONLINE_DEBS += $(CENTEC_SAI) SONIC_ONLINE_DEBS += $(CENTEC_SAI_DEV) - +$(CENTEC_SAI_DEV)_DEPENDS += $(CENTEC_SAI) diff --git a/platform/centec/docker-saiserver-centec.mk b/platform/centec/docker-saiserver-centec.mk index 78b7f44d7fbd..929e4e7ad6e2 100755 --- a/platform/centec/docker-saiserver-centec.mk +++ b/platform/centec/docker-saiserver-centec.mk @@ -3,7 +3,7 @@ DOCKER_SAISERVER_CENTEC = docker-saiserver-centec.gz $(DOCKER_SAISERVER_CENTEC)_PATH = $(PLATFORM_PATH)/docker-saiserver-centec $(DOCKER_SAISERVER_CENTEC)_DEPENDS += $(SAISERVER) -$(DOCKER_SAISERVER_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_SAISERVER_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_CENTEC) $(DOCKER_SAISERVER_CENTEC)_CONTAINER_NAME = saiserver @@ -13,4 +13,4 @@ $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /var/run/docker-saiserver:/var/run/ssws $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /host/warmboot:/var/warmboot -SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_CENTEC) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_SAISERVER_CENTEC) diff --git a/platform/centec/docker-saiserver-centec/Dockerfile.j2 b/platform/centec/docker-saiserver-centec/Dockerfile.j2 index 2e0e8ecca836..2bba1db71fd6 100644 --- a/platform/centec/docker-saiserver-centec/Dockerfile.j2 +++ b/platform/centec/docker-saiserver-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name @@ -7,7 +7,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get -y install \ - libboost-atomic1.71-dev \ + libboost-atomic1.74.0 \ libqt5core5a \ libqt5network5 diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index a2d4f9287735..d029a8735b6f 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -24,4 +24,4 @@ $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_CENTEC_RPC) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_SYNCD_CENTEC_RPC) diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 index cfb888b9e5c4..9b0125301d92 100644 --- a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -2,11 +2,6 @@ FROM docker-syncd-centec-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update \ - && apt-get -y install \ - libboost-atomic1.71-dev \ - libqt5core5a \ - libqt5network5 COPY \ {% for deb in docker_syncd_centec_rpc_debs.split(' ') -%} @@ -20,7 +15,7 @@ RUN apt-get purge -y syncd RUN apt-get update \ && apt-get -y install \ net-tools \ - python-pip \ + python3-pip \ python-setuptools \ build-essential \ libssl-dev \ @@ -30,7 +25,7 @@ RUN apt-get update \ cmake \ libqt5core5a \ libqt5network5 \ - libboost-atomic1.71.0 + libboost-atomic1.74.0 RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ {% for deb in docker_syncd_centec_rpc_debs.split(' ') -%} diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk index f8fc1e839677..844d8a7839db 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -1,7 +1,7 @@ # docker image for centec syncd DOCKER_SYNCD_PLATFORM_CODE = centec -include $(PLATFORM_PATH)/../template/docker-syncd-base.mk +include $(PLATFORM_PATH)/../template/docker-syncd-bullseye.mk $(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index 9993539887a5..b87b49c290f8 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/centec/rules.mk b/platform/centec/rules.mk index 2e8cdb0af9f6..8f198203289c 100644 --- a/platform/centec/rules.mk +++ b/platform/centec/rules.mk @@ -1,7 +1,7 @@ include $(PLATFORM_PATH)/platform-modules-centec-e582.mk include $(PLATFORM_PATH)/platform-modules-embedway.mk include $(PLATFORM_PATH)/platform-modules-centec-v682.mk -include $(PLATFORM_PATH)/sdk.mk +include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-syncd-centec.mk include $(PLATFORM_PATH)/docker-syncd-centec-rpc.mk include $(PLATFORM_PATH)/docker-saiserver-centec.mk diff --git a/platform/centec/sai.mk b/platform/centec/sai.mk new file mode 100644 index 000000000000..d2242261645e --- /dev/null +++ b/platform/centec/sai.mk @@ -0,0 +1,14 @@ +# Centec SAI + +export CENTEC_SAI_VERSION = 1.11.0-1 +export CENTEC_SAI = libsai_$(CENTEC_SAI_VERSION)_$(PLATFORM_ARCH).deb +export CENTEC_SAI_DEV = libsai-dev_$(CENTEC_SAI_VERSION)_$(PLATFORM_ARCH).deb +export CENTEC_SAI_URL_PREFIX = "https://github.com/CentecNetworks/sonic-binaries/raw/master/$(PLATFORM_ARCH)/sai" + +$(CENTEC_SAI)_URL = $(CENTEC_SAI_URL_PREFIX)/$(CENTEC_SAI) +$(CENTEC_SAI_DEV)_URL = $(CENTEC_SAI_URL_PREFIX)/$(CENTEC_SAI_DEV) +$(eval $(call add_conflict_package,$(CENTEC_SAI_DEV),$(LIBSAIVS_DEV))) + +SONIC_ONLINE_DEBS += $(CENTEC_SAI) +SONIC_ONLINE_DEBS += $(CENTEC_SAI_DEV) +$(CENTEC_SAI_DEV)_DEPENDS += $(CENTEC_SAI) diff --git a/platform/centec/sdk.mk b/platform/centec/sdk.mk deleted file mode 100644 index ae836d2bf3db..000000000000 --- a/platform/centec/sdk.mk +++ /dev/null @@ -1,10 +0,0 @@ -# Centec SAI -CENTEC_SAI = libsai_1.11.0-1_amd64.deb -$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/sonic-binaries/raw/master/amd64/sai/$(CENTEC_SAI) - -CENTEC_SAI_DEV = libsai-dev_1.11.0-1_amd64.deb -$(CENTEC_SAI_DEV)_URL = https://github.com/CentecNetworks/sonic-binaries/raw/master/amd64/sai/$(CENTEC_SAI_DEV) -$(eval $(call add_conflict_package,$(CENTEC_SAI_DEV),$(LIBSAIVS_DEV))) - -SONIC_ONLINE_DEBS += $(CENTEC_SAI) -SONIC_ONLINE_DEBS += $(CENTEC_SAI_DEV) From 1dec473495888f255db1f05b39422a0eaddfe9c5 Mon Sep 17 00:00:00 2001 From: Ikki Zhu <79439153+qnos@users.noreply.github.com> Date: Tue, 7 Feb 2023 01:27:46 +0800 Subject: [PATCH 095/113] [Celestica DX010] fix fan drawer and watchdog platform testcase issues (#13426) Why I did it fix DX010 fan drawer and watchdog platform test case issues How I did it 1. Add fan_drawer get_maximum_consumed_power support 2. Adjust maximum watchdog timeout value check How to verify it Run test_fan_drawer and test_watchdog test cases. --- .../sonic_platform/fan_drawer.py | 10 ++++++++++ .../x86_64-cel_seastone-r0/sonic_platform/watchdog.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/fan_drawer.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/fan_drawer.py index e35ecf65195a..0fa37fba86ce 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/fan_drawer.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/fan_drawer.py @@ -106,3 +106,13 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True + + def get_maximum_consumed_power(self): + """ + Retrives the maximum power drawn by Fan Drawer + + Returns: + A float, with value of the maximum consumable power of the + component. + """ + return 33.60 diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/watchdog.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/watchdog.py index 122b5d90ddb6..2bb8f2d57aa3 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/watchdog.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/watchdog.py @@ -135,7 +135,7 @@ def arm(self, seconds): ret = WDT_COMMON_ERROR if seconds < 0: return ret - if seconds > 16779: + if seconds > 16777: return ret From 68e1079202e33f44e941fb8ed0d73abcbd698607 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Mon, 6 Feb 2023 19:38:39 +0200 Subject: [PATCH 096/113] [FRR] Switch to dplane_fpm_nl plugin instead of fpm (#12852) Why I did it dplane_fpm_nl is a new FPM implementation in FRR. The old plugin fpm will not have any new features implemented. Usage of the new plugin gives us ability to use BGP suppression feature and next hop groups in the future. How I did it Switch to dplane_fpm_nl zebra plugin from old fpm plugin which is not supported anymore Remove stale patches for old fpm plugin and add similar patches for dplane_fpm_nl How to verify it Build and run on the switch. Signed-off-by: Stepan Blyschak --- dockers/docker-fpm-frr/docker_init.sh | 11 ++ .../frr/supervisord/supervisord.conf.j2 | 2 +- .../docker-fpm-frr/frr/zebra/zebra.conf.j2 | 7 + platform/vs/docker-sonic-vs/Dockerfile.j2 | 2 + platform/vs/docker-sonic-vs/frr/zebra.conf | 4 + .../vs/docker-sonic-vs/supervisord.conf.j2 | 2 +- .../tests/data/sonic-cfggen/zebra/zebra.conf | 6 + .../py2/t2-chassis-fe-vni-zebra.conf | 5 + .../py2/t2-chassis-fe-zebra.conf | 5 + .../tests/sample_output/py2/zebra_frr.conf | 5 + .../py3/t2-chassis-fe-vni-zebra.conf | 5 + .../py3/t2-chassis-fe-zebra.conf | 5 + .../tests/sample_output/py3/zebra_frr.conf | 5 + ...003-Use-vrf_id-for-vrf-not-tabled_id.patch | 61 +++++--- .../0007-Add-support-of-bgp-l3vni-evpn.patch | 148 +++++++----------- ...0009-ignore-route-from-default-table.patch | 78 ++++----- ...m-nl-to-allow-for-fast-configuration.patch | 62 ++++++++ src/sonic-frr/patch/series | 1 + 18 files changed, 250 insertions(+), 164 deletions(-) create mode 100644 platform/vs/docker-sonic-vs/frr/zebra.conf create mode 100644 src/sonic-frr/patch/0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch diff --git a/dockers/docker-fpm-frr/docker_init.sh b/dockers/docker-fpm-frr/docker_init.sh index 1f1bc511dc83..d8058e9b5d8d 100755 --- a/dockers/docker-fpm-frr/docker_init.sh +++ b/dockers/docker-fpm-frr/docker_init.sh @@ -41,6 +41,15 @@ update_default_gw() fi } +write_default_zebra_config() +{ + FILE_NAME=${1} + + grep -q '^no fpm use-next-hop-groups' $FILE_NAME || { + sed -i '1i no fpm use-next-hop-groups\nfpm address 127.0.0.1' $FILE_NAME + } +} + if [[ ! -z "$NAMESPACE_ID" ]]; then update_default_gw 4 update_default_gw 6 @@ -69,9 +78,11 @@ if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "separated" ]; then elif [ "$CONFIG_TYPE" == "split" ]; then echo "no service integrated-vtysh-config" > /etc/frr/vtysh.conf rm -f /etc/frr/frr.conf + write_default_zebra_config /etc/frr/zebra.conf elif [ "$CONFIG_TYPE" == "split-unified" ]; then echo "service integrated-vtysh-config" > /etc/frr/vtysh.conf rm -f /etc/frr/bgpd.conf /etc/frr/zebra.conf /etc/frr/staticd.conf + write_default_zebra_config /etc/frr/frr.conf elif [ "$CONFIG_TYPE" == "unified" ]; then CFGGEN_PARAMS=" \ -d \ diff --git a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 index 105c03345b48..e7312466051b 100644 --- a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 +++ b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 @@ -30,7 +30,7 @@ stderr_logfile=syslog dependent_startup=true [program:zebra] -command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm -M snmp +command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M dplane_fpm_nl -M snmp priority=4 autostart=false autorestart=false diff --git a/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 b/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 index 51d998e90d36..f5a56c316d41 100644 --- a/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 +++ b/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 @@ -6,6 +6,13 @@ ! {% endblock banner %} ! +{% block fpm %} +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +{% endblock fpm %} +! {% include "common/daemons.common.conf.j2" %} ! {% include "zebra.interfaces.conf.j2" %} diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 87b17e90332d..4f2b99c43777 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -206,6 +206,8 @@ RUN touch /etc/quagga/zebra.conf # disable integrated vtysh config RUN rm /etc/frr/frr.conf +COPY ["frr/zebra.conf", "/etc/frr/"] + # Create /var/warmboot/teamd folder for teammgrd RUN mkdir -p /var/warmboot/teamd diff --git a/platform/vs/docker-sonic-vs/frr/zebra.conf b/platform/vs/docker-sonic-vs/frr/zebra.conf new file mode 100644 index 000000000000..4c994e60def2 --- /dev/null +++ b/platform/vs/docker-sonic-vs/frr/zebra.conf @@ -0,0 +1,4 @@ +no fpm use-next-hop-groups + +fpm address 127.0.0.1 + diff --git a/platform/vs/docker-sonic-vs/supervisord.conf.j2 b/platform/vs/docker-sonic-vs/supervisord.conf.j2 index ba63d2b77dda..bfaac71d6302 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf.j2 +++ b/platform/vs/docker-sonic-vs/supervisord.conf.j2 @@ -164,7 +164,7 @@ environment=ASAN_OPTIONS="log_path=/var/log/asan/teammgrd-asan.log{{ asan_extra_ {% endif %} [program:zebra] -command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm +command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M dplane_fpm_nl priority=13 autostart=false autorestart=false diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf index ac2d8dac88f2..797b9c298267 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf @@ -3,6 +3,12 @@ ! generated by templates/zebra/zebra.conf.j2 using config DB data ! file: zebra.conf ! +! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname new_hostname diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf index fb441f69f6f0..b806cf44bb64 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname SpineFront01 diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf index 908280e2ddfa..5952bc836a71 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname SpineFront01 diff --git a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf index 4024f4b340e2..3643bcb8b1c5 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname switch-t0 diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf index 7b7987650d61..1b1aa992e2d4 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname SpineFront01 diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf index fc8a8a2fb3bf..65c43fd706b4 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname SpineFront01 diff --git a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf index f596c5579d3b..5661b25dac93 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname switch-t0 diff --git a/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch b/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch index f815cf38455e..68d4fd0d34d6 100644 --- a/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch +++ b/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch @@ -1,25 +1,48 @@ -From 39bb40dc4bad4462e4ae9c98580d75fa2c92e032 Mon Sep 17 00:00:00 2001 -From: Pavel Shirshov -Date: Mon, 16 Nov 2020 18:29:46 -0800 -Subject: [PATCH 3/8] Use vrf_id for vrf, not tabled_id +From 5dba497fb3810f9e5cb4b23bec151ec44d8dcec4 Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Mon, 16 Jan 2023 11:24:16 +0000 +Subject: [PATCH] Use vrf_id for vrf, not tabled_id +Signed-off-by: Stepan Blyschak --- - zebra/zebra_fpm_netlink.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + zebra/rt_netlink.c | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index ec22c5dd4..aad0156b3 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -287,7 +287,7 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd, - ri->nlmsg_pid = zvrf->zns->netlink_dplane_out.snl.nl_pid; +diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c +index 24c01b7f5..d4567990e 100644 +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -1969,12 +1969,24 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, + #endif + /* Table corresponding to this route. */ + table_id = dplane_ctx_get_table(ctx); +- if (table_id < 256) +- req->r.rtm_table = table_id; +- else { +- req->r.rtm_table = RT_TABLE_UNSPEC; +- if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, table_id)) +- return 0; ++ if (!fpm) { ++ if (table_id < 256) ++ req->r.rtm_table = table_id; ++ else { ++ req->r.rtm_table = RT_TABLE_UNSPEC; ++ if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, table_id)) ++ return 0; ++ } ++ } else { ++ /* Put vrf if_index instead of table id */ ++ vrf_id_t vrf = dplane_ctx_get_vrf(ctx); ++ if (vrf < 256) ++ req->r.rtm_table = vrf; ++ else { ++ req->r.rtm_table = RT_TABLE_UNSPEC; ++ if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, vrf)) ++ return 0; ++ } + } - ri->nlmsg_type = cmd; -- ri->rtm_table = table_info->table_id; -+ ri->rtm_table = zvrf_id(rib_dest_vrf(dest)); - ri->rtm_protocol = RTPROT_UNSPEC; - - /* + if (IS_ZEBRA_DEBUG_KERNEL) -- -2.12.2 +2.30.2 diff --git a/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch b/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch index 5097ad513ef0..5efd29fdcf09 100644 --- a/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch +++ b/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch @@ -1,39 +1,40 @@ -From 74ee34e4990dbd168b7b8072894eb0cf8927f9d1 Mon Sep 17 00:00:00 2001 -From: Kishore Kunal -Date: Fri, 15 Jan 2021 15:52:13 -0800 -Subject: [PATCH 7/8] This is temp patch till Prefix to ARP indirection is - add in neighorch +From 369bbb4d62aa47d5a6d5157ca6ea819c4cb80f15 Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Thu, 20 Oct 2022 13:19:31 +0000 +Subject: [PATCH 07/13] Added support of L3VNI EVPN +This is temp patch till Prefix to ARP indirection is add in neighorch + +Signed-off-by: Kishore Kunal +Signed-off-by: Stepan Blyschak --- - lib/nexthop.c | 2 ++ - lib/nexthop.h | 6 ++++++ - zebra/rt_netlink.c | 2 +- - zebra/zapi_msg.c | 4 ++++ - zebra/zebra_dplane.c | 1 + - zebra/zebra_fpm_netlink.c | 20 ++++++++++++++++++++ - 6 files changed, 34 insertions(+), 1 deletion(-) + lib/nexthop.c | 1 + + lib/nexthop.h | 7 ++++++- + zebra/rt_netlink.c | 15 ++++++++++++++- + zebra/zapi_msg.c | 4 ++++ + zebra/zebra_dplane.c | 2 +- + 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/nexthop.c b/lib/nexthop.c -index a1ce22e3b..6f3fe2a5f 100644 +index a1ce22e3b..10a87f072 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c -@@ -813,6 +813,8 @@ void nexthop_copy_no_recurse(struct nexthop *copy, +@@ -813,6 +813,7 @@ void nexthop_copy_no_recurse(struct nexthop *copy, memcpy(©->src, &nexthop->src, sizeof(nexthop->src)); memcpy(©->rmap_src, &nexthop->rmap_src, sizeof(nexthop->rmap_src)); copy->rparent = rparent; + memcpy(©->nh_encap.encap_data.rmac, &nexthop->nh_encap.encap_data.rmac, ETH_ALEN); -+ if (nexthop->nh_label) nexthop_add_labels(copy, nexthop->nh_label_type, nexthop->nh_label->num_labels, diff --git a/lib/nexthop.h b/lib/nexthop.h -index 320b46315..0f98dc3c2 100644 +index 320b46315..77eea3674 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -66,6 +66,11 @@ enum nh_encap_type { /* Backup index value is limited */ #define NEXTHOP_BACKUP_IDX_MAX 255 - + +struct vxlan_nh_encap { + vni_t vni; + struct ethaddr rmac; @@ -42,27 +43,50 @@ index 320b46315..0f98dc3c2 100644 /* Nexthop structure. */ struct nexthop { struct nexthop *next; -@@ -136,6 +141,7 @@ struct nexthop { +@@ -135,7 +140,7 @@ struct nexthop { + /* Encapsulation information. */ enum nh_encap_type nh_encap_type; union { - vni_t vni; +- vni_t vni; + struct vxlan_nh_encap encap_data; } nh_encap; - + /* SR-TE color used for matching SR-TE policies */ diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c -index 24c01b7f5..5e0f4cd8f 100644 +index 03c84d6dc..a56a95276 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c -@@ -1856,7 +1856,7 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, +@@ -1869,6 +1869,7 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, + struct nexthop *nh) + { + struct rtattr *nest; ++ struct vxlan_nh_encap* encap_data; + + switch (nh->nh_encap_type) { + case NET_VXLAN: +@@ -1879,9 +1880,21 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, + if (!nest) return false; - + ++ encap_data = &nh->nh_encap.encap_data; ++ if (!nl_attr_put32(n, nlen, 0 /* VXLAN_VNI */, - nh->nh_encap.vni)) -+ nh->nh_encap.encap_data.vni)) ++ encap_data->vni)) ++ return false; ++ ++ if (ZEBRA_DEBUG_KERNEL) ++ zlog_debug( ++ "%s: VNI:%d RMAC:%pEA", __func__, encap_data->vni, ++ &encap_data->rmac); ++ ++ if (!nl_attr_put(n, nlen, 1 /* VXLAN_RMAC */, ++ &encap_data->rmac, sizeof(encap_data->rmac))) return false; ++ nl_attr_nest_end(n, nest); break; + } diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 5cf7d815d..529cbb44b 100644 --- a/zebra/zapi_msg.c @@ -86,80 +110,18 @@ index 5cf7d815d..529cbb44b 100644 api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p); } diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c -index 656ebcf3b..8d125d77e 100644 +index 656ebcf3b..bd59df189 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c -@@ -2421,6 +2421,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, +@@ -2420,7 +2420,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + zl3vni = zl3vni_from_vrf(nexthop->vrf_id); if (zl3vni && is_l3vni_oper_up(zl3vni)) { nexthop->nh_encap_type = NET_VXLAN; - nexthop->nh_encap.vni = zl3vni->vni; +- nexthop->nh_encap.vni = zl3vni->vni; + nexthop->nh_encap.encap_data.vni = zl3vni->vni; } } - -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index aad0156b3..34be9fb39 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -95,10 +95,12 @@ static const char *fpm_nh_encap_type_to_str(enum fpm_nh_encap_type_t encap_type) - - struct vxlan_encap_info_t { - vni_t vni; -+ struct ethaddr rmac; - }; - - enum vxlan_encap_info_type_t { - VXLAN_VNI = 0, -+ VXLAN_RMAC = 1, - }; - - struct fpm_nh_encap_info_t { -@@ -234,6 +236,9 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri, - } - - nhi.encap_info.vxlan_encap.vni = vni; -+ memcpy(&nhi.encap_info.vxlan_encap.rmac, -+ &(nexthop->nh_encap.encap_data.rmac), -+ ETH_ALEN); - } - - /* -@@ -456,9 +461,16 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, - nl_attr_put16(&req->n, in_buf_len, RTA_ENCAP_TYPE, - encap); - vxlan = &nhi->encap_info.vxlan_encap; -+ char buf[ETHER_ADDR_STRLEN]; -+ -+ zfpm_debug( -+ "%s: VNI:%d RMAC:%s", __func__, vxlan->vni, -+ prefix_mac2str(&vxlan->rmac, buf, sizeof(buf))); - nest = nl_attr_nest(&req->n, in_buf_len, RTA_ENCAP); - nl_attr_put32(&req->n, in_buf_len, VXLAN_VNI, - vxlan->vni); -+ nl_attr_put(&req->n, in_buf_len, VXLAN_RMAC, -+ &vxlan->rmac, sizeof(vxlan->rmac)); - nl_attr_nest_end(&req->n, nest); - break; - } -@@ -494,10 +506,18 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, - nl_attr_put16(&req->n, in_buf_len, RTA_ENCAP_TYPE, - encap); - vxlan = &nhi->encap_info.vxlan_encap; -+ char rmac_buf[ETHER_ADDR_STRLEN]; -+ -+ zfpm_debug("%s: Multi VNI:%d RMAC:%s", __func__, -+ vxlan->vni, -+ prefix_mac2str(&vxlan->rmac, rmac_buf, -+ sizeof(rmac_buf))); - inner_nest = - nl_attr_nest(&req->n, in_buf_len, RTA_ENCAP); - nl_attr_put32(&req->n, in_buf_len, VXLAN_VNI, - vxlan->vni); -+ nl_attr_put(&req->n, in_buf_len, VXLAN_RMAC, -+ &vxlan->rmac, sizeof(vxlan->rmac)); - nl_attr_nest_end(&req->n, inner_nest); - break; - } --- -2.12.2 + +-- +2.30.2 diff --git a/src/sonic-frr/patch/0009-ignore-route-from-default-table.patch b/src/sonic-frr/patch/0009-ignore-route-from-default-table.patch index b90092446fe7..6af5bfc45783 100644 --- a/src/sonic-frr/patch/0009-ignore-route-from-default-table.patch +++ b/src/sonic-frr/patch/0009-ignore-route-from-default-table.patch @@ -1,54 +1,32 @@ -commit 8b78a43ba243df281f2096a84893ad87cb2a79ff -Author: Stephen Xu -Date: Wed Nov 16 16:07:37 2022 -0500 +From ca66350aecf7db3354019480d11754fabae3a97c Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Thu, 20 Oct 2022 13:07:18 +0000 +Subject: [PATCH 09/13] ignore route from default table - [PATCH] ignore route from default table +Signed-off-by: Stepan Blyschak +--- + zebra/dplane_fpm_nl.c | 9 +++++++++ + 1 file changed, 9 insertions(+) - Signed-off-by: Stephen Xu +diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c +index 3b02128c9..da8504adf 100644 +--- a/zebra/dplane_fpm_nl.c ++++ b/zebra/dplane_fpm_nl.c +@@ -699,6 +699,15 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx) + || op == DPLANE_OP_NH_UPDATE)) + return 0; -diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c -index 43958fdfd..de7e246d4 100644 ---- a/zebra/zebra_fpm.c -+++ b/zebra/zebra_fpm.c -@@ -25,6 +25,7 @@ - - #include "log.h" - #include "libfrr.h" -+#include "rib.h" - #include "stream.h" - #include "thread.h" - #include "network.h" -@@ -1016,8 +1017,15 @@ static int zfpm_build_route_updates(void) - else - zfpm_g->stats.route_dels++; - } else { -- zlog_err("%s: Encoding Prefix: %pRN No valid nexthops", -- __func__, dest->rnode); -+ struct rib_table_info *table_info = -+ rib_table_info(rib_dest_table(dest)); -+ if (table_info && table_info->table_id == RT_TABLE_DEFAULT) { -+ zfpm_debug("%s: Skip encoding default table prefix: %pRN", -+ __func__, dest->rnode); -+ } else { -+ zlog_err("%s: Encoding Prefix: %pRN No valid nexthops", -+ __func__, dest->rnode); -+ } - } - } - -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index ec22c5dd4..53e5f59fb 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -278,6 +278,11 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd, - rib_table_info(rib_dest_table(dest)); - struct zebra_vrf *zvrf = table_info->zvrf; - -+ if (table_info->table_id == RT_TABLE_DEFAULT) { -+ zfpm_debug("%s: Discard default table route", __func__); -+ return 0; -+ } ++ /* ++ * Ignore route from default table, because when mgmt port goes down, ++ * zebra will remove the default route and causing ASIC to blackhole IO. ++ */ ++ if (dplane_ctx_get_table(ctx) == RT_TABLE_DEFAULT) { ++ zlog_debug("%s: discard default table route", __func__); ++ return 0; ++ } + - memset(ri, 0, sizeof(*ri)); - - ri->prefix = rib_dest_prefix(dest); + nl_buf_len = 0; + + frr_mutex_lock_autounlock(&fnc->obuf_mutex); +-- +2.30.2 diff --git a/src/sonic-frr/patch/0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch b/src/sonic-frr/patch/0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch new file mode 100644 index 000000000000..9a412d24ee86 --- /dev/null +++ b/src/sonic-frr/patch/0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch @@ -0,0 +1,62 @@ +From 551fa8c3549e24020dfce33d06ade4a14f72abfe Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Mon, 14 Nov 2022 08:28:45 -0500 +Subject: [PATCH] zebra: Fix dplane_fpm_nl to allow for fast configuration + +If you have this order in your configuration file: + +no fpm use-next-hop-groups +fpm address 127.0.0.1 + +the dplane code was using the same event thread t_event and the second +add event in the code was going, you already have an event scheduled +and as such the second event does not overwrite it. Leaving +no code to actually start the whole processing. There are probably +other cli iterations that will cause this fun as well, but I'm +not going to spend the time sussing them out at the moment. + +Fixes: #12314 +Signed-off-by: Donald Sharp +--- + zebra/dplane_fpm_nl.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c +index 7383c982baa..c5e1c113cb0 100644 +--- a/zebra/dplane_fpm_nl.c ++++ b/zebra/dplane_fpm_nl.c +@@ -98,6 +98,7 @@ struct fpm_nl_ctx { + struct thread *t_read; + struct thread *t_write; + struct thread *t_event; ++ struct thread *t_nhg; + struct thread *t_dequeue; + + /* zebra events. */ +@@ -271,7 +272,7 @@ DEFUN(fpm_use_nhg, fpm_use_nhg_cmd, + return CMD_SUCCESS; + + thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, +- FNE_TOGGLE_NHG, &gfnc->t_event); ++ FNE_TOGGLE_NHG, &gfnc->t_nhg); + + return CMD_SUCCESS; + } +@@ -287,7 +288,7 @@ DEFUN(no_fpm_use_nhg, no_fpm_use_nhg_cmd, + return CMD_SUCCESS; + + thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, +- FNE_TOGGLE_NHG, &gfnc->t_event); ++ FNE_TOGGLE_NHG, &gfnc->t_nhg); + + return CMD_SUCCESS; + } +@@ -1367,6 +1368,8 @@ static int fpm_nl_finish_early(struct fpm_nl_ctx *fnc) + THREAD_OFF(fnc->t_ribwalk); + THREAD_OFF(fnc->t_rmacreset); + THREAD_OFF(fnc->t_rmacwalk); ++ THREAD_OFF(fnc->t_event); ++ THREAD_OFF(fnc->t_nhg); + thread_cancel_async(fnc->fthread->master, &fnc->t_read, NULL); + thread_cancel_async(fnc->fthread->master, &fnc->t_write, NULL); + thread_cancel_async(fnc->fthread->master, &fnc->t_connect, NULL); diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index d7d7046ee6f5..01197120ef2b 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -12,3 +12,4 @@ cross-compile-changes.patch 0010-zebra-Note-when-the-netlink-DUMP-command-is-interrup.patch 0011-bgpd-enhanced-capability-is-always-turned-on-for-int.patch 0012-Ensure-ospf_apiclient_lsa_originate-cannot-accidently-write-into-stack.patch +0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch From 8fdbf9dce3eb89995acec59a6be80ea697535fc2 Mon Sep 17 00:00:00 2001 From: arunlk-dell <83708154+arunlk-dell@users.noreply.github.com> Date: Mon, 6 Feb 2023 23:21:00 +0530 Subject: [PATCH 097/113] [devices]: DellEMC: Add platform_env.conf for Z9432F platform (#13003) Added the platform specific non-default values. --- device/dell/x86_64-dellemc_z9432f_c3758-r0/platform_env.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 device/dell/x86_64-dellemc_z9432f_c3758-r0/platform_env.conf diff --git a/device/dell/x86_64-dellemc_z9432f_c3758-r0/platform_env.conf b/device/dell/x86_64-dellemc_z9432f_c3758-r0/platform_env.conf new file mode 100644 index 000000000000..d72ffde2f262 --- /dev/null +++ b/device/dell/x86_64-dellemc_z9432f_c3758-r0/platform_env.conf @@ -0,0 +1,2 @@ +SYNCD_SHM_SIZE=256m +is_ltsw_chip=1 From 5ff5e984379ffee50d595e444df93207e1d0f2c2 Mon Sep 17 00:00:00 2001 From: Dmytro Lytvynenko Date: Mon, 6 Feb 2023 19:52:28 +0200 Subject: [PATCH 098/113] [BFN] Update psu.py to process sigterm signal (#13350) Why I did it Sometime, SIGTERM processing by psud takes more then default 10sec (please see stopwaitsecs in http://supervisord.org/configuration.html). Due to this, the following two testcases may fail: test_pmon_psud_stop_and_start_status test_pmon_psud_term_and_start_status How I did it Update PSU plugin to process sigterm signal so that psud runs faster to end last cycle in time How to verify it Run SONiC CTs: test_pmon_psud_stop_and_start_status test_pmon_psud_term_and_start_status --- .../sonic_platform/platform_utils.py | 7 +++- .../sonic_platform/psu.py | 35 ++++++++++++++++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_utils.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_utils.py index 2f7b5aecb6d0..f257c2b17a89 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_utils.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_utils.py @@ -9,6 +9,8 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") +SIGTERM_CAUGHT = False + def file_create(path, mode=None): """ Ensure that file is created with the appropriate permissions @@ -38,13 +40,16 @@ def wrapper(*args, **kwargs): def handler(sig, frame): if sigterm_handler: sigterm_handler(sig, frame) + global SIGTERM_CAUGHT + SIGTERM_CAUGHT = True raise Exception("Canceling {}() execution...".format(func.__name__)) sigterm_handler = signal.getsignal(signal.SIGTERM) signal.signal(signal.SIGTERM, handler) result = None try: - result = func(*args, **kwargs) + if not SIGTERM_CAUGHT: + result = func(*args, **kwargs) finally: signal.signal(signal.SIGTERM, sigterm_handler) return result diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py index 435452959780..d065104d2d5e 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py @@ -28,6 +28,13 @@ class Psu(PsuBase): __sensors_info = None __timestamp = 0 + # When psud gets termination signal it starts processing last cycle. + # This cycle must be as fast as possible to be able to stop correctly, + # otherwise it will be killed, so the whole plugin must encounter + # this signal to process operations based on state, where the + # state is "termination signal got" and "no termination signal" + + # State is "no termination signal" sigterm = False sigterm_default_handler = None cls_inited = False @@ -54,12 +61,15 @@ def signal_handler(cls, sig, frame): if cls.sigterm_default_handler: cls.sigterm_default_handler(sig, frame) syslog.syslog(syslog.LOG_INFO, "Canceling PSU platform API calls...") + # Changing state to "termination signal" cls.sigterm = True @classmethod def __sensors_get(cls, cached=True): cls.__lock.acquire() - if time.time() > cls.__timestamp + 15: + # Operation may take a few seconds to process, so if state is + # "termination signal", plugin doesn't perform this operation + if time.time() > cls.__timestamp + 15 and not Psu.sigterm: # Update cache once per 15 seconds try: cls.__sensors_info = get_psu_metrics() @@ -83,6 +93,8 @@ def __info_get(self): def psu_info_get(client): return client.pltfm_mgr.pltfm_mgr_pwr_supply_info_get(self.__index) + # Operation may take a few seconds to process, so if state is + # "termination signal", plugin doesn't perform this operation # Update cache once per 2 seconds if self.__ts + 2 < time.time() and not Psu.sigterm: self.__info = None @@ -96,6 +108,10 @@ def psu_info_get(client): return self.__info return self.__info + @cancel_on_sigterm + def get_metric_value(self, metric_name): + return get_metric_value(Psu.__sensors_get(), "PSU%d ".format(self.__index) + metric_name) + @staticmethod def get_num_psus(): """ @@ -127,7 +143,7 @@ def get_voltage(self): A float number, the output voltage in volts, e.g. 12.1 """ - return get_metric_value(Psu.__sensors_get(), "PSU%d 12V Output Voltage_in1_input" % self.__index) + return self.get_metric_value("12V Output Voltage_in1_input") def get_current(self): """ @@ -136,7 +152,7 @@ def get_current(self): Returns: A float number, the electric current in amperes, e.g 15.4 """ - return get_metric_value(Psu.__sensors_get(), "PSU%d 12V Output Current_curr2_input" % self.__index) + return self.get_metric_value("12V Output Current_curr2_input") def get_input_voltage(self): """ @@ -145,7 +161,7 @@ def get_input_voltage(self): A float number, the input voltage in volts, e.g. 220 """ - return get_metric_value(Psu.__sensors_get(), "PSU%d Input Voltage_in0_input" % self.__index) + return self.get_metric_value("Input Voltage_in0_input") def get_input_current(self): """ @@ -153,7 +169,7 @@ def get_input_current(self): Returns: A float number, the electric current in amperes, e.g 0.8 """ - return get_metric_value(Psu.__sensors_get(), "PSU%d Input Current_curr1_input" % self.__index) + return self.get_metric_value("Input Current_curr1_input") def get_power(self): """ @@ -177,6 +193,9 @@ def psu_present_get(client): return client.pltfm_mgr.pltfm_mgr_pwr_supply_present_get(self.__index) status = False + if Psu.sigterm: + return status + try: status = thrift_try(psu_present_get, attempts=1) except Exception as e: @@ -267,6 +286,7 @@ def get_position_in_parent(self): """ return self.__index + @cancel_on_sigterm def get_temperature(self): """ Retrieves current temperature reading from PSU @@ -274,8 +294,11 @@ def get_temperature(self): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ + # Operation may take a few seconds to process, so if state is + # "termination signal", plugin doesn't perform this operation return self.get_thermal(0).get_temperature() + @cancel_on_sigterm def get_temperature_high_threshold(self): """ Retrieves the high threshold temperature of PSU @@ -283,6 +306,8 @@ def get_temperature_high_threshold(self): A float number, the high threshold temperature of PSU in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ + # Operation may take a few seconds to process, so if state is + # "termination signal", plugin doesn't perform this operation return self.get_thermal(0).get_high_threshold() @property From 346576bcf4ef716f736c3e2d8ccc5dcacabfc094 Mon Sep 17 00:00:00 2001 From: Dmytro Lytvynenko Date: Mon, 6 Feb 2023 19:54:43 +0200 Subject: [PATCH 099/113] [BFN] Remove not common entries from pcie yaml configuration (#12816) Why I did it Default pcieutil uses one configuration for all models of platform How I did it Take the configuration file as base for all models of concrete platform where model-specific devices are not listed in this configuration How to verify it Run pmon#pcied and verify that there is no error/warning logs on initialization step --- device/barefoot/x86_64-accton_as9516_32d-r0/pcie.yaml | 11 ----------- .../x86_64-accton_wedge100bf_32x-r0/pcie.yaml | 10 ---------- 2 files changed, 21 deletions(-) diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/pcie.yaml b/device/barefoot/x86_64-accton_as9516_32d-r0/pcie.yaml index c45064a9f73c..c524c88087ad 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/pcie.yaml +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/pcie.yaml @@ -100,12 +100,6 @@ id: 8c22 name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)' -- bus: '02' - dev: '00' - fn: '0' - id: '1533' - name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev - 03)' - bus: '03' dev: '00' fn: '0' @@ -140,11 +134,6 @@ fn: '1' id: 15ab name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' -- bus: '06' - dev: '00' - fn: '0' - id: '0100' - name: 'Ethernet controller: Device 1d1c:0100' - bus: '07' dev: '00' fn: '0' diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/pcie.yaml b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/pcie.yaml index ab38096c9740..a4d703266ad7 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/pcie.yaml +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/pcie.yaml @@ -124,16 +124,6 @@ id: 6f53 name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology Register DMA Channel 3' -- bus: '04' - dev: '00' - fn: '0' - id: 10a6 - name: 'Unassigned class [ff00]: Intel Corporation 82599EB 10-Gigabit Dummy Function' -- bus: '05' - dev: '00' - fn: '0' - id: '0010' - name: 'Unassigned class [ff00]: Device 1d1c:0010 (rev 10)' - bus: ff dev: 0b fn: '0' From 0704ff5e6c27f8e189be00d082e7e4cc6e8eb184 Mon Sep 17 00:00:00 2001 From: FuzailBrcm <51665572+FuzailBrcm@users.noreply.github.com> Date: Tue, 7 Feb 2023 03:18:31 +0530 Subject: [PATCH 100/113] [pddf]: Adding support for FPGAPCIe in PDDF (#13476) Why I did it Some of the platform vendors use FPGA in the HW design. This FPGA is connected to the CPU via PCIe interface. This FPGA also works as an I2C controller having other devices attached to the I2C channels emanating from it. Adding a common module, a driver and a platform specific algorithm module to be used for such FPGA in PDDF. How I did it Added 'pddf_fpgapci_module', 'pddf_fpgapci_driver' and a sample algorithm module for Xilinx device 7021. Kernel modules which takes the platform dependent data from PDDF JSON files and initialises the PCIe FPGA. The sample algorithm module can be used by the ODMs in case the communication algorithms are same for their device. Else, they need to come up with similar algo module. How to verify it Any platform having such an FPGA and brought up using PDDF would use these kernel modules. The detail representation of such a device in PDDF JSON file is covered in the HLD. --- platform/pddf/i2c/debian/rules | 2 +- platform/pddf/i2c/modules/Makefile | 2 +- platform/pddf/i2c/modules/fpgapci/Makefile | 4 + .../pddf/i2c/modules/fpgapci/algos/Makefile | 4 + .../algos/pddf_xilinx_device_7021_algo.c | 417 ++++++++++++++++++ .../pddf/i2c/modules/fpgapci/driver/Makefile | 4 + .../fpgapci/driver/pddf_fpgapci_driver.c | 352 +++++++++++++++ .../i2c/modules/fpgapci/pddf_fpgapci_module.c | 142 ++++++ .../i2c/modules/include/pddf_client_defs.h | 2 + .../i2c/modules/include/pddf_fpgapci_defs.h | 49 ++ .../pddf/i2c/modules/include/pddf_i2c_algo.h | 36 ++ 11 files changed, 1012 insertions(+), 2 deletions(-) create mode 100644 platform/pddf/i2c/modules/fpgapci/Makefile create mode 100644 platform/pddf/i2c/modules/fpgapci/algos/Makefile create mode 100644 platform/pddf/i2c/modules/fpgapci/algos/pddf_xilinx_device_7021_algo.c create mode 100644 platform/pddf/i2c/modules/fpgapci/driver/Makefile create mode 100644 platform/pddf/i2c/modules/fpgapci/driver/pddf_fpgapci_driver.c create mode 100644 platform/pddf/i2c/modules/fpgapci/pddf_fpgapci_module.c create mode 100644 platform/pddf/i2c/modules/include/pddf_fpgapci_defs.h create mode 100644 platform/pddf/i2c/modules/include/pddf_i2c_algo.h diff --git a/platform/pddf/i2c/debian/rules b/platform/pddf/i2c/debian/rules index 3e0bb7c4ffc9..4ddbbdfd2405 100755 --- a/platform/pddf/i2c/debian/rules +++ b/platform/pddf/i2c/debian/rules @@ -18,7 +18,7 @@ PACKAGE_PRE_NAME := sonic-platform-pddf KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= client cpld cpld/driver cpldmux cpldmux/driver fpgai2c fpgai2c/driver fan fan/driver mux gpio led psu psu/driver sysstatus xcvr xcvr/driver +MODULE_DIRS:= client cpld cpld/driver cpldmux cpldmux/driver fpgai2c fpgai2c/driver fpgapci fpgapci/driver fpgapci/algos fan fan/driver mux gpio led psu psu/driver sysstatus xcvr xcvr/driver MODULE_DIR:= modules UTILS_DIR := utils SERVICE_DIR := service diff --git a/platform/pddf/i2c/modules/Makefile b/platform/pddf/i2c/modules/Makefile index 71c1db661367..a936ff9756c3 100644 --- a/platform/pddf/i2c/modules/Makefile +++ b/platform/pddf/i2c/modules/Makefile @@ -1 +1 @@ -obj-m := client/ cpld/ cpldmux/ fpgai2c/ xcvr/ mux/ gpio/ psu/ fan/ led/ sysstatus/ +obj-m := client/ cpld/ cpldmux/ fpgai2c/ fpgapci/ xcvr/ mux/ gpio/ psu/ fan/ led/ sysstatus/ diff --git a/platform/pddf/i2c/modules/fpgapci/Makefile b/platform/pddf/i2c/modules/fpgapci/Makefile new file mode 100644 index 000000000000..12b9830cef77 --- /dev/null +++ b/platform/pddf/i2c/modules/fpgapci/Makefile @@ -0,0 +1,4 @@ +obj-m := driver/ algos/ +obj-m += pddf_fpgapci_module.o + +ccflags-y:= -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/fpgapci/algos/Makefile b/platform/pddf/i2c/modules/fpgapci/algos/Makefile new file mode 100644 index 000000000000..91d6954711fb --- /dev/null +++ b/platform/pddf/i2c/modules/fpgapci/algos/Makefile @@ -0,0 +1,4 @@ +# Sample driver for Xilinx 7021 FPGA device +obj-m += pddf_xilinx_device_7021_algo.o + +ccflags-y := -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/fpgapci/algos/pddf_xilinx_device_7021_algo.c b/platform/pddf/i2c/modules/fpgapci/algos/pddf_xilinx_device_7021_algo.c new file mode 100644 index 000000000000..dc2f52bf16c3 --- /dev/null +++ b/platform/pddf/i2c/modules/fpgapci/algos/pddf_xilinx_device_7021_algo.c @@ -0,0 +1,417 @@ +/* +* +* Licensed under the GNU General Public License Version 2 +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +/* +* pddf_xilinx_device_7021_algo.c +* Description: +* A sample i2c driver algorithms for Xilinx Corporation Device 7021 FPGA adapters +* +*********************************************************************************/ +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include "pddf_i2c_algo.h" + +#define DEBUG 0 + +enum { + STATE_DONE = 0, + STATE_INIT, + STATE_ADDR, + STATE_ADDR10, + STATE_START, + STATE_WRITE, + STATE_READ, + STATE_STOP, + STATE_ERROR, +}; + +/* registers */ +#define FPGAI2C_REG_PRELOW 0 +#define FPGAI2C_REG_PREHIGH 1 +#define FPGAI2C_REG_CONTROL 2 +#define FPGAI2C_REG_DATA 3 +#define FPGAI2C_REG_CMD 4 /* write only */ +#define FPGAI2C_REG_STATUS 4 /* read only, same address as FPGAI2C_REG_CMD */ +#define FPGAI2C_REG_VER 5 + +#define FPGAI2C_REG_CTRL_IEN 0x40 +#define FPGAI2C_REG_CTRL_EN 0x80 + +#define FPGAI2C_REG_CMD_START 0x91 +#define FPGAI2C_REG_CMD_STOP 0x41 +#define FPGAI2C_REG_CMD_READ 0x21 +#define FPGAI2C_REG_CMD_WRITE 0x11 +#define FPGAI2C_REG_CMD_READ_ACK 0x21 +#define FPGAI2C_REG_CMD_READ_NACK 0x29 +#define FPGAI2C_REG_CMD_IACK 0x01 + +#define FPGAI2C_REG_STAT_IF 0x01 +#define FPGAI2C_REG_STAT_TIP 0x02 +#define FPGAI2C_REG_STAT_ARBLOST 0x20 +#define FPGAI2C_REG_STAT_BUSY 0x40 +#define FPGAI2C_REG_STAT_NACK 0x80 + +struct fpgalogic_i2c { + void __iomem *base; + u32 reg_shift; + u32 reg_io_width; + wait_queue_head_t wait; + struct i2c_msg *msg; + int pos; + int nmsgs; + int state; /* see STATE_ */ + int ip_clock_khz; + int bus_clock_khz; + void (*reg_set)(struct fpgalogic_i2c *i2c, int reg, u8 value); + u8 (*reg_get)(struct fpgalogic_i2c *i2c, int reg); + u32 timeout; + struct mutex lock; +}; +static struct fpgalogic_i2c fpgalogic_i2c[I2C_PCI_MAX_BUS]; +extern void __iomem * fpga_ctl_addr; +extern int (*ptr_fpgapci_read)(uint32_t); +extern int (*ptr_fpgapci_write)(uint32_t, uint32_t); +extern int (*pddf_i2c_pci_add_numbered_bus)(struct i2c_adapter *, int); + +void i2c_get_mutex(struct fpgalogic_i2c *i2c) +{ + mutex_lock(&i2c->lock); +} + +/** + * i2c_release_mutex - release mutex + */ +void i2c_release_mutex(struct fpgalogic_i2c *i2c) +{ + mutex_unlock(&i2c->lock); +} + +static void fpgai2c_reg_set_8(struct fpgalogic_i2c *i2c, int reg, u8 value) +{ + iowrite8(value, i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 fpgai2c_reg_get_8(struct fpgalogic_i2c *i2c, int reg) +{ + return ioread8(i2c->base + (reg << i2c->reg_shift)); +} + +static inline void fpgai2c_reg_set(struct fpgalogic_i2c *i2c, int reg, u8 value) +{ + i2c->reg_set(i2c, reg, value); + udelay(100); +} + +static inline u8 fpgai2c_reg_get(struct fpgalogic_i2c *i2c, int reg) +{ + udelay(100); + return i2c->reg_get(i2c, reg); +} + + +/* + * i2c_get_mutex must be called prior to calling this function. + */ +static int fpgai2c_poll(struct fpgalogic_i2c *i2c) +{ + u8 stat = fpgai2c_reg_get(i2c, FPGAI2C_REG_STATUS); + struct i2c_msg *msg = i2c->msg; + u8 addr; + + /* Ready? */ + if (stat & FPGAI2C_REG_STAT_TIP) + return -EBUSY; + + if (i2c->state == STATE_DONE || i2c->state == STATE_ERROR) { + /* Stop has been sent */ + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK); + if (i2c->state == STATE_ERROR) + return -EIO; + return 0; + } + + /* Error? */ + if (stat & FPGAI2C_REG_STAT_ARBLOST) { + i2c->state = STATE_ERROR; + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_STOP); + return -EAGAIN; + } + + if (i2c->state == STATE_INIT) { + if (stat & FPGAI2C_REG_STAT_BUSY) + return -EBUSY; + + i2c->state = STATE_ADDR; + } + + if (i2c->state == STATE_ADDR) { + /* 10 bit address? */ + if (i2c->msg->flags & I2C_M_TEN) { + addr = 0xf0 | ((i2c->msg->addr >> 7) & 0x6); + i2c->state = STATE_ADDR10; + } else { + addr = (i2c->msg->addr << 1); + i2c->state = STATE_START; + } + + /* Set read bit if necessary */ + addr |= (i2c->msg->flags & I2C_M_RD) ? 1 : 0; + + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, addr); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_START); + + return 0; + } + + /* Second part of 10 bit addressing */ + if (i2c->state == STATE_ADDR10) { + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, i2c->msg->addr & 0xff); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_WRITE); + + i2c->state = STATE_START; + return 0; + } + + if (i2c->state == STATE_START || i2c->state == STATE_WRITE) { + i2c->state = (msg->flags & I2C_M_RD) ? STATE_READ : STATE_WRITE; + + if (stat & FPGAI2C_REG_STAT_NACK) { + i2c->state = STATE_ERROR; + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_STOP); + return -ENXIO; + } + } else { + msg->buf[i2c->pos++] = fpgai2c_reg_get(i2c, FPGAI2C_REG_DATA); + } + if (i2c->pos >= msg->len) { + i2c->nmsgs--; + i2c->msg++; + i2c->pos = 0; + msg = i2c->msg; + + if (i2c->nmsgs) { + if (!(msg->flags & I2C_M_NOSTART)) { + i2c->state = STATE_ADDR; + return 0; + } else { + i2c->state = (msg->flags & I2C_M_RD) + ? STATE_READ : STATE_WRITE; + } + } else { + i2c->state = STATE_DONE; + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_STOP); + return 0; + } + } + + if (i2c->state == STATE_READ) { + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, i2c->pos == (msg->len - 1) ? + FPGAI2C_REG_CMD_READ_NACK : FPGAI2C_REG_CMD_READ_ACK); + } else { + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, msg->buf[i2c->pos++]); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_WRITE); + } + + return 0; +} + +static int fpgai2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + struct fpgalogic_i2c *i2c = i2c_get_adapdata(adap); + int ret; + unsigned long timeout = jiffies + msecs_to_jiffies(1000); + + i2c->msg = msgs; + i2c->pos = 0; + i2c->nmsgs = num; + i2c->state = STATE_INIT; + + /* Handle the transfer */ + while (time_before(jiffies, timeout)) { + i2c_get_mutex(i2c); + ret = fpgai2c_poll(i2c); + i2c_release_mutex(i2c); + + if (i2c->state == STATE_DONE || i2c->state == STATE_ERROR) + return (i2c->state == STATE_DONE) ? num : ret; + + if (ret == 0) + timeout = jiffies + HZ; + + usleep_range(5, 15); + } + printk("[%s] ERROR STATE_ERROR\n", __FUNCTION__); + + i2c->state = STATE_ERROR; + + return -ETIMEDOUT; + +} + +static u32 fpgai2c_func(struct i2c_adapter *adap) +{ +/* a typical full-I2C adapter would use the following */ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; +} + +static const struct i2c_algorithm fpgai2c_algorithm= { + .master_xfer = fpgai2c_xfer, /*write I2C messages */ + .functionality = fpgai2c_func, /* what the adapter supports */ +}; + +static int fpgai2c_init(struct fpgalogic_i2c *i2c) +{ + int prescale; + int diff; + u8 ctrl; + + i2c->reg_set = fpgai2c_reg_set_8; + i2c->reg_get = fpgai2c_reg_get_8; + + ctrl = fpgai2c_reg_get(i2c, FPGAI2C_REG_CONTROL); + /* make sure the device is disabled */ + fpgai2c_reg_set(i2c, FPGAI2C_REG_CONTROL, ctrl & ~(FPGAI2C_REG_CTRL_EN|FPGAI2C_REG_CTRL_IEN)); + + /* + * I2C Frequency depends on host clock + * input clock of 100MHz + * prescale to 100MHz / ( 5*100kHz) -1 = 199 = 0x4F 100000/(5*100)-1=199=0xc7 + */ + prescale = (i2c->ip_clock_khz / (5 * i2c->bus_clock_khz)) - 1; + prescale = clamp(prescale, 0, 0xffff); + + diff = i2c->ip_clock_khz / (5 * (prescale + 1)) - i2c->bus_clock_khz; + if (abs(diff) > i2c->bus_clock_khz / 10) { + printk("[%s] ERROR Unsupported clock settings: core: %d KHz, bus: %d KHz\n", + __FUNCTION__, i2c->ip_clock_khz, i2c->bus_clock_khz); + return -EINVAL; + } + + fpgai2c_reg_set(i2c, FPGAI2C_REG_PRELOW, prescale & 0xff); + fpgai2c_reg_set(i2c, FPGAI2C_REG_PREHIGH, prescale >> 8); + + /* Init the device */ + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CONTROL, ctrl | FPGAI2C_REG_CTRL_EN); + + /* Initialize interrupt handlers if not already done */ + init_waitqueue_head(&i2c->wait); + return 0; +} + +static int adap_data_init(struct i2c_adapter *adap, int i2c_ch_index) +{ + struct fpgapci_devdata *pci_privdata = 0; + pci_privdata = (struct fpgapci_devdata*) dev_get_drvdata(adap->dev.parent); + + if (pci_privdata == 0) { + printk("[%s]: ERROR pci_privdata is 0\n", __FUNCTION__); + return -1; + } +#if DEBUG + pddf_dbg(FPGA, KERN_INFO "[%s] index: [%d] fpga_data__base_addr:0x%0x8lx" + " fpgapci_bar_len:0x%08lx fpga_i2c_ch_base_addr:0x%08lx ch_size=0x%x supported_i2c_ch=%d", + __FUNCTION__, i2c_ch_index, pci_privdata->fpga_data_base_addr, + pci_privdata->bar_length, pci_privdata->fpga_i2c_ch_base_addr, + pci_privdata->fpga_i2c_ch_size, pci_privdata->max_fpga_i2c_ch); +#endif + if (i2c_ch_index >= pci_privdata->max_fpga_i2c_ch || pci_privdata->max_fpga_i2c_ch > I2C_PCI_MAX_BUS) { + printk("[%s]: ERROR i2c_ch_index=%d max_ch_index=%d out of range: %d\n", + __FUNCTION__, i2c_ch_index, pci_privdata->max_fpga_i2c_ch, I2C_PCI_MAX_BUS); + return -1; + } +#ifdef __STDC_LIB_EXT1__ + memset_s(&fpgalogic_i2c[i2c_ch_index], sizeof(fpgalogic_i2c[0]), 0, sizeof(fpgalogic_i2c[0])); +#else + memset(&fpgalogic_i2c[i2c_ch_index], 0, sizeof(fpgalogic_i2c[0])); +#endif + /* Initialize driver's itnernal data structures */ + fpgalogic_i2c[i2c_ch_index].reg_shift = 0; /* 8 bit registers */ + fpgalogic_i2c[i2c_ch_index].reg_io_width = 1; /* 8 bit read/write */ + fpgalogic_i2c[i2c_ch_index].timeout = 500;//1000;//1ms + fpgalogic_i2c[i2c_ch_index].ip_clock_khz = 100000;//100000;/* input clock of 100MHz */ + fpgalogic_i2c[i2c_ch_index].bus_clock_khz = 100; + fpgalogic_i2c[i2c_ch_index].base = pci_privdata->fpga_i2c_ch_base_addr + + i2c_ch_index* pci_privdata->fpga_i2c_ch_size; + mutex_init(&fpgalogic_i2c[i2c_ch_index].lock); + fpgai2c_init(&fpgalogic_i2c[i2c_ch_index]); + + + adap->algo_data = &fpgalogic_i2c[i2c_ch_index]; + i2c_set_adapdata(adap, &fpgalogic_i2c[i2c_ch_index]); + return 0; +} + +static int pddf_i2c_pci_add_numbered_bus_default (struct i2c_adapter *adap, int i2c_ch_index) +{ + int ret = 0; + + adap_data_init(adap, i2c_ch_index); + adap->algo = &fpgai2c_algorithm; + + ret = i2c_add_numbered_adapter(adap); + return ret; +} + +/* + * FPGAPCI APIs + */ +int board_i2c_fpgapci_read(uint32_t offset) +{ + int data; + data=ioread32(fpga_ctl_addr+offset); + return data; +} + + +int board_i2c_fpgapci_write(uint32_t offset, uint32_t value) +{ + iowrite32(value, fpga_ctl_addr+offset); + return (0); +} + + +static int __init pddf_xilinx_device_7021_algo_init(void) +{ + pddf_dbg(FPGA, KERN_INFO "[%s]\n", __FUNCTION__); + pddf_i2c_pci_add_numbered_bus = pddf_i2c_pci_add_numbered_bus_default; + ptr_fpgapci_read = board_i2c_fpgapci_read; + ptr_fpgapci_write = board_i2c_fpgapci_write; + return 0; +} + +static void __exit pddf_xilinx_device_7021_algo_exit(void) +{ + pddf_dbg(FPGA, KERN_INFO "[%s]\n", __FUNCTION__); + + pddf_i2c_pci_add_numbered_bus = NULL; + ptr_fpgapci_read = NULL; + ptr_fpgapci_write = NULL; + return; +} + + +module_init (pddf_xilinx_device_7021_algo_init); +module_exit (pddf_xilinx_device_7021_algo_exit); +MODULE_DESCRIPTION("Xilinx Corporation Device 7021 FPGAPCIe I2C-Bus algorithm"); +MODULE_LICENSE("GPL"); diff --git a/platform/pddf/i2c/modules/fpgapci/driver/Makefile b/platform/pddf/i2c/modules/fpgapci/driver/Makefile new file mode 100644 index 000000000000..1ea8b612734f --- /dev/null +++ b/platform/pddf/i2c/modules/fpgapci/driver/Makefile @@ -0,0 +1,4 @@ +TARGET = pddf_fpgapci_driver +obj-m := $(TARGET).o + +ccflags-y := -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/fpgapci/driver/pddf_fpgapci_driver.c b/platform/pddf/i2c/modules/fpgapci/driver/pddf_fpgapci_driver.c new file mode 100644 index 000000000000..630981522b15 --- /dev/null +++ b/platform/pddf/i2c/modules/fpgapci/driver/pddf_fpgapci_driver.c @@ -0,0 +1,352 @@ +/* +* +* Licensed under the GNU General Public License Version 2 +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +/* +* pddf_fpgapci_driver.c +* Description: +* This is a PDDF FPGAPCIe driver whic creates the PCIE device and add +* the i2c adapters to it. It uses the adapter creation and fpgapcie +* read/write functions defined separately in another kernel module. +* +************************************************************************/ +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //siginfo +#include //rcu_read_lock +#include //kernel_version +#include +#include +#include +#include +#include +#include "pddf_fpgapci_defs.h" +#include "pddf_client_defs.h" +#include "pddf_i2c_algo.h" + + + +#define DEBUG 0 +int (*pddf_i2c_pci_add_numbered_bus)(struct i2c_adapter *, int) = NULL; +int (*ptr_fpgapci_read)(uint32_t) = NULL; +int (*ptr_fpgapci_write)(uint32_t, uint32_t) = NULL; +EXPORT_SYMBOL(pddf_i2c_pci_add_numbered_bus); +EXPORT_SYMBOL(ptr_fpgapci_read); +EXPORT_SYMBOL(ptr_fpgapci_write); + +FPGA_OPS_DATA pddf_fpga_ops_data={0}; + +#define DRIVER_NAME "pddf_fpgapci" +#define MAX_PCI_NUM_BARS 6 + +struct pci_driver pddf_fpgapci_driver; +struct pci_device_id *pddf_fpgapci_ids=NULL; +int total_i2c_pci_bus=0; +int FPGAPCI_BAR_INDEX = -1; + +void __iomem * fpga_ctl_addr = NULL; +EXPORT_SYMBOL(fpga_ctl_addr); + +static int pddf_fpgapci_probe(struct pci_dev *dev, const struct pci_device_id *id); +static void pddf_fpgapci_remove(struct pci_dev *dev); +static int map_bars(struct fpgapci_devdata *pci_privdata, struct pci_dev *dev); +static void free_bars(struct fpgapci_devdata *pci_privdata, struct pci_dev *dev); +static int pddf_pci_add_adapter(struct pci_dev *dev); + +/* each i2c bus is represented in linux using struct i2c_adapter */ +static struct i2c_adapter i2c_pci_adap[I2C_PCI_MAX_BUS]; + +static int pddf_pci_add_adapter(struct pci_dev *dev) +{ + int i; + + total_i2c_pci_bus = pddf_fpga_ops_data.virt_i2c_ch; + pddf_dbg(FPGA, KERN_INFO "[%s] total_i2c_pci_bus=%d\n", __FUNCTION__, total_i2c_pci_bus); +#ifdef __STDC_LIB_EXT1__ + memset_s(&i2c_pci_adap, sizeof(i2c_pci_adap), 0, sizeof(i2c_pci_adap)); +#else + memset(&i2c_pci_adap, 0, sizeof(i2c_pci_adap)); +#endif + + for (i = 0 ; i < total_i2c_pci_bus; i ++) { + + i2c_pci_adap[i].owner = THIS_MODULE; + i2c_pci_adap[i].class = I2C_CLASS_HWMON | I2C_CLASS_SPD; + + /* /dev/i2c-xxx for FPGA LOGIC I2C channel controller 1-7 */ + i2c_pci_adap[i].nr = i + pddf_fpga_ops_data.virt_bus ; + sprintf( i2c_pci_adap[ i ].name, "i2c-pci-%d", i ); + + /* set up the sysfs linkage to our parent device */ + i2c_pci_adap[i].dev.parent = &dev->dev; + + /* Add the bus via the algorithm code */ + + if( (pddf_i2c_pci_add_numbered_bus!=NULL) && (pddf_i2c_pci_add_numbered_bus( &i2c_pci_adap[ i ], i ) != 0 )) + { + pddf_dbg(FPGA, KERN_ERR "Cannot add bus %d to algorithm layer\n", i ); + return( -ENODEV ); + } + pddf_dbg(FPGA, KERN_INFO "[%s] Registered bus id: %s\n", __FUNCTION__, kobject_name(&i2c_pci_adap[ i ].dev.kobj)); + } + + return 0; +} + +static void pddf_pci_del_adapter(void) +{ + int i; + for( i = 0; i < total_i2c_pci_bus; i++ ){ + i2c_del_adapter(&i2c_pci_adap[i]); + } +} + +static int map_bars(struct fpgapci_devdata *pci_privdata, struct pci_dev *dev) +{ + unsigned long barFlags, barStart, barEnd, barLen; + int i; + + for (i=0; i < MAX_PCI_NUM_BARS; i++) { + if((barLen=pci_resource_len(dev, i)) !=0 && (barStart=pci_resource_start(dev, i)) !=0 ) { + barFlags = pci_resource_flags(dev, i); + barEnd = pci_resource_end(dev, i); + pddf_dbg(FPGA, KERN_INFO "[%s] PCI_BASE_ADDRESS_%d 0x%08lx-0x%08lx bar_len=0x%lx" + " flags 0x%08lx IO_mapped=%s Mem_mapped=%s\n", __FUNCTION__, + i, barStart, barEnd, barLen, barFlags, (barFlags & IORESOURCE_IO)? "Yes": "No", + (barFlags & IORESOURCE_MEM)? "Yes" : "No"); + FPGAPCI_BAR_INDEX=i; + break; + } + } + + if (FPGAPCI_BAR_INDEX != -1) { + pci_privdata->bar_length = barLen; + pci_privdata->fpga_data_base_addr = ioremap_cache (barStart + pddf_fpga_ops_data.data_base_offset, + pddf_fpga_ops_data.data_size); + fpga_ctl_addr = pci_privdata->fpga_data_base_addr; + + pci_privdata->fpga_i2c_ch_base_addr = ioremap_cache (barStart + pddf_fpga_ops_data.i2c_ch_base_offset, + I2C_PCI_MAX_BUS * pddf_fpga_ops_data.i2c_ch_size); + pci_privdata->max_fpga_i2c_ch = pddf_fpga_ops_data.virt_i2c_ch; + pci_privdata->fpga_i2c_ch_size = pddf_fpga_ops_data.i2c_ch_size; + } else { + pddf_dbg(FPGA, KERN_INFO "[%s] Failed to find BAR\n", __FUNCTION__); + return (-1); + } + pddf_dbg(FPGA, KERN_INFO "[%s] fpga_ctl_addr:0x%p fpga_data__base_addr:0x%p" + " bar_index[%d] fpgapci_bar_len:0x%08lx fpga_i2c_ch_base_addr:0x%p supported_i2c_ch=%d", + __FUNCTION__, fpga_ctl_addr, pci_privdata->fpga_data_base_addr, FPGAPCI_BAR_INDEX, + pci_privdata->bar_length, pci_privdata->fpga_i2c_ch_base_addr, pci_privdata->max_fpga_i2c_ch); + + return 0; +} + +static void free_bars(struct fpgapci_devdata *pci_privdata, struct pci_dev *dev) +{ + pci_iounmap(dev, pci_privdata->fpga_data_base_addr); + pci_privdata->fpga_i2c_ch_base_addr = NULL; +} + +static int pddf_pci_config_data(struct pci_dev *dev) +{ + unsigned short vendorId=0xFFFF, deviceId=0xFFFF; + char revisionId=0xFF, classDev=0xFF, classProg=0xFF; + char irqLine=0xFF, irqPin=0xFF; + + pddf_dbg(FPGA, KERN_INFO "[%s] PCI Config Data\n", __FUNCTION__); + + /* accessing the configuration region of the PCI device */ + pci_read_config_word(dev, PCI_VENDOR_ID, &vendorId); + pci_read_config_word(dev, PCI_DEVICE_ID, &deviceId); + pci_read_config_byte(dev, PCI_REVISION_ID, &revisionId); + pci_read_config_byte(dev, PCI_CLASS_PROG, &classProg); + pci_read_config_byte(dev, PCI_CLASS_DEVICE, &classDev); + + pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irqPin); + if(pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irqLine)) { + pddf_dbg(FPGA, KERN_ERR "\tPCI_INTERRUPT_LINE Error\n"); + } + + pddf_dbg(FPGA, KERN_INFO "\t[venId, devId]=[0x%x;0x%x] [group, class]=[%x;%x]\n", + vendorId, deviceId, classProg, classDev); + pddf_dbg(FPGA, KERN_INFO "\trevsionId=0x%x, irq_line=0x%x, irq_support=%s\n", + revisionId, irqLine, (irqPin == 0)? "No":"Yes"); + + return (0); +} + + +static int pddf_fpgapci_probe(struct pci_dev *dev, const struct pci_device_id *id) +{ + struct fpgapci_devdata *pci_privdata = 0; + int err = 0; + pddf_dbg(FPGA, KERN_INFO "[%s]\n", __FUNCTION__); + + if ((err = pci_enable_device(dev))) { + pddf_dbg(FPGA, KERN_ERR "[%s] pci_enable_device failed. dev:%s err:%#x\n", + __FUNCTION__, pci_name(dev), err); + return (err); + } + + /* Enable DMA */ + pci_set_master(dev); + + /* Request MMIO/IOP resources - reserve PCI I/O and memory resources + DRIVE_NAME shows up in /proc/iomem + */ + if ((err = pci_request_regions(dev, DRIVER_NAME)) < 0) { + pddf_dbg(FPGA, KERN_ERR "[%s] pci_request_regions failed. dev:%s err:%#x\n", + __FUNCTION__, pci_name(dev), err); + goto error_pci_req; + } + + pci_privdata = kzalloc(sizeof(struct fpgapci_devdata), GFP_KERNEL); + + if (!pci_privdata) { + pddf_dbg(FPGA, KERN_ERR "[%s] couldn't allocate pci_privdata memory", __FUNCTION__); + goto error_pci_req; + } + + pci_privdata->pci_dev = dev; + dev_set_drvdata(&dev->dev, (void*)pci_privdata); + pddf_pci_config_data(dev); + + if (map_bars(pci_privdata, dev)) { + pddf_dbg(FPGA, KERN_ERR "error_map_bars\n"); + goto error_map_bars; + } + pddf_pci_add_adapter(dev); + return (0); + +/* ERROR HANDLING */ +error_map_bars: + pci_release_regions(dev); +error_pci_req: + pci_disable_device(dev); + return -ENODEV; + +} + +static void pddf_fpgapci_remove(struct pci_dev *dev) +{ + struct fpgapci_devdata *pci_privdata = 0; + + if (dev == 0) { + pddf_dbg(FPGA, KERN_ERR "[%s]: dev is 0\n", __FUNCTION__); + return; + } + + pci_privdata = (struct fpgapci_devdata*) dev_get_drvdata(&dev->dev); + + if (pci_privdata == 0) { + pddf_dbg(FPGA, KERN_ERR "[%s]: pci_privdata is 0\n", __FUNCTION__); + return; + } + + pddf_pci_del_adapter(); + free_bars (pci_privdata, dev); + pci_disable_device(dev); + pci_release_regions(dev); + kfree (pci_privdata); +} + + +/* Initialize the driver module (but not any device) and register + * the module with the kernel PCI subsystem. */ +int pddf_fpgapci_register(FPGA_OPS_DATA* ptr_ops_data) +{ + + memcpy(&pddf_fpga_ops_data, ptr_ops_data, sizeof(FPGA_OPS_DATA)); +#if DEBUG + pddf_dbg(FPGA, KERN_INFO "[%s]: pddf_fpga_ops_data vendor_id=0x%x device_id=0x%x virt_bus=0x%x " + " data_base_offset=0x%x data_size=0x%x i2c_ch_base_offset=0x%x i2c_ch_size=0x%x virt_i2c_ch=%d", + __FUNCTION__, pddf_fpga_ops_data.vendor_id, pddf_fpga_ops_data.device_id, + pddf_fpga_ops_data.virt_bus, pddf_fpga_ops_data.data_base_offset, pddf_fpga_ops_data.data_size, + pddf_fpga_ops_data.i2c_ch_base_offset, pddf_fpga_ops_data.i2c_ch_size, + pddf_fpga_ops_data.virt_i2c_ch); +#endif + struct pci_device_id fpgapci_ids[2] = { + {PCI_DEVICE(pddf_fpga_ops_data.vendor_id, pddf_fpga_ops_data.device_id)}, + {0, }, + }; + + int size = sizeof(struct pci_device_id) * 2; + + if ((pddf_fpgapci_ids=kmalloc(size, GFP_KERNEL)) == NULL) { + pddf_dbg(FPGA, KERN_INFO "%s kmalloc failed\n", __FUNCTION__); + return 0; + } + + memcpy(pddf_fpgapci_ids, fpgapci_ids, size); + + pddf_fpgapci_driver.name=DRIVER_NAME; + pddf_fpgapci_driver.id_table=pddf_fpgapci_ids; + pddf_fpgapci_driver.probe=pddf_fpgapci_probe; + pddf_fpgapci_driver.remove=pddf_fpgapci_remove; + + if (pci_register_driver(&pddf_fpgapci_driver)) { + pddf_dbg(FPGA, KERN_INFO "%s: pci_unregister_driver\n", __FUNCTION__); + pci_unregister_driver(&pddf_fpgapci_driver); + return -ENODEV; + } + return 0; +} + +EXPORT_SYMBOL(pddf_fpgapci_register); + +static int __init pddf_fpgapci_driver_init(void) +{ + pddf_dbg(FPGA, KERN_INFO "[%s]\n", __FUNCTION__); + + return 0; +} + +static void __exit pddf_fpgapci_driver_exit(void) +{ + pddf_dbg(FPGA, KERN_INFO "[%s]\n", __FUNCTION__); + + if (pddf_fpgapci_ids) { + /* unregister this driver from the PCI bus driver */ + pci_unregister_driver(&pddf_fpgapci_driver); + kfree(pddf_fpgapci_ids); + } + +} + + +module_init (pddf_fpgapci_driver_init); +module_exit (pddf_fpgapci_driver_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION ("PDDF Driver for FPGAPCI Logic I2C bus"); +MODULE_SUPPORTED_DEVICE ("PDDF FPGAPCI Logic I2C bus"); diff --git a/platform/pddf/i2c/modules/fpgapci/pddf_fpgapci_module.c b/platform/pddf/i2c/modules/fpgapci/pddf_fpgapci_module.c new file mode 100644 index 000000000000..72ec97c1e2f3 --- /dev/null +++ b/platform/pddf/i2c/modules/fpgapci/pddf_fpgapci_module.c @@ -0,0 +1,142 @@ +/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * A pddf kernel module to create sysfs for fpga + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pddf_client_defs.h" +#include "pddf_fpgapci_defs.h" + +FPGA_OPS_DATA tmp_pddf_fpga_ops_data={0}; +extern int pddf_fpgapci_register(FPGA_OPS_DATA *ptr); + +/************************************************************************** + * FPGA SYSFS Attributes + **************************************************************************/ +static ssize_t dev_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + +PDDF_DATA_ATTR(vendor_id, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_UINT32, sizeof(uint32_t), (void*)&tmp_pddf_fpga_ops_data.vendor_id, NULL); +PDDF_DATA_ATTR(device_id, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_UINT32, sizeof(uint32_t), (void*)&tmp_pddf_fpga_ops_data.device_id, NULL); +PDDF_DATA_ATTR(virt_bus, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_UINT32, sizeof(uint32_t), (void*)&tmp_pddf_fpga_ops_data.virt_bus, NULL); +PDDF_DATA_ATTR(data_base_offset, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_UINT32, sizeof(uint32_t), (void*)&tmp_pddf_fpga_ops_data.data_base_offset, NULL); +PDDF_DATA_ATTR(data_size, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_UINT32, sizeof(uint32_t), (void*)&tmp_pddf_fpga_ops_data.data_size, NULL); +PDDF_DATA_ATTR(i2c_ch_base_offset, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_UINT32, sizeof(uint32_t), (void*)&tmp_pddf_fpga_ops_data.i2c_ch_base_offset, NULL); +PDDF_DATA_ATTR(i2c_ch_size, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_UINT32, sizeof(uint32_t), (void*)&tmp_pddf_fpga_ops_data.i2c_ch_size, NULL); +PDDF_DATA_ATTR(virt_i2c_ch, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_UINT32, sizeof(uint32_t), (void*)&tmp_pddf_fpga_ops_data.virt_i2c_ch, NULL); +PDDF_DATA_ATTR(dev_ops , S_IWUSR|S_IRUGO, show_pddf_data, + dev_operation, PDDF_CHAR, NAME_SIZE, (void*)&tmp_pddf_fpga_ops_data, NULL); + +struct attribute* attrs_fpgapci[]={ + &attr_vendor_id.dev_attr.attr, + &attr_device_id.dev_attr.attr, + &attr_virt_bus.dev_attr.attr, + &attr_data_base_offset.dev_attr.attr, + &attr_data_size.dev_attr.attr, + &attr_i2c_ch_base_offset.dev_attr.attr, + &attr_i2c_ch_size.dev_attr.attr, + &attr_virt_i2c_ch.dev_attr.attr, + &attr_dev_ops.dev_attr.attr, + NULL, +}; +struct attribute_group attr_group_fpgapci={ + .attrs = attrs_fpgapci, +}; + +ssize_t dev_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + if(strncmp(buf, "fpgapci_init", strlen("fpgapci_init"))==0 ) { + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + FPGA_OPS_DATA* pddf_fpga_ops_data=(FPGA_OPS_DATA*)_ptr->addr; + pddf_dbg(FPGA, KERN_INFO "%s: pddf_fpga_ops_data vendor_id=0x%x device_id=0x%x virt_bus=0x%x:%d " + " data_base_offset=0x%x data_size=0x%x i2c_ch_base_offset=0x%x i2c_ch_size=0x%x virt_i2c_ch=%d", + __FUNCTION__, pddf_fpga_ops_data->vendor_id, pddf_fpga_ops_data->device_id, + pddf_fpga_ops_data->virt_bus, pddf_fpga_ops_data->virt_bus, + pddf_fpga_ops_data->data_base_offset, pddf_fpga_ops_data->data_size, + pddf_fpga_ops_data->i2c_ch_base_offset, pddf_fpga_ops_data->i2c_ch_size, pddf_fpga_ops_data->virt_i2c_ch); + + pddf_fpgapci_register(pddf_fpga_ops_data); + } + else { + pddf_dbg(FPGA, KERN_ERR "PDDF_ERROR %s: Invalid value for dev_ops %s\n", __FUNCTION__, buf); + } + return(count); +} + + +#define KOBJ_FREE(obj) \ + if(obj) kobject_put(obj); \ + + +int __init pddf_fpga_data_init(void) +{ + int ret = 0; + struct kobject *device_kobj; + + pddf_dbg(FPGA, KERN_INFO "%s ..\n", __FUNCTION__); + + device_kobj = get_device_i2c_kobj(); + if(!device_kobj) { + pddf_dbg(FPGA, KERN_ERR "%s get_device_i2c_kobj failed ..\n", __FUNCTION__); + return -ENOMEM; + } + fpgapci_kobj = kobject_create_and_add("fpgapci", device_kobj); + if(!fpgapci_kobj) { + pddf_dbg(FPGA, KERN_ERR "%s create fpgapci kobj failed ..\n", __FUNCTION__); + return -ENOMEM; + } + + ret = sysfs_create_group(fpgapci_kobj, &attr_group_fpgapci); + if (ret) + { + pddf_dbg(FPGA, KERN_ERR "%s create fpga sysfs attributes failed ..\n", __FUNCTION__); + return ret; + } + + + return (0); + +} + +void __exit pddf_fpga_data_exit(void) +{ + pddf_dbg(FPGA, KERN_INFO "%s ..\n", __FUNCTION__); + KOBJ_FREE(fpgapci_kobj) + return; +} + + +module_init(pddf_fpga_data_init); +module_exit(pddf_fpga_data_exit); + +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("fpga platform data"); +MODULE_LICENSE("GPL"); diff --git a/platform/pddf/i2c/modules/include/pddf_client_defs.h b/platform/pddf/i2c/modules/include/pddf_client_defs.h index b9d5090f731f..cb26dd1ab4fa 100644 --- a/platform/pddf/i2c/modules/include/pddf_client_defs.h +++ b/platform/pddf/i2c/modules/include/pddf_client_defs.h @@ -33,6 +33,8 @@ #define GPIO "PDDF_GPIO" #define SYSSTATUS "PDDF_SYSSTATUS" #define XCVR "PDDF_XCVR" +#define FPGA "PDDF_FPGAPCI" + #define PDDF_DEBUG #ifdef PDDF_DEBUG diff --git a/platform/pddf/i2c/modules/include/pddf_fpgapci_defs.h b/platform/pddf/i2c/modules/include/pddf_fpgapci_defs.h new file mode 100644 index 000000000000..c745bbd09f3c --- /dev/null +++ b/platform/pddf/i2c/modules/include/pddf_fpgapci_defs.h @@ -0,0 +1,49 @@ +/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Description: + * Platform FPGAPCI defines/structures header file + */ + +#ifndef __PDDF_FPGAPCI_DEFS_H__ +#define __PDDF_FPGAPCI_DEFS_H__ + + +// FPGA +typedef struct +{ + uint32_t vendor_id; + uint32_t device_id; + uint32_t virt_bus; + uint32_t virt_i2c_ch; + uint32_t data_base_offset; + uint32_t data_size; + uint32_t i2c_ch_base_offset; + uint32_t i2c_ch_size; +} FPGA_OPS_DATA; + +/***************************************** + * kobj list + *****************************************/ + +struct kobject *fpgapci_kobj=NULL; + +/***************************************** + * Static Data provided from user + * space JSON data file + *****************************************/ +#define NAME_SIZE 32 + + + + +#endif diff --git a/platform/pddf/i2c/modules/include/pddf_i2c_algo.h b/platform/pddf/i2c/modules/include/pddf_i2c_algo.h new file mode 100644 index 000000000000..3526b456516a --- /dev/null +++ b/platform/pddf/i2c/modules/include/pddf_i2c_algo.h @@ -0,0 +1,36 @@ +/* + * + * Description: + * This is the required header file for customed i2c algorithms + */ + +#ifndef __PDDF_I2C_ALGO_H__ +#define __PDDF_I2C_ALGO_H__ +#include "pddf_client_defs.h" + +/* max number of adapters */ +#define I2C_PCI_MAX_BUS 16 + +/** + * struct fpgapci_devdata - PCI device data structure + * support one device per PCIe + */ +struct fpgapci_devdata { + struct pci_dev *pci_dev; + + /* kernels virtual addr for fpga_data_base_addr */ + void * __iomem fpga_data_base_addr; + + /* kernels virtual addr. for the i2c_ch_base_addr */ + void * __iomem fpga_i2c_ch_base_addr; + + /* size per i2c_ch */ + int fpga_i2c_ch_size; + + /* number of supported virtual i2c buses */ + int max_fpga_i2c_ch; + + size_t bar_length; +}; + +#endif From e3ff08833e7b8033dfa6c29ea152c9caefdc05d6 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Tue, 7 Feb 2023 22:21:59 +0800 Subject: [PATCH 101/113] [Mellanox] Support DSCP remapping in dual ToR topo on T0 switch (#12605) - Why I did it Support DSCP remapping in dual ToR topo on T0 switch for SKU Mellanox-SN4600c-C64, Mellanox-SN4600c-D48C40, Mellanox-SN2700, Mellanox-SN2700-D48C8. - How I did it Regarding buffer settings, originally, there are two lossless PGs and queues 3, 4. In dual ToR scenario, the lossless traffic from the leaf switch to the uplink of the ToR switch can be bounced back. To avoid PFC deadlock, we need to map the bounce-back lossless traffic to different PGs and queues. Therefore, 2 additional lossless PGs and queues are allocated on uplink ports on ToR switches. On uplink ports, map DSCP 2/6 to TC 2/6 respectively On downlink ports, both DSCP 2/6 are still mapped to TC 1 Buffer adjusted according to the ports information: Mellanox-SN4600c-C64: 56 downlinks 50G + 8 uplinks 100G Mellanox-SN4600c-D48C40, Mellanox-SN2700, Mellanox-SN2700-D48C8: 24 downlinks 50G + 8 uplinks 100G - How to verify it Unit test. Signed-off-by: Stephen Sun --- .../buffers_defaults_t0.j2 | 23 +- .../Mellanox-SN2700-D48C8/qos.json.j2 | 18 +- .../Mellanox-SN2700/buffers_defaults_t0.j2 | 23 +- .../Mellanox-SN2700/qos.json.j2 | 2 +- .../buffers_defaults_t0.j2 | 23 +- .../Mellanox-SN4600C-C64/qos.json.j2 | 131 +- .../buffers_defaults_t0.j2 | 23 +- .../Mellanox-SN4600C-D48C40/qos.json.j2 | 2 +- files/build_templates/swss_vars.j2 | 4 +- ...anox-4600c-t0-minigraph-remap-disabled.xml | 4002 +++++++++++++++++ .../sample-mellanox-4600c-t0-minigraph.xml | 3929 ++++++++++++++++ ...llanox4600c-t0-dynamic-remap-disabled.json | 2008 +++++++++ .../py3/buffers-mellanox4600c-t0-dynamic.json | 2044 +++++++++ ...fers-mellanox4600c-t0-remap-disabled.json} | 1189 +++-- .../py3/buffers-mellanox4600c-t0.json | 1786 ++++++++ ...ellanox4600c-d48c40-t0-remap-disabled.json | 884 ++++ .../py3/qos-mellanox4600c-d48c40-t0.json | 1155 +++++ src/sonic-config-engine/tests/test_j2files.py | 17 +- 18 files changed, 16919 insertions(+), 344 deletions(-) mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 create mode 100644 src/sonic-config-engine/tests/sample-mellanox-4600c-t0-minigraph-remap-disabled.xml create mode 100644 src/sonic-config-engine/tests/sample-mellanox-4600c-t0-minigraph.xml create mode 100644 src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-dynamic-remap-disabled.json create mode 100644 src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-dynamic.json rename src/sonic-config-engine/tests/sample_output/py3/{buffers-mellanox2700.json => buffers-mellanox4600c-t0-remap-disabled.json} (55%) create mode 100644 src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0.json create mode 100644 src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-d48c40-t0-remap-disabled.json create mode 100644 src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-d48c40-t0.json diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 index 3a3f2499c8d8..e94c7693824d 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,10 +15,17 @@ limitations under the License. #} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '7719936' %} -{% set ingress_lossless_pool_xoff = '1032192' %} +{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) -%} +{% set ingress_lossless_pool_size = '9047040' %} +{% set ingress_lossless_pool_xoff = '851968' %} {% set egress_lossless_pool_size = '13945824' %} -{% set egress_lossy_pool_size = '7719936' %} +{% set egress_lossy_pool_size = '9047040' %} +{%- else -%} +{% set ingress_lossless_pool_size = '9595904' %} +{% set ingress_lossless_pool_xoff = '614400' %} +{% set egress_lossless_pool_size = '13945824' %} +{% set egress_lossy_pool_size = '9595904' %} +{%- endif -%} {% import 'buffers_defaults_objects.j2' as defs with context %} @@ -30,10 +37,18 @@ {{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} +{%- macro generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) %} +{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues, port_names_inactive) }} +{%- endmacro %} + {%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} {{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} +{%- macro generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports(port_names_active, port_names_extra_pgs, port_names_inactive) %} +{{ defs.generate_pg_profiles_with_extra_lossless_pgs(port_names_active, port_names_extra_pgs, port_names_inactive) }} +{%- endmacro %} + {%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} {{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 deleted file mode 100644 index 94bd7dda2c37..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{# - Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. - Apache-2.0 - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -#} -{%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 new file mode 120000 index 000000000000..48221aa2b3de --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 index e36cc754fa52..e94c7693824d 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,10 +15,17 @@ limitations under the License. #} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '10177536' %} -{% set ingress_lossless_pool_xoff = '688128' %} +{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) -%} +{% set ingress_lossless_pool_size = '9047040' %} +{% set ingress_lossless_pool_xoff = '851968' %} {% set egress_lossless_pool_size = '13945824' %} -{% set egress_lossy_pool_size = '10177536' %} +{% set egress_lossy_pool_size = '9047040' %} +{%- else -%} +{% set ingress_lossless_pool_size = '9595904' %} +{% set ingress_lossless_pool_xoff = '614400' %} +{% set egress_lossless_pool_size = '13945824' %} +{% set egress_lossy_pool_size = '9595904' %} +{%- endif -%} {% import 'buffers_defaults_objects.j2' as defs with context %} @@ -30,10 +37,18 @@ {{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} +{%- macro generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) %} +{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues, port_names_inactive) }} +{%- endmacro %} + {%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} {{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} +{%- macro generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports(port_names_active, port_names_extra_pgs, port_names_inactive) %} +{{ defs.generate_pg_profiles_with_extra_lossless_pgs(port_names_active, port_names_extra_pgs, port_names_inactive) }} +{%- endmacro %} + {%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} {{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/qos.json.j2 index 8bd2d26567b8..48221aa2b3de 120000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/qos.json.j2 @@ -1 +1 @@ -../ACS-MSN2700/qos.json.j2 \ No newline at end of file +../../x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t0.j2 index a66a404bb2c2..0269b1b52f35 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t0.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,10 +15,17 @@ limitations under the License. #} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '49905664' %} -{% set ingress_lossless_pool_xoff = '3702784' %} +{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) -%} +{% set ingress_lossless_pool_size = '50667520' %} +{% set ingress_lossless_pool_xoff = '2629632' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '49905664' %} +{% set egress_lossy_pool_size = '50667520' %} +{%- else -%} +{% set ingress_lossless_pool_size = '51511296' %} +{% set ingress_lossless_pool_xoff = '2097152' %} +{% set egress_lossless_pool_size = '60817392' %} +{% set egress_lossy_pool_size = '51511296' %} +{%- endif -%} {% import 'buffers_defaults_objects.j2' as defs with context %} @@ -30,10 +37,18 @@ {{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} +{%- macro generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) %} +{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues, port_names_inactive) }} +{%- endmacro %} + {%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} {{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} +{%- macro generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports(port_names_active, port_names_extra_pgs, port_names_inactive) %} +{{ defs.generate_pg_profiles_with_extra_lossless_pgs(port_names_active, port_names_extra_pgs, port_names_inactive) }} +{%- endmacro %} + {%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} {{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/qos.json.j2 index 6134402aad53..b3bc96fb83c3 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/qos.json.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Copyright (c) 2020-2023 NVIDIA CORPORATION & AFFILIATES. Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,18 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. #} -{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %} + +{% if (('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') or + ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'ToRRouter') and + ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR')) %} {% set different_dscp_to_tc_map = true %} -{%- macro generate_dscp_to_tc_map() %} - "DSCP_TO_TC_MAP": { - "AZURE": { +{%- macro generate_normal_dscp_to_tc_map(tc_mapped_from_dscp_33) -%} + { "0" : "1", "1" : "1", - "2" : "2", + "2" : "1", "3" : "3", "4" : "4", "5" : "1", - "6" : "6", + "6" : "1", "7" : "1", "8" : "0", "9" : "1", @@ -52,7 +54,7 @@ "30": "1", "31": "1", "32": "1", - "33": "1", + "33": "{{tc_mapped_from_dscp_33}}", "34": "1", "35": "1", "36": "1", @@ -83,15 +85,17 @@ "61": "1", "62": "1", "63": "1" - }, - "AZURE_UPLINK": { + } +{%- endmacro -%} +{%- macro generate_dscp_to_tc_map_with_addition_lossless_pgs_n_queues(tc_mapped_from_dscp_33) -%} + { "0" : "1", "1" : "1", - "2" : "1", + "2" : "2", "3" : "3", "4" : "4", "5" : "1", - "6" : "1", + "6" : "6", "7" : "1", "8" : "0", "9" : "1", @@ -118,7 +122,7 @@ "30": "1", "31": "1", "32": "1", - "33": "1", + "33": "{{tc_mapped_from_dscp_33}}", "34": "1", "35": "1", "36": "1", @@ -150,10 +154,52 @@ "62": "1", "63": "1" } +{%- endmacro -%} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { +{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %} + "AZURE_UPLINK": + {{ generate_normal_dscp_to_tc_map("1") }}, + "AZURE": + {{ generate_dscp_to_tc_map_with_addition_lossless_pgs_n_queues("1") }} +{% endif %} +{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'ToRRouter') %} + "AZURE_UPLINK": + {{ generate_dscp_to_tc_map_with_addition_lossless_pgs_n_queues("8") }}, + "AZURE_TUNNEL": + {{ generate_normal_dscp_to_tc_map("8") }}, + "AZURE": + {{ generate_normal_dscp_to_tc_map("8") }} +{% endif %} }, {%- endmacro %} {%- macro generate_tc_to_pg_map() %} "TC_TO_PRIORITY_GROUP_MAP": { +{% if (('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'ToRRouter') and + ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR')) %} + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0", + "8": "0" + }, + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "0", + "8": "0" + } +{% else %} "AZURE": { "0": "0", "1": "0", @@ -164,8 +210,67 @@ "6": "6", "7": "0" } +{% endif %} + }, +{%- endmacro %} +{%- macro generate_tc_to_queue_map() %} + "TC_TO_QUEUE_MAP": { +{% if (('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'ToRRouter') and + ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR')) %} + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "2", + "3": "2", + "4": "6", + "5": "5", + "6": "6", + "7": "7", + "8": "1" + }, + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "1" + } +{% else %} + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } +{% endif %} + }, +{%- endmacro %} +{% if (('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'ToRRouter') and + ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR')) %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "2", + "3": "2", + "4": "6", + "5": "46", + "6": "6", + "7": "48", + "8": "33" + } }, {%- endmacro %} +{%- endif %} {%- macro generate_global_dscp_to_tc_map() %} {# This is an empty macro since the global DSCP_TO_TC map is not required #} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t0.j2 index 87d8bda4c55f..87f8207ab75f 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t0.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,10 +15,17 @@ limitations under the License. #} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '47398912' %} -{% set ingress_lossless_pool_xoff = '3604480' %} +{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) -%} +{% set ingress_lossless_pool_size = '55058432' %} +{% set ingress_lossless_pool_xoff = '1712128' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '47398912' %} +{% set egress_lossy_pool_size = '55058432' %} +{%- else -%} +{% set ingress_lossless_pool_size = '55902208' %} +{% set ingress_lossless_pool_xoff = '1179648' %} +{% set egress_lossless_pool_size = '60817392' %} +{% set egress_lossy_pool_size = '55902208' %} +{%- endif -%} {% import 'buffers_defaults_objects.j2' as defs with context %} @@ -30,10 +37,18 @@ {{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} +{%- macro generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) %} +{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues, port_names_inactive) }} +{%- endmacro %} + {%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} {{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} +{%- macro generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports(port_names_active, port_names_extra_pgs, port_names_inactive) %} +{{ defs.generate_pg_profiles_with_extra_lossless_pgs(port_names_active, port_names_extra_pgs, port_names_inactive) }} +{%- endmacro %} + {%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} {{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/qos.json.j2 index 05394016a129..c06f6bddc387 120000 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/qos.json.j2 @@ -1 +1 @@ -../ACS-MSN4600C/qos.json.j2 \ No newline at end of file +../Mellanox-SN4600C-C64/qos.json.j2 \ No newline at end of file diff --git a/files/build_templates/swss_vars.j2 b/files/build_templates/swss_vars.j2 index 1cd95d16a6d6..f35d0fc080ad 100644 --- a/files/build_templates/swss_vars.j2 +++ b/files/build_templates/swss_vars.j2 @@ -6,5 +6,7 @@ "asic_id": "{{ DEVICE_METADATA.localhost.asic_id }}", "mac": "{{ DEVICE_METADATA.localhost.mac }}", "resource_type": "{{ DEVICE_METADATA.localhost.resource_type }}", - "synchronous_mode": {% if DEVICE_METADATA.localhost.synchronous_mode == "disable" %}"disable"{% else %}"enable"{% endif %} + "synchronous_mode": {% if DEVICE_METADATA.localhost.synchronous_mode == "disable" %}"disable"{% else %}"enable"{% endif %}, + "dual_tor": {% if DEVICE_METADATA.localhost.type == "ToRRouter" and DEVICE_METADATA.localhost.subtype == "DualToR" %}"enable"{% else %}"disable"{% endif %}, + "dscp_remapping": {% if SYSTEM_DEFAULTS is defined and SYSTEM_DEFAULTS.tunnel_qos_remap is defined and SYSTEM_DEFAULTS.tunnel_qos_remap.status == "enabled" %}"enable"{% else %}"disable"{% endif %} } diff --git a/src/sonic-config-engine/tests/sample-mellanox-4600c-t0-minigraph-remap-disabled.xml b/src/sonic-config-engine/tests/sample-mellanox-4600c-t0-minigraph-remap-disabled.xml new file mode 100644 index 000000000000..0154df6fffcd --- /dev/null +++ b/src/sonic-config-engine/tests/sample-mellanox-4600c-t0-minigraph-remap-disabled.xml @@ -0,0 +1,4002 @@ + + + + + + false + r-tigon-20 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 10 + 3 + + + r-tigon-20 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 10 + 3 + + + false + r-tigon-20 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 10 + 3 + + + r-tigon-20 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 10 + 3 + + + false + r-tigon-20 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 10 + 3 + + + r-tigon-20 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 10 + 3 + + + false + r-tigon-20 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 10 + 3 + + + r-tigon-20 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 10 + 3 + + + + + 65100 + r-tigon-20 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ + BGPPeer +
10.1.0.32
+ + + + BGPSLBPassive + 10.255.0.0/25 +
+ + BGPPeer +
10.1.0.32
+ + + + BGPVac + 192.168.0.0/21 +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + HostIP2 + Loopback1 + + 10.1.0.34/32 + + 10.1.0.34/32 + + + HostIP3 + Loopback1 + + FC00:1::34/128 + + FC00:1::34/128 + + HostIP6 + Loopback3 + + 10.1.0.38/32 + + 10.1.0.38/32 + + + HostIP7 + Loopback3 + + FC00:1::38/128 + + FC00:1::38/128 + + HostIP4 + Loopback2 + + 10.1.0.36/32 + + 10.1.0.36/32 + + + HostIP5 + Loopback2 + + FC00:1::36/128 + + FC00:1::36/128 + + + + HostIP + eth0 + + 10.210.24.183/22 + + 10.210.24.183/22 + + + V6HostIP + eth0 + + fe80::bace:f6ff:fedc:bd4c/64 + + fe80::bace:f6ff:fedc:bd4c/64 + + + + + + + r-tigon-20 + + + PortChannel101 + etp63a + + + + PortChannel102 + etp63b + + + + PortChannel103 + etp64a + + + + PortChannel104 + etp64b + + + + + + + + + Vlan1000 + etp1b;etp2a;etp2b;etp3a;etp3b;etp4a;etp4b;etp5a;etp5b;etp6a;etp6b;etp7a;etp7b;etp8a;etp8b;etp9a;etp9b;etp10a;etp10b;etp11a;etp11b;etp12a;etp12b;etp13a + False + 0.0.0.0/0 + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4 + fc02:2000::1;fc02:2000::2;fc02:2000::3;fc02:2000::4 + 1000 + 1000 + 192.168.0.0/21 + 00:aa:bb:cc:dd:ee + + + + + + PortChannel101 + 10.0.0.56/31 + + + + PortChannel101 + FC00::71/126 + + + + PortChannel102 + 10.0.0.58/31 + + + + PortChannel102 + FC00::75/126 + + + + PortChannel103 + 10.0.0.60/31 + + + + PortChannel103 + FC00::79/126 + + + + PortChannel104 + 10.0.0.62/31 + + + + PortChannel104 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/21 + + + + Vlan1000 + fc02:1000::1/64 + + + + + + NTP_ACL + NTP + NTP + + + SNMP_ACL + SNMP + SNMP + + + ERSPAN + Everflow + Everflow + + + ERSPANV6 + EverflowV6 + EverflowV6 + + + VTY_LINE + ssh-only + SSH + + + PortChannel101;PortChannel102;PortChannel103;PortChannel104 + DataAcl + DataPlane + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.2/21 + + 192.168.0.2/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::2/64 + + fc02:1000::2/64 + + + + + + + + Servers0 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.3/21 + + 192.168.0.3/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::3/64 + + fc02:1000::3/64 + + + + + + + + Servers1 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.4/21 + + 192.168.0.4/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::4/64 + + fc02:1000::4/64 + + + + + + + + Servers2 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.5/21 + + 192.168.0.5/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::5/64 + + fc02:1000::5/64 + + + + + + + + Servers3 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.6/21 + + 192.168.0.6/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::6/64 + + fc02:1000::6/64 + + + + + + + + Servers4 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.7/21 + + 192.168.0.7/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::7/64 + + fc02:1000::7/64 + + + + + + + + Servers5 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.8/21 + + 192.168.0.8/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::8/64 + + fc02:1000::8/64 + + + + + + + + Servers6 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.9/21 + + 192.168.0.9/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::9/64 + + fc02:1000::9/64 + + + + + + + + Servers7 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.10/21 + + 192.168.0.10/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::a/64 + + fc02:1000::a/64 + + + + + + + + Servers8 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.11/21 + + 192.168.0.11/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::b/64 + + fc02:1000::b/64 + + + + + + + + Servers9 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.12/21 + + 192.168.0.12/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::c/64 + + fc02:1000::c/64 + + + + + + + + Servers10 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.13/21 + + 192.168.0.13/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::d/64 + + fc02:1000::d/64 + + + + + + + + Servers11 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.14/21 + + 192.168.0.14/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::e/64 + + fc02:1000::e/64 + + + + + + + + Servers12 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.15/21 + + 192.168.0.15/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::f/64 + + fc02:1000::f/64 + + + + + + + + Servers13 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.16/21 + + 192.168.0.16/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::10/64 + + fc02:1000::10/64 + + + + + + + + Servers14 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.17/21 + + 192.168.0.17/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::11/64 + + fc02:1000::11/64 + + + + + + + + Servers15 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.18/21 + + 192.168.0.18/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::12/64 + + fc02:1000::12/64 + + + + + + + + Servers16 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.19/21 + + 192.168.0.19/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::13/64 + + fc02:1000::13/64 + + + + + + + + Servers17 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.20/21 + + 192.168.0.20/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::14/64 + + fc02:1000::14/64 + + + + + + + + Servers18 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.21/21 + + 192.168.0.21/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::15/64 + + fc02:1000::15/64 + + + + + + + + Servers19 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.22/21 + + 192.168.0.22/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::16/64 + + fc02:1000::16/64 + + + + + + + + Servers20 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.23/21 + + 192.168.0.23/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::17/64 + + fc02:1000::17/64 + + + + + + + + Servers21 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.24/21 + + 192.168.0.24/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::18/64 + + fc02:1000::18/64 + + + + + + + + Servers22 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.25/21 + + 192.168.0.25/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::19/64 + + fc02:1000::19/64 + + + + + + + + Servers23 + + + + + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1 + r-tigon-20 + etp63a + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1 + r-tigon-20 + etp63b + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1 + r-tigon-20 + etp64a + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1 + r-tigon-20 + etp64b + + + DeviceInterfaceLink + r-tigon-20 + etp1b + Servers0 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp2a + Servers1 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp2b + Servers2 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp3a + Servers3 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp3b + Servers4 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp4a + Servers5 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp4b + Servers6 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp5a + Servers7 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp5b + Servers8 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp6a + Servers9 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp6b + Servers10 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp7a + Servers11 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp7b + Servers12 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp8a + Servers13 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp8b + Servers14 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp9a + Servers15 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp9b + Servers16 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp10a + Servers17 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp10b + Servers18 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp11a + Servers19 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp11b + Servers20 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp12a + Servers21 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp12b + Servers22 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp13a + Servers23 + eth0 + + + LogicalLink + r-tigon-20 + etp1b + r-tigon-20-Servers0-SC + U + + + LogicalLink + r-tigon-20 + etp2a + r-tigon-20-Servers1-SC + U + + + LogicalLink + r-tigon-20 + etp2b + r-tigon-20-Servers2-SC + U + + + LogicalLink + r-tigon-20 + etp3a + r-tigon-20-Servers3-SC + U + + + LogicalLink + r-tigon-20 + etp3b + r-tigon-20-Servers4-SC + U + + + LogicalLink + r-tigon-20 + etp4a + r-tigon-20-Servers5-SC + U + + + LogicalLink + r-tigon-20 + etp4b + r-tigon-20-Servers6-SC + U + + + LogicalLink + r-tigon-20 + etp5a + r-tigon-20-Servers7-SC + U + + + LogicalLink + r-tigon-20 + etp5b + r-tigon-20-Servers8-SC + U + + + LogicalLink + r-tigon-20 + etp6a + r-tigon-20-Servers9-SC + U + + + LogicalLink + r-tigon-20 + etp6b + r-tigon-20-Servers10-SC + U + + + LogicalLink + r-tigon-20 + etp7a + r-tigon-20-Servers11-SC + U + + + LogicalLink + r-tigon-20 + etp7b + r-tigon-20-Servers12-SC + U + + + LogicalLink + r-tigon-20 + etp8a + r-tigon-20-Servers13-SC + U + + + LogicalLink + r-tigon-20 + etp8b + r-tigon-20-Servers14-SC + U + + + LogicalLink + r-tigon-20 + etp9a + r-tigon-20-Servers15-SC + U + + + LogicalLink + r-tigon-20 + etp9b + r-tigon-20-Servers16-SC + U + + + LogicalLink + r-tigon-20 + etp10a + r-tigon-20-Servers17-SC + U + + + LogicalLink + r-tigon-20 + etp10b + r-tigon-20-Servers18-SC + U + + + LogicalLink + r-tigon-20 + etp11a + r-tigon-20-Servers19-SC + U + + + LogicalLink + r-tigon-20 + etp11b + r-tigon-20-Servers20-SC + U + + + LogicalLink + r-tigon-20 + etp12a + r-tigon-20-Servers21-SC + U + + + LogicalLink + r-tigon-20 + etp12b + r-tigon-20-Servers22-SC + U + + + LogicalLink + r-tigon-20 + etp13a + r-tigon-20-Servers23-SC + U + + + + + r-tigon-20 + Mellanox-SN4600C-D48C40 +
+ 10.1.0.32/32 +
+ + FC00:1::32/128 + + + 10.210.24.183 + +
+ + r-tigon-21 + Mellanox-SN4600C-D48C40 +
+ 10.1.0.33/32 +
+ + FC00:1::33/128 + + + 10.210.24.193 + +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers0-SC +
+ + Server +
+ 192.168.0.2/26 +
+ + fc02:1000::2/96 + + + 0.0.0.0/0 + + Servers0 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers1-SC +
+ + Server +
+ 192.168.0.3/26 +
+ + fc02:1000::3/96 + + + 0.0.0.0/0 + + Servers1 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers2-SC +
+ + Server +
+ 192.168.0.4/26 +
+ + fc02:1000::4/96 + + + 0.0.0.0/0 + + Servers2 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers3-SC +
+ + Server +
+ 192.168.0.5/26 +
+ + fc02:1000::5/96 + + + 0.0.0.0/0 + + Servers3 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers4-SC +
+ + Server +
+ 192.168.0.6/26 +
+ + fc02:1000::6/96 + + + 0.0.0.0/0 + + Servers4 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers5-SC +
+ + Server +
+ 192.168.0.7/26 +
+ + fc02:1000::7/96 + + + 0.0.0.0/0 + + Servers5 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers6-SC +
+ + Server +
+ 192.168.0.8/26 +
+ + fc02:1000::8/96 + + + 0.0.0.0/0 + + Servers6 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers7-SC +
+ + Server +
+ 192.168.0.9/26 +
+ + fc02:1000::9/96 + + + 0.0.0.0/0 + + Servers7 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers8-SC +
+ + Server +
+ 192.168.0.10/26 +
+ + fc02:1000::a/96 + + + 0.0.0.0/0 + + Servers8 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers9-SC +
+ + Server +
+ 192.168.0.11/26 +
+ + fc02:1000::b/96 + + + 0.0.0.0/0 + + Servers9 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers10-SC +
+ + Server +
+ 192.168.0.12/26 +
+ + fc02:1000::c/96 + + + 0.0.0.0/0 + + Servers10 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers11-SC +
+ + Server +
+ 192.168.0.13/26 +
+ + fc02:1000::d/96 + + + 0.0.0.0/0 + + Servers11 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers12-SC +
+ + Server +
+ 192.168.0.14/26 +
+ + fc02:1000::e/96 + + + 0.0.0.0/0 + + Servers12 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers13-SC +
+ + Server +
+ 192.168.0.15/26 +
+ + fc02:1000::f/96 + + + 0.0.0.0/0 + + Servers13 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers14-SC +
+ + Server +
+ 192.168.0.16/26 +
+ + fc02:1000::10/96 + + + 0.0.0.0/0 + + Servers14 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers15-SC +
+ + Server +
+ 192.168.0.17/26 +
+ + fc02:1000::11/96 + + + 0.0.0.0/0 + + Servers15 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers16-SC +
+ + Server +
+ 192.168.0.18/26 +
+ + fc02:1000::12/96 + + + 0.0.0.0/0 + + Servers16 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers17-SC +
+ + Server +
+ 192.168.0.19/26 +
+ + fc02:1000::13/96 + + + 0.0.0.0/0 + + Servers17 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers18-SC +
+ + Server +
+ 192.168.0.20/26 +
+ + fc02:1000::14/96 + + + 0.0.0.0/0 + + Servers18 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers19-SC +
+ + Server +
+ 192.168.0.21/26 +
+ + fc02:1000::15/96 + + + 0.0.0.0/0 + + Servers19 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers20-SC +
+ + Server +
+ 192.168.0.22/26 +
+ + fc02:1000::16/96 + + + 0.0.0.0/0 + + Servers20 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers21-SC +
+ + Server +
+ 192.168.0.23/26 +
+ + fc02:1000::17/96 + + + 0.0.0.0/0 + + Servers21 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers22-SC +
+ + Server +
+ 192.168.0.24/26 +
+ + fc02:1000::18/96 + + + 0.0.0.0/0 + + Servers22 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers23-SC +
+ + Server +
+ 192.168.0.25/26 +
+ + fc02:1000::19/96 + + + 0.0.0.0/0 + + Servers23 +
+ + ARISTA04T1 + + 10.215.18.187 + + Arista-VM + + + ARISTA03T1 + + 10.215.18.186 + + Arista-VM + + + ARISTA02T1 + + 10.215.18.185 + + Arista-VM + + + ARISTA01T1 + + 10.215.18.184 + + Arista-VM + +
+
+ + + true + + + DeviceInterface + + true + true + 1 + etp1a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp1b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp2a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp2b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp3a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp3b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp4a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp4b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp5a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp5b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp6a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp6b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp7a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp7b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp8a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp8b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp9a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp9b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp10a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp10b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp11a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp11b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp12a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp12b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp13a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp13b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp14a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp14b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp63a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp63b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp64a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp64b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp17a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp17b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp18a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp18b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp19a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp19b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp20a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp20b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp21a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp21b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp22a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp22b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp23a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp23b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp24a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp24b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp25 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp26 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp27a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp27b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp28a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp28b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp29 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp30 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp31a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp31b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp32a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp32b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp33 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp34 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp35a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp35b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp36a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp36b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp37 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp38 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp39a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp39b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp40a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp40b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp41a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp41b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp42a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp42b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp43a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp43b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp44a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp44b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp45a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp45b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp46a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp46b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp47a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp47b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp48a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp48b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp49a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp49b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp50a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp50b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp51a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp51b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp52a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp52b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp53a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp53b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp54a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp54b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp55a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp55b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp56a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp56b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp57a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp57b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp58a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp58b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp59a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp59b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp60a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp60b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp61a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp61b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp62a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp62b + + false + 0 + 0 + 50000 + + + true + 0 + Mellanox-SN4600C-D48C40 + + + + + + + r-tigon-20 + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4 + + + NtpResources + + 10.210.25.32;10.75.202.2 + + + SnmpResources + + 10.0.0.9 + + + TacacsGroup + + testlab + + + TacacsServer + + 10.7.34.20 + + + ForcedMgmtRoutes + + 10.75.0.0/16;10.213.0.0/16;10.215.0.0/16;10.9.0.0/16;10.212.0.0/16 + + + ErspanDestinationIpv4 + + 10.0.0.7 + + + + + + + r-tigon-20 + Mellanox-SN4600C-D48C40 +
diff --git a/src/sonic-config-engine/tests/sample-mellanox-4600c-t0-minigraph.xml b/src/sonic-config-engine/tests/sample-mellanox-4600c-t0-minigraph.xml new file mode 100644 index 000000000000..2674ab1fed91 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-mellanox-4600c-t0-minigraph.xml @@ -0,0 +1,3929 @@ + + + + + + false + r-tigon-20 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 10 + 3 + + + r-tigon-20 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 10 + 3 + + + false + r-tigon-20 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 10 + 3 + + + r-tigon-20 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 10 + 3 + + + false + r-tigon-20 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 10 + 3 + + + r-tigon-20 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 10 + 3 + + + false + r-tigon-20 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 10 + 3 + + + r-tigon-20 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 10 + 3 + + + + + 65100 + r-tigon-20 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ + BGPPeer +
10.1.0.32
+ + + + BGPSLBPassive + 10.255.0.0/25 +
+ + BGPPeer +
10.1.0.32
+ + + + BGPVac + 192.168.0.0/21 +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + HostIP2 + Loopback1 + + 10.1.0.34/32 + + 10.1.0.34/32 + + + HostIP3 + Loopback1 + + FC00:1::34/128 + + FC00:1::34/128 + + HostIP6 + Loopback3 + + 10.1.0.38/32 + + 10.1.0.38/32 + + + HostIP7 + Loopback3 + + FC00:1::38/128 + + FC00:1::38/128 + + HostIP4 + Loopback2 + + 10.1.0.36/32 + + 10.1.0.36/32 + + + HostIP5 + Loopback2 + + FC00:1::36/128 + + FC00:1::36/128 + + + + HostIP + eth0 + + 10.210.24.183/22 + + 10.210.24.183/22 + + + V6HostIP + eth0 + + fe80::bace:f6ff:fedc:bd4c/64 + + fe80::bace:f6ff:fedc:bd4c/64 + + + + + + + r-tigon-20 + + + PortChannel101 + etp63a + + + + PortChannel102 + etp63b + + + + PortChannel103 + etp64a + + + + PortChannel104 + etp64b + + + + + + + + + Vlan1000 + etp1b;etp2a;etp2b;etp3a;etp3b;etp4a;etp4b;etp5a;etp5b;etp6a;etp6b;etp7a;etp7b;etp8a;etp8b;etp9a;etp9b;etp10a;etp10b;etp13a + False + 0.0.0.0/0 + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4 + fc02:2000::1;fc02:2000::2;fc02:2000::3;fc02:2000::4 + 1000 + 1000 + 192.168.0.0/21 + 00:aa:bb:cc:dd:ee + + + + + + PortChannel101 + 10.0.0.56/31 + + + + PortChannel101 + FC00::71/126 + + + + PortChannel102 + 10.0.0.58/31 + + + + PortChannel102 + FC00::75/126 + + + + PortChannel103 + 10.0.0.60/31 + + + + PortChannel103 + FC00::79/126 + + + + PortChannel104 + 10.0.0.62/31 + + + + PortChannel104 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/21 + + + + Vlan1000 + fc02:1000::1/64 + + + + + + NTP_ACL + NTP + NTP + + + SNMP_ACL + SNMP + SNMP + + + ERSPAN + Everflow + Everflow + + + ERSPANV6 + EverflowV6 + EverflowV6 + + + VTY_LINE + ssh-only + SSH + + + PortChannel101;PortChannel102;PortChannel103;PortChannel104 + DataAcl + DataPlane + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.2/21 + + 192.168.0.2/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::2/64 + + fc02:1000::2/64 + + + + + + + + Servers0 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.3/21 + + 192.168.0.3/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::3/64 + + fc02:1000::3/64 + + + + + + + + Servers1 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.4/21 + + 192.168.0.4/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::4/64 + + fc02:1000::4/64 + + + + + + + + Servers2 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.5/21 + + 192.168.0.5/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::5/64 + + fc02:1000::5/64 + + + + + + + + Servers3 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.6/21 + + 192.168.0.6/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::6/64 + + fc02:1000::6/64 + + + + + + + + Servers4 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.7/21 + + 192.168.0.7/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::7/64 + + fc02:1000::7/64 + + + + + + + + Servers5 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.8/21 + + 192.168.0.8/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::8/64 + + fc02:1000::8/64 + + + + + + + + Servers6 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.9/21 + + 192.168.0.9/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::9/64 + + fc02:1000::9/64 + + + + + + + + Servers7 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.10/21 + + 192.168.0.10/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::a/64 + + fc02:1000::a/64 + + + + + + + + Servers8 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.11/21 + + 192.168.0.11/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::b/64 + + fc02:1000::b/64 + + + + + + + + Servers9 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.12/21 + + 192.168.0.12/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::c/64 + + fc02:1000::c/64 + + + + + + + + Servers10 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.13/21 + + 192.168.0.13/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::d/64 + + fc02:1000::d/64 + + + + + + + + Servers11 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.14/21 + + 192.168.0.14/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::e/64 + + fc02:1000::e/64 + + + + + + + + Servers12 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.15/21 + + 192.168.0.15/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::f/64 + + fc02:1000::f/64 + + + + + + + + Servers13 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.16/21 + + 192.168.0.16/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::10/64 + + fc02:1000::10/64 + + + + + + + + Servers14 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.17/21 + + 192.168.0.17/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::11/64 + + fc02:1000::11/64 + + + + + + + + Servers15 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.18/21 + + 192.168.0.18/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::12/64 + + fc02:1000::12/64 + + + + + + + + Servers16 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.19/21 + + 192.168.0.19/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::13/64 + + fc02:1000::13/64 + + + + + + + + Servers17 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.20/21 + + 192.168.0.20/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::14/64 + + fc02:1000::14/64 + + + + + + + + Servers18 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.21/21 + + 192.168.0.21/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::15/64 + + fc02:1000::15/64 + + + + + + + + Servers19 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.22/21 + + 192.168.0.22/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::16/64 + + fc02:1000::16/64 + + + + + + + + Servers20 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.23/21 + + 192.168.0.23/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::17/64 + + fc02:1000::17/64 + + + + + + + + Servers21 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.24/21 + + 192.168.0.24/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::18/64 + + fc02:1000::18/64 + + + + + + + + Servers22 + + + + + + + + + + + + + + + LoopbackInterface + HostIP + Loopback0 + + 192.168.0.25/21 + + 192.168.0.25/21 + + + LoopbackInterface + HostIP1 + Loopback0 + + fc02:1000::19/64 + + fc02:1000::19/64 + + + + + + + + Servers23 + + + + + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1 + r-tigon-20 + etp63a + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1 + r-tigon-20 + etp63b + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1 + r-tigon-20 + etp64a + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1 + r-tigon-20 + etp64b + + + DeviceInterfaceLink + r-tigon-20 + etp1b + Servers0 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp2a + Servers1 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp2b + Servers2 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp3a + Servers3 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp3b + Servers4 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp4a + Servers5 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp4b + Servers6 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp5a + Servers7 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp5b + Servers8 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp6a + Servers9 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp6b + Servers10 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp7a + Servers11 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp7b + Servers12 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp8a + Servers13 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp8b + Servers14 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp9a + Servers15 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp9b + Servers16 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp10a + Servers17 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp10b + Servers18 + eth0 + + + DeviceInterfaceLink + r-tigon-20 + etp13a + Servers23 + eth0 + + + LogicalLink + r-tigon-20 + etp1b + r-tigon-20-Servers0-SC + U + + + LogicalLink + r-tigon-20 + etp2a + r-tigon-20-Servers1-SC + U + + + LogicalLink + r-tigon-20 + etp2b + r-tigon-20-Servers2-SC + U + + + LogicalLink + r-tigon-20 + etp3a + r-tigon-20-Servers3-SC + U + + + LogicalLink + r-tigon-20 + etp3b + r-tigon-20-Servers4-SC + U + + + LogicalLink + r-tigon-20 + etp4a + r-tigon-20-Servers5-SC + U + + + LogicalLink + r-tigon-20 + etp4b + r-tigon-20-Servers6-SC + U + + + LogicalLink + r-tigon-20 + etp5a + r-tigon-20-Servers7-SC + U + + + LogicalLink + r-tigon-20 + etp5b + r-tigon-20-Servers8-SC + U + + + LogicalLink + r-tigon-20 + etp6a + r-tigon-20-Servers9-SC + U + + + LogicalLink + r-tigon-20 + etp6b + r-tigon-20-Servers10-SC + U + + + LogicalLink + r-tigon-20 + etp7a + r-tigon-20-Servers11-SC + U + + + LogicalLink + r-tigon-20 + etp7b + r-tigon-20-Servers12-SC + U + + + LogicalLink + r-tigon-20 + etp8a + r-tigon-20-Servers13-SC + U + + + LogicalLink + r-tigon-20 + etp8b + r-tigon-20-Servers14-SC + U + + + LogicalLink + r-tigon-20 + etp9a + r-tigon-20-Servers15-SC + U + + + LogicalLink + r-tigon-20 + etp9b + r-tigon-20-Servers16-SC + U + + + LogicalLink + r-tigon-20 + etp10a + r-tigon-20-Servers17-SC + U + + + LogicalLink + r-tigon-20 + etp10b + r-tigon-20-Servers18-SC + U + + + LogicalLink + r-tigon-20 + etp13a + r-tigon-20-Servers23-SC + U + + + + + r-tigon-20 + Mellanox-SN4600C-D48C40 +
+ 10.1.0.32/32 +
+ + FC00:1::32/128 + + + 10.210.24.183 + +
+ + r-tigon-21 + Mellanox-SN4600C-D48C40 +
+ 10.1.0.33/32 +
+ + FC00:1::33/128 + + + 10.210.24.193 + +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers0-SC +
+ + Server +
+ 192.168.0.2/26 +
+ + fc02:1000::2/96 + + + 0.0.0.0/0 + + Servers0 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers1-SC +
+ + Server +
+ 192.168.0.3/26 +
+ + fc02:1000::3/96 + + + 0.0.0.0/0 + + Servers1 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers2-SC +
+ + Server +
+ 192.168.0.4/26 +
+ + fc02:1000::4/96 + + + 0.0.0.0/0 + + Servers2 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers3-SC +
+ + Server +
+ 192.168.0.5/26 +
+ + fc02:1000::5/96 + + + 0.0.0.0/0 + + Servers3 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers4-SC +
+ + Server +
+ 192.168.0.6/26 +
+ + fc02:1000::6/96 + + + 0.0.0.0/0 + + Servers4 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers5-SC +
+ + Server +
+ 192.168.0.7/26 +
+ + fc02:1000::7/96 + + + 0.0.0.0/0 + + Servers5 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers6-SC +
+ + Server +
+ 192.168.0.8/26 +
+ + fc02:1000::8/96 + + + 0.0.0.0/0 + + Servers6 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers7-SC +
+ + Server +
+ 192.168.0.9/26 +
+ + fc02:1000::9/96 + + + 0.0.0.0/0 + + Servers7 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers8-SC +
+ + Server +
+ 192.168.0.10/26 +
+ + fc02:1000::a/96 + + + 0.0.0.0/0 + + Servers8 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers9-SC +
+ + Server +
+ 192.168.0.11/26 +
+ + fc02:1000::b/96 + + + 0.0.0.0/0 + + Servers9 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers10-SC +
+ + Server +
+ 192.168.0.12/26 +
+ + fc02:1000::c/96 + + + 0.0.0.0/0 + + Servers10 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers11-SC +
+ + Server +
+ 192.168.0.13/26 +
+ + fc02:1000::d/96 + + + 0.0.0.0/0 + + Servers11 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers12-SC +
+ + Server +
+ 192.168.0.14/26 +
+ + fc02:1000::e/96 + + + 0.0.0.0/0 + + Servers12 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers13-SC +
+ + Server +
+ 192.168.0.15/26 +
+ + fc02:1000::f/96 + + + 0.0.0.0/0 + + Servers13 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers14-SC +
+ + Server +
+ 192.168.0.16/26 +
+ + fc02:1000::10/96 + + + 0.0.0.0/0 + + Servers14 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers15-SC +
+ + Server +
+ 192.168.0.17/26 +
+ + fc02:1000::11/96 + + + 0.0.0.0/0 + + Servers15 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers16-SC +
+ + Server +
+ 192.168.0.18/26 +
+ + fc02:1000::12/96 + + + 0.0.0.0/0 + + Servers16 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers17-SC +
+ + Server +
+ 192.168.0.19/26 +
+ + fc02:1000::13/96 + + + 0.0.0.0/0 + + Servers17 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers18-SC +
+ + Server +
+ 192.168.0.20/26 +
+ + fc02:1000::14/96 + + + 0.0.0.0/0 + + Servers18 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers19-SC +
+ + Server +
+ 192.168.0.21/26 +
+ + fc02:1000::15/96 + + + 0.0.0.0/0 + + Servers19 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers20-SC +
+ + Server +
+ 192.168.0.22/26 +
+ + fc02:1000::16/96 + + + 0.0.0.0/0 + + Servers20 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers21-SC +
+ + Server +
+ 192.168.0.23/26 +
+ + fc02:1000::17/96 + + + 0.0.0.0/0 + + Servers21 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers22-SC +
+ + Server +
+ 192.168.0.24/26 +
+ + fc02:1000::18/96 + + + 0.0.0.0/0 + + Servers22 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + r-tigon-20-Servers23-SC +
+ + Server +
+ 192.168.0.25/26 +
+ + fc02:1000::19/96 + + + 0.0.0.0/0 + + Servers23 +
+ + ARISTA04T1 + + 10.215.18.187 + + Arista-VM + + + ARISTA03T1 + + 10.215.18.186 + + Arista-VM + + + ARISTA02T1 + + 10.215.18.185 + + Arista-VM + + + ARISTA01T1 + + 10.215.18.184 + + Arista-VM + +
+
+ + + true + + + DeviceInterface + + true + true + 1 + etp1a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp1b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp2a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp2b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp3a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp3b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp4a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp4b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp5a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp5b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp6a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp6b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp7a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp7b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp8a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp8b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp9a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp9b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp10a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp10b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp13a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp13b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp14a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp14b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp63a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp63b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp64a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp64b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp17a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp17b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp18a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp18b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp19a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp19b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp20a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp20b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp21a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp21b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp22a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp22b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp23a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp23b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp24a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp24b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp25 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp26 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp27a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp27b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp28a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp28b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp29 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp30 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp31a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp31b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp32a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp32b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp33 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp34 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp35a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp35b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp36a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp36b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp37 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp38 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp39a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp39b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp40a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp40b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp41a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp41b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp42a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp42b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp43a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp43b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp44a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp44b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp45a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp45b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp46a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp46b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp47a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp47b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp48a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp48b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp49a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp49b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp50a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp50b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp51a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp51b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp52a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp52b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp53a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp53b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp54a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp54b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp55a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp55b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp56a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp56b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp57a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp57b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp58a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp58b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp59a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp59b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp60a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp60b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp61a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp61b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp62a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp62b + + false + 0 + 0 + 50000 + + + true + 0 + Mellanox-SN4600C-D48C40 + + + + + + + r-tigon-20 + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + GeminiEnabled + + True + + + RedundancyType + + Gemini + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4 + + + NtpResources + + 10.210.25.32;10.75.202.2 + + + SnmpResources + + 10.0.0.9 + + + TacacsGroup + + testlab + + + TacacsServer + + 10.7.34.20 + + + ForcedMgmtRoutes + + 10.75.0.0/16;10.213.0.0/16;10.215.0.0/16;10.9.0.0/16;10.212.0.0/16 + + + ErspanDestinationIpv4 + + 10.0.0.7 + + + + + + + + + + + + + GeminiPeeringLink + + True + + + UpperTOR + + r-tigon-20 + + + LowerTOR + + r-tigon-21 + + + r-tigon-21:MuxTunnel0;r-tigon-20:MuxTunnel0 + + + + r-tigon-20 + Mellanox-SN4600C-D48C40 +
diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-dynamic-remap-disabled.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-dynamic-remap-disabled.json new file mode 100644 index 000000000000..c70d257b3a8d --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-dynamic-remap-disabled.json @@ -0,0 +1,2008 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet2": "5m", + "Ethernet4": "5m", + "Ethernet6": "5m", + "Ethernet8": "5m", + "Ethernet10": "5m", + "Ethernet12": "5m", + "Ethernet14": "5m", + "Ethernet16": "5m", + "Ethernet18": "5m", + "Ethernet20": "5m", + "Ethernet22": "5m", + "Ethernet24": "5m", + "Ethernet26": "5m", + "Ethernet28": "5m", + "Ethernet30": "5m", + "Ethernet32": "5m", + "Ethernet34": "5m", + "Ethernet36": "5m", + "Ethernet38": "5m", + "Ethernet40": "5m", + "Ethernet44": "5m", + "Ethernet48": "5m", + "Ethernet50": "5m", + "Ethernet52": "5m", + "Ethernet54": "5m", + "Ethernet56": "5m", + "Ethernet60": "5m", + "Ethernet64": "5m", + "Ethernet68": "5m", + "Ethernet72": "5m", + "Ethernet76": "5m", + "Ethernet80": "5m", + "Ethernet84": "5m", + "Ethernet88": "5m", + "Ethernet92": "5m", + "Ethernet96": "5m", + "Ethernet100": "5m", + "Ethernet104": "5m", + "Ethernet108": "5m", + "Ethernet112": "5m", + "Ethernet116": "5m", + "Ethernet120": "5m", + "Ethernet124": "5m", + "Ethernet128": "5m", + "Ethernet132": "5m", + "Ethernet136": "5m", + "Ethernet140": "5m", + "Ethernet144": "5m", + "Ethernet148": "5m", + "Ethernet152": "5m", + "Ethernet156": "5m", + "Ethernet160": "5m", + "Ethernet164": "5m", + "Ethernet168": "5m", + "Ethernet172": "5m", + "Ethernet176": "5m", + "Ethernet180": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet192": "5m", + "Ethernet194": "5m", + "Ethernet196": "5m", + "Ethernet198": "5m", + "Ethernet200": "5m", + "Ethernet204": "5m", + "Ethernet208": "5m", + "Ethernet210": "5m", + "Ethernet212": "5m", + "Ethernet214": "5m", + "Ethernet216": "5m", + "Ethernet220": "5m", + "Ethernet224": "5m", + "Ethernet226": "5m", + "Ethernet228": "5m", + "Ethernet230": "5m", + "Ethernet232": "5m", + "Ethernet234": "5m", + "Ethernet236": "5m", + "Ethernet238": "5m", + "Ethernet240": "5m", + "Ethernet242": "5m", + "Ethernet244": "5m", + "Ethernet246": "5m", + "Ethernet248": "40m", + "Ethernet250": "40m", + "Ethernet252": "40m", + "Ethernet254": "40m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "60817392", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet248": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet250": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet252": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet254": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet2": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet6": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet8": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet10": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet14": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet18": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet22": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet26": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet30": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet34": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet38": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile" + } +, + "Ethernet0": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet50": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet54": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet64": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet128": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet132": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet136": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet140": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet144": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet148": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet152": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet156": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet160": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet164": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet168": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet172": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet176": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet180": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet184": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet188": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet192": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet194": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet196": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet198": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet200": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet204": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet208": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet210": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet212": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet214": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet216": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet220": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet224": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet226": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet228": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet230": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet232": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet234": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet236": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet238": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet240": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet242": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet244": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet246": { + "profile_list" : "ingress_lossless_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet248": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet250": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet252": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet254": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet2": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet6": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet10": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet14": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet18": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet22": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet26": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet30": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet34": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet38": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet0": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet50": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet54": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet64": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet128": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet132": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet136": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet140": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet144": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet148": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet152": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet156": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet160": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet164": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet168": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet172": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet176": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet180": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet184": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet188": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet192": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet194": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet196": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet198": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet200": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet204": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet208": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet210": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet212": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet214": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet216": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet220": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet224": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet226": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet228": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet230": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet232": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet234": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet236": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet238": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet240": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet242": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet244": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet246": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } + }, + + "BUFFER_PG": { + "Ethernet248|3-4": { + "profile" : "NULL" + }, + "Ethernet248|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet250|3-4": { + "profile" : "NULL" + }, + "Ethernet250|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet252|3-4": { + "profile" : "NULL" + }, + "Ethernet252|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet254|3-4": { + "profile" : "NULL" + }, + "Ethernet254|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet2|3-4": { + "profile" : "NULL" + }, + "Ethernet2|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|3-4": { + "profile" : "NULL" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet6|3-4": { + "profile" : "NULL" + }, + "Ethernet6|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|3-4": { + "profile" : "NULL" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet10|3-4": { + "profile" : "NULL" + }, + "Ethernet10|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|3-4": { + "profile" : "NULL" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet14|3-4": { + "profile" : "NULL" + }, + "Ethernet14|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|3-4": { + "profile" : "NULL" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet18|3-4": { + "profile" : "NULL" + }, + "Ethernet18|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|3-4": { + "profile" : "NULL" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet22|3-4": { + "profile" : "NULL" + }, + "Ethernet22|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|3-4": { + "profile" : "NULL" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet26|3-4": { + "profile" : "NULL" + }, + "Ethernet26|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|3-4": { + "profile" : "NULL" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet30|3-4": { + "profile" : "NULL" + }, + "Ethernet30|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|3-4": { + "profile" : "NULL" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet34|3-4": { + "profile" : "NULL" + }, + "Ethernet34|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|3-4": { + "profile" : "NULL" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet38|3-4": { + "profile" : "NULL" + }, + "Ethernet38|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|3-4": { + "profile" : "NULL" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet0|3-4": { + "profile" : "NULL" + }, + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|3-4": { + "profile" : "NULL" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|3-4": { + "profile" : "NULL" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet50|3-4": { + "profile" : "NULL" + }, + "Ethernet50|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|3-4": { + "profile" : "NULL" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet54|3-4": { + "profile" : "NULL" + }, + "Ethernet54|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|3-4": { + "profile" : "NULL" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|3-4": { + "profile" : "NULL" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|3-4": { + "profile" : "NULL" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|3-4": { + "profile" : "NULL" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|3-4": { + "profile" : "NULL" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|3-4": { + "profile" : "NULL" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|3-4": { + "profile" : "NULL" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|3-4": { + "profile" : "NULL" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|3-4": { + "profile" : "NULL" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|3-4": { + "profile" : "NULL" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|3-4": { + "profile" : "NULL" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|3-4": { + "profile" : "NULL" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|3-4": { + "profile" : "NULL" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|3-4": { + "profile" : "NULL" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|3-4": { + "profile" : "NULL" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|3-4": { + "profile" : "NULL" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|3-4": { + "profile" : "NULL" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|3-4": { + "profile" : "NULL" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet128|3-4": { + "profile" : "NULL" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet132|3-4": { + "profile" : "NULL" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet136|3-4": { + "profile" : "NULL" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet140|3-4": { + "profile" : "NULL" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet144|3-4": { + "profile" : "NULL" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet148|3-4": { + "profile" : "NULL" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet152|3-4": { + "profile" : "NULL" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet156|3-4": { + "profile" : "NULL" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet160|3-4": { + "profile" : "NULL" + }, + "Ethernet160|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet164|3-4": { + "profile" : "NULL" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet168|3-4": { + "profile" : "NULL" + }, + "Ethernet168|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet172|3-4": { + "profile" : "NULL" + }, + "Ethernet172|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet176|3-4": { + "profile" : "NULL" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet180|3-4": { + "profile" : "NULL" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet184|3-4": { + "profile" : "NULL" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet188|3-4": { + "profile" : "NULL" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet192|3-4": { + "profile" : "NULL" + }, + "Ethernet192|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet194|3-4": { + "profile" : "NULL" + }, + "Ethernet194|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet196|3-4": { + "profile" : "NULL" + }, + "Ethernet196|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet198|3-4": { + "profile" : "NULL" + }, + "Ethernet198|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet200|3-4": { + "profile" : "NULL" + }, + "Ethernet200|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet204|3-4": { + "profile" : "NULL" + }, + "Ethernet204|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet208|3-4": { + "profile" : "NULL" + }, + "Ethernet208|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet210|3-4": { + "profile" : "NULL" + }, + "Ethernet210|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet212|3-4": { + "profile" : "NULL" + }, + "Ethernet212|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet214|3-4": { + "profile" : "NULL" + }, + "Ethernet214|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet216|3-4": { + "profile" : "NULL" + }, + "Ethernet216|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet220|3-4": { + "profile" : "NULL" + }, + "Ethernet220|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet224|3-4": { + "profile" : "NULL" + }, + "Ethernet224|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet226|3-4": { + "profile" : "NULL" + }, + "Ethernet226|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet228|3-4": { + "profile" : "NULL" + }, + "Ethernet228|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet230|3-4": { + "profile" : "NULL" + }, + "Ethernet230|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet232|3-4": { + "profile" : "NULL" + }, + "Ethernet232|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet234|3-4": { + "profile" : "NULL" + }, + "Ethernet234|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet236|3-4": { + "profile" : "NULL" + }, + "Ethernet236|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet238|3-4": { + "profile" : "NULL" + }, + "Ethernet238|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet240|3-4": { + "profile" : "NULL" + }, + "Ethernet240|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet242|3-4": { + "profile" : "NULL" + }, + "Ethernet242|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet244|3-4": { + "profile" : "NULL" + }, + "Ethernet244|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet246|3-4": { + "profile" : "NULL" + }, + "Ethernet246|0": { + "profile" : "ingress_lossy_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet248|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet250|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet252|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet254|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet2|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet6|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet10|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet14|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet18|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet22|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet26|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet30|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet34|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet38|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet248|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet250|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet252|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet254|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet2|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet26|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet30|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet34|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet38|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet248|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet250|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet252|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet254|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet2|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet26|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet30|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet34|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet38|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-6": { + "profile" : "q_lossy_profile" + } +, + "Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet50|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet54|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet128|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet132|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet136|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet140|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet144|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet148|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet152|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet156|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet160|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet164|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet168|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet172|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet176|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet192|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet194|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet196|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet198|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet200|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet204|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet208|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet210|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet212|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet214|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet216|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet220|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet224|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet226|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet228|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet230|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet232|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet234|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet236|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet238|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet240|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet242|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet244|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet246|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet0|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet50|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet54|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet128|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet132|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet136|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet140|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet144|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet148|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet152|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet156|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet160|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet164|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet168|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet172|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet176|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet180|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet184|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet188|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet192|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet194|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet196|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet198|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet200|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet204|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet208|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet210|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet212|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet214|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet216|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet220|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet224|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet226|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet228|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet230|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet232|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet234|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet236|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet238|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet240|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet242|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet244|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet246|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet50|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet54|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet128|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet132|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet136|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet140|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet144|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet148|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet152|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet156|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet160|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet164|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet168|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet172|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet176|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet180|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet184|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet188|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet192|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet194|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet196|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet198|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet200|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet204|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet208|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet210|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet212|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet214|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet216|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet220|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet224|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet226|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet228|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet230|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet232|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet234|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet236|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet238|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet240|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet242|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet244|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet246|5-6": { + "profile" : "q_lossy_profile" + } + } +, "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0"} + }, + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1024", + "small_packet_percentage": "100" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-dynamic.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-dynamic.json new file mode 100644 index 000000000000..a784d0e0cff3 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-dynamic.json @@ -0,0 +1,2044 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet2": "5m", + "Ethernet4": "5m", + "Ethernet6": "5m", + "Ethernet8": "5m", + "Ethernet10": "5m", + "Ethernet12": "5m", + "Ethernet14": "5m", + "Ethernet16": "5m", + "Ethernet18": "5m", + "Ethernet20": "5m", + "Ethernet22": "5m", + "Ethernet24": "5m", + "Ethernet26": "5m", + "Ethernet28": "5m", + "Ethernet30": "5m", + "Ethernet32": "5m", + "Ethernet34": "5m", + "Ethernet36": "5m", + "Ethernet38": "5m", + "Ethernet40": "5m", + "Ethernet44": "5m", + "Ethernet48": "5m", + "Ethernet50": "5m", + "Ethernet52": "5m", + "Ethernet54": "5m", + "Ethernet56": "5m", + "Ethernet60": "5m", + "Ethernet64": "5m", + "Ethernet68": "5m", + "Ethernet72": "5m", + "Ethernet76": "5m", + "Ethernet80": "5m", + "Ethernet84": "5m", + "Ethernet88": "5m", + "Ethernet92": "5m", + "Ethernet96": "5m", + "Ethernet100": "5m", + "Ethernet104": "5m", + "Ethernet108": "5m", + "Ethernet112": "5m", + "Ethernet116": "5m", + "Ethernet120": "5m", + "Ethernet124": "5m", + "Ethernet128": "5m", + "Ethernet132": "5m", + "Ethernet136": "5m", + "Ethernet140": "5m", + "Ethernet144": "5m", + "Ethernet148": "5m", + "Ethernet152": "5m", + "Ethernet156": "5m", + "Ethernet160": "5m", + "Ethernet164": "5m", + "Ethernet168": "5m", + "Ethernet172": "5m", + "Ethernet176": "5m", + "Ethernet180": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet192": "5m", + "Ethernet194": "5m", + "Ethernet196": "5m", + "Ethernet198": "5m", + "Ethernet200": "5m", + "Ethernet204": "5m", + "Ethernet208": "5m", + "Ethernet210": "5m", + "Ethernet212": "5m", + "Ethernet214": "5m", + "Ethernet216": "5m", + "Ethernet220": "5m", + "Ethernet224": "5m", + "Ethernet226": "5m", + "Ethernet228": "5m", + "Ethernet230": "5m", + "Ethernet232": "5m", + "Ethernet234": "5m", + "Ethernet236": "5m", + "Ethernet238": "5m", + "Ethernet240": "5m", + "Ethernet242": "5m", + "Ethernet244": "5m", + "Ethernet246": "5m", + "Ethernet248": "40m", + "Ethernet250": "40m", + "Ethernet252": "40m", + "Ethernet254": "40m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "60817392", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet248": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet250": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet252": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet254": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet2": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet6": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet8": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet10": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet14": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet18": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet22": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet26": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet30": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet34": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet38": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile" + } +, + "Ethernet0": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet50": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet54": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet64": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet128": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet132": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet136": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet140": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet144": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet148": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet152": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet156": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet160": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet164": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet168": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet172": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet176": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet180": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet184": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet188": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet192": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet194": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet196": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet198": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet200": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet204": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet208": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet210": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet212": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet214": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet216": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet220": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet224": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet226": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet228": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet230": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet232": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet234": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet236": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet238": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet240": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet242": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet244": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet246": { + "profile_list" : "ingress_lossless_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet248": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet250": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet252": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet254": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet2": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet6": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet10": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet14": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet18": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet22": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet26": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet30": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet34": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet38": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet0": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet50": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet54": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet64": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet128": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet132": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet136": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet140": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet144": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet148": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet152": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet156": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet160": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet164": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet168": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet172": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet176": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet180": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet184": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet188": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet192": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet194": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet196": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet198": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet200": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet204": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet208": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet210": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet212": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet214": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet216": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet220": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet224": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet226": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet228": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet230": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet232": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet234": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet236": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet238": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet240": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet242": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet244": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet246": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } + }, + + "BUFFER_PG": { + "Ethernet2|3-4": { + "profile" : "NULL" + }, + "Ethernet2|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|3-4": { + "profile" : "NULL" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet6|3-4": { + "profile" : "NULL" + }, + "Ethernet6|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|3-4": { + "profile" : "NULL" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet10|3-4": { + "profile" : "NULL" + }, + "Ethernet10|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|3-4": { + "profile" : "NULL" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet14|3-4": { + "profile" : "NULL" + }, + "Ethernet14|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|3-4": { + "profile" : "NULL" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet18|3-4": { + "profile" : "NULL" + }, + "Ethernet18|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|3-4": { + "profile" : "NULL" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet22|3-4": { + "profile" : "NULL" + }, + "Ethernet22|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|3-4": { + "profile" : "NULL" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet26|3-4": { + "profile" : "NULL" + }, + "Ethernet26|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|3-4": { + "profile" : "NULL" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet30|3-4": { + "profile" : "NULL" + }, + "Ethernet30|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|3-4": { + "profile" : "NULL" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet34|3-4": { + "profile" : "NULL" + }, + "Ethernet34|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|3-4": { + "profile" : "NULL" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet38|3-4": { + "profile" : "NULL" + }, + "Ethernet38|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|3-4": { + "profile" : "NULL" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet248|2-4": { + "profile" : "NULL" + }, + "Ethernet248|6": { + "profile" : "NULL" + }, + "Ethernet248|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet250|2-4": { + "profile" : "NULL" + }, + "Ethernet250|6": { + "profile" : "NULL" + }, + "Ethernet250|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet252|2-4": { + "profile" : "NULL" + }, + "Ethernet252|6": { + "profile" : "NULL" + }, + "Ethernet252|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet254|2-4": { + "profile" : "NULL" + }, + "Ethernet254|6": { + "profile" : "NULL" + }, + "Ethernet254|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet0|3-4": { + "profile" : "NULL" + }, + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|3-4": { + "profile" : "NULL" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|3-4": { + "profile" : "NULL" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet50|3-4": { + "profile" : "NULL" + }, + "Ethernet50|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|3-4": { + "profile" : "NULL" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet54|3-4": { + "profile" : "NULL" + }, + "Ethernet54|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|3-4": { + "profile" : "NULL" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|3-4": { + "profile" : "NULL" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|3-4": { + "profile" : "NULL" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|3-4": { + "profile" : "NULL" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|3-4": { + "profile" : "NULL" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|3-4": { + "profile" : "NULL" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|3-4": { + "profile" : "NULL" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|3-4": { + "profile" : "NULL" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|3-4": { + "profile" : "NULL" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|3-4": { + "profile" : "NULL" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|3-4": { + "profile" : "NULL" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|3-4": { + "profile" : "NULL" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|3-4": { + "profile" : "NULL" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|3-4": { + "profile" : "NULL" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|3-4": { + "profile" : "NULL" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|3-4": { + "profile" : "NULL" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|3-4": { + "profile" : "NULL" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|3-4": { + "profile" : "NULL" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet128|3-4": { + "profile" : "NULL" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet132|3-4": { + "profile" : "NULL" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet136|3-4": { + "profile" : "NULL" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet140|3-4": { + "profile" : "NULL" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet144|3-4": { + "profile" : "NULL" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet148|3-4": { + "profile" : "NULL" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet152|3-4": { + "profile" : "NULL" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet156|3-4": { + "profile" : "NULL" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet160|3-4": { + "profile" : "NULL" + }, + "Ethernet160|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet164|3-4": { + "profile" : "NULL" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet168|3-4": { + "profile" : "NULL" + }, + "Ethernet168|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet172|3-4": { + "profile" : "NULL" + }, + "Ethernet172|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet176|3-4": { + "profile" : "NULL" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet180|3-4": { + "profile" : "NULL" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet184|3-4": { + "profile" : "NULL" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet188|3-4": { + "profile" : "NULL" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet192|3-4": { + "profile" : "NULL" + }, + "Ethernet192|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet194|3-4": { + "profile" : "NULL" + }, + "Ethernet194|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet196|3-4": { + "profile" : "NULL" + }, + "Ethernet196|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet198|3-4": { + "profile" : "NULL" + }, + "Ethernet198|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet200|3-4": { + "profile" : "NULL" + }, + "Ethernet200|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet204|3-4": { + "profile" : "NULL" + }, + "Ethernet204|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet208|3-4": { + "profile" : "NULL" + }, + "Ethernet208|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet210|3-4": { + "profile" : "NULL" + }, + "Ethernet210|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet212|3-4": { + "profile" : "NULL" + }, + "Ethernet212|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet214|3-4": { + "profile" : "NULL" + }, + "Ethernet214|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet216|3-4": { + "profile" : "NULL" + }, + "Ethernet216|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet220|3-4": { + "profile" : "NULL" + }, + "Ethernet220|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet224|3-4": { + "profile" : "NULL" + }, + "Ethernet224|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet226|3-4": { + "profile" : "NULL" + }, + "Ethernet226|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet228|3-4": { + "profile" : "NULL" + }, + "Ethernet228|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet230|3-4": { + "profile" : "NULL" + }, + "Ethernet230|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet232|3-4": { + "profile" : "NULL" + }, + "Ethernet232|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet234|3-4": { + "profile" : "NULL" + }, + "Ethernet234|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet236|3-4": { + "profile" : "NULL" + }, + "Ethernet236|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet238|3-4": { + "profile" : "NULL" + }, + "Ethernet238|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet240|3-4": { + "profile" : "NULL" + }, + "Ethernet240|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet242|3-4": { + "profile" : "NULL" + }, + "Ethernet242|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet244|3-4": { + "profile" : "NULL" + }, + "Ethernet244|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet246|3-4": { + "profile" : "NULL" + }, + "Ethernet246|0": { + "profile" : "ingress_lossy_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet2|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet6|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet10|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet14|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet18|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet22|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet26|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet30|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet34|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet38|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet2|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet26|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet30|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet34|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet38|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet2|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet26|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet30|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet34|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet38|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-7": { + "profile" : "q_lossy_profile" + } +, "Ethernet248|0-1": { + "profile" : "q_lossy_profile" + }, + "Ethernet248|2-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet248|5": { + "profile" : "q_lossy_profile" + }, + "Ethernet248|6": { + "profile" : "egress_lossless_profile" + }, + "Ethernet248|7": { + "profile" : "q_lossy_profile" + }, + "Ethernet250|0-1": { + "profile" : "q_lossy_profile" + }, + "Ethernet250|2-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet250|5": { + "profile" : "q_lossy_profile" + }, + "Ethernet250|6": { + "profile" : "egress_lossless_profile" + }, + "Ethernet250|7": { + "profile" : "q_lossy_profile" + }, + "Ethernet252|0-1": { + "profile" : "q_lossy_profile" + }, + "Ethernet252|2-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet252|5": { + "profile" : "q_lossy_profile" + }, + "Ethernet252|6": { + "profile" : "egress_lossless_profile" + }, + "Ethernet252|7": { + "profile" : "q_lossy_profile" + }, + "Ethernet254|0-1": { + "profile" : "q_lossy_profile" + }, + "Ethernet254|2-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet254|5": { + "profile" : "q_lossy_profile" + }, + "Ethernet254|6": { + "profile" : "egress_lossless_profile" + }, + "Ethernet254|7": { + "profile" : "q_lossy_profile" + } +, + "Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet50|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet54|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet128|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet132|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet136|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet140|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet144|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet148|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet152|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet156|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet160|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet164|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet168|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet172|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet176|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet192|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet194|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet196|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet198|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet200|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet204|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet208|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet210|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet212|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet214|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet216|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet220|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet224|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet226|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet228|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet230|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet232|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet234|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet236|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet238|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet240|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet242|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet244|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet246|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet0|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet50|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet54|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet128|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet132|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet136|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet140|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet144|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet148|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet152|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet156|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet160|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet164|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet168|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet172|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet176|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet180|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet184|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet188|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet192|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet194|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet196|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet198|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet200|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet204|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet208|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet210|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet212|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet214|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet216|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet220|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet224|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet226|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet228|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet230|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet232|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet234|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet236|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet238|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet240|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet242|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet244|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet246|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet50|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet54|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet128|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet132|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet136|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet140|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet144|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet148|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet152|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet156|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet160|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet164|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet168|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet172|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet176|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet180|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet184|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet188|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet192|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet194|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet196|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet198|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet200|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet204|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet208|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet210|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet212|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet214|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet216|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet220|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet224|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet226|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet228|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet230|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet232|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet234|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet236|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet238|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet240|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet242|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet244|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet246|5-7": { + "profile" : "q_lossy_profile" + } + } +, "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0"} + }, + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1024", + "small_packet_percentage": "100" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2700.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-remap-disabled.json similarity index 55% rename from src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2700.json rename to src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-remap-disabled.json index 49da9b064afa..deaf75d0db24 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2700.json +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0-remap-disabled.json @@ -14,49 +14,81 @@ "Ethernet20": "5m", "Ethernet22": "5m", "Ethernet24": "5m", + "Ethernet26": "5m", "Ethernet28": "5m", + "Ethernet30": "5m", "Ethernet32": "5m", + "Ethernet34": "5m", "Ethernet36": "5m", + "Ethernet38": "5m", "Ethernet40": "5m", - "Ethernet42": "5m", "Ethernet44": "5m", - "Ethernet46": "5m", "Ethernet48": "5m", "Ethernet50": "5m", "Ethernet52": "5m", "Ethernet54": "5m", "Ethernet56": "5m", - "Ethernet58": "5m", "Ethernet60": "5m", - "Ethernet62": "5m", - "Ethernet64": "40m", - "Ethernet66": "40m", - "Ethernet68": "40m", - "Ethernet70": "40m", + "Ethernet64": "5m", + "Ethernet68": "5m", "Ethernet72": "5m", - "Ethernet74": "5m", "Ethernet76": "5m", - "Ethernet78": "5m", "Ethernet80": "5m", - "Ethernet82": "5m", "Ethernet84": "5m", - "Ethernet86": "5m", "Ethernet88": "5m", "Ethernet92": "5m", "Ethernet96": "5m", "Ethernet100": "5m", "Ethernet104": "5m", - "Ethernet106": "5m", "Ethernet108": "5m", - "Ethernet110": "5m", "Ethernet112": "5m", - "Ethernet114": "5m", "Ethernet116": "5m", - "Ethernet118": "5m", "Ethernet120": "5m", - "Ethernet122": "5m", "Ethernet124": "5m", - "Ethernet126": "5m" + "Ethernet128": "5m", + "Ethernet132": "5m", + "Ethernet136": "5m", + "Ethernet140": "5m", + "Ethernet144": "5m", + "Ethernet148": "5m", + "Ethernet152": "5m", + "Ethernet156": "5m", + "Ethernet160": "5m", + "Ethernet164": "5m", + "Ethernet168": "5m", + "Ethernet172": "5m", + "Ethernet176": "5m", + "Ethernet180": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet192": "5m", + "Ethernet194": "5m", + "Ethernet196": "5m", + "Ethernet198": "5m", + "Ethernet200": "5m", + "Ethernet204": "5m", + "Ethernet208": "5m", + "Ethernet210": "5m", + "Ethernet212": "5m", + "Ethernet214": "5m", + "Ethernet216": "5m", + "Ethernet220": "5m", + "Ethernet224": "5m", + "Ethernet226": "5m", + "Ethernet228": "5m", + "Ethernet230": "5m", + "Ethernet232": "5m", + "Ethernet234": "5m", + "Ethernet236": "5m", + "Ethernet238": "5m", + "Ethernet240": "5m", + "Ethernet242": "5m", + "Ethernet244": "5m", + "Ethernet246": "5m", + "Ethernet248": "40m", + "Ethernet250": "40m", + "Ethernet252": "40m", + "Ethernet254": "40m" } }, @@ -67,18 +99,18 @@ "size": "0" }, "ingress_lossless_pool": { - "size": "7719936", - "xoff": "1032192", + "size": "55902208", + "xoff": "1179648", "type": "ingress", "mode": "dynamic" }, "egress_lossless_pool": { - "size": "13945824", + "size": "60817392", "type": "egress", "mode": "dynamic" }, "egress_lossy_pool": { - "size": "7719936", + "size": "55902208", "type": "egress", "mode": "dynamic" } @@ -131,16 +163,16 @@ } }, "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "Ethernet64": { + "Ethernet248": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet66": { + "Ethernet250": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet68": { + "Ethernet252": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet70": { + "Ethernet254": { "profile_list" : "ingress_lossless_profile" }, "Ethernet2": { @@ -179,79 +211,73 @@ "Ethernet24": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet28": { + "Ethernet26": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet32": { + "Ethernet28": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet36": { + "Ethernet30": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet40": { + "Ethernet32": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet42": { + "Ethernet34": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet44": { + "Ethernet36": { "profile_list" : "ingress_lossless_profile" }, - "Ethernet46": { + "Ethernet38": { "profile_list" : "ingress_lossless_profile" }, "Ethernet48": { "profile_list" : "ingress_lossless_profile" + } +, + "Ethernet0": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_zero_profile" }, "Ethernet50": { - "profile_list" : "ingress_lossless_profile" + "profile_list" : "ingress_lossless_zero_profile" }, "Ethernet52": { - "profile_list" : "ingress_lossless_profile" + "profile_list" : "ingress_lossless_zero_profile" }, "Ethernet54": { - "profile_list" : "ingress_lossless_profile" - }, - "Ethernet56": { - "profile_list" : "ingress_lossless_profile" - } -, - "Ethernet0": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet58": { + "Ethernet56": { "profile_list" : "ingress_lossless_zero_profile" }, "Ethernet60": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet62": { + "Ethernet64": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet72": { + "Ethernet68": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet74": { + "Ethernet72": { "profile_list" : "ingress_lossless_zero_profile" }, "Ethernet76": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet78": { - "profile_list" : "ingress_lossless_zero_profile" - }, "Ethernet80": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet82": { - "profile_list" : "ingress_lossless_zero_profile" - }, "Ethernet84": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet86": { - "profile_list" : "ingress_lossless_zero_profile" - }, "Ethernet88": { "profile_list" : "ingress_lossless_zero_profile" }, @@ -267,51 +293,153 @@ "Ethernet104": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet106": { + "Ethernet108": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet108": { + "Ethernet112": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet110": { + "Ethernet116": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet112": { + "Ethernet120": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet114": { + "Ethernet124": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet116": { + "Ethernet128": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet118": { + "Ethernet132": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet120": { + "Ethernet136": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet122": { + "Ethernet140": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet124": { + "Ethernet144": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet148": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet152": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet156": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet160": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet164": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet168": { "profile_list" : "ingress_lossless_zero_profile" }, - "Ethernet126": { + "Ethernet172": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet176": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet180": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet184": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet188": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet192": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet194": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet196": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet198": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet200": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet204": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet208": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet210": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet212": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet214": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet216": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet220": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet224": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet226": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet228": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet230": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet232": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet234": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet236": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet238": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet240": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet242": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet244": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet246": { "profile_list" : "ingress_lossless_zero_profile" } }, "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "Ethernet64": { + "Ethernet248": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet66": { + "Ethernet250": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet68": { + "Ethernet252": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet70": { + "Ethernet254": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, "Ethernet2": { @@ -350,79 +478,73 @@ "Ethernet24": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet28": { + "Ethernet26": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet32": { + "Ethernet28": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet36": { + "Ethernet30": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet40": { + "Ethernet32": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet42": { + "Ethernet34": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet44": { + "Ethernet36": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, - "Ethernet46": { + "Ethernet38": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" }, "Ethernet48": { "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet0": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, "Ethernet50": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, "Ethernet52": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, "Ethernet54": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }, - "Ethernet56": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - } -, - "Ethernet0": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet58": { + "Ethernet56": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, "Ethernet60": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet62": { + "Ethernet64": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet72": { + "Ethernet68": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet74": { + "Ethernet72": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, "Ethernet76": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet78": { - "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" - }, "Ethernet80": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet82": { - "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" - }, "Ethernet84": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet86": { - "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" - }, "Ethernet88": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, @@ -438,51 +560,154 @@ "Ethernet104": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet106": { + "Ethernet108": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet108": { + "Ethernet112": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet110": { + "Ethernet116": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet112": { + "Ethernet120": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet114": { + "Ethernet124": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet116": { + "Ethernet128": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet118": { + "Ethernet132": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet120": { + "Ethernet136": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet122": { + "Ethernet140": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet124": { + "Ethernet144": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet148": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet152": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet156": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet160": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet164": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet168": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet172": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet176": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet180": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet184": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" }, - "Ethernet126": { + "Ethernet188": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet192": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet194": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet196": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet198": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet200": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet204": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet208": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet210": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet212": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet214": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet216": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet220": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet224": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet226": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet228": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet230": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet232": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet234": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet236": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet238": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet240": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet242": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet244": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet246": { "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" } }, + "BUFFER_PG": { - "Ethernet64|0": { + "Ethernet248|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet66|0": { + "Ethernet250|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet68|0": { + "Ethernet252|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet70|0": { + "Ethernet254|0": { "profile" : "ingress_lossy_profile" }, "Ethernet2|0": { @@ -521,76 +746,70 @@ "Ethernet24|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet28|0": { + "Ethernet26|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet32|0": { + "Ethernet28|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet36|0": { + "Ethernet30|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet40|0": { + "Ethernet32|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet42|0": { + "Ethernet34|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet44|0": { + "Ethernet36|0": { "profile" : "ingress_lossy_profile" }, - "Ethernet46|0": { + "Ethernet38|0": { "profile" : "ingress_lossy_profile" }, "Ethernet48|0": { "profile" : "ingress_lossy_profile" - }, - "Ethernet50|0": { - "profile" : "ingress_lossy_profile" - }, - "Ethernet52|0": { - "profile" : "ingress_lossy_profile" - }, - "Ethernet54|0": { - "profile" : "ingress_lossy_profile" - }, - "Ethernet56|0": { - "profile" : "ingress_lossy_profile" } , "Ethernet0|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet58|0": { + "Ethernet40|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet60|0": { + "Ethernet44|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet62|0": { + "Ethernet50|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet72|0": { + "Ethernet52|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet74|0": { + "Ethernet54|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet76|0": { + "Ethernet56|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet78|0": { + "Ethernet60|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet80|0": { + "Ethernet64|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet82|0": { + "Ethernet68|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet84|0": { + "Ethernet72|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet86|0": { + "Ethernet76|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet84|0": { "profile" : "ingress_lossy_pg_zero_profile" }, "Ethernet88|0": { @@ -608,52 +827,154 @@ "Ethernet104|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet106|0": { + "Ethernet108|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet108|0": { + "Ethernet112|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet110|0": { + "Ethernet116|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet112|0": { + "Ethernet120|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet114|0": { + "Ethernet124|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet116|0": { + "Ethernet128|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet118|0": { + "Ethernet132|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet120|0": { + "Ethernet136|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet122|0": { + "Ethernet140|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet124|0": { + "Ethernet144|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet156|0": { "profile" : "ingress_lossy_pg_zero_profile" }, - "Ethernet126|0": { + "Ethernet160|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet168|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet172|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet192|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet194|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet196|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet198|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet200|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet204|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet208|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet210|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet212|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet214|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet216|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet220|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet224|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet226|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet228|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet230|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet232|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet234|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet236|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet238|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet240|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet242|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet244|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet246|0": { "profile" : "ingress_lossy_pg_zero_profile" } }, "BUFFER_QUEUE": { - "Ethernet64|3-4": { + "Ethernet248|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet66|3-4": { + "Ethernet250|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet68|3-4": { + "Ethernet252|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet70|3-4": { + "Ethernet254|3-4": { "profile" : "egress_lossless_profile" }, "Ethernet2|3-4": { @@ -692,52 +1013,40 @@ "Ethernet24|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet28|3-4": { + "Ethernet26|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet32|3-4": { + "Ethernet28|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet36|3-4": { + "Ethernet30|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet40|3-4": { + "Ethernet32|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet42|3-4": { + "Ethernet34|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet44|3-4": { + "Ethernet36|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet46|3-4": { + "Ethernet38|3-4": { "profile" : "egress_lossless_profile" }, "Ethernet48|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet50|3-4": { - "profile" : "egress_lossless_profile" - }, - "Ethernet52|3-4": { - "profile" : "egress_lossless_profile" - }, - "Ethernet54|3-4": { - "profile" : "egress_lossless_profile" - }, - "Ethernet56|3-4": { - "profile" : "egress_lossless_profile" - }, - "Ethernet64|0-2": { + "Ethernet248|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet66|0-2": { + "Ethernet250|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet68|0-2": { + "Ethernet252|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet70|0-2": { + "Ethernet254|0-2": { "profile" : "q_lossy_profile" }, "Ethernet2|0-2": { @@ -776,52 +1085,40 @@ "Ethernet24|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet28|0-2": { + "Ethernet26|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet32|0-2": { + "Ethernet28|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet36|0-2": { + "Ethernet30|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet40|0-2": { + "Ethernet32|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet42|0-2": { + "Ethernet34|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet44|0-2": { + "Ethernet36|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet46|0-2": { + "Ethernet38|0-2": { "profile" : "q_lossy_profile" }, "Ethernet48|0-2": { "profile" : "q_lossy_profile" }, - "Ethernet50|0-2": { + "Ethernet248|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet52|0-2": { + "Ethernet250|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet54|0-2": { + "Ethernet252|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet56|0-2": { - "profile" : "q_lossy_profile" - }, - "Ethernet64|5-6": { - "profile" : "q_lossy_profile" - }, - "Ethernet66|5-6": { - "profile" : "q_lossy_profile" - }, - "Ethernet68|5-6": { - "profile" : "q_lossy_profile" - }, - "Ethernet70|5-6": { + "Ethernet254|5-6": { "profile" : "q_lossy_profile" }, "Ethernet2|5-6": { @@ -860,77 +1157,71 @@ "Ethernet24|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet28|5-6": { + "Ethernet26|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet32|5-6": { + "Ethernet28|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet36|5-6": { + "Ethernet30|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet40|5-6": { + "Ethernet32|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet42|5-6": { + "Ethernet34|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet44|5-6": { + "Ethernet36|5-6": { "profile" : "q_lossy_profile" }, - "Ethernet46|5-6": { + "Ethernet38|5-6": { "profile" : "q_lossy_profile" }, "Ethernet48|5-6": { "profile" : "q_lossy_profile" - }, - "Ethernet50|5-6": { - "profile" : "q_lossy_profile" - }, - "Ethernet52|5-6": { - "profile" : "q_lossy_profile" - }, - "Ethernet54|5-6": { - "profile" : "q_lossy_profile" - }, - "Ethernet56|5-6": { - "profile" : "q_lossy_profile" } , "Ethernet0|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet58|3-4": { + "Ethernet40|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet60|3-4": { + "Ethernet44|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet62|3-4": { + "Ethernet50|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet72|3-4": { + "Ethernet52|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet74|3-4": { + "Ethernet54|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet76|3-4": { + "Ethernet56|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet78|3-4": { + "Ethernet60|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet80|3-4": { + "Ethernet64|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet82|3-4": { + "Ethernet68|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet84|3-4": { + "Ethernet72|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet86|3-4": { + "Ethernet76|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet84|3-4": { "profile" : "egress_lossless_zero_profile" }, "Ethernet88|3-4": { @@ -948,73 +1239,181 @@ "Ethernet104|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet106|3-4": { + "Ethernet108|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet108|3-4": { + "Ethernet112|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet110|3-4": { + "Ethernet116|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet112|3-4": { + "Ethernet120|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet114|3-4": { + "Ethernet124|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet116|3-4": { + "Ethernet128|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet118|3-4": { + "Ethernet132|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet120|3-4": { + "Ethernet136|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet122|3-4": { + "Ethernet140|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet124|3-4": { + "Ethernet144|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet148|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet152|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet156|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet160|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet164|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet168|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet172|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet176|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet180|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet184|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet188|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet192|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet194|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet196|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet198|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet200|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet204|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet208|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet210|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet212|3-4": { "profile" : "egress_lossless_zero_profile" }, - "Ethernet126|3-4": { + "Ethernet214|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet216|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet220|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet224|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet226|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet228|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet230|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet232|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet234|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet236|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet238|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet240|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet242|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet244|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet246|3-4": { "profile" : "egress_lossless_zero_profile" }, "Ethernet0|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet58|0-2": { + "Ethernet40|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet60|0-2": { + "Ethernet44|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet62|0-2": { + "Ethernet50|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet72|0-2": { + "Ethernet52|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet74|0-2": { + "Ethernet54|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet76|0-2": { + "Ethernet56|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet78|0-2": { + "Ethernet60|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet80|0-2": { + "Ethernet64|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet82|0-2": { + "Ethernet68|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet84|0-2": { + "Ethernet72|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet86|0-2": { + "Ethernet76|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet80|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet84|0-2": { "profile" : "egress_lossy_zero_profile" }, "Ethernet88|0-2": { @@ -1032,73 +1431,181 @@ "Ethernet104|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet106|0-2": { + "Ethernet108|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet108|0-2": { + "Ethernet112|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet110|0-2": { + "Ethernet116|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet112|0-2": { + "Ethernet120|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet124|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet114|0-2": { + "Ethernet128|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet116|0-2": { + "Ethernet132|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet118|0-2": { + "Ethernet136|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet120|0-2": { + "Ethernet140|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet122|0-2": { + "Ethernet144|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet124|0-2": { + "Ethernet148|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet152|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet156|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet160|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet164|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet168|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet172|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet176|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet180|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet184|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet188|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet192|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet194|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet196|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet198|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet200|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet204|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet208|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet210|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet212|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet214|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet216|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet220|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet224|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet226|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet228|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet230|0-2": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet126|0-2": { + "Ethernet232|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet234|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet236|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet238|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet240|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet242|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet244|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet246|0-2": { "profile" : "egress_lossy_zero_profile" }, "Ethernet0|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet58|5-6": { + "Ethernet40|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet60|5-6": { + "Ethernet44|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet62|5-6": { + "Ethernet50|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet72|5-6": { + "Ethernet52|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet74|5-6": { + "Ethernet54|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet76|5-6": { + "Ethernet56|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet78|5-6": { + "Ethernet60|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet80|5-6": { + "Ethernet64|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet82|5-6": { + "Ethernet68|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet84|5-6": { + "Ethernet72|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet86|5-6": { + "Ethernet76|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet80|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet84|5-6": { "profile" : "egress_lossy_zero_profile" }, "Ethernet88|5-6": { @@ -1116,37 +1623,139 @@ "Ethernet104|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet106|5-6": { + "Ethernet108|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet108|5-6": { + "Ethernet112|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet110|5-6": { + "Ethernet116|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet112|5-6": { + "Ethernet120|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet124|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet114|5-6": { + "Ethernet128|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet116|5-6": { + "Ethernet132|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet118|5-6": { + "Ethernet136|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet120|5-6": { + "Ethernet140|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet122|5-6": { + "Ethernet144|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet124|5-6": { + "Ethernet148|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet152|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet156|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet160|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet164|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet168|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet172|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet176|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet180|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet184|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet188|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet192|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet194|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet196|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet198|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet200|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet204|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet208|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet210|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet212|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet214|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet216|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet220|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet224|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet226|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet228|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet230|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet232|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet234|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet236|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet238|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet240|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet242|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet244|5-6": { "profile" : "egress_lossy_zero_profile" }, - "Ethernet126|5-6": { + "Ethernet246|5-6": { "profile" : "egress_lossy_zero_profile" } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0.json new file mode 100644 index 000000000000..e41215e6efb0 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox4600c-t0.json @@ -0,0 +1,1786 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet2": "5m", + "Ethernet4": "5m", + "Ethernet6": "5m", + "Ethernet8": "5m", + "Ethernet10": "5m", + "Ethernet12": "5m", + "Ethernet14": "5m", + "Ethernet16": "5m", + "Ethernet18": "5m", + "Ethernet20": "5m", + "Ethernet22": "5m", + "Ethernet24": "5m", + "Ethernet26": "5m", + "Ethernet28": "5m", + "Ethernet30": "5m", + "Ethernet32": "5m", + "Ethernet34": "5m", + "Ethernet36": "5m", + "Ethernet38": "5m", + "Ethernet40": "5m", + "Ethernet44": "5m", + "Ethernet48": "5m", + "Ethernet50": "5m", + "Ethernet52": "5m", + "Ethernet54": "5m", + "Ethernet56": "5m", + "Ethernet60": "5m", + "Ethernet64": "5m", + "Ethernet68": "5m", + "Ethernet72": "5m", + "Ethernet76": "5m", + "Ethernet80": "5m", + "Ethernet84": "5m", + "Ethernet88": "5m", + "Ethernet92": "5m", + "Ethernet96": "5m", + "Ethernet100": "5m", + "Ethernet104": "5m", + "Ethernet108": "5m", + "Ethernet112": "5m", + "Ethernet116": "5m", + "Ethernet120": "5m", + "Ethernet124": "5m", + "Ethernet128": "5m", + "Ethernet132": "5m", + "Ethernet136": "5m", + "Ethernet140": "5m", + "Ethernet144": "5m", + "Ethernet148": "5m", + "Ethernet152": "5m", + "Ethernet156": "5m", + "Ethernet160": "5m", + "Ethernet164": "5m", + "Ethernet168": "5m", + "Ethernet172": "5m", + "Ethernet176": "5m", + "Ethernet180": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet192": "5m", + "Ethernet194": "5m", + "Ethernet196": "5m", + "Ethernet198": "5m", + "Ethernet200": "5m", + "Ethernet204": "5m", + "Ethernet208": "5m", + "Ethernet210": "5m", + "Ethernet212": "5m", + "Ethernet214": "5m", + "Ethernet216": "5m", + "Ethernet220": "5m", + "Ethernet224": "5m", + "Ethernet226": "5m", + "Ethernet228": "5m", + "Ethernet230": "5m", + "Ethernet232": "5m", + "Ethernet234": "5m", + "Ethernet236": "5m", + "Ethernet238": "5m", + "Ethernet240": "5m", + "Ethernet242": "5m", + "Ethernet244": "5m", + "Ethernet246": "5m", + "Ethernet248": "40m", + "Ethernet250": "40m", + "Ethernet252": "40m", + "Ethernet254": "40m" + } + }, + + "BUFFER_POOL": { + "ingress_zero_pool" : { + "mode": "static", + "type": "ingress", + "size": "0" + }, + "ingress_lossless_pool": { + "size": "55058432", + "xoff": "1712128", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "60817392", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "55058432", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet248": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet250": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet252": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet254": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet2": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet6": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet8": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet10": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet14": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet18": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet22": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet26": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet30": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet34": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet38": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile" + } +, + "Ethernet0": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet50": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet54": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet64": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet128": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet132": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet136": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet140": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet144": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet148": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet152": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet156": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet160": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet164": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet168": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet172": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet176": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet180": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet184": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet188": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet192": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet194": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet196": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet198": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet200": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet204": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet208": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet210": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet212": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet214": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet216": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet220": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet224": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet226": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet228": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet230": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet232": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet234": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet236": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet238": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet240": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet242": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet244": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet246": { + "profile_list" : "ingress_lossless_zero_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet248": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet250": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet252": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet254": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet2": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet6": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet10": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet14": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet18": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet22": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet26": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet30": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet34": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet38": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet0": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet50": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet54": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet64": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet128": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet132": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet136": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet140": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet144": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet148": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet152": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet156": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet160": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet164": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet168": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet172": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet176": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet180": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet184": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet188": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet192": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet194": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet196": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet198": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet200": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet204": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet208": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet210": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet212": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet214": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet216": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet220": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet224": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet226": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet228": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet230": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet232": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet234": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet236": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet238": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet240": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet242": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet244": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet246": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + } + }, + + "BUFFER_PG": { + "Ethernet2|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet6|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet10|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet14|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet18|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet22|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet26|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet30|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet34|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet38|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet248|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet250|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet252|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet254|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet0|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet50|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet54|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet160|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet168|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet172|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet192|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet194|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet196|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet198|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet200|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet204|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet208|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet210|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet212|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet214|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet216|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet220|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet224|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet226|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet228|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet230|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet232|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet234|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet236|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet238|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet240|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet242|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet244|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet246|0": { + "profile" : "ingress_lossy_pg_zero_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet2|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet6|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet10|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet14|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet18|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet22|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet26|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet30|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet34|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet38|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet2|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet26|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet30|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet34|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet38|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet2|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet26|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet30|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet34|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet38|5-7": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-7": { + "profile" : "q_lossy_profile" + } +, "Ethernet248|0-1": { + "profile" : "q_lossy_profile" + }, + "Ethernet248|2-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet248|5": { + "profile" : "q_lossy_profile" + }, + "Ethernet248|6": { + "profile" : "egress_lossless_profile" + }, + "Ethernet248|7": { + "profile" : "q_lossy_profile" + }, + "Ethernet250|0-1": { + "profile" : "q_lossy_profile" + }, + "Ethernet250|2-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet250|5": { + "profile" : "q_lossy_profile" + }, + "Ethernet250|6": { + "profile" : "egress_lossless_profile" + }, + "Ethernet250|7": { + "profile" : "q_lossy_profile" + }, + "Ethernet252|0-1": { + "profile" : "q_lossy_profile" + }, + "Ethernet252|2-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet252|5": { + "profile" : "q_lossy_profile" + }, + "Ethernet252|6": { + "profile" : "egress_lossless_profile" + }, + "Ethernet252|7": { + "profile" : "q_lossy_profile" + }, + "Ethernet254|0-1": { + "profile" : "q_lossy_profile" + }, + "Ethernet254|2-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet254|5": { + "profile" : "q_lossy_profile" + }, + "Ethernet254|6": { + "profile" : "egress_lossless_profile" + }, + "Ethernet254|7": { + "profile" : "q_lossy_profile" + } +, + "Ethernet0|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet50|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet54|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet64|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet128|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet132|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet136|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet140|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet144|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet148|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet152|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet156|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet160|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet164|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet168|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet172|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet176|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet180|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet184|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet188|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet192|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet194|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet196|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet198|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet200|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet204|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet208|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet210|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet212|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet214|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet216|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet220|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet224|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet226|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet228|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet230|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet232|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet234|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet236|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet238|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet240|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet242|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet244|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet246|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet0|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet40|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet44|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet50|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet52|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet54|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet56|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet60|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet64|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet68|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet72|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet76|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet80|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet84|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet88|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet92|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet96|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet100|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet104|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet108|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet112|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet116|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet120|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet124|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet128|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet132|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet136|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet140|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet144|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet148|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet152|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet156|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet160|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet164|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet168|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet172|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet176|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet180|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet184|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet188|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet192|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet194|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet196|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet198|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet200|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet204|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet208|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet210|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet212|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet214|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet216|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet220|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet224|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet226|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet228|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet230|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet232|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet234|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet236|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet238|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet240|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet242|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet244|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet246|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet0|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet40|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet44|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet50|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet52|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet54|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet56|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet60|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet64|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet68|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet72|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet76|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet80|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet84|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet88|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet92|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet96|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet100|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet104|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet108|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet112|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet116|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet120|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet124|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet128|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet132|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet136|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet140|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet144|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet148|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet152|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet156|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet160|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet164|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet168|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet172|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet176|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet180|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet184|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet188|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet192|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet194|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet196|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet198|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet200|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet204|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet208|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet210|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet212|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet214|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet216|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet220|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet224|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet226|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet228|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet230|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet232|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet234|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet236|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet238|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet240|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet242|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet244|5-7": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet246|5-7": { + "profile" : "egress_lossy_zero_profile" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-d48c40-t0-remap-disabled.json b/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-d48c40-t0-remap-disabled.json new file mode 100644 index 000000000000..a131d36a5f82 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-d48c40-t0-remap-disabled.json @@ -0,0 +1,884 @@ + +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + "global": { + "dscp_to_tc_map" : "AZURE" + }, "Ethernet2": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet4": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet6": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet10": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet12": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet14": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet18": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet20": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet22": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet26": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet28": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet30": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet34": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet36": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet38": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet248": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet250": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet252": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet254": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet2|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet6|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet10|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet14|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet18|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet22|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet26|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet30|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet34|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet38|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet250|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet254|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet2|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet6|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet10|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet14|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet18|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet22|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet26|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet30|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet34|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet38|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet250|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet254|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet2|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet6|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet10|0": { + "scheduler": "scheduler.0" + }, + "Ethernet12|0": { + "scheduler": "scheduler.0" + }, + "Ethernet14|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet18|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet22|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet26|0": { + "scheduler": "scheduler.0" + }, + "Ethernet28|0": { + "scheduler": "scheduler.0" + }, + "Ethernet30|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet34|0": { + "scheduler": "scheduler.0" + }, + "Ethernet36|0": { + "scheduler": "scheduler.0" + }, + "Ethernet38|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet248|0": { + "scheduler": "scheduler.0" + }, + "Ethernet250|0": { + "scheduler": "scheduler.0" + }, + "Ethernet252|0": { + "scheduler": "scheduler.0" + }, + "Ethernet254|0": { + "scheduler": "scheduler.0" + }, + "Ethernet2|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet6|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet10|1": { + "scheduler": "scheduler.0" + }, + "Ethernet12|1": { + "scheduler": "scheduler.0" + }, + "Ethernet14|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet18|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet22|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet26|1": { + "scheduler": "scheduler.0" + }, + "Ethernet28|1": { + "scheduler": "scheduler.0" + }, + "Ethernet30|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet34|1": { + "scheduler": "scheduler.0" + }, + "Ethernet36|1": { + "scheduler": "scheduler.0" + }, + "Ethernet38|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet248|1": { + "scheduler": "scheduler.0" + }, + "Ethernet250|1": { + "scheduler": "scheduler.0" + }, + "Ethernet252|1": { + "scheduler": "scheduler.0" + }, + "Ethernet254|1": { + "scheduler": "scheduler.0" + }, + "Ethernet2|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet6|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet10|2": { + "scheduler": "scheduler.0" + }, + "Ethernet12|2": { + "scheduler": "scheduler.0" + }, + "Ethernet14|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet18|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet22|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet26|2": { + "scheduler": "scheduler.0" + }, + "Ethernet28|2": { + "scheduler": "scheduler.0" + }, + "Ethernet30|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet34|2": { + "scheduler": "scheduler.0" + }, + "Ethernet36|2": { + "scheduler": "scheduler.0" + }, + "Ethernet38|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet248|2": { + "scheduler": "scheduler.0" + }, + "Ethernet250|2": { + "scheduler": "scheduler.0" + }, + "Ethernet252|2": { + "scheduler": "scheduler.0" + }, + "Ethernet254|2": { + "scheduler": "scheduler.0" + }, + "Ethernet2|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet6|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet10|5": { + "scheduler": "scheduler.0" + }, + "Ethernet12|5": { + "scheduler": "scheduler.0" + }, + "Ethernet14|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet18|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet22|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet26|5": { + "scheduler": "scheduler.0" + }, + "Ethernet28|5": { + "scheduler": "scheduler.0" + }, + "Ethernet30|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet34|5": { + "scheduler": "scheduler.0" + }, + "Ethernet36|5": { + "scheduler": "scheduler.0" + }, + "Ethernet38|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet248|5": { + "scheduler": "scheduler.0" + }, + "Ethernet250|5": { + "scheduler": "scheduler.0" + }, + "Ethernet252|5": { + "scheduler": "scheduler.0" + }, + "Ethernet254|5": { + "scheduler": "scheduler.0" + }, + "Ethernet2|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet6|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet10|6": { + "scheduler": "scheduler.0" + }, + "Ethernet12|6": { + "scheduler": "scheduler.0" + }, + "Ethernet14|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet18|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet22|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet26|6": { + "scheduler": "scheduler.0" + }, + "Ethernet28|6": { + "scheduler": "scheduler.0" + }, + "Ethernet30|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet34|6": { + "scheduler": "scheduler.0" + }, + "Ethernet36|6": { + "scheduler": "scheduler.0" + }, + "Ethernet38|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet248|6": { + "scheduler": "scheduler.0" + }, + "Ethernet250|6": { + "scheduler": "scheduler.0" + }, + "Ethernet252|6": { + "scheduler": "scheduler.0" + }, + "Ethernet254|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-d48c40-t0.json b/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-d48c40-t0.json new file mode 100644 index 000000000000..90190f9b133f --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-d48c40-t0.json @@ -0,0 +1,1155 @@ + + +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0", + "8": "0" + }, + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "0", + "8": "0" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "2", + "3": "2", + "4": "6", + "5": "5", + "6": "6", + "7": "7", + "8": "1" + }, + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "1" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE_UPLINK": { + "0" : "1", + "1" : "1", + "2" : "2", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "6", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + }, + "AZURE_TUNNEL": + { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + }, + "AZURE": + { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "2", + "3": "2", + "4": "6", + "5": "46", + "6": "6", + "7": "48", + "8": "33" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + + "Ethernet2": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet4": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet6": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet8": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet10": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet12": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet14": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet18": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet20": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet22": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet24": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet26": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet28": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet30": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet32": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet34": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet36": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet38": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet48": { + + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet248": { + "dscp_to_tc_map" : "AZURE_UPLINK", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet250": { + "dscp_to_tc_map" : "AZURE_UPLINK", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet252": { + "dscp_to_tc_map" : "AZURE_UPLINK", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet254": { + "dscp_to_tc_map" : "AZURE_UPLINK", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet2|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet6|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet10|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet14|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet18|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet22|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet26|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet30|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet34|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet38|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet250|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet254|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet2|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet6|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet10|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet14|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet18|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet22|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet26|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet30|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet34|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet38|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet250|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet254|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet2|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet6|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet10|0": { + "scheduler": "scheduler.0" + }, + "Ethernet12|0": { + "scheduler": "scheduler.0" + }, + "Ethernet14|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet18|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet22|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet26|0": { + "scheduler": "scheduler.0" + }, + "Ethernet28|0": { + "scheduler": "scheduler.0" + }, + "Ethernet30|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet34|0": { + "scheduler": "scheduler.0" + }, + "Ethernet36|0": { + "scheduler": "scheduler.0" + }, + "Ethernet38|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet248|0": { + "scheduler": "scheduler.0" + }, + "Ethernet250|0": { + "scheduler": "scheduler.0" + }, + "Ethernet252|0": { + "scheduler": "scheduler.0" + }, + "Ethernet254|0": { + "scheduler": "scheduler.0" + }, + "Ethernet2|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet6|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet10|1": { + "scheduler": "scheduler.0" + }, + "Ethernet12|1": { + "scheduler": "scheduler.0" + }, + "Ethernet14|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet18|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet22|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet26|1": { + "scheduler": "scheduler.0" + }, + "Ethernet28|1": { + "scheduler": "scheduler.0" + }, + "Ethernet30|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet34|1": { + "scheduler": "scheduler.0" + }, + "Ethernet36|1": { + "scheduler": "scheduler.0" + }, + "Ethernet38|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet248|1": { + "scheduler": "scheduler.0" + }, + "Ethernet250|1": { + "scheduler": "scheduler.0" + }, + "Ethernet252|1": { + "scheduler": "scheduler.0" + }, + "Ethernet254|1": { + "scheduler": "scheduler.0" + }, + "Ethernet2|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet6|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet10|2": { + "scheduler": "scheduler.0" + }, + "Ethernet12|2": { + "scheduler": "scheduler.0" + }, + "Ethernet14|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet18|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet22|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet26|2": { + "scheduler": "scheduler.0" + }, + "Ethernet28|2": { + "scheduler": "scheduler.0" + }, + "Ethernet30|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet34|2": { + "scheduler": "scheduler.0" + }, + "Ethernet36|2": { + "scheduler": "scheduler.0" + }, + "Ethernet38|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet248|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet250|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet254|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet2|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet6|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet10|5": { + "scheduler": "scheduler.0" + }, + "Ethernet12|5": { + "scheduler": "scheduler.0" + }, + "Ethernet14|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet18|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet22|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet26|5": { + "scheduler": "scheduler.0" + }, + "Ethernet28|5": { + "scheduler": "scheduler.0" + }, + "Ethernet30|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet34|5": { + "scheduler": "scheduler.0" + }, + "Ethernet36|5": { + "scheduler": "scheduler.0" + }, + "Ethernet38|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet248|5": { + "scheduler": "scheduler.0" + }, + "Ethernet250|5": { + "scheduler": "scheduler.0" + }, + "Ethernet252|5": { + "scheduler": "scheduler.0" + }, + "Ethernet254|5": { + "scheduler": "scheduler.0" + }, + "Ethernet2|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet6|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet10|6": { + "scheduler": "scheduler.0" + }, + "Ethernet12|6": { + "scheduler": "scheduler.0" + }, + "Ethernet14|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet18|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet22|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet26|6": { + "scheduler": "scheduler.0" + }, + "Ethernet28|6": { + "scheduler": "scheduler.0" + }, + "Ethernet30|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet34|6": { + "scheduler": "scheduler.0" + }, + "Ethernet36|6": { + "scheduler": "scheduler.0" + }, + "Ethernet38|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet248|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet250|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet254|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet2|7": { + "scheduler": "scheduler.0" + }, + "Ethernet4|7": { + "scheduler": "scheduler.0" + }, + "Ethernet6|7": { + "scheduler": "scheduler.0" + }, + "Ethernet8|7": { + "scheduler": "scheduler.0" + }, + "Ethernet10|7": { + "scheduler": "scheduler.0" + }, + "Ethernet12|7": { + "scheduler": "scheduler.0" + }, + "Ethernet14|7": { + "scheduler": "scheduler.0" + }, + "Ethernet16|7": { + "scheduler": "scheduler.0" + }, + "Ethernet18|7": { + "scheduler": "scheduler.0" + }, + "Ethernet20|7": { + "scheduler": "scheduler.0" + }, + "Ethernet22|7": { + "scheduler": "scheduler.0" + }, + "Ethernet24|7": { + "scheduler": "scheduler.0" + }, + "Ethernet26|7": { + "scheduler": "scheduler.0" + }, + "Ethernet28|7": { + "scheduler": "scheduler.0" + }, + "Ethernet30|7": { + "scheduler": "scheduler.0" + }, + "Ethernet32|7": { + "scheduler": "scheduler.0" + }, + "Ethernet34|7": { + "scheduler": "scheduler.0" + }, + "Ethernet36|7": { + "scheduler": "scheduler.0" + }, + "Ethernet38|7": { + "scheduler": "scheduler.0" + }, + "Ethernet48|7": { + "scheduler": "scheduler.0" + }, + "Ethernet248|7": { + "scheduler": "scheduler.0" + }, + "Ethernet250|7": { + "scheduler": "scheduler.0" + }, + "Ethernet252|7": { + "scheduler": "scheduler.0" + }, + "Ethernet254|7": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 40af24151c8b..0b5ad25be65b 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -365,6 +365,8 @@ def test_qos_dscp_remapping_render_template(self): '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64', '../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64', '../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64', + '../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40', + '../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40', '../../../device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S' ] sample_outputs = [ @@ -376,6 +378,8 @@ def test_qos_dscp_remapping_render_template(self): 'qos-arista7260-t1-remap-disabled.json', 'qos-mellanox4600c-c64.json', 'qos-mellanox4600c-c64-remap-disabled.json', + 'qos-mellanox4600c-d48c40-t0.json', + 'qos-mellanox4600c-d48c40-t0-remap-disabled.json', 'qos-arista7050-t0-storage-backend.json' ] sample_minigraph_files = [ @@ -387,6 +391,8 @@ def test_qos_dscp_remapping_render_template(self): 'sample-arista-7260-t1-minigraph-remap-disabled.xml', 'sample-mellanox-4600c-t1-minigraph.xml', 'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml', + 'sample-mellanox-4600c-t0-minigraph.xml', + 'sample-mellanox-4600c-t0-minigraph-remap-disabled.xml', 'sample-arista-7050-t0-storage-backend-minigraph.xml' ] @@ -482,9 +488,6 @@ def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer def test_buffers_dell6100_render_template(self): self._test_buffers_render_template('dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100', 'sample-dell-6100-t0-minigraph.xml', 'buffers.json.j2', 'buffers-dell6100.json') - def test_buffers_mellanox2700_render_template(self): - self._test_buffers_render_template('mellanox', 'x86_64-mlnx_msn2700-r0', 'Mellanox-SN2700-D48C8', 'sample-mellanox-2700-t0-minigraph.xml', 'buffers.json.j2', 'buffers-mellanox2700.json') - def test_buffers_mellanox2410_render_template(self): self._test_buffers_render_template('mellanox', 'x86_64-mlnx_msn2410-r0', 'ACS-MSN2410', 'sample-mellanox-2410-t1-minigraph.xml', 'buffers.json.j2', 'buffers-mellanox2410.json') @@ -507,8 +510,12 @@ def test_extra_lossless_buffer_for_tunnel_remapping(self): ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph.xml', 'buffers_dynamic.json.j2', 'buffers-mellanox4600c-t1-dynamic.json'), ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph.xml', 'buffers.json.j2', 'buffers-mellanox4600c-t1.json'), ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml', 'buffers_dynamic.json.j2', 'buffers-mellanox4600c-t1-dynamic-remap-disabled.json'), - ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml', 'buffers.json.j2', 'buffers-mellanox4600c-t1-remap-disabled.json') - ] + ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml', 'buffers.json.j2', 'buffers-mellanox4600c-t1-remap-disabled.json'), + ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-D48C40', 'sample-mellanox-4600c-t0-minigraph.xml', 'buffers_dynamic.json.j2', 'buffers-mellanox4600c-t0-dynamic.json'), + ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-D48C40', 'sample-mellanox-4600c-t0-minigraph.xml', 'buffers.json.j2', 'buffers-mellanox4600c-t0.json'), + ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-D48C40', 'sample-mellanox-4600c-t0-minigraph-remap-disabled.xml', 'buffers_dynamic.json.j2', 'buffers-mellanox4600c-t0-dynamic-remap-disabled.json'), + ('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-D48C40', 'sample-mellanox-4600c-t0-minigraph-remap-disabled.xml', 'buffers.json.j2', 'buffers-mellanox4600c-t0-remap-disabled.json') + ] for test_data in TEST_DATA: self._test_buffers_render_template(vendor=test_data[0], From 5e6e2c827d4b937c06d3c31f85c22b99f50d0d5c Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Tue, 7 Feb 2023 23:56:06 +0800 Subject: [PATCH 102/113] Fix issue: ERR healthd: Get unit status determine-reboot-cause-'LoadState' (#13697) - Why I did it Fix issue: ERR healthd: Get unit status determine-reboot-cause-'LoadState'. The error log is only seen on shutdown flow such as fast-reboot/warm-reboot. In shutdown flow, 'LoadState' might not be available in systemctl status output, using [] might cause a KeyError. - How I did it Use dict.get instead of [] - How to verify it Manual test --- src/system-health/health_checker/sysmonitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system-health/health_checker/sysmonitor.py b/src/system-health/health_checker/sysmonitor.py index dde0b73d1bce..b3f43e447f7b 100755 --- a/src/system-health/health_checker/sysmonitor.py +++ b/src/system-health/health_checker/sysmonitor.py @@ -273,7 +273,7 @@ def get_unit_status(self, event): sysctl_show = self.run_systemctl_show(event) - load_state = sysctl_show['LoadState'] + load_state = sysctl_show.get('LoadState') if load_state == "loaded": status = sysctl_show['UnitFileState'] fail_reason = sysctl_show['Result'] From 8867deee13f03961beeaf1a8900451741a4a416b Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Wed, 8 Feb 2023 15:31:22 +0800 Subject: [PATCH 103/113] [ci] Disable DOCKER_BUILDKIT in pipeline build for OOM issue. (#13702) Why I did it New docker release v23.0 uses BUILDKIT by default. It leads to OOM issue in pipeline build. ##[error]Exit code 137 returned from process: file name '/agent/externals/node16/bin/node', How I did it Disable BUILDKIT when building sonic-slave-* image. Keep checking if there are issues when building docker image inside sonic-slave-*. How to verify it Check docker build logs. Disable BUILDKIT log: Step 1/80 : FROM publicmirror.azurecr.io/debian:buster ---> ff5db168d4c5 --- .azure-pipelines/template-variables.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/template-variables.yml b/.azure-pipelines/template-variables.yml index 027dfee9986a..ce2ec6874315 100644 --- a/.azure-pipelines/template-variables.yml +++ b/.azure-pipelines/template-variables.yml @@ -4,3 +4,4 @@ variables: SONIC_SLAVE_DOCKER_DRIVER: 'overlay2' SONIC_BUILD_RETRY_COUNT: 3 SONIC_BUILD_RETRY_INTERVAL: 600 + DOCKER_BUILDKIT: 0 From c643bf31d653e38ae7b2b89451100fcc01891df0 Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Wed, 8 Feb 2023 19:46:00 +0200 Subject: [PATCH 104/113] [submodule] Advance sonic-swss pointer (#13705) Update sonic-swss submodule pointer to include the following: * 7d223d3 Remove TODO comment which is no longer relevant ([#2645](https://github.com/sonic-net/sonic-swss/pull/2645)) * 02c2267 [test_mux] add sleep in test_NH ([#2648](https://github.com/sonic-net/sonic-swss/pull/2648)) * 8de52bf [EVPN]Handling race condition when remote VNI arrives before tunnel map entry ([#2642](https://github.com/sonic-net/sonic-swss/pull/2642)) * e99e2e4 [voq][chassis] Remove created ports from the default vlan. ([#2607](https://github.com/sonic-net/sonic-swss/pull/2607)) Signed-off-by: dprital --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index a2a483d3cb67..7d223d37a535 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit a2a483d3cb67a4093bf9550bca0904d96e3791d7 +Subproject commit 7d223d37a5359433ee301bc7a9fd87d9c64622d5 From 11926de5a469d61b0f3fd1728899b580407c2c85 Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Wed, 8 Feb 2023 19:46:19 +0200 Subject: [PATCH 105/113] [submodule] Advance sonic-utilities pointer (#13706) Update sonic-utilities submodule pointer to include the following: * f9130d1c [db_migrator] make LOG_LEVEL_DB migration more robust ([#2651](https://github.com/sonic-net/sonic-utilities/pull/2651)) * a2520e60 Fixed a bug in show vnet routes all causing screen overrun. ([#2644](https://github.com/sonic-net/sonic-utilities/pull/2644)) * c57c3fad show logging CLI support for logs stored in tmpfs ([#2641](https://github.com/sonic-net/sonic-utilities/pull/2641)) * 5d23934f [chassis][voq] Add asic id for linecards so show fabric counters queue/port can work. ([#2499](https://github.com/sonic-net/sonic-utilities/pull/2499)) * 79ffd9fd Add Transceiver PM basic CLI support to show output from TRANSCEIVER_PM table for ZR ([#2615](https://github.com/sonic-net/sonic-utilities/pull/2615)) * 1b71985e [masic support] 'show run bgp' support for multi-asic ([#2427](https://github.com/sonic-net/sonic-utilities/pull/2427)) * 8239e9ab Making 'show feature autorestart' more resilient to missing auto_restart config in CONFIG_DB ([#2592](https://github.com/sonic-net/sonic-utilities/pull/2592)) * 9ee6ac29 [doc] Update docs for dhcp_relay config cli ([#2598](https://github.com/sonic-net/sonic-utilities/pull/2598)) * c3c92a47 Skip saidump for Spine Router as this can take more than 5 sec ([#2637](https://github.com/sonic-net/sonic-utilities/pull/2637)) * 6fe85992 Secure upgrade ([#2337](https://github.com/sonic-net/sonic-utilities/pull/2337)) Signed-off-by: dprital --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 75d233fef15f..f9130d1cc3e3 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 75d233fef15f36744785b6e1a7aa0f277c339603 +Subproject commit f9130d1cc3e376667335919a9c6c95218412d04c From 614a267bf562ece4df2f1205c303c4bce477bbc5 Mon Sep 17 00:00:00 2001 From: Dror Prital <76714716+dprital@users.noreply.github.com> Date: Wed, 8 Feb 2023 19:46:46 +0200 Subject: [PATCH 106/113] [submodule] Advance sonic-linux-kernel pointer (#13707) Update sonic-linux-kernel submodule pointer to include the following: * 6daddcf Add Secure Boot Kernel configuration ([#298](https://github.com/sonic-net/sonic-linux-kernel/pull/298)) Signed-off-by: dprital --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 4873adee4c9c..6daddcfa6a84 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 4873adee4c9c2708c970be2551fe75bfd14a1eee +Subproject commit 6daddcfa6a84434840df718272f57fd7d2c7f053 From 39cbd28486ed20afc2038da79f1360c3a8488a35 Mon Sep 17 00:00:00 2001 From: Patrick MacArthur Date: Wed, 8 Feb 2023 13:38:36 -0500 Subject: [PATCH 107/113] fix platform.json on Wolverine for thermal sensors (#13524) Why I did it The current platform.json contains entries for thermals and SFPs that do not exist on Wolverine. How I did it I removed the incorrect entries. How to verify it Verify using applicable sonic-mgmt platform API tests. --- .../platform.json | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/platform.json b/device/arista/x86_64-arista_7800r3a_36d2_lc/platform.json index bfc7ff60781c..2c91765fcfd1 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/platform.json +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/platform.json @@ -20,22 +20,6 @@ "name": "Cpu temp sensor", "controllable": false }, - { - "name": "Center back", - "controllable": false - }, - { - "name": "Fap0 core0", - "controllable": false - }, - { - "name": "Fap0 core1", - "controllable": false - }, - { - "name": "PCIE", - "controllable": false - }, { "name": "Cpu SBTSI", "controllable": false @@ -149,42 +133,6 @@ }, { "name": "osfp36" - }, - { - "name": "osfp37" - }, - { - "name": "osfp38" - }, - { - "name": "osfp39" - }, - { - "name": "osfp40" - }, - { - "name": "osfp41" - }, - { - "name": "osfp42" - }, - { - "name": "osfp43" - }, - { - "name": "osfp44" - }, - { - "name": "osfp45" - }, - { - "name": "osfp46" - }, - { - "name": "osfp47" - }, - { - "name": "osfp48" } ] }, From c8cf20cd8ca806f7f089f4d7f49f1340a04bf862 Mon Sep 17 00:00:00 2001 From: jcaiMR <111116206+jcaiMR@users.noreply.github.com> Date: Thu, 9 Feb 2023 05:40:05 +0800 Subject: [PATCH 108/113] Set 'origin' and 'AS Path' for T1 SLB routes (#13613) * set origin and as-path prepend for routes from SLB --- src/sonic-bgpcfgd/bgpcfgd/managers_rm.py | 29 ++++++++++++++++++++---- src/sonic-bgpcfgd/tests/test_rm.py | 16 +++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_rm.py b/src/sonic-bgpcfgd/bgpcfgd/managers_rm.py index 08609c68f9a6..35a3f864d55c 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_rm.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_rm.py @@ -1,8 +1,9 @@ from .manager import Manager +from swsscommon import swsscommon from .log import log_err, log_debug ROUTE_MAPS = ["FROM_SDN_SLB_ROUTES"] - +FROM_SDN_SLB_DEPLOYMENT_ID = '2' class RouteMapMgr(Manager): """This class add route-map when BGP_PROFILE_TABLE in APPL_DB is updated""" @@ -71,8 +72,28 @@ def __del_handler_validate(self, key): return False return True + def __read_asn(self): + if not 'deployment_id_asn_map' in self.constants: + log_err("BGPRouteMapMgr:: 'deployment_id_asn_map' key is not found in constants") + return None + if FROM_SDN_SLB_DEPLOYMENT_ID in self.constants['deployment_id_asn_map']: + return self.constants['deployment_id_asn_map'][FROM_SDN_SLB_DEPLOYMENT_ID] + log_err("BGPRouteMapMgr:: deployment id %s is not found in constants" % (FROM_SDN_SLB_DEPLOYMENT_ID)) + return None + def __update_rm(self, rm, data): - cmds = ["route-map %s permit 100" % ("%s_RM" % rm), " set community %s" % data["community_id"]] - log_debug("BGPRouteMapMgr:: update route-map %s community %s" % ("%s_RM" % rm, data["community_id"])) - self.cfg_mgr.push_list(cmds) + cmds = [] + if rm == "FROM_SDN_SLB_ROUTES": + cmds.append("route-map %s permit 100" % ("%s_RM" % rm)) + bgp_asn = self.__read_asn() + if bgp_asn is None or bgp_asn is '': + log_debug("BGPRouteMapMgr:: update route-map %s, but asn is not found in constants" % ("%s_RM" % rm)) + return + cmds.append(" set as-path prepend %s %s" % (bgp_asn, bgp_asn)) + cmds.append(" set community %s" % data["community_id"]) + cmds.append(" set origin incomplete") + log_debug("BGPRouteMapMgr:: update route-map %s community %s origin incomplete as-path prepend %s %s" % \ + ("%s_RM" % rm, data["community_id"], bgp_asn, bgp_asn)) + if cmds: + self.cfg_mgr.push_list(cmds) log_debug("BGPRouteMapMgr::Done") diff --git a/src/sonic-bgpcfgd/tests/test_rm.py b/src/sonic-bgpcfgd/tests/test_rm.py index fe89055d27f4..867ae1a7a51c 100644 --- a/src/sonic-bgpcfgd/tests/test_rm.py +++ b/src/sonic-bgpcfgd/tests/test_rm.py @@ -3,13 +3,23 @@ from bgpcfgd.managers_rm import RouteMapMgr from swsscommon import swsscommon + +test_rm_constants = { + "deployment_id_asn_map": { + "1": 12345, + "2": 12346, + "3": 12347, + "4": 12348, + } +} + def constructor(): cfg_mgr = MagicMock() common_objs = { 'directory': Directory(), 'cfg_mgr': cfg_mgr, - 'constants': {}, + 'constants': test_rm_constants, } mgr = RouteMapMgr(common_objs, "APPL_DB", "BGP_PROFILE_TABLE") @@ -47,7 +57,9 @@ def test_set_del(): True, [ ["route-map FROM_SDN_SLB_ROUTES_RM permit 100", - " set community 1234:1234"] + " set as-path prepend 12346 12346", + " set community 1234:1234", + " set origin incomplete"] ] ) From 5b9f3a0b219c40ed6fb71b20384df912cca2a957 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Thu, 9 Feb 2023 03:40:05 +0200 Subject: [PATCH 109/113] [doc]: YANG UM: CRLF->LF. (#13600) #### Why I did it * To align YANG doc format with Linux line ending #### How I did it * Converted: `CRLF`->`LF` --- src/sonic-yang-models/doc/Configuration.md | 4228 ++++++++++---------- 1 file changed, 2114 insertions(+), 2114 deletions(-) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 69610f4f46a9..6fd6bbd1125c 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -1,2114 +1,2114 @@ -# SONiC Configuration Database Manual - -Table of Contents -================= - - * [Introduction](#introduction) - * [Configuration](#configuration) - * [Config Load and Save](#config-load-and-save) - * [Incremental Configuration](#incremental-configuration) - * [Redis and Json Schema](#redis-and-json-schema) - * [ACL and Mirroring](#acl-and-mirroring) - * [BGP Device Global](#bgp-device-global) - * [BGP Sessions](#bgp-sessions) - * [BUFFER_PG](#buffer_pg) - * [Buffer pool](#buffer-pool) - * [Buffer profile](#buffer-profile) - * [Buffer queue](#buffer-queue) - * [Buffer port ingress profile list](#buffer-port-ingress-profile-list) - * [Buffer port egress profile list](#buffer-port-egress-profile-list) - * [Cable length](#cable-length) - * [COPP_TABLE](#copp_table) - * [Console](#console) - * [CRM](#crm) - * [Data Plane L3 Interfaces](#data-plane-l3-interfaces) - * [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER) - * [Device Metadata](#device-metadata) - * [Device neighbor metada](#device-neighbor-metada) - * [DSCP_TO_TC_MAP](#dscp_to_tc_map) - * [FLEX_COUNTER_TABLE](#flex_counter_table) - * [Hash](#hash) - * [KDUMP](#kdump) - * [Kubernetes Master](#kubernetes-master) - * [L2 Neighbors](#l2-neighbors) - * [Loopback Interface](#loopback-interface) - * [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN) - * [Management Interface](#management-interface) - * [Management port](#management-port) - * [Management VRF](#management-vrf) - * [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue) - * [MUX_CABLE](#muxcable) - * [NTP Global Configuration](#ntp-global-configuration) - * [NTP and SYSLOG servers](#ntp-and-syslog-servers) - * [Peer Switch](#peer-switch) - * [Policer](#policer) - * [Port](#port) - * [Port Channel](#port-channel) - * [Portchannel member](#portchannel-member) - * [Scheduler](#scheduler) - * [Port QoS Map](#port-qos-map) - * [Queue](#queue) - * [Syslog Rate Limit](#syslog-rate-limit) - * [Sflow](#sflow) - * [Restapi](#restapi) - * [System Port](#system-port) - * [Tacplus Server](#tacplus-server) - * [TC to Priority group map](#tc-to-priority-group-map) - * [TC to Queue map](#tc-to-queue-map) - * [Telemetry](#telemetry) - * [Tunnel](#tunnel) - * [Versions](#versions) - * [VLAN](#vlan) - * [VLAN_MEMBER](#vlan_member) - * [VOQ Inband Interface](#voq-inband-interface) - * [VXLAN](#vxlan) - * [Virtual router](#virtual-router) - * [LOGGER](#logger) - * [WRED_PROFILE](#wred_profile) - * [PASSWORD_HARDENING](#password_hardening) - * [SYSTEM_DEFAULTS table](#systemdefaults-table) - * [RADIUS](#radius) - * [For Developers](#for-developers) - * [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template) - * [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb) - - - -# Introduction -This document lists the configuration commands schema applied in the SONiC eco system. All these commands find relevance in collecting system information, analysis and even for trouble shooting. All the commands are categorized under relevant topics with corresponding examples. - -# Configuration - -SONiC is managing configuration in a single source of truth - a redisDB -instance that we refer as ConfigDB. Applications subscribe to ConfigDB -and generate their running configuration correspondingly. - -(Before Sep 2017, we were using an XML file named minigraph.xml to -configure SONiC devices. For historical documentation, please refer to -[Configuration with -Minigraph](https://github.com/Azure/SONiC/wiki/Configuration-with-Minigraph-(~Sep-2017))) - -# **Config Load and Save** - -In current version of SONiC, ConfigDB is implemented as database 4 of -local redis. When system boots, configurations will be loaded from -/etc/sonic/config_db.json file into redis. Please note that ConfigDB -content won't be written back into /etc/sonic/config_db.json file -automatically. In order to do that, a config save command need to be -manually executed from CLI. Similarly, config load will trigger a force -load of json file into DB. Generally, content in -/etc/sonic/config_db.json can be considered as starting config, and -content in redisDB running config. - -We keep a way to load configuration from minigraph and write into -ConfigDB for backward compatibility. To do that, run `config -load_minigraph`. - -### Incremental Configuration - -The design of ConfigDB supports incremental configuration - application -could subscribe to changes in ConfigDB and response correspondingly. -However, this feature is not implemented by all applications yet. By Sep -2017 now, the only application that supports incremental configuration -is BGP (docker-fpm-quagga). For other applications, a manual restart is -required after configuration changes in ConfigDB. - -# **Redis and Json Schema** - -ConfigDB uses a table-object schema that is similar with -[AppDB](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md), -and `config_db.json` is a straight-forward serialization of DB. As an -example, the following fragments could be BGP-related configuration in -redis and json, correspondingly: - - -***Redis format*** - -``` -127.0.0.1:6379[4]> keys BGP_NEIGHBOR|* - -1) "BGP_NEIGHBOR|10.0.0.31" -2) "BGP_NEIGHBOR|10.0.0.39" -3) "BGP_NEIGHBOR|10.0.0.11" -4) "BGP_NEIGHBOR|10.0.0.7" - -... - -127.0.0.1:6379[4]> hgetall BGP_NEIGHBOR|10.0.0.3 - -1) "admin_status" -2) "up" -3) "peer_addr" -4) "10.0.0.2" -5) "asn" -6) "65200" -7) "name" -8) "ARISTA07T2" -``` - -***Json format*** - -``` -"BGP_NEIGHBOR": { - "10.0.0.57": { - "rrclient": "0", - "name": "ARISTA01T1", - "local_addr": "10.0.0.56", - "nhopself": "0", - "holdtime": "10", - "asn": "64600", - "keepalive": "3" - }, - "10.0.0.59": { - "rrclient": "0", - "name": "ARISTA02T1", - "local_addr": "10.0.0.58", - "nhopself": "0", - "holdtime": "10", - "asn": "64600", - "keepalive": "3" - }, -} -``` - -Full sample config_db.json files are availables at -[here](https://github.com/Azure/SONiC/blob/gh-pages/doc/config_db.json) -and -[here](https://github.com/Azure/SONiC/blob/gh-pages/doc/config_db_t0.json). - - -### ACL and Mirroring - -ACL and mirroring related configuration are defined in -**MIRROR_SESSION**, **ACL_TABLE** and **ACL_RULE** tables. Those -tables are in progress of migrating from APPDB. Please refer to their -schema in APPDB -[here](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md) -and migration plan -[here](https://github.com/Azure/SONiC/wiki/ACL-Configuration-Requirement-Description). - -``` -{ -"MIRROR_SESSION": { - "everflow0": { - "src_ip": "10.1.0.32", - "dst_ip": "2.2.2.2" - } - }, - -"ACL_TABLE": { - "DATAACL": { - "policy_desc" : "data_acl", - "type": "l3", - "ports": [ - "Ethernet0", - "Ethernet4", - "Ethernet8", - "Ethernet12" - ] - } - } -} -``` - -***Below ACL table added as per the mail*** -``` -{ -"ACL_TABLE": { - "aaa": { - "type": "L3", - "ports": "Ethernet0" - } - }, -"ACL_RULE": { - "aaa|rule_0": { - "PRIORITY": "55", - "PACKET_ACTION": "DROP", - "L4_SRC_PORT": "0" - }, - "aaa|rule_1": { - "PRIORITY": "55", - "PACKET_ACTION": "DROP", - "L4_SRC_PORT": "1" - } - } -} -``` - -***Below ACL table added by comparig minigraph.xml & config_db.json*** - -``` -{ -"ACL_TABLE": { - "EVERFLOW": { - "type": "MIRROR", - "policy_desc": "EVERFLOW", - "ports": [ - "PortChannel0001", - "PortChannel0002", - "PortChannel0003", - "PortChannel0004" - ] - }, - "EVERFLOWV6": { - "type": "MIRRORV6", - "policy_desc": "EVERFLOWV6", - "ports": [ - "PortChannel0001", - "PortChannel0002", - "PortChannel0003", - "PortChannel0004" - ] - }, - "SNMP_ACL": { - "services": [ - "SNMP" - ], - "type": "CTRLPLANE", - "policy_desc": "SNMP_ACL" - }, - "SSH_ONLY": { - "services": [ - "SSH" - ], - "type": "CTRLPLANE", - "policy_desc": "SSH_ONLY" - } - }, - -"ACL_RULE": { - "SNMP_ACL|DEFAULT_RULE": { - "PRIORITY": "1", - "PACKET_ACTION": "DROP", - "ETHER_TYPE": "2048" - }, - "SNMP_ACL|RULE_1": { - "PRIORITY": "9999", - "PACKET_ACTION": "ACCEPT", - "SRC_IP": "1.1.1.1/32", - "IP_PROTOCOL": "17" - }, - "SNMP_ACL|RULE_2": { - "PRIORITY": "9998", - "PACKET_ACTION": "ACCEPT", - "SRC_IP": "2.2.2.2/32", - "IP_PROTOCOL": "17" - }, - "SSH_ONLY|DEFAULT_RULE": { - "PRIORITY": "1", - "PACKET_ACTION": "DROP", - "ETHER_TYPE": "2048" - }, - "SSH_ONLY|RULE_1": { - "PRIORITY": "9999", - "PACKET_ACTION": "ACCEPT", - "SRC_IP": "4.4.4.4/8", - "IP_PROTOCOL": "6" - } - } -} - -``` - -***ACL table type configuration example*** -``` -{ - "ACL_TABLE_TYPE": { - "CUSTOM_L3": { - "MATCHES": [ - "IN_PORTS", - "OUT_PORTS", - "SRC_IP" - ], - "ACTIONS": [ - "PACKET_ACTION", - "MIRROR_INGRESS_ACTION" - ], - "BIND_POINTS": [ - "PORT", - "LAG" - ] - } - }, - "ACL_TABLE": { - "DATAACL": { - "STAGE": "INGRESS", - "TYPE": "CUSTOM_L3", - "PORTS": [ - "Ethernet0", - "PortChannel1" - ] - } - }, - "ACL_RULE": { - "DATAACL|RULE0": { - "PRIORITY": "999", - "PACKET_ACTION": "DROP", - "SRC_IP": "1.1.1.1/32", - } - } -} -``` -### BGP Device Global - -The **BGP_DEVICE_GLOBAL** table contains device-level BGP global state. -It has a STATE object containing device state like **tsa_enabled** -which is set to true if device is currently isolated using -traffic-shift-away (TSA) route-maps in BGP - -``` -{ -"BGP_DEVICE_GLOBAL": { - "STATE": { - "tsa_enabled": "true" - } -} -``` -### BGP Sessions - -BGP session configuration is defined in **BGP_NEIGHBOR** table. BGP -neighbor address is used as key of bgp neighbor objects. Object -attributes include remote AS number, neighbor router name, and local -peering address. Dynamic neighbor is also supported by defining peer -group name and IP ranges in **BGP_PEER_RANGE** table. - -``` -{ -"BGP_NEIGHBOR": { - "10.0.0.61": { - "local_addr": "10.0.0.60", - "asn": 64015, - "name": "ARISTA15T0" - }, - "10.0.0.49": { - "local_addr": "10.0.0.48", - "asn": 64009, - "name": "ARISTA09T0" - }, - - "10.0.0.63": { - "rrclient": "0", - "name": "ARISTA04T1", - "local_addr": "10.0.0.62", - "nhopself": "0", - "holdtime": "10", - "asn": "64600", - "keepalive": "3" - } - -"BGP_PEER_RANGE": { - "BGPSLBPassive": { - "name": "BGPSLBPassive", - "ip_range": [ - "10.250.0.0/27" - ] - }, - "BGPVac": { - "name": "BGPVac", - "ip_range": [ - "10.2.0.0/16" - ] - } - } -} -``` - -### BUFFER_PG - -When the system is running in traditional buffer model, profiles needs to explicitly configured: - -``` -{ -"BUFFER_PG": { - "Ethernet0|3-4": { - "profile": "pg_lossless_40000_5m_profile" - }, - "Ethernet1|3-4": { - "profile": "pg_lossless_40000_5m_profile" - }, - "Ethernet2|3-4": { - "profile": "pg_lossless_40000_5m_profile" - } - } -} - -``` - -When the system is running in dynamic buffer model, profiles can be: - - - either calculated dynamically according to ports' configuration and just configured as "NULL"; - - or configured explicitly. - -``` -{ -"BUFFER_PG": { - "Ethernet0|3-4": { - "profile": "NULL" - }, - "Ethernet1|3-4": { - "profile": "NULL" - }, - "Ethernet2|3-4": { - "profile": "static_profile" - } - } -} - -``` - -### Buffer pool - -When the system is running in traditional buffer model, the size of all of the buffer pools and xoff of ingress_lossless_pool need to be configured explicitly. - -``` -{ -"BUFFER_POOL": { - "egress_lossless_pool": { - "type": "egress", - "mode": "static", - "size": "15982720" - }, - "egress_lossy_pool": { - "type": "egress", - "mode": "dynamic", - "size": "9243812" - }, - "ingress_lossless_pool": { - "xoff": "4194112", - "type": "ingress", - "mode": "dynamic", - "size": "10875072" - } - } -} - -``` - -When the system is running in dynamic buffer model, the size of some of the buffer pools can be omitted and will be dynamically calculated. - -``` -{ -"BUFFER_POOL": { - "egress_lossless_pool": { - "type": "egress", - "mode": "static", - "size": "15982720" - }, - "egress_lossy_pool": { - "type": "egress", - "mode": "dynamic", - }, - "ingress_lossless_pool": { - "type": "ingress", - "mode": "dynamic", - } - } -} - -``` - - -### Buffer profile - -``` -{ -"BUFFER_PROFILE": { - "egress_lossless_profile": { - "static_th": "3995680", - "pool": "egress_lossless_pool", - "size": "1518" - }, - "egress_lossy_profile": { - "dynamic_th": "3", - "pool": "egress_lossy_pool", - "size": "1518" - }, - "ingress_lossy_profile": { - "dynamic_th": "3", - "pool": "ingress_lossless_pool", - "size": "0" - }, - "pg_lossless_40000_5m_profile": { - "xon_offset": "2288", - "dynamic_th": "-3", - "xon": "2288", - "xoff": "66560", - "pool": "ingress_lossless_pool", - "size": "1248" - }, - "pg_lossless_40000_40m_profile": { - "xon_offset": "2288", - "dynamic_th": "-3", - "xon": "2288", - "xoff": "71552", - "pool": "ingress_lossless_pool", - "size": "1248" - } - } -} - -``` - -When the system is running in dynamic buffer model and the headroom_type is dynamic, only dynamic_th needs to be configured and rest of fields can be omitted. -This kind of profiles will be handled by buffer manager and won't be applied to SAI. - -``` -{ - { - "non_default_dynamic_th_profile": { - "dynamic_th": 1, - "headroom_type": "dynamic" - } - } -} -``` - -### Buffer queue - -``` -{ -"BUFFER_QUEUE": { - "Ethernet50,Ethernet52,Ethernet54,Ethernet56|0-2": { - "profile": "egress_lossy_profile" - }, - "Ethernet50,Ethernet52,Ethernet54,Ethernet56|3-4": { - "profile": "egress_lossless_profile" - }, - "Ethernet50,Ethernet52,Ethernet54,Ethernet56|5-6": { - "profile": "egress_lossy_profile" - } - } -} - -``` - -### Buffer port ingress profile list - -``` -{ -"BUFFER_PORT_INGRESS_PROFILE_LIST": { - "Ethernet50": { - "profile_list": "ingress_lossy_profile,ingress_lossless_profile" - }, - "Ethernet52": { - "profile_list": "ingress_lossy_profile,ingress_lossless_profile" - }, - "Ethernet56": { - "profile_list": "ingress_lossy_profile,ingress_lossless_profile" - } - } -} - -``` - -### Buffer port egress profile list - -``` -{ -"BUFFER_PORT_EGRESS_PROFILE_LIST": { - "Ethernet50": { - "profile_list": "egress_lossy_profile,egress_lossless_profile" - }, - "Ethernet52": { - "profile_list": "egress_lossy_profile,egress_lossless_profile" - }, - "Ethernet56": { - "profile_list": "egress_lossy_profile,egress_lossless_profile" - } - } -} - -``` - -### Cable length - -``` -{ -"CABLE_LENGTH": { - "AZURE": { - "Ethernet8": "5m", - "Ethernet9": "5m", - "Ethernet2": "5m", - "Ethernet58": "5m", - "Ethernet59": "5m", - "Ethernet50": "40m", - "Ethernet51": "5m", - "Ethernet52": "40m", - "Ethernet53": "5m", - "Ethernet54": "40m", - "Ethernet55": "5m", - "Ethernet56": "40m" - } - } -} - -``` - -### COPP_TABLE - -``` -{ -"COPP_TABLE": { - "default": { - "cbs": "600", - "cir": "600", - "meter_type": "packets", - "mode": "sr_tcm", - "queue": "0", - "red_action": "drop" - }, - - "trap.group.arp": { - "cbs": "600", - "cir": "600", - "meter_type": "packets", - "mode": "sr_tcm", - "queue": "4", - "red_action": "drop", - "trap_action": "trap", - "trap_ids": "arp_req,arp_resp,neigh_discovery", - "trap_priority": "4" - }, - - "trap.group.lldp.dhcp.udld": { - "queue": "4", - "trap_action": "trap", - "trap_ids": "lldp,dhcp,udld", - "trap_priority": "4" - }, - - "trap.group.bgp.lacp": { - "queue": "4", - "trap_action": "trap", - "trap_ids": "bgp,bgpv6,lacp", - "trap_priority": "4" - }, - - "trap.group.ip2me": { - "cbs": "600", - "cir": "600", - "meter_type": "packets", - "mode": "sr_tcm", - "queue": "1", - "red_action": "drop", - "trap_action": "trap", - "trap_ids": "ip2me", - "trap_priority": "1" - } - } -} -``` - -### Console - -``` -{ -"CONSOLE_PORT": { - "1": { - "baud_rate": "115200", - "flow_control": "0", - "remote_device": "host-1" - }, - "2": { - "baud_rate": "9600", - "flow_control": "1" - } - }, -"CONSOLE_SWITCH": { - "console_mgmt": { - "enabled": "yes" - } - } -} -``` - -### CRM - -``` -{ -"CRM": { - "Config": { - "acl_table_threshold_type": "percentage", - "nexthop_group_threshold_type": "percentage", - "fdb_entry_high_threshold": "85", - "acl_entry_threshold_type": "percentage", - "ipv6_neighbor_low_threshold": "70", - "nexthop_group_member_low_threshold": "70", - "acl_group_high_threshold": "85", - "ipv4_route_high_threshold": "85", - "acl_counter_high_threshold": "85", - "ipv4_route_low_threshold": "70", - "ipv4_route_threshold_type": "percentage", - "ipv4_neighbor_low_threshold": "70", - "acl_group_threshold_type": "percentage", - "ipv4_nexthop_high_threshold": "85", - "ipv6_route_threshold_type": "percentage", - "snat_entry_threshold_type": "percentage", - "snat_entry_high_threshold": "85", - "snat_entry_low_threshold": "70", - "dnat_entry_threshold_type": "percentage", - "dnat_entry_high_threshold": "85", - "dnat_entry_low_threshold": "70", - "ipmc_entry_threshold_type": "percentage", - "ipmc_entry_high_threshold": "85", - "ipmc_entry_low_threshold": "70" - } - } -} - -``` - -### Data Plane L3 Interfaces - -IP configuration for data plane are defined in **INTERFACE**, **VLAN_SUB_INTERFACE**, -**PORTCHANNEL_INTERFACE** and **VLAN_INTERFACE** table. The objects -in all four tables have the interface (could be physical port, port -channel, vlan or vlan sub interface) that IP address is attached to as first-level key, and -IP prefix as second-level key. IP interface address objects don't have any attributes. -IP interface attributes, resides in those tables as well, key is the interface name -and value is a list of field-values representing the interface attributes, e.g. loopback action. - -``` -{ -"INTERFACE": { - "Ethernet0|10.0.0.0/31": {}, - "Ethernet4|10.0.0.2/31": {}, - "Ethernet8|10.0.0.4/31": {} - "Ethernet8": { - "loopback_action": "drop" - } - }, - -"PORTCHANNEL_INTERFACE": { - "PortChannel01|10.0.0.56/31": {}, - "PortChannel01|FC00::71/126": {}, - "PortChannel02|10.0.0.58/31": {}, - "PortChannel02|FC00::75/126": {} - }, - -"VLAN_INTERFACE": { - "Vlan1000|192.168.0.1/27": {} - }, - -"VLAN_SUB_INTERFACE": { - "Ethernet4.1|10.0.0.2/31": {}, - "Ethernet4.1": { - "loopback_action": "drop" - } - } -} -``` - - -### DEFAULT_LOSSLESS_BUFFER_PARAMETER - -This table stores the default lossless buffer parameters for dynamic buffer calculation. - -``` -{ - "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { - "AZURE": { - "default_dynamic_th": "0", - "over_subscribe_ratio": "2" - } - } -} -``` - -### Device Metadata - -The **DEVICE_METADATA** table contains only one object named -*localhost*. In this table the device metadata such as hostname, hwsku, -deployment envionment id and deployment type are specified. BGP local AS -number is also specified in this table as current only single BGP -instance is supported in SONiC. - -``` -{ -"DEVICE_METADATA": { - "localhost": { - "hwsku": "Force10-S6100", - "default_bgp_status": "up", - "docker_routing_config_mode": "unified", - "hostname": "sonic-s6100-01", - "platform": "x86_64-dell_s6100_c2538-r0", - "mac": "4c:76:25:f4:70:82", - "default_pfcwd_status": "disable", - "bgp_asn": "65100", - "deployment_id": "1", - "type": "ToRRouter", - "bgp_adv_lo_prefix_as_128" : "true", - "buffer_model": "traditional", - "yang_config_validation": "disable" - } - } -} - -``` - - -### Device neighbor metada - -``` -{ -"DEVICE_NEIGHBOR_METADATA": { - "ARISTA01T1": { - "lo_addr": "None", - "mgmt_addr": "10.11.150.45", - "hwsku": "Arista-VM", - "type": "LeafRouter" - }, - "ARISTA02T1": { - "lo_addr": "None", - "mgmt_addr": "10.11.150.46", - "hwsku": "Arista-VM", - "type": "LeafRouter" - } - } -} - -``` - - -### DSCP_TO_TC_MAP -``` -{ -"DSCP_TO_TC_MAP": { - "AZURE": { - "1": "1", - "0": "1", - "3": "3", - "2": "1", - "5": "2", - "4": "4", - "7": "1", - "6": "1", - "9": "1", - "8": "0" - } - } -} - -``` - - -### MPLS_TC_TO_TC_MAP -``` -{ -"MPLS_TC_TO_TC_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "1", - "3": "2", - "4": "2", - "5": "3", - "6": "3", - "7": "4" - } - } -} - -``` - -### FLEX_COUNTER_TABLE - -``` -{ - "FLEX_COUNTER_TABLE": { - "PFCWD": { - "FLEX_COUNTER_STATUS": "enable", - "POLL_INTERVAL": "10000" - }, - "PORT": { - "FLEX_COUNTER_STATUS": "enable", - "POLL_INTERVAL": "1000" - }, - "QUEUE": { - "FLEX_COUNTER_STATUS": "enable", - "POLL_INTERVAL": "10000" - }, - "TUNNEL": { - "FLEX_COUNTER_STATUS": "enable", - "POLL_INTERVAL": "10000" - } - } -} - -``` - -### Hash - -Generic hash allows user to configure which hash fields are suppose to be used by a hashing algorithm. -The configuration is applied globally for each ECMP and LAG on a switch. - -***ECMP/LAG HASH*** - -``` -{ - "SWITCH_HASH": { - "GLOBAL": { - "ecmp_hash": [ - "DST_MAC", - "SRC_MAC", - "ETHERTYPE", - "IP_PROTOCOL", - "DST_IP", - "SRC_IP", - "L4_DST_PORT", - "L4_SRC_PORT", - "INNER_DST_MAC", - "INNER_SRC_MAC", - "INNER_ETHERTYPE", - "INNER_IP_PROTOCOL", - "INNER_DST_IP", - "INNER_SRC_IP", - "INNER_L4_DST_PORT", - "INNER_L4_SRC_PORT" - ], - "lag_hash": [ - "DST_MAC", - "SRC_MAC", - "ETHERTYPE", - "IP_PROTOCOL", - "DST_IP", - "SRC_IP", - "L4_DST_PORT", - "L4_SRC_PORT", - "INNER_DST_MAC", - "INNER_SRC_MAC", - "INNER_ETHERTYPE", - "INNER_IP_PROTOCOL", - "INNER_DST_IP", - "INNER_SRC_IP", - "INNER_L4_DST_PORT", - "INNER_L4_SRC_PORT" - ] - } - } -} -``` - -### KDUMP - -``` -{ - "KDUMP": { - "config": { - "enabled": "true", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:256M,4G-8G:384M,8G-:448M" - } - } -} - -``` - -### Kubernetes Master - -Kubernetes Master related configurations are stored in -**KUBERNETES_MASTER** table. These configurations are used mainly -for CTRMGR service. CTRMGR service will interactive with -kubernetes master according to these configurations. - -``` -{ - "KUBERNETES_MASTER": { - "SERVER": { - "disable": "False", - "insecure": "True", - "ip": "k8s.apiserver.com", - "port": "6443" - } - } -} - -``` - -### L2 Neighbors - -The L2 neighbor and connection information can be configured in -**DEVICE_NEIGHBOR** table. Those information are used mainly for LLDP. -While mandatory fields include neighbor name acting as object key and -remote port / local port information in attributes, optional information -about neighbor device such as device type, hwsku, management address and -loopback address can also be defined. - -``` -{ -"DEVICE_NEIGHBOR": { - "ARISTA04T1": { - "mgmt_addr": "10.20.0.163", - "hwsku": "Arista", - "lo_addr": null, - "local_port": "Ethernet124", - "type": "LeafRouter", - "port": "Ethernet1" - }, - "ARISTA03T1": { - "mgmt_addr": "10.20.0.162", - "hwsku": "Arista", - "lo_addr": null, - "local_port": "Ethernet120", - "type": "LeafRouter", - "port": "Ethernet1" - }, - "ARISTA02T1": { - "mgmt_addr": "10.20.0.161", - "hwsku": "Arista", - "lo_addr": null, - "local_port": "Ethernet116", - "type": "LeafRouter", - "port": "Ethernet1" - }, - "ARISTA01T1": { - "mgmt_addr": "10.20.0.160", - "hwsku": "Arista", - "lo_addr": null, - "local_port": "Ethernet112", - "type": "LeafRouter", - "port": "Ethernet1" - } - } -} -``` - -### Loopback Interface - -Loopback interface configuration lies in **LOOPBACK_INTERFACE** table -and has similar schema with data plane interfaces. The loopback device -name and loopback IP prefix act as multi-level key for loopback -interface objects. -By default SONiC advertises Loopback interface IPv6 /128 subnet address -as prefix with /64 subnet. To overcome this set "bgp_adv_lo_prefix_as_128" -to true in DEVICE_METADATA - -``` -{ -"LOOPBACK_INTERFACE": { - "Loopback0|10.1.0.32/32": {}, - "Loopback0|FC00:1::32/128": {} - } -} - -``` - -### LOSSLESS_TRAFFIC_PATTERN - -The LOSSLESS_TRAFFIC_PATTERN table stores parameters related to -lossless traffic for dynamic buffer calculation - -``` -{ - "LOSSLESS_TRAFFIC_PATTERN": { - "AZURE": { - "mtu": "1024", - "small_packet_percentage": "100" - } - } -} -``` - -### Management Interface - -Management interfaces are defined in **MGMT_INTERFACE** table. Object -key is composed of management interface name and IP prefix. Attribute -***gwaddr*** specify the gateway address of the prefix. -***forced_mgmt_routes*** attribute can be used to specify addresses / -prefixes traffic to which are forced to go through management network -instead of data network. - -``` -{ -"MGMT_INTERFACE": { - "eth0|10.11.150.11/16": { - "gwaddr": "10.11.0.1" - }, - "eth0|FC00:2::32/64": { - "forced_mgmt_routes": [ - "10.0.0.100/31", - "10.250.0.8", - "10.255.0.0/28" - ], - "gwaddr": "fc00:2::1" - } - } -} - -``` - -### Management port - -``` -{ -"MGMT_PORT": { - "eth0": { - "alias": "eth0", - "admin_status": "up" - } - } -} - -``` - - -### Management VRF - -``` -{ -"MGMT_VRF_CONFIG": { - "vrf_global": { - "mgmtVrfEnabled": "true" - } - } -} -``` - -### MAP_PFC_PRIORITY_TO_QUEUE - -``` -{ -"MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "1": "1", - "0": "0", - "3": "3", - "2": "2", - "5": "5", - "4": "4", - "7": "7", - "6": "6" - } - } -} -``` -### MUX_CABLE - -The **MUX_CABLE** table is used for dualtor interface configuration. The `cable_type` and `soc_ipv4` objects are optional. - -``` -{ - "MUX_CABLE": { - "Ethernet4": { - "cable_type": "active-active", - "server_ipv4": "192.168.0.2/32", - "server_ipv6": "fc02:1000::30/128", - "soc_ipv4": "192.168.0.3/32", - "state": "auto" - } - } -} -``` - -### NTP Global Configuration - -These configuration options are used to modify the way that -ntp binds to the ports on the switch and which port it uses to -make ntp update requests from. - -***NTP VRF*** - -If this option is set to `default` then ntp will run within the default vrf -**when the management vrf is enabled**. If the mgmt vrf is enabled and this value is -not set to default then ntp will run within the mgmt vrf. - -This option **has no effect** if the mgmt vrf is not enabled. - -``` -{ -"NTP": { - "global": { - "vrf": "default" - } - } -} -``` - - -***NTP Source Port*** - -This option sets the port which ntp will choose to send time update requests from by. - -NOTE: If a Loopback interface is defined on the switch ntp will choose this by default, so this setting -is **required** if the switch has a Loopback interface and the ntp peer does not have defined routes -for that address. - -``` -{ -"NTP": { - "global": { - "src_intf": "Ethernet1" - } - } -} -``` - -### NTP and SYSLOG servers - -These information are configured in individual tables. Domain name or IP -address of the server is used as object key. Currently there are no -attributes in those objects. - -***NTP server*** -``` -{ - "NTP_SERVER": { - "2.debian.pool.ntp.org": {}, - "1.debian.pool.ntp.org": {}, - "3.debian.pool.ntp.org": {}, - "0.debian.pool.ntp.org": {} - }, - - "NTP_SERVER": { - "23.92.29.245": {}, - "204.2.134.164": {} - } -} -``` - -***Syslog server*** -``` -{ - "SYSLOG_SERVER": { - "10.0.0.5": {}, - "10.0.0.6": {}, - "10.11.150.5": {} - }, - - "SYSLOG_SERVER" : { - "2.2.2.2": { - "source": "1.1.1.1", - "port": "514", - "vrf": "default" - }, - "4.4.4.4": { - "source": "3.3.3.3", - "port": "514", - "vrf": "mgmt" - }, - "2222::2222": { - "source": "1111::1111", - "port": "514", - "vrf": "Vrf-Data" - } - } -} -``` - -### Peer Switch - -Below is an exmaple of the peer switch table configuration. -``` -{ - "PEER_SWITCH": { - "vlab-05": { - "address_ipv4": "10.1.0.33" - } - } -} -``` - -### Policer - -Below is an example of the policer table configuration. -``` -{ - "POLICER": { - "everflow_static_policer": { - "meter_type": "bytes", - "mode": "sr_tcm", - "cir": "12500000", - "cbs": "12500000", - "pir": "17500000", - "pbs": "17500000", - "color": "aware", - "red_packet_action": "drop", - "yellow_packet_action": "drop" - "green_packet_action": "forward" - } - } -} - -``` -Key to the table defines policer name Below are the fields -- meter_type - Mandatory field. Defines how the metering is done. values - bytes, packets -- mode - Mandatory field. Defines one of the three modes support. values - sr_tcm, tr_tcm, storm -- cir - Committed information rate bytes/sec or packets/sec based on meter_type -- cbs - Committed burst size in bytes or packets based on meter_type -- pir - Peak information rate in bytes/sec or packets/sec based on meter_type -- pbs - Peak burst size in bytes or packets based on meter_type -- color - Defines the color source for the policer. values - aware, blind -- red_packet_action - Defines the action to be taken for red color packets -- yellow_packet_action - Defines the action to be taken for yellow color packets -- green_packet_action - Defines the action to be taken for green color packets. - -The packet action could be: - -- 'drop' -- 'forward' -- 'copy' -- 'copy_cancel' -- 'trap' -- 'log' -- 'deny' -- 'transit' -### Port - -In this table the physical port configurations are defined. Each object -will have port name as its key, and port name alias and port speed as -optional attributes. - -``` -{ -"PORT": { - "Ethernet0": { - "index": "0", - "lanes": "101,102", - "description": "fortyGigE1/1/1", - "mtu": "9100", - "alias": "fortyGigE1/1/1", - "speed": "40000", - "link_training": "off", - "laser_freq": "191300", - "tx_power": "-27.3" - }, - "Ethernet1": { - "index": "1", - "lanes": "103,104", - "description": "fortyGigE1/1/2", - "mtu": "9100", - "alias": "fortyGigE1/1/2", - "admin_status": "up", - "speed": "40000", - "link_training": "on", - "laser_freq": "191300", - "tx_power": "-27.3" - }, - "Ethernet63": { - "index": "63", - "lanes": "87,88", - "description": "fortyGigE1/4/16", - "mtu": "9100", - "alias": "fortyGigE1/4/16", - "speed": "40000", - "laser_freq": "191300", - "tx_power": "-27.3" - } - } -} - -``` - -### Port Channel - -Port channels are defined in **PORTCHANNEL** table with port channel -name as object key and member list as attribute. - -``` -{ -"PORTCHANNEL": { - "PortChannel0003": { - "admin_status": "up", - "min_links": "1", - "members": [ - "Ethernet54" - ], - "mtu": "9100" - }, - "PortChannel0004": { - "admin_status": "up", - "min_links": "1", - "members": [ - "Ethernet56" - ], - "mtu": "9100" - } - } -} -``` - - -### Portchannel member - -``` -{ -"PORTCHANNEL_MEMBER": { - "PortChannel0001|Ethernet50": {}, - "PortChannel0002|Ethernet52": {}, - "PortChannel0003|Ethernet54": {}, - "PortChannel0004|Ethernet56": {} - } -} - -``` -### Scheduler - -``` -{ -"SCHEDULER": { - "scheduler.0": { - "type": "STRICT" - }, - "scheduler.1": { - "type": "WRR" - "weight": "1", - "meter_type": "bytes", - "pir": "1250000000", - "pbs": "8192" - }, - "scheduler.port": { - "meter_type": "bytes", - "pir": "1000000000", - "pbs": "8192" - } - } -} -``` - -### Port QoS Map - -``` -{ -"PORT_QOS_MAP": { - "Ethernet50,Ethernet52,Ethernet54,Ethernet56": { - "tc_to_pg_map": "AZURE", - "tc_to_queue_map": "AZURE", - "pfc_enable": "3,4", - "pfc_to_queue_map": "AZURE", - "dscp_to_tc_map": "AZURE", - "dscp_to_fc_map": "AZURE", - "exp_to_fc_map": "AZURE", - "scheduler": "scheduler.port" - } - } -} -``` - -### Queue -``` -{ -"QUEUE": { - "Ethernet56|4": { - "wred_profile": "AZURE_LOSSLESS", - "scheduler": "scheduler.1" - }, - "Ethernet56|5": { - "scheduler": "scheduler.0" - }, - "Ethernet56|6": { - "scheduler": "scheduler.0" - } - } -} -``` - -### Restapi -``` -{ -"RESTAPI": { - "certs": { - "ca_crt": "/etc/sonic/credentials/ame_root.pem", - "server_key": "/etc/sonic/credentials/restapiserver.key", - "server_crt": "/etc/sonic/credentials/restapiserver.crt", - "client_crt_cname": "client.sonic.net" - }, - "config": { - "client_auth": "true", - "log_level": "trace", - "allow_insecure": "false" - } -} -``` -### Sflow - -The below are the tables and their schema for SFLOW feature - -SFLOW - -| Field | Description | Mandatory | Default | Reference | -|------------------|-----------------------------------------------------------------------------------------|-------------|-----------|-------------------------------------------| -| admin_state | Global sflow admin state | | down | | -| polling_interval | The interval within which sFlow data is collected and sent to the configured collectors | | 20 | | -| agent_id | Interface name | | | PORT:name,PORTCHANNEL:name,MGMT_PORT:name, VLAN:name | - -SFLOW_SESSION - -key - port -| Field | Description | Mandatory | Default | Reference | -|-------------|-------------------------------------------------------------------------------------------------------------------------|-------------|-----------|-------------| -| port | Sets sflow session table attributes for either all interfaces or a specific Ethernet interface. | | | PORT:name | -| admin_state | Per port sflow admin state | | up | | -| sample_rate | Sets the packet sampling rate. The rate is expressed as an integer N, where the intended sampling rate is 1/N packets. | | | | - -SFLOW_COLLECTOR - -key - name -| Field | Description | Mandatory | Default | Reference | -|----------------|-----------------------------------------------------------------------------------------|-------------|-----------|-------------| -| name | Name of the Sflow collector | | | | -| collector_ip | IPv4/IPv6 address of the Sflow collector | true | | | -| collector_port | Destination L4 port of the Sflow collector | | 6343 | | -| collector_vrf | Specify the Collector VRF. In this revision, it is either default VRF or Management VRF.| | | | - -### Syslog Rate Limit - -Host side configuration: - -``` -{ -"SYSLOG_CONFIG": { - "GLOBAL": { - "rate_limit_interval": "300", - "rate_limit_burst": "20000" - } - } -} -``` - -Container side configuration: - -``` -{ -"SYSLOG_CONFIG_FEATURE": { - "bgp": { - "rate_limit_interval": "300", - "rate_limit_burst": "20000" - }, - "pmon": { - "rate_limit_interval": "300", - "rate_limit_burst": "20000" - } - } -} -``` - -### System Port -Every port on the system requires a global representation, known as a System Port, -and is listed in this table. - -``` -{ -"SYSTEM_PORT": { - "host227-4|asic0|Ethernet0": { - "core_index": "1", - "core_port_index": "1", - "num_voq": "8", - "speed": "100000", - "switch_id": "0", - "system_port_id": "1" - }, - "host227-4|asic0|Ethernet4": { - "core_index": "1", - "core_port_index": "2", - "num_voq": "8", - "speed": "100000", - "switch_id": "0", - "system_port_id": "2" - }, - "host227-5|asic0|Ethernet0": { - "core_index": "1", - "core_port_index": "1", - "num_voq": "8", - "speed": "100000", - "switch_id": "4", - "system_port_id": "80" - }, - "host227-5|asic0|Ethernet4": { - "core_index": "1", - "core_port_index": "2", - "num_voq": "8", - "speed": "100000", - "switch_id": "4", - "system_port_id": "81" - } - } -} -``` - -### Tacplus Server - -``` -{ -"TACPLUS_SERVER": { - "10.0.0.8": { - "priority": "1", - "tcp_port": "49" - }, - "10.0.0.9": { - "priority": "1", - "tcp_port": "49" - } - } -} -``` - - -### TC to Priority group map - -``` -{ -"TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "1": "1", - "0": "0", - "3": "3", - "2": "2", - "5": "5", - "4": "4", - "7": "7", - "6": "6" - } - } -} -``` - -### TC to Queue map - -``` -{ -"TC_TO_QUEUE_MAP": { - "AZURE": { - "1": "1", - "0": "0", - "3": "3", - "2": "2", - "5": "5", - "4": "4", - "7": "7", - "6": "6" - } - } -} -``` - -### Telemetry - -``` -{ - "TELEMETRY": { - "certs": { - "ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", - "server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer", - "server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key" - }, - "gnmi": { - "client_auth": "true", - "log_level": "2", - "port": "50051" - } - } -} -``` - -### Tunnel - -This table configures the MUX tunnel for Dual-ToR setup -``` -{ - "TUNNEL": { - "MuxTunnel0": { - "dscp_mode": "uniform", - "dst_ip": "10.1.0.32", - "ecn_mode": "copy_from_outer", - "encap_ecn_mode": "standard", - "ttl_mode": "pipe", - "tunnel_type": "IPINIP" - } - } -} -``` - -different example for configuring MUX tunnel -``` -{ - "TUNNEL": { - "MuxTunnel0": { - "dscp_mode": "pipe", - "dst_ip": "10.1.0.32", - "ecn_mode": "standard", - "encap_ecn_mode": "standard", - "ttl_mode": "uniform", - "tunnel_type": "IPINIP" - } - } -} -``` - -example mux tunnel configuration for when tunnel_qos_remap is enabled -``` -{ - "TUNNEL": { - "MuxTunnel0": { - "tunnel_type": "IPINIP", - "src_ip": "10.1.0.33", - "dst_ip": "10.1.0.32", - "dscp_mode": "pipe", - "encap_ecn_mode": "standard", - "ecn_mode": "copy_from_outer", - "ttl_mode": "uniform", - "decap_dscp_to_tc_map": "DecapDscpToTcMap", - "decap_tc_to_pg_map": "DecapTcToPgMap", - "encap_tc_to_dscp_map": "EncapTcToQueueMap", - "encap_tc_to_queue_map": "EncapTcToDscpMap" - } - } -} -``` - -### Versions - -This table is where the curret version of the software is recorded. -``` -{ - "VERSIONS": { - "DATABASE": { - "VERSION": "version_1_0_1" - } - } -} -``` - -### VLAN - -This table is where VLANs are defined. VLAN name is used as object key, -and member list as well as an integer id are defined as attributes. If a -DHCP relay is required for this VLAN, a dhcp_servers attribute must be -specified for that VLAN, the value of which is a list that must contain -the domain name or IP address of one or more DHCP servers. - -``` -{ -"VLAN": { - "Vlan1000": { - "dhcp_servers": [ - "192.0.0.1", - "192.0.0.2", - "192.0.0.3", - "192.0.0.4" - ], - "members": [ - "Ethernet0", - "Ethernet4", - "Ethernet8", - "Ethernet12" - ], - "vlanid": "1000" - } - } -} -``` - -### VLAN_MEMBER - -VLAN member table has Vlan name together with physical port or port -channel name as object key, and tagging mode as attributes. - -``` -{ -"VLAN_MEMBER": { - "Vlan1000|PortChannel47": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet8": { - "tagging_mode": "untagged" - }, - "Vlan2000|PortChannel47": { - "tagging_mode": "tagged" - } - } -} -``` - -### VOQ INBAND INTERFACE - -VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu communication. At this time, only inband_type of "port" is supported - -``` -"VOQ_INBAND_INTERFACE": { - "Ethernet-IB0": { - "inband_type": "port" - }, - "Ethernet-IB0|3.3.3.1/32": {}, - "Ethernet-IB0|3333::3:5/128": {} -} -``` - -### VXLAN - -VXLAN_TUNNEL holds the VTEP source ip configuration. -VXLAN_TUNNEL_MAP holds the vlan to vni and vni to vlan mapping configuration. -VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered tunnels. - -``` -{ -"VXLAN_TUNNEL": { - "vtep1": { - "src_ip": "10.10.10.10" - } - } -"VXLAN_TUNNEL_MAP" : { - "vtep1|map_1000_Vlan100": { - "vni": "1000", - "vlan": "100" - }, - "vtep1|testmap": { - "vni": "22000", - "vlan": "70" - }, - } - "VXLAN_EVPN_NVO": { - "nvo1": { - "source_vtep": "vtep1" - } - } -} -``` - -### Virtual router - -The virtual router table allows to insert or update a new virtual router -instance. The key of the instance is its name. The attributes in the -table allow to change properties of a virtual router. Attributes: - -- 'v4' contains boolean value 'true' or 'false'. Enable or - disable IPv4 in the virtual router -- 'v6' contains boolean value 'true' or 'false'. Enable or - disable IPv6 in the virtual router -- 'src_mac' contains MAC address. What source MAC address will be - used for packets egressing from the virtual router -- 'ttl_action' contains packet action. Defines the action for - packets with TTL == 0 or TTL == 1 -- 'ip_opt_action' contains packet action. Defines the action for - packets with IP options -- 'l3_mc_action' contains packet action. Defines the action for - unknown L3 multicast packets - -The packet action could be: - -- 'drop' -- 'forward' -- 'copy' -- 'copy_cancel' -- 'trap' -- 'log' -- 'deny' -- 'transit' - - -***TBD*** -``` -'VRF:rid1': { - 'v4': 'true', - 'v6': 'false', - 'src_mac': '02:04:05:06:07:08', - 'ttl_action': 'copy', - 'ip_opt_action': 'deny', - 'l3_mc_action': 'drop' -} -``` - - -### WRED_PROFILE - -``` -{ -"WRED_PROFILE": { - "AZURE_LOSSLESS": { - "red_max_threshold": "2097152", - "wred_green_enable": "true", - "ecn": "ecn_all", - "green_min_threshold": "1048576", - "red_min_threshold": "1048576", - "wred_yellow_enable": "true", - "yellow_min_threshold": "1048576", - "green_max_threshold": "2097152", - "green_drop_probability": "5", - "yellow_max_threshold": "2097152", - "wred_red_enable": "true", - "yellow_drop_probability": "5", - "red_drop_probability": "5" - } - } -} -``` - -### Logger - -In this table, the loglevel and logoutput of the components are defined. Each component -will have the component name as its key; and LOGLEVEL and LOGOUTPUT as attributes. -The LOGLEVEL attribute will define the verbosity of the component. -The LOGOUTPUT attribute will define the file of printing the logs. - -``` -{ - "LOGGER": { - "orchagent": { - "LOGLEVEL": "NOTICE", - "LOGOUTPUT": "SYSLOG" - }, - "syncd": { - "LOGLEVEL": "DEBUG", - "LOGOUTPUT": "STDOUT" - }, - "SAI_API_LAG": { - "LOGLEVEL": "ERROR", - "LOGOUTPUT": "STDERR" - } - } -} - -``` - -### PASSWORD_HARDENING - -Password Hardening, a user password is the key credential used in order to verify the user accessing the switch and acts as the first line of defense in regards to securing the switch. PASSWORD_HARDENING - support the enforce strong policies. - -- state - Enable/Disable password hardening feature -- len_min - The minimum length of the PW should be subject to a user change. -- expiration - PW Age Change Once a PW change takes place - the DB record for said PW is updated with the new PW value and a fresh new age (=0). -- expiration_warning - The switch will provide a warning for PW change before and (this is to allow a sufficient warning for upgrading the PW which might be relevant to numerous switches). -- history_cnt - remember last passwords, and reject to use the old passw -- reject_user_passw_match - reject to set same username and passw -- PW classes - are the type of characters the user is required to enter when setting/updating a PW. -There are 4 classes - - lower_class - Small characters - a-z - - upper_class - Big characters - A-Z - - digits_class -Numbers - 0-9 - - special_class - Special Characters `~!@#$%^&*()-_+=|[{}];:',<.>/? and white space -``` -{ -"PASSW_HARDENING": { - "POLICIES": { - "state": "disabled", - "expiration": "180", - "expiration_warning": "15", - "history_cnt": "10", - "len_min": "8", - "reject_user_passw_match": "true", - "lower_class": "true", - "upper_class": "true", - "digits_class": "true", - "special_class": "true" - } - } -} -``` - -### BREAKOUT_CFG - -This table is introduced as part of Dynamic Port Breakout(DPB) feature. -It shows the current breakout mode of all ports(root ports). -The list of root ports, all possible breakout modes, and default breakout modes - are obtained/derived from platform.json and hwsku.json files. - -``` -"BREAKOUT_CFG": { - "Ethernet0": { - "brkout_mode": "4x25G[10G]" - }, - "Ethernet4": { - "brkout_mode": "4x25G[10G]" - }, - "Ethernet8": { - "brkout_mode": "4x25G[10G]" - }, - - ...... - - "Ethernet116": { - "brkout_mode": "2x50G" - }, - "Ethernet120": { - "brkout_mode": "2x50G" - }, - "Ethernet124": { - "brkout_mode": "2x50G" - } -} -``` - -### AAA - -The AAA table defined the method SONiC used for Authentication, Authorization and Accounting. -The method could be: -- default -- local -- tacacs+ -- radius - -``` -"AAA": { - "authentication": { - "login": "local" - }, - "authorization": { - "login": "local" - }, - "accounting": { - "login": "local" - } -} -``` - -### SYSTEM_DEFAULTS table -To have a better management of the features in SONiC, a new table `SYSTEM_DEFAULTS` is introduced. - -``` -"SYSTEM_DEFAULTS": { - "tunnel_qos_remap": { - "status": "enabled" - } - "default_bgp_status": { - "status": "down" - } - "synchronous_mode": { - "status": "enable" - } - "dhcp_server": { - "status": "enable" - } - } -``` -The default value of flags in `SYSTEM_DEFAULTS` table can be set in `init_cfg.json` and loaded into db at system startup. These flags are usually set at image being build, and are unlikely to change at runtime. - -If the values in `config_db.json` is changed by user, it will not be rewritten back by `init_cfg.json` as `config_db.json` is loaded after `init_cfg.json` in [docker_image_ctl.j2](https://github.com/Azure/sonic-buildimage/blob/master/files/build_templates/docker_image_ctl.j2) - -For the flags that can be changed by reconfiguration, we can update entries in `minigraph.xml`, and parse the new values in to config_db with minigraph parser at reloading minigraph. If there are duplicated entries in `init_cfg.json` and `minigraph.xml`, the values in `minigraph.xml` will overwritten the values defined in `init_cfg.json`. - -### RADIUS - -The RADIUS and RADIUS_SERVER tables define RADIUS configuration parameters. RADIUS table carries global configuration while RADIUS_SERVER table carries per server configuration. - -``` - "RADIUS": { - "global": { - "auth_type": "pap", - "timeout": "5" - } - } - - "RADIUS_SERVER": { - "192.168.1.2": { - "priority": "4", - "retransmit": "2", - "timeout": "5" - } - } -``` - -#### 5.2.3 Update value directly in db memory - -For Developers -============== - -Generating Application Config by Jinja2 Template ------------------------------------------------- - -To be added. - -Incremental Configuration by Subscribing to ConfigDB ----------------------------------------------------- - -Detail instruction to be added. A sample could be found in this -[PR](https://github.com/Azure/sonic-buildimage/pull/861) that -implemented dynamic configuration for BGP. +# SONiC Configuration Database Manual + +Table of Contents +================= + + * [Introduction](#introduction) + * [Configuration](#configuration) + * [Config Load and Save](#config-load-and-save) + * [Incremental Configuration](#incremental-configuration) + * [Redis and Json Schema](#redis-and-json-schema) + * [ACL and Mirroring](#acl-and-mirroring) + * [BGP Device Global](#bgp-device-global) + * [BGP Sessions](#bgp-sessions) + * [BUFFER_PG](#buffer_pg) + * [Buffer pool](#buffer-pool) + * [Buffer profile](#buffer-profile) + * [Buffer queue](#buffer-queue) + * [Buffer port ingress profile list](#buffer-port-ingress-profile-list) + * [Buffer port egress profile list](#buffer-port-egress-profile-list) + * [Cable length](#cable-length) + * [COPP_TABLE](#copp_table) + * [Console](#console) + * [CRM](#crm) + * [Data Plane L3 Interfaces](#data-plane-l3-interfaces) + * [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER) + * [Device Metadata](#device-metadata) + * [Device neighbor metada](#device-neighbor-metada) + * [DSCP_TO_TC_MAP](#dscp_to_tc_map) + * [FLEX_COUNTER_TABLE](#flex_counter_table) + * [Hash](#hash) + * [KDUMP](#kdump) + * [Kubernetes Master](#kubernetes-master) + * [L2 Neighbors](#l2-neighbors) + * [Loopback Interface](#loopback-interface) + * [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN) + * [Management Interface](#management-interface) + * [Management port](#management-port) + * [Management VRF](#management-vrf) + * [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue) + * [MUX_CABLE](#muxcable) + * [NTP Global Configuration](#ntp-global-configuration) + * [NTP and SYSLOG servers](#ntp-and-syslog-servers) + * [Peer Switch](#peer-switch) + * [Policer](#policer) + * [Port](#port) + * [Port Channel](#port-channel) + * [Portchannel member](#portchannel-member) + * [Scheduler](#scheduler) + * [Port QoS Map](#port-qos-map) + * [Queue](#queue) + * [Syslog Rate Limit](#syslog-rate-limit) + * [Sflow](#sflow) + * [Restapi](#restapi) + * [System Port](#system-port) + * [Tacplus Server](#tacplus-server) + * [TC to Priority group map](#tc-to-priority-group-map) + * [TC to Queue map](#tc-to-queue-map) + * [Telemetry](#telemetry) + * [Tunnel](#tunnel) + * [Versions](#versions) + * [VLAN](#vlan) + * [VLAN_MEMBER](#vlan_member) + * [VOQ Inband Interface](#voq-inband-interface) + * [VXLAN](#vxlan) + * [Virtual router](#virtual-router) + * [LOGGER](#logger) + * [WRED_PROFILE](#wred_profile) + * [PASSWORD_HARDENING](#password_hardening) + * [SYSTEM_DEFAULTS table](#systemdefaults-table) + * [RADIUS](#radius) + * [For Developers](#for-developers) + * [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template) + * [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb) + + + +# Introduction +This document lists the configuration commands schema applied in the SONiC eco system. All these commands find relevance in collecting system information, analysis and even for trouble shooting. All the commands are categorized under relevant topics with corresponding examples. + +# Configuration + +SONiC is managing configuration in a single source of truth - a redisDB +instance that we refer as ConfigDB. Applications subscribe to ConfigDB +and generate their running configuration correspondingly. + +(Before Sep 2017, we were using an XML file named minigraph.xml to +configure SONiC devices. For historical documentation, please refer to +[Configuration with +Minigraph](https://github.com/Azure/SONiC/wiki/Configuration-with-Minigraph-(~Sep-2017))) + +# **Config Load and Save** + +In current version of SONiC, ConfigDB is implemented as database 4 of +local redis. When system boots, configurations will be loaded from +/etc/sonic/config_db.json file into redis. Please note that ConfigDB +content won't be written back into /etc/sonic/config_db.json file +automatically. In order to do that, a config save command need to be +manually executed from CLI. Similarly, config load will trigger a force +load of json file into DB. Generally, content in +/etc/sonic/config_db.json can be considered as starting config, and +content in redisDB running config. + +We keep a way to load configuration from minigraph and write into +ConfigDB for backward compatibility. To do that, run `config +load_minigraph`. + +### Incremental Configuration + +The design of ConfigDB supports incremental configuration - application +could subscribe to changes in ConfigDB and response correspondingly. +However, this feature is not implemented by all applications yet. By Sep +2017 now, the only application that supports incremental configuration +is BGP (docker-fpm-quagga). For other applications, a manual restart is +required after configuration changes in ConfigDB. + +# **Redis and Json Schema** + +ConfigDB uses a table-object schema that is similar with +[AppDB](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md), +and `config_db.json` is a straight-forward serialization of DB. As an +example, the following fragments could be BGP-related configuration in +redis and json, correspondingly: + + +***Redis format*** + +``` +127.0.0.1:6379[4]> keys BGP_NEIGHBOR|* + +1) "BGP_NEIGHBOR|10.0.0.31" +2) "BGP_NEIGHBOR|10.0.0.39" +3) "BGP_NEIGHBOR|10.0.0.11" +4) "BGP_NEIGHBOR|10.0.0.7" + +... + +127.0.0.1:6379[4]> hgetall BGP_NEIGHBOR|10.0.0.3 + +1) "admin_status" +2) "up" +3) "peer_addr" +4) "10.0.0.2" +5) "asn" +6) "65200" +7) "name" +8) "ARISTA07T2" +``` + +***Json format*** + +``` +"BGP_NEIGHBOR": { + "10.0.0.57": { + "rrclient": "0", + "name": "ARISTA01T1", + "local_addr": "10.0.0.56", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + }, + "10.0.0.59": { + "rrclient": "0", + "name": "ARISTA02T1", + "local_addr": "10.0.0.58", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + }, +} +``` + +Full sample config_db.json files are availables at +[here](https://github.com/Azure/SONiC/blob/gh-pages/doc/config_db.json) +and +[here](https://github.com/Azure/SONiC/blob/gh-pages/doc/config_db_t0.json). + + +### ACL and Mirroring + +ACL and mirroring related configuration are defined in +**MIRROR_SESSION**, **ACL_TABLE** and **ACL_RULE** tables. Those +tables are in progress of migrating from APPDB. Please refer to their +schema in APPDB +[here](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md) +and migration plan +[here](https://github.com/Azure/SONiC/wiki/ACL-Configuration-Requirement-Description). + +``` +{ +"MIRROR_SESSION": { + "everflow0": { + "src_ip": "10.1.0.32", + "dst_ip": "2.2.2.2" + } + }, + +"ACL_TABLE": { + "DATAACL": { + "policy_desc" : "data_acl", + "type": "l3", + "ports": [ + "Ethernet0", + "Ethernet4", + "Ethernet8", + "Ethernet12" + ] + } + } +} +``` + +***Below ACL table added as per the mail*** +``` +{ +"ACL_TABLE": { + "aaa": { + "type": "L3", + "ports": "Ethernet0" + } + }, +"ACL_RULE": { + "aaa|rule_0": { + "PRIORITY": "55", + "PACKET_ACTION": "DROP", + "L4_SRC_PORT": "0" + }, + "aaa|rule_1": { + "PRIORITY": "55", + "PACKET_ACTION": "DROP", + "L4_SRC_PORT": "1" + } + } +} +``` + +***Below ACL table added by comparig minigraph.xml & config_db.json*** + +``` +{ +"ACL_TABLE": { + "EVERFLOW": { + "type": "MIRROR", + "policy_desc": "EVERFLOW", + "ports": [ + "PortChannel0001", + "PortChannel0002", + "PortChannel0003", + "PortChannel0004" + ] + }, + "EVERFLOWV6": { + "type": "MIRRORV6", + "policy_desc": "EVERFLOWV6", + "ports": [ + "PortChannel0001", + "PortChannel0002", + "PortChannel0003", + "PortChannel0004" + ] + }, + "SNMP_ACL": { + "services": [ + "SNMP" + ], + "type": "CTRLPLANE", + "policy_desc": "SNMP_ACL" + }, + "SSH_ONLY": { + "services": [ + "SSH" + ], + "type": "CTRLPLANE", + "policy_desc": "SSH_ONLY" + } + }, + +"ACL_RULE": { + "SNMP_ACL|DEFAULT_RULE": { + "PRIORITY": "1", + "PACKET_ACTION": "DROP", + "ETHER_TYPE": "2048" + }, + "SNMP_ACL|RULE_1": { + "PRIORITY": "9999", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "1.1.1.1/32", + "IP_PROTOCOL": "17" + }, + "SNMP_ACL|RULE_2": { + "PRIORITY": "9998", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "2.2.2.2/32", + "IP_PROTOCOL": "17" + }, + "SSH_ONLY|DEFAULT_RULE": { + "PRIORITY": "1", + "PACKET_ACTION": "DROP", + "ETHER_TYPE": "2048" + }, + "SSH_ONLY|RULE_1": { + "PRIORITY": "9999", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "4.4.4.4/8", + "IP_PROTOCOL": "6" + } + } +} + +``` + +***ACL table type configuration example*** +``` +{ + "ACL_TABLE_TYPE": { + "CUSTOM_L3": { + "MATCHES": [ + "IN_PORTS", + "OUT_PORTS", + "SRC_IP" + ], + "ACTIONS": [ + "PACKET_ACTION", + "MIRROR_INGRESS_ACTION" + ], + "BIND_POINTS": [ + "PORT", + "LAG" + ] + } + }, + "ACL_TABLE": { + "DATAACL": { + "STAGE": "INGRESS", + "TYPE": "CUSTOM_L3", + "PORTS": [ + "Ethernet0", + "PortChannel1" + ] + } + }, + "ACL_RULE": { + "DATAACL|RULE0": { + "PRIORITY": "999", + "PACKET_ACTION": "DROP", + "SRC_IP": "1.1.1.1/32", + } + } +} +``` +### BGP Device Global + +The **BGP_DEVICE_GLOBAL** table contains device-level BGP global state. +It has a STATE object containing device state like **tsa_enabled** +which is set to true if device is currently isolated using +traffic-shift-away (TSA) route-maps in BGP + +``` +{ +"BGP_DEVICE_GLOBAL": { + "STATE": { + "tsa_enabled": "true" + } +} +``` +### BGP Sessions + +BGP session configuration is defined in **BGP_NEIGHBOR** table. BGP +neighbor address is used as key of bgp neighbor objects. Object +attributes include remote AS number, neighbor router name, and local +peering address. Dynamic neighbor is also supported by defining peer +group name and IP ranges in **BGP_PEER_RANGE** table. + +``` +{ +"BGP_NEIGHBOR": { + "10.0.0.61": { + "local_addr": "10.0.0.60", + "asn": 64015, + "name": "ARISTA15T0" + }, + "10.0.0.49": { + "local_addr": "10.0.0.48", + "asn": 64009, + "name": "ARISTA09T0" + }, + + "10.0.0.63": { + "rrclient": "0", + "name": "ARISTA04T1", + "local_addr": "10.0.0.62", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + } + +"BGP_PEER_RANGE": { + "BGPSLBPassive": { + "name": "BGPSLBPassive", + "ip_range": [ + "10.250.0.0/27" + ] + }, + "BGPVac": { + "name": "BGPVac", + "ip_range": [ + "10.2.0.0/16" + ] + } + } +} +``` + +### BUFFER_PG + +When the system is running in traditional buffer model, profiles needs to explicitly configured: + +``` +{ +"BUFFER_PG": { + "Ethernet0|3-4": { + "profile": "pg_lossless_40000_5m_profile" + }, + "Ethernet1|3-4": { + "profile": "pg_lossless_40000_5m_profile" + }, + "Ethernet2|3-4": { + "profile": "pg_lossless_40000_5m_profile" + } + } +} + +``` + +When the system is running in dynamic buffer model, profiles can be: + + - either calculated dynamically according to ports' configuration and just configured as "NULL"; + - or configured explicitly. + +``` +{ +"BUFFER_PG": { + "Ethernet0|3-4": { + "profile": "NULL" + }, + "Ethernet1|3-4": { + "profile": "NULL" + }, + "Ethernet2|3-4": { + "profile": "static_profile" + } + } +} + +``` + +### Buffer pool + +When the system is running in traditional buffer model, the size of all of the buffer pools and xoff of ingress_lossless_pool need to be configured explicitly. + +``` +{ +"BUFFER_POOL": { + "egress_lossless_pool": { + "type": "egress", + "mode": "static", + "size": "15982720" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic", + "size": "9243812" + }, + "ingress_lossless_pool": { + "xoff": "4194112", + "type": "ingress", + "mode": "dynamic", + "size": "10875072" + } + } +} + +``` + +When the system is running in dynamic buffer model, the size of some of the buffer pools can be omitted and will be dynamically calculated. + +``` +{ +"BUFFER_POOL": { + "egress_lossless_pool": { + "type": "egress", + "mode": "static", + "size": "15982720" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic", + }, + "ingress_lossless_pool": { + "type": "ingress", + "mode": "dynamic", + } + } +} + +``` + + +### Buffer profile + +``` +{ +"BUFFER_PROFILE": { + "egress_lossless_profile": { + "static_th": "3995680", + "pool": "egress_lossless_pool", + "size": "1518" + }, + "egress_lossy_profile": { + "dynamic_th": "3", + "pool": "egress_lossy_pool", + "size": "1518" + }, + "ingress_lossy_profile": { + "dynamic_th": "3", + "pool": "ingress_lossless_pool", + "size": "0" + }, + "pg_lossless_40000_5m_profile": { + "xon_offset": "2288", + "dynamic_th": "-3", + "xon": "2288", + "xoff": "66560", + "pool": "ingress_lossless_pool", + "size": "1248" + }, + "pg_lossless_40000_40m_profile": { + "xon_offset": "2288", + "dynamic_th": "-3", + "xon": "2288", + "xoff": "71552", + "pool": "ingress_lossless_pool", + "size": "1248" + } + } +} + +``` + +When the system is running in dynamic buffer model and the headroom_type is dynamic, only dynamic_th needs to be configured and rest of fields can be omitted. +This kind of profiles will be handled by buffer manager and won't be applied to SAI. + +``` +{ + { + "non_default_dynamic_th_profile": { + "dynamic_th": 1, + "headroom_type": "dynamic" + } + } +} +``` + +### Buffer queue + +``` +{ +"BUFFER_QUEUE": { + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|0-2": { + "profile": "egress_lossy_profile" + }, + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|3-4": { + "profile": "egress_lossless_profile" + }, + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|5-6": { + "profile": "egress_lossy_profile" + } + } +} + +``` + +### Buffer port ingress profile list + +``` +{ +"BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet50": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + }, + "Ethernet52": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + }, + "Ethernet56": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + } + } +} + +``` + +### Buffer port egress profile list + +``` +{ +"BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet50": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + }, + "Ethernet52": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + }, + "Ethernet56": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + } + } +} + +``` + +### Cable length + +``` +{ +"CABLE_LENGTH": { + "AZURE": { + "Ethernet8": "5m", + "Ethernet9": "5m", + "Ethernet2": "5m", + "Ethernet58": "5m", + "Ethernet59": "5m", + "Ethernet50": "40m", + "Ethernet51": "5m", + "Ethernet52": "40m", + "Ethernet53": "5m", + "Ethernet54": "40m", + "Ethernet55": "5m", + "Ethernet56": "40m" + } + } +} + +``` + +### COPP_TABLE + +``` +{ +"COPP_TABLE": { + "default": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "0", + "red_action": "drop" + }, + + "trap.group.arp": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "4", + "red_action": "drop", + "trap_action": "trap", + "trap_ids": "arp_req,arp_resp,neigh_discovery", + "trap_priority": "4" + }, + + "trap.group.lldp.dhcp.udld": { + "queue": "4", + "trap_action": "trap", + "trap_ids": "lldp,dhcp,udld", + "trap_priority": "4" + }, + + "trap.group.bgp.lacp": { + "queue": "4", + "trap_action": "trap", + "trap_ids": "bgp,bgpv6,lacp", + "trap_priority": "4" + }, + + "trap.group.ip2me": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "1", + "red_action": "drop", + "trap_action": "trap", + "trap_ids": "ip2me", + "trap_priority": "1" + } + } +} +``` + +### Console + +``` +{ +"CONSOLE_PORT": { + "1": { + "baud_rate": "115200", + "flow_control": "0", + "remote_device": "host-1" + }, + "2": { + "baud_rate": "9600", + "flow_control": "1" + } + }, +"CONSOLE_SWITCH": { + "console_mgmt": { + "enabled": "yes" + } + } +} +``` + +### CRM + +``` +{ +"CRM": { + "Config": { + "acl_table_threshold_type": "percentage", + "nexthop_group_threshold_type": "percentage", + "fdb_entry_high_threshold": "85", + "acl_entry_threshold_type": "percentage", + "ipv6_neighbor_low_threshold": "70", + "nexthop_group_member_low_threshold": "70", + "acl_group_high_threshold": "85", + "ipv4_route_high_threshold": "85", + "acl_counter_high_threshold": "85", + "ipv4_route_low_threshold": "70", + "ipv4_route_threshold_type": "percentage", + "ipv4_neighbor_low_threshold": "70", + "acl_group_threshold_type": "percentage", + "ipv4_nexthop_high_threshold": "85", + "ipv6_route_threshold_type": "percentage", + "snat_entry_threshold_type": "percentage", + "snat_entry_high_threshold": "85", + "snat_entry_low_threshold": "70", + "dnat_entry_threshold_type": "percentage", + "dnat_entry_high_threshold": "85", + "dnat_entry_low_threshold": "70", + "ipmc_entry_threshold_type": "percentage", + "ipmc_entry_high_threshold": "85", + "ipmc_entry_low_threshold": "70" + } + } +} + +``` + +### Data Plane L3 Interfaces + +IP configuration for data plane are defined in **INTERFACE**, **VLAN_SUB_INTERFACE**, +**PORTCHANNEL_INTERFACE** and **VLAN_INTERFACE** table. The objects +in all four tables have the interface (could be physical port, port +channel, vlan or vlan sub interface) that IP address is attached to as first-level key, and +IP prefix as second-level key. IP interface address objects don't have any attributes. +IP interface attributes, resides in those tables as well, key is the interface name +and value is a list of field-values representing the interface attributes, e.g. loopback action. + +``` +{ +"INTERFACE": { + "Ethernet0|10.0.0.0/31": {}, + "Ethernet4|10.0.0.2/31": {}, + "Ethernet8|10.0.0.4/31": {} + "Ethernet8": { + "loopback_action": "drop" + } + }, + +"PORTCHANNEL_INTERFACE": { + "PortChannel01|10.0.0.56/31": {}, + "PortChannel01|FC00::71/126": {}, + "PortChannel02|10.0.0.58/31": {}, + "PortChannel02|FC00::75/126": {} + }, + +"VLAN_INTERFACE": { + "Vlan1000|192.168.0.1/27": {} + }, + +"VLAN_SUB_INTERFACE": { + "Ethernet4.1|10.0.0.2/31": {}, + "Ethernet4.1": { + "loopback_action": "drop" + } + } +} +``` + + +### DEFAULT_LOSSLESS_BUFFER_PARAMETER + +This table stores the default lossless buffer parameters for dynamic buffer calculation. + +``` +{ + "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0", + "over_subscribe_ratio": "2" + } + } +} +``` + +### Device Metadata + +The **DEVICE_METADATA** table contains only one object named +*localhost*. In this table the device metadata such as hostname, hwsku, +deployment envionment id and deployment type are specified. BGP local AS +number is also specified in this table as current only single BGP +instance is supported in SONiC. + +``` +{ +"DEVICE_METADATA": { + "localhost": { + "hwsku": "Force10-S6100", + "default_bgp_status": "up", + "docker_routing_config_mode": "unified", + "hostname": "sonic-s6100-01", + "platform": "x86_64-dell_s6100_c2538-r0", + "mac": "4c:76:25:f4:70:82", + "default_pfcwd_status": "disable", + "bgp_asn": "65100", + "deployment_id": "1", + "type": "ToRRouter", + "bgp_adv_lo_prefix_as_128" : "true", + "buffer_model": "traditional", + "yang_config_validation": "disable" + } + } +} + +``` + + +### Device neighbor metada + +``` +{ +"DEVICE_NEIGHBOR_METADATA": { + "ARISTA01T1": { + "lo_addr": "None", + "mgmt_addr": "10.11.150.45", + "hwsku": "Arista-VM", + "type": "LeafRouter" + }, + "ARISTA02T1": { + "lo_addr": "None", + "mgmt_addr": "10.11.150.46", + "hwsku": "Arista-VM", + "type": "LeafRouter" + } + } +} + +``` + + +### DSCP_TO_TC_MAP +``` +{ +"DSCP_TO_TC_MAP": { + "AZURE": { + "1": "1", + "0": "1", + "3": "3", + "2": "1", + "5": "2", + "4": "4", + "7": "1", + "6": "1", + "9": "1", + "8": "0" + } + } +} + +``` + + +### MPLS_TC_TO_TC_MAP +``` +{ +"MPLS_TC_TO_TC_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "2", + "5": "3", + "6": "3", + "7": "4" + } + } +} + +``` + +### FLEX_COUNTER_TABLE + +``` +{ + "FLEX_COUNTER_TABLE": { + "PFCWD": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "1000" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" + }, + "TUNNEL": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" + } + } +} + +``` + +### Hash + +Generic hash allows user to configure which hash fields are suppose to be used by a hashing algorithm. +The configuration is applied globally for each ECMP and LAG on a switch. + +***ECMP/LAG HASH*** + +``` +{ + "SWITCH_HASH": { + "GLOBAL": { + "ecmp_hash": [ + "DST_MAC", + "SRC_MAC", + "ETHERTYPE", + "IP_PROTOCOL", + "DST_IP", + "SRC_IP", + "L4_DST_PORT", + "L4_SRC_PORT", + "INNER_DST_MAC", + "INNER_SRC_MAC", + "INNER_ETHERTYPE", + "INNER_IP_PROTOCOL", + "INNER_DST_IP", + "INNER_SRC_IP", + "INNER_L4_DST_PORT", + "INNER_L4_SRC_PORT" + ], + "lag_hash": [ + "DST_MAC", + "SRC_MAC", + "ETHERTYPE", + "IP_PROTOCOL", + "DST_IP", + "SRC_IP", + "L4_DST_PORT", + "L4_SRC_PORT", + "INNER_DST_MAC", + "INNER_SRC_MAC", + "INNER_ETHERTYPE", + "INNER_IP_PROTOCOL", + "INNER_DST_IP", + "INNER_SRC_IP", + "INNER_L4_DST_PORT", + "INNER_L4_SRC_PORT" + ] + } + } +} +``` + +### KDUMP + +``` +{ + "KDUMP": { + "config": { + "enabled": "true", + "num_dumps": "3", + "memory": "0M-2G:256M,2G-4G:256M,4G-8G:384M,8G-:448M" + } + } +} + +``` + +### Kubernetes Master + +Kubernetes Master related configurations are stored in +**KUBERNETES_MASTER** table. These configurations are used mainly +for CTRMGR service. CTRMGR service will interactive with +kubernetes master according to these configurations. + +``` +{ + "KUBERNETES_MASTER": { + "SERVER": { + "disable": "False", + "insecure": "True", + "ip": "k8s.apiserver.com", + "port": "6443" + } + } +} + +``` + +### L2 Neighbors + +The L2 neighbor and connection information can be configured in +**DEVICE_NEIGHBOR** table. Those information are used mainly for LLDP. +While mandatory fields include neighbor name acting as object key and +remote port / local port information in attributes, optional information +about neighbor device such as device type, hwsku, management address and +loopback address can also be defined. + +``` +{ +"DEVICE_NEIGHBOR": { + "ARISTA04T1": { + "mgmt_addr": "10.20.0.163", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet124", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA03T1": { + "mgmt_addr": "10.20.0.162", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet120", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA02T1": { + "mgmt_addr": "10.20.0.161", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet116", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA01T1": { + "mgmt_addr": "10.20.0.160", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet112", + "type": "LeafRouter", + "port": "Ethernet1" + } + } +} +``` + +### Loopback Interface + +Loopback interface configuration lies in **LOOPBACK_INTERFACE** table +and has similar schema with data plane interfaces. The loopback device +name and loopback IP prefix act as multi-level key for loopback +interface objects. +By default SONiC advertises Loopback interface IPv6 /128 subnet address +as prefix with /64 subnet. To overcome this set "bgp_adv_lo_prefix_as_128" +to true in DEVICE_METADATA + +``` +{ +"LOOPBACK_INTERFACE": { + "Loopback0|10.1.0.32/32": {}, + "Loopback0|FC00:1::32/128": {} + } +} + +``` + +### LOSSLESS_TRAFFIC_PATTERN + +The LOSSLESS_TRAFFIC_PATTERN table stores parameters related to +lossless traffic for dynamic buffer calculation + +``` +{ + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1024", + "small_packet_percentage": "100" + } + } +} +``` + +### Management Interface + +Management interfaces are defined in **MGMT_INTERFACE** table. Object +key is composed of management interface name and IP prefix. Attribute +***gwaddr*** specify the gateway address of the prefix. +***forced_mgmt_routes*** attribute can be used to specify addresses / +prefixes traffic to which are forced to go through management network +instead of data network. + +``` +{ +"MGMT_INTERFACE": { + "eth0|10.11.150.11/16": { + "gwaddr": "10.11.0.1" + }, + "eth0|FC00:2::32/64": { + "forced_mgmt_routes": [ + "10.0.0.100/31", + "10.250.0.8", + "10.255.0.0/28" + ], + "gwaddr": "fc00:2::1" + } + } +} + +``` + +### Management port + +``` +{ +"MGMT_PORT": { + "eth0": { + "alias": "eth0", + "admin_status": "up" + } + } +} + +``` + + +### Management VRF + +``` +{ +"MGMT_VRF_CONFIG": { + "vrf_global": { + "mgmtVrfEnabled": "true" + } + } +} +``` + +### MAP_PFC_PRIORITY_TO_QUEUE + +``` +{ +"MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` +### MUX_CABLE + +The **MUX_CABLE** table is used for dualtor interface configuration. The `cable_type` and `soc_ipv4` objects are optional. + +``` +{ + "MUX_CABLE": { + "Ethernet4": { + "cable_type": "active-active", + "server_ipv4": "192.168.0.2/32", + "server_ipv6": "fc02:1000::30/128", + "soc_ipv4": "192.168.0.3/32", + "state": "auto" + } + } +} +``` + +### NTP Global Configuration + +These configuration options are used to modify the way that +ntp binds to the ports on the switch and which port it uses to +make ntp update requests from. + +***NTP VRF*** + +If this option is set to `default` then ntp will run within the default vrf +**when the management vrf is enabled**. If the mgmt vrf is enabled and this value is +not set to default then ntp will run within the mgmt vrf. + +This option **has no effect** if the mgmt vrf is not enabled. + +``` +{ +"NTP": { + "global": { + "vrf": "default" + } + } +} +``` + + +***NTP Source Port*** + +This option sets the port which ntp will choose to send time update requests from by. + +NOTE: If a Loopback interface is defined on the switch ntp will choose this by default, so this setting +is **required** if the switch has a Loopback interface and the ntp peer does not have defined routes +for that address. + +``` +{ +"NTP": { + "global": { + "src_intf": "Ethernet1" + } + } +} +``` + +### NTP and SYSLOG servers + +These information are configured in individual tables. Domain name or IP +address of the server is used as object key. Currently there are no +attributes in those objects. + +***NTP server*** +``` +{ + "NTP_SERVER": { + "2.debian.pool.ntp.org": {}, + "1.debian.pool.ntp.org": {}, + "3.debian.pool.ntp.org": {}, + "0.debian.pool.ntp.org": {} + }, + + "NTP_SERVER": { + "23.92.29.245": {}, + "204.2.134.164": {} + } +} +``` + +***Syslog server*** +``` +{ + "SYSLOG_SERVER": { + "10.0.0.5": {}, + "10.0.0.6": {}, + "10.11.150.5": {} + }, + + "SYSLOG_SERVER" : { + "2.2.2.2": { + "source": "1.1.1.1", + "port": "514", + "vrf": "default" + }, + "4.4.4.4": { + "source": "3.3.3.3", + "port": "514", + "vrf": "mgmt" + }, + "2222::2222": { + "source": "1111::1111", + "port": "514", + "vrf": "Vrf-Data" + } + } +} +``` + +### Peer Switch + +Below is an exmaple of the peer switch table configuration. +``` +{ + "PEER_SWITCH": { + "vlab-05": { + "address_ipv4": "10.1.0.33" + } + } +} +``` + +### Policer + +Below is an example of the policer table configuration. +``` +{ + "POLICER": { + "everflow_static_policer": { + "meter_type": "bytes", + "mode": "sr_tcm", + "cir": "12500000", + "cbs": "12500000", + "pir": "17500000", + "pbs": "17500000", + "color": "aware", + "red_packet_action": "drop", + "yellow_packet_action": "drop" + "green_packet_action": "forward" + } + } +} + +``` +Key to the table defines policer name Below are the fields +- meter_type - Mandatory field. Defines how the metering is done. values - bytes, packets +- mode - Mandatory field. Defines one of the three modes support. values - sr_tcm, tr_tcm, storm +- cir - Committed information rate bytes/sec or packets/sec based on meter_type +- cbs - Committed burst size in bytes or packets based on meter_type +- pir - Peak information rate in bytes/sec or packets/sec based on meter_type +- pbs - Peak burst size in bytes or packets based on meter_type +- color - Defines the color source for the policer. values - aware, blind +- red_packet_action - Defines the action to be taken for red color packets +- yellow_packet_action - Defines the action to be taken for yellow color packets +- green_packet_action - Defines the action to be taken for green color packets. + +The packet action could be: + +- 'drop' +- 'forward' +- 'copy' +- 'copy_cancel' +- 'trap' +- 'log' +- 'deny' +- 'transit' +### Port + +In this table the physical port configurations are defined. Each object +will have port name as its key, and port name alias and port speed as +optional attributes. + +``` +{ +"PORT": { + "Ethernet0": { + "index": "0", + "lanes": "101,102", + "description": "fortyGigE1/1/1", + "mtu": "9100", + "alias": "fortyGigE1/1/1", + "speed": "40000", + "link_training": "off", + "laser_freq": "191300", + "tx_power": "-27.3" + }, + "Ethernet1": { + "index": "1", + "lanes": "103,104", + "description": "fortyGigE1/1/2", + "mtu": "9100", + "alias": "fortyGigE1/1/2", + "admin_status": "up", + "speed": "40000", + "link_training": "on", + "laser_freq": "191300", + "tx_power": "-27.3" + }, + "Ethernet63": { + "index": "63", + "lanes": "87,88", + "description": "fortyGigE1/4/16", + "mtu": "9100", + "alias": "fortyGigE1/4/16", + "speed": "40000", + "laser_freq": "191300", + "tx_power": "-27.3" + } + } +} + +``` + +### Port Channel + +Port channels are defined in **PORTCHANNEL** table with port channel +name as object key and member list as attribute. + +``` +{ +"PORTCHANNEL": { + "PortChannel0003": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet54" + ], + "mtu": "9100" + }, + "PortChannel0004": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet56" + ], + "mtu": "9100" + } + } +} +``` + + +### Portchannel member + +``` +{ +"PORTCHANNEL_MEMBER": { + "PortChannel0001|Ethernet50": {}, + "PortChannel0002|Ethernet52": {}, + "PortChannel0003|Ethernet54": {}, + "PortChannel0004|Ethernet56": {} + } +} + +``` +### Scheduler + +``` +{ +"SCHEDULER": { + "scheduler.0": { + "type": "STRICT" + }, + "scheduler.1": { + "type": "WRR" + "weight": "1", + "meter_type": "bytes", + "pir": "1250000000", + "pbs": "8192" + }, + "scheduler.port": { + "meter_type": "bytes", + "pir": "1000000000", + "pbs": "8192" + } + } +} +``` + +### Port QoS Map + +``` +{ +"PORT_QOS_MAP": { + "Ethernet50,Ethernet52,Ethernet54,Ethernet56": { + "tc_to_pg_map": "AZURE", + "tc_to_queue_map": "AZURE", + "pfc_enable": "3,4", + "pfc_to_queue_map": "AZURE", + "dscp_to_tc_map": "AZURE", + "dscp_to_fc_map": "AZURE", + "exp_to_fc_map": "AZURE", + "scheduler": "scheduler.port" + } + } +} +``` + +### Queue +``` +{ +"QUEUE": { + "Ethernet56|4": { + "wred_profile": "AZURE_LOSSLESS", + "scheduler": "scheduler.1" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + } + } +} +``` + +### Restapi +``` +{ +"RESTAPI": { + "certs": { + "ca_crt": "/etc/sonic/credentials/ame_root.pem", + "server_key": "/etc/sonic/credentials/restapiserver.key", + "server_crt": "/etc/sonic/credentials/restapiserver.crt", + "client_crt_cname": "client.sonic.net" + }, + "config": { + "client_auth": "true", + "log_level": "trace", + "allow_insecure": "false" + } +} +``` +### Sflow + +The below are the tables and their schema for SFLOW feature + +SFLOW + +| Field | Description | Mandatory | Default | Reference | +|------------------|-----------------------------------------------------------------------------------------|-------------|-----------|-------------------------------------------| +| admin_state | Global sflow admin state | | down | | +| polling_interval | The interval within which sFlow data is collected and sent to the configured collectors | | 20 | | +| agent_id | Interface name | | | PORT:name,PORTCHANNEL:name,MGMT_PORT:name, VLAN:name | + +SFLOW_SESSION + +key - port +| Field | Description | Mandatory | Default | Reference | +|-------------|-------------------------------------------------------------------------------------------------------------------------|-------------|-----------|-------------| +| port | Sets sflow session table attributes for either all interfaces or a specific Ethernet interface. | | | PORT:name | +| admin_state | Per port sflow admin state | | up | | +| sample_rate | Sets the packet sampling rate. The rate is expressed as an integer N, where the intended sampling rate is 1/N packets. | | | | + +SFLOW_COLLECTOR + +key - name +| Field | Description | Mandatory | Default | Reference | +|----------------|-----------------------------------------------------------------------------------------|-------------|-----------|-------------| +| name | Name of the Sflow collector | | | | +| collector_ip | IPv4/IPv6 address of the Sflow collector | true | | | +| collector_port | Destination L4 port of the Sflow collector | | 6343 | | +| collector_vrf | Specify the Collector VRF. In this revision, it is either default VRF or Management VRF.| | | | + +### Syslog Rate Limit + +Host side configuration: + +``` +{ +"SYSLOG_CONFIG": { + "GLOBAL": { + "rate_limit_interval": "300", + "rate_limit_burst": "20000" + } + } +} +``` + +Container side configuration: + +``` +{ +"SYSLOG_CONFIG_FEATURE": { + "bgp": { + "rate_limit_interval": "300", + "rate_limit_burst": "20000" + }, + "pmon": { + "rate_limit_interval": "300", + "rate_limit_burst": "20000" + } + } +} +``` + +### System Port +Every port on the system requires a global representation, known as a System Port, +and is listed in this table. + +``` +{ +"SYSTEM_PORT": { + "host227-4|asic0|Ethernet0": { + "core_index": "1", + "core_port_index": "1", + "num_voq": "8", + "speed": "100000", + "switch_id": "0", + "system_port_id": "1" + }, + "host227-4|asic0|Ethernet4": { + "core_index": "1", + "core_port_index": "2", + "num_voq": "8", + "speed": "100000", + "switch_id": "0", + "system_port_id": "2" + }, + "host227-5|asic0|Ethernet0": { + "core_index": "1", + "core_port_index": "1", + "num_voq": "8", + "speed": "100000", + "switch_id": "4", + "system_port_id": "80" + }, + "host227-5|asic0|Ethernet4": { + "core_index": "1", + "core_port_index": "2", + "num_voq": "8", + "speed": "100000", + "switch_id": "4", + "system_port_id": "81" + } + } +} +``` + +### Tacplus Server + +``` +{ +"TACPLUS_SERVER": { + "10.0.0.8": { + "priority": "1", + "tcp_port": "49" + }, + "10.0.0.9": { + "priority": "1", + "tcp_port": "49" + } + } +} +``` + + +### TC to Priority group map + +``` +{ +"TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` + +### TC to Queue map + +``` +{ +"TC_TO_QUEUE_MAP": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` + +### Telemetry + +``` +{ + "TELEMETRY": { + "certs": { + "ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", + "server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer", + "server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key" + }, + "gnmi": { + "client_auth": "true", + "log_level": "2", + "port": "50051" + } + } +} +``` + +### Tunnel + +This table configures the MUX tunnel for Dual-ToR setup +``` +{ + "TUNNEL": { + "MuxTunnel0": { + "dscp_mode": "uniform", + "dst_ip": "10.1.0.32", + "ecn_mode": "copy_from_outer", + "encap_ecn_mode": "standard", + "ttl_mode": "pipe", + "tunnel_type": "IPINIP" + } + } +} +``` + +different example for configuring MUX tunnel +``` +{ + "TUNNEL": { + "MuxTunnel0": { + "dscp_mode": "pipe", + "dst_ip": "10.1.0.32", + "ecn_mode": "standard", + "encap_ecn_mode": "standard", + "ttl_mode": "uniform", + "tunnel_type": "IPINIP" + } + } +} +``` + +example mux tunnel configuration for when tunnel_qos_remap is enabled +``` +{ + "TUNNEL": { + "MuxTunnel0": { + "tunnel_type": "IPINIP", + "src_ip": "10.1.0.33", + "dst_ip": "10.1.0.32", + "dscp_mode": "pipe", + "encap_ecn_mode": "standard", + "ecn_mode": "copy_from_outer", + "ttl_mode": "uniform", + "decap_dscp_to_tc_map": "DecapDscpToTcMap", + "decap_tc_to_pg_map": "DecapTcToPgMap", + "encap_tc_to_dscp_map": "EncapTcToQueueMap", + "encap_tc_to_queue_map": "EncapTcToDscpMap" + } + } +} +``` + +### Versions + +This table is where the curret version of the software is recorded. +``` +{ + "VERSIONS": { + "DATABASE": { + "VERSION": "version_1_0_1" + } + } +} +``` + +### VLAN + +This table is where VLANs are defined. VLAN name is used as object key, +and member list as well as an integer id are defined as attributes. If a +DHCP relay is required for this VLAN, a dhcp_servers attribute must be +specified for that VLAN, the value of which is a list that must contain +the domain name or IP address of one or more DHCP servers. + +``` +{ +"VLAN": { + "Vlan1000": { + "dhcp_servers": [ + "192.0.0.1", + "192.0.0.2", + "192.0.0.3", + "192.0.0.4" + ], + "members": [ + "Ethernet0", + "Ethernet4", + "Ethernet8", + "Ethernet12" + ], + "vlanid": "1000" + } + } +} +``` + +### VLAN_MEMBER + +VLAN member table has Vlan name together with physical port or port +channel name as object key, and tagging mode as attributes. + +``` +{ +"VLAN_MEMBER": { + "Vlan1000|PortChannel47": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet8": { + "tagging_mode": "untagged" + }, + "Vlan2000|PortChannel47": { + "tagging_mode": "tagged" + } + } +} +``` + +### VOQ INBAND INTERFACE + +VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu communication. At this time, only inband_type of "port" is supported + +``` +"VOQ_INBAND_INTERFACE": { + "Ethernet-IB0": { + "inband_type": "port" + }, + "Ethernet-IB0|3.3.3.1/32": {}, + "Ethernet-IB0|3333::3:5/128": {} +} +``` + +### VXLAN + +VXLAN_TUNNEL holds the VTEP source ip configuration. +VXLAN_TUNNEL_MAP holds the vlan to vni and vni to vlan mapping configuration. +VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered tunnels. + +``` +{ +"VXLAN_TUNNEL": { + "vtep1": { + "src_ip": "10.10.10.10" + } + } +"VXLAN_TUNNEL_MAP" : { + "vtep1|map_1000_Vlan100": { + "vni": "1000", + "vlan": "100" + }, + "vtep1|testmap": { + "vni": "22000", + "vlan": "70" + }, + } + "VXLAN_EVPN_NVO": { + "nvo1": { + "source_vtep": "vtep1" + } + } +} +``` + +### Virtual router + +The virtual router table allows to insert or update a new virtual router +instance. The key of the instance is its name. The attributes in the +table allow to change properties of a virtual router. Attributes: + +- 'v4' contains boolean value 'true' or 'false'. Enable or + disable IPv4 in the virtual router +- 'v6' contains boolean value 'true' or 'false'. Enable or + disable IPv6 in the virtual router +- 'src_mac' contains MAC address. What source MAC address will be + used for packets egressing from the virtual router +- 'ttl_action' contains packet action. Defines the action for + packets with TTL == 0 or TTL == 1 +- 'ip_opt_action' contains packet action. Defines the action for + packets with IP options +- 'l3_mc_action' contains packet action. Defines the action for + unknown L3 multicast packets + +The packet action could be: + +- 'drop' +- 'forward' +- 'copy' +- 'copy_cancel' +- 'trap' +- 'log' +- 'deny' +- 'transit' + + +***TBD*** +``` +'VRF:rid1': { + 'v4': 'true', + 'v6': 'false', + 'src_mac': '02:04:05:06:07:08', + 'ttl_action': 'copy', + 'ip_opt_action': 'deny', + 'l3_mc_action': 'drop' +} +``` + + +### WRED_PROFILE + +``` +{ +"WRED_PROFILE": { + "AZURE_LOSSLESS": { + "red_max_threshold": "2097152", + "wred_green_enable": "true", + "ecn": "ecn_all", + "green_min_threshold": "1048576", + "red_min_threshold": "1048576", + "wred_yellow_enable": "true", + "yellow_min_threshold": "1048576", + "green_max_threshold": "2097152", + "green_drop_probability": "5", + "yellow_max_threshold": "2097152", + "wred_red_enable": "true", + "yellow_drop_probability": "5", + "red_drop_probability": "5" + } + } +} +``` + +### Logger + +In this table, the loglevel and logoutput of the components are defined. Each component +will have the component name as its key; and LOGLEVEL and LOGOUTPUT as attributes. +The LOGLEVEL attribute will define the verbosity of the component. +The LOGOUTPUT attribute will define the file of printing the logs. + +``` +{ + "LOGGER": { + "orchagent": { + "LOGLEVEL": "NOTICE", + "LOGOUTPUT": "SYSLOG" + }, + "syncd": { + "LOGLEVEL": "DEBUG", + "LOGOUTPUT": "STDOUT" + }, + "SAI_API_LAG": { + "LOGLEVEL": "ERROR", + "LOGOUTPUT": "STDERR" + } + } +} + +``` + +### PASSWORD_HARDENING + +Password Hardening, a user password is the key credential used in order to verify the user accessing the switch and acts as the first line of defense in regards to securing the switch. PASSWORD_HARDENING - support the enforce strong policies. + +- state - Enable/Disable password hardening feature +- len_min - The minimum length of the PW should be subject to a user change. +- expiration - PW Age Change Once a PW change takes place - the DB record for said PW is updated with the new PW value and a fresh new age (=0). +- expiration_warning - The switch will provide a warning for PW change before and (this is to allow a sufficient warning for upgrading the PW which might be relevant to numerous switches). +- history_cnt - remember last passwords, and reject to use the old passw +- reject_user_passw_match - reject to set same username and passw +- PW classes - are the type of characters the user is required to enter when setting/updating a PW. +There are 4 classes + - lower_class - Small characters - a-z + - upper_class - Big characters - A-Z + - digits_class -Numbers - 0-9 + - special_class - Special Characters `~!@#$%^&*()-_+=|[{}];:',<.>/? and white space +``` +{ +"PASSW_HARDENING": { + "POLICIES": { + "state": "disabled", + "expiration": "180", + "expiration_warning": "15", + "history_cnt": "10", + "len_min": "8", + "reject_user_passw_match": "true", + "lower_class": "true", + "upper_class": "true", + "digits_class": "true", + "special_class": "true" + } + } +} +``` + +### BREAKOUT_CFG + +This table is introduced as part of Dynamic Port Breakout(DPB) feature. +It shows the current breakout mode of all ports(root ports). +The list of root ports, all possible breakout modes, and default breakout modes + are obtained/derived from platform.json and hwsku.json files. + +``` +"BREAKOUT_CFG": { + "Ethernet0": { + "brkout_mode": "4x25G[10G]" + }, + "Ethernet4": { + "brkout_mode": "4x25G[10G]" + }, + "Ethernet8": { + "brkout_mode": "4x25G[10G]" + }, + + ...... + + "Ethernet116": { + "brkout_mode": "2x50G" + }, + "Ethernet120": { + "brkout_mode": "2x50G" + }, + "Ethernet124": { + "brkout_mode": "2x50G" + } +} +``` + +### AAA + +The AAA table defined the method SONiC used for Authentication, Authorization and Accounting. +The method could be: +- default +- local +- tacacs+ +- radius + +``` +"AAA": { + "authentication": { + "login": "local" + }, + "authorization": { + "login": "local" + }, + "accounting": { + "login": "local" + } +} +``` + +### SYSTEM_DEFAULTS table +To have a better management of the features in SONiC, a new table `SYSTEM_DEFAULTS` is introduced. + +``` +"SYSTEM_DEFAULTS": { + "tunnel_qos_remap": { + "status": "enabled" + } + "default_bgp_status": { + "status": "down" + } + "synchronous_mode": { + "status": "enable" + } + "dhcp_server": { + "status": "enable" + } + } +``` +The default value of flags in `SYSTEM_DEFAULTS` table can be set in `init_cfg.json` and loaded into db at system startup. These flags are usually set at image being build, and are unlikely to change at runtime. + +If the values in `config_db.json` is changed by user, it will not be rewritten back by `init_cfg.json` as `config_db.json` is loaded after `init_cfg.json` in [docker_image_ctl.j2](https://github.com/Azure/sonic-buildimage/blob/master/files/build_templates/docker_image_ctl.j2) + +For the flags that can be changed by reconfiguration, we can update entries in `minigraph.xml`, and parse the new values in to config_db with minigraph parser at reloading minigraph. If there are duplicated entries in `init_cfg.json` and `minigraph.xml`, the values in `minigraph.xml` will overwritten the values defined in `init_cfg.json`. + +### RADIUS + +The RADIUS and RADIUS_SERVER tables define RADIUS configuration parameters. RADIUS table carries global configuration while RADIUS_SERVER table carries per server configuration. + +``` + "RADIUS": { + "global": { + "auth_type": "pap", + "timeout": "5" + } + } + + "RADIUS_SERVER": { + "192.168.1.2": { + "priority": "4", + "retransmit": "2", + "timeout": "5" + } + } +``` + +#### 5.2.3 Update value directly in db memory + +For Developers +============== + +Generating Application Config by Jinja2 Template +------------------------------------------------ + +To be added. + +Incremental Configuration by Subscribing to ConfigDB +---------------------------------------------------- + +Detail instruction to be added. A sample could be found in this +[PR](https://github.com/Azure/sonic-buildimage/pull/861) that +implemented dynamic configuration for BGP. From 8f8303ab2949e71e53888e129da2b6f67eb1c31b Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Thu, 9 Feb 2023 05:59:45 -0800 Subject: [PATCH 110/113] [submodule] Advance sonic-swss pointer (#13720) Update sonic-swss submodule pointer to include the following: * 44ea6a0 [sai_failure_dump]Invoking dump during SAI failure ([#2644](https://github.com/Azure/sonic-swss/pull/2644)) * 065a471 [hash]: Add UT infra. ([#2660](https://github.com/Azure/sonic-swss/pull/2660)) * 9597eb7 [autoneg]Fixing adv interface types to be set when AN is disabled ([#2638](https://github.com/Azure/sonic-swss/pull/2638)) Signed-off-by: dgsudharsan --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 7d223d37a535..44ea6a08659a 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 7d223d37a5359433ee301bc7a9fd87d9c64622d5 +Subproject commit 44ea6a08659a11723173c5272b0400882cf11347 From 4fc991e84e6f0991d44efc29db84d37a7f3796d8 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Thu, 9 Feb 2023 07:47:19 -0800 Subject: [PATCH 111/113] [submodule] Advance sonic-utilities pointer (#13721) Update sonic-utilities submodule pointer to include the following: * 5007f1f0 [show] add support for gRPC show commands for ([#2629](https://github.com/Azure/sonic-utilities/pull/2629)) * 6e0e1daf [sai_failure_dump]Invoking dump during SAI failure ([#2633](https://github.com/Azure/sonic-utilities/pull/2633)) Signed-off-by: dgsudharsan --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index f9130d1cc3e3..5007f1f0424d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit f9130d1cc3e376667335919a9c6c95218412d04c +Subproject commit 5007f1f0424d517f2f852bba790553535697db42 From 842789745f3fa5bf27b0f4d1399f40bef133d861 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Thu, 9 Feb 2023 18:22:28 +0200 Subject: [PATCH 112/113] Revert "Revert "05.Version cache - docker dpkg caching support (#12005)"" This reverts commit 4be080539503a66d0085ea0b8943c3c4e568fd89. --- Makefile.work | 22 ++- build_debian.sh | 13 +- platform/broadcom/sai.mk | 5 + rules/config | 9 + scripts/build_debian_base_system.sh | 2 + scripts/collect_build_version_files.sh | 7 + scripts/collect_docker_version_files.sh | 66 +++++++- scripts/collect_host_image_version_files.sh | 15 +- scripts/generate_buildinfo_config.sh | 7 +- scripts/prepare_debian_image_buildinfo.sh | 10 +- scripts/prepare_docker_buildinfo.sh | 99 ++++++++++- scripts/prepare_slave_container_buildinfo.sh | 15 +- scripts/versions_manager.py | 158 +++++++++++++++--- slave.mk | 59 +++++-- src/sonic-build-hooks/Makefile | 2 +- .../scripts/buildinfo_base.sh | 45 ++++- .../scripts/collect_version_files | 15 +- .../scripts/post_run_buildinfo | 20 ++- .../scripts/post_run_cleanup | 40 +++++ .../scripts/pre_run_buildinfo | 16 ++ src/sonic-build-hooks/scripts/utils.sh | 37 ++++ 21 files changed, 586 insertions(+), 76 deletions(-) create mode 100755 src/sonic-build-hooks/scripts/post_run_cleanup create mode 100644 src/sonic-build-hooks/scripts/utils.sh diff --git a/Makefile.work b/Makefile.work index 648461f01784..608bf672b4d9 100644 --- a/Makefile.work +++ b/Makefile.work @@ -182,11 +182,22 @@ ifeq ($(ENABLE_FIPS), y) endif endif +SONIC_VERSION_CACHE := $(filter-out none,$(SONIC_VERSION_CACHE_METHOD)) +SONIC_OVERRIDE_BUILD_VARS += SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) +SONIC_OVERRIDE_BUILD_VARS += SONIC_VERSION_CACHE_SOURCE=$(SONIC_VERSION_CACHE_SOURCE) +export SONIC_VERSION_CACHE SONIC_VERSION_CACHE_SOURCE +$(shell test -d $(SONIC_VERSION_CACHE_SOURCE) || \ + mkdir -p $(SONIC_VERSION_CACHE_SOURCE) && chmod -f 777 $(SONIC_VERSION_CACHE_SOURCE) 2>/dev/null ) + # Generate the version control build info $(shell \ SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) \ PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ + DISTRO=$(BLDENV) \ + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + SONIC_VERSION_CACHE_SOURCE=$(SONIC_VERSION_CACHE_SOURCE) \ + DBGOPT='$(DBGOPT)' \ scripts/generate_buildinfo_config.sh) # Generate the slave Dockerfile, and prepare build info for it @@ -206,6 +217,8 @@ $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) \ PREPARE_DOCKER=BUILD_SLAVE=y \ DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + DBGOPT='$(DBGOPT)' \ scripts/prepare_docker_buildinfo.sh \ $(SLAVE_BASE_IMAGE) \ $(SLAVE_DIR)/Dockerfile \ @@ -228,12 +241,13 @@ SLAVE_TAG = $(shell \ (cat $(SLAVE_DIR)/Dockerfile.user \ $(SLAVE_DIR)/Dockerfile \ $(SLAVE_DIR)/buildinfo/versions/versions-* \ - .git/HEAD \ && echo $(USER)/$(PWD)/$(CONFIGURED_PLATFORM)) \ | sha1sum \ | awk '{print substr($$1,0,11);}') COLLECT_DOCKER=DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + DBGOPT='$(DBGOPT)' \ scripts/collect_docker_version_files.sh \ $(SLAVE_BASE_IMAGE) \ target \ @@ -294,6 +308,10 @@ ifneq ($(SONIC_DPKG_CACHE_SOURCE),) DOCKER_RUN += -v "$(SONIC_DPKG_CACHE_SOURCE):/dpkg_cache:rw" endif +ifneq ($(SONIC_VERSION_CACHE_SOURCE),) + DOCKER_RUN += -v "$(SONIC_VERSION_CACHE_SOURCE):/vcache:rw" +endif + ifeq ($(SONIC_ENABLE_SECUREBOOT_SIGNATURE), y) ifneq ($(SIGNING_KEY),) DOCKER_SIGNING_SOURCE := $(shell dirname $(SIGNING_KEY)) @@ -387,6 +405,8 @@ DOCKER_SLAVE_BASE_BUILD = docker build --no-cache \ --build-arg http_proxy=$(http_proxy) \ --build-arg https_proxy=$(https_proxy) \ --build-arg no_proxy=$(no_proxy) \ + --build-arg SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + --build-arg SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ $(SLAVE_DIR) \ $(SPLIT_LOG) $(DOCKER_BASE_LOG) diff --git a/build_debian.sh b/build_debian.sh index 338e75ae6fa2..0821d86486ce 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -81,7 +81,10 @@ echo '[INFO] Build host debian base system...' TARGET_PATH=$TARGET_PATH scripts/build_debian_base_system.sh $CONFIGURED_ARCH $IMAGE_DISTRO $FILESYSTEM_ROOT # Prepare buildinfo -sudo scripts/prepare_debian_image_buildinfo.sh $CONFIGURED_ARCH $IMAGE_DISTRO $FILESYSTEM_ROOT $http_proxy +sudo SONIC_VERSION_CACHE=${SONIC_VERSION_CACHE} \ + DBGOPT="${DBGOPT}" \ + scripts/prepare_debian_image_buildinfo.sh $CONFIGURED_ARCH $IMAGE_DISTRO $FILESYSTEM_ROOT $http_proxy + sudo chown root:root $FILESYSTEM_ROOT @@ -450,10 +453,10 @@ if [[ $TARGET_BOOTLOADER == grub ]]; then GRUB_PKG=grub-efi-arm64-bin fi - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get install -d -o dir::cache=/var/cache/apt \ $GRUB_PKG - sudo mv $FILESYSTEM_ROOT/grub*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/grub + sudo cp $FILESYSTEM_ROOT/var/cache/apt/archives/grub*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/grub fi ## Disable kexec supported reboot which was installed by default @@ -645,7 +648,9 @@ if [[ $TARGET_BOOTLOADER == uboot ]]; then fi # Collect host image version files before cleanup -scripts/collect_host_image_version_files.sh $TARGET_PATH $FILESYSTEM_ROOT +SONIC_VERSION_CACHE=${SONIC_VERSION_CACHE} \ + DBGOPT="${DBGOPT}" \ + scripts/collect_host_image_version_files.sh $CONFIGURED_ARCH $IMAGE_DISTRO $TARGET_PATH $FILESYSTEM_ROOT # Remove GCC sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 47086eea9986..490ffe1d6425 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -17,4 +17,9 @@ $(BRCM_DNX_SAI)_URL = "$(LIBSAIBCM_DNX_URL_PREFIX)/$(BRCM_DNX_SAI)" SONIC_ONLINE_DEBS += $(BRCM_XGS_SAI) SONIC_ONLINE_DEBS += $(BRCM_DNX_SAI) $(BRCM_XGS_SAI_DEV)_DEPENDS += $(BRCM_XGS_SAI) + +$(BRCM_XGS_SAI)_SKIP_VERSION=y +$(BRCM_XGS_SAI_DEV)_SKIP_VERSION=y +$(BRCM_DNX_SAI)_SKIP_VERSION=y + $(eval $(call add_conflict_package,$(BRCM_XGS_SAI_DEV),$(LIBSAIVS_DEV))) diff --git a/rules/config b/rules/config index 96ae8685c1f8..aa3d885da7e5 100644 --- a/rules/config +++ b/rules/config @@ -241,6 +241,15 @@ TRUSTED_GPG_URLS = https://packages.trafficmanager.net/debian/public_key.gpg,htt # docker: docker base images SONIC_VERSION_CONTROL_COMPONENTS ?= none +# SONIC_VERSION_CACHE allows the .deb,.py, wget, git, docker and go files to be stored in the cache path. This allows the submodules to +# cache standard installation package and restored back to avoid the package download every time. +# SONIC_VERSION_CACHE - Method of deb package caching +# none : no caching +# cache : Use cache if exists else build the source and update the cache +# SONIC_VERSION_CACHE_SOURCE - Defines the version cache location details +SONIC_VERSION_CACHE_METHOD ?= none +SONIC_VERSION_CACHE_SOURCE ?= $(SONIC_DPKG_CACHE_SOURCE)/vcache + # SONiC docker registry # # Set the env variable ENABLE_DOCKER_BASE_PULL = y to enable pulling sonic-slave docker from registry diff --git a/scripts/build_debian_base_system.sh b/scripts/build_debian_base_system.sh index 1532befdbe58..07f240812b07 100755 --- a/scripts/build_debian_base_system.sh +++ b/scripts/build_debian_base_system.sh @@ -1,5 +1,7 @@ #!/bin/bash +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x + CONFIGURED_ARCH=$1 IMAGE_DISTRO=$2 FILESYSTEM_ROOT=$3 diff --git a/scripts/collect_build_version_files.sh b/scripts/collect_build_version_files.sh index e35ca0590334..88e0bad8b24e 100755 --- a/scripts/collect_build_version_files.sh +++ b/scripts/collect_build_version_files.sh @@ -1,5 +1,7 @@ #!/bin/bash +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x + RET=$1 BLDENV=$2 TARGET_PATH=$3 @@ -15,12 +17,17 @@ TIMESTAMP=$(date +"%Y%m%d%H%M%S") VERSION_BUILD_PATH=$TARGET_PATH/versions/build VERSION_SLAVE_PATH=$VERSION_BUILD_PATH/build-sonic-slave-${BLDENV} LOG_VERSION_PATH=$VERSION_BUILD_PATH/log-${TIMESTAMP} +DEFAULT_VERSION_PATH=files/build/versions/default +BUILD_LOG_PATH=/sonic/target/versions/log/sonic-slave-${BLDENV}/ sudo chmod -R a+rw $BUILDINFO_PATH collect_version_files $LOG_VERSION_PATH ([ -d $BUILD_VERSION_PATH ] && [ ! -z "$(ls $BUILD_VERSION_PATH/)" ]) && cp -rf $BUILD_VERSION_PATH/* $LOG_VERSION_PATH/ mkdir -p $VERSION_SLAVE_PATH +mkdir -p ${BUILD_LOG_PATH} +([ -d ${LOG_PATH} ] && [ ! -z "$(ls ${LOG_PATH})" ]) && cp ${LOG_PATH}/* ${BUILD_LOG_PATH} + scripts/versions_manager.py merge -t $VERSION_SLAVE_PATH -b $LOG_VERSION_PATH -e $POST_VERSION_PATH [ -d $BUILD_VERSION_PATH ] && rm -rf $BUILD_VERSION_PATH/* diff --git a/scripts/collect_docker_version_files.sh b/scripts/collect_docker_version_files.sh index 1f5cc544972c..2452a4fd09cc 100755 --- a/scripts/collect_docker_version_files.sh +++ b/scripts/collect_docker_version_files.sh @@ -1,6 +1,16 @@ #!/bin/bash -set -x +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x + +BUILDINFO_BASE=/usr/local/share/buildinfo + +SCRIPT_SRC_PATH=src/sonic-build-hooks +if [ -e ${SCRIPT_SRC_PATH} ]; then + . ${SCRIPT_SRC_PATH}/scripts/utils.sh +else + . ${BUILDINFO_BASE}/scripts/utils.sh +fi + DOCKER_IMAGE=$1 TARGET_PATH=$2 DOCKER_IMAGE_TAG=$3 @@ -13,6 +23,8 @@ DOCKER_IMAGE_NAME=$(echo $DOCKER_IMAGE | cut -d: -f1 | sed "s/-$DOCKER_USERNAME\ #Create the container specific to the user tag and slave tag DOCKER_CONTAINER=${DOCKER_IMAGE_TAG/:/-} TARGET_VERSIONS_PATH=$TARGET_PATH/versions/dockers/$DOCKER_IMAGE_NAME +BUILD_LOG_PATH=target/versions/log/$DOCKER_IMAGE_NAME +mkdir -p ${BUILD_LOG_PATH} [ -d $TARGET_VERSIONS_PATH ] && rm -rf $TARGET_VERSIONS_PATH mkdir -p $TARGET_VERSIONS_PATH @@ -34,5 +46,57 @@ docker tag ${DOCKER_IMAGE_TAG} tmp-${DOCKER_IMAGE_TAG} DOCKER_BUILDKIT=1 docker build -f ${DOCKER_PATH}/Dockerfile.cleanup --target output -o target/vcache/${DOCKER_IMAGE_NAME} ${DOCKER_PATH} DOCKER_BUILDKIT=1 docker build -f ${DOCKER_PATH}/Dockerfile.cleanup --no-cache --target final --tag ${DOCKER_IMAGE_TAG} ${DOCKER_PATH} docker rmi tmp-${DOCKER_IMAGE_TAG} +docker cp -L $DOCKER_CONTAINER:/usr/local/share/buildinfo/log ${BUILD_LOG_PATH}/ + + +# Save the cache contents from docker build +LOCAL_CACHE_FILE=target/vcache/${DOCKER_IMAGE_NAME}/cache.tgz +CACHE_ENCODE_FILE=${DOCKER_PATH}/vcache/cache.base64 +sleep 1; sync ${CACHE_ENCODE_FILE} + +# Decode the cache content into gz format +SRC_VERSION_PATH=files/build/versions +if [[ -e ${CACHE_ENCODE_FILE} ]]; then + + cat ${CACHE_ENCODE_FILE} | base64 -d >${LOCAL_CACHE_FILE} + rm -f ${CACHE_ENCODE_FILE} +fi + +# Version package cache +IMAGE_DBGS_NAME=${DOCKER_IMAGE_NAME//-/_}_image_dbgs +if [[ ${DOCKER_IMAGE_NAME} == sonic-slave-* ]]; then + GLOBAL_CACHE_DIR=${SONIC_VERSION_CACHE_SOURCE}/${DOCKER_IMAGE_NAME} +else + GLOBAL_CACHE_DIR=/vcache/${DOCKER_IMAGE_NAME} +fi + +if [[ ! -z ${SONIC_VERSION_CACHE} && -e ${CACHE_ENCODE_FILE} ]]; then + + # Select version files for SHA calculation + VERSION_FILES="${SRC_VERSION_PATH}/dockers/${DOCKER_IMAGE_NAME}/versions-*-${DISTRO}-${ARCH} ${SRC_VERSION_PATH}/default/versions-*" + DEP_FILES="${DOCKER_PATH}/Dockerfile.j2" + if [[ ${DOCKER_IMAGE_NAME} =~ '-dbg' ]]; then + DEP_FILES="${DEP_FILES} build_debug_docker_j2.sh" + fi + + # Calculate the version SHA + VERSION_SHA="$( (echo -n "${!IMAGE_DBGS_NAME}"; cat ${DEP_FILES} ${VERSION_FILES}) | sha1sum | awk '{print substr($1,0,23);}')" + GLOBAL_CACHE_FILE=${GLOBAL_CACHE_DIR}/${DOCKER_IMAGE_NAME}-${VERSION_SHA}.tgz + + GIT_FILE_STATUS=$(git status -s ${DEP_FILES}) + + # If the cache file is not exists in the global cache for the given SHA, + # store the new cache file into version cache path. + if [ -f ${LOCAL_CACHE_FILE} ]; then + if [[ -z ${GIT_FILE_STATUS} && ! -e ${GLOBAL_CACHE_FILE} ]]; then + mkdir -p ${GLOBAL_CACHE_DIR} + chmod -f 777 ${GLOBAL_CACHE_DIR} + FLOCK ${GLOBAL_CACHE_FILE} + cp ${LOCAL_CACHE_FILE} ${GLOBAL_CACHE_FILE} + chmod -f 777 ${LOCAL_CACHE_FILE} ${GLOBAL_CACHE_FILE} + FUNLOCK ${GLOBAL_CACHE_FILE} + fi + fi +fi docker container rm $DOCKER_CONTAINER diff --git a/scripts/collect_host_image_version_files.sh b/scripts/collect_host_image_version_files.sh index d0d7aabcf9d2..24cb3a994131 100755 --- a/scripts/collect_host_image_version_files.sh +++ b/scripts/collect_host_image_version_files.sh @@ -1,7 +1,16 @@ #!/bin/bash -TARGET=$1 -FILESYSTEM_ROOT=$2 +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x + +SCRIPT_SRC_PATH=src/sonic-build-hooks +if [ -e ${SCRIPT_SRC_PATH} ]; then + . ${SCRIPT_SRC_PATH}/scripts/utils.sh +fi + +ARCH=$1 +DISTRO=$2 +TARGET=$3 +FILESYSTEM_ROOT=$4 VERSIONS_PATH=$TARGET/versions/host-image IMAGENAME="host-image" @@ -13,3 +22,5 @@ sudo LANG=C chroot $FILESYSTEM_ROOT post_run_buildinfo ${IMAGENAME} cp -r $FILESYSTEM_ROOT/usr/local/share/buildinfo/pre-versions $VERSIONS_PATH/ cp -r $FILESYSTEM_ROOT/usr/local/share/buildinfo/post-versions $VERSIONS_PATH/ + +sudo LANG=C chroot $FILESYSTEM_ROOT post_run_cleanup ${IMAGENAME} diff --git a/scripts/generate_buildinfo_config.sh b/scripts/generate_buildinfo_config.sh index fe7657a6b6c9..b0ec54924246 100755 --- a/scripts/generate_buildinfo_config.sh +++ b/scripts/generate_buildinfo_config.sh @@ -6,5 +6,8 @@ BUILDINFO_CONFIG=$BUILDINFO_PATH/buildinfo/config/buildinfo.config mkdir -p $BUILDINFO_PATH/buildinfo/config -echo "PACKAGE_URL_PREFIX=$PACKAGE_URL_PREFIX" > $BUILDINFO_CONFIG -echo "SONIC_VERSION_CONTROL_COMPONENTS=$SONIC_VERSION_CONTROL_COMPONENTS" >> $BUILDINFO_CONFIG +echo "export PACKAGE_URL_PREFIX=$PACKAGE_URL_PREFIX" > $BUILDINFO_CONFIG +echo "export SONIC_VERSION_CONTROL_COMPONENTS=$SONIC_VERSION_CONTROL_COMPONENTS" >> $BUILDINFO_CONFIG +echo "export SONIC_VERSION_CACHE=${SONIC_VERSION_CACHE}" >> $BUILDINFO_CONFIG +echo "export SONIC_VERSION_CACHE_SOURCE=${SONIC_VERSION_CACHE_SOURCE}" >> $BUILDINFO_CONFIG +echo "export DISTRO=${DISTRO}" >> $BUILDINFO_CONFIG diff --git a/scripts/prepare_debian_image_buildinfo.sh b/scripts/prepare_debian_image_buildinfo.sh index 912e0de0b25f..0617bdf37ce6 100755 --- a/scripts/prepare_debian_image_buildinfo.sh +++ b/scripts/prepare_debian_image_buildinfo.sh @@ -1,9 +1,13 @@ #!/bin/bash +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x + ARCH=$1 DISTRO=$2 FILESYSTEM_ROOT=$3 +HOST_IMAGE_NAME=host-image +IMAGENAME=${HOST_IMAGE_NAME} . /usr/local/share/buildinfo/scripts/buildinfo_base.sh VERSION_DEB_PREFERENCE="01-versions-deb" @@ -26,4 +30,8 @@ if [ "$ENABLE_VERSION_CONTROL_DEB" == "y" ]; then fi sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "dpkg -i /usr/local/share/buildinfo/sonic-build-hooks_1.0_all.deb" -sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "pre_run_buildinfo" +#sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "pre_run_buildinfo" +sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo export DISTRO=${DISTRO} >> /usr/local/share/buildinfo/config/buildinfo.config" +sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo export IMAGENAME=${IMAGENAME} >> /usr/local/share/buildinfo/config/buildinfo.config" + +sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "pre_run_buildinfo ${HOST_IMAGE_NAME}" diff --git a/scripts/prepare_docker_buildinfo.sh b/scripts/prepare_docker_buildinfo.sh index 26dc7713ccd5..23e664affa15 100755 --- a/scripts/prepare_docker_buildinfo.sh +++ b/scripts/prepare_docker_buildinfo.sh @@ -1,14 +1,26 @@ #!/bin/bash +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x + +BUILDINFO_BASE=/usr/local/share/buildinfo + +SCRIPT_SRC_PATH=src/sonic-build-hooks +if [ -e ${SCRIPT_SRC_PATH} ]; then + . ${SCRIPT_SRC_PATH}/scripts/utils.sh +else + . ${BUILDINFO_BASE}/scripts/utils.sh +fi + IMAGENAME=$1 DOCKERFILE=$2 ARCH=$3 -DOCKERFILE_TARGE=$4 +DOCKERFILE_TARGET=$4 DISTRO=$5 + [ -z "$BUILD_SLAVE" ] && BUILD_SLAVE=n -[ -z "$DOCKERFILE_TARGE" ] && DOCKERFILE_TARGE=$DOCKERFILE -DOCKERFILE_PATH=$(dirname "$DOCKERFILE_TARGE") +[ -z "$DOCKERFILE_TARGET" ] && DOCKERFILE_TARGET=$DOCKERFILE +DOCKERFILE_PATH=$(dirname "$DOCKERFILE_TARGET") BUILDINFO_PATH="${DOCKERFILE_PATH}/buildinfo" BUILDINFO_VERSION_PATH="${BUILDINFO_PATH}/versions" DOCKER_PATH=$(dirname $DOCKERFILE) @@ -34,15 +46,18 @@ fi scripts/docker_version_control.sh $@ DOCKERFILE_PRE_SCRIPT='# Auto-Generated for buildinfo +ARG SONIC_VERSION_CACHE +ARG SONIC_VERSION_CONTROL_COMPONENTS COPY ["buildinfo", "/usr/local/share/buildinfo"] COPY vcache/ /sonic/target/vcache/'${IMAGENAME}' RUN dpkg -i /usr/local/share/buildinfo/sonic-build-hooks_1.0_all.deb ENV IMAGENAME='${IMAGENAME}' +ENV DISTRO='${DISTRO}' RUN pre_run_buildinfo '${IMAGENAME}' ' # Add the auto-generate code if it is not added in the target Dockerfile -if [ ! -f $DOCKERFILE_TARGE ] || ! grep -q "Auto-Generated for buildinfo" $DOCKERFILE_TARGE; then +if [ ! -f $DOCKERFILE_TARGET ] || ! grep -q "Auto-Generated for buildinfo" $DOCKERFILE_TARGET; then # Insert the docker build script before the RUN command LINE_NUMBER=$(grep -Fn -m 1 'RUN' $DOCKERFILE | cut -d: -f1) TEMP_FILE=$(mktemp) @@ -50,12 +65,14 @@ if [ ! -f $DOCKERFILE_TARGE ] || ! grep -q "Auto-Generated for buildinfo" $DOCKE # Append the docker build script at the end of the docker file echo -e "\nRUN post_run_buildinfo ${IMAGENAME} " >> $TEMP_FILE + echo -e "\nRUN post_run_cleanup ${IMAGENAME} " >> $TEMP_FILE - cat $TEMP_FILE > $DOCKERFILE_TARGE + cat $TEMP_FILE > $DOCKERFILE_TARGET rm -f $TEMP_FILE fi # Copy the build info config +mkdir -p ${BUILDINFO_PATH} cp -rf src/sonic-build-hooks/buildinfo/* $BUILDINFO_PATH # Generate the version lock files @@ -67,3 +84,75 @@ touch $BUILDINFO_VERSION_PATH/versions-deb LOCAL_CACHE_DIR=target/vcache/${IMAGENAME} mkdir -p ${LOCAL_CACHE_DIR} ${DOCKER_PATH}/vcache/ chmod -f 777 ${LOCAL_CACHE_DIR} ${DOCKER_PATH}/vcache/ + +if [[ "$SKIP_BUILD_HOOK" == y || ${ENABLE_VERSION_CONTROL_DOCKER} != y ]]; then + exit 0 +fi + +# Version cache +DOCKER_IMAGE_NAME=${IMAGENAME} +IMAGE_DBGS_NAME=${DOCKER_IMAGE_NAME//-/_}_image_dbgs + +if [[ ${DOCKER_IMAGE_NAME} == sonic-slave-* ]]; then + GLOBAL_CACHE_DIR=${SONIC_VERSION_CACHE_SOURCE}/${DOCKER_IMAGE_NAME} +else + GLOBAL_CACHE_DIR=/vcache/${DOCKER_IMAGE_NAME} +fi + +SRC_VERSION_PATH=files/build/versions +if [ ! -z ${SONIC_VERSION_CACHE} ]; then + + # Version files for SHA calculation + VERSION_FILES="${SRC_VERSION_PATH}/dockers/${DOCKER_IMAGE_NAME}/versions-*-${DISTRO}-${ARCH} ${SRC_VERSION_PATH}/default/versions-*" + DEP_FILES="Dockerfile.j2" + if [[ ${DOCKER_IMAGE_NAME} =~ '-dbg' ]]; then + DEP_DBG_FILES="build_debug_docker_j2.sh" + fi + + #Calculate the version SHA + VERSION_SHA="$( (echo -n "${!IMAGE_DBGS_NAME}"; \ + (cd ${DOCKER_PATH}; cat ${DEP_FILES}); \ + cat ${DEP_DBG_FILES} ${VERSION_FILES}) \ + | sha1sum | awk '{print substr($1,0,23);}')" + + GLOBAL_CACHE_FILE=${GLOBAL_CACHE_DIR}/${DOCKER_IMAGE_NAME}-${VERSION_SHA}.tgz + LOCAL_CACHE_FILE=${LOCAL_CACHE_DIR}/cache.tgz + GIT_FILE_STATUS=$(git status -s ${DEP_FILES}) + + # Create the empty cache tar file as local cache + if [[ ! -f ${LOCAL_CACHE_FILE} ]]; then + tar -zcf ${LOCAL_CACHE_FILE} -T /dev/null + chmod -f 777 ${LOCAL_CACHE_FILE} + fi + + # Global cache file exists, load from global cache. + if [[ -e ${GLOBAL_CACHE_FILE} ]]; then + cp ${GLOBAL_CACHE_FILE} ${LOCAL_CACHE_FILE} + touch ${GLOBAL_CACHE_FILE} + else + # When file is modified, Global SHA is calculated with the local change. + # Load from the previous version of build cache if exists + VERSIONS=( "HEAD" "HEAD~1" "HEAD~2" ) + for VERSION in ${VERSIONS[@]}; do + VERSION_PREV_SHA="$( (echo -n "${!IMAGE_DBGS_NAME}"; \ + (cd ${DOCKER_PATH}; git --no-pager show $(ls -f ${DEP_FILES}|sed 's|.*|'${VERSION}':./&|g')); \ + (git --no-pager show $(ls -f ${DEP_DBG_FILES} ${VERSION_FILES}|sed 's|.*|'${VERSION}':&|g'))) \ + | sha1sum | awk '{print substr($1,0,23);}')" + GLOBAL_PREV_CACHE_FILE=${GLOBAL_CACHE_DIR}/${DOCKER_IMAGE_NAME}-${VERSION_PREV_SHA}.tgz + if [[ -e ${GLOBAL_PREV_CACHE_FILE} ]]; then + cp ${GLOBAL_PREV_CACHE_FILE} ${LOCAL_CACHE_FILE} + touch ${GLOBAL_PREV_CACHE_FILE} + break + fi + done + fi + + rm -f ${DOCKER_PATH}/vcache/cache.tgz + ln -f ${LOCAL_CACHE_FILE} ${DOCKER_PATH}/vcache/cache.tgz + + +else + # Delete the cache file if version cache is disabled. + rm -f ${DOCKER_PATH}/vcache/cache.tgz +fi + diff --git a/scripts/prepare_slave_container_buildinfo.sh b/scripts/prepare_slave_container_buildinfo.sh index 1fb2f006640b..9632566b632a 100755 --- a/scripts/prepare_slave_container_buildinfo.sh +++ b/scripts/prepare_slave_container_buildinfo.sh @@ -1,14 +1,19 @@ #!/bin/bash +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x + SLAVE_DIR=$1 ARCH=$2 DISTRO=$3 # Install the latest debian package sonic-build-hooks in the slave container -sudo dpkg -i --force-overwrite $SLAVE_DIR/buildinfo/sonic-build-hooks_*.deb > /dev/null +sudo dpkg -i --force-overwrite $SLAVE_DIR/buildinfo/sonic-build-hooks_*.deb &> /dev/null # Enable the build hooks -symlink_build_hooks +sudo symlink_build_hooks + +# set the global permissions +sudo chmod -f 777 /usr/local/share/buildinfo/ -R # Build the slave running config cp -rf $SLAVE_DIR/buildinfo/* /usr/local/share/buildinfo/ @@ -21,8 +26,8 @@ apt-get update > /dev/null 2>&1 # Build the slave version config [ -d /usr/local/share/buildinfo/versions ] && rm -rf /usr/local/share/buildinfo/versions scripts/versions_manager.py generate -t "/usr/local/share/buildinfo/versions" -n "build-${SLAVE_DIR}" -d "$DISTRO" -a "$ARCH" -touch ${BUILDINFO_PATH}/versions/versions-deb +touch ${BUILDINFO_PATH}/versions/versions-deb ${BUILDINFO_PATH}/versions/versions-web -rm -f /etc/apt/preferences.d/01-versions-deb -([ "$ENABLE_VERSION_CONTROL_DEB" == "y" ] && [ -f $VERSION_DEB_PREFERENCE ]) && cp -f $VERSION_DEB_PREFERENCE /etc/apt/preferences.d/ +sudo rm -f /etc/apt/preferences.d/01-versions-deb +([ "$ENABLE_VERSION_CONTROL_DEB" == "y" ] && [ -f $VERSION_DEB_PREFERENCE ]) && sudo cp -f $VERSION_DEB_PREFERENCE /etc/apt/preferences.d/ exit 0 diff --git a/scripts/versions_manager.py b/scripts/versions_manager.py index a20684e97bb4..27b757721f25 100755 --- a/scripts/versions_manager.py +++ b/scripts/versions_manager.py @@ -4,6 +4,7 @@ import glob import os import sys +import re ALL_DIST = 'all' ALL_ARCH = 'all' @@ -24,7 +25,7 @@ class Component: arch -- Architectrue, such as amd64, arm64, etc ''' - def __init__(self, versions, ctype, dist=ALL_DIST, arch=ALL_ARCH): + def __init__(self, verbose=None, versions={}, ctype="deb", dist=ALL_DIST, arch=ALL_ARCH): self.versions = versions self.ctype = ctype if not dist: @@ -33,6 +34,7 @@ def __init__(self, versions, ctype, dist=ALL_DIST, arch=ALL_ARCH): arch = ALL_ARCH self.dist = dist self.arch = arch + self.verbose = verbose @classmethod def get_versions(cls, version_file): @@ -51,7 +53,7 @@ def get_versions(cls, version_file): return result def clone(self): - return Component(self.versions.copy(), self.ctype, self.dist, self.arch) + return Component(self.verbose, self.versions.copy(), self.ctype, self.dist, self.arch) def merge(self, versions, overwritten=True): for package in versions: @@ -71,7 +73,7 @@ def dump(self, config=False, priority=999): result.append(lines) else: result.append('{0}=={1}'.format(package, self.versions[package])) - return "\n".join(result) + return "\n".join(result)+'\n' def dump_to_file(self, version_file, config=False, priority=999): if len(self.versions) <= 0: @@ -92,6 +94,35 @@ def dump_to_path(self, file_path, config=False, priority=999): file_path = os.path.join(file_path, filename) self.dump_to_file(file_path, config, priority) + def print(self, file_path): + if len(self.versions) <= 0: + return + + if self.verbose is None: + return + + filename = self.get_filename() + file_path = os.path.join(file_path, filename) + if self.verbose and re.search("cfile=", self.verbose) \ + and not re.search(self.verbose, "cfile=all".format(filename)) \ + and not re.search(self.verbose, "cfile={}".format(filename)): + return + print("VERSION : {}".format(file_path)) + for package in sorted(self.versions.keys(), key=str.casefold): + if self.verbose and re.search("ctype=", self.verbose) \ + and not re.search("ctype=all".format(self.ctype), self.verbose) \ + and not re.search("ctype={}".format(self.ctype), self.verbose): + continue + if self.verbose and re.search("cname=", self.verbose) \ + and not re.search(self.verbose, "cname=all".format(package)) \ + and not re.search(self.verbose, "cname={}".format(package)): + continue + if self.verbose and re.search("cver=", self.verbose) \ + and not re.search(self.verbose, "cver=all".format(self.versions[package])) \ + and not re.search(self.verbose, "cver={}".format(self.versions[package])): + continue + print('{0}=={1}'.format(package, self.versions[package])) + # Check if the self component can be overwritten by the input component def check_overwritable(self, component, for_all_dist=False, for_all_arch=False): if self.ctype != component.ctype: @@ -153,9 +184,11 @@ class VersionModule: name -- The name of the image, such as sonic-slave-buster, docker-lldp, etc ''' - def __init__(self, name=None, components=None): + def __init__(self, verbose=None, name=None, components=None): self.name = name self.components = components + self.module_path="" + self.verbose=verbose # Overwrite the docker/host image/base image versions def overwrite(self, module, for_all_dist=False, for_all_arch=False): @@ -191,6 +224,7 @@ def get_config_module(self, source_path, dist, arch): module = default_module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS) return self._get_config_module(module, dist, arch) + #Merge the default with specific version def _get_config_module(self, default_module, dist, arch): module = default_module.clone() default_ctype_components = module._get_components_per_ctypes() @@ -205,11 +239,11 @@ def _get_config_module(self, default_module, dist, arch): continue config_component = self._get_config_for_ctype(components, dist, arch) config_components.append(config_component) - config_module = VersionModule(self.name, config_components) + config_module = VersionModule(self.verbose, self.name, config_components) return config_module def _get_config_for_ctype(self, components, dist, arch): - result = Component({}, components[0].ctype, dist, arch) + result = Component(self.verbose, {}, components[0].ctype, dist, arch) for component in sorted(components, key = lambda x : x.get_order_keys()): if result.check_inheritable(component): result.merge(component.versions, True) @@ -224,7 +258,7 @@ def subtract(self, default_module): components = sorted(components, key = lambda x : x.get_order_keys()) for i in range(0, len(components)): component = components[i] - base_module = VersionModule(self.name, components[0:i]) + base_module = VersionModule(self.verbose, self.name, components[0:i]) config_module = base_module._get_config_module(default_module, component.dist, component.arch) config_components = config_module._get_components_by_ctype(ctype) if len(config_components) > 0: @@ -253,7 +287,7 @@ def _adjust_components_for_ctype(self, components): result = [] for i in range(0, len(components)): component = components[i] - inheritable_component = Component({}, component.ctype) + inheritable_component = Component(self.verbose, {}, component.ctype) for j in range(0, i): base_component = components[j] if component.check_inheritable(base_component): @@ -276,6 +310,7 @@ def load(self, image_path, filter_ctype=None, filter_dist=None, filter_arch=None file_paths = glob.glob(version_file_pattern) components = [] self.name = os.path.basename(image_path) + self.module_path = image_path self.components = components for file_path in file_paths: filename = os.path.basename(file_path) @@ -296,18 +331,25 @@ def load(self, image_path, filter_ctype=None, filter_dist=None, filter_arch=None if filter_arch and arch and filter_arch != arch and arch != ALL_ARCH: continue versions = Component.get_versions(file_path) - component = Component(versions, ctype, dist, arch) + component = Component(self.verbose, versions, ctype, dist, arch) components.append(component) + if self.verbose and re.search("stage=load", self.verbose): + component.print(file_path) def load_from_target(self, image_path): + self.module_path=image_path post_versions = os.path.join(image_path, 'post-versions') if os.path.exists(post_versions): self.load(post_versions) self.name = os.path.basename(image_path) + if self.verbose and re.search("stage=post", self.verbose): + self.print(post_versions) pre_versions = os.path.join(image_path, 'pre-versions') if os.path.exists(pre_versions): - pre_module = VersionModule() + pre_module = VersionModule(self.verbose) pre_module.load(pre_versions) + if self.verbose and re.search("stage=pre", self.verbose): + pre_module.print(pre_versions) self.subtract(pre_module) else: self.load(image_path) @@ -319,6 +361,15 @@ def dump(self, module_path, config=False, priority=999): for component in self.components: component.dump_to_path(module_path, config, priority) + def print(self, module_path): + if self.verbose is None: + return + if re.search("cmod=", self.verbose) \ + and not re.search(self.verbose, "cmod=all".format(self.name)) \ + and not re.search(self.verbose, "cmod={}".format(self.name)): + return + for component in self.components: + component.print(module_path) def filter(self, ctypes=[]): if 'all' in ctypes: return self @@ -340,7 +391,7 @@ def clone(self, ctypes=None, exclude_ctypes=None): if ctypes and component.ctype not in ctypes: continue components.append(component.clone()) - return VersionModule(self.name, components) + return VersionModule(self.verbose, self.name, components) def is_slave_module(self): return self.name.startswith('sonic-slave-') @@ -370,14 +421,18 @@ def get_module_path_by_name(cls, source_path, module_name): return os.path.join(source_path, 'files/build/versions/build', module_name) return os.path.join(source_path, 'files/build/versions/dockers', module_name) + def __repr__(self): + return repr(self.name) + class VersionBuild: ''' The VersionBuild consists of multiple version modules. ''' - def __init__(self, target_path="./target", source_path='.'): + def __init__(self, verbose=None, target_path="./target", source_path='.'): self.target_path = target_path self.source_path = source_path + self.verbose = verbose self.modules = {} def load_from_target(self): @@ -394,8 +449,11 @@ def load_from_target(self): for file_path in file_paths: if not os.path.isdir(file_path): continue - module = VersionModule() + module = VersionModule(self.verbose) module.load_from_target(file_path) + if self.verbose and re.search("stage=tmodname", self.verbose): + print("Target modname={}, path={}".format(module.name, file_path)) + module.print(file_path) modules[module.name] = module self._merge_dgb_modules() @@ -411,8 +469,11 @@ def load_from_source(self): modules = {} self.modules = modules for image_path in paths: - module = VersionModule() + module = VersionModule(self.verbose) module.load(image_path) + if self.verbose and re.search("stage=smodname", self.verbose): + print("Source modname={}, path={}".format(module.name, image_path)) + module.print(image_path) modules[module.name] = module def overwrite(self, build, for_all_dist=False, for_all_arch=False): @@ -430,6 +491,13 @@ def dump(self): module_path = self.get_module_path(module) module.dump(module_path) + def print(self, message=None): + if self.verbose is None: + return + if message is not None: + print("[============={}===========]".format(message)) + for module in [ self.modules[x] for x in (sorted(self.modules, key = lambda x : x)) ]: + module.print(module.module_path) def subtract(self, default_module): none_aggregatable_module = default_module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS) for module in self.modules.values(): @@ -455,20 +523,39 @@ def freeze(self, rebuild=False, for_all_dist=False, for_all_arch=False, ctypes=[ self.dump() return self.load_from_source() + if self.verbose and re.search("stage=init", self.verbose): + self.print("Initial Source") + default_module = self.modules.get(DEFAULT_MODULE, None) - target_build = VersionBuild(self.target_path, self.source_path) + if self.verbose and re.search("stage=init", self.verbose): + default_module.print("Default Module") + + target_build = VersionBuild(self.verbose, self.target_path, self.source_path) target_build.load_from_target() target_build.filter(ctypes=ctypes) + if self.verbose and re.search("stage=init", self.verbose): + target_build.print("Initial Target") + if not default_module: raise Exception("The default versions does not exist") - for module in target_build.modules.values(): + for module in [ target_build.modules[x] for x in (sorted(target_build.modules, key = lambda x : x)) ] : if module.is_individule_version(): continue tmp_module = module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS) default_module.overwrite(tmp_module, for_all_dist=True, for_all_arch=True) + if self.verbose and re.search("stage=tmp", self.verbose): + default_module.print("TMP DEFAULT MODULE") + target_build.subtract(default_module) + if self.verbose and re.search("stage=tmp", self.verbose): + target_build.print("After Subtract Target") + self.print("After Subtract Source") self.overwrite(target_build, for_all_dist=for_all_dist, for_all_arch=for_all_arch) - self.dump() + + if self.verbose and re.search("stage=add", self.verbose): + self.print("After Merge") + if not self.verbose or not re.search("dryrun", self.verbose): + self.dump() def filter(self, ctypes=[]): for module in self.modules.values(): @@ -485,14 +572,14 @@ def get_default_module(self): for dist in dists: versions = self._get_versions(ctype, dist) common_versions = self._get_common_versions(versions) - component = Component(common_versions, ctype, dist) + component = Component(self.verbose, common_versions, ctype, dist) components.append(component) else: versions = self._get_versions(ctype) common_versions = self._get_common_versions(versions) - component = Component(common_versions, ctype) + component = Component(self.verbose, common_versions, ctype) components.append(component) - return VersionModule(DEFAULT_MODULE, components) + return VersionModule(self.verbose, DEFAULT_MODULE, components) def get_aggregatable_modules(self): modules = {} @@ -619,11 +706,13 @@ def freeze(self): parser.add_argument('-d', '--for_all_dist', action='store_true', help='apply the versions for all distributions') parser.add_argument('-a', '--for_all_arch', action='store_true', help='apply the versions for all architectures') parser.add_argument('-c', '--ctypes', default='all', help='component types to freeze') + parser.add_argument('-v', '--verbose', default=None, help="verbose mode") args = parser.parse_args(sys.argv[2:]) ctypes = args.ctypes.split(',') if len(ctypes) == 0: ctypes = ['all'] - build = VersionBuild(target_path=args.target_path, source_path=args.source_path) + + build = VersionBuild(verbose=args.verbose, target_path=args.target_path, source_path=args.source_path) build.freeze(rebuild=args.rebuild, for_all_dist=args.for_all_dist, for_all_arch=args.for_all_arch, ctypes=ctypes) def merge(self): @@ -632,6 +721,8 @@ def merge(self): parser.add_argument('-m', '--module_path', default=None, help='merge path, use the target path if not specified') parser.add_argument('-b', '--base_path', required=True, help='base path, merge to the module path') parser.add_argument('-e', '--exclude_module_path', default=None, help='exclude module path') + parser.add_argument('-i', '--include_module_path', default=None, help='include module path') + parser.add_argument('-v', '--verbose', default=None, help="verbose mode") args = parser.parse_args(sys.argv[2:]) module_path = args.module_path if not module_path: @@ -640,15 +731,22 @@ def merge(self): print('The module path {0} does not exist'.format(module_path)) if not os.path.exists(args.target_path): os.makedirs(args.target_path) - module = VersionModule() + module = VersionModule(args.verbose) module.load(module_path) - base_module = VersionModule() + base_module = VersionModule(args.verbose) base_module.load(args.base_path) module.overwrite(base_module) if args.exclude_module_path: - exclude_module = VersionModule() + exclude_module = VersionModule(args.verbose) exclude_module.load(args.exclude_module_path) module.subtract(exclude_module) + if args.include_module_path: + include_module = VersionModule(args.verbose) + include_module.load(args.include_module_path) + if args.verbose: + include_module.print(args.include_module_path) + include_module.overwrite(module) + module.overwrite(include_module) module.dump(args.target_path) def generate(self): @@ -661,6 +759,7 @@ def generate(self): parser.add_argument('-d', '--distribution', required=True, help="distribution") parser.add_argument('-a', '--architecture', required=True, help="architecture") parser.add_argument('-p', '--priority', default=999, help="priority of the debian apt preference") + parser.add_argument('-v', '--verbose', default=None, help="verbose mode") args = parser.parse_args(sys.argv[2:]) module_path = args.module_path @@ -668,11 +767,20 @@ def generate(self): module_path = VersionModule.get_module_path_by_name(args.source_path, args.module_name) if not os.path.exists(args.target_path): os.makedirs(args.target_path) - module = VersionModule() + module = VersionModule(args.verbose) module.load(module_path, filter_dist=args.distribution, filter_arch=args.architecture) config = module.get_config_module(args.source_path, args.distribution, args.architecture) + if args.verbose: + config.print(args.source_path) config.clean_info(force=True) config.dump(args.target_path, config=True, priority=args.priority) if __name__ == "__main__": VersionManagerCommands() + + +""" +Dry run examples: + scripts/versions_manager.py freeze -v 'dryrun|cmod=docker-config-engine-stretch|cfile=versions-py2|cname=all|stage=sub|stage=add|stage=init|stage=tmodname|stage=tmp' + scripts/versions_manager.py freeze -v 'dryrun|cmod=default|cfile=versions-docker|cname=all|stage=sub|stage=add|stage=init|stage=tmodname|stage=tmp' +""" diff --git a/slave.mk b/slave.mk index 9c76f22cf52e..b2e413e13c90 100644 --- a/slave.mk +++ b/slave.mk @@ -95,6 +95,10 @@ export GZ_COMPRESS_PROGRAM ## Define configuration, help etc. ############################################################################### +# Install the updated build hooks if INSHOOKS flag is set +export INSHOOKS=y +$(if $(INSHOOKS),$(shell sudo dpkg -i /usr/local/share/buildinfo/sonic-build-hooks_1.0_all.deb &>/dev/null)) + .platform : ifneq ($(CONFIGURED_PLATFORM),generic) $(Q)echo Build system is not configured, please run make configure @@ -447,8 +451,9 @@ $(info SONiC Build System for $(CONFIGURED_PLATFORM):$(CONFIGURED_ARCH)) endif # Overwrite the buildinfo in slave container -$(shell sudo scripts/prepare_slave_container_buildinfo.sh $(SLAVE_DIR) $(CONFIGURED_ARCH) $(BLDENV)) - +ifeq ($(filter clean,$(MAKECMDGOALS)),) +$(shell DBGOPT='$(DBGOPT)' scripts/prepare_slave_container_buildinfo.sh $(SLAVE_DIR) $(CONFIGURED_ARCH) $(BLDENV)) +endif include Makefile.cache ifeq ($(SONIC_USE_DOCKER_BUILDKIT),y) @@ -582,7 +587,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) : $(DEBS_PATH)/% : .platform \ if [ -z '$($*_CACHE_LOADED)' ] ; then $(foreach deb,$* $($*_DERIVED_DEBS), \ - { curl -L -f -o $(DEBS_PATH)/$(deb) $($(deb)_CURL_OPTIONS) $($(deb)_URL) $(LOG) || { exit 1 ; } } ; ) + { SKIP_BUILD_HOOK=$($*_SKIP_VERSION) curl -L -f -o $(DEBS_PATH)/$(deb) $($(deb)_CURL_OPTIONS) $($(deb)_URL) $(LOG) || { exit 1 ; } } ; ) # Save the target deb into DPKG cache $(call SAVE_CACHE,$*,$@) @@ -599,7 +604,7 @@ SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) # SONIC_ONLINE_FILES += $(SOME_NEW_FILE) $(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES)) : $(FILES_PATH)/% : .platform $(HEADER) - curl -L -f -o $@ $($*_CURL_OPTIONS) $($*_URL) $(LOG) + SKIP_BUILD_HOOK=$($*_SKIP_VERSION) curl -L -f -o $@ $($*_CURL_OPTIONS) $($*_URL) $(LOG) $(FOOTER) SONIC_TARGET_LIST += $(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES)) @@ -908,7 +913,7 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff while true; do if mkdir $(PYTHON_WHEELS_PATH)/pip_lock &> /dev/null; then ifneq ($(CROSS_BUILD_ENVIRON),y) - { sudo -E pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; } + { sudo -E SKIP_BUILD_HOOK=Y pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; } else # Link python script and data expected location to the cross python virtual env istallation locations { PATH=$(VIRTENV_BIN_CROSS_PYTHON$($*_PYTHON_VERSION)):${PATH} sudo -E $(VIRTENV_BIN_CROSS_PYTHON$($*_PYTHON_VERSION))/pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && $(if $(findstring $(SONIC_CONFIG_ENGINE_PY3),$*),(sudo ln -s $(VIRTENV_BIN_CROSS_PYTHON$($*_PYTHON_VERSION))/sonic-cfggen /usr/local/bin/sonic-cfggen 2>/dev/null || true), true ) && $(if $(findstring $(SONIC_YANG_MODELS_PY3),$*),(sudo ln -s $(VIRTENV_BASE_CROSS_PYTHON3)/yang-models /usr/local/yang-models 2>/dev/null || true), true ) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; } @@ -936,7 +941,11 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g # Apply series of patches if exist if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi # Prepare docker build info - scripts/prepare_docker_buildinfo.sh $* $($*.gz_PATH)/Dockerfile $(CONFIGURED_ARCH) $(TARGET_DOCKERFILE)/Dockerfile.buildinfo + SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ + TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) \ + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + DBGOPT='$(DBGOPT)' \ + scripts/prepare_docker_buildinfo.sh $* $($*.gz_PATH)/Dockerfile $(CONFIGURED_ARCH) $(TARGET_DOCKERFILE)/Dockerfile.buildinfo $(LOG) docker info $(LOG) docker build --squash --no-cache \ --build-arg http_proxy=$(HTTP_PROXY) \ @@ -951,9 +960,12 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g -t $(DOCKER_IMAGE_REF) $($*.gz_PATH) $(LOG) if [ x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) == x"y" ]; then docker tag $(DOCKER_IMAGE_REF) $*; fi - scripts/collect_docker_version_files.sh $* $(TARGET_PATH) $(DOCKER_IMAGE_REF) $($*.gz_PATH) $(LOG) + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) ARCH=${CONFIGURED_ARCH} \ + DBGOPT='$(DBGOPT)' \ + scripts/collect_docker_version_files.sh $* $(TARGET_PATH) $(DOCKER_IMAGE_REF) $($*.gz_PATH) $(LOG) $(call docker-image-save,$*,$@) + # Clean up if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi $(FOOTER) @@ -1055,7 +1067,9 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) \ - scripts/prepare_docker_buildinfo.sh $* $($*.gz_PATH)/Dockerfile $(CONFIGURED_ARCH) + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + DBGOPT='$(DBGOPT)' \ + scripts/prepare_docker_buildinfo.sh $* $($*.gz_PATH)/Dockerfile $(CONFIGURED_ARCH) $(LOG) docker info $(LOG) docker build --squash --no-cache \ --build-arg http_proxy=$(HTTP_PROXY) \ @@ -1067,6 +1081,8 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ --build-arg frr_user_uid=$(FRR_USER_UID) \ --build-arg frr_user_gid=$(FRR_USER_GID) \ + --build-arg SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + --build-arg SONIC_VERSION_CACHE_SOURCE=$(SONIC_VERSION_CACHE_SOURCE) \ --build-arg image_version=$(SONIC_IMAGE_VERSION) \ --label com.azure.sonic.manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --label Tag=$(SONIC_IMAGE_VERSION) \ @@ -1074,10 +1090,13 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform -t $(DOCKER_IMAGE_REF) $($*.gz_PATH) $(LOG) if [ x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) == x"y" ]; then docker tag $(DOCKER_IMAGE_REF) $*; fi - scripts/collect_docker_version_files.sh $* $(TARGET_PATH) $(DOCKER_IMAGE_REF) $($*.gz_PATH) $($*.gz_PATH)/Dockerfile $(LOG) + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) ARCH=${CONFIGURED_ARCH}\ + DBGOPT='$(DBGOPT)' \ + scripts/collect_docker_version_files.sh $* $(TARGET_PATH) $(DOCKER_IMAGE_REF) $($*.gz_PATH) $($*.gz_PATH)/Dockerfile $(LOG) if [ ! -z $(filter $*.gz,$(SONIC_PACKAGES_LOCAL)) ]; then docker tag $(DOCKER_IMAGE_REF) $*:$(SONIC_IMAGE_VERSION); fi $(call docker-image-save,$*,$@) + # Clean up if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi @@ -1117,7 +1136,9 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) \ - scripts/prepare_docker_buildinfo.sh $* $($*.gz_PATH)/Dockerfile-dbg $(CONFIGURED_ARCH) + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + DBGOPT='$(DBGOPT)' \ + scripts/prepare_docker_buildinfo.sh $*-dbg $($*.gz_PATH)/Dockerfile-dbg $(CONFIGURED_ARCH) $(LOG) docker info $(LOG) docker build \ $(if $($*.gz_DBG_DEPENDS), --squash --no-cache, --no-cache) \ @@ -1125,16 +1146,21 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG --build-arg https_proxy=$(HTTPS_PROXY) \ --build-arg no_proxy=$(NO_PROXY) \ --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ + --build-arg SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ + --build-arg SONIC_VERSION_CACHE_SOURCE=$(SONIC_VERSION_CACHE_SOURCE) \ --label com.azure.sonic.manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --label Tag=$(SONIC_IMAGE_VERSION) \ --file $($*.gz_PATH)/Dockerfile-dbg \ -t $(DOCKER_DBG_IMAGE_REF) $($*.gz_PATH) $(LOG) if [ x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) == x"y" ]; then docker tag $(DOCKER_IMAGE_REF) $*; fi - scripts/collect_docker_version_files.sh $*-dbg $(TARGET_PATH) $(DOCKER_DBG_IMAGE_REF) $($*.gz_PATH) $($*.gz_PATH)/Dockerfile-dbg $(LOG) + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) ARCH=${CONFIGURED_ARCH}\ + DBGOPT='$(DBGOPT)' \ + scripts/collect_docker_version_files.sh $*-dbg $(TARGET_PATH) $(DOCKER_DBG_IMAGE_REF) $($*.gz_PATH) $($*.gz_PATH)/Dockerfile-dbg $(LOG) if [ ! -z $(filter $*.gz,$(SONIC_PACKAGES_LOCAL)) ]; then docker tag $(DOCKER_IMAGE_REF) $*:$(SONIC_IMAGE_VERSION); fi $(call docker-image-save,$*-$(DBG_IMAGE_MARK),$@) + # Clean up docker rmi -f $(DOCKER_IMAGE_REF) &> /dev/null || true if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; [ -d .pc ] && rm -rf .pc; popd; fi @@ -1429,6 +1455,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ SIGNING_KEY="$(SIGNING_KEY)" \ SIGNING_CERT="$(SIGNING_CERT)" \ PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ + DBGOPT='$(DBGOPT)' \ + SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \ MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) \ CROSS_BUILD_ENVIRON=$(CROSS_BUILD_ENVIRON) \ MASTER_KUBERNETES_VERSION=$(MASTER_KUBERNETES_VERSION) \ @@ -1497,7 +1525,7 @@ SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_SIMPLE_DOCKER_IMAGES) \ $(SONIC_INSTALLERS))) $(SONIC_CLEAN_TARGETS) :: $(TARGET_PATH)/%-clean : .platform - $(Q)rm -f $(TARGET_PATH)/$* + $(Q)rm -f $(TARGET_PATH)/$* target/versions/dockers/$(subst .gz,,$*) SONIC_CLEAN_STDEB_DEBS = $(addsuffix -clean,$(addprefix $(PYTHON_DEBS_PATH)/, \ $(SONIC_PYTHON_STDEB_DEBS))) @@ -1511,8 +1539,13 @@ $(SONIC_CLEAN_WHEELS) :: $(PYTHON_WHEELS_PATH)/%-clean : .platform clean-logs :: .platform $(Q)rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log $(FILES_PATH)/*.log $(PYTHON_DEBS_PATH)/*.log $(PYTHON_WHEELS_PATH)/*.log +clean-versions :: .platform + @rm -rf target/versions/* + +vclean:: .platform + @sudo rm -rf target/vcache/* target/baseimage* -clean :: .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_FILES) $$(SONIC_CLEAN_TARGETS) $$(SONIC_CLEAN_STDEB_DEBS) $$(SONIC_CLEAN_WHEELS) +clean :: .platform clean-logs clean-versions $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_FILES) $$(SONIC_CLEAN_TARGETS) $$(SONIC_CLEAN_STDEB_DEBS) $$(SONIC_CLEAN_WHEELS) ############################################################################### ## all diff --git a/src/sonic-build-hooks/Makefile b/src/sonic-build-hooks/Makefile index b45be9dd07f6..f20acac0b143 100644 --- a/src/sonic-build-hooks/Makefile +++ b/src/sonic-build-hooks/Makefile @@ -5,7 +5,7 @@ SONIC_BUILD_HOOKS_PACKAGE = $(SONIC_BUILD_HOOKS)_$(SONIC_BUILD_HOOKS_VERSION)_al BUILDINFO_DIR = buildinfo TMP_DIR = tmp SYMBOL_LINKS_SRC_DIR = ../../usr/local/share/buildinfo/scripts -SYMBOL_LINKS = symlink_build_hooks post_run_buildinfo pre_run_buildinfo collect_version_files +SYMBOL_LINKS = symlink_build_hooks post_run_buildinfo pre_run_buildinfo collect_version_files post_run_cleanup SONIC_BUILD_HOOKS_TARGET = $(BUILDINFO_DIR)/$(SONIC_BUILD_HOOKS_PACKAGE) BUILD_ROOT_DIR = $(TMP_DIR)/$(SONIC_BUILD_HOOKS) DEBIAN_DIR = $(BUILD_ROOT_DIR)/DEBIAN diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index accf41b22ace..015935041c8d 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -25,6 +25,7 @@ fi PKG_CACHE_FILE_NAME=${PKG_CACHE_PATH}/cache.tgz mkdir -p ${PKG_CACHE_PATH} +. ${BUILDINFO_PATH}/scripts/utils.sh URL_PREFIX=$(echo "${PACKAGE_URL_PREFIX}" | sed -E "s#(//[^/]*/).*#\1#") @@ -37,9 +38,15 @@ fi log_err() { - echo "$1" >> $LOG_PATH/error.log + echo "$(date "+%F-%H-%M-%S") ERR $1" >> $LOG_PATH/error.log echo "$1" 1>&2 } +log_info() +{ + echo "$(date "+%F-%H-%M-%S") INFO $1" >> $LOG_PATH/info.log + echo "$1" 1>&2 +} + # Get the real command not hooked by sonic-build-hook package get_command() @@ -79,6 +86,28 @@ check_if_url_exist() fi } +get_version_cache_option() +{ + #SONIC_VERSION_CACHE="cache" + if [ ! -z ${SONIC_VERSION_CACHE} ]; then + if [ ${SONIC_VERSION_CACHE} == "rcache" ]; then + echo -n "rcache" + elif [ ${SONIC_VERSION_CACHE} == "wcache" ]; then + echo -n "wcache" + elif [ ${SONIC_VERSION_CACHE} == "cache" ]; then + echo -n "wcache" + else + echo -n "" + return 1 + fi + echo -n "" + return 0 + fi + echo -n "" + return 1 +} + + # Enable or disable the reproducible mirrors set_reproducible_mirrors() { @@ -118,7 +147,7 @@ download_packages() local filename=$(echo $url | awk -F"/" '{print $NF}' | cut -d? -f1 | cut -d# -f1) [ -f $WEB_VERSION_FILE ] && version=$(grep "^${url}=" $WEB_VERSION_FILE | awk -F"==" '{print $NF}') if [ -z "$version" ]; then - echo "Warning: Failed to verify the package: $url, the version is not specified" 1>&2 + log_err "Warning: Failed to verify the package: $url, the version is not specified" 1>&2 continue fi @@ -132,7 +161,7 @@ download_packages() else real_version=$(get_url_version $url) || { echo "get_url_version $url failed"; exit 1; } if [ "$real_version" != "$version" ]; then - echo "Failed to verify url: $url, real hash value: $real_version, expected value: $version_filename" 1>&2 + log_err "Failed to verify url: $url, real hash value: $real_version, expected value: $version_filename" 1>&2 exit 1 fi fi @@ -297,10 +326,10 @@ update_version_file() if [ ! -f "$pre_version_file" ]; then return 0 fi - local pacakge_versions="$(cat $pre_version_file)" - [ -f "$version_file" ] && pacakge_versions="$pacakge_versions $(cat $version_file)" + local package_versions="$(cat $pre_version_file)" + [ -f "$version_file" ] && package_versions="$package_versions $(cat $version_file)" declare -A versions - for pacakge_version in $pacakge_versions; do + for pacakge_version in $package_versions; do package=$(echo $pacakge_version | awk -F"==" '{print $1}') version=$(echo $pacakge_version | awk -F"==" '{print $2}') if [ -z "$package" ] || [ -z "$version" ]; then @@ -334,4 +363,8 @@ ENABLE_VERSION_CONTROL_PY2=$(check_version_control "py2") ENABLE_VERSION_CONTROL_PY3=$(check_version_control "py3") ENABLE_VERSION_CONTROL_WEB=$(check_version_control "web") ENABLE_VERSION_CONTROL_GIT=$(check_version_control "git") +ENABLE_VERSION_CONTROL_PIP=$(check_version_control "pip") +ENABLE_VERSION_CONTROL_PYTHON=$(check_version_control "python") +ENABLE_VERSION_CONTROL_EASY_INSTALL=$(check_version_control "easy_install") +ENABLE_VERSION_CONTROL_GO=$(check_version_control "go") ENABLE_VERSION_CONTROL_DOCKER=$(check_version_control "docker") diff --git a/src/sonic-build-hooks/scripts/collect_version_files b/src/sonic-build-hooks/scripts/collect_version_files index a4b33eeaa897..6e082406da56 100755 --- a/src/sonic-build-hooks/scripts/collect_version_files +++ b/src/sonic-build-hooks/scripts/collect_version_files @@ -1,8 +1,9 @@ #!/bin/bash +TARGET_PATH=$1 . /usr/local/share/buildinfo/scripts/buildinfo_base.sh -TARGET_PATH=$1 +[ -d ${TARGET_PATH} ] && rm -rf ${TARGET_PATH} [ -z "$TARGET_PATH" ] && TARGET_PATH=$POST_VERSION_PATH ARCH=$(dpkg --print-architecture) DIST=$(grep VERSION_CODENAME /etc/os-release | cut -d= -f2) @@ -11,9 +12,15 @@ DIST=$(grep VERSION_CODENAME /etc/os-release | cut -d= -f2) mkdir -p $TARGET_PATH chmod a+rw $TARGET_PATH -dpkg-query -W -f '${Package}==${Version}\n' >> "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" -([ -x "/usr/local/bin/pip2" ] || [ -x "/usr/bin/pip2" ]) && pip2 freeze >> "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" -([ -x "/usr/local/bin/pip3" ] || [ -x "/usr/bin/pip3" ]) && pip3 freeze >> "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" +# Skip the package that does have a static build version. +# SAI package versions are changed too frequently. +SKIP_VERSION_PACKAGE="libsaibcm|libpaibcm|linuxptp|@ file://" +dpkg-query -W -f '${Package}==${Version}\n' | grep -Ev "${SKIP_VERSION_PACKAGE}" > "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" +([ -x "/usr/local/bin/pip2" ] || [ -x "/usr/bin/pip2" ]) && pip2 freeze --all| grep -Ev "${SKIP_VERSION_PACKAGE}" > "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" +([ -x "/usr/local/bin/pip3" ] || [ -x "/usr/bin/pip3" ]) && pip3 freeze --all| grep -Ev "${SKIP_VERSION_PACKAGE}" > "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" + +[ -f "${BUILD_WEB_VERSION_FILE}" ] && cp ${BUILD_WEB_VERSION_FILE} ${TARGET_PATH} +[ -f "${BUILD_GIT_VERSION_FILE}" ] && cp ${BUILD_GIT_VERSION_FILE} ${TARGET_PATH} ## Add the the packages purged [ -f $POST_VERSION_PATH/purge-versions-deb ] && cat $POST_VERSION_PATH/purge-versions-deb >> "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" diff --git a/src/sonic-build-hooks/scripts/post_run_buildinfo b/src/sonic-build-hooks/scripts/post_run_buildinfo index 00f2b0722dab..b703edf44fc0 100755 --- a/src/sonic-build-hooks/scripts/post_run_buildinfo +++ b/src/sonic-build-hooks/scripts/post_run_buildinfo @@ -4,15 +4,23 @@ IMAGENAME=$1 . /usr/local/share/buildinfo/scripts/buildinfo_base.sh + +[ -d $POST_VERSION_PATH ] && rm -rf $POST_VERSION_PATH + # Collect the version files collect_version_files $POST_VERSION_PATH #Save the cache file for exporting it to host. tar -C ${PKG_CACHE_PATH} --exclude=cache.tgz -zcvf /cache.tgz . -# Disable the build hooks -symlink_build_hooks -d -set_reproducible_mirrors -d - -# Remove the version deb preference -rm -f $VERSION_DEB_PREFERENCE +[ -d $BUILD_VERSION_PATH ] && [ ! -z "$(ls -A $BUILD_VERSION_PATH)" ] && cp -rf $BUILD_VERSION_PATH/* $POST_VERSION_PATH +rm -rf $BUILD_VERSION_PATH/* +if [ ! -z "$(get_version_cache_option)" ]; then + # Restore he deletion of cache files + cat <<-EOF >/etc/apt/apt.conf.d/docker-clean + DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; }; + APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; }; + EOF + +fi + diff --git a/src/sonic-build-hooks/scripts/post_run_cleanup b/src/sonic-build-hooks/scripts/post_run_cleanup new file mode 100755 index 000000000000..5e4ec23aec79 --- /dev/null +++ b/src/sonic-build-hooks/scripts/post_run_cleanup @@ -0,0 +1,40 @@ +#!/bin/bash + +IMAGENAME=$1 + +. /usr/local/share/buildinfo/scripts/buildinfo_base.sh + +set -x + + +if [ ! -z "$(get_version_cache_option)" ]; then + + #Delete the rsync package files + if [[ ! ${IMAGENAME} =~ -slave- ]]; then + /usr/bin/apt-get purge -y --auto-remove rsync + fi +fi + +apt-get -s clean -y +apt-get -s autoclean -y +apt-get -s autoremove -y +#apt-get -s autoremove -y --purge +rm -f /var/cache/apt/archives/*.deb /var/cache/apt/*.bin + +if [[ ! ${IMAGENAME} =~ -slave- ]]; then + rm -f /var/lib/apt/lists/* +fi + +rm -rf /sonic/target /ssh +rm -f /tmp/* +rm -rf /debs /python-wheels ~/.cache +find / | grep -E "__pycache__" | xargs rm -rf + +rm -rf $BUILD_VERSION_PATH/* + +# Disable the build hooks +symlink_build_hooks -d +set_reproducible_mirrors -d + +# Remove the version deb preference +rm -f $VERSION_DEB_PREFERENCE diff --git a/src/sonic-build-hooks/scripts/pre_run_buildinfo b/src/sonic-build-hooks/scripts/pre_run_buildinfo index eb4d04225ec5..7a30e3541eac 100755 --- a/src/sonic-build-hooks/scripts/pre_run_buildinfo +++ b/src/sonic-build-hooks/scripts/pre_run_buildinfo @@ -18,6 +18,22 @@ symlink_build_hooks set_reproducible_mirrors mkdir -p /var/cache/apt/archives/ +mkdir -p ${PKG_CACHE_PATH}/deb/ + +if [ ! -z "$(get_version_cache_option)" ]; then + # Skip the deletion of cache files + cat <<-EOF >/etc/apt/apt.conf.d/docker-clean + DPkg::Post-Invoke { "test -f /usr/bin/rsync && rsync -avzh --ignore-errors /var/cache/apt/archives/ ${PKG_CACHE_PATH}/deb/; rm -f /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; }; + APT::Update::Post-Invoke { "test -f /usr/bin/rsync && rsync -avzh --ignore-errors /var/cache/apt/archives/ ${PKG_CACHE_PATH}/deb/; rm -f /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; }; + APT::Keep-Downloaded-Packages "true"; + EOF +fi + +# Extract the cache inside the docker build. +if [ -f ${PKG_CACHE_FILE_NAME} ]; then + tar -C ${PKG_CACHE_PATH} -xvf ${PKG_CACHE_FILE_NAME} + test -e ${PKG_CACHE_PATH}/deb && cp ${PKG_CACHE_PATH}/deb/* /var/cache/apt/archives/ +fi chmod -R a+rw $BUILDINFO_PATH diff --git a/src/sonic-build-hooks/scripts/utils.sh b/src/sonic-build-hooks/scripts/utils.sh new file mode 100644 index 000000000000..28e83c101103 --- /dev/null +++ b/src/sonic-build-hooks/scripts/utils.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Lock macro for shared file access +# Parameters: +# $(1) - Lock file name +# $(2) - Timeout value +function FLOCK() +{ + local filename=$(dirname $1) + local timeout=${2:-360} + if [[ ! -f ${filename}.flock ]]; then + touch ${filename}.flock + chmod -f 777 ${filename}.flock; + fi + local lockname=$(basename ${filename}) + local lock_fd=lock_${lockname//[%.\/\-+~]/_}_fd + eval $(echo exec {${lock_fd}}\<\>"${filename}.flock") + #echo ${!lock_fd} + if ! flock -x -w ${timeout} "${!lock_fd}" ; then + echo "ERROR: Lock timeout trying to access ${filename}.flock" 1>&2; + exit 1; + fi + #echo "Lock acquired .." +} + +# UnLock macro for shared file access +# Parameters: +# $(1) - Lock file name +function FUNLOCK() +{ + local filename=$(dirname $1) + local lockname=$(basename ${filename}) + local lock_fd=lock_${lockname//[%.\/\-+~]/_}_fd + eval $(echo exec "${!lock_fd}<&-") + #rm -f ${filename}.flock +} + From d629c2d26c60c8eece8b1e3d05e0bab4692a6182 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Mon, 13 Feb 2023 15:27:50 +0200 Subject: [PATCH 113/113] [linux-kernel][sairedis][utilities] submodule update Update submodules after the merge from sonic-net --- src/sonic-linux-kernel | 2 +- src/sonic-sairedis | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index cba46a1c507b..7ed1de24af80 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit cba46a1c507b6c571c2925269f7f22d207decaf6 +Subproject commit 7ed1de24af809a30bd80fa40f8b243af174ff7d3 diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 71cf7506982b..c762abca2966 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 71cf7506982bd6856ac3dac433ac3775a895a9e2 +Subproject commit c762abca29668ff5864d46c490c5cc2d7a3197df diff --git a/src/sonic-utilities b/src/sonic-utilities index d15877500ce9..6c037b1a435d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit d15877500ce93c0ae6b242dce6cb36b1f8d74e42 +Subproject commit 6c037b1a435d53f63113c523f88c30283a605b71