diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d553f7a4d0c4..85645d8ff7ee 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -39,7 +39,7 @@ Write a short (one line) summary that describes the changes in this pull request for inclusion in the changelog: --> -#### Ensure to add label/tag for the feature raised. example - [PR#2174](https://github.com/sonic-net/sonic-utilities/pull/2174) where, Generic Config and Update feature has been labelled as GCU. +#### Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU. #### Link to config_db schema for YANG module changes + diff --git a/dockers/docker-iccpd/Dockerfile.j2 b/dockers/docker-iccpd/Dockerfile.j2 index 95a55159e496..bdb0a9fbf367 100644 --- a/dockers/docker-iccpd/Dockerfile.j2 +++ b/dockers/docker-iccpd/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 08098b9c13ed..ff13028e7ffb 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -228,6 +228,9 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/bash_*.deb || \ # in bash.bashrc, so we copy a version of the file with it enabled here. sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ +# Install readline's initialization file +sudo cp -f $IMAGE_CONFIGS/readline/inputrc $FILESYSTEM_ROOT/etc/ + # Install prerequisites needed for installing the dependent Python packages of sonic-host-services # These packages can be uninstalled after installation sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config diff --git a/files/image_config/environment/motd b/files/image_config/environment/motd index a8003b17b8e2..29fb6ffd9e43 100644 --- a/files/image_config/environment/motd +++ b/files/image_config/environment/motd @@ -10,7 +10,7 @@ You are on Unauthorized access and/or use are prohibited. All access and/or use are subject to monitoring. -Help: http://azure.github.io/SONiC/ +Help: https://sonic-net.github.io/SONiC/ Wiki: https://microsoft.sharepoint.com/teams/WAG/AzureNetworking/Wiki/SONiC.aspx On-Call: https://portal.microsofticm.com/imp/v3/oncall/current?serviceId=10045&teamIds=26162 Dashboard: https://aka.ms/sonic-dri diff --git a/files/image_config/misc/docker-wait-any b/files/image_config/misc/docker-wait-any index 3a00a2c610d1..f4001d7e02c5 100755 --- a/files/image_config/misc/docker-wait-any +++ b/files/image_config/misc/docker-wait-any @@ -61,6 +61,7 @@ def wait_for_container(docker_client, container_name): # Signal the main thread to exit g_thread_exit_event.set() + return def main(): diff --git a/files/image_config/readline/inputrc b/files/image_config/readline/inputrc new file mode 100644 index 000000000000..f9a424c26de4 --- /dev/null +++ b/files/image_config/readline/inputrc @@ -0,0 +1,70 @@ +# /etc/inputrc - global inputrc for libreadline +# See readline(3readline) and `info rluserman' for more information. + +# Disable bracketed-paste mode which got enabled by default from bash v5.1 +set enable-bracketed-paste off + +# Be 8 bit clean. +set input-meta on +set output-meta on + +# To allow the use of 8bit-characters like the german umlauts, uncomment +# the line below. However this makes the meta key not work as a meta key, +# which is annoying to those which don't need to type in 8-bit characters. + +# set convert-meta off + +# try to enable the application keypad when it is called. Some systems +# need this to enable the arrow keys. +# set enable-keypad on + +# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys + +# do not bell on tab-completion +# set bell-style none +# set bell-style visible + +# some defaults / modifications for the emacs mode +$if mode=emacs + +# allow the use of the Home/End keys +"\e[1~": beginning-of-line +"\e[4~": end-of-line + +# allow the use of the Delete/Insert keys +"\e[3~": delete-char +"\e[2~": quoted-insert + +# mappings for "page up" and "page down" to step to the beginning/end +# of the history +# "\e[5~": beginning-of-history +# "\e[6~": end-of-history + +# alternate mappings for "page up" and "page down" to search the history +# "\e[5~": history-search-backward +# "\e[6~": history-search-forward + +# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving +"\e[1;5C": forward-word +"\e[1;5D": backward-word +"\e[5C": forward-word +"\e[5D": backward-word +"\e\e[C": forward-word +"\e\e[D": backward-word + +$if term=rxvt +"\e[7~": beginning-of-line +"\e[8~": end-of-line +"\eOc": forward-word +"\eOd": backward-word +$endif + +# for non RH/Debian xterm, can't hurt for RH/Debian xterm +# "\eOH": beginning-of-line +# "\eOF": end-of-line + +# for freebsd console +# "\e[H": beginning-of-line +# "\e[F": end-of-line + +$endif diff --git a/platform/marvell-armhf/platform.conf b/platform/marvell-armhf/platform.conf index bab1b62f745e..cd74f5cbec7d 100644 --- a/platform/marvell-armhf/platform.conf +++ b/platform/marvell-armhf/platform.conf @@ -165,11 +165,11 @@ prepare_boot_menu() { fw_setenv ${FW_ARG} mtdparts 'mtdparts=spi0.0:4m(boot),-(spi-rootfs)' > /dev/null fi fw_setenv ${FW_ARG} ubi_sonic_boot_mount_ubi 'ubi part SONIC; ubifsmount ubi0' > /dev/null - fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs $BOOTARGS > /dev/null - fw_setenv ${FW_ARG} ubi_sonic_boot_load $UBI_LOAD > /dev/null + fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs "$BOOTARGS" > /dev/null + fw_setenv ${FW_ARG} ubi_sonic_boot_load "$UBI_LOAD" > /dev/null fw_setenv ${FW_ARG} sonic_image_1 "$UBIBOOTCMD" > /dev/null - fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs_old $BOOTARGS_OLD > /dev/null - fw_setenv ${FW_ARG} ubi_sonic_boot_load_old $UBI_LOAD_OLD > /dev/null + fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs_old "$BOOTARGS_OLD" > /dev/null + fw_setenv ${FW_ARG} ubi_sonic_boot_load_old "$UBI_LOAD_OLD" > /dev/null fw_setenv ${FW_ARG} sonic_image_2 "$UBIBOOTCMD_OLD" > /dev/null fw_setenv ${FW_ARG} boot_next 'run sonic_image_1'> /dev/null fw_setenv ${FW_ARG} bootcmd 'run print_menu; usb start; test -n "$boot_once" && run boot_once; run boot_next' > /dev/null diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py index 6f482f497194..3b9ce86ac901 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py @@ -30,6 +30,7 @@ import tempfile import subprocess from sonic_py_common import device_info + from sonic_py_common.general import check_output_pipe if sys.version_info[0] > 2: import configparser else: @@ -52,8 +53,8 @@ class MPFAManager(object): MPFA_EXTENSION = '.mpfa' - MPFA_EXTRACT_COMMAND = 'tar xzf {} -C {}' - MPFA_CLEANUP_COMMAND = 'rm -rf {}' + MPFA_EXTRACT_COMMAND = ['tar', 'xzf', '', '-C', ''] + MPFA_CLEANUP_COMMAND = ['rm', '-rf', ''] def __init__(self, mpfa_path): self.__mpfa_path = mpfa_path @@ -78,8 +79,9 @@ def __validate_path(self, mpfa_path): def __extract_contents(self, mpfa_path): contents_path = tempfile.mkdtemp(prefix='mpfa-') - cmd = self.MPFA_EXTRACT_COMMAND.format(mpfa_path, contents_path) - subprocess.check_call(cmd.split(), universal_newlines=True) + self.MPFA_EXTRACT_COMMAND[2] = mpfa_path + self.MPFA_EXTRACT_COMMAND[4] = contents_path + subprocess.check_call(self.MPFA_EXTRACT_COMMAND, universal_newlines=True) self.__contents_path = contents_path @@ -105,8 +107,8 @@ def extract(self): def cleanup(self): if os.path.exists(self.__contents_path): - cmd = self.MPFA_CLEANUP_COMMAND.format(self.__contents_path) - subprocess.check_call(cmd.split(), universal_newlines=True) + self.MPFA_CLEANUP_COMMAND[2] = self.__contents_path + subprocess.check_call(self.MPFA_CLEANUP_COMMAND, universal_newlines=True) self.__contents_path = None self.__metadata = None @@ -122,11 +124,11 @@ def is_extracted(self): class ONIEUpdater(object): - ONIE_FW_UPDATE_CMD_ADD = '/usr/bin/mlnx-onie-fw-update.sh add {}' - ONIE_FW_UPDATE_CMD_REMOVE = '/usr/bin/mlnx-onie-fw-update.sh remove {}' - ONIE_FW_UPDATE_CMD_UPDATE = '/usr/bin/mlnx-onie-fw-update.sh update' - ONIE_FW_UPDATE_CMD_INSTALL = '/usr/bin/mlnx-onie-fw-update.sh update --no-reboot' - ONIE_FW_UPDATE_CMD_SHOW_PENDING = '/usr/bin/mlnx-onie-fw-update.sh show-pending' + ONIE_FW_UPDATE_CMD_ADD = ['/usr/bin/mlnx-onie-fw-update.sh', 'add', ''] + ONIE_FW_UPDATE_CMD_REMOVE = ['/usr/bin/mlnx-onie-fw-update.sh', 'remove', ''] + ONIE_FW_UPDATE_CMD_UPDATE = ['/usr/bin/mlnx-onie-fw-update.sh', 'update'] + ONIE_FW_UPDATE_CMD_INSTALL = ['/usr/bin/mlnx-onie-fw-update.sh', 'update', '--no-reboot'] + ONIE_FW_UPDATE_CMD_SHOW_PENDING = ['/usr/bin/mlnx-onie-fw-update.sh', 'show-pending'] ONIE_VERSION_PARSE_PATTERN = '([0-9]{4})\.([0-9]{2})-([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)' ONIE_VERSION_BASE_PARSE_PATTERN = '([0-9]+)\.([0-9]+)\.([0-9]+)' @@ -135,7 +137,7 @@ class ONIEUpdater(object): ONIE_VERSION_ATTR = 'onie_version' ONIE_NO_PENDING_UPDATES_ATTR = 'No pending firmware updates present' - ONIE_IMAGE_INFO_COMMAND = '/bin/bash {} -q -i' + ONIE_IMAGE_INFO_COMMAND = ['/bin/bash', '', '-q', '-i'] # Upgrading fireware from ONIE is not supported from the beginning on some platforms, like SN2700. # There is a logic to check the ONIE version in order to know whether it is supported. @@ -167,14 +169,14 @@ def __mount_onie_fs(self): self.__umount_onie_fs() cmd = "fdisk -l | grep 'ONIE boot' | awk '{print $1}'" - fs_path = subprocess.check_output(cmd, - stderr=subprocess.STDOUT, - shell=True, - universal_newlines=True).rstrip('\n') + cmd1 = ['fdisk', '-l'] + cmd2 = ['grep', 'ONIE boot'] + cmd3 = ['awk', '{print $1}'] + fs_path = check_output_pipe(cmd1, cmd2, cmd3) os.mkdir(fs_mountpoint) - cmd = "mount -n -r -t ext4 {} {}".format(fs_path, fs_mountpoint) - subprocess.check_call(cmd, shell=True, universal_newlines=True) + cmd = ["mount", "-n", "-r", "-t", "ext4", fs_path, fs_mountpoint] + subprocess.check_call(cmd, universal_newlines=True) fs_onie_path = os.path.join(fs_mountpoint, 'onie/tools/lib/onie') os.symlink(fs_onie_path, onie_path) @@ -189,8 +191,8 @@ def __umount_onie_fs(self): os.unlink(onie_path) if os.path.ismount(fs_mountpoint): - cmd = "umount -rf {}".format(fs_mountpoint) - subprocess.check_call(cmd, shell=True, universal_newlines=True) + cmd = ["umount", "-rf", fs_mountpoint] + subprocess.check_call(cmd, universal_newlines=True) if os.path.exists(fs_mountpoint): os.rmdir(fs_mountpoint) @@ -198,20 +200,20 @@ def __umount_onie_fs(self): def __stage_update(self, image_path): rename_path = self.__add_prefix(image_path) - cmd = self.ONIE_FW_UPDATE_CMD_ADD.format(rename_path) + self.ONIE_FW_UPDATE_CMD_ADD[2] = rename_path try: - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(self.ONIE_FW_UPDATE_CMD_ADD, universal_newlines=True) except subprocess.CalledProcessError as e: raise RuntimeError("Failed to stage firmware update: {}".format(str(e))) def __unstage_update(self, image_path): rename_path = self.__add_prefix(image_path) - cmd = self.ONIE_FW_UPDATE_CMD_REMOVE.format(os.path.basename(rename_path)) + self.ONIE_FW_UPDATE_CMD_REMOVE[2] = os.path.basename(rename_path) try: - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(self.ONIE_FW_UPDATE_CMD_REMOVE, universal_newlines=True) except subprocess.CalledProcessError as e: raise RuntimeError("Failed to unstage firmware update: {}".format(str(e))) @@ -222,7 +224,7 @@ def __trigger_update(self, allow_reboot): cmd = self.ONIE_FW_UPDATE_CMD_INSTALL try: - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(cmd, universal_newlines=True) except subprocess.CalledProcessError as e: raise RuntimeError("Failed to trigger firmware update: {}".format(str(e))) @@ -230,7 +232,7 @@ def __is_update_staged(self, image_path): cmd = self.ONIE_FW_UPDATE_CMD_SHOW_PENDING try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -315,10 +317,10 @@ def get_onie_firmware_info(self, image_path): try: self.__mount_onie_fs() - cmd = self.ONIE_IMAGE_INFO_COMMAND.format(image_path) + self.ONIE_IMAGE_INFO_COMMAND[1] = image_path try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.ONIE_IMAGE_INFO_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -413,25 +415,6 @@ def _read_generic_file(filename, len, ignore_errors=False): return result - @staticmethod - def _get_command_result(cmdline): - try: - proc = subprocess.Popen(cmdline, - stdout=subprocess.PIPE, - shell=True, - stderr=subprocess.STDOUT, - universal_newlines=True) - stdout = proc.communicate()[0] - rc = proc.wait() - result = stdout.rstrip('\n') - if rc != 0: - raise RuntimeError("Failed to execute command {}, return code {}, message {}".format(cmdline, rc, stdout)) - - except OSError as e: - raise RuntimeError("Failed to execute command {} due to {}".format(cmdline, repr(e))) - - return result - def _check_file_validity(self, image_path): if not os.path.isfile(image_path): print("ERROR: File {} doesn't exist or is not a file".format(image_path)) @@ -502,10 +485,10 @@ class ComponentSSD(Component): POWER_CYCLE_REQUIRED_ATTR = 'Power Cycle Required' UPGRADE_REQUIRED_ATTR = 'Upgrade Required' - SSD_INFO_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -q" - SSD_FIRMWARE_INFO_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -q -i {}" - SSD_FIRMWARE_INSTALL_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh --no-power-cycle -y -u -i {}" - SSD_FIRMWARE_UPDATE_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -y -u -i {}" + SSD_INFO_COMMAND = ["/usr/bin/mlnx-ssd-fw-update.sh", "-q"] + SSD_FIRMWARE_INFO_COMMAND = ["/usr/bin/mlnx-ssd-fw-update.sh", "-q", "-i", ""] + SSD_FIRMWARE_INSTALL_COMMAND = ["/usr/bin/mlnx-ssd-fw-update.sh", "--no-power-cycle", "-y", "-u", "-i", ""] + SSD_FIRMWARE_UPDATE_COMMAND = ["/usr/bin/mlnx-ssd-fw-update.sh", "-y", "-u", "-i", ""] def __init__(self): super(ComponentSSD, self).__init__() @@ -519,13 +502,15 @@ def __install_firmware(self, image_path, allow_reboot=True): return False if allow_reboot: - cmd = self.SSD_FIRMWARE_UPDATE_COMMAND.format(image_path) + self.SSD_FIRMWARE_UPDATE_COMMAND[4] = image_path + cmd = self.SSD_FIRMWARE_UPDATE_COMMAND else: - cmd = self.SSD_FIRMWARE_INSTALL_COMMAND.format(image_path) + self.SSD_FIRMWARE_INSTALL_COMMAND[5] = image_path + cmd = self.SSD_FIRMWARE_INSTALL_COMMAND try: print("INFO: Installing {} firmware update".format(self.name)) - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(cmd, universal_newlines=True) except subprocess.CalledProcessError as e: print("ERROR: Failed to update {} firmware: {}".format(self.name, str(e))) return False @@ -563,10 +548,8 @@ def auto_update_firmware(self, image_path, boot_action): return FW_AUTO_SCHEDULED def get_firmware_version(self): - cmd = self.SSD_INFO_COMMAND - try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.SSD_INFO_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -579,10 +562,10 @@ def get_firmware_version(self): raise RuntimeError("Failed to parse {} version".format(self.name)) def get_available_firmware_version(self, image_path): - cmd = self.SSD_FIRMWARE_INFO_COMMAND.format(image_path) + self.SSD_FIRMWARE_INFO_COMMAND[3] = image_path try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.SSD_FIRMWARE_INFO_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -614,10 +597,10 @@ def get_available_firmware_version(self, image_path): return available_firmware_version def get_firmware_update_notification(self, image_path): - cmd = self.SSD_FIRMWARE_INFO_COMMAND.format(image_path) + self.SSD_FIRMWARE_INFO_COMMAND[3] = image_path try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.SSD_FIRMWARE_INFO_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -660,7 +643,7 @@ class ComponentBIOS(Component): COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' COMPONENT_FIRMWARE_EXTENSION = '.rom' - BIOS_VERSION_COMMAND = 'dmidecode --oem-string 1' + BIOS_VERSION_COMMAND = ['dmidecode', '--oem-string', '1'] def __init__(self): super(ComponentBIOS, self).__init__() @@ -688,10 +671,8 @@ def __install_firmware(self, image_path, allow_reboot=True): return True def get_firmware_version(self): - cmd = self.BIOS_VERSION_COMMAND - try: - version = subprocess.check_output(cmd.split(), + version = subprocess.check_output(self.BIOS_VERSION_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -716,7 +697,7 @@ class ComponentBIOSSN2201(Component): COMPONENT_NAME = 'BIOS' COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' - BIOS_VERSION_COMMAND = 'dmidecode -t0' + BIOS_VERSION_COMMAND = ['dmidecode', '-t0'] def __init__(self): super(ComponentBIOSSN2201, self).__init__() @@ -725,10 +706,8 @@ def __init__(self): self.description = self.COMPONENT_DESCRIPTION def get_firmware_version(self): - cmd = self.BIOS_VERSION_COMMAND - try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.BIOS_VERSION_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -764,7 +743,7 @@ class ComponentCPLD(Component): CPLD_PART_NUMBER_DEFAULT = '0' CPLD_VERSION_MINOR_DEFAULT = '0' - CPLD_FIRMWARE_UPDATE_COMMAND = 'cpldupdate --dev {} --print-progress {}' + CPLD_FIRMWARE_UPDATE_COMMAND = ['cpldupdate', '--dev', '', '--print-progress', ''] def __init__(self, idx): super(ComponentCPLD, self).__init__() @@ -796,12 +775,13 @@ def _install_firmware(self, image_path): mst_dev = self.__get_mst_device() if mst_dev is None: return False - - cmd = self.CPLD_FIRMWARE_UPDATE_COMMAND.format(mst_dev, image_path) + self.CPLD_FIRMWARE_UPDATE_COMMAND[2] = mst_dev + self.CPLD_FIRMWARE_UPDATE_COMMAND[4] = image_path + cmd = self.CPLD_FIRMWARE_UPDATE_COMMAND try: print("INFO: Installing {} firmware update: path={}".format(self.name, image_path)) - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(cmd, universal_newlines=True) except subprocess.CalledProcessError as e: print("ERROR: Failed to update {} firmware: {}".format(self.name, str(e))) return False @@ -910,14 +890,14 @@ def get_component_list(cls): class ComponentCPLDSN2201(ComponentCPLD): - CPLD_FIRMWARE_UPDATE_COMMAND = 'cpldupdate --gpio {} --uncustomized --print-progress' + CPLD_FIRMWARE_UPDATE_COMMAND = ['cpldupdate', '--gpio', '', '--uncustomized', '--print-progress'] def _install_firmware(self, image_path): - cmd = self.CPLD_FIRMWARE_UPDATE_COMMAND.format(image_path) + self.CPLD_FIRMWARE_UPDATE_COMMAND[2] = image_path try: print("INFO: Installing {} firmware update: path={}".format(self.name, image_path)) - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(self.CPLD_FIRMWARE_UPDATE_COMMAND, universal_newlines=True) except subprocess.CalledProcessError as e: print("ERROR: Failed to update {} firmware: {}".format(self.name, str(e))) return False diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py index 8c40e2b61809..ec205fe60431 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py @@ -218,8 +218,8 @@ def set_speed(self, speed): addr = utils.read_str_from_file(self.psu_i2c_addr_path, raise_exception=True) command = utils.read_str_from_file(self.psu_i2c_command_path, raise_exception=True) speed = self.PSU_FAN_SPEED[int(speed // 10)] - command = "i2cset -f -y {0} {1} {2} {3} wp".format(bus, addr, command, speed) - subprocess.check_call(command, shell = True, universal_newlines=True) + command = ["i2cset", "-f", "-y", bus, addr, command, speed, "wp"] + subprocess.check_call(command, universal_newlines=True) return True except subprocess.CalledProcessError as ce: logger.log_error('Failed to call command {}, return code={}, command output={}'.format(ce.cmd, ce.returncode, ce.output)) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 05f38f62a0f1..e447bbb43565 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -551,7 +551,7 @@ def run(cls, psu, threshold_value, threshold_file): return threshold_value # Run a sensors -s command to triger hardware to get the real threashold value - utils.run_command('sensors -s') + utils.run_command(['sensors', '-s']) # Wait for the threshold value change return cls.wait_set_done(threshold_file) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index d35b869e9a29..bc87fb8cd4df 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -25,8 +25,8 @@ try: import subprocess import os - from sonic_platform_base.sonic_eeprom import eeprom_dts from sonic_py_common.logger import Logger + from sonic_py_common.general import check_output_pipe from . import utils from .device_data import DeviceDataManager from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase @@ -186,10 +186,11 @@ def write_mlxreg_eeprom(self, num_bytes, dword, device_address, page): return False try: - cmd = "mlxreg -d /dev/mst/{} --reg_name MCIA --indexes \ - slot_index={},module={},device_address={},page_number={},i2c_device_address=0x50,size={},bank_number=0 \ - --set {} -y".format(self.mst_pci_device, self.slot_id, self.sdk_index, device_address, page, num_bytes, dword) - subprocess.check_call(cmd, shell=True, universal_newlines=True, stdout=subprocess.DEVNULL) + cmd = ["mlxreg", "-d", "", "--reg_name", "MCIA", "--indexes", "", "--set", "", "-y"] + cmd[2] = "/dev/mst/" + self.mst_pci_device + cmd[6] = "slot_index={},module={},device_address={},page_number={},i2c_device_address=0x50,size={},bank_number=0".format(self.slot_id, self.sdk_index, device_address, page, num_bytes) + cmd[8] = dword + subprocess.check_call(cmd, universal_newlines=True, stdout=subprocess.DEVNULL) except subprocess.CalledProcessError as e: logger.log_error("Error! Unable to write data dword={} for {} port, page {} offset {}, rc = {}, err msg: {}".format(dword, self.sdk_index, page, device_address, e.returncode, e.output)) return False @@ -197,10 +198,11 @@ def write_mlxreg_eeprom(self, num_bytes, dword, device_address, page): def read_mlxred_eeprom(self, offset, page, num_bytes): try: - cmd = "mlxreg -d /dev/mst/{} --reg_name MCIA --indexes \ - slot_index={},module={},device_address={},page_number={},i2c_device_address=0x50,size={},bank_number=0 \ - --get".format(self.mst_pci_device, self.slot_id, self.sdk_index, offset, page, num_bytes) - result = subprocess.check_output(cmd, universal_newlines=True, shell=True) + + cmd = ["mlxreg", "-d", "", "--reg_name", "MCIA", "--indexes", "", "--get"] + cmd[2] = "/dev/mst/" + self.mst_pci_device + cmd[6] = "slot_index={},module={},device_address={},page_number={},i2c_device_address=0x50,size={},bank_number=0".format(self.slot_id, self.sdk_index, offset, page, num_bytes) + result = subprocess.check_output(cmd, universal_newlines=True) except subprocess.CalledProcessError as e: logger.log_error("Error! Unable to read data for {} port, page {} offset {}, rc = {}, err msg: {}".format(self.sdk_index, page, offset, e.returncode, e.output)) return None @@ -315,7 +317,7 @@ def __init__(self, sfp_index, sfp_type=None, slot_id=0, linecard_port_count=0, l def get_mst_pci_device(self): device_name = None try: - device_name = subprocess.check_output("ls /dev/mst/ | grep pciconf", universal_newlines=True, shell=True).strip() + device_name = check_output_pipe(["ls", "/dev/mst/"], ["grep", "pciconf"]).strip() except subprocess.CalledProcessError as e: logger.log_error("Failed to find mst PCI device rc={} err.msg={}".format(e.returncode, e.output)) return device_name @@ -355,10 +357,12 @@ def _read_eeprom_specific_bytes(self, offset, num_bytes): return None eeprom_raw = [] - ethtool_cmd = "ethtool -m sfp{} hex on offset {} length {}".format(self.index, offset, num_bytes) + ethtool_cmd = ["ethtool", "-m", "", "hex", "on", "offset", "", "length", ""] + ethtool_cmd[2] = "sfp" + str(self.index) + ethtool_cmd[6] = str(offset) + ethtool_cmd[8] = str(num_bytes) try: output = subprocess.check_output(ethtool_cmd, - shell=True, universal_newlines=True) output_lines = output.splitlines() first_line_raw = output_lines[0] @@ -478,9 +482,9 @@ def get_lpmode(self): get_lpmode_code = 'from sonic_platform import sfp;\n' \ 'with sfp.SdkHandleContext() as sdk_handle:' \ 'print(sfp.SFP._get_lpmode(sdk_handle, {}, {}))'.format(self.sdk_index, self.slot_id) - lpm_cmd = "docker exec pmon python3 -c \"{}\"".format(get_lpmode_code) + lpm_cmd = ["docker", "exec", "pmon", "python3", "-c", get_lpmode_code] try: - output = subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(lpm_cmd, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: print("Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) @@ -519,10 +523,10 @@ def reset(self): 'with sfp.SdkHandleContext() as sdk_handle:' \ 'print(sfp.SFP._reset(sdk_handle, {}, {}))' \ .format(self.sdk_index, self.slot_id) - reset_cmd = "docker exec pmon python3 -c \"{}\"".format(reset_code) + reset_cmd = ["docker", "exec", "pmon", "python3", "-c", reset_code] try: - output = subprocess.check_output(reset_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(reset_cmd, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) @@ -677,11 +681,11 @@ def set_lpmode(self, lpmode): 'with sfp.SdkHandleContext() as sdk_handle:' \ 'print(sfp.SFP._set_lpmode({}, sdk_handle, {}, {}))' \ .format('True' if lpmode else 'False', self.sdk_index, self.slot_id) - lpm_cmd = "docker exec pmon python3 -c \"{}\"".format(set_lpmode_code) + lpm_cmd = ["docker", "exec", "pmon", "python3", "-c", set_lpmode_code] # Set LPM try: - output = subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(lpm_cmd, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) @@ -824,9 +828,9 @@ def get_presence(self): get_presence_code = 'from sonic_platform import sfp;\n' \ 'with sfp.SdkHandleContext() as sdk_handle:' \ 'print(sfp.RJ45Port._get_presence(sdk_handle, {}))'.format(self.sdk_index) - presence_cmd = "docker exec pmon python3 -c \"{}\"".format(get_presence_code) + presence_cmd = ["docker", "exec", "pmon", "python3", "-c", get_presence_code] try: - output = subprocess.check_output(presence_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(presence_cmd, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: print("Error! Unable to get presence for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py index 0db7e1e26e30..2bc312cd2234 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py @@ -187,9 +187,8 @@ def is_host(): return True for host and False for docker """ try: - proc = subprocess.Popen("docker --version 2>/dev/null", + proc = subprocess.Popen(["docker", "--version"], stdout=subprocess.PIPE, - shell=True, stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] @@ -221,7 +220,7 @@ def run_command(command): :return: Output of the shell command. """ try: - process = subprocess.Popen(command, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return process.communicate()[0].strip() except Exception: return None diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py b/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py index e69de29bb2d1..07ebf17a113e 100644 --- a/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py +++ b/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py @@ -0,0 +1,16 @@ +# +# Copyright (c) 2017-2022 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. +# diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py b/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py index 20a09d1b54f6..170b0246430f 100644 --- a/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py +++ b/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py @@ -1,3 +1,20 @@ +# +# Copyright (c) 2022 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. +# + """ module holding the correct values for the sfp_test.py """ diff --git a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py index 8ae4ece8eec6..2aa4f78855f3 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py @@ -17,6 +17,7 @@ import os import sys +import subprocess from mock import MagicMock if sys.version_info.major == 3: @@ -172,7 +173,6 @@ def test_sfp(self): @mock.patch('sonic_platform.device_data.DeviceDataManager.get_sfp_count', MagicMock(return_value=3)) def test_change_event(self): from sonic_platform.sfp_event import sfp_event - from sonic_platform.sfp import SFP return_port_dict = {1: '1'} def mock_check_sfp_status(self, port_dict, error_dict, timeout): @@ -276,12 +276,12 @@ def test_revision_permission(self): #Override the dmi file sonic_platform.chassis.DMI_FILE = "/tmp/dmi_file" new_dmi_file = sonic_platform.chassis.DMI_FILE - os.system("touch " + new_dmi_file) - os.system("chmod -r " + new_dmi_file) + subprocess.call(["touch", new_dmi_file]) + subprocess.call(["chmod", "-r", new_dmi_file]) chassis = Chassis() rev = chassis.get_revision() sonic_platform.chassis.DMI_FILE = old_dmi_file - os.system("rm -f " + new_dmi_file) + subprocess.call(["rm", "-f", new_dmi_file]) assert rev == "N/A" def test_get_port_or_cage_type(self): diff --git a/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py b/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py index 5845a1b2cadb..75d1cbe707fe 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py @@ -143,7 +143,7 @@ def mock_read_str_from_file(file_path, default='', raise_exception=False): assert subprocess.check_call.call_count == 0 fan.get_presence = MagicMock(return_value=True) assert fan.set_speed(60) - subprocess.check_call.assert_called_with("i2cset -f -y {0} {1} {2} {3} wp".format('bus', 'addr', 'command', hex(60)), shell=True, universal_newlines=True) + subprocess.check_call.assert_called_with(["i2cset", "-f", "-y", "bus", "addr", "command", hex(60), "wp"], universal_newlines=True) subprocess.check_call = MagicMock(side_effect=subprocess.CalledProcessError('', '')) assert not fan.set_speed(60) subprocess.check_call = MagicMock() diff --git a/platform/mellanox/mlnx-platform-api/tests/test_psu.py b/platform/mellanox/mlnx-platform-api/tests/test_psu.py index 5deb72bfb0e1..d92b8f716a6d 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_psu.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_psu.py @@ -160,4 +160,4 @@ def get_entry_value(key): # Normal vpd_info[InvalidPsuVolWA.CAPACITY_FIELD] = InvalidPsuVolWA.EXPECT_CAPACITY assert InvalidPsuVolWA.run(psu, InvalidPsuVolWA.INVALID_VOLTAGE_VALUE, '') == 9999 - mock_run_command.assert_called_with('sensors -s') + mock_run_command.assert_called_with(['sensors', '-s']) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_utils.py b/platform/mellanox/mlnx-platform-api/tests/test_utils.py index e1052202d416..c4c8d0c000a9 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_utils.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_utils.py @@ -118,7 +118,7 @@ def func(): assert mock_log.call_count == 1 def test_run_command(self): - output = utils.run_command('ls') + output = utils.run_command(['ls']) assert output @mock.patch('sonic_py_common.device_info.get_path_to_hwsku_dir', mock.MagicMock(return_value='/tmp')) diff --git a/platform/mellanox/zero_profiles.j2 b/platform/mellanox/zero_profiles.j2 index a953c18409b2..007f19c83a0a 100644 --- a/platform/mellanox/zero_profiles.j2 +++ b/platform/mellanox/zero_profiles.j2 @@ -1,3 +1,20 @@ +{# + Copyright (c) 2021-2022 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. +#} + [ { "BUFFER_POOL_TABLE:ingress_zero_pool": { diff --git a/platform/vs/sonic-gns3a.sh b/platform/vs/sonic-gns3a.sh index 41e39cd8686a..2a772ce5a332 100644 --- a/platform/vs/sonic-gns3a.sh +++ b/platform/vs/sonic-gns3a.sh @@ -41,9 +41,9 @@ echo " \"category\": \"router\", \"description\": \"SONiC Virtual Switch/Router\", \"vendor_name\": \"SONiC\", - \"vendor_url\": \"https://azure.github.io/SONiC/\", + \"vendor_url\": \"https://sonic-net.github.io/SONiC/\", \"product_name\": \"SONiC\", - \"product_url\": \"https://azure.github.io/SONiC/\", + \"product_url\": \"https://sonic-net.github.io/SONiC/\", \"registry_version\": 3, \"status\": \"experimental\", \"maintainer\": \"SONiC\", diff --git a/rules/debootstrap.mk b/rules/debootstrap.mk index dc60599d5f3f..a74fa22e9faa 100644 --- a/rules/debootstrap.mk +++ b/rules/debootstrap.mk @@ -1,6 +1,6 @@ # debootstrap package -DEBOOTSTRAP_VERSION = 1.0.123 +DEBOOTSTRAP_VERSION = 1.0.123+deb11u1 export DEBOOTSTRAP_VERSION diff --git a/rules/docker-iccpd.mk b/rules/docker-iccpd.mk index c0c747997959..eb58ee755cdc 100644 --- a/rules/docker-iccpd.mk +++ b/rules/docker-iccpd.mk @@ -5,10 +5,10 @@ DOCKER_ICCPD = $(DOCKER_ICCPD_STEM).gz DOCKER_ICCPD_DBG = $(DOCKER_ICCPD_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_ICCPD)_PATH = $(DOCKERS_PATH)/$(DOCKER_ICCPD_STEM) $(DOCKER_ICCPD)_DEPENDS += $(SWSS) $(ICCPD) -$(DOCKER_ICCPD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_ICCPD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) $(DOCKER_ICCPD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) $(ICCPD_DBG) -$(DOCKER_ICCPD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) -$(DOCKER_ICCPD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ICCPD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) +$(DOCKER_ICCPD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_ICCPD)_VERSION = 1.0.0 $(DOCKER_ICCPD)_ICCPD = iccpd @@ -26,5 +26,5 @@ $(DOCKER_ICCPD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ICCPD)_BASE_IMAGE_FILES += mclagdctl:/usr/bin/mclagdctl -SONIC_BUSTER_DOCKERS += $(DOCKER_ICCPD) -SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_ICCPD_DBG) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_ICCPD) +SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_ICCPD_DBG) diff --git a/rules/sonic-config.dep b/rules/sonic-config.dep index 65aabe74d76f..2b8b98fcd42b 100644 --- a/rules/sonic-config.dep +++ b/rules/sonic-config.dep @@ -4,7 +4,7 @@ SPATH := $($(SONIC_CONFIG_ENGINE_PY3)_SRC_PATH) DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-config.mk rules/sonic-config.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(SPATH)) -DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(shell find device -type f) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 dockers/docker-orchagent/vxlan.json.j2 files/image_config/constants/constants.yml +DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(shell find device -type f | sort) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 dockers/docker-orchagent/vxlan.json.j2 files/image_config/constants/constants.yml ifeq ($(ENABLE_PY2_MODULES), y) $(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA diff --git a/slave.mk b/slave.mk index 67089adb71ce..75f836f3b0bf 100644 --- a/slave.mk +++ b/slave.mk @@ -92,32 +92,32 @@ export BLDENV .platform : ifneq ($(CONFIGURED_PLATFORM),generic) - @echo Build system is not configured, please run make configure - @exit 1 + $(Q)echo Build system is not configured, please run make configure + $(Q)exit 1 endif configure : - @mkdir -p $(JESSIE_DEBS_PATH) - @mkdir -p $(STRETCH_DEBS_PATH) - @mkdir -p $(BUSTER_DEBS_PATH) - @mkdir -p $(BULLSEYE_DEBS_PATH) - @mkdir -p $(FILES_PATH) - @mkdir -p $(JESSIE_FILES_PATH) - @mkdir -p $(STRETCH_FILES_PATH) - @mkdir -p $(BUSTER_FILES_PATH) - @mkdir -p $(BULLSEYE_FILES_PATH) - @mkdir -p $(PYTHON_DEBS_PATH) - @mkdir -p $(PYTHON_WHEELS_PATH) - @mkdir -p $(DPKG_ADMINDIR_PATH) - @echo $(PLATFORM) > .platform - @echo $(PLATFORM_ARCH) > .arch + $(Q)mkdir -p $(JESSIE_DEBS_PATH) + $(Q)mkdir -p $(STRETCH_DEBS_PATH) + $(Q)mkdir -p $(BUSTER_DEBS_PATH) + $(Q)mkdir -p $(BULLSEYE_DEBS_PATH) + $(Q)mkdir -p $(FILES_PATH) + $(Q)mkdir -p $(JESSIE_FILES_PATH) + $(Q)mkdir -p $(STRETCH_FILES_PATH) + $(Q)mkdir -p $(BUSTER_FILES_PATH) + $(Q)mkdir -p $(BULLSEYE_FILES_PATH) + $(Q)mkdir -p $(PYTHON_DEBS_PATH) + $(Q)mkdir -p $(PYTHON_WHEELS_PATH) + $(Q)mkdir -p $(DPKG_ADMINDIR_PATH) + $(Q)echo $(PLATFORM) > .platform + $(Q)echo $(PLATFORM_ARCH) > .arch distclean : .platform clean - @rm -f .platform - @rm -f .arch + $(Q)rm -f .platform + $(Q)rm -f .arch list : - @$(foreach target,$(SONIC_TARGET_LIST),echo $(target);) + $(Q)$(foreach target,$(SONIC_TARGET_LIST),echo $(target);) ############################################################################### ## Include other rules @@ -185,7 +185,7 @@ endif # TODO(PINS): Remove when Bazel binaries are available for armhf ifeq ($(CONFIGURED_ARCH),armhf) ifeq ($(INCLUDE_P4RT),y) - @echo "Disabling P4RT due to incompatible CPU architecture: $(CONFIGURED_ARCH)" + $(Q)echo "Disabling P4RT due to incompatible CPU architecture: $(CONFIGURED_ARCH)" endif override INCLUDE_P4RT = n endif @@ -213,7 +213,7 @@ endif ifeq ($(ENABLE_ASAN),y) ifneq ($(CONFIGURED_ARCH),amd64) - @echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)" + $(Q)echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)" override ENABLE_ASAN = n endif endif @@ -880,12 +880,12 @@ endif # start docker daemon docker-start : - @sudo sed -i 's/--storage-driver=vfs/--storage-driver=$(SONIC_SLAVE_DOCKER_DRIVER)/' /etc/default/docker - @sudo sed -i -e '/http_proxy/d' -e '/https_proxy/d' /etc/default/docker - @sudo bash -c "{ echo \"export http_proxy=$$http_proxy\"; \ + $(Q)sudo sed -i 's/--storage-driver=vfs/--storage-driver=$(SONIC_SLAVE_DOCKER_DRIVER)/' /etc/default/docker + $(Q)sudo sed -i -e '/http_proxy/d' -e '/https_proxy/d' /etc/default/docker + $(Q)sudo bash -c "{ echo \"export http_proxy=$$http_proxy\"; \ echo \"export https_proxy=$$https_proxy\"; \ echo \"export no_proxy=$$no_proxy\"; } >> /etc/default/docker" - @test x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) != x"y" && sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && ./scripts/wait_for_docker.sh 60 ) + $(Q)test x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) != x"y" && sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && ./scripts/wait_for_docker.sh 60 ) # targets for building simple docker images that do not depend on any debian packages $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) @@ -1427,12 +1427,12 @@ SONIC_CLEAN_FILES = $(addsuffix -clean,$(addprefix $(FILES_PATH)/, \ $(SONIC_MAKE_FILES))) $(SONIC_CLEAN_DEBS) :: $(DEBS_PATH)/%-clean : .platform $$(addsuffix -clean,$$(addprefix $(DEBS_PATH)/,$$($$*_MAIN_DEB))) - @# remove derived or extra targets if main one is removed, because we treat them - @# as part of one package - @rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) + $(Q)# remove derived or extra targets if main one is removed, because we treat them + $(Q)# as part of one package + $(Q)rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) $(SONIC_CLEAN_FILES) :: $(FILES_PATH)/%-clean : .platform - @rm -f $(FILES_PATH)/$* + $(Q)rm -f $(FILES_PATH)/$* SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_DOCKER_IMAGES) \ @@ -1440,20 +1440,20 @@ SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_SIMPLE_DOCKER_IMAGES) \ $(SONIC_INSTALLERS))) $(SONIC_CLEAN_TARGETS) :: $(TARGET_PATH)/%-clean : .platform - @rm -f $(TARGET_PATH)/$* + $(Q)rm -f $(TARGET_PATH)/$* SONIC_CLEAN_STDEB_DEBS = $(addsuffix -clean,$(addprefix $(PYTHON_DEBS_PATH)/, \ $(SONIC_PYTHON_STDEB_DEBS))) $(SONIC_CLEAN_STDEB_DEBS) :: $(PYTHON_DEBS_PATH)/%-clean : .platform - @rm -f $(PYTHON_DEBS_PATH)/$* + $(Q)rm -f $(PYTHON_DEBS_PATH)/$* SONIC_CLEAN_WHEELS = $(addsuffix -clean,$(addprefix $(PYTHON_WHEELS_PATH)/, \ $(SONIC_PYTHON_WHEELS))) $(SONIC_CLEAN_WHEELS) :: $(PYTHON_WHEELS_PATH)/%-clean : .platform - @rm -f $(PYTHON_WHEELS_PATH)/$* + $(Q)rm -f $(PYTHON_WHEELS_PATH)/$* clean-logs :: .platform - @rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log $(FILES_PATH)/*.log $(PYTHON_DEBS_PATH)/*.log $(PYTHON_WHEELS_PATH)/*.log + $(Q)rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log $(FILES_PATH)/*.log $(PYTHON_DEBS_PATH)/*.log $(PYTHON_WHEELS_PATH)/*.log clean :: .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_FILES) $$(SONIC_CLEAN_TARGETS) $$(SONIC_CLEAN_STDEB_DEBS) $$(SONIC_CLEAN_WHEELS) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 7d20aa26631f..d9379d673cdb 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1792,6 +1792,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw if is_storage_device: results['DEVICE_METADATA']['localhost']['storage_device'] = "true" + # remove bgp monitor and slb peers for storage backend + if is_storage_device and 'BackEnd' in current_device['type']: + results['BGP_MONITORS'] = {} + results['BGP_PEER_RANGE'] = {} + results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 4f73a543e9df..3db04374e4ea 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -805,6 +805,14 @@ def verify_sub_intf(self, **kwargs): output = self.run_script(argument) self.assertEqual(output.strip(), "") + # SLB and BGP Monitor table does not exist + argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "BGP_PEER_RANGE"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{}") + argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "BGP_MONITORS"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{}") + # ACL_TABLE should not contain EVERFLOW related entries argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "ACL_TABLE"' output = self.run_script(argument) @@ -1022,4 +1030,4 @@ def test_minigraph_packet_chassis_400g_zr_port_config(self): output = self.run_script(argument) output_dict = utils.to_dict(output.strip()) self.assertEqual(output_dict['tx_power'], '7.5') - self.assertEqual(output_dict['laser_freq'], 131000) \ No newline at end of file + self.assertEqual(output_dict['laser_freq'], 131000) diff --git a/src/sonic-device-data/README.md b/src/sonic-device-data/README.md index e8ccad58b819..d9d403758a86 100644 --- a/src/sonic-device-data/README.md +++ b/src/sonic-device-data/README.md @@ -1,4 +1,4 @@ # sonic-device-data Device-specific data for the SONiC project -See the [SONiC Website](http://azure.github.io/SONiC/) for more information about the SONiC project. +See the [SONiC Website](https://sonic-net.github.io/SONiC/) for more information about the SONiC project. diff --git a/src/sonic-gnmi b/src/sonic-gnmi index 437fc357fd95..194ecd0896a0 160000 --- a/src/sonic-gnmi +++ b/src/sonic-gnmi @@ -1 +1 @@ -Subproject commit 437fc357fd95a0b25715b8ab869b8cf8a7a22681 +Subproject commit 194ecd0896a0e698e22dc2320e5087e9b7de3d06 diff --git a/src/sonic-host-services-data/README.md b/src/sonic-host-services-data/README.md index 93af66a83d6b..0b9e714932d2 100644 --- a/src/sonic-host-services-data/README.md +++ b/src/sonic-host-services-data/README.md @@ -16,4 +16,4 @@ dpkg-buildpackage -rfakeroot -Tclean --- -See the [SONiC Website](http://azure.github.io/SONiC/) for more information about the SONiC project. +See the [SONiC Website](https://sonic-net.github.io/SONiC/) for more information about the SONiC project. diff --git a/src/sonic-swss b/src/sonic-swss index fd0c585d34de..df92fb7283b4 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit fd0c585d34de63dc9cca57bb7d508cadfe1125d4 +Subproject commit df92fb7283b4490a33e14fd1d6626e9c17a3b6ea diff --git a/src/sonic-utilities b/src/sonic-utilities index 3af8ba4acc2b..0a7557bd9162 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 3af8ba4acc2bbc77d17be0d67943703021c7d1e1 +Subproject commit 0a7557bd9162eae40f5d4c4f6fbab92dbad7204b