diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index d21a6066a01..09a46573fe0 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 52bff4aa9e5..43db5720a3d 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/.azure-pipelines/docker-sonic-mgmt.yml b/.azure-pipelines/docker-sonic-mgmt.yml index 35d12f12234..34adf9d5d48 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/.azure-pipelines/docker-sonic-slave-template.yml b/.azure-pipelines/docker-sonic-slave-template.yml index 142ff5fa3f6..063f7545311 100644 --- a/.azure-pipelines/docker-sonic-slave-template.yml +++ b/.azure-pipelines/docker-sonic-slave-template.yml @@ -35,7 +35,7 @@ parameters: - sonicbld-armhf jobs: -- job: Build_${{ parameters.dist }}_${{ parameters.march }}${{ parameters.arch }} +- job: sonic_slave_${{ parameters.dist }}${{ parameters.march }} timeoutInMinutes: 360 variables: - template: /.azure-pipelines/template-variables.yml@buildimage @@ -46,7 +46,6 @@ jobs: - template: /.azure-pipelines/template-clean-sonic-slave.yml@buildimage - checkout: self clean: true - submodules: recursive - task: Docker@2 displayName: Login to ACR inputs: @@ -54,22 +53,29 @@ 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 }}:/') + fi + image_branch=$(echo $(echo $image_latest | awk -F: '{print$1}'):$(Build.SourceBranchName)) docker rmi $image_tag || true if [[ "$(Build.Reason)" =~ [a-zA-Z]*CI ]] && docker pull ${{ parameters.registry_url }}/${image_tag};then 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 docker tag ${image_tag} ${REGISTRY_SERVER}/${image_tag} docker push ${REGISTRY_SERVER}/${image_tag} - if [[ "${{ parameters.arch }}" == "amd64" ]];then + docker tag ${image_tag} ${REGISTRY_SERVER}/${image_branch} + docker push ${REGISTRY_SERVER}/${image_branch} + if [[ "$(Build.SourceBranchName)" == "master" ]];then docker tag ${image_tag} ${REGISTRY_SERVER}/${image_latest} docker push ${REGISTRY_SERVER}/${image_latest} fi diff --git a/.azure-pipelines/docker-sonic-slave.yml b/.azure-pipelines/docker-sonic-slave.yml index 833a0d9606e..4c679f7f951 100644 --- a/.azure-pipelines/docker-sonic-slave.yml +++ b/.azure-pipelines/docker-sonic-slave.yml @@ -56,7 +56,7 @@ parameters: default: sonicdev stages: -- stage: Build +- stage: Build_in_amd64 jobs: - ${{ each dist in parameters.dists }}: - ${{ if endswith(variables['Build.DefinitionName'], dist) }}: @@ -66,7 +66,9 @@ stages: pool: sonicbld arch: ${{ arch }} dist: ${{ dist }} -- stage: Build_march + ${{ if ne(arch, 'amd64') }}: + march: _march_${{ arch }} +- stage: Build_native_arm dependsOn: [] jobs: - ${{ each dist in parameters.dists }}: @@ -78,4 +80,4 @@ stages: pool: sonicbld-${{ arch }} arch: ${{ arch }} dist: ${{ dist }} - march: march_ + march: _${{ arch }} diff --git a/.azure-pipelines/run-test-scheduler-template.yml b/.azure-pipelines/run-test-scheduler-template.yml index fc6b2d12205..ad5a1b1c6ef 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) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5a3aad7b8f6..f553a042f9a 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 diff --git a/.github/workflows/pr_cherrypick_poststep.yml b/.github/workflows/pr_cherrypick_poststep.yml index 1e9e497075d..7be0b7d7cbe 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,Request for ${base_ref} Branch,Approved for ${base_ref} Branch" + gh pr edit $origin_pr_url --remove-label "Created PR to ${base_ref} Branch,Approved for ${base_ref} Branch" diff --git a/Makefile.work b/Makefile.work index 6f57130b6ab..71e83e9eb1b 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 @@ -485,7 +486,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) \ @@ -534,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/build_debian.sh b/build_debian.sh index 3668e627330..7c83d28b510 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -123,6 +123,8 @@ echo '[INFO] Install and setup eatmydata' sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install eatmydata sudo LANG=C chroot $FILESYSTEM_ROOT ln -s /usr/bin/eatmydata /usr/local/bin/dpkg echo 'Dir::Bin::dpkg "/usr/local/bin/dpkg";' | sudo tee $FILESYSTEM_ROOT/etc/apt/apt.conf.d/00image-install-eatmydata > /dev/null +## Note: dpkg hook conflict with eatmydata +sudo LANG=C chroot $FILESYSTEM_ROOT rm /usr/local/sbin/dpkg -f echo '[INFO] Install packages for building image' sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install makedev psmisc @@ -281,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/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py index b19fab85deb..fdbd0f46a06 100644 --- a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py @@ -1,8 +1,8 @@ import os import struct -import subprocess from mmap import * from sonic_py_common import device_info +from sonic_py_common.general import getstatusoutput_noshell HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,11 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return subprocess.call(HOST_CHK_CMD) == 0 + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False def pci_get_value(self, resource, offset): status = True diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py index b19fab85deb..fdbd0f46a06 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py @@ -1,8 +1,8 @@ import os import struct -import subprocess from mmap import * from sonic_py_common import device_info +from sonic_py_common.general import getstatusoutput_noshell HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,11 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return subprocess.call(HOST_CHK_CMD) == 0 + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False def pci_get_value(self, resource, offset): status = True diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py index b19fab85deb..fdbd0f46a06 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py @@ -1,8 +1,8 @@ import os import struct -import subprocess from mmap import * from sonic_py_common import device_info +from sonic_py_common.general import getstatusoutput_noshell HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,11 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return subprocess.call(HOST_CHK_CMD) == 0 + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False def pci_get_value(self, resource, offset): status = True diff --git a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/helper.py index 2c644ecbfb8..ea73a06253d 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/helper.py @@ -1,8 +1,8 @@ import os import struct -import subprocess from mmap import * from sonic_py_common import device_info +from sonic_py_common.general import getstatusoutput_noshell HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,11 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return subprocess.call(HOST_CHK_CMD) == 0 + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False def pci_get_value(self, resource, offset): status = True diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py index b19fab85deb..fdbd0f46a06 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py @@ -1,8 +1,8 @@ import os import struct -import subprocess from mmap import * from sonic_py_common import device_info +from sonic_py_common.general import getstatusoutput_noshell HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,11 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return subprocess.call(HOST_CHK_CMD) == 0 + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False def pci_get_value(self, resource, offset): status = True diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/helper.py index 2c644ecbfb8..ea73a06253d 100644 --- a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/helper.py @@ -1,8 +1,8 @@ import os import struct -import subprocess from mmap import * from sonic_py_common import device_info +from sonic_py_common.general import getstatusoutput_noshell HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,11 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return subprocess.call(HOST_CHK_CMD) == 0 + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False def pci_get_value(self, resource, offset): status = True 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 7ce532554f9..cd1f77a2778 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 e7c8d3bc1e2..67d381d9731 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 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/BALANCED b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/BALANCED new file mode 120000 index 00000000000..a270c70ffc3 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/RDMA-CENTRIC b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/RDMA-CENTRIC new file mode 120000 index 00000000000..8d1ec6d277a --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/RDMA-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/TCP-CENTRIC b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/TCP-CENTRIC new file mode 120000 index 00000000000..7ee783aac6a --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/TCP-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffer_ports_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffer_ports_t0.j2 new file mode 100644 index 00000000000..a6506c3c30d --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffer_ports_t0.j2 @@ -0,0 +1,17 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(2,12) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(20,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(0,2) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(12,20) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers.json.j2 new file mode 100644 index 00000000000..e6e9e844469 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_defaults_t0.j2 new file mode 120000 index 00000000000..9524e6a476a --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_extra_queues.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_extra_queues.j2 new file mode 120000 index 00000000000..92b7e9ffbee --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_extra_queues.j2 @@ -0,0 +1 @@ +../Arista-7260CX3-C64/buffers_extra_queues.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_pool_sizes_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_pool_sizes_t0.j2 new file mode 120000 index 00000000000..72e16a60826 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/buffers_pool_sizes_t0.j2 @@ -0,0 +1 @@ +../Arista-7260CX3-C64/buffers_pool_sizes_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/config.bcm.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/config.bcm.j2 new file mode 100644 index 00000000000..2255d7149b6 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/config.bcm.j2 @@ -0,0 +1,951 @@ +{# Construct config.bcm to include additional soc properties per specific device metadata requirement #} +{%- set IPinIP_sock = '' -%} +{%- set map_prio = '' -%} +{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['subtype'] is defined -%} +{%- set switch_subtype = DEVICE_METADATA['localhost']['subtype'] -%} +{%- if 'dualtor' in switch_subtype.lower() %} +{%- set IPinIP_sock = 'sai_tunnel_support=1 + sai_tunnel_underlay_route_mode=1 + host_as_route_disable=1 + l3_ecmp_levels=2' -%} +{%- set map_prio = 'sai_remap_prio_on_tnl_egress=1' -%} +{%- endif %} +{%- endif %} +{# The following is the common soc properties that used to be named "th2-a7260cx3-64-112x50G+8x100G.config.bcm" #} +l3_alpm_hit_skip=1 +sai_adjust_acl_drop_in_rx_drop=1 +{{ map_prio }} +PHY_AN_ALLOW_PLL_CHANGE=1 +arl_clean_timeout_usec=15000000 +asf_mem_profile=2 +bcm_num_cos=10 +bcm_stat_flags=1 +bcm_stat_jumbo=9236 +cdma_timeout_usec=15000000 +core_clock_frequency=1700 +dma_desc_timeout_usec=15000000 +dpp_clock_ratio=2:3 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +mem_scan_enable=1 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +pbmp_xport_xe=0xfffffffd3fffffff4fffffffc7ffffffe +#pbmp_xport_xe=0x47fffffff1fffffffcfffffffe7ffffffe +phy_an_allow_pll_change_hg=0 +phy_an_c73=1 +phy_chain_rx_lane_map_physical{1.0}=0x3210 +phy_chain_rx_lane_map_physical{101.0}=0x0123 +phy_chain_rx_lane_map_physical{105.0}=0x0123 +phy_chain_rx_lane_map_physical{109.0}=0x0123 +phy_chain_rx_lane_map_physical{113.0}=0x2301 +phy_chain_rx_lane_map_physical{117.0}=0x3210 +phy_chain_rx_lane_map_physical{121.0}=0x3210 +phy_chain_rx_lane_map_physical{125.0}=0x1203 +phy_chain_rx_lane_map_physical{129.0}=0x3210 +phy_chain_rx_lane_map_physical{13.0}=0x0321 +phy_chain_rx_lane_map_physical{133.0}=0x1032 +phy_chain_rx_lane_map_physical{137.0}=0x3210 +phy_chain_rx_lane_map_physical{141.0}=0x0123 +phy_chain_rx_lane_map_physical{145.0}=0x3210 +phy_chain_rx_lane_map_physical{149.0}=0x2310 +phy_chain_rx_lane_map_physical{153.0}=0x0132 +phy_chain_rx_lane_map_physical{157.0}=0x1302 +phy_chain_rx_lane_map_physical{161.0}=0x3021 +phy_chain_rx_lane_map_physical{165.0}=0x2031 +phy_chain_rx_lane_map_physical{169.0}=0x2031 +phy_chain_rx_lane_map_physical{17.0}=0x3210 +phy_chain_rx_lane_map_physical{173.0}=0x1302 +phy_chain_rx_lane_map_physical{177.0}=0x2031 +phy_chain_rx_lane_map_physical{181.0}=0x0213 +phy_chain_rx_lane_map_physical{185.0}=0x0213 +phy_chain_rx_lane_map_physical{189.0}=0x1302 +phy_chain_rx_lane_map_physical{193.0}=0x3120 +phy_chain_rx_lane_map_physical{197.0}=0x0231 +phy_chain_rx_lane_map_physical{201.0}=0x2031 +phy_chain_rx_lane_map_physical{205.0}=0x0213 +phy_chain_rx_lane_map_physical{209.0}=0x2013 +phy_chain_rx_lane_map_physical{21.0}=0x3021 +phy_chain_rx_lane_map_physical{213.0}=0x3021 +phy_chain_rx_lane_map_physical{217.0}=0x0231 +phy_chain_rx_lane_map_physical{221.0}=0x2031 +phy_chain_rx_lane_map_physical{225.0}=0x1203 +phy_chain_rx_lane_map_physical{229.0}=0x1230 +phy_chain_rx_lane_map_physical{233.0}=0x3021 +phy_chain_rx_lane_map_physical{237.0}=0x1032 +phy_chain_rx_lane_map_physical{241.0}=0x2301 +phy_chain_rx_lane_map_physical{245.0}=0x0321 +phy_chain_rx_lane_map_physical{249.0}=0x2301 +phy_chain_rx_lane_map_physical{25.0}=0x2301 +phy_chain_rx_lane_map_physical{253.0}=0x2301 +phy_chain_rx_lane_map_physical{257.0}=0x3210 +phy_chain_rx_lane_map_physical{29.0}=0x3021 +phy_chain_rx_lane_map_physical{33.0}=0x1302 +phy_chain_rx_lane_map_physical{37.0}=0x2031 +phy_chain_rx_lane_map_physical{41.0}=0x3021 +phy_chain_rx_lane_map_physical{45.0}=0x1023 +phy_chain_rx_lane_map_physical{49.0}=0x0213 +phy_chain_rx_lane_map_physical{5.0}=0x3201 +phy_chain_rx_lane_map_physical{53.0}=0x3201 +phy_chain_rx_lane_map_physical{57.0}=0x2013 +phy_chain_rx_lane_map_physical{61.0}=0x0213 +phy_chain_rx_lane_map_physical{65.0}=0x1203 +phy_chain_rx_lane_map_physical{69.0}=0x0213 +phy_chain_rx_lane_map_physical{73.0}=0x0213 +phy_chain_rx_lane_map_physical{77.0}=0x3120 +phy_chain_rx_lane_map_physical{81.0}=0x0213 +phy_chain_rx_lane_map_physical{85.0}=0x2031 +phy_chain_rx_lane_map_physical{89.0}=0x2031 +phy_chain_rx_lane_map_physical{9.0}=0x0321 +phy_chain_rx_lane_map_physical{93.0}=0x3120 +phy_chain_rx_lane_map_physical{97.0}=0x1203 +phy_chain_rx_polarity_flip_physical{1.0}=0x1 +phy_chain_rx_polarity_flip_physical{10.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x1 +phy_chain_rx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{102.0}=0x0 +phy_chain_rx_polarity_flip_physical{103.0}=0x1 +phy_chain_rx_polarity_flip_physical{104.0}=0x0 +phy_chain_rx_polarity_flip_physical{105.0}=0x1 +phy_chain_rx_polarity_flip_physical{106.0}=0x0 +phy_chain_rx_polarity_flip_physical{107.0}=0x1 +phy_chain_rx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_polarity_flip_physical{109.0}=0x0 +phy_chain_rx_polarity_flip_physical{11.0}=0x1 +phy_chain_rx_polarity_flip_physical{110.0}=0x1 +phy_chain_rx_polarity_flip_physical{111.0}=0x0 +phy_chain_rx_polarity_flip_physical{112.0}=0x1 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{114.0}=0x0 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_polarity_flip_physical{117.0}=0x0 +phy_chain_rx_polarity_flip_physical{118.0}=0x0 +phy_chain_rx_polarity_flip_physical{119.0}=0x1 +phy_chain_rx_polarity_flip_physical{12.0}=0x1 +phy_chain_rx_polarity_flip_physical{120.0}=0x0 +phy_chain_rx_polarity_flip_physical{121.0}=0x1 +phy_chain_rx_polarity_flip_physical{122.0}=0x0 +phy_chain_rx_polarity_flip_physical{123.0}=0x1 +phy_chain_rx_polarity_flip_physical{124.0}=0x0 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x1 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{128.0}=0x1 +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_rx_polarity_flip_physical{130.0}=0x1 +phy_chain_rx_polarity_flip_physical{131.0}=0x1 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 +phy_chain_rx_polarity_flip_physical{133.0}=0x1 +phy_chain_rx_polarity_flip_physical{134.0}=0x1 +phy_chain_rx_polarity_flip_physical{135.0}=0x1 +phy_chain_rx_polarity_flip_physical{136.0}=0x0 +phy_chain_rx_polarity_flip_physical{137.0}=0x0 +phy_chain_rx_polarity_flip_physical{138.0}=0x0 +phy_chain_rx_polarity_flip_physical{139.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{140.0}=0x0 +phy_chain_rx_polarity_flip_physical{141.0}=0x1 +phy_chain_rx_polarity_flip_physical{142.0}=0x0 +phy_chain_rx_polarity_flip_physical{143.0}=0x1 +phy_chain_rx_polarity_flip_physical{144.0}=0x0 +phy_chain_rx_polarity_flip_physical{145.0}=0x1 +phy_chain_rx_polarity_flip_physical{146.0}=0x0 +phy_chain_rx_polarity_flip_physical{147.0}=0x1 +phy_chain_rx_polarity_flip_physical{148.0}=0x0 +phy_chain_rx_polarity_flip_physical{149.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{150.0}=0x1 +phy_chain_rx_polarity_flip_physical{151.0}=0x1 +phy_chain_rx_polarity_flip_physical{152.0}=0x0 +phy_chain_rx_polarity_flip_physical{153.0}=0x0 +phy_chain_rx_polarity_flip_physical{154.0}=0x1 +phy_chain_rx_polarity_flip_physical{155.0}=0x1 +phy_chain_rx_polarity_flip_physical{156.0}=0x0 +phy_chain_rx_polarity_flip_physical{157.0}=0x0 +phy_chain_rx_polarity_flip_physical{158.0}=0x0 +phy_chain_rx_polarity_flip_physical{159.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{160.0}=0x0 +phy_chain_rx_polarity_flip_physical{161.0}=0x1 +phy_chain_rx_polarity_flip_physical{162.0}=0x1 +phy_chain_rx_polarity_flip_physical{163.0}=0x0 +phy_chain_rx_polarity_flip_physical{164.0}=0x1 +phy_chain_rx_polarity_flip_physical{165.0}=0x0 +phy_chain_rx_polarity_flip_physical{166.0}=0x0 +phy_chain_rx_polarity_flip_physical{167.0}=0x1 +phy_chain_rx_polarity_flip_physical{168.0}=0x1 +phy_chain_rx_polarity_flip_physical{169.0}=0x1 +phy_chain_rx_polarity_flip_physical{17.0}=0x1 +phy_chain_rx_polarity_flip_physical{170.0}=0x1 +phy_chain_rx_polarity_flip_physical{171.0}=0x0 +phy_chain_rx_polarity_flip_physical{172.0}=0x0 +phy_chain_rx_polarity_flip_physical{173.0}=0x0 +phy_chain_rx_polarity_flip_physical{174.0}=0x0 +phy_chain_rx_polarity_flip_physical{175.0}=0x1 +phy_chain_rx_polarity_flip_physical{176.0}=0x1 +phy_chain_rx_polarity_flip_physical{177.0}=0x1 +phy_chain_rx_polarity_flip_physical{178.0}=0x1 +phy_chain_rx_polarity_flip_physical{179.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x0 +phy_chain_rx_polarity_flip_physical{180.0}=0x0 +phy_chain_rx_polarity_flip_physical{181.0}=0x1 +phy_chain_rx_polarity_flip_physical{182.0}=0x1 +phy_chain_rx_polarity_flip_physical{183.0}=0x0 +phy_chain_rx_polarity_flip_physical{184.0}=0x0 +phy_chain_rx_polarity_flip_physical{185.0}=0x0 +phy_chain_rx_polarity_flip_physical{186.0}=0x0 +phy_chain_rx_polarity_flip_physical{187.0}=0x1 +phy_chain_rx_polarity_flip_physical{188.0}=0x1 +phy_chain_rx_polarity_flip_physical{189.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x1 +phy_chain_rx_polarity_flip_physical{190.0}=0x0 +phy_chain_rx_polarity_flip_physical{191.0}=0x1 +phy_chain_rx_polarity_flip_physical{192.0}=0x0 +phy_chain_rx_polarity_flip_physical{193.0}=0x0 +phy_chain_rx_polarity_flip_physical{194.0}=0x0 +phy_chain_rx_polarity_flip_physical{195.0}=0x1 +phy_chain_rx_polarity_flip_physical{196.0}=0x1 +phy_chain_rx_polarity_flip_physical{197.0}=0x1 +phy_chain_rx_polarity_flip_physical{198.0}=0x1 +phy_chain_rx_polarity_flip_physical{199.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{20.0}=0x0 +phy_chain_rx_polarity_flip_physical{200.0}=0x0 +phy_chain_rx_polarity_flip_physical{201.0}=0x0 +phy_chain_rx_polarity_flip_physical{202.0}=0x0 +phy_chain_rx_polarity_flip_physical{203.0}=0x1 +phy_chain_rx_polarity_flip_physical{204.0}=0x0 +phy_chain_rx_polarity_flip_physical{205.0}=0x1 +phy_chain_rx_polarity_flip_physical{206.0}=0x1 +phy_chain_rx_polarity_flip_physical{207.0}=0x0 +phy_chain_rx_polarity_flip_physical{208.0}=0x0 +phy_chain_rx_polarity_flip_physical{209.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{210.0}=0x1 +phy_chain_rx_polarity_flip_physical{211.0}=0x0 +phy_chain_rx_polarity_flip_physical{212.0}=0x0 +phy_chain_rx_polarity_flip_physical{213.0}=0x0 +phy_chain_rx_polarity_flip_physical{214.0}=0x0 +phy_chain_rx_polarity_flip_physical{215.0}=0x1 +phy_chain_rx_polarity_flip_physical{216.0}=0x0 +phy_chain_rx_polarity_flip_physical{217.0}=0x0 +phy_chain_rx_polarity_flip_physical{218.0}=0x0 +phy_chain_rx_polarity_flip_physical{219.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{220.0}=0x1 +phy_chain_rx_polarity_flip_physical{221.0}=0x0 +phy_chain_rx_polarity_flip_physical{222.0}=0x0 +phy_chain_rx_polarity_flip_physical{223.0}=0x1 +phy_chain_rx_polarity_flip_physical{224.0}=0x1 +phy_chain_rx_polarity_flip_physical{225.0}=0x1 +phy_chain_rx_polarity_flip_physical{226.0}=0x0 +phy_chain_rx_polarity_flip_physical{227.0}=0x0 +phy_chain_rx_polarity_flip_physical{228.0}=0x1 +phy_chain_rx_polarity_flip_physical{229.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{230.0}=0x0 +phy_chain_rx_polarity_flip_physical{231.0}=0x1 +phy_chain_rx_polarity_flip_physical{232.0}=0x1 +phy_chain_rx_polarity_flip_physical{233.0}=0x1 +phy_chain_rx_polarity_flip_physical{234.0}=0x0 +phy_chain_rx_polarity_flip_physical{235.0}=0x0 +phy_chain_rx_polarity_flip_physical{236.0}=0x0 +phy_chain_rx_polarity_flip_physical{237.0}=0x1 +phy_chain_rx_polarity_flip_physical{238.0}=0x0 +phy_chain_rx_polarity_flip_physical{239.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_polarity_flip_physical{240.0}=0x0 +phy_chain_rx_polarity_flip_physical{241.0}=0x1 +phy_chain_rx_polarity_flip_physical{242.0}=0x0 +phy_chain_rx_polarity_flip_physical{243.0}=0x1 +phy_chain_rx_polarity_flip_physical{244.0}=0x0 +phy_chain_rx_polarity_flip_physical{245.0}=0x1 +phy_chain_rx_polarity_flip_physical{246.0}=0x1 +phy_chain_rx_polarity_flip_physical{247.0}=0x1 +phy_chain_rx_polarity_flip_physical{248.0}=0x0 +phy_chain_rx_polarity_flip_physical{249.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x1 +phy_chain_rx_polarity_flip_physical{250.0}=0x1 +phy_chain_rx_polarity_flip_physical{251.0}=0x0 +phy_chain_rx_polarity_flip_physical{252.0}=0x1 +phy_chain_rx_polarity_flip_physical{253.0}=0x1 +phy_chain_rx_polarity_flip_physical{254.0}=0x0 +phy_chain_rx_polarity_flip_physical{255.0}=0x1 +phy_chain_rx_polarity_flip_physical{256.0}=0x0 +phy_chain_rx_polarity_flip_physical{257.0}=0x0 +phy_chain_rx_polarity_flip_physical{259.0}=0x0 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x1 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 +phy_chain_rx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x0 +phy_chain_rx_polarity_flip_physical{35.0}=0x1 +phy_chain_rx_polarity_flip_physical{36.0}=0x1 +phy_chain_rx_polarity_flip_physical{37.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x1 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x1 +phy_chain_rx_polarity_flip_physical{44.0}=0x1 +phy_chain_rx_polarity_flip_physical{45.0}=0x1 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x1 +phy_chain_rx_polarity_flip_physical{49.0}=0x1 +phy_chain_rx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_rx_polarity_flip_physical{53.0}=0x0 +phy_chain_rx_polarity_flip_physical{54.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x1 +phy_chain_rx_polarity_flip_physical{56.0}=0x0 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x0 +phy_chain_rx_polarity_flip_physical{59.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x1 +phy_chain_rx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_rx_polarity_flip_physical{64.0}=0x1 +phy_chain_rx_polarity_flip_physical{65.0}=0x1 +phy_chain_rx_polarity_flip_physical{66.0}=0x1 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x1 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_rx_polarity_flip_physical{73.0}=0x1 +phy_chain_rx_polarity_flip_physical{74.0}=0x1 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x0 +phy_chain_rx_polarity_flip_physical{77.0}=0x0 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{79.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_polarity_flip_physical{81.0}=0x1 +phy_chain_rx_polarity_flip_physical{82.0}=0x1 +phy_chain_rx_polarity_flip_physical{83.0}=0x0 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 +phy_chain_rx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{86.0}=0x1 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{89.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x1 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x1 +phy_chain_rx_polarity_flip_physical{92.0}=0x1 +phy_chain_rx_polarity_flip_physical{93.0}=0x0 +phy_chain_rx_polarity_flip_physical{94.0}=0x0 +phy_chain_rx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{96.0}=0x0 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{98.0}=0x1 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_lane_map_physical{1.0}=0x2031 +phy_chain_tx_lane_map_physical{101.0}=0x1023 +phy_chain_tx_lane_map_physical{105.0}=0x1302 +phy_chain_tx_lane_map_physical{109.0}=0x0321 +phy_chain_tx_lane_map_physical{113.0}=0x2301 +phy_chain_tx_lane_map_physical{117.0}=0x3120 +phy_chain_tx_lane_map_physical{121.0}=0x3102 +phy_chain_tx_lane_map_physical{125.0}=0x3210 +phy_chain_tx_lane_map_physical{129.0}=0x1023 +phy_chain_tx_lane_map_physical{13.0}=0x3021 +phy_chain_tx_lane_map_physical{133.0}=0x3210 +phy_chain_tx_lane_map_physical{137.0}=0x2031 +phy_chain_tx_lane_map_physical{141.0}=0x1302 +phy_chain_tx_lane_map_physical{145.0}=0x3210 +phy_chain_tx_lane_map_physical{149.0}=0x0213 +phy_chain_tx_lane_map_physical{153.0}=0x3210 +phy_chain_tx_lane_map_physical{157.0}=0x1320 +phy_chain_tx_lane_map_physical{161.0}=0x3210 +phy_chain_tx_lane_map_physical{165.0}=0x0231 +phy_chain_tx_lane_map_physical{169.0}=0x3120 +phy_chain_tx_lane_map_physical{17.0}=0x1032 +phy_chain_tx_lane_map_physical{173.0}=0x0312 +phy_chain_tx_lane_map_physical{177.0}=0x0231 +phy_chain_tx_lane_map_physical{181.0}=0x3210 +phy_chain_tx_lane_map_physical{185.0}=0x3210 +phy_chain_tx_lane_map_physical{189.0}=0x1320 +phy_chain_tx_lane_map_physical{193.0}=0x0321 +phy_chain_tx_lane_map_physical{197.0}=0x3120 +phy_chain_tx_lane_map_physical{201.0}=0x3120 +phy_chain_tx_lane_map_physical{205.0}=0x0123 +phy_chain_tx_lane_map_physical{209.0}=0x3120 +phy_chain_tx_lane_map_physical{21.0}=0x0213 +phy_chain_tx_lane_map_physical{213.0}=0x3021 +phy_chain_tx_lane_map_physical{217.0}=0x0312 +phy_chain_tx_lane_map_physical{221.0}=0x2301 +phy_chain_tx_lane_map_physical{225.0}=0x0123 +phy_chain_tx_lane_map_physical{229.0}=0x2031 +phy_chain_tx_lane_map_physical{233.0}=0x0231 +phy_chain_tx_lane_map_physical{237.0}=0x0213 +phy_chain_tx_lane_map_physical{241.0}=0x1320 +phy_chain_tx_lane_map_physical{245.0}=0x2031 +phy_chain_tx_lane_map_physical{249.0}=0x3120 +phy_chain_tx_lane_map_physical{25.0}=0x0231 +phy_chain_tx_lane_map_physical{253.0}=0x0321 +phy_chain_tx_lane_map_physical{257.0}=0x3210 +phy_chain_tx_lane_map_physical{29.0}=0x1230 +phy_chain_tx_lane_map_physical{33.0}=0x1032 +phy_chain_tx_lane_map_physical{37.0}=0x0123 +phy_chain_tx_lane_map_physical{41.0}=0x0213 +phy_chain_tx_lane_map_physical{45.0}=0x0132 +phy_chain_tx_lane_map_physical{49.0}=0x2031 +phy_chain_tx_lane_map_physical{5.0}=0x2301 +phy_chain_tx_lane_map_physical{53.0}=0x2301 +phy_chain_tx_lane_map_physical{57.0}=0x2031 +phy_chain_tx_lane_map_physical{61.0}=0x2031 +phy_chain_tx_lane_map_physical{65.0}=0x1230 +phy_chain_tx_lane_map_physical{69.0}=0x2013 +phy_chain_tx_lane_map_physical{73.0}=0x0213 +phy_chain_tx_lane_map_physical{77.0}=0x2310 +phy_chain_tx_lane_map_physical{81.0}=0x0321 +phy_chain_tx_lane_map_physical{85.0}=0x2013 +phy_chain_tx_lane_map_physical{89.0}=0x0213 +phy_chain_tx_lane_map_physical{9.0}=0x3012 +phy_chain_tx_lane_map_physical{93.0}=0x3102 +phy_chain_tx_lane_map_physical{97.0}=0x3210 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x1 +phy_chain_tx_polarity_flip_physical{103.0}=0x0 +phy_chain_tx_polarity_flip_physical{104.0}=0x0 +phy_chain_tx_polarity_flip_physical{105.0}=0x0 +phy_chain_tx_polarity_flip_physical{106.0}=0x1 +phy_chain_tx_polarity_flip_physical{107.0}=0x1 +phy_chain_tx_polarity_flip_physical{108.0}=0x1 +phy_chain_tx_polarity_flip_physical{109.0}=0x0 +phy_chain_tx_polarity_flip_physical{11.0}=0x1 +phy_chain_tx_polarity_flip_physical{110.0}=0x0 +phy_chain_tx_polarity_flip_physical{111.0}=0x0 +phy_chain_tx_polarity_flip_physical{112.0}=0x1 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x1 +phy_chain_tx_polarity_flip_physical{115.0}=0x1 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_tx_polarity_flip_physical{117.0}=0x1 +phy_chain_tx_polarity_flip_physical{118.0}=0x0 +phy_chain_tx_polarity_flip_physical{119.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{120.0}=0x0 +phy_chain_tx_polarity_flip_physical{121.0}=0x0 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x1 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x1 +phy_chain_tx_polarity_flip_physical{127.0}=0x1 +phy_chain_tx_polarity_flip_physical{128.0}=0x1 +phy_chain_tx_polarity_flip_physical{129.0}=0x1 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{130.0}=0x0 +phy_chain_tx_polarity_flip_physical{131.0}=0x1 +phy_chain_tx_polarity_flip_physical{132.0}=0x0 +phy_chain_tx_polarity_flip_physical{133.0}=0x1 +phy_chain_tx_polarity_flip_physical{134.0}=0x1 +phy_chain_tx_polarity_flip_physical{135.0}=0x1 +phy_chain_tx_polarity_flip_physical{136.0}=0x1 +phy_chain_tx_polarity_flip_physical{137.0}=0x1 +phy_chain_tx_polarity_flip_physical{138.0}=0x1 +phy_chain_tx_polarity_flip_physical{139.0}=0x1 +phy_chain_tx_polarity_flip_physical{14.0}=0x1 +phy_chain_tx_polarity_flip_physical{140.0}=0x1 +phy_chain_tx_polarity_flip_physical{141.0}=0x0 +phy_chain_tx_polarity_flip_physical{142.0}=0x1 +phy_chain_tx_polarity_flip_physical{143.0}=0x1 +phy_chain_tx_polarity_flip_physical{144.0}=0x1 +phy_chain_tx_polarity_flip_physical{145.0}=0x1 +phy_chain_tx_polarity_flip_physical{146.0}=0x1 +phy_chain_tx_polarity_flip_physical{147.0}=0x1 +phy_chain_tx_polarity_flip_physical{148.0}=0x0 +phy_chain_tx_polarity_flip_physical{149.0}=0x1 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{150.0}=0x0 +phy_chain_tx_polarity_flip_physical{151.0}=0x0 +phy_chain_tx_polarity_flip_physical{152.0}=0x0 +phy_chain_tx_polarity_flip_physical{153.0}=0x1 +phy_chain_tx_polarity_flip_physical{154.0}=0x0 +phy_chain_tx_polarity_flip_physical{155.0}=0x0 +phy_chain_tx_polarity_flip_physical{156.0}=0x0 +phy_chain_tx_polarity_flip_physical{157.0}=0x0 +phy_chain_tx_polarity_flip_physical{158.0}=0x0 +phy_chain_tx_polarity_flip_physical{159.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{160.0}=0x0 +phy_chain_tx_polarity_flip_physical{161.0}=0x0 +phy_chain_tx_polarity_flip_physical{162.0}=0x1 +phy_chain_tx_polarity_flip_physical{163.0}=0x1 +phy_chain_tx_polarity_flip_physical{164.0}=0x0 +phy_chain_tx_polarity_flip_physical{165.0}=0x1 +phy_chain_tx_polarity_flip_physical{166.0}=0x1 +phy_chain_tx_polarity_flip_physical{167.0}=0x1 +phy_chain_tx_polarity_flip_physical{168.0}=0x0 +phy_chain_tx_polarity_flip_physical{169.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{170.0}=0x1 +phy_chain_tx_polarity_flip_physical{171.0}=0x1 +phy_chain_tx_polarity_flip_physical{172.0}=0x1 +phy_chain_tx_polarity_flip_physical{173.0}=0x0 +phy_chain_tx_polarity_flip_physical{174.0}=0x0 +phy_chain_tx_polarity_flip_physical{175.0}=0x1 +phy_chain_tx_polarity_flip_physical{176.0}=0x0 +phy_chain_tx_polarity_flip_physical{177.0}=0x1 +phy_chain_tx_polarity_flip_physical{178.0}=0x0 +phy_chain_tx_polarity_flip_physical{179.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x1 +phy_chain_tx_polarity_flip_physical{180.0}=0x0 +phy_chain_tx_polarity_flip_physical{181.0}=0x0 +phy_chain_tx_polarity_flip_physical{182.0}=0x0 +phy_chain_tx_polarity_flip_physical{183.0}=0x0 +phy_chain_tx_polarity_flip_physical{184.0}=0x1 +phy_chain_tx_polarity_flip_physical{185.0}=0x0 +phy_chain_tx_polarity_flip_physical{186.0}=0x1 +phy_chain_tx_polarity_flip_physical{187.0}=0x1 +phy_chain_tx_polarity_flip_physical{188.0}=0x1 +phy_chain_tx_polarity_flip_physical{189.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{190.0}=0x0 +phy_chain_tx_polarity_flip_physical{191.0}=0x0 +phy_chain_tx_polarity_flip_physical{192.0}=0x0 +phy_chain_tx_polarity_flip_physical{193.0}=0x1 +phy_chain_tx_polarity_flip_physical{194.0}=0x1 +phy_chain_tx_polarity_flip_physical{195.0}=0x1 +phy_chain_tx_polarity_flip_physical{196.0}=0x0 +phy_chain_tx_polarity_flip_physical{197.0}=0x0 +phy_chain_tx_polarity_flip_physical{198.0}=0x1 +phy_chain_tx_polarity_flip_physical{199.0}=0x1 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x1 +phy_chain_tx_polarity_flip_physical{200.0}=0x1 +phy_chain_tx_polarity_flip_physical{201.0}=0x1 +phy_chain_tx_polarity_flip_physical{202.0}=0x1 +phy_chain_tx_polarity_flip_physical{203.0}=0x1 +phy_chain_tx_polarity_flip_physical{204.0}=0x1 +phy_chain_tx_polarity_flip_physical{205.0}=0x0 +phy_chain_tx_polarity_flip_physical{206.0}=0x1 +phy_chain_tx_polarity_flip_physical{207.0}=0x1 +phy_chain_tx_polarity_flip_physical{208.0}=0x1 +phy_chain_tx_polarity_flip_physical{209.0}=0x1 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{210.0}=0x1 +phy_chain_tx_polarity_flip_physical{211.0}=0x1 +phy_chain_tx_polarity_flip_physical{212.0}=0x0 +phy_chain_tx_polarity_flip_physical{213.0}=0x0 +phy_chain_tx_polarity_flip_physical{214.0}=0x1 +phy_chain_tx_polarity_flip_physical{215.0}=0x0 +phy_chain_tx_polarity_flip_physical{216.0}=0x1 +phy_chain_tx_polarity_flip_physical{217.0}=0x1 +phy_chain_tx_polarity_flip_physical{218.0}=0x1 +phy_chain_tx_polarity_flip_physical{219.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{220.0}=0x1 +phy_chain_tx_polarity_flip_physical{221.0}=0x0 +phy_chain_tx_polarity_flip_physical{222.0}=0x0 +phy_chain_tx_polarity_flip_physical{223.0}=0x0 +phy_chain_tx_polarity_flip_physical{224.0}=0x1 +phy_chain_tx_polarity_flip_physical{225.0}=0x1 +phy_chain_tx_polarity_flip_physical{226.0}=0x1 +phy_chain_tx_polarity_flip_physical{227.0}=0x1 +phy_chain_tx_polarity_flip_physical{228.0}=0x0 +phy_chain_tx_polarity_flip_physical{229.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{230.0}=0x1 +phy_chain_tx_polarity_flip_physical{231.0}=0x1 +phy_chain_tx_polarity_flip_physical{232.0}=0x1 +phy_chain_tx_polarity_flip_physical{233.0}=0x0 +phy_chain_tx_polarity_flip_physical{234.0}=0x0 +phy_chain_tx_polarity_flip_physical{235.0}=0x0 +phy_chain_tx_polarity_flip_physical{236.0}=0x0 +phy_chain_tx_polarity_flip_physical{237.0}=0x1 +phy_chain_tx_polarity_flip_physical{238.0}=0x1 +phy_chain_tx_polarity_flip_physical{239.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{240.0}=0x0 +phy_chain_tx_polarity_flip_physical{241.0}=0x1 +phy_chain_tx_polarity_flip_physical{242.0}=0x1 +phy_chain_tx_polarity_flip_physical{243.0}=0x1 +phy_chain_tx_polarity_flip_physical{244.0}=0x0 +phy_chain_tx_polarity_flip_physical{245.0}=0x1 +phy_chain_tx_polarity_flip_physical{246.0}=0x1 +phy_chain_tx_polarity_flip_physical{247.0}=0x1 +phy_chain_tx_polarity_flip_physical{248.0}=0x1 +phy_chain_tx_polarity_flip_physical{249.0}=0x1 +phy_chain_tx_polarity_flip_physical{25.0}=0x1 +phy_chain_tx_polarity_flip_physical{250.0}=0x0 +phy_chain_tx_polarity_flip_physical{251.0}=0x0 +phy_chain_tx_polarity_flip_physical{252.0}=0x0 +phy_chain_tx_polarity_flip_physical{253.0}=0x1 +phy_chain_tx_polarity_flip_physical{254.0}=0x1 +phy_chain_tx_polarity_flip_physical{255.0}=0x1 +phy_chain_tx_polarity_flip_physical{256.0}=0x0 +phy_chain_tx_polarity_flip_physical{257.0}=0x0 +phy_chain_tx_polarity_flip_physical{259.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x0 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_tx_polarity_flip_physical{28.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x1 +phy_chain_tx_polarity_flip_physical{31.0}=0x1 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x1 +phy_chain_tx_polarity_flip_physical{37.0}=0x1 +phy_chain_tx_polarity_flip_physical{38.0}=0x1 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +phy_chain_tx_polarity_flip_physical{40.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{45.0}=0x1 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x1 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x1 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x1 +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x1 +phy_chain_tx_polarity_flip_physical{55.0}=0x1 +phy_chain_tx_polarity_flip_physical{56.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +phy_chain_tx_polarity_flip_physical{61.0}=0x0 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x1 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +phy_chain_tx_polarity_flip_physical{66.0}=0x1 +phy_chain_tx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_tx_polarity_flip_physical{69.0}=0x1 +phy_chain_tx_polarity_flip_physical{7.0}=0x1 +phy_chain_tx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_tx_polarity_flip_physical{73.0}=0x1 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_tx_polarity_flip_physical{76.0}=0x0 +phy_chain_tx_polarity_flip_physical{77.0}=0x0 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x1 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_polarity_flip_physical{81.0}=0x1 +phy_chain_tx_polarity_flip_physical{82.0}=0x1 +phy_chain_tx_polarity_flip_physical{83.0}=0x1 +phy_chain_tx_polarity_flip_physical{84.0}=0x0 +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_tx_polarity_flip_physical{86.0}=0x0 +phy_chain_tx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{90.0}=0x1 +phy_chain_tx_polarity_flip_physical{91.0}=0x1 +phy_chain_tx_polarity_flip_physical{92.0}=0x0 +phy_chain_tx_polarity_flip_physical{93.0}=0x0 +phy_chain_tx_polarity_flip_physical{94.0}=0x0 +phy_chain_tx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x0 +phy_chain_tx_polarity_flip_physical{97.0}=0x0 +phy_chain_tx_polarity_flip_physical{98.0}=0x1 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 + +port_init_cl72_hg=1 + + + + + + + +robust_hash_disable_egress_vlan=1 +robust_hash_disable_mpls=1 +robust_hash_disable_vlan=1 +stable_size=0x5500000 +stable_size=0x5500000 +tdma_timeout_usec=15000000 +tslam_timeout_usec=15000000 +dport_map_direct=1 +portmap_1=5:50 +portmap_2=7:50 +portmap_3=13:50 +portmap_4=15:50 +portmap_5=25:50 +portmap_6=27:50 +portmap_7=21:50 +portmap_8=23:50 +portmap_9=37:50 +portmap_10=39:50 +portmap_11=45:50 +portmap_12=47:50 +portmap_13=57:100 +portmap_14=53:100 +portmap_15=9:50 +portmap_16=11:50 +portmap_17=1:50 +portmap_18=3:50 +portmap_19=17:50 +portmap_20=19:50 +portmap_21=29:50 +portmap_22=31:50 +portmap_23=41:50 +portmap_24=43:50 +portmap_25=33:50 +portmap_26=35:50 +portmap_27=49:50 +portmap_28=51:50 +portmap_29=61:50 +portmap_30=63:50 +portmap_34=77:100 +portmap_35=65:100 +portmap_38=85:50 +portmap_39=87:50 +portmap_40=89:50 +portmap_41=91:50 +portmap_42=109:50 +portmap_43=111:50 +portmap_44=97:50 +portmap_45=99:50 +portmap_46=117:100 +portmap_47=121:100 +portmap_48=69:50 +portmap_49=71:50 +portmap_50=73:50 +portmap_51=75:50 +portmap_52=93:50 +portmap_53=95:50 +portmap_54=81:50 +portmap_55=83:50 +portmap_56=101:50 +portmap_57=103:50 +portmap_58=105:50 +portmap_59=107:50 +portmap_60=125:50 +portmap_61=127:50 +portmap_62=113:50 +portmap_63=115:50 +portmap_66=257:10 +portmap_68=141:100 +portmap_69=133:100 +portmap_70=149:50 +portmap_71=151:50 +portmap_72=153:50 +portmap_73=155:50 +portmap_74=173:50 +portmap_75=175:50 +portmap_76=161:50 +portmap_77=163:50 +portmap_78=181:50 +portmap_79=183:50 +portmap_80=185:50 +portmap_81=187:50 +portmap_82=129:50 +portmap_83=131:50 +portmap_84=137:50 +portmap_85=139:50 +portmap_86=157:50 +portmap_87=159:50 +portmap_88=145:50 +portmap_89=147:50 +portmap_90=165:50 +portmap_91=167:50 +portmap_92=169:50 +portmap_93=171:50 +portmap_94=189:50 +portmap_95=191:50 +portmap_96=177:50 +portmap_97=179:50 +portmap_100=259:10 +portmap_102=197:100 +portmap_103=205:100 +portmap_104=217:50 +portmap_105=219:50 +portmap_106=213:50 +portmap_107=215:50 +portmap_108=229:50 +portmap_109=231:50 +portmap_110=237:50 +portmap_111=239:50 +portmap_112=249:50 +portmap_113=251:50 +portmap_114=245:50 +portmap_115=247:50 +portmap_116=201:50 +portmap_117=203:50 +portmap_118=193:50 +portmap_119=195:50 +portmap_120=209:50 +portmap_121=211:50 +portmap_122=221:50 +portmap_123=223:50 +portmap_124=233:50 +portmap_125=235:50 +portmap_126=225:50 +portmap_127=227:50 +portmap_128=241:50 +portmap_129=243:50 +portmap_130=253:50 +portmap_131=255:50 + +# tuning parameters +serdes_preemphasis_1=0x580c +serdes_preemphasis_2=0x580c +serdes_preemphasis_3=0x580c +serdes_preemphasis_4=0x580c +serdes_preemphasis_5=0x580c +serdes_preemphasis_6=0x580c +serdes_preemphasis_7=0x580c +serdes_preemphasis_8=0x580c +serdes_preemphasis_9=0x580c +serdes_preemphasis_10=0x580c +serdes_preemphasis_11=0x580c +serdes_preemphasis_12=0x580c +serdes_preemphasis_13=0x83404 +serdes_preemphasis_14=0x83404 +serdes_preemphasis_15=0x580c +serdes_preemphasis_16=0x580c +serdes_preemphasis_17=0x580c +serdes_preemphasis_18=0x580c +serdes_preemphasis_19=0x580c +serdes_preemphasis_20=0x580c +serdes_preemphasis_21=0x580c +serdes_preemphasis_22=0x580c +serdes_preemphasis_23=0x580c +serdes_preemphasis_24=0x580c +serdes_preemphasis_25=0x580c +serdes_preemphasis_26=0x580c +serdes_preemphasis_27=0x580c +serdes_preemphasis_28=0x580c +serdes_preemphasis_29=0x580c +serdes_preemphasis_30=0x580c +serdes_preemphasis_34=0xf3d05 +serdes_preemphasis_35=0xd3804 +serdes_preemphasis_38=0x580c +serdes_preemphasis_39=0x580c +serdes_preemphasis_40=0x580c +serdes_preemphasis_41=0x580c +serdes_preemphasis_42=0x580c +serdes_preemphasis_43=0x580c +serdes_preemphasis_44=0x580c +serdes_preemphasis_45=0x580c +serdes_preemphasis_46=0xb3604 +serdes_preemphasis_47=0x72b03 +serdes_preemphasis_48=0x580c +serdes_preemphasis_49=0x580c +serdes_preemphasis_50=0x580c +serdes_preemphasis_51=0x580c +serdes_preemphasis_52=0x580c +serdes_preemphasis_53=0x580c +serdes_preemphasis_54=0x580c +serdes_preemphasis_55=0x580c +serdes_preemphasis_56=0x580c +serdes_preemphasis_57=0x580c +serdes_preemphasis_58=0x580c +serdes_preemphasis_59=0x580c +serdes_preemphasis_60=0x580c +serdes_preemphasis_61=0x580c +serdes_preemphasis_62=0x580c +serdes_preemphasis_63=0x580c +serdes_preemphasis_66=0x43004 +serdes_preemphasis_68=0xf4006 +serdes_preemphasis_69=0xf4006 +serdes_preemphasis_70=0x580c +serdes_preemphasis_71=0x580c +serdes_preemphasis_72=0x580c +serdes_preemphasis_73=0x580c +serdes_preemphasis_74=0x580c +serdes_preemphasis_75=0x580c +serdes_preemphasis_76=0x580c +serdes_preemphasis_77=0x580c +serdes_preemphasis_78=0x580c +serdes_preemphasis_79=0x580c +serdes_preemphasis_80=0x580c +serdes_preemphasis_81=0x580c +serdes_preemphasis_82=0x580c +serdes_preemphasis_83=0x580c +serdes_preemphasis_84=0x580c +serdes_preemphasis_85=0x580c +serdes_preemphasis_86=0x580c +serdes_preemphasis_87=0x580c +serdes_preemphasis_88=0x580c +serdes_preemphasis_89=0x580c +serdes_preemphasis_90=0x580c +serdes_preemphasis_91=0x580c +serdes_preemphasis_92=0x580c +serdes_preemphasis_93=0x580c +serdes_preemphasis_94=0x580c +serdes_preemphasis_95=0x580c +serdes_preemphasis_96=0x580c +serdes_preemphasis_97=0x580c +serdes_preemphasis_100=0x43004 +serdes_preemphasis_102=0xf3c05 +serdes_preemphasis_103=0xf3c05 +serdes_preemphasis_104=0x580c +serdes_preemphasis_105=0x580c +serdes_preemphasis_106=0x580c +serdes_preemphasis_107=0x580c +serdes_preemphasis_108=0x580c +serdes_preemphasis_109=0x580c +serdes_preemphasis_110=0x580c +serdes_preemphasis_111=0x580c +serdes_preemphasis_112=0x580c +serdes_preemphasis_113=0x580c +serdes_preemphasis_114=0x580c +serdes_preemphasis_115=0x580c +serdes_preemphasis_116=0x580c +serdes_preemphasis_117=0x580c +serdes_preemphasis_118=0x580c +serdes_preemphasis_119=0x580c +serdes_preemphasis_120=0x580c +serdes_preemphasis_121=0x580c +serdes_preemphasis_122=0x580c +serdes_preemphasis_123=0x580c +serdes_preemphasis_124=0x580c +serdes_preemphasis_125=0x580c +serdes_preemphasis_126=0x580c +serdes_preemphasis_127=0x580c +serdes_preemphasis_128=0x580c +serdes_preemphasis_129=0x580c +serdes_preemphasis_130=0x580c +serdes_preemphasis_131=0x580c + +mmu_init_config="MSFT-TH2-Tier0" +{{ IPinIP_sock }} +phy_an_lt_msft=1 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/pg_profile_lookup.ini new file mode 120000 index 00000000000..297cddb2d22 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/port_config.ini new file mode 100644 index 00000000000..1ea0f1d505a --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/port_config.ini @@ -0,0 +1,121 @@ +# name lanes alias index speed +Ethernet0 77,78,79,80 Ethernet1/1 1 100000 +Ethernet4 65,66,67,68 Ethernet2/1 2 100000 +Ethernet8 85,86 Ethernet3/1 3 50000 +Ethernet10 87,88 Ethernet3/3 3 50000 +Ethernet12 89,90 Ethernet4/1 4 50000 +Ethernet14 91,92 Ethernet4/3 4 50000 +Ethernet16 109,110 Ethernet5/1 5 50000 +Ethernet18 111,112 Ethernet5/3 5 50000 +Ethernet20 97,98 Ethernet6/1 6 50000 +Ethernet22 99,100 Ethernet6/3 6 50000 +Ethernet24 5,6 Ethernet7/1 7 50000 +Ethernet26 7,8 Ethernet7/3 7 50000 +Ethernet28 13,14 Ethernet8/1 8 50000 +Ethernet30 15,16 Ethernet8/3 8 50000 +Ethernet32 25,26 Ethernet9/1 9 50000 +Ethernet34 27,28 Ethernet9/3 9 50000 +Ethernet36 21,22 Ethernet10/1 10 50000 +Ethernet38 23,24 Ethernet10/3 10 50000 +Ethernet40 37,38 Ethernet11/1 11 50000 +Ethernet42 39,40 Ethernet11/3 11 50000 +Ethernet44 45,46 Ethernet12/1 12 50000 +Ethernet46 47,48 Ethernet12/3 12 50000 +Ethernet48 57,58,59,60 Ethernet13/1 13 100000 +Ethernet52 53,54,55,56 Ethernet14/1 14 100000 +Ethernet56 117,118,119,120 Ethernet15/1 15 100000 +Ethernet60 121,122,123,124 Ethernet16/1 16 100000 +Ethernet64 141,142,143,144 Ethernet17/1 17 100000 +Ethernet68 133,134,135,136 Ethernet18/1 18 100000 +Ethernet72 197,198,199,200 Ethernet19/1 19 100000 +Ethernet76 205,206,207,208 Ethernet20/1 20 100000 +Ethernet80 217,218 Ethernet21/1 21 50000 +Ethernet82 219,220 Ethernet21/3 21 50000 +Ethernet84 213,214 Ethernet22/1 22 50000 +Ethernet86 215,216 Ethernet22/3 22 50000 +Ethernet88 229,230 Ethernet23/1 23 50000 +Ethernet90 231,232 Ethernet23/3 23 50000 +Ethernet92 237,238 Ethernet24/1 24 50000 +Ethernet94 239,240 Ethernet24/3 24 50000 +Ethernet96 249,250 Ethernet25/1 25 50000 +Ethernet98 251,252 Ethernet25/3 25 50000 +Ethernet100 245,246 Ethernet26/1 26 50000 +Ethernet102 247,248 Ethernet26/3 26 50000 +Ethernet104 149,150 Ethernet27/1 27 50000 +Ethernet106 151,152 Ethernet27/3 27 50000 +Ethernet108 153,154 Ethernet28/1 28 50000 +Ethernet110 155,156 Ethernet28/3 28 50000 +Ethernet112 173,174 Ethernet29/1 29 50000 +Ethernet114 175,176 Ethernet29/3 29 50000 +Ethernet116 161,162 Ethernet30/1 30 50000 +Ethernet118 163,164 Ethernet30/3 30 50000 +Ethernet120 181,182 Ethernet31/1 31 50000 +Ethernet122 183,184 Ethernet31/3 31 50000 +Ethernet124 185,186 Ethernet32/1 32 50000 +Ethernet126 187,188 Ethernet32/3 32 50000 +Ethernet128 69,70 Ethernet33/1 33 50000 +Ethernet130 71,72 Ethernet33/3 33 50000 +Ethernet132 73,74 Ethernet34/1 34 50000 +Ethernet134 75,76 Ethernet34/3 34 50000 +Ethernet136 93,94 Ethernet35/1 35 50000 +Ethernet138 95,96 Ethernet35/3 35 50000 +Ethernet140 81,82 Ethernet36/1 36 50000 +Ethernet142 83,84 Ethernet36/3 36 50000 +Ethernet144 101,102 Ethernet37/1 37 50000 +Ethernet146 103,104 Ethernet37/3 37 50000 +Ethernet148 105,106 Ethernet38/1 38 50000 +Ethernet150 107,108 Ethernet38/3 38 50000 +Ethernet152 9,10 Ethernet39/1 39 50000 +Ethernet154 11,12 Ethernet39/3 39 50000 +Ethernet156 1,2 Ethernet40/1 40 50000 +Ethernet158 3,4 Ethernet40/3 40 50000 +Ethernet160 17,18 Ethernet41/1 41 50000 +Ethernet162 19,20 Ethernet41/3 41 50000 +Ethernet164 29,30 Ethernet42/1 42 50000 +Ethernet166 31,32 Ethernet42/3 42 50000 +Ethernet168 41,42 Ethernet43/1 43 50000 +Ethernet170 43,44 Ethernet43/3 43 50000 +Ethernet172 33,34 Ethernet44/1 44 50000 +Ethernet174 35,36 Ethernet44/3 44 50000 +Ethernet176 49,50 Ethernet45/1 45 50000 +Ethernet178 51,52 Ethernet45/3 45 50000 +Ethernet180 61,62 Ethernet46/1 46 50000 +Ethernet182 63,64 Ethernet46/3 46 50000 +Ethernet184 125,126 Ethernet47/1 47 50000 +Ethernet186 127,128 Ethernet47/3 47 50000 +Ethernet188 113,114 Ethernet48/1 48 50000 +Ethernet190 115,116 Ethernet48/3 48 50000 +Ethernet192 129,130 Ethernet49/1 49 50000 +Ethernet194 131,132 Ethernet49/3 49 50000 +Ethernet196 137,138 Ethernet50/1 50 50000 +Ethernet198 139,140 Ethernet50/3 50 50000 +Ethernet200 201,202 Ethernet51/1 51 50000 +Ethernet202 203,204 Ethernet51/3 51 50000 +Ethernet204 193,194 Ethernet52/1 52 50000 +Ethernet206 195,196 Ethernet52/3 52 50000 +Ethernet208 209,210 Ethernet53/1 53 50000 +Ethernet210 211,212 Ethernet53/3 53 50000 +Ethernet212 221,222 Ethernet54/1 54 50000 +Ethernet214 223,224 Ethernet54/3 54 50000 +Ethernet216 233,234 Ethernet55/1 55 50000 +Ethernet218 235,236 Ethernet55/3 55 50000 +Ethernet220 225,226 Ethernet56/1 56 50000 +Ethernet222 227,228 Ethernet56/3 56 50000 +Ethernet224 241,242 Ethernet57/1 57 50000 +Ethernet226 243,244 Ethernet57/3 57 50000 +Ethernet228 253,254 Ethernet58/1 58 50000 +Ethernet230 255,256 Ethernet58/3 58 50000 +Ethernet232 157,158 Ethernet59/1 59 50000 +Ethernet234 159,160 Ethernet59/3 59 50000 +Ethernet236 145,146 Ethernet60/1 60 50000 +Ethernet238 147,148 Ethernet60/3 60 50000 +Ethernet240 165,166 Ethernet61/1 61 50000 +Ethernet242 167,168 Ethernet61/3 61 50000 +Ethernet244 169,170 Ethernet62/1 62 50000 +Ethernet246 171,172 Ethernet62/3 62 50000 +Ethernet248 189,190 Ethernet63/1 63 50000 +Ethernet250 191,192 Ethernet63/3 63 50000 +Ethernet252 177,178 Ethernet64/1 64 50000 +Ethernet254 179,180 Ethernet64/3 64 50000 +Ethernet256 257 Ethernet65 65 10000 +Ethernet260 259 Ethernet66 66 10000 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/qos.json.j2 new file mode 120000 index 00000000000..aef6b6765cf --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/sai.profile b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/sai.profile new file mode 100644 index 00000000000..5163d6140f0 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C10/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/sai.d/config.bcm +SAI_NUM_ECMP_MEMBERS=64 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 003579a8869..a195781bf6c 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 03b4b8bbf03..eb803c09bce 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 f66e7061c6f..f10480ade94 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 5b2bbbf8925..b74d741cbd0 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 3db7f3a5147..b5a68040301 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 9be5d8e836f..e21ebf9092a 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 d663352acd5..8e7fa9ef15f 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 99dfb9e3e26..a3ae8e5d725 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 47610bbb4b4..37c4a869ceb 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 62fe61d49c9..b2981c29b3c 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 56d425f9f9c..106554efa89 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 diff --git a/device/celestica/x86_64-cel_seastone-r0/platform.json b/device/celestica/x86_64-cel_seastone-r0/platform.json index 6c874fcfcc5..ac11374b652 100644 --- a/device/celestica/x86_64-cel_seastone-r0/platform.json +++ b/device/celestica/x86_64-cel_seastone-r0/platform.json @@ -1,6 +1,10 @@ { "chassis": { "name": "Celestica-DX010-C32", + "status_led": { + "controllable": true, + "colors": ["green", "off"] + }, "components": [ { "name": "CPLD1" @@ -20,39 +24,103 @@ ], "fans": [ { - "name": "FAN-1F" - }, - { - "name": "FAN-1R" - }, - { - "name": "FAN-2F" - }, - { - "name": "FAN-2R" - }, - { - "name": "FAN-3F" - }, - { - "name": "FAN-3R" - }, - { - "name": "FAN-4F" - }, - { - "name": "FAN-4R" - }, - { - "name": "FAN-5F" - }, - { - "name": "FAN-5R" + "name": "FAN-1F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-1R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-2F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-2R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-3F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-3R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-4F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-4R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-5F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "FAN-5R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ], "fan_drawers": [ { "name": "Drawer1", + "status_led": { + "controllable": true, + "colors": ["red", "green", "amber", "off"] + }, "fans": [ { "name": "FAN-1F" @@ -64,6 +132,10 @@ }, { "name": "Drawer2", + "status_led": { + "controllable": true, + "colors": ["red", "green", "amber", "off"] + }, "fans": [ { "name": "FAN-2F" @@ -75,6 +147,10 @@ }, { "name": "Drawer3", + "status_led": { + "controllable": true, + "colors": ["red", "green", "amber", "off"] + }, "fans": [ { "name": "FAN-3F" @@ -86,6 +162,10 @@ }, { "name": "Drawer4", + "status_led": { + "controllable": true, + "colors": ["red", "green", "amber", "off"] + }, "fans": [ { "name": "FAN-4F" @@ -97,6 +177,10 @@ }, { "name": "Drawer5", + "status_led": { + "controllable": true, + "colors": ["red", "green", "amber", "off"] + }, "fans": [ { "name": "FAN-5F" @@ -110,36 +194,60 @@ "psus": [ { "name": "PSU-1", + "status_led": { + "controllable": true, + "colors": ["green", "off"] + }, "fans": [ { - "name": "PSU-1 FAN-1" + "name": "PSU-1 FAN-1", + "speed": { + "controllable": false + } } ] }, { "name": "PSU-2", + "status_led": { + "controllable": true, + "colors": ["green", "off"] + }, "fans": [ { - "name": "PSU-2 FAN-1" + "name": "PSU-2 FAN-1", + "speed": { + "controllable": false + } } ] } ], "thermals": [ { - "name": "Front-panel temp sensor 1" + "name": "Front-panel temp sensor 1", + "controllable": false, + "low-crit-threshold": false }, { - "name": "Front-panel temp sensor 2" + "name": "Front-panel temp sensor 2", + "controllable": false, + "low-crit-threshold": false }, { - "name": "ASIC temp sensor" + "name": "ASIC temp sensor", + "controllable": false, + "low-crit-threshold": false }, { - "name": "Rear-panel temp sensor 1" + "name": "Rear-panel temp sensor 1", + "controllable": false, + "low-crit-threshold": false }, { - "name": "Rear-panel temp sensor 2" + "name": "Rear-panel temp sensor 2", + "controllable": false, + "low-crit-threshold": false } ], "sfps": [ 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 b70d5890133..e4d34292301 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 a9cfd00b9e2..758068dc473 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 47979b5d7ab..974d9156e2d 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 13e95ed2549..c334cc89271 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 9a71f7b9114..f8c5b0193a4 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 8ae70b9755e..6613af1661e 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 27042e3122b..5dc44f9918f 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 9cd18661148..9a4e20705b3 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 8a7b53a626b..2c39fa79343 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 3a58afda8df..3f3841095ce 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 435f9b2929e..a559cfe4742 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 5dabf2de100..3788c0d7058 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 aaf02fec0c7..897744f69c5 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/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/jr2cp-nokia-18x100g-4x25g-config.bcm b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/jr2cp-nokia-18x100g-4x25g-config.bcm index 856d429a7e6..a2f144e5810 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/jr2cp-nokia-18x100g-4x25g-config.bcm +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/jr2cp-nokia-18x100g-4x25g-config.bcm @@ -8,7 +8,6 @@ dma_desc_aggregator_chain_length_max.BCM8885X=1000 dma_desc_aggregator_enable_specific_MDB_LPM.BCM8885X=1 dma_desc_aggregator_timeout_usec.BCM8885X=1000 dport_map_direct.BCM8885X=1 -sai_postinit_cmd_file=/usr/share/sonic/hwsku/sai_postinit_cmd.soc dtm_flow_mapping_mode_region_64.BCM8885X=3 dtm_flow_mapping_mode_region_65.BCM8885X=3 dtm_flow_mapping_mode_region_66.BCM8885X=3 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/port_config.ini index 96710e7e0fb..ea7ae717e8c 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/port_config.ini +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/port_config.ini @@ -1,21 +1,21 @@ -# name lanes alias index asic_port_name role speed coreid coreportid numvoq -Ethernet0 72,73,74,75 Ethernet0 1 Eth0-ASIC0 Ext 100000 1 1 8 -Ethernet1 80,81,82,83 Ethernet1 2 Eth1-ASIC0 Ext 100000 1 2 8 -Ethernet2 88,89,90,91 Ethernet2 3 Eth2-ASIC0 Ext 100000 1 3 8 -Ethernet3 96,97,98,99 Ethernet3 4 Eth3-ASIC0 Ext 100000 1 4 8 -Ethernet4 104,105,106,107 Ethernet4 5 Eth4-ASIC0 Ext 100000 1 5 8 -Ethernet5 112,113,114,115 Ethernet5 6 Eth5-ASIC0 Ext 100000 1 6 8 -Ethernet6 120,121,122,123 Ethernet6 7 Eth6-ASIC0 Ext 100000 1 7 8 -Ethernet7 128,129,130,131 Ethernet7 8 Eth7-ASIC0 Ext 100000 1 8 8 -Ethernet8 136,137,138,139 Ethernet8 9 Eth8-ASIC0 Ext 100000 1 9 8 -Ethernet9 64,65,66,67 Ethernet9 10 Eth9-ASIC0 Ext 100000 0 10 8 -Ethernet10 56,57,58,59 Ethernet10 11 Eth10-ASIC0 Ext 100000 0 11 8 -Ethernet11 48,49,50,51 Ethernet11 12 Eth11-ASIC0 Ext 100000 0 12 8 -Ethernet12 40,41,42,43 Ethernet12 13 Eth12-ASIC0 Ext 100000 0 13 8 -Ethernet13 32,33,34,35 Ethernet13 14 Eth13-ASIC0 Ext 100000 0 14 8 -Ethernet14 24,25,26,27 Ethernet14 15 Eth14-ASIC0 Ext 100000 0 15 8 -Ethernet15 16,17,18,19 Ethernet15 16 Eth15-ASIC0 Ext 100000 0 16 8 -Ethernet16 8,9,10,11 Ethernet16 17 Eth16-ASIC0 Ext 100000 0 17 8 -Ethernet17 0,1,2,3 Ethernet17 18 Eth17-ASIC0 Ext 100000 0 18 8 -Ethernet-IB0 115 Ethernet-IB0 37 Rcy1-ASIC0 Inb 10000 0 19 8 -Ethernet-Rec0 116 Ethernet-Rec0 39 Rcy2-ASIC0 Rec 10000 1 20 8 +# name lanes alias index role speed asic_port_name coreid coreportid numvoq +Ethernet0 72,73,74,75 Ethernet1/1 1 Ext 100000 Eth0 1 1 8 +Ethernet8 80,81,82,83 Ethernet2/1 2 Ext 100000 Eth8 1 2 8 +Ethernet16 88,89,90,91 Ethernet3/1 3 Ext 100000 Eth16 1 3 8 +Ethernet24 96,97,98,99 Ethernet4/1 4 Ext 100000 Eth24 1 4 8 +Ethernet32 104,105,106,107 Ethernet5/1 5 Ext 100000 Eth32 1 5 8 +Ethernet40 112,113,114,115 Ethernet6/1 6 Ext 100000 Eth40 1 6 8 +Ethernet48 120,121,122,123 Ethernet7/1 7 Ext 100000 Eth48 1 7 8 +Ethernet56 128,129,130,131 Ethernet8/1 8 Ext 100000 Eth56 1 8 8 +Ethernet64 136,137,138,139 Ethernet9/1 9 Ext 100000 Eth64 1 9 8 +Ethernet72 64,65,66,67 Ethernet10/1 10 Ext 100000 Eth72 0 10 8 +Ethernet80 56,57,58,59 Ethernet11/1 11 Ext 100000 Eth80 0 11 8 +Ethernet88 48,49,50,51 Ethernet12/1 12 Ext 100000 Eth88 0 12 8 +Ethernet96 40,41,42,43 Ethernet13/1 13 Ext 100000 Eth96 0 13 8 +Ethernet104 32,33,34,35 Ethernet14/1 14 Ext 100000 Eth104 0 14 8 +Ethernet112 24,25,26,27 Ethernet15/1 15 Ext 100000 Eth112 0 15 8 +Ethernet120 16,17,18,19 Ethernet16/1 16 Ext 100000 Eth120 0 16 8 +Ethernet128 8,9,10,11 Ethernet17/1 17 Ext 100000 Eth128 0 17 8 +Ethernet136 0,1,2,3 Ethernet18/1 18 Ext 100000 Eth136 0 18 8 +Ethernet-IB0 115 Recirc0/0 37 Inb 10000 Rcy0 0 19 8 +Ethernet-Rec0 116 Recirc0/1 39 Rec 10000 Rcy1 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai_postinit_cmd.soc b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai_postinit_cmd.soc index 20e19b8faeb..8b137891791 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai_postinit_cmd.soc +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai_postinit_cmd.soc @@ -1 +1 @@ -mod ETPPC_MAP_FWD_QOS_DP_TO_TYPE_FWD 0 128 TYPE_FWD_KEEP_ECN_BITS=1 + diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/jr2cp-nokia-18x100g-4x25g-config.bcm b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/jr2cp-nokia-18x100g-4x25g-config.bcm index 0d1b3972a5c..bbdd1e640e3 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/jr2cp-nokia-18x100g-4x25g-config.bcm +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/jr2cp-nokia-18x100g-4x25g-config.bcm @@ -8,7 +8,6 @@ dma_desc_aggregator_chain_length_max.BCM8885X=1000 dma_desc_aggregator_enable_specific_MDB_LPM.BCM8885X=1 dma_desc_aggregator_timeout_usec.BCM8885X=1000 dport_map_direct.BCM8885X=1 -sai_postinit_cmd_file=/usr/share/sonic/hwsku/sai_postinit_cmd.soc dtm_flow_mapping_mode_region_64.BCM8885X=3 dtm_flow_mapping_mode_region_65.BCM8885X=3 dtm_flow_mapping_mode_region_66.BCM8885X=3 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/port_config.ini index f1a7fee5ad1..b919d1b97b1 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/port_config.ini +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/port_config.ini @@ -1,21 +1,21 @@ -# name lanes alias index asic_port_name role speed coreid coreportid numvoq -Ethernet18 72,73,74,75 Ethernet18 19 Eth0-ASIC1 Ext 100000 1 1 8 -Ethernet19 80,81,82,83 Ethernet19 20 Eth1-ASIC1 Ext 100000 1 2 8 -Ethernet20 88,89,90,91 Ethernet20 21 Eth2-ASIC1 Ext 100000 1 3 8 -Ethernet21 96,97,98,99 Ethernet21 22 Eth3-ASIC1 Ext 100000 1 4 8 -Ethernet22 104,105,106,107 Ethernet22 23 Eth4-ASIC1 Ext 100000 1 5 8 -Ethernet23 112,113,114,115 Ethernet23 24 Eth5-ASIC1 Ext 100000 1 6 8 -Ethernet24 120,121,122,123 Ethernet24 25 Eth6-ASIC1 Ext 100000 1 7 8 -Ethernet25 128,129,130,131 Ethernet25 26 Eth7-ASIC1 Ext 100000 1 8 8 -Ethernet26 136,137,138,139 Ethernet26 27 Eth8-ASIC1 Ext 100000 1 9 8 -Ethernet27 64,65,66,67 Ethernet27 28 Eth9-ASIC1 Ext 100000 0 10 8 -Ethernet28 56,57,58,59 Ethernet28 29 Eth10-ASIC1 Ext 100000 0 11 8 -Ethernet29 48,49,50,51 Ethernet29 30 Eth11-ASIC1 Ext 100000 0 12 8 -Ethernet30 40,41,42,43 Ethernet30 31 Eth12-ASIC1 Ext 100000 0 13 8 -Ethernet31 32,33,34,35 Ethernet31 32 Eth13-ASIC1 Ext 100000 0 14 8 -Ethernet32 24,25,26,27 Ethernet32 33 Eth14-ASIC1 Ext 100000 0 15 8 -Ethernet33 16,17,18,19 Ethernet33 34 Eth15-ASIC1 Ext 100000 0 16 8 -Ethernet34 8,9,10,11 Ethernet34 35 Eth16-ASIC1 Ext 100000 0 17 8 -Ethernet35 0,1,2,3 Ethernet35 36 Eth17-ASIC1 Ext 100000 0 18 8 -Ethernet-IB1 115 Ethernet-IB1 38 Rcy1-ASIC1 Inb 10000 0 19 8 -Ethernet-Rec1 116 Ethernet-Rec1 40 Rcy2-ASIC1 Rec 10000 1 20 8 +# name lanes alias index role speed asic_port_name coreid coreportid numvoq +Ethernet144 72,73,74,75 Ethernet19/1 19 Ext 100000 Eth0 1 1 8 +Ethernet152 80,81,82,83 Ethernet20/1 20 Ext 100000 Eth8 1 2 8 +Ethernet160 88,89,90,91 Ethernet21/1 21 Ext 100000 Eth16 1 3 8 +Ethernet168 96,97,98,99 Ethernet22/1 22 Ext 100000 Eth24 1 4 8 +Ethernet176 104,105,106,107 Ethernet23/1 23 Ext 100000 Eth32 1 5 8 +Ethernet184 112,113,114,115 Ethernet24/1 24 Ext 100000 Eth40 1 6 8 +Ethernet192 120,121,122,123 Ethernet25/1 25 Ext 100000 Eth48 1 7 8 +Ethernet200 128,129,130,131 Ethernet26/1 26 Ext 100000 Eth56 1 8 8 +Ethernet208 136,137,138,139 Ethernet27/1 27 Ext 100000 Eth64 1 9 8 +Ethernet216 64,65,66,67 Ethernet28/1 28 Ext 100000 Eth72 0 10 8 +Ethernet224 56,57,58,59 Ethernet29/1 29 Ext 100000 Eth80 0 11 8 +Ethernet232 48,49,50,51 Ethernet30/1 30 Ext 100000 Eth88 0 12 8 +Ethernet240 40,41,42,43 Ethernet31/1 31 Ext 100000 Eth96 0 13 8 +Ethernet248 32,33,34,35 Ethernet32/1 32 Ext 100000 Eth104 0 14 8 +Ethernet256 24,25,26,27 Ethernet33/1 33 Ext 100000 Eth112 0 15 8 +Ethernet264 16,17,18,19 Ethernet34/1 34 Ext 100000 Eth120 0 16 8 +Ethernet272 8,9,10,11 Ethernet35/1 35 Ext 100000 Eth128 0 17 8 +Ethernet280 0,1,2,3 Ethernet36/1 36 Ext 100000 Eth136 0 18 8 +Ethernet-IB1 115 Recirc1/0 38 Inb 10000 Rcy0 0 19 8 +Ethernet-Rec1 116 Recirc1/1 40 Rec 10000 Rcy1 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai_postinit_cmd.soc b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai_postinit_cmd.soc index 20e19b8faeb..8b137891791 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai_postinit_cmd.soc +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai_postinit_cmd.soc @@ -1 +1 @@ -mod ETPPC_MAP_FWD_QOS_DP_TO_TYPE_FWD 0 128 TYPE_FWD_KEEP_ECN_BITS=1 + diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini index 3633842330f..162eca454fc 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini @@ -1,21 +1,21 @@ -# name lanes alias index asic_port_name role speed coreid coreportid numvoq -Ethernet0 72,73,74,75,76,77,78,79 Ethernet0 1 Eth0-ASIC0 Ext 400000 1 1 8 -Ethernet1 80,81,82,83,84,85,86,87 Ethernet1 2 Eth1-ASIC0 Ext 400000 1 2 8 -Ethernet2 88,89,90,91,92,93,94,95 Ethernet2 3 Eth2-ASIC0 Ext 400000 1 3 8 -Ethernet3 96,97,98,99,100,101,102,103 Ethernet3 4 Eth3-ASIC0 Ext 400000 1 4 8 -Ethernet4 104,105,106,107,108,109,110,111 Ethernet4 5 Eth4-ASIC0 Ext 400000 1 5 8 -Ethernet5 112,113,114,115,116,117,118,119 Ethernet5 6 Eth5-ASIC0 Ext 400000 1 6 8 -Ethernet6 120,121,122,123,124,125,126,127 Ethernet6 7 Eth6-ASIC0 Ext 400000 1 7 8 -Ethernet7 128,129,130,131,132,133,134,135 Ethernet7 8 Eth7-ASIC0 Ext 400000 1 8 8 -Ethernet8 136,137,138,139,140,141,142,143 Ethernet8 9 Eth8-ASIC0 Ext 400000 1 9 8 -Ethernet9 64,65,66,67,68,69,70,71 Ethernet9 10 Eth9-ASIC0 Ext 400000 0 10 8 -Ethernet10 56,57,58,59,60,61,62,63 Ethernet10 11 Eth10-ASIC0 Ext 400000 0 11 8 -Ethernet11 48,49,50,51,52,53,54,55 Ethernet11 12 Eth11-ASIC0 Ext 400000 0 12 8 -Ethernet12 40,41,42,43,44,45,46,47 Ethernet12 13 Eth12-ASIC0 Ext 400000 0 13 8 -Ethernet13 32,33,34,35,36,37,38,39 Ethernet13 14 Eth13-ASIC0 Ext 400000 0 14 8 -Ethernet14 24,25,26,27,28,29,30,31 Ethernet14 15 Eth14-ASIC0 Ext 400000 0 15 8 -Ethernet15 16,17,18,19,20,21,22,23 Ethernet15 16 Eth15-ASIC0 Ext 400000 0 16 8 -Ethernet16 8,9,10,11,12,13,14,15 Ethernet16 17 Eth16-ASIC0 Ext 400000 0 17 8 -Ethernet17 0,1,2,3,4,5,6,7 Ethernet17 18 Eth17-ASIC0 Ext 400000 0 18 8 -Ethernet-IB0 115 Ethernet-IB0 37 Rcy1-ASIC0 Inb 10000 0 19 8 -Ethernet-Rec0 116 Ethernet-Rec0 39 Rcy2-ASIC0 Rec 10000 1 20 8 +# name lanes alias index role speed asic_port_name coreid coreportid numvoq +Ethernet0 72,73,74,75,76,77,78,79 Ethernet1/1 1 Ext 400000 Eth0 1 1 8 +Ethernet8 80,81,82,83,84,85,86,87 Ethernet2/1 2 Ext 400000 Eth8 1 2 8 +Ethernet16 88,89,90,91,92,93,94,95 Ethernet3/1 3 Ext 400000 Eth16 1 3 8 +Ethernet24 96,97,98,99,100,101,102,103 Ethernet4/1 4 Ext 400000 Eth24 1 4 8 +Ethernet32 104,105,106,107,108,109,110,111 Ethernet5/1 5 Ext 400000 Eth32 1 5 8 +Ethernet40 112,113,114,115,116,117,118,119 Ethernet6/1 6 Ext 400000 Eth40 1 6 8 +Ethernet48 120,121,122,123,124,125,126,127 Ethernet7/1 7 Ext 400000 Eth48 1 7 8 +Ethernet56 128,129,130,131,132,133,134,135 Ethernet8/1 8 Ext 400000 Eth56 1 8 8 +Ethernet64 136,137,138,139,140,141,142,143 Ethernet9/1 9 Ext 400000 Eth64 1 9 8 +Ethernet72 64,65,66,67,68,69,70,71 Ethernet10/1 10 Ext 400000 Eth72 0 10 8 +Ethernet80 56,57,58,59,60,61,62,63 Ethernet11/1 11 Ext 400000 Eth80 0 11 8 +Ethernet88 48,49,50,51,52,53,54,55 Ethernet12/1 12 Ext 400000 Eth88 0 12 8 +Ethernet96 40,41,42,43,44,45,46,47 Ethernet13/1 13 Ext 400000 Eth96 0 13 8 +Ethernet104 32,33,34,35,36,37,38,39 Ethernet14/1 14 Ext 400000 Eth104 0 14 8 +Ethernet112 24,25,26,27,28,29,30,31 Ethernet15/1 15 Ext 400000 Eth112 0 15 8 +Ethernet120 16,17,18,19,20,21,22,23 Ethernet16/1 16 Ext 400000 Eth120 0 16 8 +Ethernet128 8,9,10,11,12,13,14,15 Ethernet17/1 17 Ext 400000 Eth128 0 17 8 +Ethernet136 0,1,2,3,4,5,6,7 Ethernet18/1 18 Ext 400000 Eth136 0 18 8 +Ethernet-IB0 115 Recirc0/0 37 Inb 10000 Rcy0 0 19 8 +Ethernet-Rec0 116 Recirc0/1 39 Rec 10000 Rcy1 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/sai_postinit_cmd.soc b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/sai_postinit_cmd.soc index fd18216d3c8..97f62c07cc7 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/sai_postinit_cmd.soc +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/sai_postinit_cmd.soc @@ -36,4 +36,3 @@ phy set 17 reg=0xd137 data=0 lane=2 phy set 17 reg=0xd138 data=0 lane=2 phy set 17 reg=0xd133 data=0x1804 lane=2 -mod ETPPC_MAP_FWD_QOS_DP_TO_TYPE_FWD 0 128 TYPE_FWD_KEEP_ECN_BITS=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini index 90376150d65..1531e5a1427 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini @@ -1,21 +1,21 @@ -# name lanes alias index asic_port_name role speed coreid coreportid numvoq -Ethernet18 72,73,74,75,76,77,78,79 Ethernet18 19 Eth0-ASIC1 Ext 400000 1 1 8 -Ethernet19 80,81,82,83,84,85,86,87 Ethernet19 20 Eth1-ASIC1 Ext 400000 1 2 8 -Ethernet20 88,89,90,91,92,93,94,95 Ethernet20 21 Eth2-ASIC1 Ext 400000 1 3 8 -Ethernet21 96,97,98,99,100,101,102,103 Ethernet21 22 Eth3-ASIC1 Ext 400000 1 4 8 -Ethernet22 104,105,106,107,108,109,110,111 Ethernet22 23 Eth4-ASIC1 Ext 400000 1 5 8 -Ethernet23 112,113,114,115,116,117,118,119 Ethernet23 24 Eth5-ASIC1 Ext 400000 1 6 8 -Ethernet24 120,121,122,123,124,125,126,127 Ethernet24 25 Eth6-ASIC1 Ext 400000 1 7 8 -Ethernet25 128,129,130,131,132,133,134,135 Ethernet25 26 Eth7-ASIC1 Ext 400000 1 8 8 -Ethernet26 136,137,138,139,140,141,142,143 Ethernet26 27 Eth8-ASIC1 Ext 400000 1 9 8 -Ethernet27 64,65,66,67,68,69,70,71 Ethernet27 28 Eth9-ASIC1 Ext 400000 0 10 8 -Ethernet28 56,57,58,59,60,61,62,63 Ethernet28 29 Eth10-ASIC1 Ext 400000 0 11 8 -Ethernet29 48,49,50,51,52,53,54,55 Ethernet29 30 Eth11-ASIC1 Ext 400000 0 12 8 -Ethernet30 40,41,42,43,44,45,46,47 Ethernet30 31 Eth12-ASIC1 Ext 400000 0 13 8 -Ethernet31 32,33,34,35,36,37,38,39 Ethernet31 32 Eth13-ASIC1 Ext 400000 0 14 8 -Ethernet32 24,25,26,27,28,29,30,31 Ethernet32 33 Eth14-ASIC1 Ext 400000 0 15 8 -Ethernet33 16,17,18,19,20,21,22,23 Ethernet33 34 Eth15-ASIC1 Ext 400000 0 16 8 -Ethernet34 8,9,10,11,12,13,14,15 Ethernet34 35 Eth16-ASIC1 Ext 400000 0 17 8 -Ethernet35 0,1,2,3,4,5,6,7 Ethernet35 36 Eth17-ASIC1 Ext 400000 0 18 8 -Ethernet-IB1 115 Ethernet-IB1 38 Rcy1-ASIC1 Inb 10000 0 19 8 -Ethernet-Rec1 116 Ethernet-Rec1 40 Rcy2-ASIC1 Rec 10000 1 20 8 +# name lanes alias index role speed asic_port_name coreid coreportid numvoq +Ethernet144 72,73,74,75,76,77,78,79 Ethernet19/1 19 Ext 400000 Eth0 1 1 8 +Ethernet152 80,81,82,83,84,85,86,87 Ethernet20/1 20 Ext 400000 Eth8 1 2 8 +Ethernet160 88,89,90,91,92,93,94,95 Ethernet21/1 21 Ext 400000 Eth16 1 3 8 +Ethernet168 96,97,98,99,100,101,102,103 Ethernet22/1 22 Ext 400000 Eth24 1 4 8 +Ethernet176 104,105,106,107,108,109,110,111 Ethernet23/1 23 Ext 400000 Eth32 1 5 8 +Ethernet184 112,113,114,115,116,117,118,119 Ethernet24/1 24 Ext 400000 Eth40 1 6 8 +Ethernet192 120,121,122,123,124,125,126,127 Ethernet25/1 25 Ext 400000 Eth48 1 7 8 +Ethernet200 128,129,130,131,132,133,134,135 Ethernet26/1 26 Ext 400000 Eth56 1 8 8 +Ethernet208 136,137,138,139,140,141,142,143 Ethernet27/1 27 Ext 400000 Eth64 1 9 8 +Ethernet216 64,65,66,67,68,69,70,71 Ethernet28/1 28 Ext 400000 Eth72 0 10 8 +Ethernet224 56,57,58,59,60,61,62,63 Ethernet29/1 29 Ext 400000 Eth80 0 11 8 +Ethernet232 48,49,50,51,52,53,54,55 Ethernet30/1 30 Ext 400000 Eth88 0 12 8 +Ethernet240 40,41,42,43,44,45,46,47 Ethernet31/1 31 Ext 400000 Eth96 0 13 8 +Ethernet248 32,33,34,35,36,37,38,39 Ethernet32/1 32 Ext 400000 Eth104 0 14 8 +Ethernet256 24,25,26,27,28,29,30,31 Ethernet33/1 33 Ext 400000 Eth112 0 15 8 +Ethernet264 16,17,18,19,20,21,22,23 Ethernet34/1 34 Ext 400000 Eth120 0 16 8 +Ethernet272 8,9,10,11,12,13,14,15 Ethernet35/1 35 Ext 400000 Eth128 0 17 8 +Ethernet280 0,1,2,3,4,5,6,7 Ethernet36/1 36 Ext 400000 Eth136 0 18 8 +Ethernet-IB1 115 Recirc1/0 38 Inb 10000 Rcy0 0 19 8 +Ethernet-Rec1 116 Recirc1/1 40 Rec 10000 Rcy1 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/sai_postinit_cmd.soc b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/sai_postinit_cmd.soc index 109b18ecaaf..ed471c6c19b 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/sai_postinit_cmd.soc +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/sai_postinit_cmd.soc @@ -13,4 +13,3 @@ phy set 8 reg=0xd137 data=0 lane=1 phy set 8 reg=0xd138 data=0 lane=1 phy set 8 reg=0xd133 data=0x1802 lane=1 -mod ETPPC_MAP_FWD_QOS_DP_TO_TYPE_FWD 0 128 TYPE_FWD_KEEP_ECN_BITS=1 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 d33d99d6e76..00000000000 --- 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 0f337006eda..51f26610495 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 042c8060d58..352e8c50b05 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 69fd8c36298..27656bd3d46 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 4fa2582830f..e9fc701bb8d 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 00000000000..cf7215e0c9a --- /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 00000000000..58c38d1d736 --- /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 00000000000..5f9e2e99dbf --- /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 00000000000..dccb1ac1a15 --- /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 00000000000..1ca92561082 --- /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 00000000000..af4dd591536 --- /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 00000000000..6aef47b7e92 --- /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 590def37b27..50c21289d26 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 e6b05e40060..00000000000 --- 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 3f5aae68c54..a5cf533a7f9 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 c2944e7b5b8..b03c57ebd8e --- 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 b8d554f3a8b..94592fa8ceb 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 4aa22016c11..00000000000 --- 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/dockers/docker-base-bullseye/etc/rsyslog.conf b/dockers/docker-base-bullseye/etc/rsyslog.conf deleted file mode 100644 index ef249229ab1..00000000000 --- a/dockers/docker-base-bullseye/etc/rsyslog.conf +++ /dev/null @@ -1,76 +0,0 @@ -# -# /etc/rsyslog.conf Configuration file for rsyslog. -# -# For more information see -# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html - - -################# -#### MODULES #### -################# - -$ModLoad imuxsock # provides support for local system logging - -# -# Set a rate limit on messages from the container -# -$SystemLogRateLimitInterval 300 -$SystemLogRateLimitBurst 20000 - -#$ModLoad imklog # provides kernel logging support -#$ModLoad immark # provides --MARK-- message capability - -# provides UDP syslog reception -#$ModLoad imudp -#$UDPServerRun 514 - -# provides TCP syslog reception -#$ModLoad imtcp -#$InputTCPServerRun 514 - - -########################### -#### GLOBAL DIRECTIVES #### -########################### - -# Set remote syslog server -template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%") -*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer") - -# -# Use traditional timestamp format. -# To enable high precision timestamps, comment out the following line. -# -#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat - -# Define a custom template -$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" -$ActionFileDefaultTemplate SONiCFileFormat - -# -# Set the default permissions for all log files. -# -$FileOwner root -$FileGroup adm -$FileCreateMode 0640 -$DirCreateMode 0755 -$Umask 0022 - -# -# Where to place spool and state files -# -$WorkDirectory /var/spool/rsyslog - -# -# Include all config files in /etc/rsyslog.d/ -# -$IncludeConfig /etc/rsyslog.d/*.conf - -# -# Suppress duplicate messages and report "message repeated n times" -# -$RepeatedMsgReduction on - -############### -#### RULES #### -############### diff --git a/dockers/docker-base-buster/etc/rsyslog.conf b/dockers/docker-base-buster/etc/rsyslog.conf deleted file mode 100644 index ef249229ab1..00000000000 --- a/dockers/docker-base-buster/etc/rsyslog.conf +++ /dev/null @@ -1,76 +0,0 @@ -# -# /etc/rsyslog.conf Configuration file for rsyslog. -# -# For more information see -# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html - - -################# -#### MODULES #### -################# - -$ModLoad imuxsock # provides support for local system logging - -# -# Set a rate limit on messages from the container -# -$SystemLogRateLimitInterval 300 -$SystemLogRateLimitBurst 20000 - -#$ModLoad imklog # provides kernel logging support -#$ModLoad immark # provides --MARK-- message capability - -# provides UDP syslog reception -#$ModLoad imudp -#$UDPServerRun 514 - -# provides TCP syslog reception -#$ModLoad imtcp -#$InputTCPServerRun 514 - - -########################### -#### GLOBAL DIRECTIVES #### -########################### - -# Set remote syslog server -template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%") -*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer") - -# -# Use traditional timestamp format. -# To enable high precision timestamps, comment out the following line. -# -#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat - -# Define a custom template -$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" -$ActionFileDefaultTemplate SONiCFileFormat - -# -# Set the default permissions for all log files. -# -$FileOwner root -$FileGroup adm -$FileCreateMode 0640 -$DirCreateMode 0755 -$Umask 0022 - -# -# Where to place spool and state files -# -$WorkDirectory /var/spool/rsyslog - -# -# Include all config files in /etc/rsyslog.d/ -# -$IncludeConfig /etc/rsyslog.d/*.conf - -# -# Suppress duplicate messages and report "message repeated n times" -# -$RepeatedMsgReduction on - -############### -#### RULES #### -############### diff --git a/dockers/docker-base-stretch/etc/rsyslog.conf b/dockers/docker-base-stretch/etc/rsyslog.conf deleted file mode 100644 index ef249229ab1..00000000000 --- a/dockers/docker-base-stretch/etc/rsyslog.conf +++ /dev/null @@ -1,76 +0,0 @@ -# -# /etc/rsyslog.conf Configuration file for rsyslog. -# -# For more information see -# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html - - -################# -#### MODULES #### -################# - -$ModLoad imuxsock # provides support for local system logging - -# -# Set a rate limit on messages from the container -# -$SystemLogRateLimitInterval 300 -$SystemLogRateLimitBurst 20000 - -#$ModLoad imklog # provides kernel logging support -#$ModLoad immark # provides --MARK-- message capability - -# provides UDP syslog reception -#$ModLoad imudp -#$UDPServerRun 514 - -# provides TCP syslog reception -#$ModLoad imtcp -#$InputTCPServerRun 514 - - -########################### -#### GLOBAL DIRECTIVES #### -########################### - -# Set remote syslog server -template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%") -*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer") - -# -# Use traditional timestamp format. -# To enable high precision timestamps, comment out the following line. -# -#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat - -# Define a custom template -$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" -$ActionFileDefaultTemplate SONiCFileFormat - -# -# Set the default permissions for all log files. -# -$FileOwner root -$FileGroup adm -$FileCreateMode 0640 -$DirCreateMode 0755 -$Umask 0022 - -# -# Where to place spool and state files -# -$WorkDirectory /var/spool/rsyslog - -# -# Include all config files in /etc/rsyslog.d/ -# -$IncludeConfig /etc/rsyslog.d/*.conf - -# -# Suppress duplicate messages and report "message repeated n times" -# -$RepeatedMsgReduction on - -############### -#### RULES #### -############### diff --git a/dockers/docker-base/etc/rsyslog.conf b/dockers/docker-base/etc/rsyslog.conf deleted file mode 100644 index 4851ac78447..00000000000 --- a/dockers/docker-base/etc/rsyslog.conf +++ /dev/null @@ -1,80 +0,0 @@ -############################################################################### -# Managed by Ansible -# file: ansible/roles/acs/templates/rsyslog.conf.j2 -############################################################################### -# -# /etc/rsyslog.conf Configuration file for rsyslog. -# -# For more information see -# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html - - -################# -#### MODULES #### -################# - -$ModLoad imuxsock # provides support for local system logging - -# -# Set a rate limit on messages from the container -# -$SystemLogRateLimitInterval 300 -$SystemLogRateLimitBurst 20000 - -#$ModLoad imklog # provides kernel logging support -#$ModLoad immark # provides --MARK-- message capability - -# provides UDP syslog reception -#$ModLoad imudp -#$UDPServerRun 514 - -# provides TCP syslog reception -#$ModLoad imtcp -#$InputTCPServerRun 514 - - -########################### -#### GLOBAL DIRECTIVES #### -########################### - -# Set remote syslog server -template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%") -*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer") - -# -# Use traditional timestamp format. -# To enable high precision timestamps, comment out the following line. -# -#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat - -# Define a custom template -$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" -$ActionFileDefaultTemplate SONiCFileFormat - -# -# Set the default permissions for all log files. -# -$FileOwner root -$FileGroup adm -$FileCreateMode 0640 -$DirCreateMode 0755 -$Umask 0022 - -# -# Where to place spool and state files -# -$WorkDirectory /var/spool/rsyslog - -# -# Include all config files in /etc/rsyslog.d/ -# -$IncludeConfig /etc/rsyslog.d/*.conf - -# -# Suppress duplicate messages and report "message repeated n times" -# -$RepeatedMsgReduction on - -############### -#### RULES #### -############### diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 899c111da41..b9d3669c0f4 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -2,7 +2,6 @@ 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 # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 1cddd11b61d..b09da75705c 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -3,7 +3,6 @@ FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py b/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py index 048a8390157..59bdbbf2cfb 100644 --- a/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py +++ b/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py @@ -1,7 +1,7 @@ import sys import click import importlib -importlib.import_module('show.plugins.dhcp-relay') +dhcp6_relay = importlib.import_module('show.plugins.dhcp-relay') import utilities_common.cli as clicommon @@ -16,7 +16,7 @@ def dhcp6relay_clear(): def dhcp6relay_clear_counters(interface): """ Clear dhcp6relay message counts """ - counter = DHCPv6_Counter() + counter = dhcp6_relay.DHCPv6_Counter() counter_intf = counter.get_interface() if interface: diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index c42f001b830..d15fc184623 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -5,7 +5,6 @@ ARG docker_container_name ARG frr_user_uid ARG frr_user_gid -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-iccpd/Dockerfile.j2 b/dockers/docker-iccpd/Dockerfile.j2 index bdb0a9fbf36..42a73b4cd30 100644 --- a/dockers/docker-iccpd/Dockerfile.j2 +++ b/dockers/docker-iccpd/Dockerfile.j2 @@ -2,7 +2,6 @@ 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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-lldp/Dockerfile.j2 b/dockers/docker-lldp/Dockerfile.j2 index d7e38e663be..9bc6418524c 100644 --- a/dockers/docker-lldp/Dockerfile.j2 +++ b/dockers/docker-lldp/Dockerfile.j2 @@ -3,7 +3,6 @@ FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-macsec/Dockerfile.j2 b/dockers/docker-macsec/Dockerfile.j2 index 2e7a412466a..3ec18b13728 100644 --- a/dockers/docker-macsec/Dockerfile.j2 +++ b/dockers/docker-macsec/Dockerfile.j2 @@ -2,7 +2,6 @@ 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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-mux/Dockerfile.j2 b/dockers/docker-mux/Dockerfile.j2 index 06e89c3ecf2..5908c432e6d 100755 --- a/dockers/docker-mux/Dockerfile.j2 +++ b/dockers/docker-mux/Dockerfile.j2 @@ -2,7 +2,6 @@ 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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-nat/Dockerfile.j2 b/dockers/docker-nat/Dockerfile.j2 index 04b2883551c..0c0e6089a8d 100644 --- a/dockers/docker-nat/Dockerfile.j2 +++ b/dockers/docker-nat/Dockerfile.j2 @@ -2,7 +2,6 @@ FROM docker-swss-layer-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf RUN echo diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 22adec2b595..b8b95a9133c 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -2,7 +2,6 @@ FROM docker-swss-layer-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 # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-pde/Dockerfile.j2 b/dockers/docker-pde/Dockerfile.j2 index 0ddbfd59ce1..6a0b21154d9 100644 --- a/dockers/docker-pde/Dockerfile.j2 +++ b/dockers/docker-pde/Dockerfile.j2 @@ -3,7 +3,6 @@ FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ENV PYTHONPATH=/usr/share/sonic/platform -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 629cf9ab9d8..1c6b484814c 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -3,7 +3,6 @@ FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -42,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 diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 35c85fd1eac..47ca3dd7ca5 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -14,14 +14,14 @@ WORKDIR /root MAINTAINER Pavel Shirshov -RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian buster-backports main" >> /etc/apt/sources.list +COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive ## Set the apt source, update package cache and install necessary packages ## TODO: Clean up this step -RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /etc/apt/sources.list \ - && apt-get update \ +RUN apt-get update \ && apt-get upgrade -y \ && apt-get dist-upgrade -y \ && apt-get install -y \ diff --git a/dockers/docker-sflow/Dockerfile.j2 b/dockers/docker-sflow/Dockerfile.j2 index eb97f5708bf..162c4eee961 100644 --- a/dockers/docker-sflow/Dockerfile.j2 +++ b/dockers/docker-sflow/Dockerfile.j2 @@ -2,7 +2,6 @@ FROM docker-swss-layer-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-snmp/Dockerfile.j2 b/dockers/docker-snmp/Dockerfile.j2 index 1eb4ec4b7c8..8465e4fb94f 100644 --- a/dockers/docker-snmp/Dockerfile.j2 +++ b/dockers/docker-snmp/Dockerfile.j2 @@ -3,7 +3,6 @@ FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Enable -O for all Python calls ENV PYTHONOPTIMIZE 1 diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index 823a2c7ff4b..5c36da43286 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-sonic-restapi/Dockerfile.j2 b/dockers/docker-sonic-restapi/Dockerfile.j2 index 029f5ec813d..ca1a80580ba 100644 --- a/dockers/docker-sonic-restapi/Dockerfile.j2 +++ b/dockers/docker-sonic-restapi/Dockerfile.j2 @@ -2,7 +2,6 @@ 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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index e9b01f751b8..64d679d40c4 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -3,7 +3,6 @@ FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index be5e6984dda..33cb3af9249 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -2,7 +2,6 @@ FROM docker-swss-layer-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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index cf09536a5e2..3bb5840e0b1 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 diff --git a/files/build_scripts/mask_disabled_services.py b/files/build_scripts/mask_disabled_services.py index 5c1a3695802..291b8d7e074 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)]) diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index f15e54b5513..c8d0aa93320 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -21,6 +21,11 @@ def {%- set switch_role = '' %} {%- endif -%} +{% set voq_chassis = false %} +{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['switch_type'] is defined and DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{%- set voq_chassis = true %} +{%- endif -%} + {# Import default values from device HWSKU folder #} {%- import 'buffers_defaults_%s.j2' % filename_postfix as defs with context %} @@ -94,7 +99,20 @@ def {%- endmacro %} {%- set PORT_ALL = [] %} +{%- set SYSTEM_PORT_ALL = [] %} +{%- if voq_chassis %} + {%- for system_port in SYSTEM_PORT %} + {% if '|' not in system_port %} + {%- set system_port_name = system_port|join("|") %} + {% else %} + {%- set system_port_name = system_port %} + {% endif %} + {%- if 'cpu' not in system_port_name.lower() and 'IB' not in system_port_name and 'Rec' not in system_port_name %} + {%- if SYSTEM_PORT_ALL.append(system_port_name) %}{%- endif %} + {%- endif %} + {%- endfor %} +{%- endif %} {%- if PORT is not defined %} {%- if defs.generate_port_lists is defined %} {%- if defs.generate_port_lists(PORT_ALL) %} {% endif %} @@ -190,6 +208,26 @@ def }, {% endif %} +{% if voq_chassis %} + "BUFFER_QUEUE": { +{% for system_port in SYSTEM_PORT_ALL %} + "{{ system_port }}|3-4": { + "profile" : "egress_lossless_profile" + }, +{% endfor %} +{% for system_port in SYSTEM_PORT_ALL %} + "{{ system_port }}|0-2": { + "profile" : "egress_lossy_profile" + }, +{% endfor %} +{% for system_port in SYSTEM_PORT_ALL %} + "{{ system_port }}|5-6": { + "profile" : "egress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{% else %} {% if (defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports is defined) and (port_names_extra_queues != '') %} {{ defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }} {% elif (defs.generate_queue_buffers_with_extra_lossless_queues is defined) and (port_names_extra_queues != '') %} @@ -218,6 +256,7 @@ def {% endfor %} } {% endif %} +{% endif %} {%- if dynamic_mode is defined -%} , {%- endif -%} diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index c0fc08e86e2..b490dc424b0 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -37,12 +37,12 @@ ("lldp", "enabled", true, "enabled"), ("pmon", "enabled", true, "enabled"), ("pmon", "enabled", false, "enabled"), - ("radv", "enabled", false, "enabled"), ("snmp", "enabled", true, "enabled"), ("eventd", "enabled", false, "enabled"), ("swss", "enabled", false, "enabled"), - ("syncd", "enabled", false, "enabled"), - ("teamd", "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] %}disabled{% else %}enabled{% endif %}", false, "enabled")] %} + ("syncd", "enabled", false, "enabled")] %} +{%- if include_router_advertiser == "y" %}{% do features.append(("radv", "enabled", false, "enabled")) %}{% endif %} +{%- if include_teamd == "y" %}{% do features.append(("teamd", "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] %}disabled{% else %}enabled{% endif %}", false, "enabled")) %}{% endif %} {% do features.append(("dhcp_relay", "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['ToRRouter', 'EPMS', 'MgmtTsToR', 'MgmtToRRouter', 'BmcMgmtToRRouter']) %}enabled{% else %}disabled{% endif %}", false, "enabled")) %} {%- if sonic_asic_platform == "vs" %}{% do features.append(("gbsyncd", "enabled", false, "enabled")) %}{% endif %} {%- if include_iccpd == "y" %}{% do features.append(("iccpd", "disabled", false, "enabled")) %}{% endif %} @@ -67,6 +67,7 @@ "has_per_asic_scope": {% if feature + '@.service' in installer_services.split(' ') %}"True"{% else %}"False"{% endif %}, {%- endif %} "auto_restart": "{{autorestart}}", + "support_syslog_rate_limit" : "true", {# Set check_up_status to true here when app readiness will be marked in state db #} {# For now, to support the infrastrucure, setting the check_up_status to false for bgp,swss,pmon #} {# Once apps like bgp,synd supports app readiness, then bgp,syncd can set check_up_status to true #} @@ -103,6 +104,20 @@ "rate_limit_interval" : "600", "available_mem_threshold": "10.0" }{%if not loop.last %},{% endif -%} +{% endfor %} + }, + "SYSLOG_CONFIG": { + "GLOBAL": { + "rate_limit_interval" : "0", + "rate_limit_burst" : "0" + } + }, + "SYSLOG_CONFIG_FEATURE": { +{%- for feature, _, _, _ in features %} + "{{feature}}": { + "rate_limit_interval" : "300", + "rate_limit_burst": "20000" + }{%if not loop.last %},{% endif -%} {% endfor %} }, "PASSW_HARDENING": { diff --git a/files/build_templates/manifest.json.j2 b/files/build_templates/manifest.json.j2 index dff92ac2163..3deac2285e9 100644 --- a/files/build_templates/manifest.json.j2 +++ b/files/build_templates/manifest.json.j2 @@ -28,6 +28,9 @@ "fast-shutdown": { "after": {{ fast_shutdown_after.split()|json if fast_shutdown_after is defined else [] }}, "before": {{ fast_shutdown_before.split()|json if fast_shutdown_before is defined else [] }} + }, + "syslog": { + "support-rate-limit": {{ support_rate_limit if support_rate_limit else 'true' }} } }, "container": { diff --git a/files/build_templates/per_namespace/swss.service.j2 b/files/build_templates/per_namespace/swss.service.j2 index 765bee8a7ac..58bca6a219a 100644 --- a/files/build_templates/per_namespace/swss.service.j2 +++ b/files/build_templates/per_namespace/swss.service.j2 @@ -11,7 +11,6 @@ Requires=opennsl-modules.service {% endif %} Requires=updategraph.service After=updategraph.service -After=interfaces-config.service BindsTo=sonic.target After=sonic.target Before=ntp-config.service diff --git a/files/build_templates/per_namespace/syncd.service.j2 b/files/build_templates/per_namespace/syncd.service.j2 index 9acf97c29fd..b509e7732cf 100644 --- a/files/build_templates/per_namespace/syncd.service.j2 +++ b/files/build_templates/per_namespace/syncd.service.j2 @@ -16,7 +16,6 @@ After=nps-modules.service {% endif %} Requires=updategraph.service After=updategraph.service -After=interfaces-config.service BindsTo=sonic.target After=sonic.target Before=ntp-config.service diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 8692ff6484c..c21a5151aa8 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 @@ -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 diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 index 5db3ec86b79..d20fb5d00ae 100644 --- a/files/image_config/rsyslog/rsyslog.conf.j2 +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -14,6 +14,25 @@ ################# $ModLoad imuxsock # provides support for local system logging + +{% if SYSLOG_CONFIG is defined %} +{% if 'GLOBAL' in SYSLOG_CONFIG %} +{% if 'rate_limit_interval' in SYSLOG_CONFIG['GLOBAL']%} +{% set rate_limit_interval = SYSLOG_CONFIG['GLOBAL']['rate_limit_interval'] %} +{% endif %} +{% if 'rate_limit_burst' in SYSLOG_CONFIG['GLOBAL']%} +{% set rate_limit_burst = SYSLOG_CONFIG['GLOBAL']['rate_limit_burst'] %} +{% endif %} +{% endif %} +{% endif %} + +{% if rate_limit_interval is defined %} +$SystemLogRateLimitInterval {{ rate_limit_interval }} +{% endif %} +{% if rate_limit_burst is defined %} +$SystemLogRateLimitBurst {{ rate_limit_burst }} +{% endif %} + $ModLoad imklog # provides kernel logging support #$ModLoad immark # provides --MARK-- message capability diff --git a/functions.sh b/functions.sh index 6015704d58d..cb52bf816c5 100644 --- a/functions.sh +++ b/functions.sh @@ -51,8 +51,8 @@ docker_try_rmi() { } sonic_get_version() { - local describe=$(git describe --tags) - local latest_tag=$(git describe --tags --abbrev=0) + local describe=$(git describe --tags 2>/dev/null) + local latest_tag=$(git describe --tags --abbrev=0 2>/dev/null) local branch_name=$(git rev-parse --abbrev-ref HEAD) if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then local dirty="-dirty-$BUILD_TIMESTAMP" diff --git a/platform/barefoot/docker-saiserver-bfn.mk b/platform/barefoot/docker-saiserver-bfn.mk new file mode 100644 index 00000000000..dde7e8888a5 --- /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 6fa5b1818a1..00000000000 --- 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 00000000000..a17cca1a857 --- /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 4d3be08ce5f..00000000000 --- 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 b20b2c6f0e0..00000000000 --- 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 00000000000..fa1ed0eb162 --- /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 139597f9cb0..00000000000 --- 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 00000000000..06fcf6c3f3a --- /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 16457d13e03..ce82391c9b8 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 e09ac3cbb44..4400184e539 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 0fb5ca0cb81..a35cf13e5e2 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 3eaa35fdb2c..58f52f5ffd5 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) diff --git a/platform/broadcom/docker-saiserver-brcm.mk b/platform/broadcom/docker-saiserver-brcm.mk index 2ee39c8600e..6987e42faa7 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 92914d7abbf..2e83500b7ea 100644 --- a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 @@ -2,7 +2,6 @@ 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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -26,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 00000000000..06fcf6c3f3a --- /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 81813b57ff9..6a395866c15 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 3574cd782b7..d20dac89141 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 diff --git a/platform/broadcom/docker-syncd-brcm-dnx/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-dnx/Dockerfile.j2 index 230c2628f41..8bf6a4e5028 100755 --- a/platform/broadcom/docker-syncd-brcm-dnx/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-dnx/Dockerfile.j2 @@ -3,8 +3,6 @@ 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 - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 6900e7c933b..4037ddc6af1 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -3,8 +3,6 @@ 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 - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/broadcom/platform-modules-ragile.mk b/platform/broadcom/platform-modules-ragile.mk index 74ce1b04f47..12236b1e72c 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 28d1cf1a4df..dde11b58f59 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-cel/debian/platform-modules-dx010.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init index 31bd7e58eff..fab61467da7 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` 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 50b85cc179e..9982582158f 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 74f8a766f6d..f9a9970016f 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 ccf90f881b0..c69d5ef34ea 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 b2f06785f0d..6822ed98827 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 0fc484be2f0..9df70736c87 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/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py index eb99821ae8a..47bf5584e6c 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py @@ -123,11 +123,7 @@ def __init__(self): for port_num in range(self.PORT_START, (self.PORT_END + 1)): # sfp get uses zero-indexing, but port numbers start from 1 - presence = self.get_sfp(port_num-1).get_presence() - if presence: - self._global_port_pres_dict[port_num] = '1' - else: - self._global_port_pres_dict[port_num] = '0' + self._global_port_pres_dict[port_num] = '0' self.LOCATOR_LED_ON = self.STATUS_LED_COLOR_BLUE_BLINK self.LOCATOR_LED_OFF = self.STATUS_LED_COLOR_OFF diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/component.py index fba51283565..d7a93cf5f4b 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/component.py @@ -78,7 +78,7 @@ def __init__(self, component_index = 0): self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] - self.version = self.CHASSIS_COMPONENTS[self.index][2]() + self.version = None def get_name(self): """ @@ -102,6 +102,8 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ + if self.version == None: + self.version = self.CHASSIS_COMPONENTS[self.index][2]() return self.version def get_presence(self): 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 6b8b6c92870..d1a2b30e961 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 483dd59a560..f03c2fc9b4d 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/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py index 02ebfbc3b7b..1d14e2c0f30 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py @@ -125,11 +125,7 @@ def __init__(self): for port_num in range(self.PORT_START, (self.PORT_END + 1)): # sfp get uses zero-indexing, but port numbers start from 1 - presence = self.get_sfp(port_num-1).get_presence() - if presence: - self._global_port_pres_dict[port_num] = '1' - else: - self._global_port_pres_dict[port_num] = '0' + self._global_port_pres_dict[port_num] = '0' self.LOCATOR_LED_ON = self.STATUS_LED_COLOR_BLUE_BLINK self.LOCATOR_LED_OFF = self.STATUS_LED_COLOR_OFF diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/component.py index b0dabc1398b..25f1f3b67fe 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/component.py @@ -77,7 +77,7 @@ def __init__(self, component_index = 0): self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] - self.version = self.CHASSIS_COMPONENTS[self.index][2]() + self.version = None def get_name(self): """ @@ -101,6 +101,8 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ + if self.version == None: + self.version = self.CHASSIS_COMPONENTS[self.index][2]() return self.version def install_firmware(self, image_path): 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 65eca492610..0d612854c38 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 5db98374039..a3a4b2f4678 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/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py index 41f985a173f..f0c67d4e92a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py @@ -92,8 +92,7 @@ def __init__(self): for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK): # sfp get uses zero-indexing, but port numbers start from 1 - presence = self.get_sfp(port_num).get_presence() - self._global_port_pres_dict[port_num] = '1' if presence else '0' + self._global_port_pres_dict[port_num] = '0' def __del__(self): if self.oir_fd != -1: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py index 52f2bacd70a..2a81be140d2 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py @@ -86,7 +86,7 @@ def __init__(self, component_index = 0): self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] - self.version = self.CHASSIS_COMPONENTS[self.index][2]() + self.version = None def get_name(self): """ @@ -110,6 +110,8 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ + if self.version == None: + self.version = self.CHASSIS_COMPONENTS[self.index][2]() return self.version def install_firmware(self, image_path): 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 7b2e9025bbd..74cfbf1b931 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 f276e6879d2..e05ec4c8883 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/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/chassis.py index b047ec0c96f..fc0768368e4 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/chassis.py @@ -151,8 +151,7 @@ def __init__(self): self._component_list = [Component(i) for i in range(MAX_S5248F_COMPONENT)] for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK): # sfp get uses zero-indexing, but port numbers start from 1 - presence = self.get_sfp(port_num-1).get_presence() - self._global_port_pres_dict[port_num] = '1' if presence else '0' + self._global_port_pres_dict[port_num] = '0' #self.LOCATOR_LED_ON = self.STATUS_LED_COLOR_BLUE_BLINK #self.LOCATOR_LED_OFF = self.STATUS_LED_COLOR_OFF diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/component.py index fdca4614c2f..f55099cdecd 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/component.py @@ -86,7 +86,7 @@ def __init__(self, component_index = 0): self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] - self.version = self.CHASSIS_COMPONENTS[self.index][2]() + self.version = None def get_name(self): """ @@ -110,6 +110,8 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ + if self.version == None: + self.version = self.CHASSIS_COMPONENTS[self.index][2]() return self.version def install_firmware(self, image_path): 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 b568b6fa153..af29c3a1803 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 4c6ef3b229a..615e8caf1b1 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/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/chassis.py index c981e4bc7ad..d3828765496 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5296f/sonic_platform/chassis.py @@ -126,6 +126,9 @@ def __init__(self): self._num_fans = MAX_S5296F_FANTRAY * MAX_S5296F_FAN self._watchdog = Watchdog() + for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK): + # sfp get uses zero-indexing, but port numbers start from 1 + self._global_port_pres_dict[port_num] = '0' def __del__(self): if self.oir_fd != -1: 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 43c43e0a4ef..cc0022e43e3 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 @@ -111,7 +110,7 @@ def __init__(self, component_index = 0): self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] - self.version = self.CHASSIS_COMPONENTS[self.index][2]() + self.version = None def get_name(self): """ @@ -135,6 +134,8 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ + if self.version == None: + self.version = self.CHASSIS_COMPONENTS[self.index][2]() return self.version def get_presence(self): 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 d87ad3db746..c94baaec105 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/s6000/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py index 6ae79ffadb0..5ff498fe8d8 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py @@ -56,6 +56,8 @@ class Chassis(ChassisBase): _is_fan_control_enabled = False _fan_control_initialised = False + _global_port_pres_dict = {} + def __init__(self): ChassisBase.__init__(self) self.status_led_reg = "system_led" @@ -107,6 +109,9 @@ def __init__(self): component = Component(i) self._component_list.append(component) + for port_num in range(self.PORT_START, (self.PORT_END + 1)): + self._global_port_pres_dict[port_num] = '0' + def _get_cpld_register(self, reg_name): rv = 'ERR' mb_reg_file = self.CPLD_DIR+'/'+reg_name diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py index b3d258f32e8..6af22720f1c 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py @@ -65,6 +65,8 @@ class Chassis(ChassisBase): 'amber': 0x02, 'blinking amber': 0x08 } + _global_port_pres_dict = {} + def __init__(self): ChassisBase.__init__(self) @@ -103,6 +105,13 @@ def __init__(self): component = Component(i) self._component_list.append(component) + for i in self._sfp_list: + presence = i.get_presence() + if presence: + self._global_port_pres_dict[i.index] = '1' + else: + self._global_port_pres_dict[i.index] = '0' + bios_ver = self.get_component(0).get_firmware_version() bios_minor_ver = bios_ver.split("-")[-1] if bios_minor_ver.isdigit() and (int(bios_minor_ver) >= 9): diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py index ab3bb174e62..cab1998be39 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py @@ -11,6 +11,7 @@ try: from sonic_eeprom import eeprom_tlvinfo + import os except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -27,6 +28,10 @@ def __init__(self, i2c_line=0, iom_eeprom=False): super(Eeprom, self).__init__(self.eeprom_path, 0, '', True) self.eeprom_tlv_dict = dict() + if os.geteuid() != 0: + self.eeprom_data = "N/A" + return + try: if self.is_module: self.write_eeprom(b"\x00\x00") 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 bcc13452a82..25b206a1fec 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/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py index 9430f918f96..d1b2766b95a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py @@ -83,11 +83,8 @@ def __init__(self): self._thermal_list.append(thermal) for port_num in range(self.PORT_START, (self.PORT_END + 1)): - presence = self.get_sfp(port_num).get_presence() - if presence: - self._global_port_pres_dict[port_num] = '1' - else: - self._global_port_pres_dict[port_num] = '0' + #presence = self.get_sfp(port_num).get_presence() + self._global_port_pres_dict[port_num] = '0' def __del__(self): if self.oir_fd != -1: 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 2e20fa9e0e0..a234ba04c17 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 1a5778525db..ecc9f67d357 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/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py index d59deb8b0a9..c22466c6c13 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py @@ -147,8 +147,7 @@ def __init__(self): self._component_list = [Component(i) for i in range(MAX_Z9332F_COMPONENT)] for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK): # sfp get uses zero-indexing, but port numbers start from 1 - presence = self.get_sfp(port_num).get_presence() - self._global_port_pres_dict[port_num] = '1' if presence else '0' + self._global_port_pres_dict[port_num] = '0' self._watchdog = Watchdog() def __del__(self): 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 7e413e041ae..62f4402fd42 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") @@ -153,7 +154,7 @@ def __init__(self, component_index=0): self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] - self.version = self.CHASSIS_COMPONENTS[self.index][2]() + self.version = None @staticmethod def _get_available_firmware_version(image_path): @@ -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() @@ -242,6 +243,8 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ + if self.version == None: + self.version = self.CHASSIS_COMPONENTS[self.index][2]() return self.version def get_presence(self): 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 693c83743ec..fbd5b2b8ea1 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 3446a09321d..1d1230019e0 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/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/chassis.py index bb2446445f5..e8a878d773f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9432f/sonic_platform/chassis.py @@ -130,8 +130,7 @@ def __init__(self): self._thermal_list = [Thermal(i) for i in range(MAX_Z9432F_THERMAL)] self._component_list = [Component(i) for i in range(MAX_Z9432F_COMPONENT)] for port_num in range(PORT_START, PORTS_IN_BLOCK): - presence = self.get_sfp(port_num).get_presence() - self._global_port_pres_dict[port_num] = '1' if presence else '0' + self._global_port_pres_dict[port_num] = '0' self._watchdog = Watchdog() #self.LOCATOR_LED_ON = self.STATUS_LED_COLOR_BLUE_BLINK 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 763db39f5ec..8d5ab6c6485 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") @@ -127,7 +128,7 @@ def __init__(self, component_index=0): self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] - self.version = self.CHASSIS_COMPONENTS[self.index][2]() + self.version = None @staticmethod def _get_available_firmware_version(image_path): @@ -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() @@ -208,6 +210,8 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ + if self.version == None: + self.version = self.CHASSIS_COMPONENTS[self.index][2]() return self.version def get_presence(self): 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 eaff8e9b1d4..bc43ba712c6 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: 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 3df7c73ecad..b1d1a984721 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 81068a14029..7857f854d60 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 82ae9f558f5..669198ca59f 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 f7b6bb952bf..76270a94ec8 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 501cfef8a91..4988fcc7f2c 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 7115fdabec1..e15bed475d2 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 39b778a4734..cd5550ab41b 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 e4fc735643d..f28852ec331 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 a76539019cc..a30dd7d86a4 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 00000000000..770cabc331e --- /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 00000000000..0d9d6a34d2a --- /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 e32da1faa71..7e5aa13b2e0 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 46415e74ab7..f197dce8cdd 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 5776735ef4f..d9968f9151a 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 00000000000..134e3a9872e --- /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 ae8e7418682..9082bbd2570 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 beb701cb590..7d139eb8fed 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 b3dd67ed52c..d91e42dfda8 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 2f83b66df94..d03fd656f4d 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 00000000000..c604d9c6116 --- /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 240af5d2d1b..71eacf763ff 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 ea8e256fe6e..c1d4cb998a6 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 00000000000..1bac5e80c71 --- /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 99b743c6d34..f2a73e5f5db 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 9e262d7c095..bc2010b78e3 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 9267a18f0b5..f179b279cc1 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 1d171a58e43..0fd19ccf99b 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 4ff45cb8129..d03fd656f4d 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 00000000000..c604d9c6116 --- /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 8595e80692d..6ff9446b951 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 240af5d2d1b..71eacf763ff 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 a216a37afcf..c1d4cb998a6 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 00000000000..d468912fdda --- /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 99b743c6d34..f2a73e5f5db 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 9e262d7c095..bc2010b78e3 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 0ed22d77062..bfa58a02c77 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 00000000000..73e2a89c8d7 --- /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 00000000000..56e9d8664a2 --- /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 396a96420e2..22f6202c5c5 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 4ff45cb8129..d03fd656f4d 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 00000000000..d61925e5ff8 --- /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 72a6d8f0825..71eacf763ff 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 d9b6e491bef..2aff4e5fe04 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 5b829fc26ca..77d6ec7ae88 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 46415e74ab7..f197dce8cdd 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 97ca23a9232..a789889e2a9 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 5d428f66856..efbb8859f71 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 2f83b66df94..d03fd656f4d 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 57dd5117a2c..71eacf763ff 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 ea8e256fe6e..2aff4e5fe04 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 99b743c6d34..f2a73e5f5db 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/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index f60fa0fe579..5932da25320 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 b/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 index 33941235bf9..2e0e8ecca83 100644 --- a/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 index 046de960cd2..175d18505d6 100755 --- a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/centec-arm64/sai.mk b/platform/centec-arm64/sai.mk index b07f334c2f0..2a8ee5c45d3 100755 --- a/platform/centec-arm64/sai.mk +++ b/platform/centec-arm64/sai.mk @@ -1,6 +1,6 @@ # Centec SAI -export CENTEC_SAI_VERSION = 1.10.1-0 +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 diff --git a/platform/centec/docker-saiserver-centec/Dockerfile.j2 b/platform/centec/docker-saiserver-centec/Dockerfile.j2 index 33941235bf9..2e0e8ecca83 100644 --- a/platform/centec/docker-saiserver-centec/Dockerfile.j2 +++ b/platform/centec/docker-saiserver-centec/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index c1d122eeb9a..9993539887a 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/centec/sdk.mk b/platform/centec/sdk.mk index 7fe7122a4bf..ae836d2bf3d 100644 --- a/platform/centec/sdk.mk +++ b/platform/centec/sdk.mk @@ -1,8 +1,8 @@ # Centec SAI -CENTEC_SAI = libsai_1.10.1-0_amd64.deb +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.10.1-0_amd64.deb +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))) diff --git a/platform/components/docker-gbsyncd-broncos/Dockerfile.j2 b/platform/components/docker-gbsyncd-broncos/Dockerfile.j2 index ca7670acb62..3bb3f402098 100644 --- a/platform/components/docker-gbsyncd-broncos/Dockerfile.j2 +++ b/platform/components/docker-gbsyncd-broncos/Dockerfile.j2 @@ -1,7 +1,6 @@ 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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/components/docker-gbsyncd-credo/Dockerfile.j2 b/platform/components/docker-gbsyncd-credo/Dockerfile.j2 index 3010dc7fdad..24fef740dc3 100644 --- a/platform/components/docker-gbsyncd-credo/Dockerfile.j2 +++ b/platform/components/docker-gbsyncd-credo/Dockerfile.j2 @@ -1,7 +1,6 @@ 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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 index ef0c3d57e02..0811d044b02 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-stretch-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 index 7ec04c49fc4..d07c2523182 100755 --- a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 @@ -3,8 +3,6 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 index b5e70888a59..84e3d5bde2f 100755 --- a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 @@ -3,8 +3,6 @@ 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 - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index cb2f7eadb91..4de6df31383 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -3,8 +3,6 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 index 0f6745d580a..40cf0634bbb 100644 --- a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 @@ -18,7 +18,6 @@ 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 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index fd50f67495a..a23baaec23c 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -19,8 +19,6 @@ 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 - RUN mkdir -p /var/run/sx_sdk ## Make apt-get non-interactive diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 96a7b9e2315..e13b90d6c0c 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/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index 2ca37fcefdf..5f2ca310f31 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -345,7 +345,7 @@ def _read_eeprom(self, offset, num_bytes, log_on_error=True): raise IOError(f'errno = {os.strerror(ctypes.get_errno())}') except (OSError, IOError) as e: if log_on_error: - logger.log_error(f'Failed to read sfp={self.sdk_index} EEPROM page={page}, page_offset={page_offset}, \ + logger.log_warning(f'Failed to read sfp={self.sdk_index} EEPROM page={page}, page_offset={page_offset}, \ size={num_bytes}, offset={offset}, error = {e}') return None diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py index 2bc312cd223..634078c9a07 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py @@ -186,17 +186,8 @@ def is_host(): Test whether current process is running on the host or an docker return True for host and False for docker """ - try: - proc = subprocess.Popen(["docker", "--version"], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - universal_newlines=True) - stdout = proc.communicate()[0] - proc.wait() - result = stdout.rstrip('\n') - return result != '' - except OSError as e: - return False + docker_env_file = '/.dockerenv' + return os.path.exists(docker_env_file) is False def default_return(return_value, log_func=logger.log_debug): diff --git a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py index 2aa4f78855f..cffdd437695 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 diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 index 5077db79662..d26abf76a05 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-stretch-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index e77781223dc..80503b910e8 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/pddf/platform-modules-pddf.mk b/platform/pddf/platform-modules-pddf.mk index 33d97e7fb50..a772f3a1300 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/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index 4dd9abf49ee..7e5219f5512 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -2,8 +2,6 @@ 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 - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 56180b51b1c..87b17e90332 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name + COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/vs/docker-syncd-vs/Dockerfile.j2 b/platform/vs/docker-syncd-vs/Dockerfile.j2 index dd6bc2d0f71..27506903b7f 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name -RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/vs/sonic-gns3a.sh b/platform/vs/sonic-gns3a.sh index 2a772ce5a33..f3ffd1b636b 100644 --- a/platform/vs/sonic-gns3a.sh +++ b/platform/vs/sonic-gns3a.sh @@ -1,12 +1,12 @@ #!/bin/bash # This script creates a .gns3a SONiC appliance file -IMGFILE="sonic-vs.image" +IMGFILE="sonic-vs.img" RELEASE="latest" usage() { - echo "`basename $0` [ -r ] -b " - echo "e.g.: `basename $0` -r 1.1 -b /sonic-vs.image" + echo "`basename $0` [ -r ] -b " + echo "e.g.: `basename $0` -r 1.1 -b /sonic-vs.img" exit 0 } diff --git a/rules/config b/rules/config index c72c572ab6f..c01adc0f539 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 @@ -235,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/rules/docker-sonic-mgmt.mk b/rules/docker-sonic-mgmt.mk index 8d6901755f8..b1aaad34873 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/rules/functions b/rules/functions index 62b3c8a9837..ab0096d6ac5 100644 --- a/rules/functions +++ b/rules/functions @@ -198,6 +198,7 @@ define generate_manifest $(eval export config_cli_plugin=$($(1).gz_CLI_CONFIG_PLUGIN)) $(eval export show_cli_plugin=$($(1).gz_CLI_SHOW_PLUGIN)) $(eval export clear_cli_plugin=$($(1).gz_CLI_CLEAR_PLUGIN)) + $(eval export support_rate_limit=$($(1).gz_SUPPORT_RATE_LIMIT)) j2 --customize scripts/j2cli/json_filter.py files/build_templates/manifest.json.j2 > $($(1).gz_PATH)/manifest.common.json if [ -f $($*.gz_PATH)/manifest.part.json.j2 ]; then j2 --customize scripts/j2cli/json_filter.py $($(1).gz_PATH)/manifest.part.json.j2 > $($(1).gz_PATH)/manifest.part.json diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 1a1ad54678b..0951836470c 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 diff --git a/scripts/build_mirror_config.sh b/scripts/build_mirror_config.sh index 5f94e701cbd..a1e5900a48b 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 b0ec5492424..87eb612007b 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/prepare_docker_buildinfo.sh b/scripts/prepare_docker_buildinfo.sh index 3be1997098e..23e664affa1 100755 --- a/scripts/prepare_docker_buildinfo.sh +++ b/scripts/prepare_docker_buildinfo.sh @@ -38,7 +38,7 @@ if [ -z "$DISTRO" ]; then fi fi -if [[ "$IMAGENAME" == docker-base-* ]]; then +if [[ "$IMAGENAME" == docker-base-* ]] || [[ "$IMAGENAME" == docker-ptf ]]; then scripts/build_mirror_config.sh ${DOCKERFILE_PATH} $ARCH $DISTRO fi diff --git a/scripts/versions_manager.py b/scripts/versions_manager.py index 27b757721f2..50fd9452454 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 3a3381ff2d7..2d8006fb8aa 100644 --- a/slave.mk +++ b/slave.mk @@ -11,7 +11,7 @@ UID = $(shell id -u) GUID = $(shell id -g) ifeq ($(SONIC_IMAGE_VERSION),) - override SONIC_IMAGE_VERSION = $(shell export BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) && export BUILD_NUMBER=$(BUILD_NUMBER) && . functions.sh && sonic_get_version) + override SONIC_IMAGE_VERSION := $(shell export BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) && export BUILD_NUMBER=$(BUILD_NUMBER) && . functions.sh && sonic_get_version) endif .SECONDEXPANSION: @@ -87,6 +87,7 @@ export CROSS_BUILD_ENVIRON export BLDENV export BUILD_WORKDIR export GZ_COMPRESS_PROGRAM +export MIRROR_SNAPSHOT ############################################################################### ## Utility rules @@ -1254,6 +1255,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" export enable_ztp="$(ENABLE_ZTP)" + export include_teamd="$(INCLUDE_TEAMD)" + export include_router_advertiser="$(INCLUDE_ROUTER_ADVERTISER)" export include_system_telemetry="$(INCLUDE_SYSTEM_TELEMETRY)" export include_restapi="$(INCLUDE_RESTAPI)" export include_nat="$(INCLUDE_NAT)" diff --git a/src/dhcpmon/src/dhcp_device.cpp b/src/dhcpmon/src/dhcp_device.cpp index 8ec91b057b6..f4f23526e13 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 a2b2a789fca..2e376ac77e6 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 4860b2b06a5..662f507c2b5 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 = { diff --git a/src/dhcprelay b/src/dhcprelay index 9b30690f33e..4bf1868dcf3 160000 --- a/src/dhcprelay +++ b/src/dhcprelay @@ -1 +1 @@ -Subproject commit 9b30690f33eb994e461aa90524561d56298c8207 +Subproject commit 4bf1868dcf3f77edfd298950e6c8826d24be8118 diff --git a/src/sonic-build-hooks/hooks/dpkg b/src/sonic-build-hooks/hooks/dpkg old mode 100644 new mode 100755 index 7fbc90f9fe5..294cb19f4c1 --- a/src/sonic-build-hooks/hooks/dpkg +++ b/src/sonic-build-hooks/hooks/dpkg @@ -3,8 +3,16 @@ . /usr/local/share/buildinfo/scripts/buildinfo_base.sh REAL_COMMAND=$(get_command dpkg) COMMAND_INFO="Locked by command: $REAL_COMMAND $@" -lock_result=$(acquire_apt_installation_lock "$COMMAND_INFO" ) +NEED_RELEASE_LOCK=n +if [[ "$DPKG_HOOK_LOCKED" != "y" ]];then + lock_result=$(acquire_apt_installation_lock "$COMMAND_INFO" ) + export DPKG_HOOK_LOCKED=y + NEED_RELEASE_LOCK=y +fi $REAL_COMMAND "$@" command_result=$? +if [[ "$NEED_RELEASE_LOCK" == "y" ]];then + unset DPKG_HOOK_LOCKED +fi [ "$lock_result" == y ] && release_apt_installation_lock exit $command_result diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index 52e5194f9cf..b42e37bf62b 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 @@ -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 @@ -111,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 6e082406da5..081ded342c4 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 diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 9cd43b6b0ab..ecfb2c3cd85 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/sample_output/py2/buffer-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json index fd9984e4208..aa8dab48684 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json +++ b/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json @@ -217,410 +217,1301 @@ }, "BUFFER_QUEUE": { - "Ethernet180|3-4": { + "dut-lc3|Asic0|Ethernet0|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet8|3-4": { + "dut-lc3|Asic0|Ethernet4|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet184|3-4": { + "dut-lc3|Asic0|Ethernet8|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet188|3-4": { + "dut-lc3|Asic0|Ethernet12|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet0|3-4": { + "dut-lc3|Asic0|Ethernet16|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet4|3-4": { + "dut-lc3|Asic0|Ethernet20|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet108|3-4": { + "dut-lc3|Asic0|Ethernet24|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet100|3-4": { + "dut-lc3|Asic0|Ethernet28|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet128|3-4": { + "dut-lc3|Asic0|Ethernet32|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet104|3-4": { + "dut-lc3|Asic0|Ethernet36|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet68|3-4": { + "dut-lc3|Asic0|Ethernet40|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet96|3-4": { + "dut-lc3|Asic0|Ethernet44|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet124|3-4": { + "dut-lc3|Asic0|Ethernet48|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet148|3-4": { + "dut-lc3|Asic0|Ethernet52|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet92|3-4": { + "dut-lc3|Asic0|Ethernet56|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet120|3-4": { + "dut-lc3|Asic0|Ethernet60|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet144|3-4": { + "dut-lc3|Asic0|Ethernet64|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet52|3-4": { + "dut-lc3|Asic0|Ethernet68|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet140|3-4": { + "dut-lc3|Asic0|Ethernet72|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet56|3-4": { + "dut-lc3|Asic0|Ethernet76|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet164|3-4": { + "dut-lc3|Asic0|Ethernet80|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet76|3-4": { + "dut-lc3|Asic0|Ethernet84|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet72|3-4": { + "dut-lc3|Asic0|Ethernet88|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet64|3-4": { + "dut-lc3|Asic0|Ethernet92|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet32|3-4": { + "dut-lc3|Asic0|Ethernet96|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet16|3-4": { + "dut-lc3|Asic0|Ethernet100|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet36|3-4": { + "dut-lc3|Asic0|Ethernet104|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet12|3-4": { + "dut-lc3|Asic0|Ethernet108|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet88|3-4": { + "dut-lc3|Asic0|Ethernet112|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet116|3-4": { + "dut-lc3|Asic0|Ethernet116|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet80|3-4": { + "dut-lc3|Asic0|Ethernet120|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet112|3-4": { + "dut-lc3|Asic0|Ethernet124|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet84|3-4": { + "dut-lc3|Asic0|Ethernet128|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet152|3-4": { + "dut-lc3|Asic0|Ethernet132|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet136|3-4": { + "dut-lc3|Asic0|Ethernet136|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet156|3-4": { + "dut-lc3|Asic0|Ethernet140|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet132|3-4": { + "dut-lc3|Asic0|Ethernet144|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet48|3-4": { + "dut-lc3|Asic0|Ethernet148|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet44|3-4": { + "dut-lc3|Asic0|Ethernet152|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet176|3-4": { + "dut-lc3|Asic0|Ethernet156|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet40|3-4": { + "dut-lc3|Asic0|Ethernet160|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet28|3-4": { + "dut-lc3|Asic0|Ethernet164|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet60|3-4": { + "dut-lc3|Asic0|Ethernet168|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet20|3-4": { + "dut-lc3|Asic0|Ethernet172|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet24|3-4": { + "dut-lc3|Asic0|Ethernet176|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet180|0-2": { + "dut-lc3|Asic0|Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc3|Asic0|Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc3|Asic0|Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet128|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet132|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet136|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet140|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet144|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet148|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet152|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet156|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet160|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet164|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet168|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet172|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet176|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet128|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet132|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet136|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet140|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet144|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet148|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet152|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet156|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet160|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet164|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet168|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet172|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet176|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc3|Asic0|Ethernet0|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet4|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet8|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet12|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet16|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet20|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet24|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet28|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet32|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet36|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet40|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet44|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet48|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet52|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet56|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet60|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet64|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet68|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet72|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet76|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet80|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet84|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet88|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet92|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet96|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet100|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet104|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet108|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet112|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet116|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet120|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet124|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet128|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet132|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet136|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet140|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet144|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet148|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet152|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet156|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet160|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet164|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet168|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet172|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet176|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet180|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet184|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet188|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet0|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet4|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet8|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet12|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet16|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet20|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet24|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet28|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet32|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet36|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet40|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet44|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet48|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet52|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet56|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet60|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet64|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet68|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet72|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet76|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet80|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet84|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet88|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet92|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet96|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet100|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet104|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet108|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet112|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet116|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet120|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet124|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet128|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet132|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet136|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet140|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet144|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet148|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet152|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet156|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet160|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet164|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet168|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet172|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet176|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet180|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet184|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet188|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet0|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet4|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet8|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet12|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet16|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet20|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet24|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet28|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet32|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet36|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet40|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet44|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet48|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet52|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet56|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet60|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet64|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet68|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet72|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet76|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet80|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet84|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet88|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet92|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet96|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet100|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet104|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet108|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet112|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet116|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet120|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet124|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet128|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet132|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet136|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet140|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet144|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet148|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet152|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet156|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet160|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet164|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet168|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet172|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet176|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet180|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet184|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet188|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet0|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet4|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet8|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet12|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet16|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet20|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet24|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet28|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet32|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet36|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet40|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet44|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet48|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet52|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet56|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet60|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet64|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet68|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet72|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet76|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet80|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet84|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet88|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet92|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet96|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet100|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet104|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet108|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet112|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet116|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet120|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet124|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet128|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet132|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet136|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet140|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet144|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet148|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet152|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet156|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet160|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet164|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet168|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet172|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet176|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet180|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet184|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet188|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet0|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet4|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet8|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet12|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet16|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet20|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet24|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet8|0-2": { + "dut-lc4|Asic0|Ethernet28|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet184|0-2": { + "dut-lc4|Asic0|Ethernet32|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet188|0-2": { + "dut-lc4|Asic0|Ethernet36|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet0|0-2": { + "dut-lc4|Asic0|Ethernet40|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet4|0-2": { + "dut-lc4|Asic0|Ethernet44|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet108|0-2": { + "dut-lc4|Asic0|Ethernet48|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet100|0-2": { + "dut-lc4|Asic0|Ethernet52|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet128|0-2": { + "dut-lc4|Asic0|Ethernet56|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet104|0-2": { + "dut-lc4|Asic0|Ethernet60|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet68|0-2": { + "dut-lc4|Asic0|Ethernet64|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet96|0-2": { + "dut-lc4|Asic0|Ethernet68|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet124|0-2": { + "dut-lc4|Asic0|Ethernet72|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet148|0-2": { + "dut-lc4|Asic0|Ethernet76|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet92|0-2": { + "dut-lc4|Asic0|Ethernet80|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet120|0-2": { + "dut-lc4|Asic0|Ethernet84|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet144|0-2": { + "dut-lc4|Asic0|Ethernet88|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet52|0-2": { + "dut-lc4|Asic0|Ethernet92|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet140|0-2": { + "dut-lc4|Asic0|Ethernet96|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet56|0-2": { + "dut-lc4|Asic0|Ethernet100|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet164|0-2": { + "dut-lc4|Asic0|Ethernet104|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet76|0-2": { + "dut-lc4|Asic0|Ethernet108|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet72|0-2": { + "dut-lc4|Asic0|Ethernet112|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet64|0-2": { + "dut-lc4|Asic0|Ethernet116|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet32|0-2": { + "dut-lc4|Asic0|Ethernet120|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet16|0-2": { + "dut-lc4|Asic0|Ethernet124|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet36|0-2": { + "dut-lc4|Asic0|Ethernet128|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet12|0-2": { + "dut-lc4|Asic0|Ethernet132|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet88|0-2": { + "dut-lc4|Asic0|Ethernet136|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet116|0-2": { + "dut-lc4|Asic0|Ethernet140|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet80|0-2": { + "dut-lc4|Asic0|Ethernet144|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet112|0-2": { + "dut-lc4|Asic0|Ethernet148|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet84|0-2": { + "dut-lc4|Asic0|Ethernet152|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet152|0-2": { + "dut-lc4|Asic0|Ethernet156|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet136|0-2": { + "dut-lc4|Asic0|Ethernet160|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet156|0-2": { + "dut-lc4|Asic0|Ethernet164|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet132|0-2": { + "dut-lc4|Asic0|Ethernet168|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet48|0-2": { + "dut-lc4|Asic0|Ethernet172|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet44|0-2": { + "dut-lc4|Asic0|Ethernet176|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet176|0-2": { + "dut-lc4|Asic0|Ethernet180|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet40|0-2": { + "dut-lc4|Asic0|Ethernet184|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet28|0-2": { + "dut-lc4|Asic0|Ethernet188|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet60|0-2": { + "dut-lc5|Asic0|Ethernet0|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet20|0-2": { + "dut-lc5|Asic0|Ethernet4|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet24|0-2": { + "dut-lc5|Asic0|Ethernet8|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet180|5-6": { + "dut-lc5|Asic0|Ethernet12|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet8|5-6": { + }, + "dut-lc5|Asic0|Ethernet16|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet184|5-6": { + }, + "dut-lc5|Asic0|Ethernet20|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet188|5-6": { + }, + "dut-lc5|Asic0|Ethernet24|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet0|5-6": { + }, + "dut-lc5|Asic0|Ethernet28|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet4|5-6": { + }, + "dut-lc5|Asic0|Ethernet32|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet108|5-6": { + }, + "dut-lc5|Asic0|Ethernet36|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet100|5-6": { + }, + "dut-lc5|Asic0|Ethernet40|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet128|5-6": { + }, + "dut-lc5|Asic0|Ethernet44|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet104|5-6": { + }, + "dut-lc5|Asic0|Ethernet48|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet68|5-6": { + }, + "dut-lc5|Asic0|Ethernet52|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet96|5-6": { + }, + "dut-lc5|Asic0|Ethernet56|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet124|5-6": { + }, + "dut-lc5|Asic0|Ethernet60|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet148|5-6": { + }, + "dut-lc5|Asic0|Ethernet64|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet92|5-6": { + }, + "dut-lc5|Asic0|Ethernet68|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet120|5-6": { + }, + "dut-lc5|Asic0|Ethernet72|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet144|5-6": { + }, + "dut-lc5|Asic0|Ethernet76|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet52|5-6": { + }, + "dut-lc5|Asic0|Ethernet80|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet140|5-6": { + }, + "dut-lc5|Asic0|Ethernet84|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet56|5-6": { + }, + "dut-lc5|Asic0|Ethernet88|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet164|5-6": { + }, + "dut-lc5|Asic0|Ethernet92|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet76|5-6": { + }, + "dut-lc5|Asic0|Ethernet96|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet72|5-6": { + }, + "dut-lc5|Asic0|Ethernet100|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet64|5-6": { + }, + "dut-lc5|Asic0|Ethernet104|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet32|5-6": { + }, + "dut-lc5|Asic0|Ethernet108|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet16|5-6": { + }, + "dut-lc5|Asic0|Ethernet112|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet36|5-6": { + }, + "dut-lc5|Asic0|Ethernet116|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet12|5-6": { + }, + "dut-lc5|Asic0|Ethernet120|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet88|5-6": { + }, + "dut-lc5|Asic0|Ethernet124|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet116|5-6": { + }, + "dut-lc5|Asic0|Ethernet128|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet80|5-6": { + }, + "dut-lc5|Asic0|Ethernet132|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet112|5-6": { + }, + "dut-lc5|Asic0|Ethernet136|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet84|5-6": { + }, + "dut-lc5|Asic0|Ethernet140|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet152|5-6": { + }, + "dut-lc5|Asic0|Ethernet144|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet136|5-6": { + }, + "dut-lc5|Asic0|Ethernet148|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet156|5-6": { + }, + "dut-lc5|Asic0|Ethernet152|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet132|5-6": { + }, + "dut-lc5|Asic0|Ethernet156|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet48|5-6": { + }, + "dut-lc5|Asic0|Ethernet160|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet44|5-6": { + }, + "dut-lc5|Asic0|Ethernet164|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet176|5-6": { + }, + "dut-lc5|Asic0|Ethernet168|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet40|5-6": { + }, + "dut-lc5|Asic0|Ethernet172|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet28|5-6": { + }, + "dut-lc5|Asic0|Ethernet176|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet60|5-6": { + }, + "dut-lc5|Asic0|Ethernet180|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet20|5-6": { + }, + "dut-lc5|Asic0|Ethernet184|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet24|5-6": { + }, + "dut-lc5|Asic0|Ethernet188|5-6": { "profile" : "egress_lossy_profile" - } + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json index fd9984e4208..aa8dab48684 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json +++ b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json @@ -217,410 +217,1301 @@ }, "BUFFER_QUEUE": { - "Ethernet180|3-4": { + "dut-lc3|Asic0|Ethernet0|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet8|3-4": { + "dut-lc3|Asic0|Ethernet4|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet184|3-4": { + "dut-lc3|Asic0|Ethernet8|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet188|3-4": { + "dut-lc3|Asic0|Ethernet12|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet0|3-4": { + "dut-lc3|Asic0|Ethernet16|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet4|3-4": { + "dut-lc3|Asic0|Ethernet20|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet108|3-4": { + "dut-lc3|Asic0|Ethernet24|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet100|3-4": { + "dut-lc3|Asic0|Ethernet28|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet128|3-4": { + "dut-lc3|Asic0|Ethernet32|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet104|3-4": { + "dut-lc3|Asic0|Ethernet36|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet68|3-4": { + "dut-lc3|Asic0|Ethernet40|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet96|3-4": { + "dut-lc3|Asic0|Ethernet44|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet124|3-4": { + "dut-lc3|Asic0|Ethernet48|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet148|3-4": { + "dut-lc3|Asic0|Ethernet52|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet92|3-4": { + "dut-lc3|Asic0|Ethernet56|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet120|3-4": { + "dut-lc3|Asic0|Ethernet60|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet144|3-4": { + "dut-lc3|Asic0|Ethernet64|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet52|3-4": { + "dut-lc3|Asic0|Ethernet68|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet140|3-4": { + "dut-lc3|Asic0|Ethernet72|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet56|3-4": { + "dut-lc3|Asic0|Ethernet76|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet164|3-4": { + "dut-lc3|Asic0|Ethernet80|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet76|3-4": { + "dut-lc3|Asic0|Ethernet84|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet72|3-4": { + "dut-lc3|Asic0|Ethernet88|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet64|3-4": { + "dut-lc3|Asic0|Ethernet92|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet32|3-4": { + "dut-lc3|Asic0|Ethernet96|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet16|3-4": { + "dut-lc3|Asic0|Ethernet100|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet36|3-4": { + "dut-lc3|Asic0|Ethernet104|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet12|3-4": { + "dut-lc3|Asic0|Ethernet108|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet88|3-4": { + "dut-lc3|Asic0|Ethernet112|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet116|3-4": { + "dut-lc3|Asic0|Ethernet116|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet80|3-4": { + "dut-lc3|Asic0|Ethernet120|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet112|3-4": { + "dut-lc3|Asic0|Ethernet124|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet84|3-4": { + "dut-lc3|Asic0|Ethernet128|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet152|3-4": { + "dut-lc3|Asic0|Ethernet132|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet136|3-4": { + "dut-lc3|Asic0|Ethernet136|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet156|3-4": { + "dut-lc3|Asic0|Ethernet140|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet132|3-4": { + "dut-lc3|Asic0|Ethernet144|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet48|3-4": { + "dut-lc3|Asic0|Ethernet148|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet44|3-4": { + "dut-lc3|Asic0|Ethernet152|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet176|3-4": { + "dut-lc3|Asic0|Ethernet156|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet40|3-4": { + "dut-lc3|Asic0|Ethernet160|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet28|3-4": { + "dut-lc3|Asic0|Ethernet164|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet60|3-4": { + "dut-lc3|Asic0|Ethernet168|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet20|3-4": { + "dut-lc3|Asic0|Ethernet172|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet24|3-4": { + "dut-lc3|Asic0|Ethernet176|3-4": { "profile" : "egress_lossless_profile" }, - "Ethernet180|0-2": { + "dut-lc3|Asic0|Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc3|Asic0|Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc3|Asic0|Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet128|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet132|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet136|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet140|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet144|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet148|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet152|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet156|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet160|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet164|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet168|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet172|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet176|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc4|Asic0|Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet128|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet132|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet136|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet140|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet144|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet148|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet152|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet156|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet160|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet164|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet168|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet172|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet176|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc5|Asic0|Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "dut-lc3|Asic0|Ethernet0|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet4|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet8|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet12|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet16|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet20|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet24|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet28|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet32|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet36|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet40|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet44|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet48|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet52|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet56|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet60|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet64|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet68|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet72|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet76|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet80|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet84|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet88|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet92|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet96|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet100|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet104|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet108|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet112|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet116|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet120|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet124|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet128|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet132|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet136|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet140|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet144|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet148|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet152|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet156|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet160|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet164|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet168|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet172|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet176|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet180|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet184|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet188|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet0|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet4|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet8|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet12|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet16|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet20|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet24|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet28|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet32|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet36|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet40|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet44|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet48|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet52|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet56|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet60|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet64|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet68|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet72|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet76|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet80|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet84|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet88|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet92|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet96|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet100|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet104|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet108|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet112|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet116|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet120|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet124|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet128|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet132|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet136|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet140|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet144|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet148|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet152|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet156|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet160|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet164|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet168|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet172|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet176|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet180|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet184|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet188|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet0|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet4|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet8|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet12|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet16|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet20|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet24|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet28|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet32|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet36|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet40|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet44|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet48|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet52|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet56|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet60|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet64|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet68|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet72|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet76|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet80|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet84|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet88|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet92|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet96|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet100|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet104|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet108|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet112|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet116|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet120|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet124|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet128|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet132|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet136|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet140|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet144|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet148|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet152|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet156|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet160|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet164|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet168|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet172|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet176|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet180|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet184|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc5|Asic0|Ethernet188|0-2": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet0|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet4|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet8|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet12|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet16|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet20|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet24|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet28|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet32|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet36|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet40|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet44|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet48|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet52|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet56|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet60|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet64|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet68|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet72|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet76|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet80|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet84|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet88|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet92|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet96|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet100|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet104|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet108|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet112|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet116|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet120|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet124|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet128|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet132|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet136|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet140|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet144|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet148|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet152|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet156|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet160|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet164|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet168|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet172|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet176|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet180|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet184|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc3|Asic0|Ethernet188|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet0|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet4|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet8|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet12|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet16|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet20|5-6": { + "profile" : "egress_lossy_profile" + }, + "dut-lc4|Asic0|Ethernet24|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet8|0-2": { + "dut-lc4|Asic0|Ethernet28|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet184|0-2": { + "dut-lc4|Asic0|Ethernet32|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet188|0-2": { + "dut-lc4|Asic0|Ethernet36|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet0|0-2": { + "dut-lc4|Asic0|Ethernet40|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet4|0-2": { + "dut-lc4|Asic0|Ethernet44|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet108|0-2": { + "dut-lc4|Asic0|Ethernet48|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet100|0-2": { + "dut-lc4|Asic0|Ethernet52|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet128|0-2": { + "dut-lc4|Asic0|Ethernet56|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet104|0-2": { + "dut-lc4|Asic0|Ethernet60|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet68|0-2": { + "dut-lc4|Asic0|Ethernet64|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet96|0-2": { + "dut-lc4|Asic0|Ethernet68|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet124|0-2": { + "dut-lc4|Asic0|Ethernet72|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet148|0-2": { + "dut-lc4|Asic0|Ethernet76|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet92|0-2": { + "dut-lc4|Asic0|Ethernet80|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet120|0-2": { + "dut-lc4|Asic0|Ethernet84|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet144|0-2": { + "dut-lc4|Asic0|Ethernet88|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet52|0-2": { + "dut-lc4|Asic0|Ethernet92|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet140|0-2": { + "dut-lc4|Asic0|Ethernet96|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet56|0-2": { + "dut-lc4|Asic0|Ethernet100|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet164|0-2": { + "dut-lc4|Asic0|Ethernet104|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet76|0-2": { + "dut-lc4|Asic0|Ethernet108|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet72|0-2": { + "dut-lc4|Asic0|Ethernet112|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet64|0-2": { + "dut-lc4|Asic0|Ethernet116|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet32|0-2": { + "dut-lc4|Asic0|Ethernet120|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet16|0-2": { + "dut-lc4|Asic0|Ethernet124|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet36|0-2": { + "dut-lc4|Asic0|Ethernet128|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet12|0-2": { + "dut-lc4|Asic0|Ethernet132|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet88|0-2": { + "dut-lc4|Asic0|Ethernet136|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet116|0-2": { + "dut-lc4|Asic0|Ethernet140|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet80|0-2": { + "dut-lc4|Asic0|Ethernet144|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet112|0-2": { + "dut-lc4|Asic0|Ethernet148|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet84|0-2": { + "dut-lc4|Asic0|Ethernet152|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet152|0-2": { + "dut-lc4|Asic0|Ethernet156|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet136|0-2": { + "dut-lc4|Asic0|Ethernet160|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet156|0-2": { + "dut-lc4|Asic0|Ethernet164|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet132|0-2": { + "dut-lc4|Asic0|Ethernet168|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet48|0-2": { + "dut-lc4|Asic0|Ethernet172|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet44|0-2": { + "dut-lc4|Asic0|Ethernet176|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet176|0-2": { + "dut-lc4|Asic0|Ethernet180|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet40|0-2": { + "dut-lc4|Asic0|Ethernet184|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet28|0-2": { + "dut-lc4|Asic0|Ethernet188|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet60|0-2": { + "dut-lc5|Asic0|Ethernet0|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet20|0-2": { + "dut-lc5|Asic0|Ethernet4|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet24|0-2": { + "dut-lc5|Asic0|Ethernet8|5-6": { "profile" : "egress_lossy_profile" }, - "Ethernet180|5-6": { + "dut-lc5|Asic0|Ethernet12|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet8|5-6": { + }, + "dut-lc5|Asic0|Ethernet16|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet184|5-6": { + }, + "dut-lc5|Asic0|Ethernet20|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet188|5-6": { + }, + "dut-lc5|Asic0|Ethernet24|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet0|5-6": { + }, + "dut-lc5|Asic0|Ethernet28|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet4|5-6": { + }, + "dut-lc5|Asic0|Ethernet32|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet108|5-6": { + }, + "dut-lc5|Asic0|Ethernet36|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet100|5-6": { + }, + "dut-lc5|Asic0|Ethernet40|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet128|5-6": { + }, + "dut-lc5|Asic0|Ethernet44|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet104|5-6": { + }, + "dut-lc5|Asic0|Ethernet48|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet68|5-6": { + }, + "dut-lc5|Asic0|Ethernet52|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet96|5-6": { + }, + "dut-lc5|Asic0|Ethernet56|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet124|5-6": { + }, + "dut-lc5|Asic0|Ethernet60|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet148|5-6": { + }, + "dut-lc5|Asic0|Ethernet64|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet92|5-6": { + }, + "dut-lc5|Asic0|Ethernet68|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet120|5-6": { + }, + "dut-lc5|Asic0|Ethernet72|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet144|5-6": { + }, + "dut-lc5|Asic0|Ethernet76|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet52|5-6": { + }, + "dut-lc5|Asic0|Ethernet80|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet140|5-6": { + }, + "dut-lc5|Asic0|Ethernet84|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet56|5-6": { + }, + "dut-lc5|Asic0|Ethernet88|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet164|5-6": { + }, + "dut-lc5|Asic0|Ethernet92|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet76|5-6": { + }, + "dut-lc5|Asic0|Ethernet96|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet72|5-6": { + }, + "dut-lc5|Asic0|Ethernet100|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet64|5-6": { + }, + "dut-lc5|Asic0|Ethernet104|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet32|5-6": { + }, + "dut-lc5|Asic0|Ethernet108|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet16|5-6": { + }, + "dut-lc5|Asic0|Ethernet112|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet36|5-6": { + }, + "dut-lc5|Asic0|Ethernet116|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet12|5-6": { + }, + "dut-lc5|Asic0|Ethernet120|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet88|5-6": { + }, + "dut-lc5|Asic0|Ethernet124|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet116|5-6": { + }, + "dut-lc5|Asic0|Ethernet128|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet80|5-6": { + }, + "dut-lc5|Asic0|Ethernet132|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet112|5-6": { + }, + "dut-lc5|Asic0|Ethernet136|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet84|5-6": { + }, + "dut-lc5|Asic0|Ethernet140|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet152|5-6": { + }, + "dut-lc5|Asic0|Ethernet144|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet136|5-6": { + }, + "dut-lc5|Asic0|Ethernet148|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet156|5-6": { + }, + "dut-lc5|Asic0|Ethernet152|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet132|5-6": { + }, + "dut-lc5|Asic0|Ethernet156|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet48|5-6": { + }, + "dut-lc5|Asic0|Ethernet160|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet44|5-6": { + }, + "dut-lc5|Asic0|Ethernet164|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet176|5-6": { + }, + "dut-lc5|Asic0|Ethernet168|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet40|5-6": { + }, + "dut-lc5|Asic0|Ethernet172|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet28|5-6": { + }, + "dut-lc5|Asic0|Ethernet176|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet60|5-6": { + }, + "dut-lc5|Asic0|Ethernet180|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet20|5-6": { + }, + "dut-lc5|Asic0|Ethernet184|5-6": { "profile" : "egress_lossy_profile" - }, - "Ethernet24|5-6": { + }, + "dut-lc5|Asic0|Ethernet188|5-6": { "profile" : "egress_lossy_profile" - } + } } } 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 4165647a9aa..6692e306653 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 90731e0855a..b1c203536b5 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) diff --git a/src/sonic-containercfgd/containercfgd/containercfgd.py b/src/sonic-containercfgd/containercfgd/containercfgd.py index 14b47db3c09..4eda8a6d8b4 100644 --- a/src/sonic-containercfgd/containercfgd/containercfgd.py +++ b/src/sonic-containercfgd/containercfgd/containercfgd.py @@ -149,7 +149,7 @@ def update_syslog_config(self, data): if os.path.exists(self.TMP_SYSLOG_CONF_PATH): os.remove(self.TMP_SYSLOG_CONF_PATH) with open(self.TMP_SYSLOG_CONF_PATH, 'w+') as f: - json_args = f'{{"target_ip": "127.0.0.1", "{self.target_ip}": "{container_name}" }}' + json_args = f'{{"target_ip": "{self.target_ip}", "container_name": "{container_name}" }}' output = run_command(['sonic-cfggen', '-d', '-t', '/usr/share/sonic/templates/rsyslog-container.conf.j2', '-a', json_args]) f.write(output) run_command(['cp', self.TMP_SYSLOG_CONF_PATH, self.SYSLOG_CONF_PATH]) diff --git a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py index b6e9249fcb1..84c23f9f0eb 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) diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index 01ed79c41ff..565f7796afa 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 diff --git a/src/sonic-eventd/rsyslog_plugin_tests/rsyslog_plugin_ut.cpp b/src/sonic-eventd/rsyslog_plugin_tests/rsyslog_plugin_ut.cpp index be5a19ad5a5..00bde81e2d0 100644 --- a/src/sonic-eventd/rsyslog_plugin_tests/rsyslog_plugin_ut.cpp +++ b/src/sonic-eventd/rsyslog_plugin_tests/rsyslog_plugin_ut.cpp @@ -19,6 +19,8 @@ using namespace std; using namespace swss; using json = nlohmann::json; +const string g_stored_year = "2024"; + vector createEventParams(vector params, vector luaCodes) { vector eventParams; for(long unsigned int i = 0; i < params.size(); i++) { @@ -85,13 +87,16 @@ TEST(syslog_parser, matching_regex_timestamp) { event_params_t expectedDict; expectedDict["message"] = "test_message"; expectedDict["other_data"] = "test_data"; - expectedDict["timestamp"] = "2022-07-21T02:10:00.000000Z"; + // Adding stored year to messages as syslog don't contain year + expectedDict["timestamp"] = g_stored_year + "-07-21T02:10:00.000000Z"; unique_ptr parser(new SyslogParser()); parser->m_regexList = regexList; lua_State* luaState = luaL_newstate(); luaL_openlibs(luaState); + parser->m_timestampFormatter->m_storedTimestamp = "010100:00:00.000000"; + parser->m_timestampFormatter->m_storedYear = g_stored_year; bool success = parser->parseMessage("Jul 21 02:10:00.000000 message test_message other_data test_data", tag, paramDict, luaState); EXPECT_EQ(true, success); EXPECT_EQ("test_tag", tag); @@ -186,13 +191,15 @@ TEST(syslog_parser, lua_code_valid_2) { expectedDict["ip"] = "10.10.24.216"; expectedDict["major-code"] = "6"; expectedDict["minor-code"] = "2"; - expectedDict["timestamp"] = "2022-12-03T12:36:24.503424Z"; + expectedDict["timestamp"] = g_stored_year + "-12-03T12:36:24.503424Z"; unique_ptr parser(new SyslogParser()); parser->m_regexList = regexList; lua_State* luaState = luaL_newstate(); luaL_openlibs(luaState); + parser->m_timestampFormatter->m_storedTimestamp = "010100:00:00.000000"; + parser->m_timestampFormatter->m_storedYear = g_stored_year; bool success = parser->parseMessage("Dec 3 12:36:24.503424 NOTIFICATION: received from neighbor 10.10.24.216 active 6/2 (Administrative Shutdown) 0 bytes", tag, paramDict, luaState); EXPECT_EQ(true, success); EXPECT_EQ("test_tag", tag); @@ -253,13 +260,22 @@ TEST(timestampFormatter, changeTimestampFormat) { vector timestampTwo = { "Jan", "1", "00:00:00.000000" }; vector timestampThree = { "Dec", "31", "23:59:59.000000" }; + formatter->m_storedTimestamp = "010100:00:00.000000"; + formatter->m_storedYear = g_stored_year; + string formattedTimestampOne = formatter->changeTimestampFormat(timestampOne); - EXPECT_EQ("2022-07-20T10:09:40.230874Z", formattedTimestampOne); + string expectedTimestampOne = g_stored_year + "-07-20T10:09:40.230874Z"; + + EXPECT_EQ(expectedTimestampOne, formattedTimestampOne); EXPECT_EQ("072010:09:40.230874", formatter->m_storedTimestamp); + formatter->m_storedTimestamp = "010100:00:00.000000"; + formatter->m_storedYear = g_stored_year; + string formattedTimestampTwo = formatter->changeTimestampFormat(timestampTwo); - EXPECT_EQ("2022-01-01T00:00:00.000000Z", formattedTimestampTwo); + string expectedTimestampTwo = g_stored_year + "-01-01T00:00:00.000000Z"; + EXPECT_EQ(expectedTimestampTwo, formattedTimestampTwo); formatter->m_storedTimestamp = "010100:00:00.000000"; formatter->m_storedYear = "2025"; diff --git a/src/sonic-frr/frr b/src/sonic-frr/frr index c69608a6808..79188bf710e 160000 --- a/src/sonic-frr/frr +++ b/src/sonic-frr/frr @@ -1 +1 @@ -Subproject commit c69608a68083d1017257977bd0260bebdb12322f +Subproject commit 79188bf710e92acf42fb5b9b0a2e9593a5ee9b05 diff --git a/src/sonic-gnmi b/src/sonic-gnmi index 43a9179e9de..d922a076ca3 160000 --- a/src/sonic-gnmi +++ b/src/sonic-gnmi @@ -1 +1 @@ -Subproject commit 43a9179e9de97e1bc02af89299e5d5d2814c70df +Subproject commit d922a076ca3490792009ba67c1fe6436fe01cb11 diff --git a/src/sonic-host-services b/src/sonic-host-services index 4a2ef99630e..121330a287d 160000 --- a/src/sonic-host-services +++ b/src/sonic-host-services @@ -1 +1 @@ -Subproject commit 4a2ef99630ee02e104643bf356cafd6a1228b882 +Subproject commit 121330a287d139439ef4a539b84822292e3a654d diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index dbe40633f19..34f26b35839 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit dbe40633f195fa8495f6d34d4c2048dfd9764830 +Subproject commit 34f26b35839d7c0c09d48176c4ec33197344643c diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 8f2dffb9d77..9df998bbec1 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 8f2dffb9d7708d05823462e9e643965103989d0d +Subproject commit 9df998bbec12083dd88104657d2fd8f67e217bc3 diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 342f76f2678..402eb14a6da 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 342f76f26789b73184f88ee8d3f16ed255703ab7 +Subproject commit 402eb14a6dad7c747c84c08643f2edb8e348ab3f diff --git a/src/sonic-swss b/src/sonic-swss index 28aa309ed04..bdedf694f10 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 28aa309ed04a5b442487c0404db23229cec9b4c9 +Subproject commit bdedf694f10b6f8b5ea71fb30eef5d0c3b354409 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 5d481da0f5b..a4987b931b2 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 5d481da0f5b8d58aeae4ca077623fd3a03d0ebb9 +Subproject commit a4987b931b246c141dff91fa2f0e971dbc41820e diff --git a/src/sonic-utilities b/src/sonic-utilities index 49fc3896a0e..fb8f98bfa67 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 49fc3896a0ef907ff337467a3e04d2501ef850fd +Subproject commit fb8f98bfa672a80f56398d57a470a02d031d3da3 diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index d05eca0d70e..1c25f66a61c 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -54,6 +54,7 @@ Table of Contents * [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) @@ -64,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) @@ -1594,6 +1596,61 @@ Container side configuration: } ``` +### 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. @@ -1913,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 8c318e583fa..783dfb8be1a 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -100,6 +100,7 @@ def run(self): './yang-models/sonic-copp.yang', './yang-models/sonic-console.yang', './yang-models/sonic-crm.yang', + './yang-models/sonic-dash.yang', './yang-models/sonic-default-lossless-buffer-parameter.yang', './yang-models/sonic-device_metadata.yang', './yang-models/sonic-device_neighbor.yang', @@ -144,7 +145,9 @@ 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', './yang-models/sonic-versions.yang', './yang-models/sonic-vlan.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 99c94e96cfa..2d1f672542c 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1144,14 +1144,45 @@ "TELEMETRY": { "certs": { "ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", - "server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer", - "server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key" + "server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer", + "server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key" }, - "gnmi": { - "client_auth": "true", - "log_level": "2", - "port": "50051" - } + "gnmi": { + "client_auth": "true", + "log_level": "2", + "port": "50051" + } + }, + "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" + }, + "MuxTunnel1": { + "dscp_mode": "pipe", + "dst_ip": "10.1.0.32", + "ecn_mode": "standard", + "encap_ecn_mode": "standard", + "ttl_mode": "uniform", + "tunnel_type": "IPINIP" + }, + "MuxTunnel2": { + "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": "Dscp_to_tc_map1", + "decap_tc_to_pg_map": "tc_to_pg_map1", + "encap_tc_to_dscp_map": "EncapTcToQueueMap", + "encap_tc_to_queue_map": "tc_to_q_map1" + } }, "RESTAPI": { "certs": { @@ -1318,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", @@ -2109,6 +2153,12 @@ "ip": "kubernetes.apiserver.com", "port": "6443" } + }, + "DASH_VNET": { + "Vnet1": { + "vni": "10", + "guid":"guid-vnet1" + } } }, "SAMPLE_CONFIG_DB_UNKNOWN": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/dash.json b/src/sonic-yang-models/tests/yang_model_tests/tests/dash.json new file mode 100644 index 00000000000..df232db3fb2 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/dash.json @@ -0,0 +1,25 @@ +{ + "DASH_VNET_TABLE_WITH_CORRECT_CONFIG": { + "desc": "DASH VNET TABLE WITH VALID CONFIG." + }, + "DASH_ENI_TABLE_WITH_CORRECT_CONFIG": { + "desc": "DASH ENI TABLE WITH VALID CONFIG." + }, + "DASH_ROUTING_TYPE_TABLE_WITH_CORRECT_CONFIG": { + "desc": "DASH ROUTING TYPE TABLE WITH VALID CONFIG." + }, + "DASH_MAPPING_TABLE_WITH_NON_EXISTENT_VNET": { + "desc": "DASH MAPPING TABLE_WITH_NON_EXISTENT VNET failure.", + "eStrKey" : "LeafRef" + }, + "DASH_ROUTE_TABLE_WITH_INCORRECT_IPPREFIX": { + "desc": "DASH ROUTE TABLE WITH INVALID IP PREFIX.", + "eStrKey": "InvalidValue" + }, + "DASH_MAPPING_TABLE_WITH_VALID_CONFIG": { + "desc": "DASH MAPPING TABLE WITH VALID CONFIG." + }, + "DASH_ROUTE_TABLE_WITH_VALID_CONFIG": { + "desc": "DASH ROUTE TABLE WITH VALID CONFIG." + } +} 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 00000000000..c7e68740881 --- /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/tunnel.json b/src/sonic-yang-models/tests/yang_model_tests/tests/tunnel.json new file mode 100644 index 00000000000..b414b639aa3 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/tunnel.json @@ -0,0 +1,18 @@ +{ + "TUNNEL_LOAD_NORMAL": { + "desc": "Load TUNNEL for dualtor device." + }, + "TUNNEL_INVALID_ADDR": { + "desc": "Load TUNNEL with invalid IPv4 Address.", + "eStr": ["does not satisfy the constraint"] + }, + "TUNNEL_SRC_IP_NOT_PEER_SWITCH": { + "desc": "Load TUNNEL with wrong IPv4 Address.", + "eStr": ["points to a non-existing leaf."] + }, + "TUNNEL_MISSING_MUX_TUNNEL": { + "desc": "Load MUX_TUNNEL missing name.", + "eStr": ["Missing required element"] + } +} + diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/dash.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/dash.json new file mode 100644 index 00000000000..0c2c8cd4f5c --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/dash.json @@ -0,0 +1,143 @@ +{ + "DASH_VNET_TABLE_WITH_CORRECT_CONFIG": { + "sonic-dash:sonic-dash": { + "sonic-dash:DASH_VNET": { + "DASH_VNET_LIST": [{ + "name": "Vnet1", + "vni": "10", + "guid":"guid-vnet1" + }] + } + } + }, + "DASH_ENI_TABLE_WITH_CORRECT_CONFIG": { + "sonic-dash:sonic-dash": { + "sonic-dash:DASH_ENI": { + "DASH_ENI_LIST": [{ + "name": "F9-22", + "vnet": "Vnet1", + "eni_id":"guid-eni1", + "mac_address":"F9:22:83:99:22:A2" + }] + }, + "sonic-dash:DASH_VNET": { + "DASH_VNET_LIST": [{ + "name": "Vnet1", + "vni": "10", + "guid":"guid-vnet1" + }] + } + } + }, + "DASH_ROUTING_TYPE_TABLE_WITH_CORRECT_CONFIG": { + "sonic-dash:sonic-dash": { + "sonic-dash:DASH_ROUTING_TYPE": { + "DASH_ROUTING_TYPE_LIST": [{ + "name": "vnet_direct", + "action_name": "act_name", + "action_type":"maprouting" + }, + { + "name": "vnet_encap", + "action_name": "act_name1", + "action_type": "staticencap", + "encap_type": "vxlan" + }] + } + } + }, + "DASH_MAPPING_TABLE_WITH_NON_EXISTENT_VNET": { + "sonic-dash:sonic-dash": { + "sonic-dash:DASH_VNET_MAPPING_TABLE": { + "DASH_VNET_MAPPING_TABLE_LIST": [{ + "vnet": "Vnet2", + "ip_addr": "10.0.0.6", + "routing_type":"vnet_encap", + "underlay_ip":"2601:12:7a:1::1234", + "mac_address":"F9:22:83:99:22:A2" + }] + } + } + }, + "DASH_ROUTE_TABLE_WITH_INCORRECT_IPPREFIX": { + "sonic-dash:sonic-dash": { + "sonic-dash:DASH_ROUTE_TABLE": { + "DASH_ROUTE_TABLE_LIST": [{ + "eni": "F9-22", + "prefix": "10.0.0.6", + "action_type":"vnet_encap" + }] + }, + "sonic-dash:DASH_ROUTING_TYPE": { + "DASH_ROUTING_TYPE_LIST": [{ + "name": "vnet_encap", + "action_name": "act_name1", + "action_type": "staticencap", + "encap_type": "vxlan" + }] + } + } + }, + "DASH_MAPPING_TABLE_WITH_VALID_CONFIG": { + "sonic-dash:sonic-dash": { + "sonic-dash:DASH_VNET_MAPPING_TABLE": { + "DASH_VNET_MAPPING_TABLE_LIST": [{ + "vnet": "Vnet1", + "ip_addr": "10.0.0.6", + "routing_type":"vnet_encap", + "underlay_ip":"2601:12:7a:1::1234", + "mac_address":"F9:22:83:99:22:A2" + }] + }, + "sonic-dash:DASH_ROUTING_TYPE": { + "DASH_ROUTING_TYPE_LIST": [{ + "name": "vnet_encap", + "action_name": "act_name1", + "action_type": "staticencap", + "encap_type": "vxlan" + }] + }, + "sonic-dash:DASH_VNET": { + "DASH_VNET_LIST": [{ + "name": "Vnet1", + "vni": "10", + "guid":"guid-vnet1" + }] + } + } + }, + "DASH_ROUTE_TABLE_WITH_VALID_CONFIG": { + "sonic-dash:sonic-dash": { + "sonic-dash:DASH_ROUTE_TABLE": { + "DASH_ROUTE_TABLE_LIST": [{ + "eni": "F9-22", + "prefix": "10.0.0.6/32", + "action_type":"vnet", + "vnet":"Vnet1" + }] + }, + "sonic-dash:DASH_ROUTING_TYPE": { + "DASH_ROUTING_TYPE_LIST": [{ + "name": "vnet", + "action_name": "act_name1", + "action_type": "maprouting" + }] + }, + "sonic-dash:DASH_ENI": { + "DASH_ENI_LIST": [{ + "name": "F9-22", + "vnet": "Vnet1", + "eni_id":"guid-eni1", + "mac_address":"F9:22:83:99:22:A2" + }] + }, + "sonic-dash:DASH_VNET": { + "DASH_VNET_LIST": [{ + "name": "Vnet1", + "vni": "10", + "guid":"guid-vnet1" + }] + } + } + } +} 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 00000000000..3f58635ef75 --- /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/tests/yang_model_tests/tests_config/tunnel.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/tunnel.json new file mode 100644 index 00000000000..0f511e6dde2 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/tunnel.json @@ -0,0 +1,143 @@ +{ + "TUNNEL_LOAD_NORMAL": { + "sonic-peer-switch:sonic-peer-switch": { + "sonic-peer-switch:PEER_SWITCH": { + "PEER_SWITCH_LIST": [ + { + "peer_switch": "vlab-05", + "address_ipv4": "10.1.0.33" + } + ] + } + }, + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "DecapDscpToTcMap", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "1" + } + ] + } + ] + } + }, + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "DecapTcToPgMap", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "1" + } + ] + } + ] + } + }, + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "EncapTcToQueueMap", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "1" + } + ] + } + ] + } + }, + "sonic-tunnel:sonic-tunnel": { + "sonic-tunnel:TUNNEL": { + "TUNNEL_LIST": [ + { + "mux_tunnel": "MuxTunnel0", + "dscp_mode": "pipe", + "src_ip": "10.1.0.33", + "dst_ip": "10.1.0.32", + "ecn_mode": "standard", + "encap_ecn_mode": "standard", + "ttl_mode": "pipe", + "tunnel_type": "IPINIP", + "decap_dscp_to_tc_map": "DecapDscpToTcMap", + "decap_tc_to_pg_map": "DecapTcToPgMap", + "encap_tc_to_dscp_map": "EncapTcToDscpMap", + "encap_tc_to_queue_map": "EncapTcToQueueMap" + } + ] + } + } + }, + + "TUNNEL_INVALID_ADDR": { + "sonic-tunnel:sonic-tunnel": { + "sonic-tunnel:TUNNEL": { + "TUNNEL_LIST": [ + { + "mux_tunnel": "MuxTunnel0", + "dscp_mode": "pipe", + "dst_ip": "10.1.0.33/32", + "ecn_mode": "standard", + "encap_ecn_mode": "standard", + "ttl_mode": "pipe", + "tunnel_type": "IPINIP" + } + ] + } + } + }, + + "TUNNEL_SRC_IP_NOT_PEER_SWITCH": { + "sonic-peer-switch:sonic-peer-switch": { + "sonic-peer-switch:PEER_SWITCH": { + "PEER_SWITCH_LIST": [ + { + "peer_switch": "vlab-05", + "address_ipv4": "10.1.0.33" + } + ] + } + }, + "sonic-tunnel:sonic-tunnel": { + "sonic-tunnel:TUNNEL": { + "TUNNEL_LIST": [ + { + "mux_tunnel": "MuxTunnel0", + "dscp_mode": "pipe", + "dst_ip": "10.1.0.32", + "src_ip": "10.1.0.32", + "ecn_mode": "standard", + "encap_ecn_mode": "standard", + "ttl_mode": "pipe", + "tunnel_type": "IPINIP" + } + ] + } + } + }, + + "TUNNEL_MISSING_MUX_TUNNEL": { + "sonic-tunnel:sonic-tunnel": { + "sonic-tunnel:TUNNEL": { + "TUNNEL_LIST": [ + { + "dscp_mode": "pipe", + "dst_ip": "10.1.0.32", + "ecn_mode": "standard", + "encap_ecn_mode": "standard", + "ttl_mode": "pipe", + "tunnel_type": "IPINIP" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-dash.yang b/src/sonic-yang-models/yang-models/sonic-dash.yang new file mode 100644 index 00000000000..f3c431d0781 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-dash.yang @@ -0,0 +1,476 @@ +module sonic-dash { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-dash"; + prefix dash; + + import ietf-yang-types { + prefix yang; + } + + import ietf-inet-types { + prefix inet; + } + + import sonic-types { + prefix stypes; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC DASH YANG Module for SONiC OS"; + + revision 2022-12-07 { + description + "Initial revision."; + } + + container sonic-dash { + + container DASH_VNET { + + description "DASH VNET configuration, part of APP_DB. Used for gNMI clients to configure SONiC"; + + list DASH_VNET_LIST { + key "name"; + + leaf name { + type string { + pattern "Vnet[a-zA-Z0-9_-]+" { + error-message "Invalid Vnet name"; + error-app-tag vnet-name-invalid; + } + } + } + + leaf vni { + type uint32 { + range 1..16777215; + } + } + + leaf guid { + description "Guid used for Vnet identification"; + type string { + length 1..255; + } + } + + leaf-list address_spaces { + type stypes:sonic-ip-prefix; + } + + } /* end of list DASH_VNET_LIST */ + } /* end of container DASH_VNET */ + + container DASH_QOS { + description "DASH QOS configs to specify bandwidth, cps, part of APP_DB"; + + list DASH_QOS_LIST { + key "name"; + + leaf name{ + type string { + length 1..255; + } + } + + leaf bw { + description "Bandwidth in kbps"; + type uint64 { + range "0..100000000" { + error-message "kbps value out of range"; + } + } + } + + leaf cps { + description "Max number of connections per second"; + type uint64 { + range "0..100000000" { + error-message "cps value out of range"; + } + } + } + + leaf flows { + description "Number of flows"; + type uint64 { + range "0..100000000" { + error-message "flows value out of range"; + } + } + } + + } /* end of list DASH_QOS_LIST */ + } /* end of container DASH_QOS */ + + container DASH_ENI { + description "DASH ENI object to specify eni params; part of APP_DB"; + + list DASH_ENI_LIST { + key "name"; + + leaf name{ + type string { + length 1..255; + } + } + + leaf eni_id{ + description "ENI guid for cross reference and identification"; + type string { + length 1..255; + } + } + + leaf mac_address { + type yang:mac-address; + } + + leaf qos { + type leafref { + path /dash:sonic-dash/dash:DASH_QOS/dash:DASH_QOS_LIST/dash:name; + } + } + + leaf vnet { + type leafref { + path /dash:sonic-dash/dash:DASH_VNET/dash:DASH_VNET_LIST/dash:name; + } + } + + } /* end of list DASH_ENI_LIST */ + } /* end of container DASH_ENI */ + + container DASH_ACL_IN { + description "DASH Ingress ACL to specify stage and group; part of APP_DB"; + + list DASH_ACL_IN_LIST { + key "eni stage"; + + leaf eni { + type leafref { + path /dash:sonic-dash/dash:DASH_ENI/dash:DASH_ENI_LIST/dash:name; + } + } + + leaf stage { + type uint8 { + range 1..5; + } + } + + leaf acl_group_id { + type leafref { + path /dash:sonic-dash/dash:DASH_ACL_GROUP/dash:DASH_ACL_GROUP_LIST/dash:name; + } + } + + } /* end of list DASH_ACL_IN_LIST */ + } /* end of container DASH_ACL_IN */ + + container DASH_ACL_OUT { + description "DASH Egress ACL to specify stage and group; part of APP_DB"; + + list DASH_ACL_OUT_LIST { + key "eni stage"; + + leaf eni { + type leafref { + path /dash:sonic-dash/dash:DASH_ENI/dash:DASH_ENI_LIST/dash:name; + } + } + + leaf stage { + type uint8 { + range 1..5; + } + } + + leaf acl_group_id { + type leafref { + path /dash:sonic-dash/dash:DASH_ACL_GROUP/dash:DASH_ACL_GROUP_LIST/dash:name; + } + } + + } /* end of list DASH_ACL_OUT_LIST */ + } /* end of container DASH_ACL_OUT */ + + container DASH_ACL_GROUP { + description "DASH ACL group to specify IP version; part of APP_DB"; + + list DASH_ACL_GROUP_LIST { + key "name"; + + leaf name { + type string { + length 1..255; + } + } + + leaf ip_version { + type string { + pattern "ipv4|ipv6"; + } + } + + leaf guid { + description "Guid used for ACL group identification"; + type string { + length 1..255; + } + } + + } /* end of list DASH_ACL_GROUP_LIST */ + } /* end of container DASH_ACL_GROUP */ + + container DASH_ACL_RULE { + description "DASH ACL rule; part of APP_DB"; + + list DASH_ACL_RULE_LIST { + key "acl_group_id name"; + + leaf acl_group_id { + type leafref { + path /dash:sonic-dash/dash:DASH_ACL_GROUP/dash:DASH_ACL_GROUP_LIST/dash:name; + } + } + + leaf name { + type string { + length 1..255; + } + } + + leaf priority { + type uint32 { + range 0..16777215; + } + } + + leaf action { + type string { + pattern "allow|deny"; + } + } + + leaf terminating { + type boolean; + default false; + description "If set to true, stop processing further rules"; + } + + leaf-list ip_protocol { + description "IP Protocol (tcp or udp or icmp etc)"; + type stypes:ip-protocol-type; + } + + leaf-list src_addr { + type stypes:sonic-ip-prefix; + } + + leaf-list dst_addr { + type stypes:sonic-ip-prefix; + } + + leaf-list src_port { + description "List of L4 source port range as pattern '0-65365'"; + type string { + pattern '([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])-([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])'; + } + } + + leaf-list dst_port { + description "List of L4 dst port range as pattern '0-65365'"; + type string { + pattern '([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])-([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])'; + } + } + + } /* end of list DASH_ACL_RULE_LIST */ + } /* end of container DASH_ACL_RULE */ + + container DASH_APPLIANCE { + description "DASH general appliance configs; part of APP_DB"; + + list DASH_APPLIANCE_LIST { + key "name"; + + leaf name { + type string { + length 1..255; + } + } + + leaf sip { + type inet:ip-address; + } + + leaf vni { + description "VM VNI used for setting direction"; + type uint32 { + range 1..16777215; + } + } + + } /* end of list DASH_APPLIANCE_LIST */ + } /* end of container DASH_APPLIANCE */ + + container DASH_ROUTING_TYPE { + description "DASH Routing types and actions; part of APP_DB"; + + list DASH_ROUTING_TYPE_LIST { + key "name"; + + leaf name { + type string { + pattern "direct|vnet|vnet_direct|vnet_encap|drop|appliance|privatelink|privatelinknsg|servicetunnel"; + } + } + + leaf action_name { + type string { + length 1..255; + } + } + + leaf action_type { + type string { + pattern "none|maprouting|direct|staticencap|appliance|4to6|mapdecap|decap|drop"; + } + } + + leaf encap_type { + type string { + pattern "vxlan|nvgre"; + } + } + + leaf vni { + type uint32 { + range 1..16777215; + } + } + + } /* end of list DASH_ROUTING_TYPE_LIST */ + } /* end of container DASH_ROUTING_TYPE */ + + container DASH_ROUTE_TABLE { + description "DASH Route table (LPM) associated to an ENI for outbound routing; part of APP_DB"; + + list DASH_ROUTE_TABLE_LIST { + key "eni prefix"; + + leaf eni { + type leafref { + path /dash:sonic-dash/dash:DASH_ENI/dash:DASH_ENI_LIST/dash:name; + } + } + + leaf prefix { + type stypes:sonic-ip-prefix; + } + + leaf action_type { + type leafref { + path /dash:sonic-dash/dash:DASH_ROUTING_TYPE/dash:DASH_ROUTING_TYPE_LIST/dash:name; + } + } + + leaf vnet { + 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; + } + } + + leaf appliance { + when "(current()/../action_type = 'appliance')"; + type leafref { + path /dash:sonic-dash/dash:DASH_APPLIANCE/dash:DASH_APPLIANCE_LIST/dash:name; + } + } + + 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"; + type inet:ip-address; + } + + leaf overlay_sip { + when "(current()/../action_type = 'servicetunnel')"; + description "Overlay src ip for service tunnel"; + type inet:ip-address; + } + + leaf overlay_dip { + when "(current()/../action_type = 'servicetunnel')"; + description "Overlay dst ip for service tunnel"; + type inet:ip-address; + } + + leaf underlay_sip { + when "(current()/../action_type = 'servicetunnel')"; + description "Underlay src ip for service tunnel"; + type inet:ip-address; + } + + leaf underlay_dip{ + when "(current()/../action_type = 'servicetunnel')"; + description "Underlay dst ip for service tunnel"; + type inet:ip-address; + } + + } /* end of list DASH_ROUTE_TABLE_LIST */ + } /* end of container DASH_ROUTE_TABLE */ + + container DASH_VNET_MAPPING_TABLE { + description "DASH Mapping table associated to a Vnet; part of APP_DB"; + + list DASH_VNET_MAPPING_TABLE_LIST { + key "vnet ip_addr"; + + leaf vnet { + type leafref { + path /dash:sonic-dash/dash:DASH_VNET/dash:DASH_VNET_LIST/dash:name; + } + } + + leaf ip_addr { + description "Overlay CA address"; + type inet:ip-address; + } + + leaf routing_type { + type leafref { + path /dash:sonic-dash/dash:DASH_ROUTING_TYPE/dash:DASH_ROUTING_TYPE_LIST/dash:name; + } + } + + leaf underlay_ip { + description "PA address"; + type inet:ip-address; + } + + leaf mac_address { + type yang:mac-address; + } + + leaf use_dst_vni { + type boolean; + default false; + description "If set to true, use destination VNET VNI for encap"; + } + + } /* end of list DASH_MAPPING_TABLE_LIST */ + } /* end of container DASH_MAPPING_TABLE */ + + } /* end of container sonic-dash */ +} /* end of module sonic-dash */ 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 00000000000..2bf92f206c6 --- /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."; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-tunnel.yang b/src/sonic-yang-models/yang-models/sonic-tunnel.yang new file mode 100644 index 00000000000..e0e20ec8df2 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-tunnel.yang @@ -0,0 +1,122 @@ +module sonic-tunnel { + yang-version 1.1; + namespace "http://github.com/sonic-net/sonic-tunnel"; + prefix tunnel; + + import ietf-inet-types { + prefix inet; + } + + import sonic-peer-switch { + prefix ps; + } + + import sonic-dscp-tc-map { + prefix dtm; + } + + import sonic-tc-priority-group-map { + prefix tpgm; + } + + import sonic-tc-queue-map { + prefix tqm; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONiC DualToR tunnel data"; + + revision 2022-08-23 { + description + "Initial revision"; + } + + container sonic-tunnel { + container TUNNEL { + description "TUNNEL configuration for SONiC Dual-ToR"; + list TUNNEL_LIST { + key "mux_tunnel"; + + leaf mux_tunnel { + description "Name of MuxTunnel"; + type string { + pattern "MuxTunnel[0-9]+"; + } + } + + leaf dscp_mode { + description "DSCP mode"; + type string { + pattern "uniform|pipe"; + } + } + + leaf src_ip { + description "source IPv4 address off the tunnel. Must be SONiC DualToR peer IPv4 address."; + type leafref { + path "/ps:sonic-peer-switch/ps:PEER_SWITCH/ps:PEER_SWITCH_LIST/ps:address_ipv4"; + } + } + + leaf dst_ip { + description "IPv4 address of this switch."; + type inet:ipv4-address; + } + + leaf ecn_mode { + description "ECN mode"; + type string { + pattern "copy_from_outer|standard"; + } + } + + leaf encap_ecn_mode { + description "Encap ECN mode"; + type string { + pattern "standard"; + } + } + + leaf ttl_mode { + description "TTL mode"; + type string { + pattern "uniform|pipe"; + } + } + + leaf tunnel_type { + description "Tunnel type"; + type string { + pattern "IPINIP"; + } + } + + leaf decap_dscp_to_tc_map { + description "Decap DSCP to TC map"; + type string; + } + + leaf decap_tc_to_pg_map { + description "Decap TC to PG map"; + type string; + } + + leaf encap_tc_to_dscp_map { + description "Encap TC to DSCP map"; + type string; + } + + leaf encap_tc_to_queue_map { + description "Encap TC to Queue map"; + type string; + } + } + } + } +}