diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index e8e74e8d188..b9998b2a54e 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -121,6 +121,7 @@ jobs: mv target/docker-sonic-vs.gz target/docker-sonic-vs-asan.gz fi make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz + make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-ptf-sai.gz if [ $(Build.Reason) != 'PullRequest' ];then gzip -kd target/sonic-vs.img.gz SONIC_RUN_CMDS="qemu-img convert target/sonic-vs.img -O vhdx -o subformat=dynamic target/sonic-vs.vhdx" make sonic-slave-run @@ -138,9 +139,25 @@ jobs: make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).raw fi if [ $(docker_syncd_rpc_image) == yes ]; then + # workaround for issue in rules/sairedis.dep, git ls-files will list un-exist files for cache make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/docker-syncd-$(platform_rpc)-rpc.gz + pushd ./src/sonic-sairedis/SAI + git stash + popd if [ $(GROUP_NAME) == broadcom ]; then make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/docker-syncd-$(platform_rpc)-dnx-rpc.gz + pushd ./src/sonic-sairedis/SAI + git stash + popd + make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-saiserverv2-brcm.gz + pushd ./src/sonic-sairedis/SAI + git stash + popd + echo BUILD_OPTIONS $BUILD_OPTIONS + make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-syncd-brcm-rpcv2.gz + pushd ./src/sonic-sairedis/SAI + git stash + popd fi fi if [ $(syncd_rpc_image) == yes ]; then diff --git a/.azure-pipelines/azure-pipelines-image-template.yml b/.azure-pipelines/azure-pipelines-image-template.yml index 6a9c2790572..f055414e137 100644 --- a/.azure-pipelines/azure-pipelines-image-template.yml +++ b/.azure-pipelines/azure-pipelines-image-template.yml @@ -36,7 +36,7 @@ jobs: displayName: "Set cache options" - checkout: self submodules: recursive - condition: eq(variables.SKIP_CHECKOUT, '') + condition: and(succeeded(), eq(variables.SKIP_CHECKOUT, '')) displayName: 'Checkout code' - script: | BRANCH_NAME=$(Build.SourceBranchName) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 2665f46452c..cde438cbe56 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -92,6 +92,7 @@ jobs: fi make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz + make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-ptf-sai.gz else if [ ${{ parameters.dbg_image }} == true ]; then make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) INSTALL_DEBUG_TOOLS=y target/sonic-${{ parameters.platform }}.bin && \ @@ -105,6 +106,20 @@ jobs: fi if [ ${{ parameters.sync_rpc_image }} == true ]; then make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) ENABLE_SYNCD_RPC=y target/docker-syncd-${{ parameters.platform_short }}-rpc.gz + # workaround for issue in rules/sairedis.dep, git ls-files will list un-exist files for cache + pushd ./src/sonic-sairedis/SAI + git stash + popd + if [ ${{ parameters.platform }} == broadcom ]; then + make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) SAITHRIFT_V2=y ENABLE_SYNCD_RPC=y target/docker-syncd-brcm-rpcv2.gz + pushd ./src/sonic-sairedis/SAI + git stash + popd + make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-saiserverv2-brcm.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/official-build.yml b/.azure-pipelines/official-build.yml index 3ebb106a621..14308292f4b 100644 --- a/.azure-pipelines/official-build.yml +++ b/.azure-pipelines/official-build.yml @@ -9,7 +9,7 @@ schedules: branches: include: - master - - 202012 + - 202??? always: true - cron: "0 4 * * *" displayName: nightly build for release diff --git a/.azure-pipelines/run-test-scheduler-template.yml b/.azure-pipelines/run-test-scheduler-template.yml new file mode 100644 index 00000000000..f43ce59d8a5 --- /dev/null +++ b/.azure-pipelines/run-test-scheduler-template.yml @@ -0,0 +1,139 @@ +parameters: +- name: TOPOLOGY + type: string + +- name: POLL_INTERVAL + type: number + default: 10 + +- name: POLL_TIMEOUT + type: number + default: 36000 + +- name: MIN_WORKER + type: number + default: 1 + +- name: MAX_WORKER + type: number + default: 2 + +- name: TEST_SET + type: string + default: "" + +- name: DEPLOY_MG_EXTRA_PARAMS + type: string + default: "" + +- name: COMMON_EXTRA_PARAMS + type: string + default: "" + +- name: VM_TYPE + type: string + default: "ceos" + +- name: SPECIFIED_PARAMS + type: string + default: "{}" + +- name: MGMT_BRANCH + type: string + default: master + +- name: NUM_ASIC + type: number + default: 1 + +steps: + - script: | + set -ex + wget -O ./.azure-pipelines/test_plan.py https://raw.githubusercontent.com/sonic-net/sonic-mgmt/master/.azure-pipelines/test_plan.py + wget -O ./.azure-pipelines/pr_test_scripts.yaml https://raw.githubusercontent.com/sonic-net/sonic-mgmt/master/.azure-pipelines/pr_test_scripts.yaml + displayName: Download TestbedV2 scripts + + - script: | + set -ex + pip install PyYAML + rm -f new_test_plan_id.txt + python ./.azure-pipelines/test_plan.py create -t ${{ parameters.TOPOLOGY }} -o new_test_plan_id.txt \ + --min-worker ${{ parameters.MIN_WORKER }} --max-worker ${{ parameters.MAX_WORKER }} \ + --test-set ${{ parameters.TEST_SET }} --kvm-build-id $(KVM_BUILD_ID) \ + --deploy-mg-extra-params "${{ parameters.DEPLOY_MG_EXTRA_PARAMS }}" --common-extra-params "${{ parameters.COMMON_EXTRA_PARAMS }}" \ + --mgmt-branch ${{ parameters.MGMT_BRANCH }} --vm-type ${{ parameters.VM_TYPE }} --specified-params "${{ parameters.SPECIFIED_PARAMS }}" \ + --num-asic ${{ parameters.NUM_ASIC }} + TEST_PLAN_ID=`cat new_test_plan_id.txt` + + echo "Created test plan $TEST_PLAN_ID" + echo "Check https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID for test plan status" + echo "##vso[task.setvariable variable=TEST_PLAN_ID]$TEST_PLAN_ID" + env: + TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) + TENANT_ID: $(TESTBED_TOOLS_MSAL_TENANT_ID) + CLIENT_ID: $(TESTBED_TOOLS_MSAL_CLIENT_ID) + CLIENT_SECRET: $(TESTBED_TOOLS_MSAL_CLIENT_SECRET) + displayName: Trigger test + + - script: | + set -ex + echo "Lock testbed" + 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)" --timeout 43200 --expected-states PREPARE_TESTBED EXECUTING KVMDUMP FINISHED CANCELLED FAILED + env: + TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) + displayName: Lock testbed + timeoutInMinutes: 240 + + - script: | + set -ex + echo "Prepare testbed" + echo "Preparing the testbed(add-topo, deploy-mg) may take 15-30 minutes. Before the testbed is ready, the progress of the test plan keeps displayed as 0, please be patient(We will improve the indication in a short time)" + echo "If the progress keeps as 0 for more than 1 hour, please cancel and retry this pipeline" + 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)" --timeout 2400 --expected-states EXECUTING KVMDUMP FINISHED CANCELLED FAILED + env: + TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) + displayName: Prepare testbed + timeoutInMinutes: 40 + + - script: | + set -ex + echo "Run test" + 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)" --timeout 18000 --expected-states KVMDUMP FINISHED CANCELLED FAILED + env: + TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) + displayName: Run test + timeoutInMinutes: 300 + + - script: | + set -ex + echo "KVM dump" + 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)" --timeout 43200 --expected-states FINISHED CANCELLED FAILED + condition: succeededOrFailed() + env: + TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) + displayName: KVM dump + timeoutInMinutes: 20 + + - script: | + set -ex + echo "Try to cancel test plan $TEST_PLAN_ID, cancelling finished test plan has no effect." + python ./.azure-pipelines/test_plan.py cancel -i "$(TEST_PLAN_ID)" + condition: always() + env: + TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) + TENANT_ID: $(TESTBED_TOOLS_MSAL_TENANT_ID) + CLIENT_ID: $(TESTBED_TOOLS_MSAL_CLIENT_ID) + CLIENT_SECRET: $(TESTBED_TOOLS_MSAL_CLIENT_SECRET) + displayName: Finalize running test plan diff --git a/.azure-pipelines/run-test-template.yml b/.azure-pipelines/run-test-template.yml index 2f1b3d8702d..88404cabf41 100644 --- a/.azure-pipelines/run-test-template.yml +++ b/.azure-pipelines/run-test-template.yml @@ -22,10 +22,15 @@ parameters: - sonic-6asic-vs.img.gz steps: +- template: cleanup.yml - checkout: self clean: true displayName: 'checkout sonic-mgmt repo' +- script: | + sudo rm -rf ../target + displayName: "Cleanup" + - task: DownloadPipelineArtifact@2 inputs: artifact: sonic-buildimage.vs diff --git a/.azure-pipelines/trigger-publish-artifacts-build.yml b/.azure-pipelines/trigger-publish-artifacts-build.yml index 7a6676e0f1b..085fbe3cd05 100644 --- a/.azure-pipelines/trigger-publish-artifacts-build.yml +++ b/.azure-pipelines/trigger-publish-artifacts-build.yml @@ -53,7 +53,7 @@ steps: **/*.raw\n **/*.img.gz\n **/*-rpc.gz\n - **/python-saithrift*.deb"}, + **/*.deb"}, publishContext: {"publishPrefix":"${{ parameters.publishPrefix }}", "keepArtifactName":false, "dockerImagePatterns":"target/*-rpc.gz", diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 00000000000..2c8b0498f31 --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,4 @@ +name: "CodeQL config" +queries: + - uses: security-and-quality + - uses: security-extended diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d553f7a4d0c..85645d8ff7e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -39,7 +39,7 @@ Write a short (one line) summary that describes the changes in this pull request for inclusion in the changelog: --> -#### Ensure to add label/tag for the feature raised. example - [PR#2174](https://github.com/sonic-net/sonic-utilities/pull/2174) where, Generic Config and Update feature has been labelled as GCU. +#### Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU. #### Link to config_db schema for YANG module changes A{merged?} +A -- NO --> STOP +A -- YES --> A1{Approved
for 202205
Branch?} +A1 -- NO --> STOP +A1 -- YES --> A2(pr_cherrypick_prestep) +B(pr_cherrypick_prestep) +B --> B1{cherry pick
conflict?} +B1 -- YES --> B2(Add tag:
Cherry Pick Confclit_202205) --> B3(Add comment:
refer author code conflict) --> STOP1(STOP) +B1 -- NO --> B4(Create New PR) -- success --> B5(New PR add tag:
automerge) --> B6(New PR add comment:
Origin PR link) --> B7(Origin PR add tag:
Created PR to 202205 Branch) --> B8(Origin PR add comment:
New PR link) +B4 -- fail --> STOP1 +``` + +2. automerge: +```mermaid +graph +Start(PR azp finished successfully) --> A{author:
mssonicbld?} +A -- NO --> STOP +A -- YES --> B{tag:
automerge?} -- YES --> C(Merge PR) +B -- NO --> STOP +``` + +3. pr_cherrypick_poststep: +```mermaid +graph +A(PR is Merged) --> B{tag:
automerge?} +B -- YES --> B1{author:
mssonicbld?} +B1 -- YES --> B2{"title starts:
[action] [PR:123]"} +B2 -- YES --> C(Origin PR remove tag:
Created PR to 202205 Branch) --> D(Origin PR add tag:
Included in 202205 Branch) +B -- NO --> STOP +B1 -- NO --> STOP +B2 -- NO --> STOP +``` diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index ee27244bfb1..3edb8ad5318 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -13,10 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - name: automerge - uses: 'pascalgn/automerge-action@v0.13.1' + uses: 'pascalgn/automerge-action@v0.15.5' env: GITHUB_TOKEN: '${{ secrets.TOKEN }}' MERGE_LABELS: 'automerge' MERGE_METHOD: 'squash' MERGE_FILTER_AUTHOR: 'mssonicbld' MERGE_DELETE_BRANCH: true + LOG: "TRACE" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000000..6478fb99f7a --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,43 @@ +# For more infomation, please visit: https://github.com/github/codeql-action + +name: "CodeQL" + +on: + push: + branches: + - 'master' + - '202[0-9][0-9][0-9]' + pull_request_target: + branches: + - 'master' + - '202[0-9][0-9][0-9]' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + config-file: ./.github/codeql/codeql-config.yml + languages: ${{ matrix.language }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/pr_cherrypick_poststep.yml b/.github/workflows/pr_cherrypick_poststep.yml new file mode 100644 index 00000000000..1e9e497075d --- /dev/null +++ b/.github/workflows/pr_cherrypick_poststep.yml @@ -0,0 +1,49 @@ +name: PostCherryPick +on: + pull_request_target: + types: + - closed + branches: + - '20*' + +jobs: + post_cherry_pick: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'automerge') && github.event.pull_request.head.user.login == 'mssonicbld' && startsWith(github.event.pull_request.title, '[action]') + runs-on: ubuntu-latest + steps: + - name: Debug + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo $GITHUB_CONTEXT | jq + - name: Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + - name: Main + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + TOKEN: ${{ secrets.TOKEN }} + run: | + set -e + pr_url=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request._links.html.href") + pr_id=$(echo $GITHUB_CONTEXT | jq -r ".event.number") + base_ref=$(echo $GITHUB_CONTEXT | jq -r ".base_ref") + echo ${TOKEN} | gh auth login --with-token + title=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.title") + origin_pr_id=$(echo $title | grep -Eo "\[action\] \[PR:[0-9]*\]" | grep -Eo "[0-9]*") + origin_pr_url=$(echo $pr_url | sed "s/$pr_id/$origin_pr_id/") + echo ============================= + echo pr_url: $pr_url + echo pr_id: $pr_id + echo base_ref: $base_ref + echo title: $title + echo origin_pr_id: $origin_pr_id + echo origin_pr_url: $origin_pr_url + echo ============================= + # Add label + if [[ "$origin_pr_id" == "" ]];then + echo "original PR didn't found." + 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" diff --git a/.github/workflows/pr_cherrypick_prestep.yml b/.github/workflows/pr_cherrypick_prestep.yml new file mode 100644 index 00000000000..b99e883d904 --- /dev/null +++ b/.github/workflows/pr_cherrypick_prestep.yml @@ -0,0 +1,136 @@ +name: PreCherryPick +on: + pull_request_target: + types: + - labeled + - closed + branches: + - master + +jobs: + pre_cherry_pick: + if: github.event.pull_request.merged == true && ( (github.event.action == 'closed' && contains(join(github.event.pull_request.labels.*.name, ','), 'Approved for 20')) || (github.event.action == 'labeled' && startsWith(github.event.label.name, 'Approved for 20')) ) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + - name: Debug + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo $GITHUB_CONTEXT | jq + - name: Main + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + TOKEN: ${{ secrets.TOKEN }} + run: | + set -e + + sha=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.merge_commit_sha") + pr_id=$(echo $GITHUB_CONTEXT | jq -r ".event.number") + pr_url=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request._links.html.href") + repository=$(echo $GITHUB_CONTEXT | jq -r ".repository") + labels=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.labels[].name") + author=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.user.login") + branches=$(git branch -a --list 'origin/20????' | awk -F/ '{print$3}' | grep -E "202[0-9]{3}") + if [[ $(echo $GITHUB_CONTEXT | jq -r ".event.action") == "labeled" ]];then + labels=$(echo $GITHUB_CONTEXT | jq -r ".event.label.name") + fi + title=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.title") + echo ============================= + echo SHA: $sha + echo PRID: $pr_id + echo pr_url: $pr_url + echo repository: $repository + echo branches: $branches + echo labels: + echo "$labels" + echo ${TOKEN} | gh auth login --with-token + echo author: $author + echo title: $title + echo ============================= + + git config user.name mssonicbld + git config user.email sonicbld@microsoft.com + git config credential.https://github.zerozr99.workers.dev.username mssonicbld + git remote add mssonicbld https://mssonicbld:${TOKEN}@github.com/mssonicbld/sonic-buildimage + git fetch mssonicbld + git remote -vv + + cherry_pick(){ + set -e + local create_pr='' + while read label + do + echo label: $label + if [[ "$label" == "Approved for $branch Branch" ]];then + create_pr=1 + fi + if [[ "$label" == "Created PR to $branch Branch" ]];then + echo "already has tag: Created PR to $branch Branch, return" + return 0 + fi + if [[ "$label" == "Included in $branch Branch" ]];then + echo "already has tag: Included in $branch Branch, return" + return 0 + fi + if [[ "$label" == "Cherry Pick Conflict_$branch" ]];then + echo "already has tag: Cherry Pick Conflict_$branch, return" + return 0 + fi + done <<< "$labels" + + if [[ "$create_pr" != "1" ]];then + echo "Didn't find 'Approved for $branch Branch' tag." + return 0 + fi + # Begin to cherry-pick PR + git cherry-pick --abort 2>/dev/null || true + git clean -xdff 2>/dev/null || true + git reset HEAD --hard || true + git checkout -b $branch --track origin/$branch + git status | grep "working tree clean" + + if ! git cherry-pick $sha;then + echo 'cherry-pick failed.' + git cherry-pick --abort + git status | grep "working tree clean" + # Add label + gh pr edit $pr_url --add-label "Cherry Pick Conflict_$branch" + echo 'Add label "Cherry Pick Conflict_$branch" success' + gh pr comment $pr_url --body "@${author} PR conflicts with $branch branch" + echo 'Add commnet "@${author} PR conflicts with $branch branch"' + else + # Create PR to release branch + git push mssonicbld HEAD:cherry/$branch/${pr_id} -f + result=$(gh pr create -R ${repository} -H mssonicbld:cherry/$branch/${pr_id} -B $branch -t "[action] [PR:$pr_id] $title" -b '' 2>&1) + echo $result | grep "already exists" && { echo $result; return 0; } + echo $result | grep github.com || { echo $result; return 1; } + new_pr_rul=$(echo $result | grep github.com) + echo new_pr_rul: $new_pr_rul + + # Add label to old PR + gh pr edit $pr_url --add-label "Created PR to $branch Branch" + echo Add label Created PR to $branch Branch + # Add comment to old PR + gh pr comment $pr_url --body "Cherry-pick PR to $branch: ${new_pr_rul}" + echo Add comment to old PR + + # Add label to new PR + gh pr edit $new_pr_rul --add-label "automerge" + echo Add label automerge to new PR + # Add comment to new PR + gh pr comment $new_pr_rul --body "Original PR: ${pr_url}" + echo Add comment to new PR + fi + } + + for branch in $branches + do + echo ------------------------------------------- + echo Begin to parse Branch: $branch + cherry_pick + done + diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 008bf8dbdba..cdf6ee483ce 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -2,8 +2,6 @@ name: Semgrep on: pull_request: {} - push: - branches: ["master"] jobs: semgrep: diff --git a/.gitignore b/.gitignore index 5f6f41b1a09..60c328d6228 100644 --- a/.gitignore +++ b/.gitignore @@ -96,3 +96,6 @@ htmlcov/ .vscode/ .idea/ +# Debian mirror Sources +sources.list.* +!sources.list*.j2 diff --git a/Makefile b/Makefile index af3d7086ec8..ccfefc6c183 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,14 @@ NOSTRETCH ?= 0 NOBUSTER ?= 0 NOBULLSEYE ?= 0 +override Q := @ +ifeq ($(QUIET),n) + override Q := +endif +override SONIC_OVERRIDE_BUILD_VARS += $(SONIC_BUILD_VARS) +override SONIC_OVERRIDE_BUILD_VARS += Q=$(Q) +export Q SONIC_OVERRIDE_BUILD_VARS + ifeq ($(NOJESSIE),0) BUILD_JESSIE=1 endif @@ -29,50 +37,50 @@ PLATFORM_CHECKOUT_CMD := $(shell if [ -f $(PLATFORM_CHECKOUT_FILE) ]; then PLATF %:: @echo "+++ --- Making $@ --- +++" ifeq ($(NOJESSIE), 0) - EXTRA_DOCKER_TARGETS=$(notdir $@) make -f Makefile.work jessie + EXTRA_DOCKER_TARGETS=$(notdir $@) $(MAKE) -f Makefile.work jessie endif ifeq ($(NOSTRETCH), 0) - EXTRA_DOCKER_TARGETS=$(notdir $@) BLDENV=stretch make -f Makefile.work stretch + EXTRA_DOCKER_TARGETS=$(notdir $@) BLDENV=stretch $(MAKE) -f Makefile.work stretch endif ifeq ($(NOBUSTER), 0) - EXTRA_DOCKER_TARGETS=$(notdir $@) BLDENV=buster make -f Makefile.work buster + EXTRA_DOCKER_TARGETS=$(notdir $@) BLDENV=buster $(MAKE) -f Makefile.work buster endif ifeq ($(NOBULLSEYE), 0) - BLDENV=bullseye make -f Makefile.work $@ + BLDENV=bullseye $(MAKE) -f Makefile.work $@ endif - BLDENV=bullseye make -f Makefile.work docker-cleanup + BLDENV=bullseye $(MAKE) -f Makefile.work docker-cleanup jessie: @echo "+++ Making $@ +++" ifeq ($(NOJESSIE), 0) - make -f Makefile.work jessie + $(MAKE) -f Makefile.work jessie endif stretch: @echo "+++ Making $@ +++" ifeq ($(NOSTRETCH), 0) - make -f Makefile.work stretch + $(MAKE) -f Makefile.work stretch endif buster: @echo "+++ Making $@ +++" ifeq ($(NOBUSTER), 0) - make -f Makefile.work buster + $(MAKE) -f Makefile.work buster endif init: @echo "+++ Making $@ +++" - make -f Makefile.work $@ + $(MAKE) -f Makefile.work $@ # # Function to invoke target $@ in Makefile.work with proper BLDENV # define make_work @echo "+++ Making $@ +++" - $(if $(BUILD_JESSIE),make -f Makefile.work $@,) - $(if $(BUILD_STRETCH),BLDENV=stretch make -f Makefile.work $@,) - $(if $(BUILD_BUSTER),BLDENV=buster make -f Makefile.work $@,) - $(if $(BUILD_BULLSEYE),BLDENV=bullseye make -f Makefile.work $@,) + $(if $(BUILD_JESSIE),$(MAKE) -f Makefile.work $@,) + $(if $(BUILD_STRETCH),BLDENV=stretch $(MAKE) -f Makefile.work $@,) + $(if $(BUILD_BUSTER),BLDENV=buster $(MAKE) -f Makefile.work $@,) + $(if $(BUILD_BULLSEYE),BLDENV=bullseye $(MAKE) -f Makefile.work $@,) endef .PHONY: $(PLATFORM_PATH) diff --git a/Makefile.work b/Makefile.work index 6171a05c519..b048282d64b 100644 --- a/Makefile.work +++ b/Makefile.work @@ -124,7 +124,7 @@ endif # Define a do-nothing target for rules/config.user so that when # the file is missing, make won't try to rebuld everything. rules/config.user: - @echo -n "" + $(Q)echo -n "" include rules/config -include rules/config.user @@ -173,21 +173,59 @@ endif endif # Generate the version control build info -$(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ - TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ - scripts/generate_buildinfo_config.sh) +$(shell \ + SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ + TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) \ + PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ + scripts/generate_buildinfo_config.sh) # Generate the slave Dockerfile, and prepare build info for it -$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) CROSS_BUILD_ENVIRON=$(CROSS_BUILD_ENVIRON) ENABLE_FIPS_FEATURE=$(ENABLE_FIPS_FEATURE) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile) -$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) CROSS_BUILD_ENVIRON=$(CROSS_BUILD_ENVIRON) j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user) -$(shell BUILD_SLAVE=y DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV)) +$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) \ + MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) \ + CROSS_BUILD_ENVIRON=$(CROSS_BUILD_ENVIRON) \ + ENABLE_FIPS_FEATURE=$(ENABLE_FIPS_FEATURE) \ + DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) \ + DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ + j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile) + +$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) \ + MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) \ + CROSS_BUILD_ENVIRON=$(CROSS_BUILD_ENVIRON) \ + j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user) + +PREPARE_DOCKER=BUILD_SLAVE=y \ + DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ + scripts/prepare_docker_buildinfo.sh \ + $(SLAVE_BASE_IMAGE) \ + $(SLAVE_DIR)/Dockerfile \ + $(CONFIGURED_ARCH) \ + "" \ + $(BLDENV) + +$(shell $(PREPARE_DOCKER) ) # Add the versions in the tag, if the version change, need to rebuild the slave -SLAVE_BASE_TAG = $(shell cat $(SLAVE_DIR)/Dockerfile $(SLAVE_DIR)/buildinfo/versions/versions-* src/sonic-build-hooks/hooks/* | sha1sum | awk '{print substr($$1,0,11);}') -# Calculate the slave TAG based on $(USER)/$(PWD)/$(CONFIGURED_PLATFORM) to get unique SHA ID -SLAVE_TAG = $(shell (cat $(SLAVE_DIR)/Dockerfile.user $(SLAVE_DIR)/Dockerfile $(SLAVE_DIR)/buildinfo/versions/versions-* .git/HEAD && echo $(USER)/$(PWD)/$(CONFIGURED_PLATFORM)) \ - | sha1sum | awk '{print substr($$1,0,11);}') +SLAVE_BASE_TAG = $(shell \ + cat $(SLAVE_DIR)/Dockerfile \ + $(SLAVE_DIR)/buildinfo/versions/versions-* \ + src/sonic-build-hooks/hooks/* 2>/dev/null \ + | sha1sum \ + | awk '{print substr($$1,0,11);}') +# Calculate the slave TAG based on $(USER)/$(PWD)/$(CONFIGURED_PLATFORM) to get unique SHA ID +SLAVE_TAG = $(shell \ + (cat $(SLAVE_DIR)/Dockerfile.user \ + $(SLAVE_DIR)/Dockerfile \ + $(SLAVE_DIR)/buildinfo/versions/versions-* \ + .git/HEAD \ + && echo $(USER)/$(PWD)/$(CONFIGURED_PLATFORM)) \ + | sha1sum \ + | awk '{print substr($$1,0,11);}') + +COLLECT_DOCKER=DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ + scripts/collect_docker_version_files.sh \ + $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) \ + target OVERLAY_MODULE_CHECK := \ lsmod | grep -q "^overlay " &>/dev/null || \ zgrep -q 'CONFIG_OVERLAY_FS=y' /proc/config.gz &>/dev/null || \ @@ -329,7 +367,7 @@ DOCKER_BASE_LOG = $(SLAVE_DIR)/$(SLAVE_BASE_IMAGE)_$(SLAVE_BASE_TAG).log DOCKER_LOG = $(SLAVE_DIR)/$(SLAVE_IMAGE)_$(SLAVE_TAG).log -DOCKER_BASE_BUILD = docker build --no-cache \ +DOCKER_SLAVE_BASE_BUILD = docker build --no-cache \ -t $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) \ --build-arg http_proxy=$(http_proxy) \ --build-arg https_proxy=$(https_proxy) \ @@ -339,7 +377,7 @@ DOCKER_BASE_BUILD = docker build --no-cache \ DOCKER_BASE_PULL = docker pull \ $(REGISTRY_SERVER):$(REGISTRY_PORT)/$(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) -DOCKER_BUILD = docker build --no-cache \ +DOCKER_USER_BUILD = docker build --no-cache \ --build-arg user=$(USER) \ --build-arg uid=$(shell id -u) \ --build-arg guid=$(shell id -g) \ @@ -349,7 +387,52 @@ DOCKER_BUILD = docker build --no-cache \ -f $(SLAVE_DIR)/Dockerfile.user \ $(SLAVE_DIR) $(SPLIT_LOG) $(DOCKER_LOG) -SONIC_BUILD_INSTRUCTION := make \ + +DOCKER_SLAVE_BASE_INSPECT = \ + { \ + echo Checking sonic-slave-base image: $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG); \ + docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null; \ + } + +DOCKER_SLAVE_BASE_PULL_REGISTRY = \ + [ $(ENABLE_DOCKER_BASE_PULL) == y ] && \ + { \ + echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Pulling...; \ + $(DOCKER_BASE_PULL); \ + } && \ + { \ + docker tag $(REGISTRY_SERVER):$(REGISTRY_PORT)/$(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) && \ + $(COLLECT_DOCKER); \ + }\ + +SONIC_SLAVE_BASE_BUILD = \ + { \ + $(DOCKER_SLAVE_BASE_INSPECT); \ + } || \ + { \ + $(DOCKER_SLAVE_BASE_PULL_REGISTRY); \ + } || \ + { \ + echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ + $(PREPARE_DOCKER) ; \ + $(DOCKER_SLAVE_BASE_BUILD) ; \ + $(COLLECT_DOCKER) ; \ + } + +DOCKER_SLAVE_USER_INSPECT = \ + { \ + echo Checking sonic-slave-user image: $(SLAVE_IMAGE):$(SLAVE_TAG); \ + docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null; \ + } + +SONIC_SLAVE_USER_BUILD = \ + { $(DOCKER_SLAVE_USER_INSPECT) } || \ + { \ + echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ + $(DOCKER_USER_BUILD) ; \ + } + +SONIC_BUILD_INSTRUCTION := $(MAKE) \ -f slave.mk \ PLATFORM=$(PLATFORM) \ PLATFORM_ARCH=$(PLATFORM_ARCH) \ @@ -411,91 +494,87 @@ SONIC_BUILD_INSTRUCTION := make \ ENABLE_FIPS_FEATURE=$(ENABLE_FIPS_FEATURE) \ ENABLE_FIPS=$(ENABLE_FIPS) \ SONIC_SLAVE_DOCKER_DRIVER=$(SONIC_SLAVE_DOCKER_DRIVER) \ + MIRROR_URLS=$(MIRROR_URLS) \ + MIRROR_SECURITY_URLS=$(MIRROR_SECURITY_URLS) \ $(SONIC_OVERRIDE_BUILD_VARS) .PHONY: sonic-slave-build sonic-slave-bash init reset + +ifeq ($(filter clean,$(MAKECMDGOALS)),) +COLLECT_BUILD_VERSION = { DBGOPT='$(DBGOPT)' scripts/collect_build_version_files.sh \$$?; } +endif + +ifdef SOURCE_FOLDER + DOCKER_RUN += -v $(SOURCE_FOLDER):/var/$(USER)/src +endif + +ifeq "$(KEEP_SLAVE_ON)" "yes" +SLAVE_SHELL={ ret=\$$?; /bin/bash; exit \$$ret; } +endif + .DEFAULT_GOAL := all +.SHELLFLAGS += -e -%:: +export MIRROR_URLS +export MIRROR_SECURITY_URLS + +%:: | sonic-build-hooks ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),) - @$(DOCKER_MULTIARCH_CHECK) + $(Q)$(DOCKER_MULTIARCH_CHECK) ifneq ($(BLDENV), ) - @$(DOCKER_SERVICE_MULTIARCH_CHECK) - @$(DOCKER_SERVICE_DOCKERFS_CHECK) -endif -endif - @$(OVERLAY_MODULE_CHECK) - - @pushd src/sonic-build-hooks; TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) make all; popd - @cp src/sonic-build-hooks/buildinfo/sonic-build-hooks* $(SLAVE_DIR)/buildinfo - @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ - { [ $(ENABLE_DOCKER_BASE_PULL) == y ] && { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Pulling...; } && \ - $(DOCKER_BASE_PULL) && \ - { docker tag $(REGISTRY_SERVER):$(REGISTRY_PORT)/$(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) && \ - scripts/collect_docker_version_files.sh $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) target ; } } || \ - { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ - $(DOCKER_BASE_BUILD) ; \ - scripts/collect_docker_version_files.sh $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) target ; } - @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ - { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ - $(DOCKER_BUILD) ; } -ifeq "$(KEEP_SLAVE_ON)" "yes" - ifdef SOURCE_FOLDER - @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/$(USER)/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; scripts/collect_build_version_files.sh \$$?; /bin/bash" - else - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; scripts/collect_build_version_files.sh \$$?; /bin/bash" - endif -else - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; scripts/collect_build_version_files.sh \$$?" + $(Q)$(DOCKER_SERVICE_MULTIARCH_CHECK) + $(Q)$(DOCKER_SERVICE_DOCKERFS_CHECK) +endif endif + $(Q)$(OVERLAY_MODULE_CHECK) + $(Q)$(SONIC_SLAVE_BASE_BUILD) + $(Q)$(SONIC_SLAVE_USER_BUILD) + + $(Q)$(DOCKER_RUN) \ + $(SLAVE_IMAGE):$(SLAVE_TAG) \ + bash -c "$(SONIC_BUILD_INSTRUCTION) $@; $(COLLECT_BUILD_VERSION); $(SLAVE_SHELL)" + $(Q)$(docker-image-cleanup) docker-cleanup: - $(docker-image-cleanup) + $(Q)$(docker-image-cleanup) +.PHONY: sonic-build-hooks sonic-build-hooks: - @pushd src/sonic-build-hooks; TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) make all; popd - @cp src/sonic-build-hooks/buildinfo/sonic-build-hooks* $(SLAVE_DIR)/buildinfo + $(Q)pushd src/sonic-build-hooks; TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) $(MAKE) all; popd + $(Q)mkdir -p $(SLAVE_DIR)/buildinfo + $(Q)cp src/sonic-build-hooks/buildinfo/sonic-build-hooks* $(SLAVE_DIR)/buildinfo + $(Q)[ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && scripts/build_mirror_config.sh $(SLAVE_DIR) amd64 $(BLDENV) + $(Q)scripts/build_mirror_config.sh $(SLAVE_DIR) $(CONFIGURED_ARCH) $(BLDENV) -sonic-slave-base-build : sonic-build-hooks +sonic-slave-base-build : | sonic-build-hooks ifeq ($(MULTIARCH_QEMU_ENVIRON), y) - @$(DOCKER_MULTIARCH_CHECK) -endif - @$(OVERLAY_MODULE_CHECK) - @echo Checking sonic-slave-base image: $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) - @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ - { [ $(ENABLE_DOCKER_BASE_PULL) == y ] && { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Pulling...; } && \ - $(DOCKER_BASE_PULL) && \ - { docker tag $(REGISTRY_SERVER):$(REGISTRY_PORT)/$(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) && \ - scripts/collect_docker_version_files.sh $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) target ; } } || \ - { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ - $(DOCKER_BASE_BUILD) ; \ - scripts/collect_docker_version_files.sh $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) target ; } + $(Q)$(DOCKER_MULTIARCH_CHECK) +endif + $(Q)$(OVERLAY_MODULE_CHECK) + $(Q)$(SONIC_SLAVE_BASE_BUILD) sonic-slave-build : sonic-slave-base-build - @echo Checking sonic-slave image: $(SLAVE_IMAGE):$(SLAVE_TAG) - @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ - { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ - $(DOCKER_BUILD) ; } + $(Q)$(SONIC_SLAVE_USER_BUILD) sonic-slave-bash : sonic-slave-build - @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash + $(Q)$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash sonic-slave-run : sonic-slave-build - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_RUN_CMDS)" + $(Q)$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_RUN_CMDS)" showtag: - @echo $(SLAVE_IMAGE):$(SLAVE_TAG) - @echo $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) + $(Q)echo $(SLAVE_IMAGE):$(SLAVE_TAG) + $(Q)echo $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) init : - @git submodule update --init --recursive - @git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' + $(Q)git submodule update --init --recursive + $(Q)git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' .ONESHELL : reset reset : - @echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " - @read ans && ( + $(Q)echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " + $(Q)read ans && ( if [ $$ans == y ]; then echo "Resetting local repository. Please wait..."; sudo rm -rf fsroot*; diff --git a/README.md b/README.md index 1f78c9f56d6..cda483fbd94 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ To build SONiC installer image and docker images, run the following commands: The supported ASIC vendors are: +- PLATFORM=barefoot - PLATFORM=broadcom - PLATFORM=marvell - PLATFORM=mellanox diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 26a86dffa01..7cb439d95f2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,7 +7,7 @@ trigger: branches: include: - master - - 202012 + - 202??? paths: exclude: - .github @@ -16,8 +16,7 @@ pr: branches: include: - master - - 202012 - - bullseye + - 202??? paths: exclude: - .github @@ -74,8 +73,9 @@ stages: - stage: Test dependsOn: BuildVS - condition: and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), in(dependencies.BuildVS.result, 'Succeeded', 'SucceededWithIssues')) + condition: and(succeeded(), and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), in(dependencies.BuildVS.result, 'Succeeded', 'SucceededWithIssues'))) variables: + - group: Testbed-Tools - name: inventory value: veos_vtb - name: testbed_file @@ -91,11 +91,17 @@ stages: displayName: "vstest" timeoutInMinutes: 60 steps: + - template: .azure-pipelines/cleanup.yml - checkout: self clean: true submodules: recursive displayName: 'Checkout code' + - script: | + sudo rm -rf ../target + sudo rm -rf ../*.deb + displayName: "Cleanup" + - task: DownloadPipelineArtifact@2 inputs: source: specific @@ -113,6 +119,8 @@ stages: - script: | set -x + sudo apt-get update + sudo apt-get install libyang0.16 -y sudo dpkg -i --force-confask,confnew ../libswsscommon_1.0.0_amd64.deb sudo dpkg -i ../python3-swsscommon_1.0.0_amd64.deb sudo docker load -i ../target/docker-sonic-vs.gz @@ -136,7 +144,8 @@ stages: - job: t0_part1 pool: sonictest displayName: "kvmtest-t0-part1" - timeoutInMinutes: 360 + timeoutInMinutes: 400 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_CLASSICAL_TEST, 'YES')) continueOnError: false steps: - template: .azure-pipelines/run-test-template.yml @@ -145,12 +154,14 @@ stages: tbname: vms-kvm-t0 ptf_name: ptf_vms6-1 tbtype: t0 + vmtype: ceos section: part-1 - job: t0_part2 pool: sonictest displayName: "kvmtest-t0-part2" - timeoutInMinutes: 360 + timeoutInMinutes: 400 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_CLASSICAL_TEST, 'YES')) continueOnError: false steps: - template: .azure-pipelines/run-test-template.yml @@ -159,35 +170,76 @@ stages: tbname: vms-kvm-t0 ptf_name: ptf_vms6-1 tbtype: t0 + vmtype: ceos section: part-2 + - job: t0_testbedv2 + pool: + vmImage: 'ubuntu-20.04' + displayName: "kvmtest-t0 by TestbedV2" + timeoutInMinutes: 1080 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES')) + continueOnError: false + steps: + - template: .azure-pipelines/run-test-scheduler-template.yml + parameters: + TOPOLOGY: t0 + MIN_WORKER: 2 + MAX_WORKER: 3 + + - job: t0_2vlans_testbedv2 + pool: + vmImage: 'ubuntu-20.04' + displayName: "kvmtest-t0-2vlans by TestbedV2" + timeoutInMinutes: 1080 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES')) + continueOnError: false + steps: + - template: .azure-pipelines/run-test-scheduler-template.yml + parameters: + TOPOLOGY: t0 + TEST_SET: t0-2vlans + MAX_WORKER: 1 + DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a" + - job: - pool: sonictest + pool: + vmImage: 'ubuntu-20.04' displayName: "kvmtest-t0" - timeoutInMinutes: 360 dependsOn: - t0_part1 - t0_part2 + - t0_testbedv2 + - t0_2vlans_testbedv2 condition: always() continueOnError: false variables: resultOfPart1: $[ dependencies.t0_part1.result ] resultOfPart2: $[ dependencies.t0_part2.result ] + resultOfT0TestbedV2: $[ dependencies.t0_testbedv2.result ] + resultOfT02VlansTestbedV2: $[ dependencies.t0_2vlans_testbedv2.result ] steps: - script: | + if [ $(resultOfT0TestbedV2) == "Succeeded" ] && [ $(resultOfT02VlansTestbedV2) == "Succeeded" ]; then + echo "TestbedV2 t0 passed." + exit 0 + fi + if [ $(resultOfPart1) == "Succeeded" ] && [ $(resultOfPart2) == "Succeeded" ]; then - echo "Both job kvmtest-t0-part1 and kvmtest-t0-part2 are passed." + echo "Classic t0 jobs(both part1 and part2) passed." exit 0 - else - echo "Either job kvmtest-t0-part1 or job kvmtest-t0-part2 failed! Please check the detailed information." - exit 1 fi - - job: + echo "Both classic and TestbedV2 t0 jobs failed! Please check the detailed information. (Any of them passed, t0 will be considered as passed)" + exit 1 + + + - job: t1_lag_classic pool: sonictest-t1-lag - displayName: "kvmtest-t1-lag" - timeoutInMinutes: 360 + displayName: "kvmtest-t1-lag classic" + timeoutInMinutes: 400 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_CLASSICAL_TEST, 'YES')) continueOnError: false steps: - template: .azure-pipelines/run-test-template.yml @@ -196,11 +248,49 @@ stages: tbname: vms-kvm-t1-lag ptf_name: ptf_vms6-2 tbtype: t1-lag + vmtype: ceos + + - job: t1_lag_testbedv2 + pool: + vmImage: 'ubuntu-20.04' + displayName: "kvmtest-t1-lag by TestbedV2" + timeoutInMinutes: 600 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES')) + continueOnError: false + steps: + - template: .azure-pipelines/run-test-scheduler-template.yml + parameters: + TOPOLOGY: t1-lag + MIN_WORKER: 2 + MAX_WORKER: 3 + + - job: + pool: + vmImage: 'ubuntu-20.04' + displayName: "kvmtest-t1-lag" + dependsOn: + - t1_lag_classic + - t1_lag_testbedv2 + condition: always() + continueOnError: false + variables: + resultOfClassic: $[ dependencies.t1_lag_classic.result ] + resultOfTestbedV2: $[ dependencies.t1_lag_testbedv2.result ] + steps: + - script: | + if [ $(resultOfClassic) == "Succeeded" ] || [ $(resultOfTestbedV2) == "Succeeded" ]; then + echo "One or both of t1_lag_classic and t1_lag_testbedv2 passed." + exit 0 + else + echo "Both t1_lag_classic and t1_lag_testbedv2 failed! Please check the detailed information." + exit 1 + fi - job: pool: sonictest-sonic-t0 displayName: "kvmtest-t0-sonic" timeoutInMinutes: 360 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_CLASSICAL_TEST, 'YES')) continueOnError: true steps: - template: .azure-pipelines/run-test-template.yml @@ -215,6 +305,7 @@ stages: pool: sonictest-ma displayName: "kvmtest-multi-asic-t1-lag" timeoutInMinutes: 240 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_CLASSICAL_TEST, 'YES')) continueOnError: true steps: - template: .azure-pipelines/run-test-template.yml @@ -224,3 +315,66 @@ stages: ptf_name: ptf_vms6-4 tbtype: multi-asic-t1-lag-pr image: sonic-4asic-vs.img.gz + + - job: multi_asic_testbedv2 + displayName: "kvmtest-multi-asic-t1-lag by TestbedV2" + pool: + vmImage: 'ubuntu-20.04' + timeoutInMinutes: 1080 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES')) + continueOnError: true + steps: + - template: .azure-pipelines/run-test-scheduler-template.yml + parameters: + TOPOLOGY: t1-8-lag + TEST_SET: multi-asic-t1-lag + MIN_WORKER: 1 + MAX_WORKER: 1 + NUM_ASIC: 4 + + - job: dualtor_testbedv2 + pool: + vmImage: 'ubuntu-20.04' + displayName: "kvmtest-dualtor-t0 by TestbedV2" + timeoutInMinutes: 1080 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES')) + continueOnError: false + steps: + - template: .azure-pipelines/run-test-scheduler-template.yml + parameters: + TOPOLOGY: dualtor + MIN_WORKER: 1 + MAX_WORKER: 1 + COMMON_EXTRA_PARAMS: "--disable_loganalyzer " + + - job: sonic_t0_testbedv2 + displayName: "kvmtest-t0-sonic by TestbedV2" + pool: + vmImage: 'ubuntu-20.04' + timeoutInMinutes: 1080 + condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES')) + continueOnError: true + steps: + - template: .azure-pipelines/run-test-scheduler-template.yml + parameters: + TOPOLOGY: t0-64-32 + MIN_WORKER: 1 + MAX_WORKER: 2 + TEST_SET: t0-sonic + COMMON_EXTRA_PARAMS: "--neighbor_type=sonic --enable_macsec --macsec_profile=128_SCI,256_XPN_SCI" + VM_TYPE: vsonic + SPECIFIED_PARAMS: '{\"test_pretest.py\":[\"--completeness_level=confident\",\"--allow_recover\"],\"test_posttest.py\":[\"--completeness_level=confident\",\"--allow_recover\"]}' + + - job: Semgrep + displayName: "Semgrep" + trigger: + - master + pool: + vmImage: ubuntu-latest + steps: + - script: | + python -m pip install --upgrade pip + pip install semgrep + semgrep --config auto + env: + SEMGREP_PR_ID: $(System.PullRequest.PullRequestNumber) diff --git a/build_debian.sh b/build_debian.sh index 01a10d78d67..140e3b4b8ae 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -108,6 +108,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT mount [ -d $TRUSTED_GPG_DIR ] && [ ! -z "$(ls $TRUSTED_GPG_DIR)" ] && sudo cp $TRUSTED_GPG_DIR/* ${FILESYSTEM_ROOT}/etc/apt/trusted.gpg.d/ ## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates +scripts/build_mirror_config.sh files/apt $CONFIGURED_ARCH $IMAGE_DISTRO sudo cp files/apt/sources.list.$CONFIGURED_ARCH $FILESYSTEM_ROOT/etc/apt/sources.list sudo cp files/apt/apt.conf.d/{81norecommends,apt-{clean,gzip-indexes,no-languages},no-check-valid-until} $FILESYSTEM_ROOT/etc/apt/apt.conf.d/ @@ -468,7 +469,7 @@ rm /files/etc/ssh/sshd_config/ClientAliveCountMax touch /files/etc/ssh/sshd_config/EmptyLineHack rename /files/etc/ssh/sshd_config/EmptyLineHack "" set /files/etc/ssh/sshd_config/ClientAliveInterval 300 -set /files/etc/ssh/sshd_config/ClientAliveCountMax 1 +set /files/etc/ssh/sshd_config/ClientAliveCountMax 0 ins #comment before /files/etc/ssh/sshd_config/ClientAliveInterval set /files/etc/ssh/sshd_config/#comment[following-sibling::*[1][self::ClientAliveInterval]] "Close inactive client sessions after 5 minutes" rm /files/etc/ssh/sshd_config/MaxAuthTries @@ -678,6 +679,7 @@ sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS ## Note: -x to skip directories on different file systems, such as /proc sudo du -hsx $FILESYSTEM_ROOT sudo mkdir -p $FILESYSTEM_ROOT/var/lib/docker +sudo cp files/image_config/resolv-config/resolv.conf $FILESYSTEM_ROOT/etc/resolv.conf sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -comp zstd -b 1M -e boot -e var/lib/docker -e $PLATFORM_DIR # Ensure admin gid is 1000 diff --git a/build_image.sh b/build_image.sh index 9c70713866a..ea276367eb5 100755 --- a/build_image.sh +++ b/build_image.sh @@ -71,12 +71,12 @@ generate_onie_installer_image() output_file=$OUTPUT_ONIE_IMAGE [ -n "$1" ] && output_file=$1 # Copy platform-specific ONIE installer config files where onie-mk-demo.sh expects them - rm -rf ./installer/${TARGET_PLATFORM}/platforms/ - mkdir -p ./installer/${TARGET_PLATFORM}/platforms/ + rm -rf ./installer/platforms/ + mkdir -p ./installer/platforms/ for VENDOR in `ls ./device`; do for PLATFORM in `ls ./device/$VENDOR | grep ^${TARGET_PLATFORM}`; do if [ -f ./device/$VENDOR/$PLATFORM/installer.conf ]; then - cp ./device/$VENDOR/$PLATFORM/installer.conf ./installer/${TARGET_PLATFORM}/platforms/$PLATFORM + cp ./device/$VENDOR/$PLATFORM/installer.conf ./installer/platforms/$PLATFORM fi done diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py index 310d0433d8b..c1192b3a2eb 100644 --- a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py @@ -6,8 +6,8 @@ # ############################################################################# -import os import sys +import subprocess try: from sonic_platform_base.chassis_base import ChassisBase @@ -27,7 +27,7 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +HOST_CHK_CMD = ["which", "systemctl"] SYSLED_FNODE = "/sys/class/leds/diag/brightness" SYSLED_MODES = { "0" : "STATUS_LED_COLOR_OFF", @@ -97,7 +97,7 @@ def __initialize_watchdog(self): def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py index 53a01c1f147..c942a2fed97 100644 --- a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py @@ -6,9 +6,6 @@ # ############################################################################# -import shlex -import subprocess - try: from sonic_platform_base.component_base import ComponentBase @@ -38,22 +35,6 @@ def __init__(self, component_index=0): self.index = component_index self.name = self.get_name() - def __run_command(self, command): - # Run bash command and print output to stdout - try: - process = subprocess.Popen( - shlex.split(command), stdout=subprocess.PIPE) - while True: - output = process.stdout.readline() - if output == '' and process.poll() is not None: - break - rc = process.poll() - if rc != 0: - return False - except Exception: - return False - return True - def __get_bios_version(self): # Retrieves the BIOS firmware version try: 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 b124ca29f0d..b19fab85deb 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 @@ -4,7 +4,7 @@ from mmap import * from sonic_py_common import device_info -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,7 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def pci_get_value(self, resource, offset): status = True @@ -29,26 +29,6 @@ def pci_get_value(self, resource, offset): status = False return status, result - def run_command(self, cmd): - status = True - result = "" - try: - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - except Exception: - status = False - return status, result - - def run_interactive_command(self, cmd): - try: - os.system(cmd) - except Exception: - return False - return True - def read_txt_file(self, file_path): try: with open(file_path, 'r', errors='replace') as fd: @@ -66,52 +46,3 @@ def write_txt_file(self, file_path, value): return False return True - def ipmi_raw(self, netfn, cmd): - status = True - result = "" - try: - cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_fru_id(self, id, key=None): - status = True - result = "" - try: - cmd = "ipmitool fru print {}".format(str( - id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) - - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_set_ss_thres(self, id, threshold_key, value): - status = True - result = "" - try: - cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py index c421761025c..4205b17efad 100644 --- a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py @@ -6,10 +6,9 @@ # ############################################################################# -import os import time import sys - +import subprocess from ctypes import create_string_buffer try: @@ -30,7 +29,7 @@ class Sfp(SfpOptoeBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + HOST_CHK_CMD = ["which", "systemctl"] PLATFORM = "x86_64-accton_as4630_54pe-r0" HWSKU = "Accton-AS4630-54PE" @@ -60,7 +59,7 @@ def get_eeprom_path(self): return self.port_to_eeprom_mapping[self.port_num] def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py index 7a54eee6f47..9f39c903c68 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py @@ -6,7 +6,7 @@ # ############################################################################# -import os +import subprocess try: from sonic_platform_base.chassis_base import ChassisBase @@ -26,7 +26,7 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] SYSLED_FNODE = "/sys/class/leds/diag/brightness" SYSLED_MODES = { "0" : "STATUS_LED_COLOR_OFF", @@ -95,7 +95,7 @@ def __initialize_watchdog(self): def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py index c34da704432..8137d0f3a79 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py @@ -6,9 +6,6 @@ # ############################################################################# -import shlex -import subprocess - try: from sonic_platform_base.component_base import ComponentBase @@ -38,22 +35,6 @@ def __init__(self, component_index=0): self.index = component_index self.name = self.get_name() - def __run_command(self, command): - # Run bash command and print output to stdout - try: - process = subprocess.Popen( - shlex.split(command), stdout=subprocess.PIPE) - while True: - output = process.stdout.readline() - if output == '' and process.poll() is not None: - break - rc = process.poll() - if rc != 0: - return False - except Exception: - return False - return True - def __get_bios_version(self): # Retrieves the BIOS firmware version try: 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 b124ca29f0d..b19fab85deb 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 @@ -4,7 +4,7 @@ from mmap import * from sonic_py_common import device_info -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,7 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def pci_get_value(self, resource, offset): status = True @@ -29,26 +29,6 @@ def pci_get_value(self, resource, offset): status = False return status, result - def run_command(self, cmd): - status = True - result = "" - try: - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - except Exception: - status = False - return status, result - - def run_interactive_command(self, cmd): - try: - os.system(cmd) - except Exception: - return False - return True - def read_txt_file(self, file_path): try: with open(file_path, 'r', errors='replace') as fd: @@ -66,52 +46,3 @@ def write_txt_file(self, file_path, value): return False return True - def ipmi_raw(self, netfn, cmd): - status = True - result = "" - try: - cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_fru_id(self, id, key=None): - status = True - result = "" - try: - cmd = "ipmitool fru print {}".format(str( - id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) - - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_set_ss_thres(self, id, threshold_key, value): - status = True - result = "" - try: - cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py index 4529c2f0ac8..adab3d294c1 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py @@ -8,10 +8,9 @@ # ############################################################################# -import os import time import sys - +import subprocess from ctypes import create_string_buffer try: @@ -127,7 +126,7 @@ class Sfp(SfpBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-accton_as4630_54te-r0" HWSKU = "Accton-AS4630-54TE" @@ -193,7 +192,7 @@ def __write_txt_file(self, file_path, value): return True def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py index dce9f3c150c..c4a062f49a9 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py @@ -6,8 +6,8 @@ # ############################################################################# -import os import sys +import subprocess try: from sonic_platform_base.chassis_base import ChassisBase @@ -28,7 +28,7 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +HOST_CHK_CMD = ["which", "systemctl"] SYSLED_FNODE= "/sys/class/leds/as5835_54x_led::diag/brightness" SYSLED_MODES = { @@ -98,7 +98,7 @@ def __initialize_watchdog(self): def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py index f3c9b3cee75..ef47a154e95 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py @@ -6,10 +6,6 @@ # ############################################################################# -import shlex -import subprocess - - try: from sonic_platform_base.component_base import ComponentBase from .helper import APIHelper @@ -44,23 +40,6 @@ def __init__(self, component_index=0): self.index = component_index self.name = self.get_name() - - def __run_command(self, command): - # Run bash command and print output to stdout - try: - process = subprocess.Popen( - shlex.split(command), stdout=subprocess.PIPE) - while True: - output = process.stdout.readline() - if output == '' and process.poll() is not None: - break - rc = process.poll() - if rc != 0: - return False - except Exception: - return False - return True - def __get_bios_version(self): # Retrieves the BIOS firmware version try: 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 b124ca29f0d..b19fab85deb 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 @@ -4,7 +4,7 @@ from mmap import * from sonic_py_common import device_info -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,7 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def pci_get_value(self, resource, offset): status = True @@ -29,26 +29,6 @@ def pci_get_value(self, resource, offset): status = False return status, result - def run_command(self, cmd): - status = True - result = "" - try: - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - except Exception: - status = False - return status, result - - def run_interactive_command(self, cmd): - try: - os.system(cmd) - except Exception: - return False - return True - def read_txt_file(self, file_path): try: with open(file_path, 'r', errors='replace') as fd: @@ -66,52 +46,3 @@ def write_txt_file(self, file_path, value): return False return True - def ipmi_raw(self, netfn, cmd): - status = True - result = "" - try: - cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_fru_id(self, id, key=None): - status = True - result = "" - try: - cmd = "ipmitool fru print {}".format(str( - id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) - - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_set_ss_thres(self, id, threshold_key, value): - status = True - result = "" - try: - cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py index ec16e80568f..39813a87728 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py @@ -6,10 +6,9 @@ # ############################################################################# -import os import time import sys - +import subprocess from ctypes import create_string_buffer try: @@ -31,7 +30,7 @@ class Sfp(SfpOptoeBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + HOST_CHK_CMD = ["which", "systemctl"] PLATFORM = "x86_64-accton_as5835_54x-r0" HWSKU = "Accton-AS5835-54X" @@ -121,7 +120,7 @@ def __get_cpld_num(self, port_num): def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess(self.HOST_CHK_CMD).returncode == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/chassis.py index 86ae121c6c8..178f3c56265 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/chassis.py @@ -5,12 +5,7 @@ # ############################################################################# try: - import sys - import re - import os import subprocess - import json - import syslog from sonic_platform_base.chassis_base import ChassisBase from sonic_py_common.logger import Logger from sonic_platform.fan import Fan @@ -36,7 +31,7 @@ REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" COMPONENT_NAME_LIST = ["BIOS"] -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] class Chassis(ChassisBase): @@ -71,7 +66,7 @@ def __init__(self): logger.log_info("Chassis loaded successfully") def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: diff --git a/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/component.py index 15d8e9e15e9..5e1e800d52f 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/component.py @@ -3,10 +3,7 @@ # provides the components firmware management function ############################################################################# -import json import os.path -import shutil -import shlex import subprocess try: @@ -29,8 +26,7 @@ def __init__(self, component_name): def __run_command(self, command): # Run bash command and print output to stdout try: - process = subprocess.Popen( - shlex.split(command), universal_newlines=True, stdout=subprocess.PIPE) + process = subprocess.Popen(command, universal_newlines=True, stdout=subprocess.PIPE) while True: output = process.stdout.readline() if output == '' and process.poll() is not None: diff --git a/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/sfp.py index 6aabc144117..39c21c0d11c 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/sfp.py @@ -3,10 +3,8 @@ # provides the sfp device status which are available in the platform ############################################################################# try: - import os import time import subprocess - import syslog from ctypes import create_string_buffer from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom @@ -173,7 +171,7 @@ class Sfp(SfpBase): PLATFORM_ROOT_PATH = '/usr/share/sonic/device' PMON_HWSKU_PATH = '/usr/share/sonic/hwsku' - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-accton_as7116_54x-r0" HWSKU = "Accton-AS7116-54X-R0" @@ -233,7 +231,7 @@ def __read_txt_file(self, file_path): return "" def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/chassis.py index ceece0f9db8..a1143b11254 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/chassis.py @@ -6,7 +6,7 @@ # ############################################################################# -import os +import subprocess try: from sonic_platform_base.chassis_base import ChassisBase @@ -24,7 +24,7 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] class Chassis(ChassisBase): @@ -87,7 +87,7 @@ def __initialize_watchdog(self): def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: diff --git a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/component.py index 5300e1e7323..2ba405f9f8a 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/component.py @@ -6,8 +6,6 @@ # ############################################################################# -import shlex -import subprocess try: from sonic_platform_base.component_base import ComponentBase @@ -43,22 +41,6 @@ def __init__(self, component_index=0): self.index = component_index self.name = self.get_name() - def __run_command(self, command): - # Run bash command and print output to stdout - try: - process = subprocess.Popen( - shlex.split(command), stdout=subprocess.PIPE) - while True: - output = process.stdout.readline() - if output == '' and process.poll() is not None: - break - rc = process.poll() - if rc != 0: - return False - except Exception: - return False - return True - def __get_bios_version(self): # Retrieves the BIOS firmware version try: 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 4cd60ac9061..2c644ecbfb8 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 @@ -4,7 +4,7 @@ from mmap import * from sonic_py_common import device_info -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,7 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def pci_get_value(self, resource, offset): status = True @@ -29,26 +29,6 @@ def pci_get_value(self, resource, offset): status = False return status, result - def run_command(self, cmd): - status = True - result = "" - try: - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - except Exception: - status = False - return status, result - - def run_interactive_command(self, cmd): - try: - os.system(cmd) - except Exception: - return False - return True - def read_txt_file(self, file_path): try: with open(file_path, 'r') as fd: @@ -66,52 +46,3 @@ def write_txt_file(self, file_path, value): return False return True - def ipmi_raw(self, netfn, cmd): - status = True - result = "" - try: - cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_fru_id(self, id, key=None): - status = True - result = "" - try: - cmd = "ipmitool fru print {}".format(str( - id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) - - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_set_ss_thres(self, id, threshold_key, value): - status = True - result = "" - try: - cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result diff --git a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/sfp.py index 445b39edc73..fd6d0f8524f 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/sfp.py @@ -6,10 +6,9 @@ # ############################################################################# -import os import time import sys - +import subprocess from ctypes import create_string_buffer try: @@ -125,7 +124,7 @@ class Sfp(SfpBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-accton_as7312_54x-r0" HWSKU = "Accton-AS7312-54X" @@ -256,7 +255,7 @@ def __write_txt_file(self, file_path, value): return True def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py index f32f381b7c2..1c97d0e878a 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py @@ -6,8 +6,8 @@ # ############################################################################# -import os import sys +import subprocess try: from sonic_platform_base.chassis_base import ChassisBase @@ -27,7 +27,7 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +HOST_CHK_CMD = ["which", "systemctl"] SYSLED_FNODE= "/sys/class/leds/accton_as7326_56x_led::diag/brightness" SYSLED_MODES = { "0" : "STATUS_LED_COLOR_OFF", @@ -93,7 +93,7 @@ def __initialize_watchdog(self): self._watchdog = Watchdog() def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py index 95a54e554a0..16fe60bfb69 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py @@ -6,10 +6,9 @@ # ############################################################################# -import os import time import sys - +import subprocess from ctypes import create_string_buffer try: @@ -40,7 +39,7 @@ class Sfp(SfpOptoeBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + HOST_CHK_CMD = ["which", "systemctl"] PLATFORM = "x86_64-accton_as7326_56x-r0" HWSKU = "Accton-AS7326-56X" @@ -144,7 +143,7 @@ def __write_txt_file(self, file_path, value): return True def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py index 44a759045b6..164da5fd612 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py @@ -6,8 +6,8 @@ # ############################################################################# -import os import sys +import subprocess try: from sonic_platform_base.chassis_base import ChassisBase @@ -26,7 +26,7 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +HOST_CHK_CMD = ["which", "systemctl"] SYSLED_FNODE = "/sys/class/leds/as7816_64x_led::diag/brightness" SYSLED_MODES = { "0" : "STATUS_LED_COLOR_OFF", @@ -96,7 +96,7 @@ def __initialize_watchdog(self): def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py index 6af2f6008e7..d024e43e1f4 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py @@ -6,8 +6,6 @@ # ############################################################################# -import shlex -import subprocess try: from sonic_platform_base.component_base import ComponentBase @@ -43,22 +41,6 @@ def __init__(self, component_index=0): self.index = component_index self.name = self.get_name() - def __run_command(self, command): - # Run bash command and print output to stdout - try: - process = subprocess.Popen( - shlex.split(command), stdout=subprocess.PIPE) - while True: - output = process.stdout.readline() - if output == '' and process.poll() is not None: - break - rc = process.poll() - if rc != 0: - return False - except Exception: - return False - return True - def __get_bios_version(self): # Retrieves the BIOS firmware version try: 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 b124ca29f0d..b19fab85deb 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 @@ -4,7 +4,7 @@ from mmap import * from sonic_py_common import device_info -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,7 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def pci_get_value(self, resource, offset): status = True @@ -29,26 +29,6 @@ def pci_get_value(self, resource, offset): status = False return status, result - def run_command(self, cmd): - status = True - result = "" - try: - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - except Exception: - status = False - return status, result - - def run_interactive_command(self, cmd): - try: - os.system(cmd) - except Exception: - return False - return True - def read_txt_file(self, file_path): try: with open(file_path, 'r', errors='replace') as fd: @@ -66,52 +46,3 @@ def write_txt_file(self, file_path, value): return False return True - def ipmi_raw(self, netfn, cmd): - status = True - result = "" - try: - cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_fru_id(self, id, key=None): - status = True - result = "" - try: - cmd = "ipmitool fru print {}".format(str( - id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) - - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_set_ss_thres(self, id, threshold_key, value): - status = True - result = "" - try: - cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py index 01e568ef3e7..d8ff303b359 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py @@ -6,10 +6,9 @@ # ############################################################################# -import os import time import sys - +import subprocess from ctypes import create_string_buffer try: @@ -31,7 +30,7 @@ class Sfp(SfpOptoeBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + HOST_CHK_CMD = ["which", "systemctl"] PLATFORM = "x86_64-accton_as7816_64x-r0" HWSKU = "Accton-AS7816-64X" @@ -119,7 +118,7 @@ def get_eeprom_path(self): return self.port_to_eeprom_mapping[self.port_num] def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/chassis.py index 7eb9601d8b5..b0a573432b7 100644 --- a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/chassis.py @@ -6,7 +6,7 @@ # ############################################################################# -import os +import subprocess try: from sonic_platform_base.chassis_base import ChassisBase @@ -28,7 +28,7 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] class Chassis(ChassisBase): @@ -96,7 +96,7 @@ def __initialize_watchdog(self): def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/component.py index c34da704432..8137d0f3a79 100644 --- a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/component.py @@ -6,9 +6,6 @@ # ############################################################################# -import shlex -import subprocess - try: from sonic_platform_base.component_base import ComponentBase @@ -38,22 +35,6 @@ def __init__(self, component_index=0): self.index = component_index self.name = self.get_name() - def __run_command(self, command): - # Run bash command and print output to stdout - try: - process = subprocess.Popen( - shlex.split(command), stdout=subprocess.PIPE) - while True: - output = process.stdout.readline() - if output == '' and process.poll() is not None: - break - rc = process.poll() - if rc != 0: - return False - except Exception: - return False - return True - def __get_bios_version(self): # Retrieves the BIOS firmware version try: 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 4cd60ac9061..2c644ecbfb8 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 @@ -4,7 +4,7 @@ from mmap import * from sonic_py_common import device_info -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = ["docker"] EMPTY_STRING = "" @@ -14,7 +14,7 @@ def __init__(self): (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() def is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def pci_get_value(self, resource, offset): status = True @@ -29,26 +29,6 @@ def pci_get_value(self, resource, offset): status = False return status, result - def run_command(self, cmd): - status = True - result = "" - try: - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - except Exception: - status = False - return status, result - - def run_interactive_command(self, cmd): - try: - os.system(cmd) - except Exception: - return False - return True - def read_txt_file(self, file_path): try: with open(file_path, 'r') as fd: @@ -66,52 +46,3 @@ def write_txt_file(self, file_path, value): return False return True - def ipmi_raw(self, netfn, cmd): - status = True - result = "" - try: - cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_fru_id(self, id, key=None): - status = True - result = "" - try: - cmd = "ipmitool fru print {}".format(str( - id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) - - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result - - def ipmi_set_ss_thres(self, id, threshold_key, value): - status = True - result = "" - try: - cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) - p = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err = p.communicate() - if err == '': - result = raw_data.strip() - else: - status = False - except Exception: - status = False - return status, result diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py index 6cefc2a29a4..5d7c03d0055 100644 --- a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py @@ -6,11 +6,10 @@ # ############################################################################# -import os import sys import time import struct - +import subprocess from ctypes import create_string_buffer try: @@ -272,7 +271,7 @@ class Sfp(SfpBase): """Platform-specific Sfp class""" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-accton_as9726_32d-r0" HWSKU = "Accton-AS9726-32D" @@ -310,7 +309,7 @@ def __write_txt_file(self, file_path, value): return True def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/buffers_defaults_t0.j2 new file mode 100644 index 00000000000..d71cdcb265f --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/buffers_defaults_t0.j2 @@ -0,0 +1,52 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "32732160", + "type": "ingress", + "mode": "dynamic", + "xoff": "1622016" + }, + "egress_lossy_pool": { + "size": "24709632", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "32599040", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"32732160" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "static_th":"32599040" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1792", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{% import 'buffers_extra_queues.j2' as defs with context %} + +{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} +{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/buffers_defaults_t1.j2 new file mode 100644 index 00000000000..eb1dc510e91 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/buffers_defaults_t1.j2 @@ -0,0 +1,46 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "32712448", + "type": "ingress", + "mode": "dynamic", + "xoff": "1622016" + }, + "egress_lossy_pool": { + "size": "24709632", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "32599040", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"32712448" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "static_th":"32599040" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1792", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/pg_profile_lookup.ini new file mode 100644 index 00000000000..5b4482bc74c --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/pg_profile_lookup.ini @@ -0,0 +1,8 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 50000 5m 4608 4608 160000 0 4608 + 100000 5m 4608 4608 160000 0 4608 + 50000 40m 4608 4608 160000 0 4608 + 100000 40m 4608 4608 160000 0 4608 + 50000 300m 4608 4608 160000 0 4608 + 100000 300m 4608 4608 160000 0 4608 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/qos.json.j2 new file mode 100644 index 00000000000..040da33dd79 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/BALANCED/qos.json.j2 @@ -0,0 +1,206 @@ +{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + }, + "AZURE_TUNNEL": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "0", + "8": "0" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0", + "8": "0" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_queue_map() %} + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "3", + "4": "4", + "5": "5", + "6": "1", + "7": "7", + "8": "1" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7", + "8": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48", + "8": "33" + } + }, +{%- endmacro %} +{% endif %} +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/RDMA-CENTRIC b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/RDMA-CENTRIC new file mode 120000 index 00000000000..d6f7127aa74 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/RDMA-CENTRIC @@ -0,0 +1 @@ +BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/TCP-CENTRIC b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/TCP-CENTRIC new file mode 120000 index 00000000000..d6f7127aa74 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/TCP-CENTRIC @@ -0,0 +1 @@ +BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 deleted file mode 100644 index d71cdcb265f..00000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 +++ /dev/null @@ -1,52 +0,0 @@ -{%- set default_cable = '300m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "32732160", - "type": "ingress", - "mode": "dynamic", - "xoff": "1622016" - }, - "egress_lossy_pool": { - "size": "24709632", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "32599040", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "static_th":"32732160" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "static_th":"32599040" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1792", - "dynamic_th":"3" - } - }, -{%- endmacro %} - -{% import 'buffers_extra_queues.j2' as defs with context %} - -{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} -{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t0.j2 new file mode 120000 index 00000000000..9524e6a476a --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/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_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 deleted file mode 100644 index eb1dc510e91..00000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 +++ /dev/null @@ -1,46 +0,0 @@ -{%- set default_cable = '300m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "32712448", - "type": "ingress", - "mode": "dynamic", - "xoff": "1622016" - }, - "egress_lossy_pool": { - "size": "24709632", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "32599040", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "static_th":"32712448" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "static_th":"32599040" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1792", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 new file mode 120000 index 00000000000..c25cc95d6d5 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini deleted file mode 100644 index 5b4482bc74c..00000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini +++ /dev/null @@ -1,8 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 50000 5m 4608 4608 160000 0 4608 - 100000 5m 4608 4608 160000 0 4608 - 50000 40m 4608 4608 160000 0 4608 - 100000 40m 4608 4608 160000 0 4608 - 50000 300m 4608 4608 160000 0 4608 - 100000 300m 4608 4608 160000 0 4608 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/pg_profile_lookup.ini new file mode 120000 index 00000000000..297cddb2d22 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/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_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 index 5ea713ce7f4..aef6b6765cf 120000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 @@ -1 +1 @@ -../Arista-7050CX3-32S-D48C8/qos.json.j2 \ No newline at end of file +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/buffers_defaults_t0.j2 new file mode 100644 index 00000000000..57a7fb13146 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/buffers_defaults_t0.j2 @@ -0,0 +1,53 @@ + +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "32689152", + "type": "ingress", + "mode": "dynamic", + "xoff": "2058240" + }, + "egress_lossy_pool": { + "size": "24192256", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "32340992", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"32689152" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "static_th":"32340992" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1792", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{% import 'buffers_extra_queues.j2' as defs with context %} + +{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} +{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/pg_profile_lookup.ini new file mode 100644 index 00000000000..5b4482bc74c --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/pg_profile_lookup.ini @@ -0,0 +1,8 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 50000 5m 4608 4608 160000 0 4608 + 100000 5m 4608 4608 160000 0 4608 + 50000 40m 4608 4608 160000 0 4608 + 100000 40m 4608 4608 160000 0 4608 + 50000 300m 4608 4608 160000 0 4608 + 100000 300m 4608 4608 160000 0 4608 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/qos.json.j2 new file mode 100644 index 00000000000..040da33dd79 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/BALANCED/qos.json.j2 @@ -0,0 +1,206 @@ +{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + }, + "AZURE_TUNNEL": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "0", + "8": "0" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0", + "8": "0" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_queue_map() %} + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "3", + "4": "4", + "5": "5", + "6": "1", + "7": "7", + "8": "1" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7", + "8": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48", + "8": "33" + } + }, +{%- endmacro %} +{% endif %} +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/RDMA-CENTRIC b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/RDMA-CENTRIC new file mode 120000 index 00000000000..d6f7127aa74 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/RDMA-CENTRIC @@ -0,0 +1 @@ +BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/TCP-CENTRIC b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/TCP-CENTRIC new file mode 120000 index 00000000000..d6f7127aa74 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/TCP-CENTRIC @@ -0,0 +1 @@ +BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 deleted file mode 100644 index 57a7fb13146..00000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 +++ /dev/null @@ -1,53 +0,0 @@ - -{%- set default_cable = '300m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "32689152", - "type": "ingress", - "mode": "dynamic", - "xoff": "2058240" - }, - "egress_lossy_pool": { - "size": "24192256", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "32340992", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "static_th":"32689152" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "static_th":"32340992" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1792", - "dynamic_th":"3" - } - }, -{%- endmacro %} - -{% import 'buffers_extra_queues.j2' as defs with context %} - -{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} -{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/buffers_defaults_t0.j2 new file mode 120000 index 00000000000..9524e6a476a --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/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_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini deleted file mode 100644 index 5b4482bc74c..00000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini +++ /dev/null @@ -1,8 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 50000 5m 4608 4608 160000 0 4608 - 100000 5m 4608 4608 160000 0 4608 - 50000 40m 4608 4608 160000 0 4608 - 100000 40m 4608 4608 160000 0 4608 - 50000 300m 4608 4608 160000 0 4608 - 100000 300m 4608 4608 160000 0 4608 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/pg_profile_lookup.ini new file mode 120000 index 00000000000..297cddb2d22 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/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_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 deleted file mode 100644 index 040da33dd79..00000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 +++ /dev/null @@ -1,206 +0,0 @@ -{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} -{%- macro generate_dscp_to_tc_map() %} - "DSCP_TO_TC_MAP": { - "AZURE": { - "0" : "1", - "1" : "1", - "2" : "1", - "3" : "3", - "4" : "4", - "5" : "1", - "6" : "1", - "7" : "1", - "8" : "0", - "9" : "1", - "10": "1", - "11": "1", - "12": "1", - "13": "1", - "14": "1", - "15": "1", - "16": "1", - "17": "1", - "18": "1", - "19": "1", - "20": "1", - "21": "1", - "22": "1", - "23": "1", - "24": "1", - "25": "1", - "26": "1", - "27": "1", - "28": "1", - "29": "1", - "30": "1", - "31": "1", - "32": "1", - "33": "8", - "34": "1", - "35": "1", - "36": "1", - "37": "1", - "38": "1", - "39": "1", - "40": "1", - "41": "1", - "42": "1", - "43": "1", - "44": "1", - "45": "1", - "46": "5", - "47": "1", - "48": "7", - "49": "1", - "50": "1", - "51": "1", - "52": "1", - "53": "1", - "54": "1", - "55": "1", - "56": "1", - "57": "1", - "58": "1", - "59": "1", - "60": "1", - "61": "1", - "62": "1", - "63": "1" - }, - "AZURE_TUNNEL": { - "0" : "1", - "1" : "1", - "2" : "1", - "3" : "3", - "4" : "4", - "5" : "1", - "6" : "1", - "7" : "1", - "8" : "0", - "9" : "1", - "10": "1", - "11": "1", - "12": "1", - "13": "1", - "14": "1", - "15": "1", - "16": "1", - "17": "1", - "18": "1", - "19": "1", - "20": "1", - "21": "1", - "22": "1", - "23": "1", - "24": "1", - "25": "1", - "26": "1", - "27": "1", - "28": "1", - "29": "1", - "30": "1", - "31": "1", - "32": "1", - "33": "8", - "34": "1", - "35": "1", - "36": "1", - "37": "1", - "38": "1", - "39": "1", - "40": "1", - "41": "1", - "42": "1", - "43": "1", - "44": "1", - "45": "1", - "46": "5", - "47": "1", - "48": "7", - "49": "1", - "50": "1", - "51": "1", - "52": "1", - "53": "1", - "54": "1", - "55": "1", - "56": "1", - "57": "1", - "58": "1", - "59": "1", - "60": "1", - "61": "1", - "62": "1", - "63": "1" - } - }, -{%- endmacro %} -{%- macro generate_tc_to_pg_map() %} - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "0", - "2": "2", - "3": "3", - "4": "4", - "5": "0", - "6": "6", - "7": "0", - "8": "0" - }, - "AZURE_TUNNEL": { - "0": "0", - "1": "0", - "2": "0", - "3": "2", - "4": "6", - "5": "0", - "6": "0", - "7": "0", - "8": "0" - } - }, -{%- endmacro %} -{%- macro generate_tc_to_queue_map() %} - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "1", - "3": "3", - "4": "4", - "5": "5", - "6": "1", - "7": "7", - "8": "1" - }, - "AZURE_TUNNEL": { - "0": "0", - "1": "1", - "2": "1", - "3": "2", - "4": "6", - "5": "5", - "6": "1", - "7": "7", - "8": "1" - } - }, -{%- endmacro %} -{%- macro generate_tc_to_dscp_map() %} - "TC_TO_DSCP_MAP": { - "AZURE_TUNNEL": { - "0": "8", - "1": "0", - "2": "0", - "3": "2", - "4": "6", - "5": "46", - "6": "0", - "7": "48", - "8": "33" - } - }, -{%- endmacro %} -{% endif %} -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 new file mode 120000 index 00000000000..aef6b6765cf --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/platform.json b/device/arista/x86_64-arista_7050cx3_32s/platform.json index 6a417e320e6..274f44615fb 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/platform.json +++ b/device/arista/x86_64-arista_7050cx3_32s/platform.json @@ -1,7 +1,23 @@ { "chassis": { "name": "DCS-7050CX3-32S", - "components": [], + "components": [ + { + "name": "Aboot()" + }, + { + "name": "Scd(addr=0000:02:00.0)" + }, + { + "name": "Ucd90120A(addr=3-004e)" + }, + { + "name": "Ucd90120A(addr=16-004e)" + }, + { + "name": "CrowSysCpld(addr=2-0023)" + } + ], "fans": [], "fan_drawers": [ { @@ -40,46 +56,47 @@ "psus": [ { "name": "psu1", - "fans": [] + "fans": [ + { + "name": "psu1/1", + "speed": { + "controllable": false + } + } + ] }, { "name": "psu2", - "fans": [] + "fans": [ + { + "name": "psu2/1", + "speed": { + "controllable": false + } + } + ] } ], "thermals": [ { - "name": "Cpu temp sensor" - }, - { - "name": "Cpu board temp sensor" - }, - { - "name": "Back-panel temp sensor" - }, - { - "name": "Board temp sensor" - }, - { - "name": "Front-panel temp sensor" - }, - { - "name": "Power supply 1 hotspot sensor" - }, - { - "name": "Power supply 1 inlet temp sensor" + "name": "Cpu temp sensor", + "controllable": false }, { - "name": "Power supply 1 exhaust temp sensor" + "name": "Cpu board temp sensor", + "controllable": false }, { - "name": "Power supply 2 hotspot sensor" + "name": "Back-panel temp sensor", + "controllable": false }, { - "name": "Power supply 2 inlet temp sensor" + "name": "Board temp sensor", + "controllable": false }, { - "name": "Power supply 2 exhaust temp sensor" + "name": "Front-panel temp sensor", + "controllable": false } ], "sfps": [ @@ -815,4 +832,4 @@ } } } -} \ No newline at end of file +} diff --git a/device/arista/x86_64-arista_7050cx3_32s/platform_components.json b/device/arista/x86_64-arista_7050cx3_32s/platform_components.json new file mode 100644 index 00000000000..0d30d1b13e1 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/platform_components.json @@ -0,0 +1,13 @@ +{ + "chassis": { + "DCS-7050CX3-32S": { + "component": { + "Aboot()": {}, + "Scd(addr=0000:00:18.7)": {}, + "Ucd90120A(addr=3-004e)": {}, + "Ucd90120A(addr=16-004e)": {}, + "CrowSysCpld(addr=2-0023)": {} + } + } + } +} diff --git a/device/arista/x86_64-arista_720dt_48s/platform.json b/device/arista/x86_64-arista_720dt_48s/platform.json index ce405b82f95..c560f8d739f 100644 --- a/device/arista/x86_64-arista_720dt_48s/platform.json +++ b/device/arista/x86_64-arista_720dt_48s/platform.json @@ -1,7 +1,14 @@ { "chassis": { "name": "CCS-720DT-48S", - "components": [], + "components": [ + { + "name": "Aboot()" + }, + { + "name": "Scd(addr=0000:00:18.7)" + } + ], "fan_drawers": [ { "name": "fixed1", diff --git a/device/arista/x86_64-arista_720dt_48s/platform_components.json b/device/arista/x86_64-arista_720dt_48s/platform_components.json new file mode 100644 index 00000000000..ea8bbb5e334 --- /dev/null +++ b/device/arista/x86_64-arista_720dt_48s/platform_components.json @@ -0,0 +1,10 @@ +{ + "chassis": { + "CCS-720DT-48S": { + "component": { + "Aboot()": {}, + "Scd(addr=0000:00:18.7)": {} + } + } + } +} diff --git a/device/arista/x86_64-arista_7800_sup/platform.json b/device/arista/x86_64-arista_7800_sup/platform.json index 3afdaa3eb88..958c57ac498 100644 --- a/device/arista/x86_64-arista_7800_sup/platform.json +++ b/device/arista/x86_64-arista_7800_sup/platform.json @@ -1,6 +1,6 @@ { "chassis": { - "name": "DCS-7800A-SUP1A", + "name": "DCS-7800-SUP1A", "components": [], "fans": [], "fan_drawers": [], diff --git a/device/arista/x86_64-arista_7800_sup/platform_env.conf b/device/arista/x86_64-arista_7800_sup/platform_env.conf index 89102035fc4..c7bd98f7c01 100644 --- a/device/arista/x86_64-arista_7800_sup/platform_env.conf +++ b/device/arista/x86_64-arista_7800_sup/platform_env.conf @@ -1,2 +1,3 @@ usemsi=1 dmasize=512M +supervisor=1 diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/jr2-a7280cr3-32d4-40x100G.config.bcm index f20ea81049f..3db7f3a5147 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 @@ -793,3 +793,4 @@ dma_desc_aggregator_buff_size_kb.BCM8869X=100 dma_desc_aggregator_timeout_usec.BCM8869X=1000 dma_desc_aggregator_enable_specific_MDB_LPM.BCM8869X=1 dma_desc_aggregator_enable_specific_MDB_FEC.BCM8869X=1 +sai_pfc_dlr_init_capability=0 diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json deleted file mode 120000 index 2b84d998cf2..00000000000 --- a/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json +++ /dev/null @@ -1 +0,0 @@ -../x86_64-arista_7800r3_48cq2_lc/platform.json \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json new file mode 100644 index 00000000000..18798cabb33 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json @@ -0,0 +1,173 @@ +{ + "chassis": { + "name": "7800R3-48CQM2-LC", + "components": [], + "fans": [], + "fan_drawers": [], + "psus": [], + "thermals": [ + { + "name": "Cpu temp sensor" + }, + { + "name": "Center back" + }, + { + "name": "Fap0 core0" + }, + { + "name": "Fap0 core1" + }, + { + "name": "PCIE" + } + ], + "sfps": [ + { + "name": "qsfp1" + }, + { + "name": "qsfp2" + }, + { + "name": "qsfp3" + }, + { + "name": "qsfp4" + }, + { + "name": "qsfp5" + }, + { + "name": "qsfp6" + }, + { + "name": "qsfp7" + }, + { + "name": "qsfp8" + }, + { + "name": "qsfp9" + }, + { + "name": "qsfp10" + }, + { + "name": "qsfp11" + }, + { + "name": "qsfp12" + }, + { + "name": "qsfp13" + }, + { + "name": "qsfp14" + }, + { + "name": "qsfp15" + }, + { + "name": "qsfp16" + }, + { + "name": "qsfp17" + }, + { + "name": "qsfp18" + }, + { + "name": "qsfp19" + }, + { + "name": "qsfp20" + }, + { + "name": "qsfp21" + }, + { + "name": "qsfp22" + }, + { + "name": "qsfp23" + }, + { + "name": "qsfp24" + }, + { + "name": "qsfp25" + }, + { + "name": "qsfp26" + }, + { + "name": "qsfp27" + }, + { + "name": "qsfp28" + }, + { + "name": "qsfp29" + }, + { + "name": "qsfp30" + }, + { + "name": "qsfp31" + }, + { + "name": "qsfp32" + }, + { + "name": "qsfp33" + }, + { + "name": "qsfp34" + }, + { + "name": "qsfp35" + }, + { + "name": "qsfp36" + }, + { + "name": "qsfp37" + }, + { + "name": "qsfp38" + }, + { + "name": "qsfp39" + }, + { + "name": "qsfp40" + }, + { + "name": "qsfp41" + }, + { + "name": "qsfp42" + }, + { + "name": "qsfp43" + }, + { + "name": "qsfp44" + }, + { + "name": "qsfp45" + }, + { + "name": "qsfp46" + }, + { + "name": "qsfp47" + }, + { + "name": "qsfp48" + } + ] + }, + "interfaces": {} +} diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D-C36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D-C36 new file mode 120000 index 00000000000..41ebc98e1c4 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D-C36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-C36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D-D36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D-D36 new file mode 120000 index 00000000000..e029ef37b78 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D-D36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-D36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/context_config.json b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/context_config.json new file mode 100644 index 00000000000..2c126e71899 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/context_config.json @@ -0,0 +1,25 @@ +{ + "CONTEXTS": [ + { + "guid" : 0, + "name" : "syncd", + "dbAsic" : "ASIC_DB", + "dbCounters" : "COUNTERS_DB", + "dbFlex": "FLEX_COUNTER_DB", + "dbState" : "STATE_DB", + "zmq_enable": false, + "zmq_endpoint": "tcp://127.0.0.1:5555", + "zmq_ntf_endpoint": "tcp://127.0.0.1:5556", + "switches": [ + { + "index" : 0, + "hwinfo" : "06:00.0" + }, + { + "index" : 1, + "hwinfo" : "07:00.0" + } + ] + } + ] +} 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 new file mode 100644 index 00000000000..9be5d8e836f --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -0,0 +1,985 @@ +soc_family=BCM8885X +system_ref_core_clock_khz=1600000 + +dpp_db_path=/usr/share/bcm/db + +#################################################### +##Reference applications related properties - Start +#################################################### + +## PMF small EXEM connected stage: +# Options: IPMF2 - Ingress PMF 2 stage can perform small EXEM lookups. +# IPMF3 - Ingress PMF 3 stage can perform small EXEM lookups. +## PMF small EXEM connected stage: +# Options: IPMF2 - Ingress PMF 2 stage can perform small EXEM lookups. +# IPMF3 - Ingress PMF 3 stage can perform small EXEM lookups. +pmf_sexem3_stage=IPMF2 + +#################################################### +##Reference applications related properties - End +#################################################### + +# Jericho2-mode (description 0x1 used for Jericho 2 mode) +system_headers_mode=1 + +# HW mode to support 1024 16-member system wide LAGs +trunk_group_max_members=16 + +# Disable link-training +port_init_cl72=0 + +###Default interfaces for Jericho2Plus +#CPU interfaces +ucode_port_0=CPU.0:core_0.0 +ucode_port_200=CPU.8:core_1.200 +ucode_port_201=CPU.16:core_0.201 +ucode_port_202=CPU.24:core_1.202 +ucode_port_203=CPU.32:core_0.203 + +#NIF ETH interfaces on device +ucode_port_1=CGE18:core_1.1 +ucode_port_2=CGE20:core_1.2 +ucode_port_3=CGE22:core_1.3 +ucode_port_4=CGE24:core_1.4 +ucode_port_5=CGE26:core_1.5 +ucode_port_6=CGE28:core_1.6 +ucode_port_7=CGE30:core_1.7 +ucode_port_8=CGE32:core_1.8 +ucode_port_9=CGE34:core_1.9 + +ucode_port_10=CGE16:core_0.10 +ucode_port_11=CGE14:core_0.11 +ucode_port_12=CGE12:core_0.12 +ucode_port_13=CGE10:core_0.13 +ucode_port_14=CGE8:core_0.14 +ucode_port_15=CGE6:core_0.15 +ucode_port_16=CGE4:core_0.16 +ucode_port_17=CGE2:core_0.17 +ucode_port_18=CGE0:core_0.18 + +#NIF default speeds +port_init_speed_xe=10000 +port_init_speed_xl=40000 +port_init_speed_le=50000 +port_init_speed_ce=100000 +port_init_speed_cc=200000 +port_init_speed_cd=400000 +port_init_speed_il=10312 + +port_priorities=8 + +#special ports +ucode_port_240=OLP:core_0.240 + +# NIF lane mapping +lane_to_serdes_map_nif_lane0=rx3:tx4 +lane_to_serdes_map_nif_lane1=rx6:tx1 +lane_to_serdes_map_nif_lane2=rx7:tx5 +lane_to_serdes_map_nif_lane3=rx4:tx7 +lane_to_serdes_map_nif_lane4=rx1:tx2 +lane_to_serdes_map_nif_lane5=rx0:tx0 +lane_to_serdes_map_nif_lane6=rx5:tx3 +lane_to_serdes_map_nif_lane7=rx2:tx6 +lane_to_serdes_map_nif_lane8=rx10:tx11 +lane_to_serdes_map_nif_lane9=rx8:tx8 +lane_to_serdes_map_nif_lane10=rx14:tx12 +lane_to_serdes_map_nif_lane11=rx15:tx15 +lane_to_serdes_map_nif_lane12=rx13:tx10 +lane_to_serdes_map_nif_lane13=rx9:tx9 +lane_to_serdes_map_nif_lane14=rx11:tx13 +lane_to_serdes_map_nif_lane15=rx12:tx14 +lane_to_serdes_map_nif_lane16=rx16:tx17 +lane_to_serdes_map_nif_lane17=rx19:tx21 +lane_to_serdes_map_nif_lane18=rx21:tx18 +lane_to_serdes_map_nif_lane19=rx18:tx16 +lane_to_serdes_map_nif_lane20=rx17:tx23 +lane_to_serdes_map_nif_lane21=rx20:tx22 +lane_to_serdes_map_nif_lane22=rx22:tx20 +lane_to_serdes_map_nif_lane23=rx23:tx19 +lane_to_serdes_map_nif_lane24=rx26:tx28 +lane_to_serdes_map_nif_lane25=rx29:tx31 +lane_to_serdes_map_nif_lane26=rx31:tx29 +lane_to_serdes_map_nif_lane27=rx28:tx27 +lane_to_serdes_map_nif_lane28=rx25:tx25 +lane_to_serdes_map_nif_lane29=rx24:tx30 +lane_to_serdes_map_nif_lane30=rx30:tx24 +lane_to_serdes_map_nif_lane31=rx27:tx26 +lane_to_serdes_map_nif_lane32=rx32:tx39 +lane_to_serdes_map_nif_lane33=rx33:tx38 +lane_to_serdes_map_nif_lane34=rx38:tx32 +lane_to_serdes_map_nif_lane35=rx39:tx33 +lane_to_serdes_map_nif_lane36=rx35:tx37 +lane_to_serdes_map_nif_lane37=rx34:tx36 +lane_to_serdes_map_nif_lane38=rx36:tx34 +lane_to_serdes_map_nif_lane39=rx37:tx35 +lane_to_serdes_map_nif_lane40=rx40:tx41 +lane_to_serdes_map_nif_lane41=rx43:tx45 +lane_to_serdes_map_nif_lane42=rx45:tx42 +lane_to_serdes_map_nif_lane43=rx42:tx40 +lane_to_serdes_map_nif_lane44=rx41:tx47 +lane_to_serdes_map_nif_lane45=rx44:tx46 +lane_to_serdes_map_nif_lane46=rx46:tx44 +lane_to_serdes_map_nif_lane47=rx47:tx43 +lane_to_serdes_map_nif_lane48=rx50:tx52 +lane_to_serdes_map_nif_lane49=rx53:tx55 +lane_to_serdes_map_nif_lane50=rx55:tx53 +lane_to_serdes_map_nif_lane51=rx52:tx51 +lane_to_serdes_map_nif_lane52=rx49:tx49 +lane_to_serdes_map_nif_lane53=rx48:tx54 +lane_to_serdes_map_nif_lane54=rx54:tx48 +lane_to_serdes_map_nif_lane55=rx51:tx50 +lane_to_serdes_map_nif_lane56=rx56:tx63 +lane_to_serdes_map_nif_lane57=rx57:tx62 +lane_to_serdes_map_nif_lane58=rx62:tx56 +lane_to_serdes_map_nif_lane59=rx63:tx57 +lane_to_serdes_map_nif_lane60=rx59:tx61 +lane_to_serdes_map_nif_lane61=rx58:tx60 +lane_to_serdes_map_nif_lane62=rx60:tx58 +lane_to_serdes_map_nif_lane63=rx61:tx59 +lane_to_serdes_map_nif_lane64=rx64:tx65 +lane_to_serdes_map_nif_lane65=rx67:tx69 +lane_to_serdes_map_nif_lane66=rx69:tx66 +lane_to_serdes_map_nif_lane67=rx66:tx64 +lane_to_serdes_map_nif_lane68=rx65:tx71 +lane_to_serdes_map_nif_lane69=rx68:tx70 +lane_to_serdes_map_nif_lane70=rx70:tx68 +lane_to_serdes_map_nif_lane71=rx71:tx67 +lane_to_serdes_map_nif_lane72=rx79:tx74 +lane_to_serdes_map_nif_lane73=rx76:tx75 +lane_to_serdes_map_nif_lane74=rx72:tx76 +lane_to_serdes_map_nif_lane75=rx74:tx73 +lane_to_serdes_map_nif_lane76=rx77:tx79 +lane_to_serdes_map_nif_lane77=rx78:tx78 +lane_to_serdes_map_nif_lane78=rx73:tx77 +lane_to_serdes_map_nif_lane79=rx75:tx72 +lane_to_serdes_map_nif_lane80=rx86:tx86 +lane_to_serdes_map_nif_lane81=rx83:tx87 +lane_to_serdes_map_nif_lane82=rx82:tx81 +lane_to_serdes_map_nif_lane83=rx85:tx80 +lane_to_serdes_map_nif_lane84=rx87:tx85 +lane_to_serdes_map_nif_lane85=rx84:tx84 +lane_to_serdes_map_nif_lane86=rx80:tx82 +lane_to_serdes_map_nif_lane87=rx81:tx83 +lane_to_serdes_map_nif_lane88=rx95:tx90 +lane_to_serdes_map_nif_lane89=rx92:tx88 +lane_to_serdes_map_nif_lane90=rx88:tx92 +lane_to_serdes_map_nif_lane91=rx91:tx95 +lane_to_serdes_map_nif_lane92=rx94:tx89 +lane_to_serdes_map_nif_lane93=rx93:tx91 +lane_to_serdes_map_nif_lane94=rx89:tx93 +lane_to_serdes_map_nif_lane95=rx90:tx94 +lane_to_serdes_map_nif_lane96=rx103:tx97 +lane_to_serdes_map_nif_lane97=rx100:tx96 +lane_to_serdes_map_nif_lane98=rx96:tx100 +lane_to_serdes_map_nif_lane99=rx99:tx103 +lane_to_serdes_map_nif_lane100=rx102:tx99 +lane_to_serdes_map_nif_lane101=rx101:tx98 +lane_to_serdes_map_nif_lane102=rx97:tx101 +lane_to_serdes_map_nif_lane103=rx98:tx102 +lane_to_serdes_map_nif_lane104=rx110:tx107 +lane_to_serdes_map_nif_lane105=rx108:tx105 +lane_to_serdes_map_nif_lane106=rx104:tx108 +lane_to_serdes_map_nif_lane107=rx107:tx110 +lane_to_serdes_map_nif_lane108=rx111:tx106 +lane_to_serdes_map_nif_lane109=rx109:tx104 +lane_to_serdes_map_nif_lane110=rx105:tx109 +lane_to_serdes_map_nif_lane111=rx106:tx111 +lane_to_serdes_map_nif_lane112=rx119:tx114 +lane_to_serdes_map_nif_lane113=rx116:tx112 +lane_to_serdes_map_nif_lane114=rx112:tx116 +lane_to_serdes_map_nif_lane115=rx115:tx119 +lane_to_serdes_map_nif_lane116=rx118:tx113 +lane_to_serdes_map_nif_lane117=rx117:tx115 +lane_to_serdes_map_nif_lane118=rx113:tx117 +lane_to_serdes_map_nif_lane119=rx114:tx118 +lane_to_serdes_map_nif_lane120=rx127:tx121 +lane_to_serdes_map_nif_lane121=rx124:tx120 +lane_to_serdes_map_nif_lane122=rx120:tx124 +lane_to_serdes_map_nif_lane123=rx123:tx127 +lane_to_serdes_map_nif_lane124=rx126:tx123 +lane_to_serdes_map_nif_lane125=rx125:tx122 +lane_to_serdes_map_nif_lane126=rx121:tx125 +lane_to_serdes_map_nif_lane127=rx122:tx126 +lane_to_serdes_map_nif_lane128=rx134:tx131 +lane_to_serdes_map_nif_lane129=rx132:tx129 +lane_to_serdes_map_nif_lane130=rx128:tx132 +lane_to_serdes_map_nif_lane131=rx131:tx134 +lane_to_serdes_map_nif_lane132=rx135:tx130 +lane_to_serdes_map_nif_lane133=rx133:tx128 +lane_to_serdes_map_nif_lane134=rx129:tx133 +lane_to_serdes_map_nif_lane135=rx130:tx135 +lane_to_serdes_map_nif_lane136=rx143:tx138 +lane_to_serdes_map_nif_lane137=rx140:tx136 +lane_to_serdes_map_nif_lane138=rx136:tx140 +lane_to_serdes_map_nif_lane139=rx139:tx143 +lane_to_serdes_map_nif_lane140=rx142:tx137 +lane_to_serdes_map_nif_lane141=rx141:tx139 +lane_to_serdes_map_nif_lane142=rx137:tx141 +lane_to_serdes_map_nif_lane143=rx138:tx142 + +######################### +### High Availability ### +######################### + +sw_state_max_size=750000000 + +#location of warmboot NV memory +#Allowed options for dnx are - 3:external storage in filesystem 4:driver will save the state directly in shared memory +stable_location=4 + +# Note that each unit should have a unique filename and that adapter does not play well with tmp and dev/shm folders. +stable_filename=/dev/shm/warmboot_data_0 +stable_filename.1=/dev/shm/warmboot_data_1 +stable_filename.2=/dev/shm/warmboot_data_2 + +#Maximum size for NVM used for WB storage, must be larger than sw_state_max_size.BCM8885X +stable_size=800000000 + +######################### +######################### +######################### + +tm_port_header_type_in_0=INJECTED_2_PP +tm_port_header_type_out_0=CPU + +tm_port_header_type_in_200=INJECTED_2_PP +tm_port_header_type_out_200=ETH +tm_port_header_type_in_201=INJECTED_2_PP +tm_port_header_type_out_201=ETH +tm_port_header_type_in_202=INJECTED_2_PP +tm_port_header_type_out_202=ETH +tm_port_header_type_in_203=INJECTED_2_PP +tm_port_header_type_out_203=ETH + +### SAT +## Enable SAT Interface. 0 - Disable, 1 - Enable (Default) +sat_enable=1 +ucode_port_218=SAT:core_0.218 +tm_port_header_type_out_218=CPU +tm_port_header_type_in_218=INJECTED_2 +ucode_port_219=SAT:core_1.219 +tm_port_header_type_out_219=CPU +tm_port_header_type_in_219=INJECTED_2 +port_init_speed_sat=400000 + +### RCY +sai_recycle_port_lane_base=0 +ucode_port_221=RCY.21:core_0.221 +ucode_port_222=RCY.22:core_1.222 +tm_port_header_type_out_221=ETH +tm_port_header_type_in_221=ETH +tm_port_header_type_out_222=ETH +tm_port_header_type_in_222=ETH +port_init_speed_221=400000 +port_init_speed_222=400000 + +#OLP port +tm_port_header_type_in_240=INJECTED_2 +tm_port_header_type_out_240=RAW + +# Set statically the region mode per region id +dtm_flow_mapping_mode_region_257=3 +dtm_flow_mapping_mode_region_258=3 +dtm_flow_mapping_mode_region_259=3 +dtm_flow_mapping_mode_region_260=3 +dtm_flow_mapping_mode_region_261=3 +dtm_flow_mapping_mode_region_262=3 +dtm_flow_mapping_mode_region_263=3 +dtm_flow_mapping_mode_region_264=3 +dtm_flow_mapping_mode_region_265=3 +dtm_flow_mapping_mode_region_266=7 +dtm_flow_mapping_mode_region_267=3 +dtm_flow_mapping_mode_region_268=3 +dtm_flow_mapping_mode_region_269=3 +dtm_flow_mapping_mode_region_270=3 +dtm_flow_mapping_mode_region_271=3 +dtm_flow_mapping_mode_region_272=3 +dtm_flow_mapping_mode_region_273=3 +dtm_flow_mapping_mode_region_274=3 +dtm_flow_mapping_mode_region_275=3 +dtm_flow_mapping_mode_region_276=3 +dtm_flow_mapping_mode_region_277=3 +dtm_flow_mapping_mode_region_278=3 +dtm_flow_mapping_mode_region_279=3 +dtm_flow_mapping_mode_region_280=3 +dtm_flow_mapping_mode_region_281=3 +dtm_flow_mapping_mode_region_282=3 +dtm_flow_mapping_mode_region_283=3 +dtm_flow_mapping_mode_region_284=3 +dtm_flow_mapping_mode_region_285=3 +dtm_flow_mapping_mode_region_286=3 +dtm_flow_mapping_mode_region_287=3 + +## Configure number of symmetric cores each region supports ## +dtm_flow_nof_remote_cores_region_1=2 +dtm_flow_nof_remote_cores_region_2=2 +dtm_flow_nof_remote_cores_region_3=2 +dtm_flow_nof_remote_cores_region_4=2 +dtm_flow_nof_remote_cores_region_5=2 +dtm_flow_nof_remote_cores_region_6=2 +dtm_flow_nof_remote_cores_region_7=2 +dtm_flow_nof_remote_cores_region_8=2 +dtm_flow_nof_remote_cores_region_9=2 +dtm_flow_nof_remote_cores_region_10=2 +dtm_flow_nof_remote_cores_region_11=2 +dtm_flow_nof_remote_cores_region_12=2 +dtm_flow_nof_remote_cores_region_13=2 +dtm_flow_nof_remote_cores_region_14=2 +dtm_flow_nof_remote_cores_region_15=2 +dtm_flow_nof_remote_cores_region_16=2 +dtm_flow_nof_remote_cores_region_17=2 +dtm_flow_nof_remote_cores_region_18=2 +dtm_flow_nof_remote_cores_region_19=2 +dtm_flow_nof_remote_cores_region_20=2 +dtm_flow_nof_remote_cores_region_21=2 +dtm_flow_nof_remote_cores_region_22=2 +dtm_flow_nof_remote_cores_region_23=2 +dtm_flow_nof_remote_cores_region_24=2 +dtm_flow_nof_remote_cores_region_25=2 +dtm_flow_nof_remote_cores_region_26=2 +dtm_flow_nof_remote_cores_region_27=2 +dtm_flow_nof_remote_cores_region_28=2 +dtm_flow_nof_remote_cores_region_29=2 +dtm_flow_nof_remote_cores_region_30=2 +dtm_flow_nof_remote_cores_region_31=2 +dtm_flow_nof_remote_cores_region_32=2 +dtm_flow_nof_remote_cores_region_33=2 +dtm_flow_nof_remote_cores_region_34=2 +dtm_flow_nof_remote_cores_region_35=2 +dtm_flow_nof_remote_cores_region_36=2 +dtm_flow_nof_remote_cores_region_37=2 +dtm_flow_nof_remote_cores_region_38=2 +dtm_flow_nof_remote_cores_region_39=2 +dtm_flow_nof_remote_cores_region_40=2 +dtm_flow_nof_remote_cores_region_41=2 +dtm_flow_nof_remote_cores_region_42=2 +dtm_flow_nof_remote_cores_region_43=2 +dtm_flow_nof_remote_cores_region_44=2 +dtm_flow_nof_remote_cores_region_45=2 +dtm_flow_nof_remote_cores_region_46=2 +dtm_flow_nof_remote_cores_region_47=2 +dtm_flow_nof_remote_cores_region_48=2 +dtm_flow_nof_remote_cores_region_49=2 +dtm_flow_nof_remote_cores_region_50=2 +dtm_flow_nof_remote_cores_region_51=2 +dtm_flow_nof_remote_cores_region_52=2 +dtm_flow_nof_remote_cores_region_53=2 +dtm_flow_nof_remote_cores_region_54=2 +dtm_flow_nof_remote_cores_region_55=2 +dtm_flow_nof_remote_cores_region_56=2 +dtm_flow_nof_remote_cores_region_57=2 +dtm_flow_nof_remote_cores_region_58=2 +dtm_flow_nof_remote_cores_region_59=2 +dtm_flow_nof_remote_cores_region_60=2 + +### MDB configuration ### +mdb_profile=balanced-exem + +### Descriptor-DMA configuration ### +dma_desc_aggregator_chain_length_max=1000 +dma_desc_aggregator_buff_size_kb=100 +dma_desc_aggregator_timeout_usec=1000 +dma_desc_aggregator_enable_specific_MDB_LPM=1 +dma_desc_aggregator_enable_specific_MDB_FEC=1 + +### Outlif configuarion ### +outlif_logical_to_physical_phase_map_1=S1 +outlif_logical_to_physical_phase_map_2=L1 +outlif_logical_to_physical_phase_map_3=XL +outlif_logical_to_physical_phase_map_4=L2 +outlif_logical_to_physical_phase_map_5=M1 +outlif_logical_to_physical_phase_map_6=M2 +outlif_logical_to_physical_phase_map_7=M3 +outlif_logical_to_physical_phase_map_8=S2 + +### Outlif data granularity configuration ### +outlif_physical_phase_data_granularity_S1=60 +outlif_physical_phase_data_granularity_S2=60 +outlif_physical_phase_data_granularity_M1=60 +outlif_physical_phase_data_granularity_M2=60 +outlif_physical_phase_data_granularity_M3=60 +outlif_physical_phase_data_granularity_L1=60 +outlif_physical_phase_data_granularity_L2=60 +outlif_physical_phase_data_granularity_XL=60 + +### Fabric configuration ### +# Enable link-training +port_init_cl72_sfi=1 +serdes_lane_config_cl72_auto_polarity_en=0 +serdes_lane_config_cl72_auto_polarity_en_sfi=1 +serdes_lane_config_cl72_restart_timeout_en=0 + +#SFI speed rate +port_init_speed_fabric=53125 + +## Fabric transmission mode +# Set the Connect mode to the Fabric +# Options: FE - presence of a Fabric device (single stage) +# SINGLE_FAP - stand-alone device +# MESH - devices in Mesh +# Note: If 'diag_chassis' is on, value will be override in dnx.soc +# to be FE instead of SINGLE_FAP. +fabric_connect_mode=FE + +fabric_logical_port_base=512 + +# Fabric lane mapping +lane_to_serdes_map_fabric_lane0=rx0:tx0 +lane_to_serdes_map_fabric_lane1=rx1:tx1 +lane_to_serdes_map_fabric_lane2=rx2:tx2 +lane_to_serdes_map_fabric_lane3=rx3:tx3 +lane_to_serdes_map_fabric_lane4=rx4:tx4 +lane_to_serdes_map_fabric_lane5=rx5:tx5 +lane_to_serdes_map_fabric_lane6=rx6:tx6 +lane_to_serdes_map_fabric_lane7=rx7:tx7 +lane_to_serdes_map_fabric_lane8=rx8:tx10 +lane_to_serdes_map_fabric_lane9=rx9:tx11 +lane_to_serdes_map_fabric_lane10=rx10:tx9 +lane_to_serdes_map_fabric_lane11=rx11:tx8 +lane_to_serdes_map_fabric_lane12=rx12:tx12 +lane_to_serdes_map_fabric_lane13=rx13:tx15 +lane_to_serdes_map_fabric_lane14=rx14:tx14 +lane_to_serdes_map_fabric_lane15=rx15:tx13 +lane_to_serdes_map_fabric_lane16=rx16:tx17 +lane_to_serdes_map_fabric_lane17=rx17:tx18 +lane_to_serdes_map_fabric_lane18=rx18:tx16 +lane_to_serdes_map_fabric_lane19=rx19:tx19 +lane_to_serdes_map_fabric_lane20=rx20:tx21 +lane_to_serdes_map_fabric_lane21=rx21:tx23 +lane_to_serdes_map_fabric_lane22=rx22:tx20 +lane_to_serdes_map_fabric_lane23=rx23:tx22 +lane_to_serdes_map_fabric_lane24=rx24:tx26 +lane_to_serdes_map_fabric_lane25=rx25:tx24 +lane_to_serdes_map_fabric_lane26=rx26:tx25 +lane_to_serdes_map_fabric_lane27=rx27:tx27 +lane_to_serdes_map_fabric_lane28=rx28:tx31 +lane_to_serdes_map_fabric_lane29=rx29:tx30 +lane_to_serdes_map_fabric_lane30=rx30:tx29 +lane_to_serdes_map_fabric_lane31=rx31:tx28 +lane_to_serdes_map_fabric_lane32=rx32:tx32 +lane_to_serdes_map_fabric_lane33=rx33:tx33 +lane_to_serdes_map_fabric_lane34=rx34:tx34 +lane_to_serdes_map_fabric_lane35=rx35:tx35 +lane_to_serdes_map_fabric_lane36=rx36:tx36 +lane_to_serdes_map_fabric_lane37=rx37:tx37 +lane_to_serdes_map_fabric_lane38=rx38:tx38 +lane_to_serdes_map_fabric_lane39=rx39:tx39 +lane_to_serdes_map_fabric_lane40=rx40:tx43 +lane_to_serdes_map_fabric_lane41=rx41:tx42 +lane_to_serdes_map_fabric_lane42=rx42:tx41 +lane_to_serdes_map_fabric_lane43=rx43:tx40 +lane_to_serdes_map_fabric_lane44=rx44:tx47 +lane_to_serdes_map_fabric_lane45=rx45:tx46 +lane_to_serdes_map_fabric_lane46=rx46:tx45 +lane_to_serdes_map_fabric_lane47=rx47:tx44 +lane_to_serdes_map_fabric_lane48=rx48:tx48 +lane_to_serdes_map_fabric_lane49=rx49:tx49 +lane_to_serdes_map_fabric_lane50=rx50:tx50 +lane_to_serdes_map_fabric_lane51=rx51:tx51 +lane_to_serdes_map_fabric_lane52=rx52:tx52 +lane_to_serdes_map_fabric_lane53=rx53:tx53 +lane_to_serdes_map_fabric_lane54=rx54:tx54 +lane_to_serdes_map_fabric_lane55=rx55:tx55 +lane_to_serdes_map_fabric_lane56=rx56:tx59 +lane_to_serdes_map_fabric_lane57=rx57:tx58 +lane_to_serdes_map_fabric_lane58=rx58:tx57 +lane_to_serdes_map_fabric_lane59=rx59:tx56 +lane_to_serdes_map_fabric_lane60=rx60:tx63 +lane_to_serdes_map_fabric_lane61=rx61:tx62 +lane_to_serdes_map_fabric_lane62=rx62:tx61 +lane_to_serdes_map_fabric_lane63=rx63:tx60 +lane_to_serdes_map_fabric_lane64=rx64:tx64 +lane_to_serdes_map_fabric_lane65=rx65:tx65 +lane_to_serdes_map_fabric_lane66=rx66:tx66 +lane_to_serdes_map_fabric_lane67=rx67:tx67 +lane_to_serdes_map_fabric_lane68=rx68:tx68 +lane_to_serdes_map_fabric_lane69=rx69:tx69 +lane_to_serdes_map_fabric_lane70=rx70:tx70 +lane_to_serdes_map_fabric_lane71=rx71:tx71 +lane_to_serdes_map_fabric_lane72=rx72:tx75 +lane_to_serdes_map_fabric_lane73=rx73:tx74 +lane_to_serdes_map_fabric_lane74=rx74:tx73 +lane_to_serdes_map_fabric_lane75=rx75:tx72 +lane_to_serdes_map_fabric_lane76=rx76:tx79 +lane_to_serdes_map_fabric_lane77=rx77:tx78 +lane_to_serdes_map_fabric_lane78=rx78:tx77 +lane_to_serdes_map_fabric_lane79=rx79:tx76 +lane_to_serdes_map_fabric_lane80=rx80:tx80 +lane_to_serdes_map_fabric_lane81=rx81:tx81 +lane_to_serdes_map_fabric_lane82=rx82:tx83 +lane_to_serdes_map_fabric_lane83=rx83:tx82 +lane_to_serdes_map_fabric_lane84=rx84:tx85 +lane_to_serdes_map_fabric_lane85=rx85:tx86 +lane_to_serdes_map_fabric_lane86=rx86:tx84 +lane_to_serdes_map_fabric_lane87=rx87:tx87 +lane_to_serdes_map_fabric_lane88=rx88:tx90 +lane_to_serdes_map_fabric_lane89=rx89:tx88 +lane_to_serdes_map_fabric_lane90=rx90:tx91 +lane_to_serdes_map_fabric_lane91=rx91:tx89 +lane_to_serdes_map_fabric_lane92=rx92:tx93 +lane_to_serdes_map_fabric_lane93=rx93:tx92 +lane_to_serdes_map_fabric_lane94=rx94:tx94 +lane_to_serdes_map_fabric_lane95=rx95:tx95 +lane_to_serdes_map_fabric_lane96=rx96:tx96 +lane_to_serdes_map_fabric_lane97=rx97:tx97 +lane_to_serdes_map_fabric_lane98=rx98:tx98 +lane_to_serdes_map_fabric_lane99=rx99:tx99 +lane_to_serdes_map_fabric_lane100=rx100:tx100 +lane_to_serdes_map_fabric_lane101=rx101:tx101 +lane_to_serdes_map_fabric_lane102=rx102:tx102 +lane_to_serdes_map_fabric_lane103=rx103:tx103 +lane_to_serdes_map_fabric_lane104=rx104:tx105 +lane_to_serdes_map_fabric_lane105=rx105:tx106 +lane_to_serdes_map_fabric_lane106=rx106:tx107 +lane_to_serdes_map_fabric_lane107=rx107:tx104 +lane_to_serdes_map_fabric_lane108=rx108:tx111 +lane_to_serdes_map_fabric_lane109=rx109:tx109 +lane_to_serdes_map_fabric_lane110=rx110:tx110 +lane_to_serdes_map_fabric_lane111=rx111:tx108 +lane_to_serdes_map_fabric_lane112=rx112:tx114 +lane_to_serdes_map_fabric_lane113=rx113:tx113 +lane_to_serdes_map_fabric_lane114=rx114:tx112 +lane_to_serdes_map_fabric_lane115=rx115:tx115 +lane_to_serdes_map_fabric_lane116=rx116:tx117 +lane_to_serdes_map_fabric_lane117=rx117:tx116 +lane_to_serdes_map_fabric_lane118=rx118:tx119 +lane_to_serdes_map_fabric_lane119=rx119:tx118 +lane_to_serdes_map_fabric_lane120=rx120:tx123 +lane_to_serdes_map_fabric_lane121=rx121:tx120 +lane_to_serdes_map_fabric_lane122=rx122:tx122 +lane_to_serdes_map_fabric_lane123=rx123:tx121 +lane_to_serdes_map_fabric_lane124=rx124:tx127 +lane_to_serdes_map_fabric_lane125=rx125:tx125 +lane_to_serdes_map_fabric_lane126=rx126:tx124 +lane_to_serdes_map_fabric_lane127=rx127:tx126 +lane_to_serdes_map_fabric_lane128=rx128:tx128 +lane_to_serdes_map_fabric_lane129=rx129:tx129 +lane_to_serdes_map_fabric_lane130=rx130:tx130 +lane_to_serdes_map_fabric_lane131=rx131:tx131 +lane_to_serdes_map_fabric_lane132=rx132:tx132 +lane_to_serdes_map_fabric_lane133=rx133:tx133 +lane_to_serdes_map_fabric_lane134=rx134:tx134 +lane_to_serdes_map_fabric_lane135=rx135:tx135 +lane_to_serdes_map_fabric_lane136=rx136:tx139 +lane_to_serdes_map_fabric_lane137=rx137:tx138 +lane_to_serdes_map_fabric_lane138=rx138:tx137 +lane_to_serdes_map_fabric_lane139=rx139:tx136 +lane_to_serdes_map_fabric_lane140=rx140:tx140 +lane_to_serdes_map_fabric_lane141=rx141:tx142 +lane_to_serdes_map_fabric_lane142=rx142:tx141 +lane_to_serdes_map_fabric_lane143=rx143:tx143 +lane_to_serdes_map_fabric_lane144=rx144:tx144 +lane_to_serdes_map_fabric_lane145=rx145:tx145 +lane_to_serdes_map_fabric_lane146=rx146:tx146 +lane_to_serdes_map_fabric_lane147=rx147:tx147 +lane_to_serdes_map_fabric_lane148=rx148:tx148 +lane_to_serdes_map_fabric_lane149=rx149:tx149 +lane_to_serdes_map_fabric_lane150=rx150:tx150 +lane_to_serdes_map_fabric_lane151=rx151:tx151 +lane_to_serdes_map_fabric_lane152=rx152:tx155 +lane_to_serdes_map_fabric_lane153=rx153:tx154 +lane_to_serdes_map_fabric_lane154=rx154:tx153 +lane_to_serdes_map_fabric_lane155=rx155:tx152 +lane_to_serdes_map_fabric_lane156=rx156:tx159 +lane_to_serdes_map_fabric_lane157=rx157:tx158 +lane_to_serdes_map_fabric_lane158=rx158:tx157 +lane_to_serdes_map_fabric_lane159=rx159:tx156 +lane_to_serdes_map_fabric_lane160=rx160:tx160 +lane_to_serdes_map_fabric_lane161=rx161:tx161 +lane_to_serdes_map_fabric_lane162=rx162:tx162 +lane_to_serdes_map_fabric_lane163=rx163:tx163 +lane_to_serdes_map_fabric_lane164=rx164:tx164 +lane_to_serdes_map_fabric_lane165=rx165:tx165 +lane_to_serdes_map_fabric_lane166=rx166:tx166 +lane_to_serdes_map_fabric_lane167=rx167:tx167 +lane_to_serdes_map_fabric_lane168=rx168:tx171 +lane_to_serdes_map_fabric_lane169=rx169:tx170 +lane_to_serdes_map_fabric_lane170=rx170:tx169 +lane_to_serdes_map_fabric_lane171=rx171:tx168 +lane_to_serdes_map_fabric_lane172=rx172:tx175 +lane_to_serdes_map_fabric_lane173=rx173:tx174 +lane_to_serdes_map_fabric_lane174=rx174:tx173 +lane_to_serdes_map_fabric_lane175=rx175:tx172 +lane_to_serdes_map_fabric_lane176=rx176:tx176 +lane_to_serdes_map_fabric_lane177=rx177:tx177 +lane_to_serdes_map_fabric_lane178=rx178:tx179 +lane_to_serdes_map_fabric_lane179=rx179:tx178 +lane_to_serdes_map_fabric_lane180=rx180:tx181 +lane_to_serdes_map_fabric_lane181=rx181:tx182 +lane_to_serdes_map_fabric_lane182=rx182:tx180 +lane_to_serdes_map_fabric_lane183=rx183:tx183 +lane_to_serdes_map_fabric_lane184=rx184:tx186 +lane_to_serdes_map_fabric_lane185=rx185:tx184 +lane_to_serdes_map_fabric_lane186=rx186:tx185 +lane_to_serdes_map_fabric_lane187=rx187:tx187 +lane_to_serdes_map_fabric_lane188=rx188:tx188 +lane_to_serdes_map_fabric_lane189=rx189:tx189 +lane_to_serdes_map_fabric_lane190=rx190:tx190 +lane_to_serdes_map_fabric_lane191=rx191:tx191 + +# +##Protocol trap look-up mode: +# Options: IN_LIF - Look-ups in the profile table are done by IN-LIF +# IN_PORT - Look-ups in the profile table are done by IN-PORT +protocol_traps_mode=IN_LIF + +# access definitions +schan_intr_enable=0 +tdma_intr_enable=0 +tslam_intr_enable=0 +miim_intr_enable=0 +schan_timeout_usec=300000 +tdma_timeout_usec=1000000 +tslam_timeout_usec=1000000 + +### Interrupts +appl_enable_intr_init=1 +polled_irq_mode=1 +# reduce CPU load, configure delay 100ms +polled_irq_delay=1000 + +# reduce the CPU load over adapter (caused by counter thread) +bcm_stat_interval=1000 + +# shadow memory +mem_cache_enable_ecc=1 +mem_cache_enable_parity=1 + +# serdes_nif/fabric_clk_freq_in/out configuration +serdes_nif_clk_freq_in=2 +serdes_nif_clk_freq_out=1 +serdes_fabric_clk_freq_in=2 +serdes_fabric_clk_freq_out=1 + +dport_map_direct=1 + +rif_id_max=0x6000 + +phy_rx_polarity_flip_phy0=0 +phy_rx_polarity_flip_phy1=0 +phy_rx_polarity_flip_phy2=0 +phy_rx_polarity_flip_phy3=0 +phy_rx_polarity_flip_phy4=0 +phy_rx_polarity_flip_phy5=0 +phy_rx_polarity_flip_phy6=0 +phy_rx_polarity_flip_phy7=0 +phy_rx_polarity_flip_phy8=1 +phy_rx_polarity_flip_phy9=1 +phy_rx_polarity_flip_phy10=0 +phy_rx_polarity_flip_phy11=1 +phy_rx_polarity_flip_phy12=1 +phy_rx_polarity_flip_phy13=1 +phy_rx_polarity_flip_phy14=1 +phy_rx_polarity_flip_phy15=1 +phy_rx_polarity_flip_phy16=0 +phy_rx_polarity_flip_phy17=0 +phy_rx_polarity_flip_phy18=0 +phy_rx_polarity_flip_phy19=0 +phy_rx_polarity_flip_phy20=0 +phy_rx_polarity_flip_phy21=0 +phy_rx_polarity_flip_phy22=0 +phy_rx_polarity_flip_phy23=0 +phy_rx_polarity_flip_phy24=0 +phy_rx_polarity_flip_phy25=0 +phy_rx_polarity_flip_phy26=0 +phy_rx_polarity_flip_phy27=0 +phy_rx_polarity_flip_phy28=0 +phy_rx_polarity_flip_phy29=0 +phy_rx_polarity_flip_phy30=0 +phy_rx_polarity_flip_phy31=0 +phy_rx_polarity_flip_phy32=0 +phy_rx_polarity_flip_phy33=0 +phy_rx_polarity_flip_phy34=0 +phy_rx_polarity_flip_phy35=0 +phy_rx_polarity_flip_phy36=0 +phy_rx_polarity_flip_phy37=0 +phy_rx_polarity_flip_phy38=0 +phy_rx_polarity_flip_phy39=0 +phy_rx_polarity_flip_phy40=0 +phy_rx_polarity_flip_phy41=0 +phy_rx_polarity_flip_phy42=0 +phy_rx_polarity_flip_phy43=0 +phy_rx_polarity_flip_phy44=0 +phy_rx_polarity_flip_phy45=0 +phy_rx_polarity_flip_phy46=0 +phy_rx_polarity_flip_phy47=0 +phy_rx_polarity_flip_phy48=0 +phy_rx_polarity_flip_phy49=0 +phy_rx_polarity_flip_phy50=0 +phy_rx_polarity_flip_phy51=0 +phy_rx_polarity_flip_phy52=0 +phy_rx_polarity_flip_phy53=0 +phy_rx_polarity_flip_phy54=0 +phy_rx_polarity_flip_phy55=0 +phy_rx_polarity_flip_phy56=0 +phy_rx_polarity_flip_phy57=0 +phy_rx_polarity_flip_phy58=0 +phy_rx_polarity_flip_phy59=0 +phy_rx_polarity_flip_phy60=0 +phy_rx_polarity_flip_phy61=0 +phy_rx_polarity_flip_phy62=0 +phy_rx_polarity_flip_phy63=0 +phy_rx_polarity_flip_phy64=0 +phy_rx_polarity_flip_phy65=0 +phy_rx_polarity_flip_phy66=0 +phy_rx_polarity_flip_phy67=0 +phy_rx_polarity_flip_phy68=0 +phy_rx_polarity_flip_phy69=0 +phy_rx_polarity_flip_phy70=0 +phy_rx_polarity_flip_phy71=0 +phy_rx_polarity_flip_phy72=1 +phy_rx_polarity_flip_phy73=1 +phy_rx_polarity_flip_phy74=1 +phy_rx_polarity_flip_phy75=1 +phy_rx_polarity_flip_phy76=1 +phy_rx_polarity_flip_phy77=1 +phy_rx_polarity_flip_phy78=1 +phy_rx_polarity_flip_phy79=1 +phy_rx_polarity_flip_phy80=0 +phy_rx_polarity_flip_phy81=0 +phy_rx_polarity_flip_phy82=0 +phy_rx_polarity_flip_phy83=0 +phy_rx_polarity_flip_phy84=0 +phy_rx_polarity_flip_phy85=0 +phy_rx_polarity_flip_phy86=0 +phy_rx_polarity_flip_phy87=0 +phy_rx_polarity_flip_phy88=0 +phy_rx_polarity_flip_phy89=0 +phy_rx_polarity_flip_phy90=1 +phy_rx_polarity_flip_phy91=0 +phy_rx_polarity_flip_phy92=0 +phy_rx_polarity_flip_phy93=0 +phy_rx_polarity_flip_phy94=0 +phy_rx_polarity_flip_phy95=0 +phy_rx_polarity_flip_phy96=0 +phy_rx_polarity_flip_phy97=0 +phy_rx_polarity_flip_phy98=0 +phy_rx_polarity_flip_phy99=0 +phy_rx_polarity_flip_phy100=0 +phy_rx_polarity_flip_phy101=0 +phy_rx_polarity_flip_phy102=0 +phy_rx_polarity_flip_phy103=0 +phy_rx_polarity_flip_phy104=0 +phy_rx_polarity_flip_phy105=0 +phy_rx_polarity_flip_phy106=0 +phy_rx_polarity_flip_phy107=0 +phy_rx_polarity_flip_phy108=0 +phy_rx_polarity_flip_phy109=0 +phy_rx_polarity_flip_phy110=0 +phy_rx_polarity_flip_phy111=0 +phy_rx_polarity_flip_phy112=0 +phy_rx_polarity_flip_phy113=0 +phy_rx_polarity_flip_phy114=0 +phy_rx_polarity_flip_phy115=0 +phy_rx_polarity_flip_phy116=0 +phy_rx_polarity_flip_phy117=0 +phy_rx_polarity_flip_phy118=0 +phy_rx_polarity_flip_phy119=0 +phy_rx_polarity_flip_phy120=0 +phy_rx_polarity_flip_phy121=0 +phy_rx_polarity_flip_phy122=0 +phy_rx_polarity_flip_phy123=0 +phy_rx_polarity_flip_phy124=0 +phy_rx_polarity_flip_phy125=0 +phy_rx_polarity_flip_phy126=0 +phy_rx_polarity_flip_phy127=0 +phy_rx_polarity_flip_phy128=0 +phy_rx_polarity_flip_phy129=0 +phy_rx_polarity_flip_phy130=0 +phy_rx_polarity_flip_phy131=0 +phy_rx_polarity_flip_phy132=0 +phy_rx_polarity_flip_phy133=0 +phy_rx_polarity_flip_phy134=0 +phy_rx_polarity_flip_phy135=0 +phy_rx_polarity_flip_phy136=0 +phy_rx_polarity_flip_phy137=0 +phy_rx_polarity_flip_phy138=0 +phy_rx_polarity_flip_phy139=0 +phy_rx_polarity_flip_phy140=0 +phy_rx_polarity_flip_phy141=0 +phy_rx_polarity_flip_phy142=0 +phy_rx_polarity_flip_phy143=0 +phy_tx_polarity_flip_phy0=1 +phy_tx_polarity_flip_phy1=1 +phy_tx_polarity_flip_phy2=1 +phy_tx_polarity_flip_phy3=1 +phy_tx_polarity_flip_phy4=1 +phy_tx_polarity_flip_phy5=1 +phy_tx_polarity_flip_phy6=1 +phy_tx_polarity_flip_phy7=1 +phy_tx_polarity_flip_phy8=1 +phy_tx_polarity_flip_phy9=0 +phy_tx_polarity_flip_phy10=1 +phy_tx_polarity_flip_phy11=1 +phy_tx_polarity_flip_phy12=1 +phy_tx_polarity_flip_phy13=1 +phy_tx_polarity_flip_phy14=1 +phy_tx_polarity_flip_phy15=1 +phy_tx_polarity_flip_phy16=1 +phy_tx_polarity_flip_phy17=1 +phy_tx_polarity_flip_phy18=1 +phy_tx_polarity_flip_phy19=1 +phy_tx_polarity_flip_phy20=1 +phy_tx_polarity_flip_phy21=1 +phy_tx_polarity_flip_phy22=1 +phy_tx_polarity_flip_phy23=1 +phy_tx_polarity_flip_phy24=1 +phy_tx_polarity_flip_phy25=1 +phy_tx_polarity_flip_phy26=1 +phy_tx_polarity_flip_phy27=1 +phy_tx_polarity_flip_phy28=1 +phy_tx_polarity_flip_phy29=1 +phy_tx_polarity_flip_phy30=1 +phy_tx_polarity_flip_phy31=1 +phy_tx_polarity_flip_phy32=1 +phy_tx_polarity_flip_phy33=1 +phy_tx_polarity_flip_phy34=1 +phy_tx_polarity_flip_phy35=1 +phy_tx_polarity_flip_phy36=1 +phy_tx_polarity_flip_phy37=1 +phy_tx_polarity_flip_phy38=1 +phy_tx_polarity_flip_phy39=1 +phy_tx_polarity_flip_phy40=1 +phy_tx_polarity_flip_phy41=1 +phy_tx_polarity_flip_phy42=1 +phy_tx_polarity_flip_phy43=1 +phy_tx_polarity_flip_phy44=1 +phy_tx_polarity_flip_phy45=1 +phy_tx_polarity_flip_phy46=1 +phy_tx_polarity_flip_phy47=1 +phy_tx_polarity_flip_phy48=1 +phy_tx_polarity_flip_phy49=1 +phy_tx_polarity_flip_phy50=1 +phy_tx_polarity_flip_phy51=1 +phy_tx_polarity_flip_phy52=1 +phy_tx_polarity_flip_phy53=1 +phy_tx_polarity_flip_phy54=1 +phy_tx_polarity_flip_phy55=1 +phy_tx_polarity_flip_phy56=1 +phy_tx_polarity_flip_phy57=1 +phy_tx_polarity_flip_phy58=1 +phy_tx_polarity_flip_phy59=1 +phy_tx_polarity_flip_phy60=1 +phy_tx_polarity_flip_phy61=1 +phy_tx_polarity_flip_phy62=1 +phy_tx_polarity_flip_phy63=1 +phy_tx_polarity_flip_phy64=1 +phy_tx_polarity_flip_phy65=1 +phy_tx_polarity_flip_phy66=1 +phy_tx_polarity_flip_phy67=1 +phy_tx_polarity_flip_phy68=1 +phy_tx_polarity_flip_phy69=1 +phy_tx_polarity_flip_phy70=1 +phy_tx_polarity_flip_phy71=1 +phy_tx_polarity_flip_phy72=0 +phy_tx_polarity_flip_phy73=0 +phy_tx_polarity_flip_phy74=0 +phy_tx_polarity_flip_phy75=0 +phy_tx_polarity_flip_phy76=0 +phy_tx_polarity_flip_phy77=0 +phy_tx_polarity_flip_phy78=0 +phy_tx_polarity_flip_phy79=0 +phy_tx_polarity_flip_phy80=0 +phy_tx_polarity_flip_phy81=0 +phy_tx_polarity_flip_phy82=0 +phy_tx_polarity_flip_phy83=0 +phy_tx_polarity_flip_phy84=0 +phy_tx_polarity_flip_phy85=0 +phy_tx_polarity_flip_phy86=0 +phy_tx_polarity_flip_phy87=0 +phy_tx_polarity_flip_phy88=1 +phy_tx_polarity_flip_phy89=1 +phy_tx_polarity_flip_phy90=1 +phy_tx_polarity_flip_phy91=1 +phy_tx_polarity_flip_phy92=1 +phy_tx_polarity_flip_phy93=1 +phy_tx_polarity_flip_phy94=1 +phy_tx_polarity_flip_phy95=1 +phy_tx_polarity_flip_phy96=1 +phy_tx_polarity_flip_phy97=1 +phy_tx_polarity_flip_phy98=1 +phy_tx_polarity_flip_phy99=1 +phy_tx_polarity_flip_phy100=1 +phy_tx_polarity_flip_phy101=1 +phy_tx_polarity_flip_phy102=1 +phy_tx_polarity_flip_phy103=1 +phy_tx_polarity_flip_phy104=1 +phy_tx_polarity_flip_phy105=1 +phy_tx_polarity_flip_phy106=1 +phy_tx_polarity_flip_phy107=1 +phy_tx_polarity_flip_phy108=1 +phy_tx_polarity_flip_phy109=1 +phy_tx_polarity_flip_phy110=1 +phy_tx_polarity_flip_phy111=1 +phy_tx_polarity_flip_phy112=1 +phy_tx_polarity_flip_phy113=1 +phy_tx_polarity_flip_phy114=1 +phy_tx_polarity_flip_phy115=1 +phy_tx_polarity_flip_phy116=1 +phy_tx_polarity_flip_phy117=1 +phy_tx_polarity_flip_phy118=1 +phy_tx_polarity_flip_phy119=1 +phy_tx_polarity_flip_phy120=1 +phy_tx_polarity_flip_phy121=1 +phy_tx_polarity_flip_phy122=1 +phy_tx_polarity_flip_phy123=1 +phy_tx_polarity_flip_phy124=1 +phy_tx_polarity_flip_phy125=1 +phy_tx_polarity_flip_phy126=1 +phy_tx_polarity_flip_phy127=1 +phy_tx_polarity_flip_phy128=1 +phy_tx_polarity_flip_phy129=1 +phy_tx_polarity_flip_phy130=1 +phy_tx_polarity_flip_phy131=1 +phy_tx_polarity_flip_phy132=1 +phy_tx_polarity_flip_phy133=1 +phy_tx_polarity_flip_phy134=1 +phy_tx_polarity_flip_phy135=1 +phy_tx_polarity_flip_phy136=1 +phy_tx_polarity_flip_phy137=1 +phy_tx_polarity_flip_phy138=1 +phy_tx_polarity_flip_phy139=1 +phy_tx_polarity_flip_phy140=1 +phy_tx_polarity_flip_phy141=1 +phy_tx_polarity_flip_phy142=1 +phy_tx_polarity_flip_phy143=1 + +serdes_tx_taps_1=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_2=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_3=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_4=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_5=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_6=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_7=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_8=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_9=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_10=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_11=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_12=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_13=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_14=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_15=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_16=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_17=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_18=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_19=nrz:-6:85:-21:0:0:0 +serdes_tx_taps_20=nrz:-5:83:-22:0:0:0 +serdes_tx_taps_21=nrz:-4:75:-21:0:0:0 +serdes_tx_taps_22=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_23=nrz:-6:85:-21:0:0:0 +serdes_tx_taps_24=nrz:-5:83:-22:0:0:0 +serdes_tx_taps_25=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_26=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_27=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_28=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_29=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_30=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_31=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_32=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_33=nrz:-5:83:-22:0:0:0 +serdes_tx_taps_34=nrz:-5:83:-22:0:0:0 +serdes_tx_taps_35=nrz:-4:75:-21:0:0:0 +serdes_tx_taps_36=nrz:-8:89:-29:0:0:0 + +xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 +xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=2 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/port_config.ini b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/port_config.ini new file mode 100644 index 00000000000..4756e475658 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/port_config.ini @@ -0,0 +1,21 @@ +# name lanes alias index role speed asic_port_name coreId corePortId numVoq +Ethernet0 72,73,74,75 Ethernet1/1 1 Ext 100000 Eth0-ASIC0 1 1 8 +Ethernet8 80,81,82,83 Ethernet2/1 2 Ext 100000 Eth8-ASIC0 1 2 8 +Ethernet16 88,89,90,91 Ethernet3/1 3 Ext 100000 Eth16-ASIC0 1 3 8 +Ethernet24 96,97,98,99 Ethernet4/1 4 Ext 100000 Eth24-ASIC0 1 4 8 +Ethernet32 104,105,106,107 Ethernet5/1 5 Ext 100000 Eth32-ASIC0 1 5 8 +Ethernet40 112,113,114,115 Ethernet6/1 6 Ext 100000 Eth40-ASIC0 1 6 8 +Ethernet48 120,121,122,123 Ethernet7/1 7 Ext 100000 Eth48-ASIC0 1 7 8 +Ethernet56 128,129,130,131 Ethernet8/1 8 Ext 100000 Eth56-ASIC0 1 8 8 +Ethernet64 136,137,138,139 Ethernet9/1 9 Ext 100000 Eth64-ASIC0 1 9 8 +Ethernet72 64,65,66,67 Ethernet10/1 10 Ext 100000 Eth72-ASIC0 0 10 8 +Ethernet80 56,57,58,59 Ethernet11/1 11 Ext 100000 Eth80-ASIC0 0 11 8 +Ethernet88 48,49,50,51 Ethernet12/1 12 Ext 100000 Eth88-ASIC0 0 12 8 +Ethernet96 40,41,42,43 Ethernet13/1 13 Ext 100000 Eth96-ASIC0 0 13 8 +Ethernet104 32,33,34,35 Ethernet14/1 14 Ext 100000 Eth104-ASIC0 0 14 8 +Ethernet112 24,25,26,27 Ethernet15/1 15 Ext 100000 Eth112-ASIC0 0 15 8 +Ethernet120 16,17,18,19 Ethernet16/1 16 Ext 100000 Eth120-ASIC0 0 16 8 +Ethernet128 8,9,10,11 Ethernet17/1 17 Ext 100000 Eth128-ASIC0 0 17 8 +Ethernet136 0,1,2,3 Ethernet18/1 18 Ext 100000 Eth136-ASIC0 0 18 8 +Ethernet-Rec0 221 Recirc0/0 19 Rec 400000 Rcy0-ASIC0 0 221 8 +Ethernet-IB0 222 Recirc0/1 20 Inb 400000 Rcy1-ASIC0 1 222 8 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/sai.profile b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/sai.profile new file mode 100644 index 00000000000..894b300ad73 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/0/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/j2p-a7800r3a-36d-36x400G.config.bcm + diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/context_config.json b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/context_config.json new file mode 120000 index 00000000000..3db0e8ed3d9 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/context_config.json @@ -0,0 +1 @@ +../0/context_config.json \ No newline at end of file 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 new file mode 100644 index 00000000000..b30d9d238b2 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -0,0 +1,984 @@ +soc_family=BCM8885X + +dpp_db_path=/usr/share/bcm/db + +#################################################### +##Reference applications related properties - Start +#################################################### + +## PMF small EXEM connected stage: +# Options: IPMF2 - Ingress PMF 2 stage can perform small EXEM lookups. +# IPMF3 - Ingress PMF 3 stage can perform small EXEM lookups. +## PMF small EXEM connected stage: +# Options: IPMF2 - Ingress PMF 2 stage can perform small EXEM lookups. +# IPMF3 - Ingress PMF 3 stage can perform small EXEM lookups. +pmf_sexem3_stage=IPMF2 + +#################################################### +##Reference applications related properties - End +#################################################### + +# Jericho2-mode (description 0x1 used for Jericho 2 mode) +system_headers_mode=1 + +# HW mode to support 1024 16-member system wide LAGs +trunk_group_max_members=16 + +# Disable link-training +port_init_cl72=0 + +###Default interfaces for Jericho2Plus +#CPU interfaces +ucode_port_0=CPU.0:core_0.0 +ucode_port_200=CPU.8:core_1.200 +ucode_port_201=CPU.16:core_0.201 +ucode_port_202=CPU.24:core_1.202 +ucode_port_203=CPU.32:core_0.203 + +#NIF ETH interfaces on device +ucode_port_1=CGE18:core_1.1 +ucode_port_2=CGE20:core_1.2 +ucode_port_3=CGE22:core_1.3 +ucode_port_4=CGE24:core_1.4 +ucode_port_5=CGE26:core_1.5 +ucode_port_6=CGE28:core_1.6 +ucode_port_7=CGE30:core_1.7 +ucode_port_8=CGE32:core_1.8 +ucode_port_9=CGE34:core_1.9 + +ucode_port_10=CGE16:core_0.10 +ucode_port_11=CGE14:core_0.11 +ucode_port_12=CGE12:core_0.12 +ucode_port_13=CGE10:core_0.13 +ucode_port_14=CGE8:core_0.14 +ucode_port_15=CGE6:core_0.15 +ucode_port_16=CGE4:core_0.16 +ucode_port_17=CGE2:core_0.17 +ucode_port_18=CGE0:core_0.18 + +#NIF default speeds +port_init_speed_xe=10000 +port_init_speed_xl=40000 +port_init_speed_le=50000 +port_init_speed_ce=100000 +port_init_speed_cc=200000 +port_init_speed_cd=400000 +port_init_speed_il=10312 + +port_priorities=8 + +#special ports +ucode_port_240=OLP:core_0.240 + +# NIF lane mapping +lane_to_serdes_map_nif_lane0=rx3:tx4 +lane_to_serdes_map_nif_lane1=rx6:tx1 +lane_to_serdes_map_nif_lane2=rx7:tx5 +lane_to_serdes_map_nif_lane3=rx4:tx7 +lane_to_serdes_map_nif_lane4=rx1:tx2 +lane_to_serdes_map_nif_lane5=rx0:tx0 +lane_to_serdes_map_nif_lane6=rx5:tx3 +lane_to_serdes_map_nif_lane7=rx2:tx6 +lane_to_serdes_map_nif_lane8=rx10:tx11 +lane_to_serdes_map_nif_lane9=rx8:tx8 +lane_to_serdes_map_nif_lane10=rx14:tx12 +lane_to_serdes_map_nif_lane11=rx15:tx15 +lane_to_serdes_map_nif_lane12=rx13:tx10 +lane_to_serdes_map_nif_lane13=rx9:tx9 +lane_to_serdes_map_nif_lane14=rx11:tx13 +lane_to_serdes_map_nif_lane15=rx12:tx14 +lane_to_serdes_map_nif_lane16=rx16:tx17 +lane_to_serdes_map_nif_lane17=rx19:tx21 +lane_to_serdes_map_nif_lane18=rx21:tx18 +lane_to_serdes_map_nif_lane19=rx18:tx16 +lane_to_serdes_map_nif_lane20=rx17:tx23 +lane_to_serdes_map_nif_lane21=rx20:tx22 +lane_to_serdes_map_nif_lane22=rx22:tx20 +lane_to_serdes_map_nif_lane23=rx23:tx19 +lane_to_serdes_map_nif_lane24=rx26:tx28 +lane_to_serdes_map_nif_lane25=rx29:tx31 +lane_to_serdes_map_nif_lane26=rx31:tx29 +lane_to_serdes_map_nif_lane27=rx28:tx27 +lane_to_serdes_map_nif_lane28=rx25:tx25 +lane_to_serdes_map_nif_lane29=rx24:tx30 +lane_to_serdes_map_nif_lane30=rx30:tx24 +lane_to_serdes_map_nif_lane31=rx27:tx26 +lane_to_serdes_map_nif_lane32=rx32:tx39 +lane_to_serdes_map_nif_lane33=rx33:tx38 +lane_to_serdes_map_nif_lane34=rx38:tx32 +lane_to_serdes_map_nif_lane35=rx39:tx33 +lane_to_serdes_map_nif_lane36=rx35:tx37 +lane_to_serdes_map_nif_lane37=rx34:tx36 +lane_to_serdes_map_nif_lane38=rx36:tx34 +lane_to_serdes_map_nif_lane39=rx37:tx35 +lane_to_serdes_map_nif_lane40=rx40:tx41 +lane_to_serdes_map_nif_lane41=rx43:tx45 +lane_to_serdes_map_nif_lane42=rx45:tx42 +lane_to_serdes_map_nif_lane43=rx42:tx40 +lane_to_serdes_map_nif_lane44=rx41:tx47 +lane_to_serdes_map_nif_lane45=rx44:tx46 +lane_to_serdes_map_nif_lane46=rx46:tx44 +lane_to_serdes_map_nif_lane47=rx47:tx43 +lane_to_serdes_map_nif_lane48=rx50:tx52 +lane_to_serdes_map_nif_lane49=rx53:tx55 +lane_to_serdes_map_nif_lane50=rx55:tx53 +lane_to_serdes_map_nif_lane51=rx52:tx51 +lane_to_serdes_map_nif_lane52=rx49:tx49 +lane_to_serdes_map_nif_lane53=rx48:tx54 +lane_to_serdes_map_nif_lane54=rx54:tx48 +lane_to_serdes_map_nif_lane55=rx51:tx50 +lane_to_serdes_map_nif_lane56=rx56:tx63 +lane_to_serdes_map_nif_lane57=rx57:tx62 +lane_to_serdes_map_nif_lane58=rx62:tx56 +lane_to_serdes_map_nif_lane59=rx63:tx57 +lane_to_serdes_map_nif_lane60=rx59:tx61 +lane_to_serdes_map_nif_lane61=rx58:tx60 +lane_to_serdes_map_nif_lane62=rx60:tx58 +lane_to_serdes_map_nif_lane63=rx61:tx59 +lane_to_serdes_map_nif_lane64=rx64:tx65 +lane_to_serdes_map_nif_lane65=rx67:tx69 +lane_to_serdes_map_nif_lane66=rx69:tx66 +lane_to_serdes_map_nif_lane67=rx66:tx64 +lane_to_serdes_map_nif_lane68=rx65:tx71 +lane_to_serdes_map_nif_lane69=rx68:tx70 +lane_to_serdes_map_nif_lane70=rx70:tx68 +lane_to_serdes_map_nif_lane71=rx71:tx67 +lane_to_serdes_map_nif_lane72=rx79:tx74 +lane_to_serdes_map_nif_lane73=rx76:tx75 +lane_to_serdes_map_nif_lane74=rx72:tx76 +lane_to_serdes_map_nif_lane75=rx74:tx73 +lane_to_serdes_map_nif_lane76=rx77:tx79 +lane_to_serdes_map_nif_lane77=rx78:tx78 +lane_to_serdes_map_nif_lane78=rx73:tx77 +lane_to_serdes_map_nif_lane79=rx75:tx72 +lane_to_serdes_map_nif_lane80=rx86:tx86 +lane_to_serdes_map_nif_lane81=rx83:tx87 +lane_to_serdes_map_nif_lane82=rx82:tx81 +lane_to_serdes_map_nif_lane83=rx85:tx80 +lane_to_serdes_map_nif_lane84=rx87:tx85 +lane_to_serdes_map_nif_lane85=rx84:tx84 +lane_to_serdes_map_nif_lane86=rx80:tx82 +lane_to_serdes_map_nif_lane87=rx81:tx83 +lane_to_serdes_map_nif_lane88=rx95:tx90 +lane_to_serdes_map_nif_lane89=rx92:tx88 +lane_to_serdes_map_nif_lane90=rx88:tx92 +lane_to_serdes_map_nif_lane91=rx91:tx95 +lane_to_serdes_map_nif_lane92=rx94:tx89 +lane_to_serdes_map_nif_lane93=rx93:tx91 +lane_to_serdes_map_nif_lane94=rx89:tx93 +lane_to_serdes_map_nif_lane95=rx90:tx94 +lane_to_serdes_map_nif_lane96=rx103:tx97 +lane_to_serdes_map_nif_lane97=rx100:tx96 +lane_to_serdes_map_nif_lane98=rx96:tx100 +lane_to_serdes_map_nif_lane99=rx99:tx103 +lane_to_serdes_map_nif_lane100=rx102:tx99 +lane_to_serdes_map_nif_lane101=rx101:tx98 +lane_to_serdes_map_nif_lane102=rx97:tx101 +lane_to_serdes_map_nif_lane103=rx98:tx102 +lane_to_serdes_map_nif_lane104=rx110:tx107 +lane_to_serdes_map_nif_lane105=rx108:tx105 +lane_to_serdes_map_nif_lane106=rx104:tx108 +lane_to_serdes_map_nif_lane107=rx107:tx110 +lane_to_serdes_map_nif_lane108=rx111:tx106 +lane_to_serdes_map_nif_lane109=rx109:tx104 +lane_to_serdes_map_nif_lane110=rx105:tx109 +lane_to_serdes_map_nif_lane111=rx106:tx111 +lane_to_serdes_map_nif_lane112=rx119:tx114 +lane_to_serdes_map_nif_lane113=rx116:tx112 +lane_to_serdes_map_nif_lane114=rx112:tx116 +lane_to_serdes_map_nif_lane115=rx115:tx119 +lane_to_serdes_map_nif_lane116=rx118:tx113 +lane_to_serdes_map_nif_lane117=rx117:tx115 +lane_to_serdes_map_nif_lane118=rx113:tx117 +lane_to_serdes_map_nif_lane119=rx114:tx118 +lane_to_serdes_map_nif_lane120=rx127:tx121 +lane_to_serdes_map_nif_lane121=rx124:tx120 +lane_to_serdes_map_nif_lane122=rx120:tx124 +lane_to_serdes_map_nif_lane123=rx123:tx127 +lane_to_serdes_map_nif_lane124=rx126:tx123 +lane_to_serdes_map_nif_lane125=rx125:tx122 +lane_to_serdes_map_nif_lane126=rx121:tx125 +lane_to_serdes_map_nif_lane127=rx122:tx126 +lane_to_serdes_map_nif_lane128=rx134:tx131 +lane_to_serdes_map_nif_lane129=rx132:tx129 +lane_to_serdes_map_nif_lane130=rx128:tx132 +lane_to_serdes_map_nif_lane131=rx131:tx134 +lane_to_serdes_map_nif_lane132=rx135:tx130 +lane_to_serdes_map_nif_lane133=rx133:tx128 +lane_to_serdes_map_nif_lane134=rx129:tx133 +lane_to_serdes_map_nif_lane135=rx130:tx135 +lane_to_serdes_map_nif_lane136=rx143:tx138 +lane_to_serdes_map_nif_lane137=rx140:tx136 +lane_to_serdes_map_nif_lane138=rx136:tx140 +lane_to_serdes_map_nif_lane139=rx139:tx143 +lane_to_serdes_map_nif_lane140=rx142:tx137 +lane_to_serdes_map_nif_lane141=rx141:tx139 +lane_to_serdes_map_nif_lane142=rx137:tx141 +lane_to_serdes_map_nif_lane143=rx138:tx142 + +######################### +### High Availability ### +######################### + +sw_state_max_size=750000000 + +#location of warmboot NV memory +#Allowed options for dnx are - 3:external storage in filesystem 4:driver will save the state directly in shared memory +stable_location=4 + +# Note that each unit should have a unique filename and that adapter does not play well with tmp and dev/shm folders. +stable_filename=/dev/shm/warmboot_data_0 +stable_filename.1=/dev/shm/warmboot_data_1 +stable_filename.2=/dev/shm/warmboot_data_2 + +#Maximum size for NVM used for WB storage, must be larger than sw_state_max_size.BCM8885X +stable_size=800000000 + +######################### +######################### +######################### + +tm_port_header_type_in_0=INJECTED_2_PP +tm_port_header_type_out_0=CPU + +tm_port_header_type_in_200=INJECTED_2_PP +tm_port_header_type_out_200=ETH +tm_port_header_type_in_201=INJECTED_2_PP +tm_port_header_type_out_201=ETH +tm_port_header_type_in_202=INJECTED_2_PP +tm_port_header_type_out_202=ETH +tm_port_header_type_in_203=INJECTED_2_PP +tm_port_header_type_out_203=ETH + +### SAT +## Enable SAT Interface. 0 - Disable, 1 - Enable (Default) +sat_enable=1 +ucode_port_218=SAT:core_0.218 +tm_port_header_type_out_218=CPU +tm_port_header_type_in_218=INJECTED_2 +ucode_port_219=SAT:core_1.219 +tm_port_header_type_out_219=CPU +tm_port_header_type_in_219=INJECTED_2 +port_init_speed_sat=400000 + +### RCY +sai_recycle_port_lane_base=0 +ucode_port_221=RCY.21:core_0.221 +ucode_port_222=RCY.22:core_1.222 +tm_port_header_type_out_221=ETH +tm_port_header_type_in_221=ETH +tm_port_header_type_out_222=ETH +tm_port_header_type_in_222=ETH +port_init_speed_221=400000 +port_init_speed_222=400000 + +#OLP port +tm_port_header_type_in_240=INJECTED_2 +tm_port_header_type_out_240=RAW + +# Set statically the region mode per region id +dtm_flow_mapping_mode_region_257=3 +dtm_flow_mapping_mode_region_258=3 +dtm_flow_mapping_mode_region_259=3 +dtm_flow_mapping_mode_region_260=3 +dtm_flow_mapping_mode_region_261=3 +dtm_flow_mapping_mode_region_262=3 +dtm_flow_mapping_mode_region_263=3 +dtm_flow_mapping_mode_region_264=3 +dtm_flow_mapping_mode_region_265=3 +dtm_flow_mapping_mode_region_266=7 +dtm_flow_mapping_mode_region_267=3 +dtm_flow_mapping_mode_region_268=3 +dtm_flow_mapping_mode_region_269=3 +dtm_flow_mapping_mode_region_270=3 +dtm_flow_mapping_mode_region_271=3 +dtm_flow_mapping_mode_region_272=3 +dtm_flow_mapping_mode_region_273=3 +dtm_flow_mapping_mode_region_274=3 +dtm_flow_mapping_mode_region_275=3 +dtm_flow_mapping_mode_region_276=3 +dtm_flow_mapping_mode_region_277=3 +dtm_flow_mapping_mode_region_278=3 +dtm_flow_mapping_mode_region_279=3 +dtm_flow_mapping_mode_region_280=3 +dtm_flow_mapping_mode_region_281=3 +dtm_flow_mapping_mode_region_282=3 +dtm_flow_mapping_mode_region_283=3 +dtm_flow_mapping_mode_region_284=3 +dtm_flow_mapping_mode_region_285=3 +dtm_flow_mapping_mode_region_286=3 +dtm_flow_mapping_mode_region_287=3 + +## Configure number of symmetric cores each region supports ## +dtm_flow_nof_remote_cores_region_1=2 +dtm_flow_nof_remote_cores_region_2=2 +dtm_flow_nof_remote_cores_region_3=2 +dtm_flow_nof_remote_cores_region_4=2 +dtm_flow_nof_remote_cores_region_5=2 +dtm_flow_nof_remote_cores_region_6=2 +dtm_flow_nof_remote_cores_region_7=2 +dtm_flow_nof_remote_cores_region_8=2 +dtm_flow_nof_remote_cores_region_9=2 +dtm_flow_nof_remote_cores_region_10=2 +dtm_flow_nof_remote_cores_region_11=2 +dtm_flow_nof_remote_cores_region_12=2 +dtm_flow_nof_remote_cores_region_13=2 +dtm_flow_nof_remote_cores_region_14=2 +dtm_flow_nof_remote_cores_region_15=2 +dtm_flow_nof_remote_cores_region_16=2 +dtm_flow_nof_remote_cores_region_17=2 +dtm_flow_nof_remote_cores_region_18=2 +dtm_flow_nof_remote_cores_region_19=2 +dtm_flow_nof_remote_cores_region_20=2 +dtm_flow_nof_remote_cores_region_21=2 +dtm_flow_nof_remote_cores_region_22=2 +dtm_flow_nof_remote_cores_region_23=2 +dtm_flow_nof_remote_cores_region_24=2 +dtm_flow_nof_remote_cores_region_25=2 +dtm_flow_nof_remote_cores_region_26=2 +dtm_flow_nof_remote_cores_region_27=2 +dtm_flow_nof_remote_cores_region_28=2 +dtm_flow_nof_remote_cores_region_29=2 +dtm_flow_nof_remote_cores_region_30=2 +dtm_flow_nof_remote_cores_region_31=2 +dtm_flow_nof_remote_cores_region_32=2 +dtm_flow_nof_remote_cores_region_33=2 +dtm_flow_nof_remote_cores_region_34=2 +dtm_flow_nof_remote_cores_region_35=2 +dtm_flow_nof_remote_cores_region_36=2 +dtm_flow_nof_remote_cores_region_37=2 +dtm_flow_nof_remote_cores_region_38=2 +dtm_flow_nof_remote_cores_region_39=2 +dtm_flow_nof_remote_cores_region_40=2 +dtm_flow_nof_remote_cores_region_41=2 +dtm_flow_nof_remote_cores_region_42=2 +dtm_flow_nof_remote_cores_region_43=2 +dtm_flow_nof_remote_cores_region_44=2 +dtm_flow_nof_remote_cores_region_45=2 +dtm_flow_nof_remote_cores_region_46=2 +dtm_flow_nof_remote_cores_region_47=2 +dtm_flow_nof_remote_cores_region_48=2 +dtm_flow_nof_remote_cores_region_49=2 +dtm_flow_nof_remote_cores_region_50=2 +dtm_flow_nof_remote_cores_region_51=2 +dtm_flow_nof_remote_cores_region_52=2 +dtm_flow_nof_remote_cores_region_53=2 +dtm_flow_nof_remote_cores_region_54=2 +dtm_flow_nof_remote_cores_region_55=2 +dtm_flow_nof_remote_cores_region_56=2 +dtm_flow_nof_remote_cores_region_57=2 +dtm_flow_nof_remote_cores_region_58=2 +dtm_flow_nof_remote_cores_region_59=2 +dtm_flow_nof_remote_cores_region_60=2 + +### MDB configuration ### +mdb_profile=balanced-exem + +### Descriptor-DMA configuration ### +dma_desc_aggregator_chain_length_max=1000 +dma_desc_aggregator_buff_size_kb=100 +dma_desc_aggregator_timeout_usec=1000 +dma_desc_aggregator_enable_specific_MDB_LPM=1 +dma_desc_aggregator_enable_specific_MDB_FEC=1 + +### Outlif configuarion ### +outlif_logical_to_physical_phase_map_1=S1 +outlif_logical_to_physical_phase_map_2=L1 +outlif_logical_to_physical_phase_map_3=XL +outlif_logical_to_physical_phase_map_4=L2 +outlif_logical_to_physical_phase_map_5=M1 +outlif_logical_to_physical_phase_map_6=M2 +outlif_logical_to_physical_phase_map_7=M3 +outlif_logical_to_physical_phase_map_8=S2 + +### Outlif data granularity configuration ### +outlif_physical_phase_data_granularity_S1=60 +outlif_physical_phase_data_granularity_S2=60 +outlif_physical_phase_data_granularity_M1=60 +outlif_physical_phase_data_granularity_M2=60 +outlif_physical_phase_data_granularity_M3=60 +outlif_physical_phase_data_granularity_L1=60 +outlif_physical_phase_data_granularity_L2=60 +outlif_physical_phase_data_granularity_XL=60 + +### Fabric configuration ### +# Enable link-training +port_init_cl72_sfi=1 +serdes_lane_config_cl72_auto_polarity_en=0 +serdes_lane_config_cl72_auto_polarity_en_sfi=1 +serdes_lane_config_cl72_restart_timeout_en=0 + +#SFI speed rate +port_init_speed_fabric=53125 + +## Fabric transmission mode +# Set the Connect mode to the Fabric +# Options: FE - presence of a Fabric device (single stage) +# SINGLE_FAP - stand-alone device +# MESH - devices in Mesh +# Note: If 'diag_chassis' is on, value will be override in dnx.soc +# to be FE instead of SINGLE_FAP. +fabric_connect_mode=FE + +fabric_logical_port_base=512 + +# Fabric lane mapping +lane_to_serdes_map_fabric_lane0=rx0:tx0 +lane_to_serdes_map_fabric_lane1=rx1:tx1 +lane_to_serdes_map_fabric_lane2=rx2:tx2 +lane_to_serdes_map_fabric_lane3=rx3:tx3 +lane_to_serdes_map_fabric_lane4=rx4:tx4 +lane_to_serdes_map_fabric_lane5=rx5:tx5 +lane_to_serdes_map_fabric_lane6=rx6:tx6 +lane_to_serdes_map_fabric_lane7=rx7:tx7 +lane_to_serdes_map_fabric_lane8=rx8:tx10 +lane_to_serdes_map_fabric_lane9=rx9:tx11 +lane_to_serdes_map_fabric_lane10=rx10:tx9 +lane_to_serdes_map_fabric_lane11=rx11:tx8 +lane_to_serdes_map_fabric_lane12=rx12:tx12 +lane_to_serdes_map_fabric_lane13=rx13:tx15 +lane_to_serdes_map_fabric_lane14=rx14:tx14 +lane_to_serdes_map_fabric_lane15=rx15:tx13 +lane_to_serdes_map_fabric_lane16=rx16:tx17 +lane_to_serdes_map_fabric_lane17=rx17:tx18 +lane_to_serdes_map_fabric_lane18=rx18:tx16 +lane_to_serdes_map_fabric_lane19=rx19:tx19 +lane_to_serdes_map_fabric_lane20=rx20:tx21 +lane_to_serdes_map_fabric_lane21=rx21:tx23 +lane_to_serdes_map_fabric_lane22=rx22:tx20 +lane_to_serdes_map_fabric_lane23=rx23:tx22 +lane_to_serdes_map_fabric_lane24=rx24:tx26 +lane_to_serdes_map_fabric_lane25=rx25:tx24 +lane_to_serdes_map_fabric_lane26=rx26:tx25 +lane_to_serdes_map_fabric_lane27=rx27:tx27 +lane_to_serdes_map_fabric_lane28=rx28:tx31 +lane_to_serdes_map_fabric_lane29=rx29:tx30 +lane_to_serdes_map_fabric_lane30=rx30:tx29 +lane_to_serdes_map_fabric_lane31=rx31:tx28 +lane_to_serdes_map_fabric_lane32=rx32:tx32 +lane_to_serdes_map_fabric_lane33=rx33:tx33 +lane_to_serdes_map_fabric_lane34=rx34:tx34 +lane_to_serdes_map_fabric_lane35=rx35:tx35 +lane_to_serdes_map_fabric_lane36=rx36:tx36 +lane_to_serdes_map_fabric_lane37=rx37:tx37 +lane_to_serdes_map_fabric_lane38=rx38:tx38 +lane_to_serdes_map_fabric_lane39=rx39:tx39 +lane_to_serdes_map_fabric_lane40=rx40:tx43 +lane_to_serdes_map_fabric_lane41=rx41:tx42 +lane_to_serdes_map_fabric_lane42=rx42:tx41 +lane_to_serdes_map_fabric_lane43=rx43:tx40 +lane_to_serdes_map_fabric_lane44=rx44:tx47 +lane_to_serdes_map_fabric_lane45=rx45:tx46 +lane_to_serdes_map_fabric_lane46=rx46:tx45 +lane_to_serdes_map_fabric_lane47=rx47:tx44 +lane_to_serdes_map_fabric_lane48=rx48:tx48 +lane_to_serdes_map_fabric_lane49=rx49:tx49 +lane_to_serdes_map_fabric_lane50=rx50:tx50 +lane_to_serdes_map_fabric_lane51=rx51:tx51 +lane_to_serdes_map_fabric_lane52=rx52:tx52 +lane_to_serdes_map_fabric_lane53=rx53:tx53 +lane_to_serdes_map_fabric_lane54=rx54:tx54 +lane_to_serdes_map_fabric_lane55=rx55:tx55 +lane_to_serdes_map_fabric_lane56=rx56:tx59 +lane_to_serdes_map_fabric_lane57=rx57:tx58 +lane_to_serdes_map_fabric_lane58=rx58:tx57 +lane_to_serdes_map_fabric_lane59=rx59:tx56 +lane_to_serdes_map_fabric_lane60=rx60:tx63 +lane_to_serdes_map_fabric_lane61=rx61:tx62 +lane_to_serdes_map_fabric_lane62=rx62:tx61 +lane_to_serdes_map_fabric_lane63=rx63:tx60 +lane_to_serdes_map_fabric_lane64=rx64:tx64 +lane_to_serdes_map_fabric_lane65=rx65:tx65 +lane_to_serdes_map_fabric_lane66=rx66:tx66 +lane_to_serdes_map_fabric_lane67=rx67:tx67 +lane_to_serdes_map_fabric_lane68=rx68:tx68 +lane_to_serdes_map_fabric_lane69=rx69:tx69 +lane_to_serdes_map_fabric_lane70=rx70:tx70 +lane_to_serdes_map_fabric_lane71=rx71:tx71 +lane_to_serdes_map_fabric_lane72=rx72:tx75 +lane_to_serdes_map_fabric_lane73=rx73:tx74 +lane_to_serdes_map_fabric_lane74=rx74:tx73 +lane_to_serdes_map_fabric_lane75=rx75:tx72 +lane_to_serdes_map_fabric_lane76=rx76:tx79 +lane_to_serdes_map_fabric_lane77=rx77:tx78 +lane_to_serdes_map_fabric_lane78=rx78:tx77 +lane_to_serdes_map_fabric_lane79=rx79:tx76 +lane_to_serdes_map_fabric_lane80=rx80:tx80 +lane_to_serdes_map_fabric_lane81=rx81:tx81 +lane_to_serdes_map_fabric_lane82=rx82:tx83 +lane_to_serdes_map_fabric_lane83=rx83:tx82 +lane_to_serdes_map_fabric_lane84=rx84:tx85 +lane_to_serdes_map_fabric_lane85=rx85:tx86 +lane_to_serdes_map_fabric_lane86=rx86:tx84 +lane_to_serdes_map_fabric_lane87=rx87:tx87 +lane_to_serdes_map_fabric_lane88=rx88:tx90 +lane_to_serdes_map_fabric_lane89=rx89:tx88 +lane_to_serdes_map_fabric_lane90=rx90:tx91 +lane_to_serdes_map_fabric_lane91=rx91:tx89 +lane_to_serdes_map_fabric_lane92=rx92:tx93 +lane_to_serdes_map_fabric_lane93=rx93:tx92 +lane_to_serdes_map_fabric_lane94=rx94:tx94 +lane_to_serdes_map_fabric_lane95=rx95:tx95 +lane_to_serdes_map_fabric_lane96=rx96:tx96 +lane_to_serdes_map_fabric_lane97=rx97:tx97 +lane_to_serdes_map_fabric_lane98=rx98:tx98 +lane_to_serdes_map_fabric_lane99=rx99:tx99 +lane_to_serdes_map_fabric_lane100=rx100:tx100 +lane_to_serdes_map_fabric_lane101=rx101:tx101 +lane_to_serdes_map_fabric_lane102=rx102:tx102 +lane_to_serdes_map_fabric_lane103=rx103:tx103 +lane_to_serdes_map_fabric_lane104=rx104:tx105 +lane_to_serdes_map_fabric_lane105=rx105:tx106 +lane_to_serdes_map_fabric_lane106=rx106:tx107 +lane_to_serdes_map_fabric_lane107=rx107:tx104 +lane_to_serdes_map_fabric_lane108=rx108:tx111 +lane_to_serdes_map_fabric_lane109=rx109:tx109 +lane_to_serdes_map_fabric_lane110=rx110:tx110 +lane_to_serdes_map_fabric_lane111=rx111:tx108 +lane_to_serdes_map_fabric_lane112=rx112:tx114 +lane_to_serdes_map_fabric_lane113=rx113:tx113 +lane_to_serdes_map_fabric_lane114=rx114:tx112 +lane_to_serdes_map_fabric_lane115=rx115:tx115 +lane_to_serdes_map_fabric_lane116=rx116:tx117 +lane_to_serdes_map_fabric_lane117=rx117:tx116 +lane_to_serdes_map_fabric_lane118=rx118:tx119 +lane_to_serdes_map_fabric_lane119=rx119:tx118 +lane_to_serdes_map_fabric_lane120=rx120:tx123 +lane_to_serdes_map_fabric_lane121=rx121:tx120 +lane_to_serdes_map_fabric_lane122=rx122:tx122 +lane_to_serdes_map_fabric_lane123=rx123:tx121 +lane_to_serdes_map_fabric_lane124=rx124:tx127 +lane_to_serdes_map_fabric_lane125=rx125:tx125 +lane_to_serdes_map_fabric_lane126=rx126:tx124 +lane_to_serdes_map_fabric_lane127=rx127:tx126 +lane_to_serdes_map_fabric_lane128=rx128:tx128 +lane_to_serdes_map_fabric_lane129=rx129:tx129 +lane_to_serdes_map_fabric_lane130=rx130:tx130 +lane_to_serdes_map_fabric_lane131=rx131:tx131 +lane_to_serdes_map_fabric_lane132=rx132:tx132 +lane_to_serdes_map_fabric_lane133=rx133:tx133 +lane_to_serdes_map_fabric_lane134=rx134:tx134 +lane_to_serdes_map_fabric_lane135=rx135:tx135 +lane_to_serdes_map_fabric_lane136=rx136:tx139 +lane_to_serdes_map_fabric_lane137=rx137:tx138 +lane_to_serdes_map_fabric_lane138=rx138:tx137 +lane_to_serdes_map_fabric_lane139=rx139:tx136 +lane_to_serdes_map_fabric_lane140=rx140:tx140 +lane_to_serdes_map_fabric_lane141=rx141:tx142 +lane_to_serdes_map_fabric_lane142=rx142:tx141 +lane_to_serdes_map_fabric_lane143=rx143:tx143 +lane_to_serdes_map_fabric_lane144=rx144:tx144 +lane_to_serdes_map_fabric_lane145=rx145:tx145 +lane_to_serdes_map_fabric_lane146=rx146:tx146 +lane_to_serdes_map_fabric_lane147=rx147:tx147 +lane_to_serdes_map_fabric_lane148=rx148:tx148 +lane_to_serdes_map_fabric_lane149=rx149:tx149 +lane_to_serdes_map_fabric_lane150=rx150:tx150 +lane_to_serdes_map_fabric_lane151=rx151:tx151 +lane_to_serdes_map_fabric_lane152=rx152:tx155 +lane_to_serdes_map_fabric_lane153=rx153:tx154 +lane_to_serdes_map_fabric_lane154=rx154:tx153 +lane_to_serdes_map_fabric_lane155=rx155:tx152 +lane_to_serdes_map_fabric_lane156=rx156:tx159 +lane_to_serdes_map_fabric_lane157=rx157:tx158 +lane_to_serdes_map_fabric_lane158=rx158:tx157 +lane_to_serdes_map_fabric_lane159=rx159:tx156 +lane_to_serdes_map_fabric_lane160=rx160:tx160 +lane_to_serdes_map_fabric_lane161=rx161:tx161 +lane_to_serdes_map_fabric_lane162=rx162:tx162 +lane_to_serdes_map_fabric_lane163=rx163:tx163 +lane_to_serdes_map_fabric_lane164=rx164:tx164 +lane_to_serdes_map_fabric_lane165=rx165:tx165 +lane_to_serdes_map_fabric_lane166=rx166:tx166 +lane_to_serdes_map_fabric_lane167=rx167:tx167 +lane_to_serdes_map_fabric_lane168=rx168:tx171 +lane_to_serdes_map_fabric_lane169=rx169:tx170 +lane_to_serdes_map_fabric_lane170=rx170:tx169 +lane_to_serdes_map_fabric_lane171=rx171:tx168 +lane_to_serdes_map_fabric_lane172=rx172:tx175 +lane_to_serdes_map_fabric_lane173=rx173:tx174 +lane_to_serdes_map_fabric_lane174=rx174:tx173 +lane_to_serdes_map_fabric_lane175=rx175:tx172 +lane_to_serdes_map_fabric_lane176=rx176:tx176 +lane_to_serdes_map_fabric_lane177=rx177:tx177 +lane_to_serdes_map_fabric_lane178=rx178:tx179 +lane_to_serdes_map_fabric_lane179=rx179:tx178 +lane_to_serdes_map_fabric_lane180=rx180:tx181 +lane_to_serdes_map_fabric_lane181=rx181:tx182 +lane_to_serdes_map_fabric_lane182=rx182:tx180 +lane_to_serdes_map_fabric_lane183=rx183:tx183 +lane_to_serdes_map_fabric_lane184=rx184:tx186 +lane_to_serdes_map_fabric_lane185=rx185:tx184 +lane_to_serdes_map_fabric_lane186=rx186:tx185 +lane_to_serdes_map_fabric_lane187=rx187:tx187 +lane_to_serdes_map_fabric_lane188=rx188:tx188 +lane_to_serdes_map_fabric_lane189=rx189:tx189 +lane_to_serdes_map_fabric_lane190=rx190:tx190 +lane_to_serdes_map_fabric_lane191=rx191:tx191 + +# +##Protocol trap look-up mode: +# Options: IN_LIF - Look-ups in the profile table are done by IN-LIF +# IN_PORT - Look-ups in the profile table are done by IN-PORT +protocol_traps_mode=IN_LIF + +# access definitions +schan_intr_enable=0 +tdma_intr_enable=0 +tslam_intr_enable=0 +miim_intr_enable=0 +schan_timeout_usec=300000 +tdma_timeout_usec=1000000 +tslam_timeout_usec=1000000 + +### Interrupts +appl_enable_intr_init=1 +polled_irq_mode=1 +# reduce CPU load, configure delay 100ms +polled_irq_delay=1000 + +# reduce the CPU load over adapter (caused by counter thread) +bcm_stat_interval=1000 + +# shadow memory +mem_cache_enable_ecc=1 +mem_cache_enable_parity=1 + +# serdes_nif/fabric_clk_freq_in/out configuration +serdes_nif_clk_freq_in=2 +serdes_nif_clk_freq_out=1 +serdes_fabric_clk_freq_in=2 +serdes_fabric_clk_freq_out=1 + +dport_map_direct=1 + +rif_id_max=0x6000 + +phy_rx_polarity_flip_phy0=0 +phy_rx_polarity_flip_phy1=0 +phy_rx_polarity_flip_phy2=0 +phy_rx_polarity_flip_phy3=0 +phy_rx_polarity_flip_phy4=0 +phy_rx_polarity_flip_phy5=0 +phy_rx_polarity_flip_phy6=0 +phy_rx_polarity_flip_phy7=0 +phy_rx_polarity_flip_phy8=1 +phy_rx_polarity_flip_phy9=1 +phy_rx_polarity_flip_phy10=0 +phy_rx_polarity_flip_phy11=0 +phy_rx_polarity_flip_phy12=1 +phy_rx_polarity_flip_phy13=1 +phy_rx_polarity_flip_phy14=0 +phy_rx_polarity_flip_phy15=1 +phy_rx_polarity_flip_phy16=0 +phy_rx_polarity_flip_phy17=0 +phy_rx_polarity_flip_phy18=0 +phy_rx_polarity_flip_phy19=0 +phy_rx_polarity_flip_phy20=0 +phy_rx_polarity_flip_phy21=0 +phy_rx_polarity_flip_phy22=0 +phy_rx_polarity_flip_phy23=0 +phy_rx_polarity_flip_phy24=0 +phy_rx_polarity_flip_phy25=0 +phy_rx_polarity_flip_phy26=0 +phy_rx_polarity_flip_phy27=0 +phy_rx_polarity_flip_phy28=0 +phy_rx_polarity_flip_phy29=0 +phy_rx_polarity_flip_phy30=0 +phy_rx_polarity_flip_phy31=0 +phy_rx_polarity_flip_phy32=0 +phy_rx_polarity_flip_phy33=0 +phy_rx_polarity_flip_phy34=0 +phy_rx_polarity_flip_phy35=0 +phy_rx_polarity_flip_phy36=0 +phy_rx_polarity_flip_phy37=0 +phy_rx_polarity_flip_phy38=0 +phy_rx_polarity_flip_phy39=0 +phy_rx_polarity_flip_phy40=0 +phy_rx_polarity_flip_phy41=0 +phy_rx_polarity_flip_phy42=0 +phy_rx_polarity_flip_phy43=0 +phy_rx_polarity_flip_phy44=0 +phy_rx_polarity_flip_phy45=0 +phy_rx_polarity_flip_phy46=0 +phy_rx_polarity_flip_phy47=0 +phy_rx_polarity_flip_phy48=0 +phy_rx_polarity_flip_phy49=0 +phy_rx_polarity_flip_phy50=0 +phy_rx_polarity_flip_phy51=0 +phy_rx_polarity_flip_phy52=0 +phy_rx_polarity_flip_phy53=0 +phy_rx_polarity_flip_phy54=0 +phy_rx_polarity_flip_phy55=0 +phy_rx_polarity_flip_phy56=0 +phy_rx_polarity_flip_phy57=0 +phy_rx_polarity_flip_phy58=0 +phy_rx_polarity_flip_phy59=0 +phy_rx_polarity_flip_phy60=0 +phy_rx_polarity_flip_phy61=0 +phy_rx_polarity_flip_phy62=0 +phy_rx_polarity_flip_phy63=0 +phy_rx_polarity_flip_phy64=0 +phy_rx_polarity_flip_phy65=0 +phy_rx_polarity_flip_phy66=0 +phy_rx_polarity_flip_phy67=0 +phy_rx_polarity_flip_phy68=0 +phy_rx_polarity_flip_phy69=0 +phy_rx_polarity_flip_phy70=0 +phy_rx_polarity_flip_phy71=0 +phy_rx_polarity_flip_phy72=1 +phy_rx_polarity_flip_phy73=1 +phy_rx_polarity_flip_phy74=0 +phy_rx_polarity_flip_phy75=1 +phy_rx_polarity_flip_phy76=1 +phy_rx_polarity_flip_phy77=1 +phy_rx_polarity_flip_phy78=1 +phy_rx_polarity_flip_phy79=1 +phy_rx_polarity_flip_phy80=0 +phy_rx_polarity_flip_phy81=0 +phy_rx_polarity_flip_phy82=0 +phy_rx_polarity_flip_phy83=0 +phy_rx_polarity_flip_phy84=0 +phy_rx_polarity_flip_phy85=0 +phy_rx_polarity_flip_phy86=0 +phy_rx_polarity_flip_phy87=0 +phy_rx_polarity_flip_phy88=0 +phy_rx_polarity_flip_phy89=0 +phy_rx_polarity_flip_phy90=0 +phy_rx_polarity_flip_phy91=0 +phy_rx_polarity_flip_phy92=0 +phy_rx_polarity_flip_phy93=0 +phy_rx_polarity_flip_phy94=0 +phy_rx_polarity_flip_phy95=0 +phy_rx_polarity_flip_phy96=0 +phy_rx_polarity_flip_phy97=0 +phy_rx_polarity_flip_phy98=0 +phy_rx_polarity_flip_phy99=0 +phy_rx_polarity_flip_phy100=0 +phy_rx_polarity_flip_phy101=0 +phy_rx_polarity_flip_phy102=0 +phy_rx_polarity_flip_phy103=0 +phy_rx_polarity_flip_phy104=0 +phy_rx_polarity_flip_phy105=0 +phy_rx_polarity_flip_phy106=0 +phy_rx_polarity_flip_phy107=0 +phy_rx_polarity_flip_phy108=0 +phy_rx_polarity_flip_phy109=0 +phy_rx_polarity_flip_phy110=0 +phy_rx_polarity_flip_phy111=0 +phy_rx_polarity_flip_phy112=0 +phy_rx_polarity_flip_phy113=0 +phy_rx_polarity_flip_phy114=0 +phy_rx_polarity_flip_phy115=0 +phy_rx_polarity_flip_phy116=0 +phy_rx_polarity_flip_phy117=0 +phy_rx_polarity_flip_phy118=0 +phy_rx_polarity_flip_phy119=0 +phy_rx_polarity_flip_phy120=0 +phy_rx_polarity_flip_phy121=0 +phy_rx_polarity_flip_phy122=0 +phy_rx_polarity_flip_phy123=0 +phy_rx_polarity_flip_phy124=0 +phy_rx_polarity_flip_phy125=0 +phy_rx_polarity_flip_phy126=0 +phy_rx_polarity_flip_phy127=0 +phy_rx_polarity_flip_phy128=0 +phy_rx_polarity_flip_phy129=0 +phy_rx_polarity_flip_phy130=0 +phy_rx_polarity_flip_phy131=0 +phy_rx_polarity_flip_phy132=0 +phy_rx_polarity_flip_phy133=0 +phy_rx_polarity_flip_phy134=0 +phy_rx_polarity_flip_phy135=0 +phy_rx_polarity_flip_phy136=0 +phy_rx_polarity_flip_phy137=0 +phy_rx_polarity_flip_phy138=0 +phy_rx_polarity_flip_phy139=0 +phy_rx_polarity_flip_phy140=0 +phy_rx_polarity_flip_phy141=0 +phy_rx_polarity_flip_phy142=0 +phy_rx_polarity_flip_phy143=0 +phy_tx_polarity_flip_phy0=1 +phy_tx_polarity_flip_phy1=1 +phy_tx_polarity_flip_phy2=1 +phy_tx_polarity_flip_phy3=1 +phy_tx_polarity_flip_phy4=1 +phy_tx_polarity_flip_phy5=1 +phy_tx_polarity_flip_phy6=1 +phy_tx_polarity_flip_phy7=1 +phy_tx_polarity_flip_phy8=1 +phy_tx_polarity_flip_phy9=1 +phy_tx_polarity_flip_phy10=1 +phy_tx_polarity_flip_phy11=1 +phy_tx_polarity_flip_phy12=1 +phy_tx_polarity_flip_phy13=1 +phy_tx_polarity_flip_phy14=1 +phy_tx_polarity_flip_phy15=1 +phy_tx_polarity_flip_phy16=1 +phy_tx_polarity_flip_phy17=1 +phy_tx_polarity_flip_phy18=1 +phy_tx_polarity_flip_phy19=1 +phy_tx_polarity_flip_phy20=1 +phy_tx_polarity_flip_phy21=1 +phy_tx_polarity_flip_phy22=1 +phy_tx_polarity_flip_phy23=1 +phy_tx_polarity_flip_phy24=1 +phy_tx_polarity_flip_phy25=1 +phy_tx_polarity_flip_phy26=1 +phy_tx_polarity_flip_phy27=1 +phy_tx_polarity_flip_phy28=1 +phy_tx_polarity_flip_phy29=1 +phy_tx_polarity_flip_phy30=1 +phy_tx_polarity_flip_phy31=1 +phy_tx_polarity_flip_phy32=1 +phy_tx_polarity_flip_phy33=1 +phy_tx_polarity_flip_phy34=1 +phy_tx_polarity_flip_phy35=1 +phy_tx_polarity_flip_phy36=1 +phy_tx_polarity_flip_phy37=1 +phy_tx_polarity_flip_phy38=1 +phy_tx_polarity_flip_phy39=1 +phy_tx_polarity_flip_phy40=1 +phy_tx_polarity_flip_phy41=1 +phy_tx_polarity_flip_phy42=1 +phy_tx_polarity_flip_phy43=1 +phy_tx_polarity_flip_phy44=1 +phy_tx_polarity_flip_phy45=1 +phy_tx_polarity_flip_phy46=1 +phy_tx_polarity_flip_phy47=1 +phy_tx_polarity_flip_phy48=1 +phy_tx_polarity_flip_phy49=1 +phy_tx_polarity_flip_phy50=1 +phy_tx_polarity_flip_phy51=1 +phy_tx_polarity_flip_phy52=1 +phy_tx_polarity_flip_phy53=1 +phy_tx_polarity_flip_phy54=1 +phy_tx_polarity_flip_phy55=1 +phy_tx_polarity_flip_phy56=1 +phy_tx_polarity_flip_phy57=1 +phy_tx_polarity_flip_phy58=1 +phy_tx_polarity_flip_phy59=1 +phy_tx_polarity_flip_phy60=1 +phy_tx_polarity_flip_phy61=1 +phy_tx_polarity_flip_phy62=1 +phy_tx_polarity_flip_phy63=1 +phy_tx_polarity_flip_phy64=1 +phy_tx_polarity_flip_phy65=1 +phy_tx_polarity_flip_phy66=1 +phy_tx_polarity_flip_phy67=1 +phy_tx_polarity_flip_phy68=1 +phy_tx_polarity_flip_phy69=1 +phy_tx_polarity_flip_phy70=1 +phy_tx_polarity_flip_phy71=1 +phy_tx_polarity_flip_phy72=0 +phy_tx_polarity_flip_phy73=0 +phy_tx_polarity_flip_phy74=0 +phy_tx_polarity_flip_phy75=0 +phy_tx_polarity_flip_phy76=0 +phy_tx_polarity_flip_phy77=0 +phy_tx_polarity_flip_phy78=0 +phy_tx_polarity_flip_phy79=0 +phy_tx_polarity_flip_phy80=0 +phy_tx_polarity_flip_phy81=0 +phy_tx_polarity_flip_phy82=0 +phy_tx_polarity_flip_phy83=0 +phy_tx_polarity_flip_phy84=0 +phy_tx_polarity_flip_phy85=0 +phy_tx_polarity_flip_phy86=0 +phy_tx_polarity_flip_phy87=0 +phy_tx_polarity_flip_phy88=1 +phy_tx_polarity_flip_phy89=1 +phy_tx_polarity_flip_phy90=1 +phy_tx_polarity_flip_phy91=1 +phy_tx_polarity_flip_phy92=1 +phy_tx_polarity_flip_phy93=1 +phy_tx_polarity_flip_phy94=1 +phy_tx_polarity_flip_phy95=1 +phy_tx_polarity_flip_phy96=1 +phy_tx_polarity_flip_phy97=1 +phy_tx_polarity_flip_phy98=1 +phy_tx_polarity_flip_phy99=1 +phy_tx_polarity_flip_phy100=1 +phy_tx_polarity_flip_phy101=1 +phy_tx_polarity_flip_phy102=1 +phy_tx_polarity_flip_phy103=1 +phy_tx_polarity_flip_phy104=1 +phy_tx_polarity_flip_phy105=1 +phy_tx_polarity_flip_phy106=1 +phy_tx_polarity_flip_phy107=1 +phy_tx_polarity_flip_phy108=1 +phy_tx_polarity_flip_phy109=1 +phy_tx_polarity_flip_phy110=1 +phy_tx_polarity_flip_phy111=1 +phy_tx_polarity_flip_phy112=1 +phy_tx_polarity_flip_phy113=1 +phy_tx_polarity_flip_phy114=1 +phy_tx_polarity_flip_phy115=1 +phy_tx_polarity_flip_phy116=1 +phy_tx_polarity_flip_phy117=1 +phy_tx_polarity_flip_phy118=1 +phy_tx_polarity_flip_phy119=1 +phy_tx_polarity_flip_phy120=1 +phy_tx_polarity_flip_phy121=1 +phy_tx_polarity_flip_phy122=1 +phy_tx_polarity_flip_phy123=1 +phy_tx_polarity_flip_phy124=1 +phy_tx_polarity_flip_phy125=1 +phy_tx_polarity_flip_phy126=1 +phy_tx_polarity_flip_phy127=1 +phy_tx_polarity_flip_phy128=1 +phy_tx_polarity_flip_phy129=1 +phy_tx_polarity_flip_phy130=1 +phy_tx_polarity_flip_phy131=1 +phy_tx_polarity_flip_phy132=1 +phy_tx_polarity_flip_phy133=1 +phy_tx_polarity_flip_phy134=1 +phy_tx_polarity_flip_phy135=1 +phy_tx_polarity_flip_phy136=1 +phy_tx_polarity_flip_phy137=1 +phy_tx_polarity_flip_phy138=1 +phy_tx_polarity_flip_phy139=1 +phy_tx_polarity_flip_phy140=1 +phy_tx_polarity_flip_phy141=1 +phy_tx_polarity_flip_phy142=1 +phy_tx_polarity_flip_phy143=1 + +serdes_tx_taps_1=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_2=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_3=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_4=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_5=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_6=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_7=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_8=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_9=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_10=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_11=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_12=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_13=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_14=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_15=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_16=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_17=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_18=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_19=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_20=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_21=nrz:-4:75:-21:0:0:0 +serdes_tx_taps_22=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_23=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_24=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_25=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_26=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_27=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_28=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_29=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_30=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_31=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_32=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_33=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_34=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_35=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_36=nrz:-7:85:-25:0:0:0 + +xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 +xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=2 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/port_config.ini b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/port_config.ini new file mode 100644 index 00000000000..f77f5b35172 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/port_config.ini @@ -0,0 +1,21 @@ +# name lanes alias index role speed asic_port_name coreId corePortId numVoq +Ethernet144 72,73,74,75 Ethernet19/1 21 Ext 100000 Eth0-ASIC1 1 1 8 +Ethernet152 80,81,82,83 Ethernet20/1 22 Ext 100000 Eth8-ASIC1 1 2 8 +Ethernet160 88,89,90,91 Ethernet21/1 23 Ext 100000 Eth16-ASIC1 1 3 8 +Ethernet168 96,97,98,99 Ethernet22/1 24 Ext 100000 Eth24-ASIC1 1 4 8 +Ethernet176 104,105,106,107 Ethernet23/1 25 Ext 100000 Eth32-ASIC1 1 5 8 +Ethernet184 112,113,114,115 Ethernet24/1 26 Ext 100000 Eth40-ASIC1 1 6 8 +Ethernet192 120,121,122,123 Ethernet25/1 27 Ext 100000 Eth48-ASIC1 1 7 8 +Ethernet200 128,129,130,131 Ethernet26/1 28 Ext 100000 Eth56-ASIC1 1 8 8 +Ethernet208 136,137,138,139 Ethernet27/1 29 Ext 100000 Eth64-ASIC1 1 9 8 +Ethernet216 64,65,66,67 Ethernet28/1 30 Ext 100000 Eth72-ASIC1 0 10 8 +Ethernet224 56,57,58,59 Ethernet29/1 31 Ext 100000 Eth80-ASIC1 0 11 8 +Ethernet232 48,49,50,51 Ethernet30/1 32 Ext 100000 Eth88-ASIC1 0 12 8 +Ethernet240 40,41,42,43 Ethernet31/1 33 Ext 100000 Eth96-ASIC1 0 13 8 +Ethernet248 32,33,34,35 Ethernet32/1 34 Ext 100000 Eth104-ASIC1 0 14 8 +Ethernet256 24,25,26,27 Ethernet33/1 35 Ext 100000 Eth112-ASIC1 0 15 8 +Ethernet264 16,17,18,19 Ethernet34/1 36 Ext 100000 Eth120-ASIC1 0 16 8 +Ethernet272 8,9,10,11 Ethernet35/1 37 Ext 100000 Eth128-ASIC1 0 17 8 +Ethernet280 0,1,2,3 Ethernet36/1 38 Ext 100000 Eth136-ASIC1 0 18 8 +Ethernet-Rec1 221 Recirc0/0 39 Rec 400000 Rcy0-ASIC1 0 221 8 +Ethernet-IB1 222 Recirc0/1 40 Inb 400000 Rcy1-ASIC1 1 222 8 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/sai.profile b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/sai.profile new file mode 120000 index 00000000000..1e172f3e076 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C36/1/sai.profile @@ -0,0 +1 @@ +../0/sai.profile \ No newline at end of file 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 e32603e1da0..99dfb9e3e26 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 @@ -1001,3 +1001,4 @@ serdes_tx_taps_36=nrz:-8:89:-29:0:0:0 xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 +sai_pfc_dlr_init_capability=0 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 c2a1d4229f2..bccc2d5be9f 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 @@ -1000,3 +1000,4 @@ serdes_tx_taps_36=nrz:-7:85:-25:0:0:0 xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 +sai_pfc_dlr_init_capability=0 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/buffers.json.j2 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/buffers.json.j2 new file mode 100644 index 00000000000..f34a844f4a8 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't2' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/buffers_defaults_t2.j2 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/buffers_defaults_t2.j2 new file mode 100644 index 00000000000..e7af0aff493 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/buffers_defaults_t2.j2 @@ -0,0 +1,37 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,144,8) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "6441610000", + "type": "both", + "mode": "dynamic", + "xoff": "11354112" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"1280", + "xon_offset": "2560", + "dynamic_th":"0" + }, + "egress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-1" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/context_config.json b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/context_config.json new file mode 100644 index 00000000000..2c126e71899 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/context_config.json @@ -0,0 +1,25 @@ +{ + "CONTEXTS": [ + { + "guid" : 0, + "name" : "syncd", + "dbAsic" : "ASIC_DB", + "dbCounters" : "COUNTERS_DB", + "dbFlex": "FLEX_COUNTER_DB", + "dbState" : "STATE_DB", + "zmq_enable": false, + "zmq_endpoint": "tcp://127.0.0.1:5555", + "zmq_ntf_endpoint": "tcp://127.0.0.1:5556", + "switches": [ + { + "index" : 0, + "hwinfo" : "06:00.0" + }, + { + "index" : 1, + "hwinfo" : "07:00.0" + } + ] + } + ] +} 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 new file mode 100644 index 00000000000..62fe61d49c9 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -0,0 +1,1022 @@ +soc_family=BCM8885X +system_ref_core_clock_khz=1600000 + +dpp_db_path=/usr/share/bcm/db + +#################################################### +##Reference applications related properties - Start +#################################################### + +## PMF small EXEM connected stage: +# Options: IPMF2 - Ingress PMF 2 stage can perform small EXEM lookups. +# IPMF3 - Ingress PMF 3 stage can perform small EXEM lookups. +## PMF small EXEM connected stage: +# Options: IPMF2 - Ingress PMF 2 stage can perform small EXEM lookups. +# IPMF3 - Ingress PMF 3 stage can perform small EXEM lookups. +pmf_sexem3_stage=IPMF2 + +#################################################### +##Reference applications related properties - End +#################################################### + +# Jericho2-mode (description 0x1 used for Jericho 2 mode) +system_headers_mode=1 + +# HW mode to support 1024 16-member system wide LAGs +trunk_group_max_members=16 + +# Disable link-training +port_init_cl72=0 + +###Default interfaces for Jericho2Plus +#CPU interfaces +ucode_port_0=CPU.0:core_0.0 +ucode_port_200=CPU.8:core_1.200 +ucode_port_201=CPU.16:core_0.201 +ucode_port_202=CPU.24:core_1.202 +ucode_port_203=CPU.32:core_0.203 + +#NIF ETH interfaces on device +ucode_port_1=CDGE9:core_1.1 +ucode_port_2=CDGE10:core_1.2 +ucode_port_3=CDGE11:core_1.3 +ucode_port_4=CDGE12:core_1.4 +ucode_port_5=CDGE13:core_1.5 +ucode_port_6=CDGE14:core_1.6 +ucode_port_7=CDGE15:core_1.7 +ucode_port_8=CDGE16:core_1.8 +ucode_port_9=CDGE17:core_1.9 + +ucode_port_10=CDGE8:core_0.10 +ucode_port_11=CDGE7:core_0.11 +ucode_port_12=CDGE6:core_0.12 +ucode_port_13=CDGE5:core_0.13 +ucode_port_14=CDGE4:core_0.14 +ucode_port_15=CDGE3:core_0.15 +ucode_port_16=CDGE2:core_0.16 +ucode_port_17=CDGE1:core_0.17 +ucode_port_18=CDGE0:core_0.18 + +#NIF default speeds +port_init_speed_xe=10000 +port_init_speed_xl=40000 +port_init_speed_le=50000 +port_init_speed_ce=100000 +port_init_speed_cc=200000 +port_init_speed_cd=400000 +port_init_speed_il=10312 + +port_priorities=8 + +#special ports +ucode_port_240=OLP:core_0.240 + +# NIF lane mapping +lane_to_serdes_map_nif_lane0=rx3:tx4 +lane_to_serdes_map_nif_lane1=rx6:tx1 +lane_to_serdes_map_nif_lane2=rx7:tx5 +lane_to_serdes_map_nif_lane3=rx4:tx7 +lane_to_serdes_map_nif_lane4=rx1:tx2 +lane_to_serdes_map_nif_lane5=rx0:tx0 +lane_to_serdes_map_nif_lane6=rx5:tx3 +lane_to_serdes_map_nif_lane7=rx2:tx6 +lane_to_serdes_map_nif_lane8=rx10:tx11 +lane_to_serdes_map_nif_lane9=rx8:tx8 +lane_to_serdes_map_nif_lane10=rx14:tx12 +lane_to_serdes_map_nif_lane11=rx15:tx15 +lane_to_serdes_map_nif_lane12=rx13:tx10 +lane_to_serdes_map_nif_lane13=rx9:tx9 +lane_to_serdes_map_nif_lane14=rx11:tx13 +lane_to_serdes_map_nif_lane15=rx12:tx14 +lane_to_serdes_map_nif_lane16=rx16:tx17 +lane_to_serdes_map_nif_lane17=rx19:tx21 +lane_to_serdes_map_nif_lane18=rx21:tx18 +lane_to_serdes_map_nif_lane19=rx18:tx16 +lane_to_serdes_map_nif_lane20=rx17:tx23 +lane_to_serdes_map_nif_lane21=rx20:tx22 +lane_to_serdes_map_nif_lane22=rx22:tx20 +lane_to_serdes_map_nif_lane23=rx23:tx19 +lane_to_serdes_map_nif_lane24=rx26:tx28 +lane_to_serdes_map_nif_lane25=rx29:tx31 +lane_to_serdes_map_nif_lane26=rx31:tx29 +lane_to_serdes_map_nif_lane27=rx28:tx27 +lane_to_serdes_map_nif_lane28=rx25:tx25 +lane_to_serdes_map_nif_lane29=rx24:tx30 +lane_to_serdes_map_nif_lane30=rx30:tx24 +lane_to_serdes_map_nif_lane31=rx27:tx26 +lane_to_serdes_map_nif_lane32=rx32:tx39 +lane_to_serdes_map_nif_lane33=rx33:tx38 +lane_to_serdes_map_nif_lane34=rx38:tx32 +lane_to_serdes_map_nif_lane35=rx39:tx33 +lane_to_serdes_map_nif_lane36=rx35:tx37 +lane_to_serdes_map_nif_lane37=rx34:tx36 +lane_to_serdes_map_nif_lane38=rx36:tx34 +lane_to_serdes_map_nif_lane39=rx37:tx35 +lane_to_serdes_map_nif_lane40=rx40:tx41 +lane_to_serdes_map_nif_lane41=rx43:tx45 +lane_to_serdes_map_nif_lane42=rx45:tx42 +lane_to_serdes_map_nif_lane43=rx42:tx40 +lane_to_serdes_map_nif_lane44=rx41:tx47 +lane_to_serdes_map_nif_lane45=rx44:tx46 +lane_to_serdes_map_nif_lane46=rx46:tx44 +lane_to_serdes_map_nif_lane47=rx47:tx43 +lane_to_serdes_map_nif_lane48=rx50:tx52 +lane_to_serdes_map_nif_lane49=rx53:tx55 +lane_to_serdes_map_nif_lane50=rx55:tx53 +lane_to_serdes_map_nif_lane51=rx52:tx51 +lane_to_serdes_map_nif_lane52=rx49:tx49 +lane_to_serdes_map_nif_lane53=rx48:tx54 +lane_to_serdes_map_nif_lane54=rx54:tx48 +lane_to_serdes_map_nif_lane55=rx51:tx50 +lane_to_serdes_map_nif_lane56=rx56:tx63 +lane_to_serdes_map_nif_lane57=rx57:tx62 +lane_to_serdes_map_nif_lane58=rx62:tx56 +lane_to_serdes_map_nif_lane59=rx63:tx57 +lane_to_serdes_map_nif_lane60=rx59:tx61 +lane_to_serdes_map_nif_lane61=rx58:tx60 +lane_to_serdes_map_nif_lane62=rx60:tx58 +lane_to_serdes_map_nif_lane63=rx61:tx59 +lane_to_serdes_map_nif_lane64=rx64:tx65 +lane_to_serdes_map_nif_lane65=rx67:tx69 +lane_to_serdes_map_nif_lane66=rx69:tx66 +lane_to_serdes_map_nif_lane67=rx66:tx64 +lane_to_serdes_map_nif_lane68=rx65:tx71 +lane_to_serdes_map_nif_lane69=rx68:tx70 +lane_to_serdes_map_nif_lane70=rx70:tx68 +lane_to_serdes_map_nif_lane71=rx71:tx67 +lane_to_serdes_map_nif_lane72=rx79:tx74 +lane_to_serdes_map_nif_lane73=rx76:tx75 +lane_to_serdes_map_nif_lane74=rx72:tx76 +lane_to_serdes_map_nif_lane75=rx74:tx73 +lane_to_serdes_map_nif_lane76=rx77:tx79 +lane_to_serdes_map_nif_lane77=rx78:tx78 +lane_to_serdes_map_nif_lane78=rx73:tx77 +lane_to_serdes_map_nif_lane79=rx75:tx72 +lane_to_serdes_map_nif_lane80=rx86:tx86 +lane_to_serdes_map_nif_lane81=rx83:tx87 +lane_to_serdes_map_nif_lane82=rx82:tx81 +lane_to_serdes_map_nif_lane83=rx85:tx80 +lane_to_serdes_map_nif_lane84=rx87:tx85 +lane_to_serdes_map_nif_lane85=rx84:tx84 +lane_to_serdes_map_nif_lane86=rx80:tx82 +lane_to_serdes_map_nif_lane87=rx81:tx83 +lane_to_serdes_map_nif_lane88=rx95:tx90 +lane_to_serdes_map_nif_lane89=rx92:tx88 +lane_to_serdes_map_nif_lane90=rx88:tx92 +lane_to_serdes_map_nif_lane91=rx91:tx95 +lane_to_serdes_map_nif_lane92=rx94:tx89 +lane_to_serdes_map_nif_lane93=rx93:tx91 +lane_to_serdes_map_nif_lane94=rx89:tx93 +lane_to_serdes_map_nif_lane95=rx90:tx94 +lane_to_serdes_map_nif_lane96=rx103:tx97 +lane_to_serdes_map_nif_lane97=rx100:tx96 +lane_to_serdes_map_nif_lane98=rx96:tx100 +lane_to_serdes_map_nif_lane99=rx99:tx103 +lane_to_serdes_map_nif_lane100=rx102:tx99 +lane_to_serdes_map_nif_lane101=rx101:tx98 +lane_to_serdes_map_nif_lane102=rx97:tx101 +lane_to_serdes_map_nif_lane103=rx98:tx102 +lane_to_serdes_map_nif_lane104=rx110:tx107 +lane_to_serdes_map_nif_lane105=rx108:tx105 +lane_to_serdes_map_nif_lane106=rx104:tx108 +lane_to_serdes_map_nif_lane107=rx107:tx110 +lane_to_serdes_map_nif_lane108=rx111:tx106 +lane_to_serdes_map_nif_lane109=rx109:tx104 +lane_to_serdes_map_nif_lane110=rx105:tx109 +lane_to_serdes_map_nif_lane111=rx106:tx111 +lane_to_serdes_map_nif_lane112=rx119:tx114 +lane_to_serdes_map_nif_lane113=rx116:tx112 +lane_to_serdes_map_nif_lane114=rx112:tx116 +lane_to_serdes_map_nif_lane115=rx115:tx119 +lane_to_serdes_map_nif_lane116=rx118:tx113 +lane_to_serdes_map_nif_lane117=rx117:tx115 +lane_to_serdes_map_nif_lane118=rx113:tx117 +lane_to_serdes_map_nif_lane119=rx114:tx118 +lane_to_serdes_map_nif_lane120=rx127:tx121 +lane_to_serdes_map_nif_lane121=rx124:tx120 +lane_to_serdes_map_nif_lane122=rx120:tx124 +lane_to_serdes_map_nif_lane123=rx123:tx127 +lane_to_serdes_map_nif_lane124=rx126:tx123 +lane_to_serdes_map_nif_lane125=rx125:tx122 +lane_to_serdes_map_nif_lane126=rx121:tx125 +lane_to_serdes_map_nif_lane127=rx122:tx126 +lane_to_serdes_map_nif_lane128=rx134:tx131 +lane_to_serdes_map_nif_lane129=rx132:tx129 +lane_to_serdes_map_nif_lane130=rx128:tx132 +lane_to_serdes_map_nif_lane131=rx131:tx134 +lane_to_serdes_map_nif_lane132=rx135:tx130 +lane_to_serdes_map_nif_lane133=rx133:tx128 +lane_to_serdes_map_nif_lane134=rx129:tx133 +lane_to_serdes_map_nif_lane135=rx130:tx135 +lane_to_serdes_map_nif_lane136=rx143:tx138 +lane_to_serdes_map_nif_lane137=rx140:tx136 +lane_to_serdes_map_nif_lane138=rx136:tx140 +lane_to_serdes_map_nif_lane139=rx139:tx143 +lane_to_serdes_map_nif_lane140=rx142:tx137 +lane_to_serdes_map_nif_lane141=rx141:tx139 +lane_to_serdes_map_nif_lane142=rx137:tx141 +lane_to_serdes_map_nif_lane143=rx138:tx142 + +######################### +### High Availability ### +######################### + +sw_state_max_size=750000000 + +#location of warmboot NV memory +#Allowed options for dnx are - 3:external storage in filesystem 4:driver will save the state directly in shared memory +stable_location=4 + +# Note that each unit should have a unique filename and that adapter does not play well with tmp and dev/shm folders. +stable_filename=/dev/shm/warmboot_data_0 +stable_filename.1=/dev/shm/warmboot_data_1 +stable_filename.2=/dev/shm/warmboot_data_2 + +#Maximum size for NVM used for WB storage, must be larger than sw_state_max_size.BCM8885X +stable_size=800000000 + +######################### +######################### +######################### + +tm_port_header_type_in_0=INJECTED_2_PP +tm_port_header_type_out_0=CPU + +tm_port_header_type_in_200=INJECTED_2_PP +tm_port_header_type_out_200=ETH +tm_port_header_type_in_201=INJECTED_2_PP +tm_port_header_type_out_201=ETH +tm_port_header_type_in_202=INJECTED_2_PP +tm_port_header_type_out_202=ETH +tm_port_header_type_in_203=INJECTED_2_PP +tm_port_header_type_out_203=ETH + +### SAT +## Enable SAT Interface. 0 - Disable, 1 - Enable (Default) +sat_enable=1 +ucode_port_218=SAT:core_0.218 +tm_port_header_type_out_218=CPU +tm_port_header_type_in_218=INJECTED_2 +ucode_port_219=SAT:core_1.219 +tm_port_header_type_out_219=CPU +tm_port_header_type_in_219=INJECTED_2 +port_init_speed_sat=400000 + +### RCY +sai_recycle_port_lane_base=0 +ucode_port_221=RCY.21:core_0.221 +ucode_port_222=RCY.22:core_1.222 +tm_port_header_type_out_221=ETH +tm_port_header_type_in_221=ETH +tm_port_header_type_out_222=ETH +tm_port_header_type_in_222=ETH +port_init_speed_221=400000 +port_init_speed_222=400000 + +#OLP port +tm_port_header_type_in_240=INJECTED_2 +tm_port_header_type_out_240=RAW + +# Set statically the region mode per region id +dtm_flow_mapping_mode_region_257=3 +dtm_flow_mapping_mode_region_258=3 +dtm_flow_mapping_mode_region_259=3 +dtm_flow_mapping_mode_region_260=3 +dtm_flow_mapping_mode_region_261=3 +dtm_flow_mapping_mode_region_262=3 +dtm_flow_mapping_mode_region_263=3 +dtm_flow_mapping_mode_region_264=3 +dtm_flow_mapping_mode_region_265=3 +dtm_flow_mapping_mode_region_266=7 +dtm_flow_mapping_mode_region_267=3 +dtm_flow_mapping_mode_region_268=3 +dtm_flow_mapping_mode_region_269=3 +dtm_flow_mapping_mode_region_270=3 +dtm_flow_mapping_mode_region_271=3 +dtm_flow_mapping_mode_region_272=3 +dtm_flow_mapping_mode_region_273=3 +dtm_flow_mapping_mode_region_274=3 +dtm_flow_mapping_mode_region_275=3 +dtm_flow_mapping_mode_region_276=3 +dtm_flow_mapping_mode_region_277=3 +dtm_flow_mapping_mode_region_278=3 +dtm_flow_mapping_mode_region_279=3 +dtm_flow_mapping_mode_region_280=3 +dtm_flow_mapping_mode_region_281=3 +dtm_flow_mapping_mode_region_282=3 +dtm_flow_mapping_mode_region_283=3 +dtm_flow_mapping_mode_region_284=3 +dtm_flow_mapping_mode_region_285=3 +dtm_flow_mapping_mode_region_286=3 +dtm_flow_mapping_mode_region_287=3 + +## Configure number of symmetric cores each region supports ## +dtm_flow_nof_remote_cores_region_1=2 +dtm_flow_nof_remote_cores_region_2=2 +dtm_flow_nof_remote_cores_region_3=2 +dtm_flow_nof_remote_cores_region_4=2 +dtm_flow_nof_remote_cores_region_5=2 +dtm_flow_nof_remote_cores_region_6=2 +dtm_flow_nof_remote_cores_region_7=2 +dtm_flow_nof_remote_cores_region_8=2 +dtm_flow_nof_remote_cores_region_9=2 +dtm_flow_nof_remote_cores_region_10=2 +dtm_flow_nof_remote_cores_region_11=2 +dtm_flow_nof_remote_cores_region_12=2 +dtm_flow_nof_remote_cores_region_13=2 +dtm_flow_nof_remote_cores_region_14=2 +dtm_flow_nof_remote_cores_region_15=2 +dtm_flow_nof_remote_cores_region_16=2 +dtm_flow_nof_remote_cores_region_17=2 +dtm_flow_nof_remote_cores_region_18=2 +dtm_flow_nof_remote_cores_region_19=2 +dtm_flow_nof_remote_cores_region_20=2 +dtm_flow_nof_remote_cores_region_21=2 +dtm_flow_nof_remote_cores_region_22=2 +dtm_flow_nof_remote_cores_region_23=2 +dtm_flow_nof_remote_cores_region_24=2 +dtm_flow_nof_remote_cores_region_25=2 +dtm_flow_nof_remote_cores_region_26=2 +dtm_flow_nof_remote_cores_region_27=2 +dtm_flow_nof_remote_cores_region_28=2 +dtm_flow_nof_remote_cores_region_29=2 +dtm_flow_nof_remote_cores_region_30=2 +dtm_flow_nof_remote_cores_region_31=2 +dtm_flow_nof_remote_cores_region_32=2 +dtm_flow_nof_remote_cores_region_33=2 +dtm_flow_nof_remote_cores_region_34=2 +dtm_flow_nof_remote_cores_region_35=2 +dtm_flow_nof_remote_cores_region_36=2 +dtm_flow_nof_remote_cores_region_37=2 +dtm_flow_nof_remote_cores_region_38=2 +dtm_flow_nof_remote_cores_region_39=2 +dtm_flow_nof_remote_cores_region_40=2 +dtm_flow_nof_remote_cores_region_41=2 +dtm_flow_nof_remote_cores_region_42=2 +dtm_flow_nof_remote_cores_region_43=2 +dtm_flow_nof_remote_cores_region_44=2 +dtm_flow_nof_remote_cores_region_45=2 +dtm_flow_nof_remote_cores_region_46=2 +dtm_flow_nof_remote_cores_region_47=2 +dtm_flow_nof_remote_cores_region_48=2 +dtm_flow_nof_remote_cores_region_49=2 +dtm_flow_nof_remote_cores_region_50=2 +dtm_flow_nof_remote_cores_region_51=2 +dtm_flow_nof_remote_cores_region_52=2 +dtm_flow_nof_remote_cores_region_53=2 +dtm_flow_nof_remote_cores_region_54=2 +dtm_flow_nof_remote_cores_region_55=2 +dtm_flow_nof_remote_cores_region_56=2 +dtm_flow_nof_remote_cores_region_57=2 +dtm_flow_nof_remote_cores_region_58=2 +dtm_flow_nof_remote_cores_region_59=2 +dtm_flow_nof_remote_cores_region_60=2 + +### MDB configuration ### +mdb_profile=balanced-exem + +### Descriptor-DMA configuration ### +dma_desc_aggregator_chain_length_max=1000 +dma_desc_aggregator_buff_size_kb=100 +dma_desc_aggregator_timeout_usec=1000 +dma_desc_aggregator_enable_specific_MDB_LPM=1 +dma_desc_aggregator_enable_specific_MDB_FEC=1 + +### Outlif configuarion ### +outlif_logical_to_physical_phase_map_1=S1 +outlif_logical_to_physical_phase_map_2=L1 +outlif_logical_to_physical_phase_map_3=XL +outlif_logical_to_physical_phase_map_4=L2 +outlif_logical_to_physical_phase_map_5=M1 +outlif_logical_to_physical_phase_map_6=M2 +outlif_logical_to_physical_phase_map_7=M3 +outlif_logical_to_physical_phase_map_8=S2 + +### Outlif data granularity configuration ### +outlif_physical_phase_data_granularity_S1=60 +outlif_physical_phase_data_granularity_S2=60 +outlif_physical_phase_data_granularity_M1=60 +outlif_physical_phase_data_granularity_M2=60 +outlif_physical_phase_data_granularity_M3=60 +outlif_physical_phase_data_granularity_L1=60 +outlif_physical_phase_data_granularity_L2=60 +outlif_physical_phase_data_granularity_XL=60 + +### Fabric configuration ### +# Enable link-training +port_init_cl72_sfi=1 +serdes_lane_config_cl72_auto_polarity_en=0 +serdes_lane_config_cl72_auto_polarity_en_sfi=1 +serdes_lane_config_cl72_restart_timeout_en=0 + +#SFI speed rate +port_init_speed_fabric=53125 + +## Fabric transmission mode +# Set the Connect mode to the Fabric +# Options: FE - presence of a Fabric device (single stage) +# SINGLE_FAP - stand-alone device +# MESH - devices in Mesh +# Note: If 'diag_chassis' is on, value will be override in dnx.soc +# to be FE instead of SINGLE_FAP. +fabric_connect_mode=FE + +fabric_logical_port_base=512 + +# Fabric lane mapping +lane_to_serdes_map_fabric_lane0=rx0:tx0 +lane_to_serdes_map_fabric_lane1=rx1:tx1 +lane_to_serdes_map_fabric_lane2=rx2:tx2 +lane_to_serdes_map_fabric_lane3=rx3:tx3 +lane_to_serdes_map_fabric_lane4=rx4:tx4 +lane_to_serdes_map_fabric_lane5=rx5:tx5 +lane_to_serdes_map_fabric_lane6=rx6:tx6 +lane_to_serdes_map_fabric_lane7=rx7:tx7 +lane_to_serdes_map_fabric_lane8=rx8:tx10 +lane_to_serdes_map_fabric_lane9=rx9:tx11 +lane_to_serdes_map_fabric_lane10=rx10:tx9 +lane_to_serdes_map_fabric_lane11=rx11:tx8 +lane_to_serdes_map_fabric_lane12=rx12:tx12 +lane_to_serdes_map_fabric_lane13=rx13:tx15 +lane_to_serdes_map_fabric_lane14=rx14:tx14 +lane_to_serdes_map_fabric_lane15=rx15:tx13 +lane_to_serdes_map_fabric_lane16=rx16:tx17 +lane_to_serdes_map_fabric_lane17=rx17:tx18 +lane_to_serdes_map_fabric_lane18=rx18:tx16 +lane_to_serdes_map_fabric_lane19=rx19:tx19 +lane_to_serdes_map_fabric_lane20=rx20:tx21 +lane_to_serdes_map_fabric_lane21=rx21:tx23 +lane_to_serdes_map_fabric_lane22=rx22:tx20 +lane_to_serdes_map_fabric_lane23=rx23:tx22 +lane_to_serdes_map_fabric_lane24=rx24:tx26 +lane_to_serdes_map_fabric_lane25=rx25:tx24 +lane_to_serdes_map_fabric_lane26=rx26:tx25 +lane_to_serdes_map_fabric_lane27=rx27:tx27 +lane_to_serdes_map_fabric_lane28=rx28:tx31 +lane_to_serdes_map_fabric_lane29=rx29:tx30 +lane_to_serdes_map_fabric_lane30=rx30:tx29 +lane_to_serdes_map_fabric_lane31=rx31:tx28 +lane_to_serdes_map_fabric_lane32=rx32:tx32 +lane_to_serdes_map_fabric_lane33=rx33:tx33 +lane_to_serdes_map_fabric_lane34=rx34:tx34 +lane_to_serdes_map_fabric_lane35=rx35:tx35 +lane_to_serdes_map_fabric_lane36=rx36:tx36 +lane_to_serdes_map_fabric_lane37=rx37:tx37 +lane_to_serdes_map_fabric_lane38=rx38:tx38 +lane_to_serdes_map_fabric_lane39=rx39:tx39 +lane_to_serdes_map_fabric_lane40=rx40:tx43 +lane_to_serdes_map_fabric_lane41=rx41:tx42 +lane_to_serdes_map_fabric_lane42=rx42:tx41 +lane_to_serdes_map_fabric_lane43=rx43:tx40 +lane_to_serdes_map_fabric_lane44=rx44:tx47 +lane_to_serdes_map_fabric_lane45=rx45:tx46 +lane_to_serdes_map_fabric_lane46=rx46:tx45 +lane_to_serdes_map_fabric_lane47=rx47:tx44 +lane_to_serdes_map_fabric_lane48=rx48:tx48 +lane_to_serdes_map_fabric_lane49=rx49:tx49 +lane_to_serdes_map_fabric_lane50=rx50:tx50 +lane_to_serdes_map_fabric_lane51=rx51:tx51 +lane_to_serdes_map_fabric_lane52=rx52:tx52 +lane_to_serdes_map_fabric_lane53=rx53:tx53 +lane_to_serdes_map_fabric_lane54=rx54:tx54 +lane_to_serdes_map_fabric_lane55=rx55:tx55 +lane_to_serdes_map_fabric_lane56=rx56:tx59 +lane_to_serdes_map_fabric_lane57=rx57:tx58 +lane_to_serdes_map_fabric_lane58=rx58:tx57 +lane_to_serdes_map_fabric_lane59=rx59:tx56 +lane_to_serdes_map_fabric_lane60=rx60:tx63 +lane_to_serdes_map_fabric_lane61=rx61:tx62 +lane_to_serdes_map_fabric_lane62=rx62:tx61 +lane_to_serdes_map_fabric_lane63=rx63:tx60 +lane_to_serdes_map_fabric_lane64=rx64:tx64 +lane_to_serdes_map_fabric_lane65=rx65:tx65 +lane_to_serdes_map_fabric_lane66=rx66:tx66 +lane_to_serdes_map_fabric_lane67=rx67:tx67 +lane_to_serdes_map_fabric_lane68=rx68:tx68 +lane_to_serdes_map_fabric_lane69=rx69:tx69 +lane_to_serdes_map_fabric_lane70=rx70:tx70 +lane_to_serdes_map_fabric_lane71=rx71:tx71 +lane_to_serdes_map_fabric_lane72=rx72:tx75 +lane_to_serdes_map_fabric_lane73=rx73:tx74 +lane_to_serdes_map_fabric_lane74=rx74:tx73 +lane_to_serdes_map_fabric_lane75=rx75:tx72 +lane_to_serdes_map_fabric_lane76=rx76:tx79 +lane_to_serdes_map_fabric_lane77=rx77:tx78 +lane_to_serdes_map_fabric_lane78=rx78:tx77 +lane_to_serdes_map_fabric_lane79=rx79:tx76 +lane_to_serdes_map_fabric_lane80=rx80:tx80 +lane_to_serdes_map_fabric_lane81=rx81:tx81 +lane_to_serdes_map_fabric_lane82=rx82:tx83 +lane_to_serdes_map_fabric_lane83=rx83:tx82 +lane_to_serdes_map_fabric_lane84=rx84:tx85 +lane_to_serdes_map_fabric_lane85=rx85:tx86 +lane_to_serdes_map_fabric_lane86=rx86:tx84 +lane_to_serdes_map_fabric_lane87=rx87:tx87 +lane_to_serdes_map_fabric_lane88=rx88:tx90 +lane_to_serdes_map_fabric_lane89=rx89:tx88 +lane_to_serdes_map_fabric_lane90=rx90:tx91 +lane_to_serdes_map_fabric_lane91=rx91:tx89 +lane_to_serdes_map_fabric_lane92=rx92:tx93 +lane_to_serdes_map_fabric_lane93=rx93:tx92 +lane_to_serdes_map_fabric_lane94=rx94:tx94 +lane_to_serdes_map_fabric_lane95=rx95:tx95 +lane_to_serdes_map_fabric_lane96=rx96:tx96 +lane_to_serdes_map_fabric_lane97=rx97:tx97 +lane_to_serdes_map_fabric_lane98=rx98:tx98 +lane_to_serdes_map_fabric_lane99=rx99:tx99 +lane_to_serdes_map_fabric_lane100=rx100:tx100 +lane_to_serdes_map_fabric_lane101=rx101:tx101 +lane_to_serdes_map_fabric_lane102=rx102:tx102 +lane_to_serdes_map_fabric_lane103=rx103:tx103 +lane_to_serdes_map_fabric_lane104=rx104:tx105 +lane_to_serdes_map_fabric_lane105=rx105:tx106 +lane_to_serdes_map_fabric_lane106=rx106:tx107 +lane_to_serdes_map_fabric_lane107=rx107:tx104 +lane_to_serdes_map_fabric_lane108=rx108:tx111 +lane_to_serdes_map_fabric_lane109=rx109:tx109 +lane_to_serdes_map_fabric_lane110=rx110:tx110 +lane_to_serdes_map_fabric_lane111=rx111:tx108 +lane_to_serdes_map_fabric_lane112=rx112:tx114 +lane_to_serdes_map_fabric_lane113=rx113:tx113 +lane_to_serdes_map_fabric_lane114=rx114:tx112 +lane_to_serdes_map_fabric_lane115=rx115:tx115 +lane_to_serdes_map_fabric_lane116=rx116:tx117 +lane_to_serdes_map_fabric_lane117=rx117:tx116 +lane_to_serdes_map_fabric_lane118=rx118:tx119 +lane_to_serdes_map_fabric_lane119=rx119:tx118 +lane_to_serdes_map_fabric_lane120=rx120:tx123 +lane_to_serdes_map_fabric_lane121=rx121:tx120 +lane_to_serdes_map_fabric_lane122=rx122:tx122 +lane_to_serdes_map_fabric_lane123=rx123:tx121 +lane_to_serdes_map_fabric_lane124=rx124:tx127 +lane_to_serdes_map_fabric_lane125=rx125:tx125 +lane_to_serdes_map_fabric_lane126=rx126:tx124 +lane_to_serdes_map_fabric_lane127=rx127:tx126 +lane_to_serdes_map_fabric_lane128=rx128:tx128 +lane_to_serdes_map_fabric_lane129=rx129:tx129 +lane_to_serdes_map_fabric_lane130=rx130:tx130 +lane_to_serdes_map_fabric_lane131=rx131:tx131 +lane_to_serdes_map_fabric_lane132=rx132:tx132 +lane_to_serdes_map_fabric_lane133=rx133:tx133 +lane_to_serdes_map_fabric_lane134=rx134:tx134 +lane_to_serdes_map_fabric_lane135=rx135:tx135 +lane_to_serdes_map_fabric_lane136=rx136:tx139 +lane_to_serdes_map_fabric_lane137=rx137:tx138 +lane_to_serdes_map_fabric_lane138=rx138:tx137 +lane_to_serdes_map_fabric_lane139=rx139:tx136 +lane_to_serdes_map_fabric_lane140=rx140:tx140 +lane_to_serdes_map_fabric_lane141=rx141:tx142 +lane_to_serdes_map_fabric_lane142=rx142:tx141 +lane_to_serdes_map_fabric_lane143=rx143:tx143 +lane_to_serdes_map_fabric_lane144=rx144:tx144 +lane_to_serdes_map_fabric_lane145=rx145:tx145 +lane_to_serdes_map_fabric_lane146=rx146:tx146 +lane_to_serdes_map_fabric_lane147=rx147:tx147 +lane_to_serdes_map_fabric_lane148=rx148:tx148 +lane_to_serdes_map_fabric_lane149=rx149:tx149 +lane_to_serdes_map_fabric_lane150=rx150:tx150 +lane_to_serdes_map_fabric_lane151=rx151:tx151 +lane_to_serdes_map_fabric_lane152=rx152:tx155 +lane_to_serdes_map_fabric_lane153=rx153:tx154 +lane_to_serdes_map_fabric_lane154=rx154:tx153 +lane_to_serdes_map_fabric_lane155=rx155:tx152 +lane_to_serdes_map_fabric_lane156=rx156:tx159 +lane_to_serdes_map_fabric_lane157=rx157:tx158 +lane_to_serdes_map_fabric_lane158=rx158:tx157 +lane_to_serdes_map_fabric_lane159=rx159:tx156 +lane_to_serdes_map_fabric_lane160=rx160:tx160 +lane_to_serdes_map_fabric_lane161=rx161:tx161 +lane_to_serdes_map_fabric_lane162=rx162:tx162 +lane_to_serdes_map_fabric_lane163=rx163:tx163 +lane_to_serdes_map_fabric_lane164=rx164:tx164 +lane_to_serdes_map_fabric_lane165=rx165:tx165 +lane_to_serdes_map_fabric_lane166=rx166:tx166 +lane_to_serdes_map_fabric_lane167=rx167:tx167 +lane_to_serdes_map_fabric_lane168=rx168:tx171 +lane_to_serdes_map_fabric_lane169=rx169:tx170 +lane_to_serdes_map_fabric_lane170=rx170:tx169 +lane_to_serdes_map_fabric_lane171=rx171:tx168 +lane_to_serdes_map_fabric_lane172=rx172:tx175 +lane_to_serdes_map_fabric_lane173=rx173:tx174 +lane_to_serdes_map_fabric_lane174=rx174:tx173 +lane_to_serdes_map_fabric_lane175=rx175:tx172 +lane_to_serdes_map_fabric_lane176=rx176:tx176 +lane_to_serdes_map_fabric_lane177=rx177:tx177 +lane_to_serdes_map_fabric_lane178=rx178:tx179 +lane_to_serdes_map_fabric_lane179=rx179:tx178 +lane_to_serdes_map_fabric_lane180=rx180:tx181 +lane_to_serdes_map_fabric_lane181=rx181:tx182 +lane_to_serdes_map_fabric_lane182=rx182:tx180 +lane_to_serdes_map_fabric_lane183=rx183:tx183 +lane_to_serdes_map_fabric_lane184=rx184:tx186 +lane_to_serdes_map_fabric_lane185=rx185:tx184 +lane_to_serdes_map_fabric_lane186=rx186:tx185 +lane_to_serdes_map_fabric_lane187=rx187:tx187 +lane_to_serdes_map_fabric_lane188=rx188:tx188 +lane_to_serdes_map_fabric_lane189=rx189:tx189 +lane_to_serdes_map_fabric_lane190=rx190:tx190 +lane_to_serdes_map_fabric_lane191=rx191:tx191 + +# +##Protocol trap look-up mode: +# Options: IN_LIF - Look-ups in the profile table are done by IN-LIF +# IN_PORT - Look-ups in the profile table are done by IN-PORT +protocol_traps_mode=IN_LIF + +# access definitions +schan_intr_enable=0 +tdma_intr_enable=0 +tslam_intr_enable=0 +miim_intr_enable=0 +schan_timeout_usec=300000 +tdma_timeout_usec=1000000 +tslam_timeout_usec=1000000 + +### Interrupts +appl_enable_intr_init=1 +polled_irq_mode=1 +# reduce CPU load, configure delay 100ms +polled_irq_delay=1000 + +# reduce the CPU load over adapter (caused by counter thread) +bcm_stat_interval=1000 + +# shadow memory +mem_cache_enable_ecc=1 +mem_cache_enable_parity=1 + +# serdes_nif/fabric_clk_freq_in/out configuration +serdes_nif_clk_freq_in=2 +serdes_nif_clk_freq_out=1 +serdes_fabric_clk_freq_in=2 +serdes_fabric_clk_freq_out=1 + +dport_map_direct=1 + +rif_id_max=0x6000 + +phy_rx_polarity_flip_phy0=0 +phy_rx_polarity_flip_phy1=0 +phy_rx_polarity_flip_phy2=0 +phy_rx_polarity_flip_phy3=0 +phy_rx_polarity_flip_phy4=0 +phy_rx_polarity_flip_phy5=0 +phy_rx_polarity_flip_phy6=0 +phy_rx_polarity_flip_phy7=0 +phy_rx_polarity_flip_phy8=1 +phy_rx_polarity_flip_phy9=1 +phy_rx_polarity_flip_phy10=0 +phy_rx_polarity_flip_phy11=1 +phy_rx_polarity_flip_phy12=1 +phy_rx_polarity_flip_phy13=1 +phy_rx_polarity_flip_phy14=1 +phy_rx_polarity_flip_phy15=1 +phy_rx_polarity_flip_phy16=0 +phy_rx_polarity_flip_phy17=0 +phy_rx_polarity_flip_phy18=0 +phy_rx_polarity_flip_phy19=0 +phy_rx_polarity_flip_phy20=0 +phy_rx_polarity_flip_phy21=0 +phy_rx_polarity_flip_phy22=0 +phy_rx_polarity_flip_phy23=0 +phy_rx_polarity_flip_phy24=0 +phy_rx_polarity_flip_phy25=0 +phy_rx_polarity_flip_phy26=0 +phy_rx_polarity_flip_phy27=0 +phy_rx_polarity_flip_phy28=0 +phy_rx_polarity_flip_phy29=0 +phy_rx_polarity_flip_phy30=0 +phy_rx_polarity_flip_phy31=0 +phy_rx_polarity_flip_phy32=0 +phy_rx_polarity_flip_phy33=0 +phy_rx_polarity_flip_phy34=0 +phy_rx_polarity_flip_phy35=0 +phy_rx_polarity_flip_phy36=0 +phy_rx_polarity_flip_phy37=0 +phy_rx_polarity_flip_phy38=0 +phy_rx_polarity_flip_phy39=0 +phy_rx_polarity_flip_phy40=0 +phy_rx_polarity_flip_phy41=0 +phy_rx_polarity_flip_phy42=0 +phy_rx_polarity_flip_phy43=0 +phy_rx_polarity_flip_phy44=0 +phy_rx_polarity_flip_phy45=0 +phy_rx_polarity_flip_phy46=0 +phy_rx_polarity_flip_phy47=0 +phy_rx_polarity_flip_phy48=0 +phy_rx_polarity_flip_phy49=0 +phy_rx_polarity_flip_phy50=0 +phy_rx_polarity_flip_phy51=0 +phy_rx_polarity_flip_phy52=0 +phy_rx_polarity_flip_phy53=0 +phy_rx_polarity_flip_phy54=0 +phy_rx_polarity_flip_phy55=0 +phy_rx_polarity_flip_phy56=0 +phy_rx_polarity_flip_phy57=0 +phy_rx_polarity_flip_phy58=0 +phy_rx_polarity_flip_phy59=0 +phy_rx_polarity_flip_phy60=0 +phy_rx_polarity_flip_phy61=0 +phy_rx_polarity_flip_phy62=0 +phy_rx_polarity_flip_phy63=0 +phy_rx_polarity_flip_phy64=0 +phy_rx_polarity_flip_phy65=0 +phy_rx_polarity_flip_phy66=0 +phy_rx_polarity_flip_phy67=0 +phy_rx_polarity_flip_phy68=0 +phy_rx_polarity_flip_phy69=0 +phy_rx_polarity_flip_phy70=0 +phy_rx_polarity_flip_phy71=0 +phy_rx_polarity_flip_phy72=1 +phy_rx_polarity_flip_phy73=1 +phy_rx_polarity_flip_phy74=1 +phy_rx_polarity_flip_phy75=1 +phy_rx_polarity_flip_phy76=1 +phy_rx_polarity_flip_phy77=1 +phy_rx_polarity_flip_phy78=1 +phy_rx_polarity_flip_phy79=1 +phy_rx_polarity_flip_phy80=0 +phy_rx_polarity_flip_phy81=0 +phy_rx_polarity_flip_phy82=0 +phy_rx_polarity_flip_phy83=0 +phy_rx_polarity_flip_phy84=0 +phy_rx_polarity_flip_phy85=0 +phy_rx_polarity_flip_phy86=0 +phy_rx_polarity_flip_phy87=0 +phy_rx_polarity_flip_phy88=0 +phy_rx_polarity_flip_phy89=0 +phy_rx_polarity_flip_phy90=1 +phy_rx_polarity_flip_phy91=0 +phy_rx_polarity_flip_phy92=0 +phy_rx_polarity_flip_phy93=0 +phy_rx_polarity_flip_phy94=0 +phy_rx_polarity_flip_phy95=0 +phy_rx_polarity_flip_phy96=0 +phy_rx_polarity_flip_phy97=0 +phy_rx_polarity_flip_phy98=0 +phy_rx_polarity_flip_phy99=0 +phy_rx_polarity_flip_phy100=0 +phy_rx_polarity_flip_phy101=0 +phy_rx_polarity_flip_phy102=0 +phy_rx_polarity_flip_phy103=0 +phy_rx_polarity_flip_phy104=0 +phy_rx_polarity_flip_phy105=0 +phy_rx_polarity_flip_phy106=0 +phy_rx_polarity_flip_phy107=0 +phy_rx_polarity_flip_phy108=0 +phy_rx_polarity_flip_phy109=0 +phy_rx_polarity_flip_phy110=0 +phy_rx_polarity_flip_phy111=0 +phy_rx_polarity_flip_phy112=0 +phy_rx_polarity_flip_phy113=0 +phy_rx_polarity_flip_phy114=0 +phy_rx_polarity_flip_phy115=0 +phy_rx_polarity_flip_phy116=0 +phy_rx_polarity_flip_phy117=0 +phy_rx_polarity_flip_phy118=0 +phy_rx_polarity_flip_phy119=0 +phy_rx_polarity_flip_phy120=0 +phy_rx_polarity_flip_phy121=0 +phy_rx_polarity_flip_phy122=0 +phy_rx_polarity_flip_phy123=0 +phy_rx_polarity_flip_phy124=0 +phy_rx_polarity_flip_phy125=0 +phy_rx_polarity_flip_phy126=0 +phy_rx_polarity_flip_phy127=0 +phy_rx_polarity_flip_phy128=0 +phy_rx_polarity_flip_phy129=0 +phy_rx_polarity_flip_phy130=0 +phy_rx_polarity_flip_phy131=0 +phy_rx_polarity_flip_phy132=0 +phy_rx_polarity_flip_phy133=0 +phy_rx_polarity_flip_phy134=0 +phy_rx_polarity_flip_phy135=0 +phy_rx_polarity_flip_phy136=0 +phy_rx_polarity_flip_phy137=0 +phy_rx_polarity_flip_phy138=0 +phy_rx_polarity_flip_phy139=0 +phy_rx_polarity_flip_phy140=0 +phy_rx_polarity_flip_phy141=0 +phy_rx_polarity_flip_phy142=0 +phy_rx_polarity_flip_phy143=0 +phy_tx_polarity_flip_phy0=1 +phy_tx_polarity_flip_phy1=1 +phy_tx_polarity_flip_phy2=1 +phy_tx_polarity_flip_phy3=1 +phy_tx_polarity_flip_phy4=1 +phy_tx_polarity_flip_phy5=1 +phy_tx_polarity_flip_phy6=1 +phy_tx_polarity_flip_phy7=1 +phy_tx_polarity_flip_phy8=1 +phy_tx_polarity_flip_phy9=0 +phy_tx_polarity_flip_phy10=1 +phy_tx_polarity_flip_phy11=1 +phy_tx_polarity_flip_phy12=1 +phy_tx_polarity_flip_phy13=1 +phy_tx_polarity_flip_phy14=1 +phy_tx_polarity_flip_phy15=1 +phy_tx_polarity_flip_phy16=1 +phy_tx_polarity_flip_phy17=1 +phy_tx_polarity_flip_phy18=1 +phy_tx_polarity_flip_phy19=1 +phy_tx_polarity_flip_phy20=1 +phy_tx_polarity_flip_phy21=1 +phy_tx_polarity_flip_phy22=1 +phy_tx_polarity_flip_phy23=1 +phy_tx_polarity_flip_phy24=1 +phy_tx_polarity_flip_phy25=1 +phy_tx_polarity_flip_phy26=1 +phy_tx_polarity_flip_phy27=1 +phy_tx_polarity_flip_phy28=1 +phy_tx_polarity_flip_phy29=1 +phy_tx_polarity_flip_phy30=1 +phy_tx_polarity_flip_phy31=1 +phy_tx_polarity_flip_phy32=1 +phy_tx_polarity_flip_phy33=1 +phy_tx_polarity_flip_phy34=1 +phy_tx_polarity_flip_phy35=1 +phy_tx_polarity_flip_phy36=1 +phy_tx_polarity_flip_phy37=1 +phy_tx_polarity_flip_phy38=1 +phy_tx_polarity_flip_phy39=1 +phy_tx_polarity_flip_phy40=1 +phy_tx_polarity_flip_phy41=1 +phy_tx_polarity_flip_phy42=1 +phy_tx_polarity_flip_phy43=1 +phy_tx_polarity_flip_phy44=1 +phy_tx_polarity_flip_phy45=1 +phy_tx_polarity_flip_phy46=1 +phy_tx_polarity_flip_phy47=1 +phy_tx_polarity_flip_phy48=1 +phy_tx_polarity_flip_phy49=1 +phy_tx_polarity_flip_phy50=1 +phy_tx_polarity_flip_phy51=1 +phy_tx_polarity_flip_phy52=1 +phy_tx_polarity_flip_phy53=1 +phy_tx_polarity_flip_phy54=1 +phy_tx_polarity_flip_phy55=1 +phy_tx_polarity_flip_phy56=1 +phy_tx_polarity_flip_phy57=1 +phy_tx_polarity_flip_phy58=1 +phy_tx_polarity_flip_phy59=1 +phy_tx_polarity_flip_phy60=1 +phy_tx_polarity_flip_phy61=1 +phy_tx_polarity_flip_phy62=1 +phy_tx_polarity_flip_phy63=1 +phy_tx_polarity_flip_phy64=1 +phy_tx_polarity_flip_phy65=1 +phy_tx_polarity_flip_phy66=1 +phy_tx_polarity_flip_phy67=1 +phy_tx_polarity_flip_phy68=1 +phy_tx_polarity_flip_phy69=1 +phy_tx_polarity_flip_phy70=1 +phy_tx_polarity_flip_phy71=1 +phy_tx_polarity_flip_phy72=0 +phy_tx_polarity_flip_phy73=0 +phy_tx_polarity_flip_phy74=0 +phy_tx_polarity_flip_phy75=0 +phy_tx_polarity_flip_phy76=0 +phy_tx_polarity_flip_phy77=0 +phy_tx_polarity_flip_phy78=0 +phy_tx_polarity_flip_phy79=0 +phy_tx_polarity_flip_phy80=0 +phy_tx_polarity_flip_phy81=0 +phy_tx_polarity_flip_phy82=0 +phy_tx_polarity_flip_phy83=0 +phy_tx_polarity_flip_phy84=0 +phy_tx_polarity_flip_phy85=0 +phy_tx_polarity_flip_phy86=0 +phy_tx_polarity_flip_phy87=0 +phy_tx_polarity_flip_phy88=1 +phy_tx_polarity_flip_phy89=1 +phy_tx_polarity_flip_phy90=1 +phy_tx_polarity_flip_phy91=1 +phy_tx_polarity_flip_phy92=1 +phy_tx_polarity_flip_phy93=1 +phy_tx_polarity_flip_phy94=1 +phy_tx_polarity_flip_phy95=1 +phy_tx_polarity_flip_phy96=1 +phy_tx_polarity_flip_phy97=1 +phy_tx_polarity_flip_phy98=1 +phy_tx_polarity_flip_phy99=1 +phy_tx_polarity_flip_phy100=1 +phy_tx_polarity_flip_phy101=1 +phy_tx_polarity_flip_phy102=1 +phy_tx_polarity_flip_phy103=1 +phy_tx_polarity_flip_phy104=1 +phy_tx_polarity_flip_phy105=1 +phy_tx_polarity_flip_phy106=1 +phy_tx_polarity_flip_phy107=1 +phy_tx_polarity_flip_phy108=1 +phy_tx_polarity_flip_phy109=1 +phy_tx_polarity_flip_phy110=1 +phy_tx_polarity_flip_phy111=1 +phy_tx_polarity_flip_phy112=1 +phy_tx_polarity_flip_phy113=1 +phy_tx_polarity_flip_phy114=1 +phy_tx_polarity_flip_phy115=1 +phy_tx_polarity_flip_phy116=1 +phy_tx_polarity_flip_phy117=1 +phy_tx_polarity_flip_phy118=1 +phy_tx_polarity_flip_phy119=1 +phy_tx_polarity_flip_phy120=1 +phy_tx_polarity_flip_phy121=1 +phy_tx_polarity_flip_phy122=1 +phy_tx_polarity_flip_phy123=1 +phy_tx_polarity_flip_phy124=1 +phy_tx_polarity_flip_phy125=1 +phy_tx_polarity_flip_phy126=1 +phy_tx_polarity_flip_phy127=1 +phy_tx_polarity_flip_phy128=1 +phy_tx_polarity_flip_phy129=1 +phy_tx_polarity_flip_phy130=1 +phy_tx_polarity_flip_phy131=1 +phy_tx_polarity_flip_phy132=1 +phy_tx_polarity_flip_phy133=1 +phy_tx_polarity_flip_phy134=1 +phy_tx_polarity_flip_phy135=1 +phy_tx_polarity_flip_phy136=1 +phy_tx_polarity_flip_phy137=1 +phy_tx_polarity_flip_phy138=1 +phy_tx_polarity_flip_phy139=1 +phy_tx_polarity_flip_phy140=1 +phy_tx_polarity_flip_phy141=1 +phy_tx_polarity_flip_phy142=1 +phy_tx_polarity_flip_phy143=1 + +serdes_tx_taps_1=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_2=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_3=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_4=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_5=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_6=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_7=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_8=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_9=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_10=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_11=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_12=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_13=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_14=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_15=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_16=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_17=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_18=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_19=nrz:-6:85:-21:0:0:0 +serdes_tx_taps_20=nrz:-5:83:-22:0:0:0 +serdes_tx_taps_21=nrz:-4:75:-21:0:0:0 +serdes_tx_taps_22=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_23=nrz:-6:85:-21:0:0:0 +serdes_tx_taps_24=nrz:-5:83:-22:0:0:0 +serdes_tx_taps_25=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_26=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_27=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_28=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_29=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_30=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_31=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_32=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_33=nrz:-5:83:-22:0:0:0 +serdes_tx_taps_34=nrz:-5:83:-22:0:0:0 +serdes_tx_taps_35=nrz:-4:75:-21:0:0:0 +serdes_tx_taps_36=nrz:-8:89:-29:0:0:0 + +serdes_tx_taps_1=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_2=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_3=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_4=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_5=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_6=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_7=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_8=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_9=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_10=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_11=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_12=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_13=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_14=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_15=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_16=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_17=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_18=pam4:-16:137:-12:2:0:-3 +serdes_tx_taps_19=pam4:-17:144:-1:2:-3:-3 +serdes_tx_taps_20=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_21=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_22=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_23=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_24=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_25=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_26=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_27=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_28=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_29=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_30=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_31=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_32=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_33=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_34=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_35=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_36=pam4:-16:137:-12:2:0:-3 + +xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 +xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/pg_profile_lookup.ini b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/pg_profile_lookup.ini new file mode 100644 index 00000000000..e8289ab0311 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 40000 300m 1280 2560 69632 0 1280 + 100000 300m 1280 2560 110592 0 1280 + 400000 300m 1280 2560 315392 0 1280 + 40000 1000m 1280 2560 114688 0 1280 + 100000 1000m 1280 2560 225280 0 1280 + 400000 1000m 1280 2560 778240 0 1280 + 40000 2000m 1280 2560 184320 0 1280 + 100000 2000m 1280 2560 393216 0 1280 + 400000 2000m 1280 2560 1445888 0 1280 + 40000 80000m 1280 2560 5369856 0 1280 + 100000 80000m 1280 2560 13357056 0 1280 + 400000 80000m 1280 2560 53305344 0 1280 + 40000 120000m 1280 2560 8028160 0 1280 + 100000 120000m 1280 2560 20004864 0 1280 + 400000 120000m 1280 2560 79900672 0 1280 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/port_config.ini b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/port_config.ini new file mode 100644 index 00000000000..4d20baee09f --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/port_config.ini @@ -0,0 +1,21 @@ +# 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-ASIC0 1 1 8 +Ethernet8 80,81,82,83,84,85,86,87 Ethernet2/1 2 Ext 400000 Eth8-ASIC0 1 2 8 +Ethernet16 88,89,90,91,92,93,94,95 Ethernet3/1 3 Ext 400000 Eth16-ASIC0 1 3 8 +Ethernet24 96,97,98,99,100,101,102,103 Ethernet4/1 4 Ext 400000 Eth24-ASIC0 1 4 8 +Ethernet32 104,105,106,107,108,109,110,111 Ethernet5/1 5 Ext 400000 Eth32-ASIC0 1 5 8 +Ethernet40 112,113,114,115,116,117,118,119 Ethernet6/1 6 Ext 400000 Eth40-ASIC0 1 6 8 +Ethernet48 120,121,122,123,124,125,126,127 Ethernet7/1 7 Ext 400000 Eth48-ASIC0 1 7 8 +Ethernet56 128,129,130,131,132,133,134,135 Ethernet8/1 8 Ext 400000 Eth56-ASIC0 1 8 8 +Ethernet64 136,137,138,139,140,141,142,143 Ethernet9/1 9 Ext 400000 Eth64-ASIC0 1 9 8 +Ethernet72 64,65,66,67,68,69,70,71 Ethernet10/1 10 Ext 400000 Eth72-ASIC0 0 10 8 +Ethernet80 56,57,58,59,60,61,62,63 Ethernet11/1 11 Ext 400000 Eth80-ASIC0 0 11 8 +Ethernet88 48,49,50,51,52,53,54,55 Ethernet12/1 12 Ext 400000 Eth88-ASIC0 0 12 8 +Ethernet96 40,41,42,43,44,45,46,47 Ethernet13/1 13 Ext 400000 Eth96-ASIC0 0 13 8 +Ethernet104 32,33,34,35,36,37,38,39 Ethernet14/1 14 Ext 400000 Eth104-ASIC0 0 14 8 +Ethernet112 24,25,26,27,28,29,30,31 Ethernet15/1 15 Ext 400000 Eth112-ASIC0 0 15 8 +Ethernet120 16,17,18,19,20,21,22,23 Ethernet16/1 16 Ext 400000 Eth120-ASIC0 0 16 8 +Ethernet128 8,9,10,11,12,13,14,15 Ethernet17/1 17 Ext 400000 Eth128-ASIC0 0 17 8 +Ethernet136 0,1,2,3,4,5,6,7 Ethernet18/1 18 Ext 400000 Eth136-ASIC0 0 18 8 +Ethernet-Rec0 221 Recirc0/0 19 Rec 400000 Rcy0-ASIC0 0 221 8 +Ethernet-IB0 222 Recirc0/1 20 Inb 400000 Rcy1-ASIC0 1 222 8 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/qos.json.j2 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/qos.json.j2 new file mode 100644 index 00000000000..3e548325ea3 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/sai.profile b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/sai.profile new file mode 100644 index 00000000000..894b300ad73 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/0/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/j2p-a7800r3a-36d-36x400G.config.bcm + diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/buffers.json.j2 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/buffers.json.j2 new file mode 100644 index 00000000000..f34a844f4a8 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't2' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/buffers_defaults_t2.j2 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/buffers_defaults_t2.j2 new file mode 100644 index 00000000000..3555175244d --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/buffers_defaults_t2.j2 @@ -0,0 +1,37 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(144,288,8) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "6441610000", + "type": "both", + "mode": "dynamic", + "xoff": "11354112" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"1280", + "xon_offset": "2560", + "dynamic_th":"0" + }, + "egress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-1" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/context_config.json b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/context_config.json new file mode 120000 index 00000000000..3db0e8ed3d9 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/context_config.json @@ -0,0 +1 @@ +../0/context_config.json \ No newline at end of file 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 new file mode 100644 index 00000000000..56d425f9f9c --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -0,0 +1,1022 @@ +soc_family=BCM8885X +system_ref_core_clock_khz=1600000 + +dpp_db_path=/usr/share/bcm/db + +#################################################### +##Reference applications related properties - Start +#################################################### + +## PMF small EXEM connected stage: +# Options: IPMF2 - Ingress PMF 2 stage can perform small EXEM lookups. +# IPMF3 - Ingress PMF 3 stage can perform small EXEM lookups. +## PMF small EXEM connected stage: +# Options: IPMF2 - Ingress PMF 2 stage can perform small EXEM lookups. +# IPMF3 - Ingress PMF 3 stage can perform small EXEM lookups. +pmf_sexem3_stage=IPMF2 + +#################################################### +##Reference applications related properties - End +#################################################### + +# Jericho2-mode (description 0x1 used for Jericho 2 mode) +system_headers_mode=1 + +# HW mode to support 1024 16-member system wide LAGs +trunk_group_max_members=16 + +# Disable link-training +port_init_cl72=0 + +###Default interfaces for Jericho2Plus +#CPU interfaces +ucode_port_0=CPU.0:core_0.0 +ucode_port_200=CPU.8:core_1.200 +ucode_port_201=CPU.16:core_0.201 +ucode_port_202=CPU.24:core_1.202 +ucode_port_203=CPU.32:core_0.203 + +#NIF ETH interfaces on device +ucode_port_1=CDGE9:core_1.1 +ucode_port_2=CDGE10:core_1.2 +ucode_port_3=CDGE11:core_1.3 +ucode_port_4=CDGE12:core_1.4 +ucode_port_5=CDGE13:core_1.5 +ucode_port_6=CDGE14:core_1.6 +ucode_port_7=CDGE15:core_1.7 +ucode_port_8=CDGE16:core_1.8 +ucode_port_9=CDGE17:core_1.9 + +ucode_port_10=CDGE8:core_0.10 +ucode_port_11=CDGE7:core_0.11 +ucode_port_12=CDGE6:core_0.12 +ucode_port_13=CDGE5:core_0.13 +ucode_port_14=CDGE4:core_0.14 +ucode_port_15=CDGE3:core_0.15 +ucode_port_16=CDGE2:core_0.16 +ucode_port_17=CDGE1:core_0.17 +ucode_port_18=CDGE0:core_0.18 + +#NIF default speeds +port_init_speed_xe=10000 +port_init_speed_xl=40000 +port_init_speed_le=50000 +port_init_speed_ce=100000 +port_init_speed_cc=200000 +port_init_speed_cd=400000 +port_init_speed_il=10312 + +port_priorities=8 + +#special ports +ucode_port_240=OLP:core_0.240 + +# NIF lane mapping +lane_to_serdes_map_nif_lane0=rx3:tx4 +lane_to_serdes_map_nif_lane1=rx6:tx1 +lane_to_serdes_map_nif_lane2=rx7:tx5 +lane_to_serdes_map_nif_lane3=rx4:tx7 +lane_to_serdes_map_nif_lane4=rx1:tx2 +lane_to_serdes_map_nif_lane5=rx0:tx0 +lane_to_serdes_map_nif_lane6=rx5:tx3 +lane_to_serdes_map_nif_lane7=rx2:tx6 +lane_to_serdes_map_nif_lane8=rx10:tx11 +lane_to_serdes_map_nif_lane9=rx8:tx8 +lane_to_serdes_map_nif_lane10=rx14:tx12 +lane_to_serdes_map_nif_lane11=rx15:tx15 +lane_to_serdes_map_nif_lane12=rx13:tx10 +lane_to_serdes_map_nif_lane13=rx9:tx9 +lane_to_serdes_map_nif_lane14=rx11:tx13 +lane_to_serdes_map_nif_lane15=rx12:tx14 +lane_to_serdes_map_nif_lane16=rx16:tx17 +lane_to_serdes_map_nif_lane17=rx19:tx21 +lane_to_serdes_map_nif_lane18=rx21:tx18 +lane_to_serdes_map_nif_lane19=rx18:tx16 +lane_to_serdes_map_nif_lane20=rx17:tx23 +lane_to_serdes_map_nif_lane21=rx20:tx22 +lane_to_serdes_map_nif_lane22=rx22:tx20 +lane_to_serdes_map_nif_lane23=rx23:tx19 +lane_to_serdes_map_nif_lane24=rx26:tx28 +lane_to_serdes_map_nif_lane25=rx29:tx31 +lane_to_serdes_map_nif_lane26=rx31:tx29 +lane_to_serdes_map_nif_lane27=rx28:tx27 +lane_to_serdes_map_nif_lane28=rx25:tx25 +lane_to_serdes_map_nif_lane29=rx24:tx30 +lane_to_serdes_map_nif_lane30=rx30:tx24 +lane_to_serdes_map_nif_lane31=rx27:tx26 +lane_to_serdes_map_nif_lane32=rx32:tx39 +lane_to_serdes_map_nif_lane33=rx33:tx38 +lane_to_serdes_map_nif_lane34=rx38:tx32 +lane_to_serdes_map_nif_lane35=rx39:tx33 +lane_to_serdes_map_nif_lane36=rx35:tx37 +lane_to_serdes_map_nif_lane37=rx34:tx36 +lane_to_serdes_map_nif_lane38=rx36:tx34 +lane_to_serdes_map_nif_lane39=rx37:tx35 +lane_to_serdes_map_nif_lane40=rx40:tx41 +lane_to_serdes_map_nif_lane41=rx43:tx45 +lane_to_serdes_map_nif_lane42=rx45:tx42 +lane_to_serdes_map_nif_lane43=rx42:tx40 +lane_to_serdes_map_nif_lane44=rx41:tx47 +lane_to_serdes_map_nif_lane45=rx44:tx46 +lane_to_serdes_map_nif_lane46=rx46:tx44 +lane_to_serdes_map_nif_lane47=rx47:tx43 +lane_to_serdes_map_nif_lane48=rx50:tx52 +lane_to_serdes_map_nif_lane49=rx53:tx55 +lane_to_serdes_map_nif_lane50=rx55:tx53 +lane_to_serdes_map_nif_lane51=rx52:tx51 +lane_to_serdes_map_nif_lane52=rx49:tx49 +lane_to_serdes_map_nif_lane53=rx48:tx54 +lane_to_serdes_map_nif_lane54=rx54:tx48 +lane_to_serdes_map_nif_lane55=rx51:tx50 +lane_to_serdes_map_nif_lane56=rx56:tx63 +lane_to_serdes_map_nif_lane57=rx57:tx62 +lane_to_serdes_map_nif_lane58=rx62:tx56 +lane_to_serdes_map_nif_lane59=rx63:tx57 +lane_to_serdes_map_nif_lane60=rx59:tx61 +lane_to_serdes_map_nif_lane61=rx58:tx60 +lane_to_serdes_map_nif_lane62=rx60:tx58 +lane_to_serdes_map_nif_lane63=rx61:tx59 +lane_to_serdes_map_nif_lane64=rx64:tx65 +lane_to_serdes_map_nif_lane65=rx67:tx69 +lane_to_serdes_map_nif_lane66=rx69:tx66 +lane_to_serdes_map_nif_lane67=rx66:tx64 +lane_to_serdes_map_nif_lane68=rx65:tx71 +lane_to_serdes_map_nif_lane69=rx68:tx70 +lane_to_serdes_map_nif_lane70=rx70:tx68 +lane_to_serdes_map_nif_lane71=rx71:tx67 +lane_to_serdes_map_nif_lane72=rx79:tx74 +lane_to_serdes_map_nif_lane73=rx76:tx75 +lane_to_serdes_map_nif_lane74=rx72:tx76 +lane_to_serdes_map_nif_lane75=rx74:tx73 +lane_to_serdes_map_nif_lane76=rx77:tx79 +lane_to_serdes_map_nif_lane77=rx78:tx78 +lane_to_serdes_map_nif_lane78=rx73:tx77 +lane_to_serdes_map_nif_lane79=rx75:tx72 +lane_to_serdes_map_nif_lane80=rx86:tx86 +lane_to_serdes_map_nif_lane81=rx83:tx87 +lane_to_serdes_map_nif_lane82=rx82:tx81 +lane_to_serdes_map_nif_lane83=rx85:tx80 +lane_to_serdes_map_nif_lane84=rx87:tx85 +lane_to_serdes_map_nif_lane85=rx84:tx84 +lane_to_serdes_map_nif_lane86=rx80:tx82 +lane_to_serdes_map_nif_lane87=rx81:tx83 +lane_to_serdes_map_nif_lane88=rx95:tx90 +lane_to_serdes_map_nif_lane89=rx92:tx88 +lane_to_serdes_map_nif_lane90=rx88:tx92 +lane_to_serdes_map_nif_lane91=rx91:tx95 +lane_to_serdes_map_nif_lane92=rx94:tx89 +lane_to_serdes_map_nif_lane93=rx93:tx91 +lane_to_serdes_map_nif_lane94=rx89:tx93 +lane_to_serdes_map_nif_lane95=rx90:tx94 +lane_to_serdes_map_nif_lane96=rx103:tx97 +lane_to_serdes_map_nif_lane97=rx100:tx96 +lane_to_serdes_map_nif_lane98=rx96:tx100 +lane_to_serdes_map_nif_lane99=rx99:tx103 +lane_to_serdes_map_nif_lane100=rx102:tx99 +lane_to_serdes_map_nif_lane101=rx101:tx98 +lane_to_serdes_map_nif_lane102=rx97:tx101 +lane_to_serdes_map_nif_lane103=rx98:tx102 +lane_to_serdes_map_nif_lane104=rx110:tx107 +lane_to_serdes_map_nif_lane105=rx108:tx105 +lane_to_serdes_map_nif_lane106=rx104:tx108 +lane_to_serdes_map_nif_lane107=rx107:tx110 +lane_to_serdes_map_nif_lane108=rx111:tx106 +lane_to_serdes_map_nif_lane109=rx109:tx104 +lane_to_serdes_map_nif_lane110=rx105:tx109 +lane_to_serdes_map_nif_lane111=rx106:tx111 +lane_to_serdes_map_nif_lane112=rx119:tx114 +lane_to_serdes_map_nif_lane113=rx116:tx112 +lane_to_serdes_map_nif_lane114=rx112:tx116 +lane_to_serdes_map_nif_lane115=rx115:tx119 +lane_to_serdes_map_nif_lane116=rx118:tx113 +lane_to_serdes_map_nif_lane117=rx117:tx115 +lane_to_serdes_map_nif_lane118=rx113:tx117 +lane_to_serdes_map_nif_lane119=rx114:tx118 +lane_to_serdes_map_nif_lane120=rx127:tx121 +lane_to_serdes_map_nif_lane121=rx124:tx120 +lane_to_serdes_map_nif_lane122=rx120:tx124 +lane_to_serdes_map_nif_lane123=rx123:tx127 +lane_to_serdes_map_nif_lane124=rx126:tx123 +lane_to_serdes_map_nif_lane125=rx125:tx122 +lane_to_serdes_map_nif_lane126=rx121:tx125 +lane_to_serdes_map_nif_lane127=rx122:tx126 +lane_to_serdes_map_nif_lane128=rx134:tx131 +lane_to_serdes_map_nif_lane129=rx132:tx129 +lane_to_serdes_map_nif_lane130=rx128:tx132 +lane_to_serdes_map_nif_lane131=rx131:tx134 +lane_to_serdes_map_nif_lane132=rx135:tx130 +lane_to_serdes_map_nif_lane133=rx133:tx128 +lane_to_serdes_map_nif_lane134=rx129:tx133 +lane_to_serdes_map_nif_lane135=rx130:tx135 +lane_to_serdes_map_nif_lane136=rx143:tx138 +lane_to_serdes_map_nif_lane137=rx140:tx136 +lane_to_serdes_map_nif_lane138=rx136:tx140 +lane_to_serdes_map_nif_lane139=rx139:tx143 +lane_to_serdes_map_nif_lane140=rx142:tx137 +lane_to_serdes_map_nif_lane141=rx141:tx139 +lane_to_serdes_map_nif_lane142=rx137:tx141 +lane_to_serdes_map_nif_lane143=rx138:tx142 + +######################### +### High Availability ### +######################### + +sw_state_max_size=750000000 + +#location of warmboot NV memory +#Allowed options for dnx are - 3:external storage in filesystem 4:driver will save the state directly in shared memory +stable_location=4 + +# Note that each unit should have a unique filename and that adapter does not play well with tmp and dev/shm folders. +stable_filename=/dev/shm/warmboot_data_0 +stable_filename.1=/dev/shm/warmboot_data_1 +stable_filename.2=/dev/shm/warmboot_data_2 + +#Maximum size for NVM used for WB storage, must be larger than sw_state_max_size.BCM8885X +stable_size=800000000 + +######################### +######################### +######################### + +tm_port_header_type_in_0=INJECTED_2_PP +tm_port_header_type_out_0=CPU + +tm_port_header_type_in_200=INJECTED_2_PP +tm_port_header_type_out_200=ETH +tm_port_header_type_in_201=INJECTED_2_PP +tm_port_header_type_out_201=ETH +tm_port_header_type_in_202=INJECTED_2_PP +tm_port_header_type_out_202=ETH +tm_port_header_type_in_203=INJECTED_2_PP +tm_port_header_type_out_203=ETH + +### SAT +## Enable SAT Interface. 0 - Disable, 1 - Enable (Default) +sat_enable=1 +ucode_port_218=SAT:core_0.218 +tm_port_header_type_out_218=CPU +tm_port_header_type_in_218=INJECTED_2 +ucode_port_219=SAT:core_1.219 +tm_port_header_type_out_219=CPU +tm_port_header_type_in_219=INJECTED_2 +port_init_speed_sat=400000 + +### RCY +sai_recycle_port_lane_base=0 +ucode_port_221=RCY.21:core_0.221 +ucode_port_222=RCY.22:core_1.222 +tm_port_header_type_out_221=ETH +tm_port_header_type_in_221=ETH +tm_port_header_type_out_222=ETH +tm_port_header_type_in_222=ETH +port_init_speed_221=400000 +port_init_speed_222=400000 + +#OLP port +tm_port_header_type_in_240=INJECTED_2 +tm_port_header_type_out_240=RAW + +# Set statically the region mode per region id +dtm_flow_mapping_mode_region_257=3 +dtm_flow_mapping_mode_region_258=3 +dtm_flow_mapping_mode_region_259=3 +dtm_flow_mapping_mode_region_260=3 +dtm_flow_mapping_mode_region_261=3 +dtm_flow_mapping_mode_region_262=3 +dtm_flow_mapping_mode_region_263=3 +dtm_flow_mapping_mode_region_264=3 +dtm_flow_mapping_mode_region_265=3 +dtm_flow_mapping_mode_region_266=7 +dtm_flow_mapping_mode_region_267=3 +dtm_flow_mapping_mode_region_268=3 +dtm_flow_mapping_mode_region_269=3 +dtm_flow_mapping_mode_region_270=3 +dtm_flow_mapping_mode_region_271=3 +dtm_flow_mapping_mode_region_272=3 +dtm_flow_mapping_mode_region_273=3 +dtm_flow_mapping_mode_region_274=3 +dtm_flow_mapping_mode_region_275=3 +dtm_flow_mapping_mode_region_276=3 +dtm_flow_mapping_mode_region_277=3 +dtm_flow_mapping_mode_region_278=3 +dtm_flow_mapping_mode_region_279=3 +dtm_flow_mapping_mode_region_280=3 +dtm_flow_mapping_mode_region_281=3 +dtm_flow_mapping_mode_region_282=3 +dtm_flow_mapping_mode_region_283=3 +dtm_flow_mapping_mode_region_284=3 +dtm_flow_mapping_mode_region_285=3 +dtm_flow_mapping_mode_region_286=3 +dtm_flow_mapping_mode_region_287=3 + +## Configure number of symmetric cores each region supports ## +dtm_flow_nof_remote_cores_region_1=2 +dtm_flow_nof_remote_cores_region_2=2 +dtm_flow_nof_remote_cores_region_3=2 +dtm_flow_nof_remote_cores_region_4=2 +dtm_flow_nof_remote_cores_region_5=2 +dtm_flow_nof_remote_cores_region_6=2 +dtm_flow_nof_remote_cores_region_7=2 +dtm_flow_nof_remote_cores_region_8=2 +dtm_flow_nof_remote_cores_region_9=2 +dtm_flow_nof_remote_cores_region_10=2 +dtm_flow_nof_remote_cores_region_11=2 +dtm_flow_nof_remote_cores_region_12=2 +dtm_flow_nof_remote_cores_region_13=2 +dtm_flow_nof_remote_cores_region_14=2 +dtm_flow_nof_remote_cores_region_15=2 +dtm_flow_nof_remote_cores_region_16=2 +dtm_flow_nof_remote_cores_region_17=2 +dtm_flow_nof_remote_cores_region_18=2 +dtm_flow_nof_remote_cores_region_19=2 +dtm_flow_nof_remote_cores_region_20=2 +dtm_flow_nof_remote_cores_region_21=2 +dtm_flow_nof_remote_cores_region_22=2 +dtm_flow_nof_remote_cores_region_23=2 +dtm_flow_nof_remote_cores_region_24=2 +dtm_flow_nof_remote_cores_region_25=2 +dtm_flow_nof_remote_cores_region_26=2 +dtm_flow_nof_remote_cores_region_27=2 +dtm_flow_nof_remote_cores_region_28=2 +dtm_flow_nof_remote_cores_region_29=2 +dtm_flow_nof_remote_cores_region_30=2 +dtm_flow_nof_remote_cores_region_31=2 +dtm_flow_nof_remote_cores_region_32=2 +dtm_flow_nof_remote_cores_region_33=2 +dtm_flow_nof_remote_cores_region_34=2 +dtm_flow_nof_remote_cores_region_35=2 +dtm_flow_nof_remote_cores_region_36=2 +dtm_flow_nof_remote_cores_region_37=2 +dtm_flow_nof_remote_cores_region_38=2 +dtm_flow_nof_remote_cores_region_39=2 +dtm_flow_nof_remote_cores_region_40=2 +dtm_flow_nof_remote_cores_region_41=2 +dtm_flow_nof_remote_cores_region_42=2 +dtm_flow_nof_remote_cores_region_43=2 +dtm_flow_nof_remote_cores_region_44=2 +dtm_flow_nof_remote_cores_region_45=2 +dtm_flow_nof_remote_cores_region_46=2 +dtm_flow_nof_remote_cores_region_47=2 +dtm_flow_nof_remote_cores_region_48=2 +dtm_flow_nof_remote_cores_region_49=2 +dtm_flow_nof_remote_cores_region_50=2 +dtm_flow_nof_remote_cores_region_51=2 +dtm_flow_nof_remote_cores_region_52=2 +dtm_flow_nof_remote_cores_region_53=2 +dtm_flow_nof_remote_cores_region_54=2 +dtm_flow_nof_remote_cores_region_55=2 +dtm_flow_nof_remote_cores_region_56=2 +dtm_flow_nof_remote_cores_region_57=2 +dtm_flow_nof_remote_cores_region_58=2 +dtm_flow_nof_remote_cores_region_59=2 +dtm_flow_nof_remote_cores_region_60=2 + +### MDB configuration ### +mdb_profile=balanced-exem + +### Descriptor-DMA configuration ### +dma_desc_aggregator_chain_length_max=1000 +dma_desc_aggregator_buff_size_kb=100 +dma_desc_aggregator_timeout_usec=1000 +dma_desc_aggregator_enable_specific_MDB_LPM=1 +dma_desc_aggregator_enable_specific_MDB_FEC=1 + +### Outlif configuarion ### +outlif_logical_to_physical_phase_map_1=S1 +outlif_logical_to_physical_phase_map_2=L1 +outlif_logical_to_physical_phase_map_3=XL +outlif_logical_to_physical_phase_map_4=L2 +outlif_logical_to_physical_phase_map_5=M1 +outlif_logical_to_physical_phase_map_6=M2 +outlif_logical_to_physical_phase_map_7=M3 +outlif_logical_to_physical_phase_map_8=S2 + +### Outlif data granularity configuration ### +outlif_physical_phase_data_granularity_S1=60 +outlif_physical_phase_data_granularity_S2=60 +outlif_physical_phase_data_granularity_M1=60 +outlif_physical_phase_data_granularity_M2=60 +outlif_physical_phase_data_granularity_M3=60 +outlif_physical_phase_data_granularity_L1=60 +outlif_physical_phase_data_granularity_L2=60 +outlif_physical_phase_data_granularity_XL=60 + +### Fabric configuration ### +# Enable link-training +port_init_cl72_sfi=1 +serdes_lane_config_cl72_auto_polarity_en=0 +serdes_lane_config_cl72_auto_polarity_en_sfi=1 +serdes_lane_config_cl72_restart_timeout_en=0 + +#SFI speed rate +port_init_speed_fabric=53125 + +## Fabric transmission mode +# Set the Connect mode to the Fabric +# Options: FE - presence of a Fabric device (single stage) +# SINGLE_FAP - stand-alone device +# MESH - devices in Mesh +# Note: If 'diag_chassis' is on, value will be override in dnx.soc +# to be FE instead of SINGLE_FAP. +fabric_connect_mode=FE + +fabric_logical_port_base=512 + +# Fabric lane mapping +lane_to_serdes_map_fabric_lane0=rx0:tx0 +lane_to_serdes_map_fabric_lane1=rx1:tx1 +lane_to_serdes_map_fabric_lane2=rx2:tx2 +lane_to_serdes_map_fabric_lane3=rx3:tx3 +lane_to_serdes_map_fabric_lane4=rx4:tx4 +lane_to_serdes_map_fabric_lane5=rx5:tx5 +lane_to_serdes_map_fabric_lane6=rx6:tx6 +lane_to_serdes_map_fabric_lane7=rx7:tx7 +lane_to_serdes_map_fabric_lane8=rx8:tx10 +lane_to_serdes_map_fabric_lane9=rx9:tx11 +lane_to_serdes_map_fabric_lane10=rx10:tx9 +lane_to_serdes_map_fabric_lane11=rx11:tx8 +lane_to_serdes_map_fabric_lane12=rx12:tx12 +lane_to_serdes_map_fabric_lane13=rx13:tx15 +lane_to_serdes_map_fabric_lane14=rx14:tx14 +lane_to_serdes_map_fabric_lane15=rx15:tx13 +lane_to_serdes_map_fabric_lane16=rx16:tx17 +lane_to_serdes_map_fabric_lane17=rx17:tx18 +lane_to_serdes_map_fabric_lane18=rx18:tx16 +lane_to_serdes_map_fabric_lane19=rx19:tx19 +lane_to_serdes_map_fabric_lane20=rx20:tx21 +lane_to_serdes_map_fabric_lane21=rx21:tx23 +lane_to_serdes_map_fabric_lane22=rx22:tx20 +lane_to_serdes_map_fabric_lane23=rx23:tx22 +lane_to_serdes_map_fabric_lane24=rx24:tx26 +lane_to_serdes_map_fabric_lane25=rx25:tx24 +lane_to_serdes_map_fabric_lane26=rx26:tx25 +lane_to_serdes_map_fabric_lane27=rx27:tx27 +lane_to_serdes_map_fabric_lane28=rx28:tx31 +lane_to_serdes_map_fabric_lane29=rx29:tx30 +lane_to_serdes_map_fabric_lane30=rx30:tx29 +lane_to_serdes_map_fabric_lane31=rx31:tx28 +lane_to_serdes_map_fabric_lane32=rx32:tx32 +lane_to_serdes_map_fabric_lane33=rx33:tx33 +lane_to_serdes_map_fabric_lane34=rx34:tx34 +lane_to_serdes_map_fabric_lane35=rx35:tx35 +lane_to_serdes_map_fabric_lane36=rx36:tx36 +lane_to_serdes_map_fabric_lane37=rx37:tx37 +lane_to_serdes_map_fabric_lane38=rx38:tx38 +lane_to_serdes_map_fabric_lane39=rx39:tx39 +lane_to_serdes_map_fabric_lane40=rx40:tx43 +lane_to_serdes_map_fabric_lane41=rx41:tx42 +lane_to_serdes_map_fabric_lane42=rx42:tx41 +lane_to_serdes_map_fabric_lane43=rx43:tx40 +lane_to_serdes_map_fabric_lane44=rx44:tx47 +lane_to_serdes_map_fabric_lane45=rx45:tx46 +lane_to_serdes_map_fabric_lane46=rx46:tx45 +lane_to_serdes_map_fabric_lane47=rx47:tx44 +lane_to_serdes_map_fabric_lane48=rx48:tx48 +lane_to_serdes_map_fabric_lane49=rx49:tx49 +lane_to_serdes_map_fabric_lane50=rx50:tx50 +lane_to_serdes_map_fabric_lane51=rx51:tx51 +lane_to_serdes_map_fabric_lane52=rx52:tx52 +lane_to_serdes_map_fabric_lane53=rx53:tx53 +lane_to_serdes_map_fabric_lane54=rx54:tx54 +lane_to_serdes_map_fabric_lane55=rx55:tx55 +lane_to_serdes_map_fabric_lane56=rx56:tx59 +lane_to_serdes_map_fabric_lane57=rx57:tx58 +lane_to_serdes_map_fabric_lane58=rx58:tx57 +lane_to_serdes_map_fabric_lane59=rx59:tx56 +lane_to_serdes_map_fabric_lane60=rx60:tx63 +lane_to_serdes_map_fabric_lane61=rx61:tx62 +lane_to_serdes_map_fabric_lane62=rx62:tx61 +lane_to_serdes_map_fabric_lane63=rx63:tx60 +lane_to_serdes_map_fabric_lane64=rx64:tx64 +lane_to_serdes_map_fabric_lane65=rx65:tx65 +lane_to_serdes_map_fabric_lane66=rx66:tx66 +lane_to_serdes_map_fabric_lane67=rx67:tx67 +lane_to_serdes_map_fabric_lane68=rx68:tx68 +lane_to_serdes_map_fabric_lane69=rx69:tx69 +lane_to_serdes_map_fabric_lane70=rx70:tx70 +lane_to_serdes_map_fabric_lane71=rx71:tx71 +lane_to_serdes_map_fabric_lane72=rx72:tx75 +lane_to_serdes_map_fabric_lane73=rx73:tx74 +lane_to_serdes_map_fabric_lane74=rx74:tx73 +lane_to_serdes_map_fabric_lane75=rx75:tx72 +lane_to_serdes_map_fabric_lane76=rx76:tx79 +lane_to_serdes_map_fabric_lane77=rx77:tx78 +lane_to_serdes_map_fabric_lane78=rx78:tx77 +lane_to_serdes_map_fabric_lane79=rx79:tx76 +lane_to_serdes_map_fabric_lane80=rx80:tx80 +lane_to_serdes_map_fabric_lane81=rx81:tx81 +lane_to_serdes_map_fabric_lane82=rx82:tx83 +lane_to_serdes_map_fabric_lane83=rx83:tx82 +lane_to_serdes_map_fabric_lane84=rx84:tx85 +lane_to_serdes_map_fabric_lane85=rx85:tx86 +lane_to_serdes_map_fabric_lane86=rx86:tx84 +lane_to_serdes_map_fabric_lane87=rx87:tx87 +lane_to_serdes_map_fabric_lane88=rx88:tx90 +lane_to_serdes_map_fabric_lane89=rx89:tx88 +lane_to_serdes_map_fabric_lane90=rx90:tx91 +lane_to_serdes_map_fabric_lane91=rx91:tx89 +lane_to_serdes_map_fabric_lane92=rx92:tx93 +lane_to_serdes_map_fabric_lane93=rx93:tx92 +lane_to_serdes_map_fabric_lane94=rx94:tx94 +lane_to_serdes_map_fabric_lane95=rx95:tx95 +lane_to_serdes_map_fabric_lane96=rx96:tx96 +lane_to_serdes_map_fabric_lane97=rx97:tx97 +lane_to_serdes_map_fabric_lane98=rx98:tx98 +lane_to_serdes_map_fabric_lane99=rx99:tx99 +lane_to_serdes_map_fabric_lane100=rx100:tx100 +lane_to_serdes_map_fabric_lane101=rx101:tx101 +lane_to_serdes_map_fabric_lane102=rx102:tx102 +lane_to_serdes_map_fabric_lane103=rx103:tx103 +lane_to_serdes_map_fabric_lane104=rx104:tx105 +lane_to_serdes_map_fabric_lane105=rx105:tx106 +lane_to_serdes_map_fabric_lane106=rx106:tx107 +lane_to_serdes_map_fabric_lane107=rx107:tx104 +lane_to_serdes_map_fabric_lane108=rx108:tx111 +lane_to_serdes_map_fabric_lane109=rx109:tx109 +lane_to_serdes_map_fabric_lane110=rx110:tx110 +lane_to_serdes_map_fabric_lane111=rx111:tx108 +lane_to_serdes_map_fabric_lane112=rx112:tx114 +lane_to_serdes_map_fabric_lane113=rx113:tx113 +lane_to_serdes_map_fabric_lane114=rx114:tx112 +lane_to_serdes_map_fabric_lane115=rx115:tx115 +lane_to_serdes_map_fabric_lane116=rx116:tx117 +lane_to_serdes_map_fabric_lane117=rx117:tx116 +lane_to_serdes_map_fabric_lane118=rx118:tx119 +lane_to_serdes_map_fabric_lane119=rx119:tx118 +lane_to_serdes_map_fabric_lane120=rx120:tx123 +lane_to_serdes_map_fabric_lane121=rx121:tx120 +lane_to_serdes_map_fabric_lane122=rx122:tx122 +lane_to_serdes_map_fabric_lane123=rx123:tx121 +lane_to_serdes_map_fabric_lane124=rx124:tx127 +lane_to_serdes_map_fabric_lane125=rx125:tx125 +lane_to_serdes_map_fabric_lane126=rx126:tx124 +lane_to_serdes_map_fabric_lane127=rx127:tx126 +lane_to_serdes_map_fabric_lane128=rx128:tx128 +lane_to_serdes_map_fabric_lane129=rx129:tx129 +lane_to_serdes_map_fabric_lane130=rx130:tx130 +lane_to_serdes_map_fabric_lane131=rx131:tx131 +lane_to_serdes_map_fabric_lane132=rx132:tx132 +lane_to_serdes_map_fabric_lane133=rx133:tx133 +lane_to_serdes_map_fabric_lane134=rx134:tx134 +lane_to_serdes_map_fabric_lane135=rx135:tx135 +lane_to_serdes_map_fabric_lane136=rx136:tx139 +lane_to_serdes_map_fabric_lane137=rx137:tx138 +lane_to_serdes_map_fabric_lane138=rx138:tx137 +lane_to_serdes_map_fabric_lane139=rx139:tx136 +lane_to_serdes_map_fabric_lane140=rx140:tx140 +lane_to_serdes_map_fabric_lane141=rx141:tx142 +lane_to_serdes_map_fabric_lane142=rx142:tx141 +lane_to_serdes_map_fabric_lane143=rx143:tx143 +lane_to_serdes_map_fabric_lane144=rx144:tx144 +lane_to_serdes_map_fabric_lane145=rx145:tx145 +lane_to_serdes_map_fabric_lane146=rx146:tx146 +lane_to_serdes_map_fabric_lane147=rx147:tx147 +lane_to_serdes_map_fabric_lane148=rx148:tx148 +lane_to_serdes_map_fabric_lane149=rx149:tx149 +lane_to_serdes_map_fabric_lane150=rx150:tx150 +lane_to_serdes_map_fabric_lane151=rx151:tx151 +lane_to_serdes_map_fabric_lane152=rx152:tx155 +lane_to_serdes_map_fabric_lane153=rx153:tx154 +lane_to_serdes_map_fabric_lane154=rx154:tx153 +lane_to_serdes_map_fabric_lane155=rx155:tx152 +lane_to_serdes_map_fabric_lane156=rx156:tx159 +lane_to_serdes_map_fabric_lane157=rx157:tx158 +lane_to_serdes_map_fabric_lane158=rx158:tx157 +lane_to_serdes_map_fabric_lane159=rx159:tx156 +lane_to_serdes_map_fabric_lane160=rx160:tx160 +lane_to_serdes_map_fabric_lane161=rx161:tx161 +lane_to_serdes_map_fabric_lane162=rx162:tx162 +lane_to_serdes_map_fabric_lane163=rx163:tx163 +lane_to_serdes_map_fabric_lane164=rx164:tx164 +lane_to_serdes_map_fabric_lane165=rx165:tx165 +lane_to_serdes_map_fabric_lane166=rx166:tx166 +lane_to_serdes_map_fabric_lane167=rx167:tx167 +lane_to_serdes_map_fabric_lane168=rx168:tx171 +lane_to_serdes_map_fabric_lane169=rx169:tx170 +lane_to_serdes_map_fabric_lane170=rx170:tx169 +lane_to_serdes_map_fabric_lane171=rx171:tx168 +lane_to_serdes_map_fabric_lane172=rx172:tx175 +lane_to_serdes_map_fabric_lane173=rx173:tx174 +lane_to_serdes_map_fabric_lane174=rx174:tx173 +lane_to_serdes_map_fabric_lane175=rx175:tx172 +lane_to_serdes_map_fabric_lane176=rx176:tx176 +lane_to_serdes_map_fabric_lane177=rx177:tx177 +lane_to_serdes_map_fabric_lane178=rx178:tx179 +lane_to_serdes_map_fabric_lane179=rx179:tx178 +lane_to_serdes_map_fabric_lane180=rx180:tx181 +lane_to_serdes_map_fabric_lane181=rx181:tx182 +lane_to_serdes_map_fabric_lane182=rx182:tx180 +lane_to_serdes_map_fabric_lane183=rx183:tx183 +lane_to_serdes_map_fabric_lane184=rx184:tx186 +lane_to_serdes_map_fabric_lane185=rx185:tx184 +lane_to_serdes_map_fabric_lane186=rx186:tx185 +lane_to_serdes_map_fabric_lane187=rx187:tx187 +lane_to_serdes_map_fabric_lane188=rx188:tx188 +lane_to_serdes_map_fabric_lane189=rx189:tx189 +lane_to_serdes_map_fabric_lane190=rx190:tx190 +lane_to_serdes_map_fabric_lane191=rx191:tx191 + +# +##Protocol trap look-up mode: +# Options: IN_LIF - Look-ups in the profile table are done by IN-LIF +# IN_PORT - Look-ups in the profile table are done by IN-PORT +protocol_traps_mode=IN_LIF + +# access definitions +schan_intr_enable=0 +tdma_intr_enable=0 +tslam_intr_enable=0 +miim_intr_enable=0 +schan_timeout_usec=300000 +tdma_timeout_usec=1000000 +tslam_timeout_usec=1000000 + +### Interrupts +appl_enable_intr_init=1 +polled_irq_mode=1 +# reduce CPU load, configure delay 100ms +polled_irq_delay=1000 + +# reduce the CPU load over adapter (caused by counter thread) +bcm_stat_interval=1000 + +# shadow memory +mem_cache_enable_ecc=1 +mem_cache_enable_parity=1 + +# serdes_nif/fabric_clk_freq_in/out configuration +serdes_nif_clk_freq_in=2 +serdes_nif_clk_freq_out=1 +serdes_fabric_clk_freq_in=2 +serdes_fabric_clk_freq_out=1 + +dport_map_direct=1 + +rif_id_max=0x6000 + +phy_rx_polarity_flip_phy0=0 +phy_rx_polarity_flip_phy1=0 +phy_rx_polarity_flip_phy2=0 +phy_rx_polarity_flip_phy3=0 +phy_rx_polarity_flip_phy4=0 +phy_rx_polarity_flip_phy5=0 +phy_rx_polarity_flip_phy6=0 +phy_rx_polarity_flip_phy7=0 +phy_rx_polarity_flip_phy8=1 +phy_rx_polarity_flip_phy9=1 +phy_rx_polarity_flip_phy10=0 +phy_rx_polarity_flip_phy11=0 +phy_rx_polarity_flip_phy12=1 +phy_rx_polarity_flip_phy13=1 +phy_rx_polarity_flip_phy14=0 +phy_rx_polarity_flip_phy15=1 +phy_rx_polarity_flip_phy16=0 +phy_rx_polarity_flip_phy17=0 +phy_rx_polarity_flip_phy18=0 +phy_rx_polarity_flip_phy19=0 +phy_rx_polarity_flip_phy20=0 +phy_rx_polarity_flip_phy21=0 +phy_rx_polarity_flip_phy22=0 +phy_rx_polarity_flip_phy23=0 +phy_rx_polarity_flip_phy24=0 +phy_rx_polarity_flip_phy25=0 +phy_rx_polarity_flip_phy26=0 +phy_rx_polarity_flip_phy27=0 +phy_rx_polarity_flip_phy28=0 +phy_rx_polarity_flip_phy29=0 +phy_rx_polarity_flip_phy30=0 +phy_rx_polarity_flip_phy31=0 +phy_rx_polarity_flip_phy32=0 +phy_rx_polarity_flip_phy33=0 +phy_rx_polarity_flip_phy34=0 +phy_rx_polarity_flip_phy35=0 +phy_rx_polarity_flip_phy36=0 +phy_rx_polarity_flip_phy37=0 +phy_rx_polarity_flip_phy38=0 +phy_rx_polarity_flip_phy39=0 +phy_rx_polarity_flip_phy40=0 +phy_rx_polarity_flip_phy41=0 +phy_rx_polarity_flip_phy42=0 +phy_rx_polarity_flip_phy43=0 +phy_rx_polarity_flip_phy44=0 +phy_rx_polarity_flip_phy45=0 +phy_rx_polarity_flip_phy46=0 +phy_rx_polarity_flip_phy47=0 +phy_rx_polarity_flip_phy48=0 +phy_rx_polarity_flip_phy49=0 +phy_rx_polarity_flip_phy50=0 +phy_rx_polarity_flip_phy51=0 +phy_rx_polarity_flip_phy52=0 +phy_rx_polarity_flip_phy53=0 +phy_rx_polarity_flip_phy54=0 +phy_rx_polarity_flip_phy55=0 +phy_rx_polarity_flip_phy56=0 +phy_rx_polarity_flip_phy57=0 +phy_rx_polarity_flip_phy58=0 +phy_rx_polarity_flip_phy59=0 +phy_rx_polarity_flip_phy60=0 +phy_rx_polarity_flip_phy61=0 +phy_rx_polarity_flip_phy62=0 +phy_rx_polarity_flip_phy63=0 +phy_rx_polarity_flip_phy64=0 +phy_rx_polarity_flip_phy65=0 +phy_rx_polarity_flip_phy66=0 +phy_rx_polarity_flip_phy67=0 +phy_rx_polarity_flip_phy68=0 +phy_rx_polarity_flip_phy69=0 +phy_rx_polarity_flip_phy70=0 +phy_rx_polarity_flip_phy71=0 +phy_rx_polarity_flip_phy72=1 +phy_rx_polarity_flip_phy73=1 +phy_rx_polarity_flip_phy74=0 +phy_rx_polarity_flip_phy75=1 +phy_rx_polarity_flip_phy76=1 +phy_rx_polarity_flip_phy77=1 +phy_rx_polarity_flip_phy78=1 +phy_rx_polarity_flip_phy79=1 +phy_rx_polarity_flip_phy80=0 +phy_rx_polarity_flip_phy81=0 +phy_rx_polarity_flip_phy82=0 +phy_rx_polarity_flip_phy83=0 +phy_rx_polarity_flip_phy84=0 +phy_rx_polarity_flip_phy85=0 +phy_rx_polarity_flip_phy86=0 +phy_rx_polarity_flip_phy87=0 +phy_rx_polarity_flip_phy88=0 +phy_rx_polarity_flip_phy89=0 +phy_rx_polarity_flip_phy90=0 +phy_rx_polarity_flip_phy91=0 +phy_rx_polarity_flip_phy92=0 +phy_rx_polarity_flip_phy93=0 +phy_rx_polarity_flip_phy94=0 +phy_rx_polarity_flip_phy95=0 +phy_rx_polarity_flip_phy96=0 +phy_rx_polarity_flip_phy97=0 +phy_rx_polarity_flip_phy98=0 +phy_rx_polarity_flip_phy99=0 +phy_rx_polarity_flip_phy100=0 +phy_rx_polarity_flip_phy101=0 +phy_rx_polarity_flip_phy102=0 +phy_rx_polarity_flip_phy103=0 +phy_rx_polarity_flip_phy104=0 +phy_rx_polarity_flip_phy105=0 +phy_rx_polarity_flip_phy106=0 +phy_rx_polarity_flip_phy107=0 +phy_rx_polarity_flip_phy108=0 +phy_rx_polarity_flip_phy109=0 +phy_rx_polarity_flip_phy110=0 +phy_rx_polarity_flip_phy111=0 +phy_rx_polarity_flip_phy112=0 +phy_rx_polarity_flip_phy113=0 +phy_rx_polarity_flip_phy114=0 +phy_rx_polarity_flip_phy115=0 +phy_rx_polarity_flip_phy116=0 +phy_rx_polarity_flip_phy117=0 +phy_rx_polarity_flip_phy118=0 +phy_rx_polarity_flip_phy119=0 +phy_rx_polarity_flip_phy120=0 +phy_rx_polarity_flip_phy121=0 +phy_rx_polarity_flip_phy122=0 +phy_rx_polarity_flip_phy123=0 +phy_rx_polarity_flip_phy124=0 +phy_rx_polarity_flip_phy125=0 +phy_rx_polarity_flip_phy126=0 +phy_rx_polarity_flip_phy127=0 +phy_rx_polarity_flip_phy128=0 +phy_rx_polarity_flip_phy129=0 +phy_rx_polarity_flip_phy130=0 +phy_rx_polarity_flip_phy131=0 +phy_rx_polarity_flip_phy132=0 +phy_rx_polarity_flip_phy133=0 +phy_rx_polarity_flip_phy134=0 +phy_rx_polarity_flip_phy135=0 +phy_rx_polarity_flip_phy136=0 +phy_rx_polarity_flip_phy137=0 +phy_rx_polarity_flip_phy138=0 +phy_rx_polarity_flip_phy139=0 +phy_rx_polarity_flip_phy140=0 +phy_rx_polarity_flip_phy141=0 +phy_rx_polarity_flip_phy142=0 +phy_rx_polarity_flip_phy143=0 +phy_tx_polarity_flip_phy0=1 +phy_tx_polarity_flip_phy1=1 +phy_tx_polarity_flip_phy2=1 +phy_tx_polarity_flip_phy3=1 +phy_tx_polarity_flip_phy4=1 +phy_tx_polarity_flip_phy5=1 +phy_tx_polarity_flip_phy6=1 +phy_tx_polarity_flip_phy7=1 +phy_tx_polarity_flip_phy8=1 +phy_tx_polarity_flip_phy9=1 +phy_tx_polarity_flip_phy10=1 +phy_tx_polarity_flip_phy11=1 +phy_tx_polarity_flip_phy12=1 +phy_tx_polarity_flip_phy13=1 +phy_tx_polarity_flip_phy14=1 +phy_tx_polarity_flip_phy15=1 +phy_tx_polarity_flip_phy16=1 +phy_tx_polarity_flip_phy17=1 +phy_tx_polarity_flip_phy18=1 +phy_tx_polarity_flip_phy19=1 +phy_tx_polarity_flip_phy20=1 +phy_tx_polarity_flip_phy21=1 +phy_tx_polarity_flip_phy22=1 +phy_tx_polarity_flip_phy23=1 +phy_tx_polarity_flip_phy24=1 +phy_tx_polarity_flip_phy25=1 +phy_tx_polarity_flip_phy26=1 +phy_tx_polarity_flip_phy27=1 +phy_tx_polarity_flip_phy28=1 +phy_tx_polarity_flip_phy29=1 +phy_tx_polarity_flip_phy30=1 +phy_tx_polarity_flip_phy31=1 +phy_tx_polarity_flip_phy32=1 +phy_tx_polarity_flip_phy33=1 +phy_tx_polarity_flip_phy34=1 +phy_tx_polarity_flip_phy35=1 +phy_tx_polarity_flip_phy36=1 +phy_tx_polarity_flip_phy37=1 +phy_tx_polarity_flip_phy38=1 +phy_tx_polarity_flip_phy39=1 +phy_tx_polarity_flip_phy40=1 +phy_tx_polarity_flip_phy41=1 +phy_tx_polarity_flip_phy42=1 +phy_tx_polarity_flip_phy43=1 +phy_tx_polarity_flip_phy44=1 +phy_tx_polarity_flip_phy45=1 +phy_tx_polarity_flip_phy46=1 +phy_tx_polarity_flip_phy47=1 +phy_tx_polarity_flip_phy48=1 +phy_tx_polarity_flip_phy49=1 +phy_tx_polarity_flip_phy50=1 +phy_tx_polarity_flip_phy51=1 +phy_tx_polarity_flip_phy52=1 +phy_tx_polarity_flip_phy53=1 +phy_tx_polarity_flip_phy54=1 +phy_tx_polarity_flip_phy55=1 +phy_tx_polarity_flip_phy56=1 +phy_tx_polarity_flip_phy57=1 +phy_tx_polarity_flip_phy58=1 +phy_tx_polarity_flip_phy59=1 +phy_tx_polarity_flip_phy60=1 +phy_tx_polarity_flip_phy61=1 +phy_tx_polarity_flip_phy62=1 +phy_tx_polarity_flip_phy63=1 +phy_tx_polarity_flip_phy64=1 +phy_tx_polarity_flip_phy65=1 +phy_tx_polarity_flip_phy66=1 +phy_tx_polarity_flip_phy67=1 +phy_tx_polarity_flip_phy68=1 +phy_tx_polarity_flip_phy69=1 +phy_tx_polarity_flip_phy70=1 +phy_tx_polarity_flip_phy71=1 +phy_tx_polarity_flip_phy72=0 +phy_tx_polarity_flip_phy73=0 +phy_tx_polarity_flip_phy74=0 +phy_tx_polarity_flip_phy75=0 +phy_tx_polarity_flip_phy76=0 +phy_tx_polarity_flip_phy77=0 +phy_tx_polarity_flip_phy78=0 +phy_tx_polarity_flip_phy79=0 +phy_tx_polarity_flip_phy80=0 +phy_tx_polarity_flip_phy81=0 +phy_tx_polarity_flip_phy82=0 +phy_tx_polarity_flip_phy83=0 +phy_tx_polarity_flip_phy84=0 +phy_tx_polarity_flip_phy85=0 +phy_tx_polarity_flip_phy86=0 +phy_tx_polarity_flip_phy87=0 +phy_tx_polarity_flip_phy88=1 +phy_tx_polarity_flip_phy89=1 +phy_tx_polarity_flip_phy90=1 +phy_tx_polarity_flip_phy91=1 +phy_tx_polarity_flip_phy92=1 +phy_tx_polarity_flip_phy93=1 +phy_tx_polarity_flip_phy94=1 +phy_tx_polarity_flip_phy95=1 +phy_tx_polarity_flip_phy96=1 +phy_tx_polarity_flip_phy97=1 +phy_tx_polarity_flip_phy98=1 +phy_tx_polarity_flip_phy99=1 +phy_tx_polarity_flip_phy100=1 +phy_tx_polarity_flip_phy101=1 +phy_tx_polarity_flip_phy102=1 +phy_tx_polarity_flip_phy103=1 +phy_tx_polarity_flip_phy104=1 +phy_tx_polarity_flip_phy105=1 +phy_tx_polarity_flip_phy106=1 +phy_tx_polarity_flip_phy107=1 +phy_tx_polarity_flip_phy108=1 +phy_tx_polarity_flip_phy109=1 +phy_tx_polarity_flip_phy110=1 +phy_tx_polarity_flip_phy111=1 +phy_tx_polarity_flip_phy112=1 +phy_tx_polarity_flip_phy113=1 +phy_tx_polarity_flip_phy114=1 +phy_tx_polarity_flip_phy115=1 +phy_tx_polarity_flip_phy116=1 +phy_tx_polarity_flip_phy117=1 +phy_tx_polarity_flip_phy118=1 +phy_tx_polarity_flip_phy119=1 +phy_tx_polarity_flip_phy120=1 +phy_tx_polarity_flip_phy121=1 +phy_tx_polarity_flip_phy122=1 +phy_tx_polarity_flip_phy123=1 +phy_tx_polarity_flip_phy124=1 +phy_tx_polarity_flip_phy125=1 +phy_tx_polarity_flip_phy126=1 +phy_tx_polarity_flip_phy127=1 +phy_tx_polarity_flip_phy128=1 +phy_tx_polarity_flip_phy129=1 +phy_tx_polarity_flip_phy130=1 +phy_tx_polarity_flip_phy131=1 +phy_tx_polarity_flip_phy132=1 +phy_tx_polarity_flip_phy133=1 +phy_tx_polarity_flip_phy134=1 +phy_tx_polarity_flip_phy135=1 +phy_tx_polarity_flip_phy136=1 +phy_tx_polarity_flip_phy137=1 +phy_tx_polarity_flip_phy138=1 +phy_tx_polarity_flip_phy139=1 +phy_tx_polarity_flip_phy140=1 +phy_tx_polarity_flip_phy141=1 +phy_tx_polarity_flip_phy142=1 +phy_tx_polarity_flip_phy143=1 + +serdes_tx_taps_1=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_2=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_3=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_4=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_5=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_6=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_7=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_8=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_9=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_10=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_11=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_12=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_13=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_14=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_15=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_16=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_17=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_18=nrz:-8:89:-29:0:0:0 +serdes_tx_taps_19=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_20=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_21=nrz:-4:75:-21:0:0:0 +serdes_tx_taps_22=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_23=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_24=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_25=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_26=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_27=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_28=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_29=nrz:-5:78:-22:0:0:0 +serdes_tx_taps_30=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_31=nrz:-7:85:-25:0:0:0 +serdes_tx_taps_32=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_33=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_34=nrz:-5:75:-20:0:0:0 +serdes_tx_taps_35=nrz:-5:80:-23:0:0:0 +serdes_tx_taps_36=nrz:-7:85:-25:0:0:0 + +serdes_tx_taps_1=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_2=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_3=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_4=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_5=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_6=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_7=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_8=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_9=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_10=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_11=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_12=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_13=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_14=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_15=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_16=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_17=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_18=pam4:-16:137:-12:2:0:-3 +serdes_tx_taps_19=pam4:-17:144:-1:2:-3:-3 +serdes_tx_taps_20=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_21=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_22=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_23=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_24=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_25=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_26=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_27=pam4:-16:139:-7:3:-2:-3 +serdes_tx_taps_28=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_29=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_30=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_31=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_32=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_33=pam4:-16:148:-3:2:0:-1 +serdes_tx_taps_34=pam4:-14:136:-14:2:0:-4 +serdes_tx_taps_35=pam4:-16:141:-5:3:-2:-3 +serdes_tx_taps_36=pam4:-16:137:-12:2:0:-3 + +xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 +xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/pg_profile_lookup.ini b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/pg_profile_lookup.ini new file mode 100644 index 00000000000..e8289ab0311 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 40000 300m 1280 2560 69632 0 1280 + 100000 300m 1280 2560 110592 0 1280 + 400000 300m 1280 2560 315392 0 1280 + 40000 1000m 1280 2560 114688 0 1280 + 100000 1000m 1280 2560 225280 0 1280 + 400000 1000m 1280 2560 778240 0 1280 + 40000 2000m 1280 2560 184320 0 1280 + 100000 2000m 1280 2560 393216 0 1280 + 400000 2000m 1280 2560 1445888 0 1280 + 40000 80000m 1280 2560 5369856 0 1280 + 100000 80000m 1280 2560 13357056 0 1280 + 400000 80000m 1280 2560 53305344 0 1280 + 40000 120000m 1280 2560 8028160 0 1280 + 100000 120000m 1280 2560 20004864 0 1280 + 400000 120000m 1280 2560 79900672 0 1280 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/port_config.ini b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/port_config.ini new file mode 100644 index 00000000000..bfdbc47fcf2 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/port_config.ini @@ -0,0 +1,21 @@ +# name lanes alias index role speed asic_port_name coreId corePortId numVoq +Ethernet144 72,73,74,75,76,77,78,79 Ethernet19/1 21 Ext 400000 Eth0-ASIC1 1 1 8 +Ethernet152 80,81,82,83,84,85,86,87 Ethernet20/1 22 Ext 400000 Eth8-ASIC1 1 2 8 +Ethernet160 88,89,90,91,92,93,94,95 Ethernet21/1 23 Ext 400000 Eth16-ASIC1 1 3 8 +Ethernet168 96,97,98,99,100,101,102,103 Ethernet22/1 24 Ext 400000 Eth24-ASIC1 1 4 8 +Ethernet176 104,105,106,107,108,109,110,111 Ethernet23/1 25 Ext 400000 Eth32-ASIC1 1 5 8 +Ethernet184 112,113,114,115,116,117,118,119 Ethernet24/1 26 Ext 400000 Eth40-ASIC1 1 6 8 +Ethernet192 120,121,122,123,124,125,126,127 Ethernet25/1 27 Ext 400000 Eth48-ASIC1 1 7 8 +Ethernet200 128,129,130,131,132,133,134,135 Ethernet26/1 28 Ext 400000 Eth56-ASIC1 1 8 8 +Ethernet208 136,137,138,139,140,141,142,143 Ethernet27/1 29 Ext 400000 Eth64-ASIC1 1 9 8 +Ethernet216 64,65,66,67,68,69,70,71 Ethernet28/1 30 Ext 400000 Eth72-ASIC1 0 10 8 +Ethernet224 56,57,58,59,60,61,62,63 Ethernet29/1 31 Ext 400000 Eth80-ASIC1 0 11 8 +Ethernet232 48,49,50,51,52,53,54,55 Ethernet30/1 32 Ext 400000 Eth88-ASIC1 0 12 8 +Ethernet240 40,41,42,43,44,45,46,47 Ethernet31/1 33 Ext 400000 Eth96-ASIC1 0 13 8 +Ethernet248 32,33,34,35,36,37,38,39 Ethernet32/1 34 Ext 400000 Eth104-ASIC1 0 14 8 +Ethernet256 24,25,26,27,28,29,30,31 Ethernet33/1 35 Ext 400000 Eth112-ASIC1 0 15 8 +Ethernet264 16,17,18,19,20,21,22,23 Ethernet34/1 36 Ext 400000 Eth120-ASIC1 0 16 8 +Ethernet272 8,9,10,11,12,13,14,15 Ethernet35/1 37 Ext 400000 Eth128-ASIC1 0 17 8 +Ethernet280 0,1,2,3,4,5,6,7 Ethernet36/1 38 Ext 400000 Eth136-ASIC1 0 18 8 +Ethernet-Rec1 221 Recirc0/0 39 Rec 400000 Rcy0-ASIC1 0 221 8 +Ethernet-IB1 222 Recirc0/1 40 Inb 400000 Rcy1-ASIC1 1 222 8 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/qos.json.j2 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/qos.json.j2 new file mode 100644 index 00000000000..3e548325ea3 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/sai.profile b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/sai.profile new file mode 120000 index 00000000000..1e172f3e076 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-D36/1/sai.profile @@ -0,0 +1 @@ +../0/sai.profile \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36DM2-C36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36DM2-C36 new file mode 120000 index 00000000000..41ebc98e1c4 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36DM2-C36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-C36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36DM2-D36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36DM2-D36 new file mode 120000 index 00000000000..e029ef37b78 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36DM2-D36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-D36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36P-C36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36P-C36 new file mode 120000 index 00000000000..41ebc98e1c4 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36P-C36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-C36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36P-P36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36P-P36 new file mode 120000 index 00000000000..e029ef37b78 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36P-P36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-D36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36D2-C36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36D2-C36 new file mode 120000 index 00000000000..41ebc98e1c4 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36D2-C36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-C36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36D2-D36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36D2-D36 new file mode 120000 index 00000000000..e029ef37b78 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36D2-D36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-D36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36DM2-C36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36DM2-C36 new file mode 120000 index 00000000000..41ebc98e1c4 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36DM2-C36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-C36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36DM2-D36 b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36DM2-D36 new file mode 120000 index 00000000000..e029ef37b78 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3AK-36DM2-D36 @@ -0,0 +1 @@ +Arista-7800R3A-36D2-D36 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/platform_env.conf b/device/arista/x86_64-arista_7800r3a_36d2_lc/platform_env.conf index 558fb7393f6..0f19ad3cadb 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/platform_env.conf +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/platform_env.conf @@ -1,2 +1,3 @@ usemsi=1 dmasize=64M +macsec_enabled=1 diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_defaults_t0.j2 b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_defaults_t0.j2 index a06f62f733a..89485794926 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_defaults_t0.j2 +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_defaults_t0.j2 @@ -1,12 +1,12 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '23850816' %} -{% set ingress_lossy_pool_size = '36222208' %} -{% set egress_lossless_pool_size = '29482816' %} -{% set egress_lossy_pool_size = '26400000' %} +{% set ingress_lossless_pool_size = '43067728' %} +{% set ingress_lossy_pool_size = '3520000' %} +{% set egress_lossless_pool_size = '46749824' %} +{% set egress_lossy_pool_size = '2463824' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} - {%- for port_idx in range(0,32) %} + {%- for port_idx in range(0, 32) %} {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} {%- endfor %} {%- endmacro %} @@ -15,6 +15,9 @@ "BUFFER_POOL": { "ingress_lossless_pool": { "size": "{{ ingress_lossless_pool_size }}", + {%- if dynamic_mode is defined %} + "xoff": "3153920", + {%- endif %} "type": "ingress", "mode": "dynamic" }, diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_defaults_t1.j2 b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_defaults_t1.j2 index a06f62f733a..89485794926 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_defaults_t1.j2 +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_defaults_t1.j2 @@ -1,12 +1,12 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '23850816' %} -{% set ingress_lossy_pool_size = '36222208' %} -{% set egress_lossless_pool_size = '29482816' %} -{% set egress_lossy_pool_size = '26400000' %} +{% set ingress_lossless_pool_size = '43067728' %} +{% set ingress_lossy_pool_size = '3520000' %} +{% set egress_lossless_pool_size = '46749824' %} +{% set egress_lossy_pool_size = '2463824' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} - {%- for port_idx in range(0,32) %} + {%- for port_idx in range(0, 32) %} {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} {%- endfor %} {%- endmacro %} @@ -15,6 +15,9 @@ "BUFFER_POOL": { "ingress_lossless_pool": { "size": "{{ ingress_lossless_pool_size }}", + {%- if dynamic_mode is defined %} + "xoff": "3153920", + {%- endif %} "type": "ingress", "mode": "dynamic" }, diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_dynamic.json.j2 b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_dynamic.json.j2 new file mode 100644 index 00000000000..426aee9cd8d --- /dev/null +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/buffers_dynamic.json.j2 @@ -0,0 +1,4 @@ +{%- set default_topo = 't0' %} +{%- set dynamic_mode = 'true' %} +{%- set shp = 'true' %} +{%- include 'buffers_config.j2' %} diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf index 2789eb0e2c0..9a6ae5b120f 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf @@ -23,7 +23,7 @@ ], "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, - "non_default_port_ppgs": 5 + "non_default_port_ppgs": 6 } ] } @@ -32,7 +32,7 @@ { "device-id": 0, "model_json_path": "share/switch/aug_model.json", - "non_default_port_ppgs": 5, + "non_default_port_ppgs": 6, "switchapi_port_add": false } ] diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json b/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json index abd2fec0a30..191f0c4834e 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json @@ -133,11 +133,31 @@ "psus": [ { "name": "psu-1", - "temperature": false + "thermals": [ + { + "name": "psu_driver-i2c-7-5a:psu1-temp1" + }, + { + "name": "psu_driver-i2c-7-5a:psu1-temp2" + }, + { + "name": "psu_driver-i2c-7-5a:psu1-temp3" + } + ] }, { "name": "psu-2", - "temperature": false + "thermals": [ + { + "name": "psu_driver-i2c-7-59:psu2-temp1" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp2" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp3" + } + ] } ], "thermals": [ @@ -147,24 +167,6 @@ { "name": "com_e_driver-i2c-4-33:memory-temp" }, - { - "name": "psu_driver-i2c-7-59:psu2-temp1" - }, - { - "name": "psu_driver-i2c-7-59:psu2-temp2" - }, - { - "name": "psu_driver-i2c-7-59:psu2-temp3" - }, - { - "name": "psu_driver-i2c-7-5a:psu1-temp1" - }, - { - "name": "psu_driver-i2c-7-5a:psu1-temp2" - }, - { - "name": "psu_driver-i2c-7-5a:psu1-temp3" - }, { "name": "tmp75-i2c-3-48:chip-temp" }, diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/port_peripheral_config.j2 b/device/barefoot/x86_64-accton_as9516_32d-r0/port_peripheral_config.j2 new file mode 100644 index 00000000000..c1322ec2cc6 --- /dev/null +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/port_peripheral_config.j2 @@ -0,0 +1,10 @@ +[ + {%- include 'peripheral_table.j2' %} + , + { + "PORT_PERIPHERAL_TABLE:global": { + "gearbox_model": "barefoot" + }, + "OP": "SET" + } +] diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json index 5fee4f0eeba..e788dbeff20 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json @@ -9,51 +9,131 @@ "name": "BMC" } ], + "thermal_manager": false, "fans": [ { - "name": "counter-rotating-fan-1" - }, - { - "name": "counter-rotating-fan-2" - }, - { - "name": "counter-rotating-fan-3" - }, - { - "name": "counter-rotating-fan-4" - }, - { - "name": "counter-rotating-fan-5" + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ], "fan_drawers": [ { "name": "fantray-1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "counter-rotating-fan-1" + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-2" + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-3" + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-4" + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-5" + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] } ], "psus": [ { - "name": "psu-1" + "name": "psu-1", + "thermals": [ + { + "name": "psu_driver-i2c-7-5a:psu1-temp1" + }, + { + "name": "psu_driver-i2c-7-5a:psu1-temp2" + } + ] }, { - "name": "psu-2" + "name": "psu-2", + "thermals": [ + { + "name": "psu_driver-i2c-7-59:psu2-temp1" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp2" + } + ] } ], "thermals": [ @@ -63,18 +143,6 @@ { "name": "com_e_driver-i2c-4-33:memory-temp" }, - { - "name": "psu_driver-i2c-7-59:psu2-temp1" - }, - { - "name": "psu_driver-i2c-7-59:psu2-temp2" - }, - { - "name": "psu_driver-i2c-7-5a:psu1-temp1" - }, - { - "name": "psu_driver-i2c-7-5a:psu1-temp2" - }, { "name": "tmp75-i2c-3-48:chip-temp" }, diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json index 73bb6008dbb..f302883f409 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json @@ -1,89 +1,502 @@ { "chassis": { - "name": "Mavericks", + "name": "Wedge100BF-65X-O-AC-F-BF", + "components": [ + { + "name": "BIOS" + }, + { + "name": "BMC" + } + ], + "thermal_manager": false, "fans": [ { - "name": "counter-rotating-fan-1" + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-2" + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-3" + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-4" + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-5" + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-6" + "name": "counter-rotating-fan-6", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-7" + "name": "counter-rotating-fan-7", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-8" + "name": "counter-rotating-fan-8", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-9" + "name": "counter-rotating-fan-9", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-10" + "name": "counter-rotating-fan-10", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ], "fan_drawers": [ { "name": "fantray-1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "counter-rotating-fan-1" + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-2" + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-3" + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-4" + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-5" + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] }, { "name": "fantray-2", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "counter-rotating-fan-6" + "name": "counter-rotating-fan-6", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-7", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-7" + "name": "counter-rotating-fan-8", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-8" + "name": "counter-rotating-fan-9", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-9" + "name": "counter-rotating-fan-10", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + } + ] + } + ], + "psus": [ + { + "name": "psu-1", + "thermals": [ + { + "name": "psu_driver-i2c-7-5a:psu1-temp1" }, { - "name": "counter-rotating-fan-10" + "name": "psu_driver-i2c-7-5a:psu1-temp2" } ] + }, + { + "name": "psu-2", + "thermals": [ + { + "name": "psu_driver-i2c-7-59:psu2-temp1" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp2" + } + ] + } + ], + "thermals": [ + { + "name": "com_e_driver-i2c-4-33:cpu-temp" + }, + { + "name": "com_e_driver-i2c-4-33:memory-temp" + }, + { + "name": "coretemp-isa-0000:core-0" + }, + { + "name": "coretemp-isa-0000:core-1" + }, + { + "name": "coretemp-isa-0000:core-2" + }, + { + "name": "coretemp-isa-0000:core-3" + }, + { + "name": "coretemp-isa-0000:package-id-0" + }, + { + "name": "max6658-i2c-9-4c:come-board-temp" + }, + { + "name": "max6658-i2c-9-4c:max6658-chip-temp" + }, + { + "name": "pch_haswell-virtual-0:temp1" + }, + { + "name": "tmp75-i2c-3-4a:exhaust-temp" + }, + { + "name": "tmp75-i2c-3-4b:intake-temp" + }, + { + "name": "tmp75-i2c-3-4c:intake2-temp" + }, + { + "name": "tmp75-i2c-3-48:chip-temp" + }, + { + "name": "tmp75-i2c-3-49:exhaust2-temp" + }, + { + "name": "tmp75-i2c-8-48:fan-board-outlet-right-temp" + }, + { + "name": "tmp75-i2c-8-49:fan-board-outlet-left-temp" + }, + { + "name": "tmp75-i2c-9-4a:upper-board-intake-temp" + }, + { + "name": "tmp75-i2c-9-4b:upper-board-tofino-temp" + }, + { + "name": "tmp75-i2c-9-48:upper-board-intake2-temp" + }, + { + "name": "tmp75-i2c-9-49:server-board-temp" + } + ], + "sfps": [ + { + "name": "sfp1" + }, + { + "name": "sfp2" + }, + { + "name": "sfp3" + }, + { + "name": "sfp4" + }, + { + "name": "sfp5" + }, + { + "name": "sfp6" + }, + { + "name": "sfp7" + }, + { + "name": "sfp8" + }, + { + "name": "sfp9" + }, + { + "name": "sfp10" + }, + { + "name": "sfp11" + }, + { + "name": "sfp12" + }, + { + "name": "sfp13" + }, + { + "name": "sfp14" + }, + { + "name": "sfp15" + }, + { + "name": "sfp16" + }, + { + "name": "sfp17" + }, + { + "name": "sfp18" + }, + { + "name": "sfp19" + }, + { + "name": "sfp20" + }, + { + "name": "sfp21" + }, + { + "name": "sfp22" + }, + { + "name": "sfp23" + }, + { + "name": "sfp24" + }, + { + "name": "sfp25" + }, + { + "name": "sfp26" + }, + { + "name": "sfp27" + }, + { + "name": "sfp28" + }, + { + "name": "sfp29" + }, + { + "name": "sfp30" + }, + { + "name": "sfp31" + }, + { + "name": "sfp32" + }, + { + "name": "sfp33" + }, + { + "name": "sfp34" + }, + { + "name": "sfp35" + }, + { + "name": "sfp36" + }, + { + "name": "sfp37" + }, + { + "name": "sfp38" + }, + { + "name": "sfp39" + }, + { + "name": "sfp40" + }, + { + "name": "sfp41" + }, + { + "name": "sfp42" + }, + { + "name": "sfp43" + }, + { + "name": "sfp44" + }, + { + "name": "sfp45" + }, + { + "name": "sfp46" + }, + { + "name": "sfp47" + }, + { + "name": "sfp48" + }, + { + "name": "sfp49" + }, + { + "name": "sfp50" + }, + { + "name": "sfp51" + }, + { + "name": "sfp52" + }, + { + "name": "sfp53" + }, + { + "name": "sfp54" + }, + { + "name": "sfp55" + }, + { + "name": "sfp56" + }, + { + "name": "sfp57" + }, + { + "name": "sfp58" + }, + { + "name": "sfp59" + }, + { + "name": "sfp60" + }, + { + "name": "sfp61" + }, + { + "name": "sfp62" + }, + { + "name": "sfp63" + }, + { + "name": "sfp64" + }, + { + "name": "sfp65" } ] }, - "psus": [ - { - "name": "psu-1" - }, - { - "name": "psu-2" - } - ], "interfaces": { "Ethernet0": { "index": "1,1,1,1", diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform_components.json b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform_components.json index 74e851a7c4b..693d21643f2 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform_components.json +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform_components.json @@ -2,7 +2,9 @@ "chassis": { "Wedge100BF-65X-O-AC-F-BF": { "component": { + "BIOS": { }, + "BMC": { } } } } -} \ No newline at end of file +} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/thermal_thresholds.json b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/thermal_thresholds.json new file mode 100644 index 00000000000..e53dc0443c2 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/thermal_thresholds.json @@ -0,0 +1,79 @@ +{ + "thermals": [ + { + "com_e_driver-i2c-4-33:cpu-temp" : [99.0, 89.0, 11.0, 1.0] + }, + { + "com_e_driver-i2c-4-33:memory-temp" : [85.0, 75.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-0" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-1" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-2" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-3" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:package-id-0" : [80.0, 70.0, 11.0, 1.0] + }, + { + "max6658-i2c-9-4c:come-board-temp" : [85.0, 70.0, 11.0, 1.0] + }, + { + "max6658-i2c-9-4c:max6658-chip-temp" : [85.0, 70.0, 11.0, 1.0] + }, + { + "pch_haswell-virtual-0:temp1" : [80.0, 70.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-5a:psu1-temp1" : [60.0, 40.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-5a:psu1-temp2" : [80.0, 60.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-59:psu2-temp1" : [60.0, 40.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-59:psu2-temp2" : [80.0, 60.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4a:exhaust-temp" : [90.0, 80.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4b:intake-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4c:intake2-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-48:chip-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-49:exhaust2-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-8-48:fan-board-outlet-right-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-8-49:fan-board-outlet-left-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-9-4a:upper-board-intake-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-9-4b:upper-board-tofino-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-9-48:upper-board-intake2-temp" : [90.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-9-49:server-board-temp" : [90.0, 70.0, 11.0, 1.0] + } + ] +} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t0.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t0.config.bcm index e5e60d51b32..be9cef5600c 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t0.config.bcm +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t0.config.bcm @@ -14,6 +14,7 @@ l2xmsg_mode=1 l2_mem_entries=8192 l3_mem_entries=8192 l3_alpm_enable=2 +lpm_scaling_enable=0 ipv6_lpm_128b_enable=1 mmu_lossless=0 diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t1.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t1.config.bcm index 3ff49d672fc..1f90464d418 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t1.config.bcm +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t1.config.bcm @@ -14,6 +14,7 @@ l2xmsg_mode=1 l2_mem_entries=8192 l3_mem_entries=8192 l3_alpm_enable=2 +lpm_scaling_enable=0 ipv6_lpm_128b_enable=1 mmu_lossless=0 diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/th-seastone-dx010-48x50G+8x100G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/th-seastone-dx010-48x50G+8x100G.config.bcm index 787cce0d986..e8001c9bc90 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/th-seastone-dx010-48x50G+8x100G.config.bcm +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/th-seastone-dx010-48x50G+8x100G.config.bcm @@ -1,655 +1,658 @@ -# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose -l3_alpm_hit_skip=1 - -# Disable Counting ACL Drop towards interface RX_DRP counter -sai_adjust_acl_drop_in_rx_drop=1 - -os=unix -l2xmsg_mode=1 -parity_enable=0 -rate_ext_mdio_divisor=0x80 -phy_ext_rom_boot=0 -fpem_mem_entries=32768 -l2xmsg_mode=1 -oversubscribe_mode=1 -pbmp_xport_xe=0xcccc44cc33113333044cccccc66666622 - - -dport_map_enable=1 -dport_map_port_68=1 -dport_map_port_69=2 - -dport_map_port_72=5 -dport_map_port_73=6 - -dport_map_port_76=9 -dport_map_port_77=10 - -dport_map_port_80=13 -dport_map_port_81=14 - -dport_map_port_34=17 -dport_map_port_35=18 - -dport_map_port_38=21 -dport_map_port_39=22 - -dport_map_port_42=25 -dport_map_port_43=26 - -dport_map_port_46=29 -dport_map_port_47=30 - -dport_map_port_50=33 -dport_map_port_51=34 - -dport_map_port_54=37 -dport_map_port_55=38 - -dport_map_port_58=41 - -dport_map_port_62=45 - -dport_map_port_84=49 - -dport_map_port_88=53 - -dport_map_port_92=57 -dport_map_port_93=58 - -dport_map_port_96=61 -dport_map_port_97=62 - -dport_map_port_102=65 -dport_map_port_103=66 - -dport_map_port_106=69 -dport_map_port_107=70 - -dport_map_port_110=73 - -dport_map_port_114=77 - -dport_map_port_1=81 - -dport_map_port_5=85 - -dport_map_port_9=89 -dport_map_port_10=90 - -dport_map_port_13=93 -dport_map_port_14=94 - -dport_map_port_17=97 -dport_map_port_18=98 - -dport_map_port_21=101 -dport_map_port_22=102 - -dport_map_port_25=105 -dport_map_port_26=106 - -dport_map_port_29=109 -dport_map_port_30=110 - -dport_map_port_118=113 -dport_map_port_119=114 - -dport_map_port_122=117 -dport_map_port_123=118 - -dport_map_port_126=121 -dport_map_port_127=122 - -dport_map_port_130=125 -dport_map_port_131=126 - - -# port mapping -portmap_68=65:50:2 -portmap_69=67:50:2 - -portmap_72=69:50:2 -portmap_73=71:50:2 - -portmap_76=73:50:2 -portmap_77=75:50:2 - -portmap_80=77:50:2 -portmap_81=79:50:2 - -portmap_34=33:50:2 -portmap_35=35:50:2 - -portmap_38=37:50:2 -portmap_39=39:50:2 - -portmap_42=41:50:2 -portmap_43=43:50:2 - -portmap_46=45:50:2 -portmap_47=47:50:2 - -portmap_50=49:50:2 -portmap_51=51:50:2 - -portmap_54=53:50:2 -portmap_55=55:50:2 - -portmap_58=57:100:4 - -portmap_62=61:100:4 - -portmap_84=81:100:4 - -portmap_88=85:100:4 - -portmap_92=89:50:2 -portmap_93=91:50:2 - -portmap_96=93:50:2 -portmap_97=95:50:2 - -portmap_102=97:50:2 -portmap_103=99:50:2 - -portmap_106=101:50:2 -portmap_107=103:50:2 - -portmap_110=105:100:4 - -portmap_114=109:100:4 - -portmap_1=1:100:4 - -portmap_5=5:100:4 - -portmap_9=9:50:2 -portmap_10=11:50:2 - -portmap_13=13:50:2 -portmap_14=15:50:2 - -portmap_17=17:50:2 -portmap_18=19:50:2 - -portmap_21=21:50:2 -portmap_22=23:50:2 - -portmap_25=25:50:2 -portmap_26=27:50:2 - -portmap_29=29:50:2 -portmap_30=31:50:2 - -portmap_118=113:50:2 -portmap_119=115:50:2 - -portmap_122=117:50:2 -portmap_123=119:50:2 - -portmap_126=121:50:2 -portmap_127=123:50:2 - -portmap_130=125:50:2 -portmap_131=127:50:2 - - -#WC16 -xgxs_tx_lane_map_68=0x1023 -xgxs_rx_lane_map_68=0x0132 -xgxs_tx_lane_map_69=0x1023 -xgxs_rx_lane_map_69=0x0132 - - -#WC17 -xgxs_tx_lane_map_72=0x1023 -xgxs_rx_lane_map_72=0x1032 -xgxs_tx_lane_map_73=0x1023 -xgxs_rx_lane_map_73=0x1032 - -#WC18 -xgxs_tx_lane_map_76=0x2310 -xgxs_rx_lane_map_76=0x3210 -xgxs_tx_lane_map_77=0x2310 -xgxs_rx_lane_map_77=0x3210 - -#WC19 -xgxs_tx_lane_map_80=0x1302 -xgxs_rx_lane_map_80=0x0231 -xgxs_tx_lane_map_81=0x1302 -xgxs_rx_lane_map_81=0x0231 -#WC8 -xgxs_tx_lane_map_34=0x1203 -xgxs_rx_lane_map_34=0x3120 -xgxs_tx_lane_map_35=0x1203 -xgxs_rx_lane_map_35=0x3120 - -#WC9 -xgxs_tx_lane_map_38=0x0123 -xgxs_rx_lane_map_38=0x3201 -xgxs_tx_lane_map_39=0x0123 -xgxs_rx_lane_map_39=0x3201 - -#WC10 -xgxs_tx_lane_map_42=0x0132 -xgxs_rx_lane_map_42=0x0123 -xgxs_tx_lane_map_43=0x0132 -xgxs_rx_lane_map_43=0x0123 - -#WC11 -xgxs_tx_lane_map_46=0x2301 -xgxs_rx_lane_map_46=0x2031 -xgxs_tx_lane_map_47=0x2301 -xgxs_rx_lane_map_47=0x2031 - -#WC12 -xgxs_tx_lane_map_50=0x1032 -xgxs_rx_lane_map_50=0x3120 -xgxs_tx_lane_map_51=0x1032 -xgxs_rx_lane_map_51=0x3120 - - -#WC13 -xgxs_tx_lane_map_54=0x1032 -xgxs_rx_lane_map_54=0x0132 -xgxs_tx_lane_map_55=0x1032 -xgxs_rx_lane_map_55=0x0132 - -#WC14 - xgxs_tx_lane_map_58=0x1032 - xgxs_rx_lane_map_58=0x3120 - -#WC15 -xgxs_tx_lane_map_62=0x2031 -xgxs_rx_lane_map_62=0x0132 - -#WC20 - xgxs_tx_lane_map_84=0x3120 - xgxs_rx_lane_map_84=0x1032 - -#WC21 -xgxs_tx_lane_map_88=0x2310 -xgxs_rx_lane_map_88=0x0123 - -#WC22 -xgxs_tx_lane_map_92=0x2310 -xgxs_rx_lane_map_92=0x1302 -xgxs_tx_lane_map_93=0x2310 -xgxs_rx_lane_map_93=0x1302 - -#WC23 -xgxs_tx_lane_map_96=0x1302 -xgxs_rx_lane_map_96=0x1023 -xgxs_tx_lane_map_97=0x1302 -xgxs_rx_lane_map_97=0x1023 - -#WC24 -xgxs_tx_lane_map_102=0x2310 -xgxs_rx_lane_map_102=0x1032 -xgxs_tx_lane_map_103=0x2310 -xgxs_rx_lane_map_103=0x1032 - -#WC25 -xgxs_tx_lane_map_106=0x2310 -xgxs_rx_lane_map_106=0x1023 -xgxs_tx_lane_map_107=0x2310 -xgxs_rx_lane_map_107=0x1023 - -#WC26 -xgxs_tx_lane_map_110=0x2310 -xgxs_rx_lane_map_110=0x1302 - -#WC27 -xgxs_tx_lane_map_114=0x1302 -xgxs_rx_lane_map_114=0x1032 - -#WC0 -xgxs_tx_lane_map_1=0x0123 -xgxs_rx_lane_map_1=0x0213 - -#WC1 -xgxs_tx_lane_map_5=0x2310 -xgxs_rx_lane_map_5=0x3201 - -#WC2 -xgxs_tx_lane_map_9=0x1023 -xgxs_rx_lane_map_9=0x0213 -xgxs_tx_lane_map_10=0x1023 -xgxs_rx_lane_map_10=0x0213 - -#WC3 -xgxs_tx_lane_map_13=0x1302 -xgxs_rx_lane_map_13=0x3201 -xgxs_tx_lane_map_14=0x1302 -xgxs_rx_lane_map_14=0x3201 - -#WC4 -xgxs_tx_lane_map_17=0x0132 -xgxs_rx_lane_map_17=0x0123 -xgxs_tx_lane_map_18=0x0132 -xgxs_rx_lane_map_18=0x0123 - -#WC5 -xgxs_tx_lane_map_21=0x1032 -xgxs_rx_lane_map_21=0x0213 -xgxs_tx_lane_map_22=0x1032 -xgxs_rx_lane_map_22=0x0213 - -#WC6 -xgxs_tx_lane_map_25=0x1023 -xgxs_rx_lane_map_25=0x3120 -xgxs_tx_lane_map_26=0x1023 -xgxs_rx_lane_map_26=0x3120 - -#WC7 -xgxs_tx_lane_map_29=0x2031 -xgxs_rx_lane_map_29=0x3201 -xgxs_tx_lane_map_30=0x2031 -xgxs_rx_lane_map_30=0x3201 - -#WC28 -xgxs_tx_lane_map_118=0x0231 -xgxs_rx_lane_map_118=0x2031 -xgxs_tx_lane_map_119=0x0231 -xgxs_rx_lane_map_119=0x2031 - -#WC29 -xgxs_tx_lane_map_122=0x3201 -xgxs_rx_lane_map_122=0x2301 -xgxs_tx_lane_map_123=0x3201 -xgxs_rx_lane_map_123=0x2301 - -#WC30 -xgxs_tx_lane_map_126=0x0213 -xgxs_rx_lane_map_126=0x0213 -xgxs_tx_lane_map_127=0x0213 -xgxs_rx_lane_map_127=0x0213 - -#WC31 -xgxs_tx_lane_map_130=0x2031 -xgxs_rx_lane_map_130=0x1032 -xgxs_tx_lane_map_131=0x2031 -xgxs_rx_lane_map_131=0x1032 - -#PN - -#WC16 -phy_xaui_tx_polarity_flip_68=0x0000 -phy_xaui_rx_polarity_flip_68=0x0000 -phy_xaui_tx_polarity_flip_69=0x0000 -phy_xaui_rx_polarity_flip_69=0x0000 - -#WC17 -phy_xaui_tx_polarity_flip_72=0x0003 -phy_xaui_rx_polarity_flip_72=0x0000 -phy_xaui_tx_polarity_flip_73=0x0002 -phy_xaui_rx_polarity_flip_73=0x0001 - - - -#WC18 -phy_xaui_tx_polarity_flip_76=0x0003 -phy_xaui_rx_polarity_flip_76=0x0000 -phy_xaui_tx_polarity_flip_77=0x0003 -phy_xaui_rx_polarity_flip_77=0x0000 - - -#WC19 -phy_xaui_tx_polarity_flip_80=0x0003 -phy_xaui_rx_polarity_flip_80=0x0003 -phy_xaui_tx_polarity_flip_81=0x0003 -phy_xaui_rx_polarity_flip_81=0x0003 - - -#WC8 -phy_xaui_tx_polarity_flip_34=0x0003 -phy_xaui_rx_polarity_flip_34=0x0000 -phy_xaui_tx_polarity_flip_35=0x0001 -phy_xaui_rx_polarity_flip_35=0x0000 - - -#WC9 -phy_xaui_tx_polarity_flip_38=0x0001 -phy_xaui_rx_polarity_flip_38=0x0000 -phy_xaui_tx_polarity_flip_39=0x0000 -phy_xaui_rx_polarity_flip_39=0x0000 - - -#WC10 -phy_xaui_tx_polarity_flip_42=0x0003 -phy_xaui_rx_polarity_flip_42=0x0000 -phy_xaui_tx_polarity_flip_43=0x0002 -phy_xaui_rx_polarity_flip_43=0x0000 - - -#WC11 -phy_xaui_tx_polarity_flip_46=0x0000 -phy_xaui_rx_polarity_flip_46=0x0000 -phy_xaui_tx_polarity_flip_47=0x0000 -phy_xaui_rx_polarity_flip_47=0x0000 - - -#WC12 -phy_xaui_tx_polarity_flip_50=0x0000 -phy_xaui_rx_polarity_flip_50=0x0000 -phy_xaui_tx_polarity_flip_51=0x0001 -phy_xaui_rx_polarity_flip_51=0x0000 - -#WC13 -phy_xaui_tx_polarity_flip_54=0x0000 -phy_xaui_rx_polarity_flip_54=0x0000 -phy_xaui_tx_polarity_flip_55=0x0001 -phy_xaui_rx_polarity_flip_55=0x0000 - -#WC14 -phy_xaui_tx_polarity_flip_58=0x0000 -phy_xaui_rx_polarity_flip_58=0x0000 - -#WC15 -phy_xaui_tx_polarity_flip_62=0x0005 -phy_xaui_rx_polarity_flip_62=0x000F - -#WC20 - phy_xaui_tx_polarity_flip_84=0x000E - phy_xaui_rx_polarity_flip_84=0x0007 - -#WC21 -phy_xaui_tx_polarity_flip_88=0x000B -phy_xaui_rx_polarity_flip_88=0x000B - -#WC22 -phy_xaui_tx_polarity_flip_92=0x0003 -phy_xaui_rx_polarity_flip_92=0x0001 -phy_xaui_tx_polarity_flip_93=0x0003 -phy_xaui_rx_polarity_flip_93=0x0000 - - -#WC23 -phy_xaui_tx_polarity_flip_96=0x0002 -phy_xaui_rx_polarity_flip_96=0x0000 -phy_xaui_tx_polarity_flip_97=0x0002 -phy_xaui_rx_polarity_flip_97=0x0000 - -#WC24 -phy_xaui_tx_polarity_flip_102=0x0000 -phy_xaui_rx_polarity_flip_102=0x0003 -phy_xaui_tx_polarity_flip_103=0x0000 -phy_xaui_rx_polarity_flip_103=0x0003 - - -#WC25 -phy_xaui_tx_polarity_flip_106=0x0003 -phy_xaui_rx_polarity_flip_106=0x0000 -phy_xaui_tx_polarity_flip_107=0x0003 -phy_xaui_rx_polarity_flip_107=0x0000 - -#WC26 -phy_xaui_tx_polarity_flip_110=0x000F -phy_xaui_rx_polarity_flip_110=0x000F - -#WC27 -phy_xaui_tx_polarity_flip_114=0x000F -phy_xaui_rx_polarity_flip_114=0x000E - -#WC0 -phy_xaui_tx_polarity_flip_1=0x000C -phy_xaui_rx_polarity_flip_1=0x000F - -#WC1 -phy_xaui_tx_polarity_flip_5=0x000E -phy_xaui_rx_polarity_flip_5=0x0000 - -#WC2 -phy_xaui_tx_polarity_flip_9=0x0000 -phy_xaui_rx_polarity_flip_9=0x0001 -phy_xaui_tx_polarity_flip_10=0x0001 -phy_xaui_rx_polarity_flip_10=0x0000 - - -#WC3 -phy_xaui_tx_polarity_flip_13=0x0003 -phy_xaui_rx_polarity_flip_13=0x0000 -phy_xaui_tx_polarity_flip_14=0x0003 -phy_xaui_rx_polarity_flip_14=0x0000 - -#WC4 -phy_xaui_tx_polarity_flip_17=0x0002 -phy_xaui_rx_polarity_flip_17=0x0000 -phy_xaui_tx_polarity_flip_18=0x0003 -phy_xaui_rx_polarity_flip_18=0x0000 - - -#WC5 -phy_xaui_tx_polarity_flip_21=0x0000 -phy_xaui_rx_polarity_flip_21=0x0000 -phy_xaui_tx_polarity_flip_22=0x0000 -phy_xaui_rx_polarity_flip_22=0x0000 - - -#WC6 -phy_xaui_tx_polarity_flip_25=0x0000 -phy_xaui_rx_polarity_flip_25=0x0002 -phy_xaui_tx_polarity_flip_26=0x0001 -phy_xaui_rx_polarity_flip_26=0x0002 - - -#WC7 -phy_xaui_tx_polarity_flip_29=0x0000 -phy_xaui_rx_polarity_flip_29=0x0000 -phy_xaui_tx_polarity_flip_30=0x0001 -phy_xaui_rx_polarity_flip_30=0x0000 - - -#WC28 -phy_xaui_tx_polarity_flip_118=0x0003 -phy_xaui_rx_polarity_flip_118=0x0003 -phy_xaui_tx_polarity_flip_119=0x0003 -phy_xaui_rx_polarity_flip_119=0x0003 - - -#WC29 -phy_xaui_tx_polarity_flip_122=0x0002 -phy_xaui_rx_polarity_flip_122=0x0000 -phy_xaui_tx_polarity_flip_123=0x0000 -phy_xaui_rx_polarity_flip_123=0x0000 - - -#WC30 -phy_xaui_tx_polarity_flip_126=0x0003 -phy_xaui_rx_polarity_flip_126=0x0000 -phy_xaui_tx_polarity_flip_127=0x0003 -phy_xaui_rx_polarity_flip_127=0x0000 - - -#WC31 -phy_xaui_tx_polarity_flip_130=0x0002 -phy_xaui_rx_polarity_flip_130=0x0000 -phy_xaui_tx_polarity_flip_131=0x0001 -phy_xaui_rx_polarity_flip_131=0x0000 - -#xe -serdes_driver_current=0x0a -serdes_preemphasis=0x1a5402 - -#ce0 -serdes_driver_current_lane0_58=0x0a -serdes_driver_current_lane1_58=0x09 -serdes_driver_current_lane2_58=0x09 -serdes_driver_current_lane3_58=0x0a -serdes_preemphasis_lane0_58=0x254902 -serdes_preemphasis_lane1_58=0x244a02 -serdes_preemphasis_lane2_58=0x244a02 -serdes_preemphasis_lane3_58=0x254902 - -#ce1 -serdes_driver_current_lane0_62=0x09 -serdes_driver_current_lane1_62=0x0a -serdes_driver_current_lane2_62=0x09 -serdes_driver_current_lane3_62=0x09 -serdes_preemphasis_lane0_62=0x244a02 -serdes_preemphasis_lane1_62=0x254902 -serdes_preemphasis_lane2_62=0x244a02 -serdes_preemphasis_lane3_62=0x244a02 - -#ce2 -serdes_driver_current_lane0_84=0x09 -serdes_driver_current_lane1_84=0x09 -serdes_driver_current_lane2_84=0x09 -serdes_driver_current_lane3_84=0x09 -serdes_preemphasis_lane0_84=0x204e02 -serdes_preemphasis_lane1_84=0x204e02 -serdes_preemphasis_lane2_84=0x204e02 -serdes_preemphasis_lane3_84=0x204e02 - -#ce3 -serdes_driver_current_lane0_88=0x09 -serdes_driver_current_lane1_88=0x08 -serdes_driver_current_lane2_88=0x08 -serdes_driver_current_lane3_88=0x09 -serdes_preemphasis_lane0_88=0x204e02 -serdes_preemphasis_lane1_88=0x1d5102 -serdes_preemphasis_lane2_88=0x1d5102 -serdes_preemphasis_lane3_88=0x204e02 - -#ce4 -serdes_driver_current_lane0_110=0x09 -serdes_driver_current_lane1_110=0x08 -serdes_driver_current_lane2_110=0x08 -serdes_driver_current_lane3_110=0x09 -serdes_preemphasis_lane0_110=0x204e02 -serdes_preemphasis_lane1_110=0x1d5102 -serdes_preemphasis_lane2_110=0x1d5102 -serdes_preemphasis_lane3_110=0x204e02 - -#ce5 -serdes_driver_current_lane0_114=0x09 -serdes_driver_current_lane1_114=0x08 -serdes_driver_current_lane2_114=0x09 -serdes_driver_current_lane3_114=0x09 -serdes_preemphasis_lane0_114=0x204e02 -serdes_preemphasis_lane1_114=0x1d5102 -serdes_preemphasis_lane2_114=0x224c02 -serdes_preemphasis_lane3_114=0x224c02 - -#ce6 -serdes_driver_current_lane0_1=0x09 -serdes_driver_current_lane1_1=0x0a -serdes_driver_current_lane2_1=0x09 -serdes_driver_current_lane3_1=0x0a -serdes_preemphasis_lane0_1=0x244a02 -serdes_preemphasis_lane1_1=0x254902 -serdes_preemphasis_lane2_1=0x244a02 -serdes_preemphasis_lane3_1=0x254902 - -#ce7 -serdes_driver_current_lane0_5=0x09 -serdes_driver_current_lane1_5=0x09 -serdes_driver_current_lane2_5=0x09 -serdes_driver_current_lane3_5=0x0a -serdes_preemphasis_lane0_5=0x244a02 -serdes_preemphasis_lane1_5=0x244a02 -serdes_preemphasis_lane2_5=0x244a02 -serdes_preemphasis_lane3_5=0x254902 - -phy_an_lt_msft=1 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + +# Disable Counting ACL Drop towards interface RX_DRP counter +sai_adjust_acl_drop_in_rx_drop=1 + +os=unix +l2xmsg_mode=1 +parity_enable=0 +rate_ext_mdio_divisor=0x80 +phy_ext_rom_boot=0 +fpem_mem_entries=32768 +l2xmsg_mode=1 +oversubscribe_mode=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +ipv6_lpm_128b_enable=1 +pbmp_xport_xe=0xcccc44cc33113333044cccccc66666622 + + +dport_map_enable=1 +dport_map_port_68=1 +dport_map_port_69=2 + +dport_map_port_72=5 +dport_map_port_73=6 + +dport_map_port_76=9 +dport_map_port_77=10 + +dport_map_port_80=13 +dport_map_port_81=14 + +dport_map_port_34=17 +dport_map_port_35=18 + +dport_map_port_38=21 +dport_map_port_39=22 + +dport_map_port_42=25 +dport_map_port_43=26 + +dport_map_port_46=29 +dport_map_port_47=30 + +dport_map_port_50=33 +dport_map_port_51=34 + +dport_map_port_54=37 +dport_map_port_55=38 + +dport_map_port_58=41 + +dport_map_port_62=45 + +dport_map_port_84=49 + +dport_map_port_88=53 + +dport_map_port_92=57 +dport_map_port_93=58 + +dport_map_port_96=61 +dport_map_port_97=62 + +dport_map_port_102=65 +dport_map_port_103=66 + +dport_map_port_106=69 +dport_map_port_107=70 + +dport_map_port_110=73 + +dport_map_port_114=77 + +dport_map_port_1=81 + +dport_map_port_5=85 + +dport_map_port_9=89 +dport_map_port_10=90 + +dport_map_port_13=93 +dport_map_port_14=94 + +dport_map_port_17=97 +dport_map_port_18=98 + +dport_map_port_21=101 +dport_map_port_22=102 + +dport_map_port_25=105 +dport_map_port_26=106 + +dport_map_port_29=109 +dport_map_port_30=110 + +dport_map_port_118=113 +dport_map_port_119=114 + +dport_map_port_122=117 +dport_map_port_123=118 + +dport_map_port_126=121 +dport_map_port_127=122 + +dport_map_port_130=125 +dport_map_port_131=126 + + +# port mapping +portmap_68=65:50:2 +portmap_69=67:50:2 + +portmap_72=69:50:2 +portmap_73=71:50:2 + +portmap_76=73:50:2 +portmap_77=75:50:2 + +portmap_80=77:50:2 +portmap_81=79:50:2 + +portmap_34=33:50:2 +portmap_35=35:50:2 + +portmap_38=37:50:2 +portmap_39=39:50:2 + +portmap_42=41:50:2 +portmap_43=43:50:2 + +portmap_46=45:50:2 +portmap_47=47:50:2 + +portmap_50=49:50:2 +portmap_51=51:50:2 + +portmap_54=53:50:2 +portmap_55=55:50:2 + +portmap_58=57:100:4 + +portmap_62=61:100:4 + +portmap_84=81:100:4 + +portmap_88=85:100:4 + +portmap_92=89:50:2 +portmap_93=91:50:2 + +portmap_96=93:50:2 +portmap_97=95:50:2 + +portmap_102=97:50:2 +portmap_103=99:50:2 + +portmap_106=101:50:2 +portmap_107=103:50:2 + +portmap_110=105:100:4 + +portmap_114=109:100:4 + +portmap_1=1:100:4 + +portmap_5=5:100:4 + +portmap_9=9:50:2 +portmap_10=11:50:2 + +portmap_13=13:50:2 +portmap_14=15:50:2 + +portmap_17=17:50:2 +portmap_18=19:50:2 + +portmap_21=21:50:2 +portmap_22=23:50:2 + +portmap_25=25:50:2 +portmap_26=27:50:2 + +portmap_29=29:50:2 +portmap_30=31:50:2 + +portmap_118=113:50:2 +portmap_119=115:50:2 + +portmap_122=117:50:2 +portmap_123=119:50:2 + +portmap_126=121:50:2 +portmap_127=123:50:2 + +portmap_130=125:50:2 +portmap_131=127:50:2 + + +#WC16 +xgxs_tx_lane_map_68=0x1023 +xgxs_rx_lane_map_68=0x0132 +xgxs_tx_lane_map_69=0x1023 +xgxs_rx_lane_map_69=0x0132 + + +#WC17 +xgxs_tx_lane_map_72=0x1023 +xgxs_rx_lane_map_72=0x1032 +xgxs_tx_lane_map_73=0x1023 +xgxs_rx_lane_map_73=0x1032 + +#WC18 +xgxs_tx_lane_map_76=0x2310 +xgxs_rx_lane_map_76=0x3210 +xgxs_tx_lane_map_77=0x2310 +xgxs_rx_lane_map_77=0x3210 + +#WC19 +xgxs_tx_lane_map_80=0x1302 +xgxs_rx_lane_map_80=0x0231 +xgxs_tx_lane_map_81=0x1302 +xgxs_rx_lane_map_81=0x0231 +#WC8 +xgxs_tx_lane_map_34=0x1203 +xgxs_rx_lane_map_34=0x3120 +xgxs_tx_lane_map_35=0x1203 +xgxs_rx_lane_map_35=0x3120 + +#WC9 +xgxs_tx_lane_map_38=0x0123 +xgxs_rx_lane_map_38=0x3201 +xgxs_tx_lane_map_39=0x0123 +xgxs_rx_lane_map_39=0x3201 + +#WC10 +xgxs_tx_lane_map_42=0x0132 +xgxs_rx_lane_map_42=0x0123 +xgxs_tx_lane_map_43=0x0132 +xgxs_rx_lane_map_43=0x0123 + +#WC11 +xgxs_tx_lane_map_46=0x2301 +xgxs_rx_lane_map_46=0x2031 +xgxs_tx_lane_map_47=0x2301 +xgxs_rx_lane_map_47=0x2031 + +#WC12 +xgxs_tx_lane_map_50=0x1032 +xgxs_rx_lane_map_50=0x3120 +xgxs_tx_lane_map_51=0x1032 +xgxs_rx_lane_map_51=0x3120 + + +#WC13 +xgxs_tx_lane_map_54=0x1032 +xgxs_rx_lane_map_54=0x0132 +xgxs_tx_lane_map_55=0x1032 +xgxs_rx_lane_map_55=0x0132 + +#WC14 + xgxs_tx_lane_map_58=0x1032 + xgxs_rx_lane_map_58=0x3120 + +#WC15 +xgxs_tx_lane_map_62=0x2031 +xgxs_rx_lane_map_62=0x0132 + +#WC20 + xgxs_tx_lane_map_84=0x3120 + xgxs_rx_lane_map_84=0x1032 + +#WC21 +xgxs_tx_lane_map_88=0x2310 +xgxs_rx_lane_map_88=0x0123 + +#WC22 +xgxs_tx_lane_map_92=0x2310 +xgxs_rx_lane_map_92=0x1302 +xgxs_tx_lane_map_93=0x2310 +xgxs_rx_lane_map_93=0x1302 + +#WC23 +xgxs_tx_lane_map_96=0x1302 +xgxs_rx_lane_map_96=0x1023 +xgxs_tx_lane_map_97=0x1302 +xgxs_rx_lane_map_97=0x1023 + +#WC24 +xgxs_tx_lane_map_102=0x2310 +xgxs_rx_lane_map_102=0x1032 +xgxs_tx_lane_map_103=0x2310 +xgxs_rx_lane_map_103=0x1032 + +#WC25 +xgxs_tx_lane_map_106=0x2310 +xgxs_rx_lane_map_106=0x1023 +xgxs_tx_lane_map_107=0x2310 +xgxs_rx_lane_map_107=0x1023 + +#WC26 +xgxs_tx_lane_map_110=0x2310 +xgxs_rx_lane_map_110=0x1302 + +#WC27 +xgxs_tx_lane_map_114=0x1302 +xgxs_rx_lane_map_114=0x1032 + +#WC0 +xgxs_tx_lane_map_1=0x0123 +xgxs_rx_lane_map_1=0x0213 + +#WC1 +xgxs_tx_lane_map_5=0x2310 +xgxs_rx_lane_map_5=0x3201 + +#WC2 +xgxs_tx_lane_map_9=0x1023 +xgxs_rx_lane_map_9=0x0213 +xgxs_tx_lane_map_10=0x1023 +xgxs_rx_lane_map_10=0x0213 + +#WC3 +xgxs_tx_lane_map_13=0x1302 +xgxs_rx_lane_map_13=0x3201 +xgxs_tx_lane_map_14=0x1302 +xgxs_rx_lane_map_14=0x3201 + +#WC4 +xgxs_tx_lane_map_17=0x0132 +xgxs_rx_lane_map_17=0x0123 +xgxs_tx_lane_map_18=0x0132 +xgxs_rx_lane_map_18=0x0123 + +#WC5 +xgxs_tx_lane_map_21=0x1032 +xgxs_rx_lane_map_21=0x0213 +xgxs_tx_lane_map_22=0x1032 +xgxs_rx_lane_map_22=0x0213 + +#WC6 +xgxs_tx_lane_map_25=0x1023 +xgxs_rx_lane_map_25=0x3120 +xgxs_tx_lane_map_26=0x1023 +xgxs_rx_lane_map_26=0x3120 + +#WC7 +xgxs_tx_lane_map_29=0x2031 +xgxs_rx_lane_map_29=0x3201 +xgxs_tx_lane_map_30=0x2031 +xgxs_rx_lane_map_30=0x3201 + +#WC28 +xgxs_tx_lane_map_118=0x0231 +xgxs_rx_lane_map_118=0x2031 +xgxs_tx_lane_map_119=0x0231 +xgxs_rx_lane_map_119=0x2031 + +#WC29 +xgxs_tx_lane_map_122=0x3201 +xgxs_rx_lane_map_122=0x2301 +xgxs_tx_lane_map_123=0x3201 +xgxs_rx_lane_map_123=0x2301 + +#WC30 +xgxs_tx_lane_map_126=0x0213 +xgxs_rx_lane_map_126=0x0213 +xgxs_tx_lane_map_127=0x0213 +xgxs_rx_lane_map_127=0x0213 + +#WC31 +xgxs_tx_lane_map_130=0x2031 +xgxs_rx_lane_map_130=0x1032 +xgxs_tx_lane_map_131=0x2031 +xgxs_rx_lane_map_131=0x1032 + +#PN + +#WC16 +phy_xaui_tx_polarity_flip_68=0x0000 +phy_xaui_rx_polarity_flip_68=0x0000 +phy_xaui_tx_polarity_flip_69=0x0000 +phy_xaui_rx_polarity_flip_69=0x0000 + +#WC17 +phy_xaui_tx_polarity_flip_72=0x0003 +phy_xaui_rx_polarity_flip_72=0x0000 +phy_xaui_tx_polarity_flip_73=0x0002 +phy_xaui_rx_polarity_flip_73=0x0001 + + + +#WC18 +phy_xaui_tx_polarity_flip_76=0x0003 +phy_xaui_rx_polarity_flip_76=0x0000 +phy_xaui_tx_polarity_flip_77=0x0003 +phy_xaui_rx_polarity_flip_77=0x0000 + + +#WC19 +phy_xaui_tx_polarity_flip_80=0x0003 +phy_xaui_rx_polarity_flip_80=0x0003 +phy_xaui_tx_polarity_flip_81=0x0003 +phy_xaui_rx_polarity_flip_81=0x0003 + + +#WC8 +phy_xaui_tx_polarity_flip_34=0x0003 +phy_xaui_rx_polarity_flip_34=0x0000 +phy_xaui_tx_polarity_flip_35=0x0001 +phy_xaui_rx_polarity_flip_35=0x0000 + + +#WC9 +phy_xaui_tx_polarity_flip_38=0x0001 +phy_xaui_rx_polarity_flip_38=0x0000 +phy_xaui_tx_polarity_flip_39=0x0000 +phy_xaui_rx_polarity_flip_39=0x0000 + + +#WC10 +phy_xaui_tx_polarity_flip_42=0x0003 +phy_xaui_rx_polarity_flip_42=0x0000 +phy_xaui_tx_polarity_flip_43=0x0002 +phy_xaui_rx_polarity_flip_43=0x0000 + + +#WC11 +phy_xaui_tx_polarity_flip_46=0x0000 +phy_xaui_rx_polarity_flip_46=0x0000 +phy_xaui_tx_polarity_flip_47=0x0000 +phy_xaui_rx_polarity_flip_47=0x0000 + + +#WC12 +phy_xaui_tx_polarity_flip_50=0x0000 +phy_xaui_rx_polarity_flip_50=0x0000 +phy_xaui_tx_polarity_flip_51=0x0001 +phy_xaui_rx_polarity_flip_51=0x0000 + +#WC13 +phy_xaui_tx_polarity_flip_54=0x0000 +phy_xaui_rx_polarity_flip_54=0x0000 +phy_xaui_tx_polarity_flip_55=0x0001 +phy_xaui_rx_polarity_flip_55=0x0000 + +#WC14 +phy_xaui_tx_polarity_flip_58=0x0000 +phy_xaui_rx_polarity_flip_58=0x0000 + +#WC15 +phy_xaui_tx_polarity_flip_62=0x0005 +phy_xaui_rx_polarity_flip_62=0x000F + +#WC20 + phy_xaui_tx_polarity_flip_84=0x000E + phy_xaui_rx_polarity_flip_84=0x0007 + +#WC21 +phy_xaui_tx_polarity_flip_88=0x000B +phy_xaui_rx_polarity_flip_88=0x000B + +#WC22 +phy_xaui_tx_polarity_flip_92=0x0003 +phy_xaui_rx_polarity_flip_92=0x0001 +phy_xaui_tx_polarity_flip_93=0x0003 +phy_xaui_rx_polarity_flip_93=0x0000 + + +#WC23 +phy_xaui_tx_polarity_flip_96=0x0002 +phy_xaui_rx_polarity_flip_96=0x0000 +phy_xaui_tx_polarity_flip_97=0x0002 +phy_xaui_rx_polarity_flip_97=0x0000 + +#WC24 +phy_xaui_tx_polarity_flip_102=0x0000 +phy_xaui_rx_polarity_flip_102=0x0003 +phy_xaui_tx_polarity_flip_103=0x0000 +phy_xaui_rx_polarity_flip_103=0x0003 + + +#WC25 +phy_xaui_tx_polarity_flip_106=0x0003 +phy_xaui_rx_polarity_flip_106=0x0000 +phy_xaui_tx_polarity_flip_107=0x0003 +phy_xaui_rx_polarity_flip_107=0x0000 + +#WC26 +phy_xaui_tx_polarity_flip_110=0x000F +phy_xaui_rx_polarity_flip_110=0x000F + +#WC27 +phy_xaui_tx_polarity_flip_114=0x000F +phy_xaui_rx_polarity_flip_114=0x000E + +#WC0 +phy_xaui_tx_polarity_flip_1=0x000C +phy_xaui_rx_polarity_flip_1=0x000F + +#WC1 +phy_xaui_tx_polarity_flip_5=0x000E +phy_xaui_rx_polarity_flip_5=0x0000 + +#WC2 +phy_xaui_tx_polarity_flip_9=0x0000 +phy_xaui_rx_polarity_flip_9=0x0001 +phy_xaui_tx_polarity_flip_10=0x0001 +phy_xaui_rx_polarity_flip_10=0x0000 + + +#WC3 +phy_xaui_tx_polarity_flip_13=0x0003 +phy_xaui_rx_polarity_flip_13=0x0000 +phy_xaui_tx_polarity_flip_14=0x0003 +phy_xaui_rx_polarity_flip_14=0x0000 + +#WC4 +phy_xaui_tx_polarity_flip_17=0x0002 +phy_xaui_rx_polarity_flip_17=0x0000 +phy_xaui_tx_polarity_flip_18=0x0003 +phy_xaui_rx_polarity_flip_18=0x0000 + + +#WC5 +phy_xaui_tx_polarity_flip_21=0x0000 +phy_xaui_rx_polarity_flip_21=0x0000 +phy_xaui_tx_polarity_flip_22=0x0000 +phy_xaui_rx_polarity_flip_22=0x0000 + + +#WC6 +phy_xaui_tx_polarity_flip_25=0x0000 +phy_xaui_rx_polarity_flip_25=0x0002 +phy_xaui_tx_polarity_flip_26=0x0001 +phy_xaui_rx_polarity_flip_26=0x0002 + + +#WC7 +phy_xaui_tx_polarity_flip_29=0x0000 +phy_xaui_rx_polarity_flip_29=0x0000 +phy_xaui_tx_polarity_flip_30=0x0001 +phy_xaui_rx_polarity_flip_30=0x0000 + + +#WC28 +phy_xaui_tx_polarity_flip_118=0x0003 +phy_xaui_rx_polarity_flip_118=0x0003 +phy_xaui_tx_polarity_flip_119=0x0003 +phy_xaui_rx_polarity_flip_119=0x0003 + + +#WC29 +phy_xaui_tx_polarity_flip_122=0x0002 +phy_xaui_rx_polarity_flip_122=0x0000 +phy_xaui_tx_polarity_flip_123=0x0000 +phy_xaui_rx_polarity_flip_123=0x0000 + + +#WC30 +phy_xaui_tx_polarity_flip_126=0x0003 +phy_xaui_rx_polarity_flip_126=0x0000 +phy_xaui_tx_polarity_flip_127=0x0003 +phy_xaui_rx_polarity_flip_127=0x0000 + + +#WC31 +phy_xaui_tx_polarity_flip_130=0x0002 +phy_xaui_rx_polarity_flip_130=0x0000 +phy_xaui_tx_polarity_flip_131=0x0001 +phy_xaui_rx_polarity_flip_131=0x0000 + +#xe +serdes_driver_current=0x0a +serdes_preemphasis=0x1a5402 + +#ce0 +serdes_driver_current_lane0_58=0x0a +serdes_driver_current_lane1_58=0x09 +serdes_driver_current_lane2_58=0x09 +serdes_driver_current_lane3_58=0x0a +serdes_preemphasis_lane0_58=0x254902 +serdes_preemphasis_lane1_58=0x244a02 +serdes_preemphasis_lane2_58=0x244a02 +serdes_preemphasis_lane3_58=0x254902 + +#ce1 +serdes_driver_current_lane0_62=0x09 +serdes_driver_current_lane1_62=0x0a +serdes_driver_current_lane2_62=0x09 +serdes_driver_current_lane3_62=0x09 +serdes_preemphasis_lane0_62=0x244a02 +serdes_preemphasis_lane1_62=0x254902 +serdes_preemphasis_lane2_62=0x244a02 +serdes_preemphasis_lane3_62=0x244a02 + +#ce2 +serdes_driver_current_lane0_84=0x09 +serdes_driver_current_lane1_84=0x09 +serdes_driver_current_lane2_84=0x09 +serdes_driver_current_lane3_84=0x09 +serdes_preemphasis_lane0_84=0x204e02 +serdes_preemphasis_lane1_84=0x204e02 +serdes_preemphasis_lane2_84=0x204e02 +serdes_preemphasis_lane3_84=0x204e02 + +#ce3 +serdes_driver_current_lane0_88=0x09 +serdes_driver_current_lane1_88=0x08 +serdes_driver_current_lane2_88=0x08 +serdes_driver_current_lane3_88=0x09 +serdes_preemphasis_lane0_88=0x204e02 +serdes_preemphasis_lane1_88=0x1d5102 +serdes_preemphasis_lane2_88=0x1d5102 +serdes_preemphasis_lane3_88=0x204e02 + +#ce4 +serdes_driver_current_lane0_110=0x09 +serdes_driver_current_lane1_110=0x08 +serdes_driver_current_lane2_110=0x08 +serdes_driver_current_lane3_110=0x09 +serdes_preemphasis_lane0_110=0x204e02 +serdes_preemphasis_lane1_110=0x1d5102 +serdes_preemphasis_lane2_110=0x1d5102 +serdes_preemphasis_lane3_110=0x204e02 + +#ce5 +serdes_driver_current_lane0_114=0x09 +serdes_driver_current_lane1_114=0x08 +serdes_driver_current_lane2_114=0x09 +serdes_driver_current_lane3_114=0x09 +serdes_preemphasis_lane0_114=0x204e02 +serdes_preemphasis_lane1_114=0x1d5102 +serdes_preemphasis_lane2_114=0x224c02 +serdes_preemphasis_lane3_114=0x224c02 + +#ce6 +serdes_driver_current_lane0_1=0x09 +serdes_driver_current_lane1_1=0x0a +serdes_driver_current_lane2_1=0x09 +serdes_driver_current_lane3_1=0x0a +serdes_preemphasis_lane0_1=0x244a02 +serdes_preemphasis_lane1_1=0x254902 +serdes_preemphasis_lane2_1=0x244a02 +serdes_preemphasis_lane3_1=0x254902 + +#ce7 +serdes_driver_current_lane0_5=0x09 +serdes_driver_current_lane1_5=0x09 +serdes_driver_current_lane2_5=0x09 +serdes_driver_current_lane3_5=0x0a +serdes_preemphasis_lane0_5=0x244a02 +serdes_preemphasis_lane1_5=0x244a02 +serdes_preemphasis_lane2_5=0x244a02 +serdes_preemphasis_lane3_5=0x254902 + +phy_an_lt_msft=1 diff --git a/device/centec/arm64-centec_e530_24x2c-r0/platform_reboot b/device/centec/arm64-centec_e530_24x2c-r0/platform_reboot index f22723f98de..abb89fdc194 100755 --- a/device/centec/arm64-centec_e530_24x2c-r0/platform_reboot +++ b/device/centec/arm64-centec_e530_24x2c-r0/platform_reboot @@ -1,11 +1,13 @@ #!/usr/bin/python -import os def main(): # reboot the system - os.system('echo 502 > /sys/class/gpio/export') - os.system('echo out > /sys/class/gpio/gpio502/direction') - os.system('echo 1 > /sys/class/gpio/gpio502/value') + with open('/sys/class/gpio/export', 'w') as file: + file.write('502\n') + with open('/sys/class/gpio/gpio502/direction', 'w') as file: + file.write('out\n') + with open('/sys/class/gpio/gpio502/value', 'w') as file: + file.write('1\n') if __name__ == "__main__": main() diff --git a/device/centec/arm64-centec_e530_24x2q-r0/platform_reboot b/device/centec/arm64-centec_e530_24x2q-r0/platform_reboot index f22723f98de..abb89fdc194 100755 --- a/device/centec/arm64-centec_e530_24x2q-r0/platform_reboot +++ b/device/centec/arm64-centec_e530_24x2q-r0/platform_reboot @@ -1,11 +1,13 @@ #!/usr/bin/python -import os def main(): # reboot the system - os.system('echo 502 > /sys/class/gpio/export') - os.system('echo out > /sys/class/gpio/gpio502/direction') - os.system('echo 1 > /sys/class/gpio/gpio502/value') + with open('/sys/class/gpio/export', 'w') as file: + file.write('502\n') + with open('/sys/class/gpio/gpio502/direction', 'w') as file: + file.write('out\n') + with open('/sys/class/gpio/gpio502/value', 'w') as file: + file.write('1\n') if __name__ == "__main__": main() diff --git a/device/centec/arm64-centec_e530_48s4x-r0/platform_reboot b/device/centec/arm64-centec_e530_48s4x-r0/platform_reboot index 98f62ca16cc..78563edef59 100755 --- a/device/centec/arm64-centec_e530_48s4x-r0/platform_reboot +++ b/device/centec/arm64-centec_e530_48s4x-r0/platform_reboot @@ -1,12 +1,12 @@ #!/usr/bin/python -import os +import subprocess def main(): # reboot the system - os.system('modprobe i2c-dev') - os.system('i2cset -y 0 0x36 0x23 0x0') - os.system('sleep 1') - os.system('i2cset -y 0 0x36 0x23 0x3') + subprocess.call(['modprobe', 'i2c-dev']) + subprocess.call(['i2cset', '-y', '0', '0x36', '0x23', '0x0']) + subprocess.call(['sleep', '1']) + subprocess.call(['i2cset', '-y', '0', '0x36', '0x23', '0x3']) if __name__ == "__main__": main() diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/platform_reboot b/device/centec/arm64-centec_e530_48t4x_p-r0/platform_reboot index f22723f98de..abb89fdc194 100755 --- a/device/centec/arm64-centec_e530_48t4x_p-r0/platform_reboot +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/platform_reboot @@ -1,11 +1,13 @@ #!/usr/bin/python -import os def main(): # reboot the system - os.system('echo 502 > /sys/class/gpio/export') - os.system('echo out > /sys/class/gpio/gpio502/direction') - os.system('echo 1 > /sys/class/gpio/gpio502/value') + with open('/sys/class/gpio/export', 'w') as file: + file.write('502\n') + with open('/sys/class/gpio/gpio502/direction', 'w') as file: + file.write('out\n') + with open('/sys/class/gpio/gpio502/value', 'w') as file: + file.write('1\n') if __name__ == "__main__": main() diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/platform_reboot b/device/centec/x86_64-centec_v682_48x8c-r0/platform_reboot index 5e49eecb61c..bac7c091dc9 100755 --- a/device/centec/x86_64-centec_v682_48x8c-r0/platform_reboot +++ b/device/centec/x86_64-centec_v682_48x8c-r0/platform_reboot @@ -1,15 +1,15 @@ #!/usr/bin/env python -import os +import subprocess import time def main(): - os.system('hwclock -w -f /dev/rtc1') + subprocess.call(['hwclock', '-w', '-f', '/dev/rtc1']) time.sleep(1) - os.system('i2cset -y 0 0x36 0x23 0') + subprocess.call(['i2cset', '-y', '0', '0x36', '0x23', '0']) time.sleep(1) - os.system('i2cset -y 0 0x36 0x23 1') + subprocess.call(['i2cset', '-y', '0', '0x36', '0x23', '1']) if __name__ == '__main__': main() diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/plugins/led_control.py b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/led_control.py index b787320d784..c373b5c1d83 100644 --- a/device/centec/x86_64-centec_v682_48x8c-r0/plugins/led_control.py +++ b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/led_control.py @@ -166,11 +166,11 @@ def _port_led_mode_update(self, port_idx, ledMode): def _initSystemLed(self): try: - cmd = 'i2cset -y 0 0x36 0x2 0x5' - Popen(cmd, shell=True) + cmd = ['i2cset', '-y', '0', '0x36', '0x2', '0x5'] + Popen(cmd) DBG_PRINT("init system led to normal") - cmd = 'i2cset -y 0 0x36 0x3 0x1' - Popen(cmd, shell=True) + cmd = ['i2cset', '-y', '0', '0x36', '0x3', '0x1'] + Popen(cmd) DBG_PRINT("init idn led to off") except IOError as e: DBG_PRINT(str(e)) diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/plugins/psuutil.py b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/psuutil.py index 9e311d9b4f5..1a178a38539 100644 --- a/device/centec/x86_64-centec_v682_48x8c-r0/plugins/psuutil.py +++ b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/psuutil.py @@ -40,8 +40,8 @@ def get_psu_status(self, index): if index is None: return False - cmd = 'i2cget -y 0 0x36 0x1e' - status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + cmd = ['i2cget', '-y', '0', '0x36', '0x1e'] + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT).stdout.readline(), 16) powergood = ((status & (1 << (3 * (index - 1) + 2))) != 0) return powergood @@ -56,7 +56,7 @@ def get_psu_presence(self, index): if index is None: return False - cmd = 'i2cget -y 0 0x36 0x1e' - status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + cmd = ['i2cget', '-y', '0', '0x36', '0x1e'] + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT).stdout.readline(), 16) presence = ((status & (1 << (3 * (index - 1) + 1))) == 0) return presence diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/platform_reboot b/device/centec/x86_64-centec_v682_48y8c-r0/platform_reboot index 5e49eecb61c..bac7c091dc9 100755 --- a/device/centec/x86_64-centec_v682_48y8c-r0/platform_reboot +++ b/device/centec/x86_64-centec_v682_48y8c-r0/platform_reboot @@ -1,15 +1,15 @@ #!/usr/bin/env python -import os +import subprocess import time def main(): - os.system('hwclock -w -f /dev/rtc1') + subprocess.call(['hwclock', '-w', '-f', '/dev/rtc1']) time.sleep(1) - os.system('i2cset -y 0 0x36 0x23 0') + subprocess.call(['i2cset', '-y', '0', '0x36', '0x23', '0']) time.sleep(1) - os.system('i2cset -y 0 0x36 0x23 1') + subprocess.call(['i2cset', '-y', '0', '0x36', '0x23', '1']) if __name__ == '__main__': main() diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/plugins/led_control.py b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/led_control.py index 973a9354fbc..9e9426d455f 100644 --- a/device/centec/x86_64-centec_v682_48y8c-r0/plugins/led_control.py +++ b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/led_control.py @@ -166,11 +166,11 @@ def _port_led_mode_update(self, port_idx, ledMode): def _initSystemLed(self): try: - cmd = 'i2cset -y 0 0x36 0x2 0x5' - Popen(cmd, shell=True) + cmd = ['i2cset', '-y', '0', '0x36', '0x2', '0x5'] + Popen(cmd) DBG_PRINT("init system led to normal") - cmd = 'i2cset -y 0 0x36 0x3 0x1' - Popen(cmd, shell=True) + cmd = ['i2cset', '-y', '0', '0x36', '0x3', '0x1'] + Popen(cmd) DBG_PRINT("init idn led to off") except IOError as e: DBG_PRINT(str(e)) diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/plugins/psuutil.py b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/psuutil.py index 9e311d9b4f5..1a178a38539 100644 --- a/device/centec/x86_64-centec_v682_48y8c-r0/plugins/psuutil.py +++ b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/psuutil.py @@ -40,8 +40,8 @@ def get_psu_status(self, index): if index is None: return False - cmd = 'i2cget -y 0 0x36 0x1e' - status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + cmd = ['i2cget', '-y', '0', '0x36', '0x1e'] + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT).stdout.readline(), 16) powergood = ((status & (1 << (3 * (index - 1) + 2))) != 0) return powergood @@ -56,7 +56,7 @@ def get_psu_presence(self, index): if index is None: return False - cmd = 'i2cget -y 0 0x36 0x1e' - status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + cmd = ['i2cget', '-y', '0', '0x36', '0x1e'] + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT).stdout.readline(), 16) presence = ((status & (1 << (3 * (index - 1) + 1))) == 0) return presence diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/psuutil.py b/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/psuutil.py index d55f7115946..1e31de9972b 100644 --- a/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/psuutil.py +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/psuutil.py @@ -1,4 +1,4 @@ -import os.path +import subprocess try: from sonic_psu.psu_base import PsuBase @@ -14,7 +14,7 @@ def __init__(self): self.psu_path = "/sys/bus/i2c/devices/{}-0058/" self.psu_oper_status = "in1_input" - self.psu_presence = "i2cget -y {} 0x50 0x00" + self.psu_presence = ["i2cget", "-y", "", "0x50", "0x00"] def get_num_psus(self): """ @@ -46,8 +46,9 @@ def get_psu_presence(self, index): Base_bus_number = 39 status = 0 try: - p = os.popen(self.psu_presence.format(index + Base_bus_number) + "> /dev/null 2>&1") - if p.readline() != None: + self.psu_presence[2] = str(index + Base_bus_number) + p = subprocess.Popen(self.psu_presence) + if p.stdout.readline() is not None: status = 1 p.close() except IOError: diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/sfputil.py b/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/sfputil.py index 2aced920162..28a6940055f 100644 --- a/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/sfputil.py +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/plugins/sfputil.py @@ -5,7 +5,6 @@ try: import time - import os from sonic_sfp.sfputilbase import SfpUtilBase except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -47,32 +46,6 @@ def __init__(self): SfpUtilBase.__init__(self) - def get_presence(self, port_name): - # modify by zhw to get sfp presence - # Check for invalid port_num - port_num = int(port_name[8:]) - - if port_num < (self.port_start+1) or port_num > (self.port_end+1): - return False - - # cpld info from "CPLD Register for es5800A2.2(V1.1)" - cpld_map = {0: '0x82', 1: '0x83', 2: '0x84', - 3: '0x85', 4: '0x86', 5: '0x87', 6: '0x8E'} - cpld_key = (port_num - 1)/8 - cpld_mask = (1 << (port_num - 1) % 8) - - # use i2cget cmd to get cpld data - output = os.popen('i2cdetect -l | grep CP') - bus_num = output.read()[4] - cmd = "i2cget -y "+bus_num+" 0x5 "+cpld_map[cpld_key] - tmp = os.popen(cmd).read().replace("\n", "") - cpld_value = int(tmp, 16) - - if cpld_value & cpld_mask == 0: - return True - else: - return False - def get_low_power_mode(self, port_num): ''' # Check for invalid port_num diff --git a/device/common/pddf/plugins/fanutil.py b/device/common/pddf/plugins/fanutil.py index f34c260035e..c2944e7b5b8 100755 --- a/device/common/pddf/plugins/fanutil.py +++ b/device/common/pddf/plugins/fanutil.py @@ -11,6 +11,7 @@ import os.path import sys +import ast sys.path.append('/usr/share/sonic/platform/plugins') import pddfparse import json @@ -170,7 +171,7 @@ def set_speed(self, val): print("Setting fan speed is not allowed !") return False else: - duty_cycle_to_pwm = eval(plugin_data['FAN']['duty_cycle_to_pwm']) + duty_cycle_to_pwm = ast.literal_eval(plugin_data['FAN']['duty_cycle_to_pwm']) pwm = duty_cycle_to_pwm(val) print("New Speed: %d%% - PWM value to be set is %d\n" % (val, pwm)) diff --git a/device/delta/x86_64-delta_ag5648-r0/plugins/psuutil.py b/device/delta/x86_64-delta_ag5648-r0/plugins/psuutil.py index 8aa080166f8..98112753a0a 100644 --- a/device/delta/x86_64-delta_ag5648-r0/plugins/psuutil.py +++ b/device/delta/x86_64-delta_ag5648-r0/plugins/psuutil.py @@ -1,4 +1,4 @@ -import os.path +import subprocess try: from sonic_psu.psu_base import PsuBase @@ -14,7 +14,7 @@ def __init__(self): self.psu_path = "/sys/bus/i2c/devices/6-00{}/" self.psu_oper_status = "in1_input" - self.psu_presence = "i2cget -y 6 0x{} 0x00" + self.psu_presence = ["i2cget", "-y", "6", "", "0x00"] def get_num_psus(self): """ @@ -44,9 +44,10 @@ def get_psu_presence(self, index): return False Base_bus_number = 49 status = 0 + self.psu_presence[3] = "0x" + str(index + Base_bus_number) try: - p = os.popen(self.psu_presence.format(index + Base_bus_number) + "> /dev/null 2>&1") - if p.readline() != None: + p = subprocess.Popen(self.psu_presence, stdout=subprocess.PIPE, universal_newlines=True) + if p.stdout.readline() != None: status = 1 p.close() except IOError: diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py index 391efbd2401..0659d051de0 100644 --- a/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py @@ -1,4 +1,4 @@ -import os.path +import subprocess try: from sonic_psu.psu_base import PsuBase @@ -14,7 +14,7 @@ def __init__(self): self.psu_path = "/sys/bus/i2c/devices/{}-0058/" self.psu_oper_status = "in1_input" - self.psu_presence = "i2cget -y {} 0x50 0x00" + self.psu_presence = ["i2cget", "-y", "", "0x50", "0x00"] def get_num_psus(self): """ @@ -45,9 +45,10 @@ def get_psu_presence(self, index): return False Base_bus_number = 39 status = 0 + self.psu_presence[2] = str(index + Base_bus_number) try: - p = os.popen(self.psu_presence.format(index + Base_bus_number) + "> /dev/null 2>&1") - if p.readline() != None: + p = subprocess.Popen(self.psu_presence, stdout=subprocess.PIPE, universal_newlines=True) + if p.stdout.readline() != None: status = 1 p.close() except IOError: diff --git a/device/delta/x86_64-delta_ag9032v2a-r0/plugins/psuutil.py b/device/delta/x86_64-delta_ag9032v2a-r0/plugins/psuutil.py index 06655c07a41..abce79d0924 100644 --- a/device/delta/x86_64-delta_ag9032v2a-r0/plugins/psuutil.py +++ b/device/delta/x86_64-delta_ag9032v2a-r0/plugins/psuutil.py @@ -3,7 +3,6 @@ # provides the PSUs status which are available in the platform # -import os.path import subprocess try: @@ -38,8 +37,9 @@ def get_psu_status(self, index): return False status = 0 try: - p = os.popen("ipmitool raw 0x38 0x2 3 0x6a 0x3 1") - content = p.readline().rstrip() + cmd = ["ipmitool", "raw", "0x38", "0x2", "3", "0x6a", "0x3", "1"] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) + content = p.stdout.readline().rstrip() reg_value = int(content, 16) if index == 1: mask = (1 << 6) @@ -66,8 +66,9 @@ def get_psu_presence(self, index): status = 0 try: - p = os.popen("ipmitool raw 0x38 0x2 3 0x6a 0x3 1") - content = p.readline().rstrip() + cmd = ["ipmitool", "raw", "0x38", "0x2", "3", "0x6a", "0x3", "1"] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) + content = p.stdout.readline().rstrip() reg_value = int(content, 16) if index == 1: mask = (1 << 7) diff --git a/device/delta/x86_64-delta_ag9064-r0/plugins/psuutil.py b/device/delta/x86_64-delta_ag9064-r0/plugins/psuutil.py index 43f7bb6acb3..aef4534f2e7 100644 --- a/device/delta/x86_64-delta_ag9064-r0/plugins/psuutil.py +++ b/device/delta/x86_64-delta_ag9064-r0/plugins/psuutil.py @@ -3,7 +3,6 @@ # provides the PSUs status which are available in the platform # -import os.path import subprocess try: @@ -17,8 +16,8 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_presence = "cat /sys/devices/platform/delta-ag9064-cpld.0/psu{}_scan" - self.psu_status = "cat /sys/devices/platform/delta-ag9064-swpld1.0/psu{}_pwr_ok" + self.psu_presence = "/sys/devices/platform/delta-ag9064-cpld.0/psu{}_scan" + self.psu_status = "/sys/devices/platform/delta-ag9064-swpld1.0/psu{}_pwr_ok" def get_num_psus(self): """ @@ -40,8 +39,9 @@ def get_psu_status(self, index): return False status = 0 + self.psu_status = self.psu_status.format(index) try: - p = os.popen(self.psu_status.format(index)) + p = open(self.psu_status, 'r') content = p.readline().rstrip() reg_value = int(content) if reg_value != 0: @@ -63,8 +63,9 @@ def get_psu_presence(self, index): if index is None: return False status = 0 + self.psu_presence = self.psu_presence.format(index) try: - p = os.popen(self.psu_presence.format(index)) + p = open(self.psu_presence, 'r') content = p.readline().rstrip() reg_value = int(content, 16) if reg_value != 0: diff --git a/device/delta/x86_64-delta_agc032-r0/plugins/psuutil.py b/device/delta/x86_64-delta_agc032-r0/plugins/psuutil.py index 0cb47cad1bf..3cee96c1f6a 100644 --- a/device/delta/x86_64-delta_agc032-r0/plugins/psuutil.py +++ b/device/delta/x86_64-delta_agc032-r0/plugins/psuutil.py @@ -1,4 +1,4 @@ -import os.path +import subprocess try: from sonic_psu.psu_base import PsuBase @@ -15,7 +15,7 @@ def __init__(self): self.psu_path = "/sys/bus/i2c/devices/{}-0058/" self.psu_oper_status = "in1_input" self.psu_oper_status2 = "in2_input" - self.psu_presence = "i2cget -y {} 0x50 0x00" + self.psu_presence = ["i2cget", "-y", "", "0x50", "0x00"] def get_num_psus(self): """ @@ -50,9 +50,10 @@ def get_psu_presence(self, index): return False Base_bus_number = 0 status = 0 + self.psu_presence[2] = str(index + Base_bus_number) try: - p = os.popen(self.psu_presence.format(index + Base_bus_number) + "> /dev/null 2>&1") - if p.readline() != None: + p = subprocess.Popen(self.psu_presence, stdout=subprocess.PIPE, universal_newlines=True) + if p.stdout.readline() != None: status = 1 p.close() except IOError: diff --git a/device/delta/x86_64-delta_et-c032if-r0/plugins/psuutil.py b/device/delta/x86_64-delta_et-c032if-r0/plugins/psuutil.py index 4eb3bb87db8..6d1a5084767 100644 --- a/device/delta/x86_64-delta_et-c032if-r0/plugins/psuutil.py +++ b/device/delta/x86_64-delta_et-c032if-r0/plugins/psuutil.py @@ -3,7 +3,6 @@ # provides the PSUs status which are available in the platform # -import os.path import subprocess try: @@ -17,7 +16,7 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_status = "ipmitool raw 0x38 0x1 {} 0x50" + self.psu_status = ["ipmitool", "raw", "0x38", "0x1", "", "0x50"] def get_num_psus(self): """ @@ -39,9 +38,10 @@ def get_psu_status(self, index): return False status = 0 + cmd = ["ipmitool", "raw", "0x38", "0x2", "7", "0x32", "0x28", "1"] try: - p = os.popen("ipmitool raw 0x38 0x2 7 0x32 0x28 1") - content = p.readline().rstrip() + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) + content = p.stdout.readline().rstrip() reg_value = int(content, 16) mask = (1 << (8 - index)) if reg_value & mask == 0: @@ -63,9 +63,10 @@ def get_psu_presence(self, index): if index is None: return False status = 0 + self.psu_status[4] = str(index-1) try: - p = os.popen(self.psu_status.format(index - 1)) - content = p.readline().rstrip() + p = subprocess.Popen(self.psu_status, stdout=subprocess.PIPE, universal_newlines=True) + content = p.stdout.readline().rstrip() reg_value = int(content, 16) if reg_value != 0: return False diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 index 29a3c74e523..e8edeca556d 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 @@ -1,3 +1,20 @@ +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} + {%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} "BUFFER_POOL": { {% if dynamic_mode is not defined and port_names_inactive|length > 0 -%} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers.json.j2 new file mode 100644 index 00000000000..ad326624913 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers.json.j2 @@ -0,0 +1,15 @@ +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_objects.j2 new file mode 120000 index 00000000000..c01aebb7ae1 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_t0.j2 new file mode 100644 index 00000000000..920730c15ec --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_t0.j2 @@ -0,0 +1,36 @@ +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '6822912' %} +{% set ingress_lossless_pool_xoff = '999424' %} +{% set egress_lossless_pool_size = '13945824' %} +{% set egress_lossy_pool_size = '6822912' %} + +{% import 'buffers_defaults_objects.j2' as defs with context %} + +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_t1.j2 new file mode 100644 index 00000000000..18a57073f82 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_defaults_t1.j2 @@ -0,0 +1,36 @@ +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{% set default_cable = '300m' %} +{% set ingress_lossless_pool_size = '6282240' %} +{% set ingress_lossless_pool_xoff = '1540096' %} +{% set egress_lossless_pool_size = '13945824' %} +{% set egress_lossy_pool_size = '6282240' %} + +{% import 'buffers_defaults_objects.j2' as defs with context %} + +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_dynamic.json.j2 new file mode 100644 index 00000000000..cea77067d2a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/buffers_dynamic.json.j2 @@ -0,0 +1,16 @@ +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{%- set default_topo = 't0' %} +{%- set dynamic_mode = 'true' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/hwsku.json b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/hwsku.json new file mode 100644 index 00000000000..b74b2d5ad57 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/hwsku.json @@ -0,0 +1,166 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet4": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet8": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet10": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet12": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet14": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet16": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet18": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet20": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet22": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet24": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet28": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet32": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet36": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet40": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet42": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet44": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet46": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet48": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet50": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet52": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet54": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet56": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet58": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet60": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet62": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet64": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet66": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet68": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet70": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet72": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet74": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet76": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet78": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet80": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet82": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet84": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet86": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet88": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet92": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet96": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet100": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet104": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet106": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet108": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet110": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet112": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet114": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet116": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet118": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet120": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet122": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet124": { + "default_brkout_mode": "2x50G[25G,10G]" + }, + "Ethernet126": { + "default_brkout_mode": "2x50G[25G,10G]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/pg_profile_lookup.ini new file mode 120000 index 00000000000..b1f8524ff2e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/pg_profile_lookup.ini @@ -0,0 +1 @@ +../Mellanox-SN2700-D40C8S8/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/port_config.ini new file mode 100644 index 00000000000..1320b267d8c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias index speed +Ethernet0 0,1,2,3 etp1 1 100000 +Ethernet4 4,5,6,7 etp2 2 100000 +Ethernet8 8,9 etp3a 3 50000 +Ethernet10 10,11 etp3b 3 50000 +Ethernet12 12,13 etp4a 4 50000 +Ethernet14 14,15 etp4b 4 50000 +Ethernet16 16,17 etp5a 5 50000 +Ethernet18 18,19 etp5b 5 50000 +Ethernet20 20,21 etp6a 6 50000 +Ethernet22 22,23 etp6b 6 50000 +Ethernet24 24,25,26,27 etp7 7 100000 +Ethernet28 28,29,30,31 etp8 8 100000 +Ethernet32 32,33,34,35 etp9 9 100000 +Ethernet36 36,37,38,39 etp10 10 100000 +Ethernet40 40,41 etp11a 11 50000 +Ethernet42 42,43 etp11b 11 50000 +Ethernet44 44,45 etp12a 12 50000 +Ethernet46 46,47 etp12b 12 50000 +Ethernet48 48,49 etp13a 13 50000 +Ethernet50 50,51 etp13b 13 50000 +Ethernet52 52,53 etp14a 14 50000 +Ethernet54 54,55 etp14b 14 50000 +Ethernet56 56,57 etp15a 15 50000 +Ethernet58 58,59 etp15b 15 50000 +Ethernet60 60,61 etp16a 16 50000 +Ethernet62 62,63 etp16b 16 50000 +Ethernet64 64,65 etp17a 17 50000 +Ethernet66 66,67 etp17b 17 50000 +Ethernet68 68,69 etp18a 18 50000 +Ethernet70 70,71 etp18b 18 50000 +Ethernet72 72,73 etp19a 19 50000 +Ethernet74 74,75 etp19b 19 50000 +Ethernet76 76,77 etp20a 20 50000 +Ethernet78 78,79 etp20b 20 50000 +Ethernet80 80,81 etp21a 21 50000 +Ethernet82 82,83 etp21b 21 50000 +Ethernet84 84,85 etp22a 22 50000 +Ethernet86 86,87 etp22b 22 50000 +Ethernet88 88,89,90,91 etp23 23 100000 +Ethernet92 92,93,94,95 etp24 24 100000 +Ethernet96 96,97,98,99 etp25 25 100000 +Ethernet100 100,101,102,103 etp26 26 100000 +Ethernet104 104,105 etp27a 27 50000 +Ethernet106 106,107 etp27b 27 50000 +Ethernet108 108,109 etp28a 28 50000 +Ethernet110 110,111 etp28b 28 50000 +Ethernet112 112,113 etp29a 29 50000 +Ethernet114 114,115 etp29b 29 50000 +Ethernet116 116,117 etp30a 30 50000 +Ethernet118 118,119 etp30b 30 50000 +Ethernet120 120,121 etp31a 31 50000 +Ethernet122 122,123 etp31b 31 50000 +Ethernet124 124,125 etp32a 32 50000 +Ethernet126 126,127 etp32b 32 50000 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/qos.json.j2 new file mode 120000 index 00000000000..8bd2d26567b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/qos.json.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/sai.profile new file mode 100644 index 00000000000..f25a70d3974 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/sai.profile @@ -0,0 +1,3 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700_44x50g_10x100g.xml +SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps +SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/sai_2700_44x50g_10x100g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/sai_2700_44x50g_10x100g.xml new file mode 100644 index 00000000000..c505f0c449e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D44C10/sai_2700_44x50g_10x100g.xml @@ -0,0 +1,269 @@ + + + + + + 00:02:03:04:05:00 + + + 1 + + + 32 + + + + + 1 + 2 + 4 + 16 + + + 3 + + + 3221487616 + + + 3 + 2 + 4 + 17 + 1 + 3221487616 + + + 5 + 2 + 4 + 18 + 3 + 3221487616 + + + 7 + 2 + 4 + 19 + 1 + 3221487616 + + + 9 + 2 + 4 + 20 + 3 + 3221487616 + + + 11 + 2 + 4 + 21 + 1 + 3221487616 + + + 13 + 4 + 22 + 3 + 11534336 + + + 15 + 4 + 23 + 1 + 11534336 + + + 17 + 4 + 24 + 3 + 11534336 + + + 19 + 4 + 25 + 1 + 11534336 + + + 21 + 2 + 4 + 26 + 3 + 3221487616 + + + 23 + 2 + 4 + 27 + 1 + 3221487616 + + + 25 + 2 + 4 + 28 + 3 + 3221487616 + + + 27 + 2 + 4 + 29 + 1 + 3221487616 + + + 29 + 2 + 4 + 30 + 3 + 3221487616 + + + 31 + 2 + 4 + 31 + 1 + 3221487616 + + + 33 + 2 + 4 + 14 + 3 + 3221487616 + + + 35 + 2 + 4 + 15 + 1 + 3221487616 + + + 37 + 2 + 4 + 12 + 3 + 3221487616 + + + 39 + 2 + 4 + 13 + 1 + 3221487616 + + + 41 + 2 + 4 + 10 + 3 + 3221487616 + + + 43 + 2 + 4 + 11 + 1 + 3221487616 + + + 45 + 4 + 8 + 3 + 11534336 + + + 47 + 4 + 9 + 1 + 11534336 + + + 49 + 2 + 4 + 6 + 3 + 3221487616 + + + 51 + 4 + 7 + 1 + 11534336 + + + 53 + 2 + 4 + 4 + 3 + 3221487616 + + + 55 + 2 + 4 + 5 + 1 + 3221487616 + + + 57 + 2 + 4 + 2 + 3 + 3221487616 + + + 59 + 2 + 4 + 3 + 1 + 3221487616 + + + 61 + 4 + 0 + 3 + 11534336 + + + 63 + 4 + 1 + 1 + 11534336 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 index f0b0e3993bd..6bf657d1fb7 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 @@ -1,3 +1,20 @@ +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} + {%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} "BUFFER_POOL": { {% if dynamic_mode is not defined and port_names_inactive|length > 0 -%} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/fanutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/fanutil.py index 6d54455af40..710584352bd 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/fanutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/fanutil.py @@ -44,7 +44,7 @@ class FanUtil(FanBase): PWM_MAX = 255 MAX_FAN_PER_DRAWER = 2 - GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku" + GET_HWSKU_CMD = ["sonic-cfggen", "-d", "-v", "DEVICE_METADATA.localhost.hwsku"] sku_without_fan_direction = ['ACS-MSN2010', 'ACS-MSN2100', 'ACS-MSN2410', 'ACS-MSN2700', 'Mellanox-SN2700', 'Mellanox-SN2700-D48C8', 'LS-SN2700', 'ACS-MSN2740'] sku_with_unpluggable_fan = ['ACS-MSN2010', 'ACS-MSN2100'] @@ -72,7 +72,7 @@ def __init__(self): self.num_of_fan, self.num_of_drawer = self._extract_num_of_fans_and_fan_drawers() def _get_sku_name(self): - p = subprocess.Popen(self.GET_HWSKU_CMD, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + p = subprocess.Popen(self.GET_HWSKU_CMD, universal_newlines=True, stdout=subprocess.PIPE) out, err = p.communicate() return out.rstrip('\n') diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py index 915c90bf25a..67cc92a4146 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py @@ -42,7 +42,7 @@ class PsuUtil(PsuBase): MAX_PSU_FAN = 1 MAX_NUM_PSU = 2 - GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku" + GET_HWSKU_CMD = ["sonic-cfggen", "-d", "-v", "DEVICE_METADATA.localhost.hwsku"] # for spectrum1 switches with plugable PSUs, the output voltage file is psuX_volt # for spectrum2 switches the output voltage file is psuX_volt_out2 sku_spectrum1_with_plugable_psu = ['ACS-MSN2410', 'ACS-MSN2700', @@ -65,7 +65,7 @@ def __init__(self): self.fan_speed = "thermal/psu{}_fan1_speed_get" def _get_sku_name(self): - p = subprocess.Popen(self.GET_HWSKU_CMD, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + p = subprocess.Popen(self.GET_HWSKU_CMD, universal_newlines=True, stdout=subprocess.PIPE) out, err = p.communicate() return out.rstrip('\n') diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index 9423de8dd75..d461cc30f32 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -48,7 +48,7 @@ SYSTEM_READY = 'system_become_ready' SYSTEM_FAIL = 'system_fail' -GET_PLATFORM_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.platform" +GET_PLATFORM_CMD = ["sonic-cfggen", "-d", "-v", "DEVICE_METADATA.localhost.platform"] # Ethernet <=> sfp SFP_PORT_NAME_OFFSET = 0 @@ -110,7 +110,7 @@ def port_to_eeprom_mapping(self): raise Exception() def get_port_position_tuple_by_platform_name(self): - p = subprocess.Popen(GET_PLATFORM_CMD, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + p = subprocess.Popen(GET_PLATFORM_CMD, universal_newlines=True, stdout=subprocess.PIPE) out, err = p.communicate() position_tuple = port_position_tuple_list[platform_dict[out.rstrip('\n')]] return position_tuple @@ -136,9 +136,9 @@ def get_presence(self, port_num): port_num += SFP_PORT_NAME_OFFSET sfpname = SFP_PORT_NAME_CONVENTION.format(port_num) - ethtool_cmd = "ethtool -m {} 2>/dev/null".format(sfpname) + ethtool_cmd = ["ethtool", "-m", sfpname] try: - proc = subprocess.Popen(ethtool_cmd, stdout=subprocess.PIPE, shell=True, universal_newlines=True, stderr=subprocess.STDOUT) + proc = subprocess.Popen(ethtool_cmd, stdout=subprocess.PIPE, universal_newlines=True, stderr=subprocess.DEVNULL) stdout = proc.communicate()[0] proc.wait() result = stdout.rstrip('\n') @@ -155,10 +155,10 @@ def get_low_power_mode(self, port_num): if port_num < self.port_start or port_num > self.port_end: return False - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num) + lpm_cmd = ["docker", "exec", "syncd", "python", "/usr/share/sonic/platform/plugins/sfplpmget.py", str(port_num)] try: - output = subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(lpm_cmd, universal_newlines=True) if 'LPM ON' in output: return True except subprocess.CalledProcessError as e: @@ -178,11 +178,11 @@ def set_low_power_mode(self, port_num, lpmode): # Compose LPM command lpm = 'on' if lpmode else 'off' - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm) + lpm_cmd = ["docker", "exec", "syncd", "python", "/usr/share/sonic/platform/plugins/sfplpmset.py", str(port_num), lpm] # Set LPM try: - subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) + subprocess.check_output(lpm_cmd, universal_newlines=True) except subprocess.CalledProcessError as e: print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output)) return False @@ -194,10 +194,10 @@ def reset(self, port_num): if port_num < self.port_start or port_num > self.port_end: return False - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num) + lpm_cmd = ["docker", "exec", "syncd", "python", "/usr/share/sonic/platform/plugins/sfpreset.py", str(port_num)] try: - subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) + subprocess.check_output(lpm_cmd, universal_newlines=True) return True except subprocess.CalledProcessError as e: print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output)) @@ -267,9 +267,9 @@ def _read_eeprom_specific_bytes_via_ethtool(self, port_num, offset, num_bytes): sfpname = SFP_PORT_NAME_CONVENTION.format(port_num) eeprom_raw = [] - ethtool_cmd = "ethtool -m {} hex on offset {} length {}".format(sfpname, offset, num_bytes) + ethtool_cmd = ["ethtool", "-m", sfpname, "hex", "on", "offset", str(offset), "length", str(num_bytes)] try: - output = subprocess.check_output(ethtool_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(ethtool_cmd, universal_newlines=True) output_lines = output.splitlines() first_line_raw = output_lines[0] if "Offset" in first_line_raw: diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/thermalutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/thermalutil.py index 8ee172feacd..ea7e5f70214 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/thermalutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/thermalutil.py @@ -375,12 +375,12 @@ class ThermalUtil(ThermalBase): MAX_PSU_FAN = 1 MAX_NUM_PSU = 2 - GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku" + GET_HWSKU_CMD = ["sonic-cfggen", "-d", "-v", "DEVICE_METADATA.localhost.hwsku"] number_of_thermals = 0 thermal_list = [] def _get_sku_name(self): - p = subprocess.Popen(self.GET_HWSKU_CMD, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + p = subprocess.Popen(self.GET_HWSKU_CMD, universal_newlines=True, stdout=subprocess.PIPE) out, err = p.communicate() return out.rstrip('\n') diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers.json.j2 new file mode 100644 index 00000000000..afbd130a436 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers.json.j2 @@ -0,0 +1,16 @@ + +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_objects.j2 new file mode 120000 index 00000000000..c01aebb7ae1 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_t0.j2 new file mode 100644 index 00000000000..bdca5962fd5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_t0.j2 @@ -0,0 +1,46 @@ + +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{% set default_cable = '5m' %} +{%-set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '300m', + 'spinerouter_leafrouter' : '1500m' + } +-%} +{% set ingress_lossless_pool_size = '46415872' %} +{% set ingress_lossless_pool_xoff = '1982464' %} +{% set egress_lossless_pool_size = '60817392' %} +{% set egress_lossy_pool_size = '46415872' %} + +{% import 'buffers_defaults_objects.j2' as defs with context %} + +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_t1.j2 new file mode 100644 index 00000000000..444c728c5ba --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_defaults_t1.j2 @@ -0,0 +1,40 @@ + +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{% set default_cable = '300m' %} +{% set ingress_lossless_pool_size = '45432832' %} +{% set ingress_lossless_pool_xoff = '2965504' %} +{% set egress_lossless_pool_size = '60817392' %} +{% set egress_lossy_pool_size = '45432832' %} + +{% import 'buffers_defaults_objects.j2' as defs with context %} + +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_dynamic.json.j2 new file mode 100644 index 00000000000..ac50755abbc --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/buffers_dynamic.json.j2 @@ -0,0 +1,17 @@ + +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{%- set default_topo = 't0' %} +{%- set dynamic_mode = 'true' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/hwsku.json b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/hwsku.json new file mode 100644 index 00000000000..03ed2d395ce --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/hwsku.json @@ -0,0 +1,340 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet1": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet2": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet3": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet8": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet9": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet10": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet11": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet16": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet17": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet18": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet19": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet24": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet25": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet26": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet27": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet32": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet33": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet34": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet35": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet40": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet41": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet42": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet43": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet48": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet49": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet50": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet51": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet56": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet57": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet58": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet59": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet64": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet65": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet66": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet67": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet72": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet73": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet74": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet75": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet80": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet81": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet82": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet83": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet88": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet89": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet90": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet91": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet96": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet97": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet98": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet99": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet104": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet105": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet106": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet107": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet112": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet113": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet114": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet115": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet120": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet121": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet122": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet123": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet128": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet129": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet130": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet131": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet136": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet137": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet138": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet139": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet144": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet145": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet146": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet147": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet152": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet153": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet154": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet155": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet160": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet161": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet162": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet163": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet168": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet169": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet170": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet171": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet176": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet177": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet178": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet179": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet184": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet185": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet186": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet187": { + "default_brkout_mode": "4x25G(4)[10G,1G]" + }, + "Ethernet192": { + "default_brkout_mode": "2x100G[200G,50G,40G,25G,10G,1G]" + }, + "Ethernet196": { + "default_brkout_mode": "2x100G[200G,50G,40G,25G,10G,1G]" + }, + "Ethernet200": { + "default_brkout_mode": "2x100G[200G,50G,40G,25G,10G,1G]" + }, + "Ethernet204": { + "default_brkout_mode": "2x100G[200G,50G,40G,25G,10G,1G]" + }, + "Ethernet208": { + "default_brkout_mode": "2x100G[200G,50G,40G,25G,10G,1G]" + }, + "Ethernet212": { + "default_brkout_mode": "2x100G[200G,50G,40G,25G,10G,1G]" + }, + "Ethernet216": { + "default_brkout_mode": "2x100G[200G,50G,40G,25G,10G,1G]" + }, + "Ethernet220": { + "default_brkout_mode": "2x100G[200G,50G,40G,25G,10G,1G]" + }, + "Ethernet224": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet228": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet232": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet236": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet240": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet244": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet248": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet252": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/pg_profile_lookup.ini new file mode 120000 index 00000000000..66cab04d2c4 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/pg_profile_lookup.ini @@ -0,0 +1 @@ +../Mellanox-SN4700-C128/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/port_config.ini b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/port_config.ini new file mode 100644 index 00000000000..bd24d40599f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/port_config.ini @@ -0,0 +1,113 @@ +# name lanes alias index speed +Ethernet0 0 etp1a 1 25000 +Ethernet1 1 etp1b 1 25000 +Ethernet2 2 etp1c 1 25000 +Ethernet3 3 etp1d 1 25000 +Ethernet8 8 etp2a 2 25000 +Ethernet9 9 etp2b 2 25000 +Ethernet10 10 etp2c 2 25000 +Ethernet11 11 etp2d 2 25000 +Ethernet16 16 etp3a 3 25000 +Ethernet17 17 etp3b 3 25000 +Ethernet18 18 etp3c 3 25000 +Ethernet19 19 etp3d 3 25000 +Ethernet24 24 etp4a 4 25000 +Ethernet25 25 etp4b 4 25000 +Ethernet26 26 etp4c 4 25000 +Ethernet27 27 etp4d 4 25000 +Ethernet32 32 etp5a 5 25000 +Ethernet33 33 etp5b 5 25000 +Ethernet34 34 etp5c 5 25000 +Ethernet35 35 etp5d 5 25000 +Ethernet40 40 etp6a 6 25000 +Ethernet41 41 etp6b 6 25000 +Ethernet42 42 etp6c 6 25000 +Ethernet43 43 etp6d 6 25000 +Ethernet48 48 etp7a 7 25000 +Ethernet49 49 etp7b 7 25000 +Ethernet50 50 etp7c 7 25000 +Ethernet51 51 etp7d 7 25000 +Ethernet56 56 etp8a 8 25000 +Ethernet57 57 etp8b 8 25000 +Ethernet58 58 etp8c 8 25000 +Ethernet59 59 etp8d 8 25000 +Ethernet64 64 etp9a 9 25000 +Ethernet65 65 etp9b 9 25000 +Ethernet66 66 etp9c 9 25000 +Ethernet67 67 etp9d 9 25000 +Ethernet72 72 etp10a 10 25000 +Ethernet73 73 etp10b 10 25000 +Ethernet74 74 etp10c 10 25000 +Ethernet75 75 etp10d 10 25000 +Ethernet80 80 etp11a 11 25000 +Ethernet81 81 etp11b 11 25000 +Ethernet82 82 etp11c 11 25000 +Ethernet83 83 etp11d 11 25000 +Ethernet88 88 etp12a 12 25000 +Ethernet89 89 etp12b 12 25000 +Ethernet90 90 etp12c 12 25000 +Ethernet91 91 etp12d 12 25000 +Ethernet96 96 etp13a 13 25000 +Ethernet97 97 etp13b 13 25000 +Ethernet98 98 etp13c 13 25000 +Ethernet99 99 etp13d 13 25000 +Ethernet104 104 etp14a 14 25000 +Ethernet105 105 etp14b 14 25000 +Ethernet106 106 etp14c 14 25000 +Ethernet107 107 etp14d 14 25000 +Ethernet112 112 etp15a 15 25000 +Ethernet113 113 etp15b 15 25000 +Ethernet114 114 etp15c 15 25000 +Ethernet115 115 etp15d 15 25000 +Ethernet120 120 etp16a 16 25000 +Ethernet121 121 etp16b 16 25000 +Ethernet122 122 etp16c 16 25000 +Ethernet123 123 etp16d 16 25000 +Ethernet128 128 etp17a 17 25000 +Ethernet129 129 etp17b 17 25000 +Ethernet130 130 etp17c 17 25000 +Ethernet131 131 etp17d 17 25000 +Ethernet136 136 etp18a 18 25000 +Ethernet137 137 etp18b 18 25000 +Ethernet138 138 etp18c 18 25000 +Ethernet139 139 etp18d 18 25000 +Ethernet144 144 etp19a 19 25000 +Ethernet145 145 etp19b 19 25000 +Ethernet146 146 etp19c 19 25000 +Ethernet147 147 etp19d 19 25000 +Ethernet152 152 etp20a 20 25000 +Ethernet153 153 etp20b 20 25000 +Ethernet154 154 etp20c 20 25000 +Ethernet155 155 etp20d 20 25000 +Ethernet160 160 etp21a 21 25000 +Ethernet161 161 etp21b 21 25000 +Ethernet162 162 etp21c 21 25000 +Ethernet163 163 etp21d 21 25000 +Ethernet168 168 etp22a 22 25000 +Ethernet169 169 etp22b 22 25000 +Ethernet170 170 etp22c 22 25000 +Ethernet171 171 etp22d 22 25000 +Ethernet176 176 etp23a 23 25000 +Ethernet177 177 etp23b 23 25000 +Ethernet178 178 etp23c 23 25000 +Ethernet179 179 etp23d 23 25000 +Ethernet184 184 etp24a 24 25000 +Ethernet185 185 etp24b 24 25000 +Ethernet186 186 etp24c 24 25000 +Ethernet187 187 etp24d 24 25000 +Ethernet192 192,193,194,195 etp25a 25 100000 +Ethernet196 196,197,198,199 etp25b 25 100000 +Ethernet200 200,201,202,203 etp26a 26 100000 +Ethernet204 204,205,206,207 etp26b 26 100000 +Ethernet208 208,209,210,211 etp27a 27 100000 +Ethernet212 212,213,214,215 etp27b 27 100000 +Ethernet216 216,217,218,219 etp28a 28 100000 +Ethernet220 220,221,222,223 etp28b 28 100000 +Ethernet224 224,225,226,227 etp29a 29 200000 +Ethernet228 228,229,230,231 etp29b 29 200000 +Ethernet232 232,233,234,235 etp30a 30 200000 +Ethernet236 236,237,238,239 etp30b 30 200000 +Ethernet240 240,241,242,243 etp31a 31 200000 +Ethernet244 244,245,246,247 etp31b 31 200000 +Ethernet248 248,249,250,251 etp32a 32 200000 +Ethernet252 252,253,254,255 etp32b 32 200000 diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/qos.json.j2 new file mode 120000 index 00000000000..eccf286dc87 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/qos.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/sai.profile b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/sai.profile new file mode 100644 index 00000000000..377656b4ca8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/sai.profile @@ -0,0 +1,3 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_4700_8x200g_8x100g_96x25g.xml +SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps +SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/sai_4700_8x200g_8x100g_96x25g.xml b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/sai_4700_8x200g_8x100g_96x25g.xml new file mode 100644 index 00000000000..6b16851934d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-A96C8V8/sai_4700_8x200g_8x100g_96x25g.xml @@ -0,0 +1,277 @@ + + + + + 00:02:03:04:05:00 + + + 1 + + + 32 + + + + + 1 + 4 + 17 + 3 + 100 + 4 + + + 5 + 4 + 16 + 3 + 100 + 4 + + + 9 + 4 + 19 + 3 + 100 + 4 + + + 13 + 4 + 18 + 3 + 100 + 4 + + + 17 + 4 + 21 + 3 + 100 + 4 + + + 21 + 4 + 20 + 3 + 100 + 4 + + + 25 + 4 + 23 + 3 + 100 + 4 + + + 29 + 4 + 22 + 3 + 100 + 4 + + + 33 + 8 + 29 + 1 + 4096 + 2 + + + 37 + 8 + 28 + 1 + 4096 + 2 + + + 41 + 8 + 31 + 1 + 4096 + 2 + + + 45 + 8 + 30 + 1 + 4096 + 2 + + + 49 + 8 + 25 + 1 + 1536 + 2 + + + 53 + 8 + 24 + 1 + 1536 + 2 + + + 57 + 8 + 27 + 1 + 1536 + 2 + + + 61 + 8 + 26 + 1 + 1536 + 2 + + + 65 + 4 + 14 + 3 + 100 + 4 + + + 69 + 4 + 15 + 3 + 100 + 4 + + + 73 + 4 + 12 + 3 + 100 + 4 + + + 77 + 4 + 13 + 3 + 100 + 4 + + + 81 + 4 + 10 + 3 + 100 + 4 + + + 85 + 4 + 11 + 3 + 100 + 4 + + + 89 + 4 + 8 + 3 + 100 + 4 + + + 93 + 4 + 9 + 3 + 100 + 4 + + + 97 + 4 + 2 + 3 + 100 + 4 + + + 101 + 4 + 3 + 3 + 100 + 4 + + + 105 + 4 + 0 + + + 3 + + + 100 + 4 + + + 109 + 4 + 1 + 3 + 100 + 4 + + + 113 + 4 + 6 + 3 + 100 + 4 + + + 117 + 4 + 7 + 3 + 100 + 4 + + + 121 + 4 + 4 + 3 + 100 + 4 + + + 125 + 4 + 5 + 3 + 100 + 4 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-C128/port_config.ini b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-C128/port_config.ini index d64b66b0b69..0d67f9b366f 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-C128/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-C128/port_config.ini @@ -1,3 +1,20 @@ +## +## Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + # name lanes alias index speed Ethernet0 0,1 etp1a 1 100000 Ethernet2 2,3 etp1b 1 100000 diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-C128/sai_4700_128x100g.xml b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-C128/sai_4700_128x100g.xml index f5d49f8b86a..2575b49f3fa 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-C128/sai_4700_128x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-C128/sai_4700_128x100g.xml @@ -1,3 +1,20 @@ + + diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers.json.j2 new file mode 100644 index 00000000000..44f0d97ce37 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers.json.j2 @@ -0,0 +1,16 @@ + +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_objects.j2 new file mode 120000 index 00000000000..c01aebb7ae1 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_t0.j2 new file mode 100644 index 00000000000..841444e9aa9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_t0.j2 @@ -0,0 +1,40 @@ + +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '50208768' %} +{% set ingress_lossless_pool_xoff = '1662976' %} +{% set egress_lossless_pool_size = '60817392' %} +{% set egress_lossy_pool_size = '50208768' %} + +{% import 'buffers_defaults_objects.j2' as defs with context %} + +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_t1.j2 new file mode 100644 index 00000000000..03f41430d73 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_defaults_t1.j2 @@ -0,0 +1,46 @@ + +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{% set default_cable = '300m' %} +{%-set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '300m', + 'spinerouter_leafrouter' : '1500m' + } +-%} +{% set ingress_lossless_pool_size = '46780416' %} +{% set ingress_lossless_pool_xoff = '5091328' %} +{% set egress_lossless_pool_size = '60817392' %} +{% set egress_lossy_pool_size = '46780416' %} + +{% import 'buffers_defaults_objects.j2' as defs with context %} + +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} + +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_dynamic.json.j2 new file mode 100644 index 00000000000..0829b960de1 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/buffers_dynamic.json.j2 @@ -0,0 +1,17 @@ + +{# + Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{%- set default_topo = 't1' %} +{%- set dynamic_mode = 'true' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/hwsku.json b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/hwsku.json new file mode 100644 index 00000000000..50d2faec289 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/hwsku.json @@ -0,0 +1,244 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet4": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet8": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet12": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet16": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet20": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet24": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet28": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet32": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet36": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet40": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet44": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet48": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet52": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet56": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet60": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet64": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet68": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet72": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet76": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet80": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet84": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet88": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet92": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet96": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet100": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet104": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet108": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet112": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet116": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet120": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet124": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet128": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet132": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet136": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet140": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet144": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet148": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet152": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet156": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet160": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet164": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet168": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet172": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet176": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet180": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet184": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet188": { + "default_brkout_mode": "2x200G[100G,50G,40G,25G,10G,1G]" + }, + "Ethernet192": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet194": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet196": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet198": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet200": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet202": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet204": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet206": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet208": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet210": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet212": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet214": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet216": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet218": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet220": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet222": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet224": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet226": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet228": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet230": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet232": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet234": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet236": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet238": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet240": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet242": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet244": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet246": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet248": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet250": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet252": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + }, + "Ethernet254": { + "default_brkout_mode": "4x100G[50G,25G,10G,1G]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/pg_profile_lookup.ini new file mode 120000 index 00000000000..66cab04d2c4 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/pg_profile_lookup.ini @@ -0,0 +1 @@ +../Mellanox-SN4700-C128/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/port_config.ini b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/port_config.ini new file mode 100644 index 00000000000..8fdb867ef84 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/port_config.ini @@ -0,0 +1,81 @@ +# name lanes alias index speed +Ethernet0 0,1,2,3 etp1a 1 200000 +Ethernet4 4,5,6,7 etp1b 1 200000 +Ethernet8 8,9,10,11 etp2a 2 200000 +Ethernet12 12,13,14,15 etp2b 2 200000 +Ethernet16 16,17,18,19 etp3a 3 200000 +Ethernet20 20,21,22,23 etp3b 3 200000 +Ethernet24 24,25,26,27 etp4a 4 200000 +Ethernet28 28,29,30,31 etp4b 4 200000 +Ethernet32 32,33,34,35 etp5a 5 200000 +Ethernet36 36,37,38,39 etp5b 5 200000 +Ethernet40 40,41,42,43 etp6a 6 200000 +Ethernet44 44,45,46,47 etp6b 6 200000 +Ethernet48 48,49,50,51 etp7a 7 200000 +Ethernet52 52,53,54,55 etp7b 7 200000 +Ethernet56 56,57,58,59 etp8a 8 200000 +Ethernet60 60,61,62,63 etp8b 8 200000 +Ethernet64 64,65,66,67 etp9a 9 200000 +Ethernet68 68,69,70,71 etp9b 9 200000 +Ethernet72 72,73,74,75 etp10a 10 200000 +Ethernet76 76,77,78,79 etp10b 10 200000 +Ethernet80 80,81,82,83 etp11a 11 200000 +Ethernet84 84,85,86,87 etp11b 11 200000 +Ethernet88 88,89,90,91 etp12a 12 200000 +Ethernet92 92,93,94,95 etp12b 12 200000 +Ethernet96 96,97,98,99 etp13a 13 200000 +Ethernet100 100,101,102,103 etp13b 13 200000 +Ethernet104 104,105,106,107 etp14a 14 200000 +Ethernet108 108,109,110,111 etp14b 14 200000 +Ethernet112 112,113,114,115 etp15a 15 200000 +Ethernet116 116,117,118,119 etp15b 15 200000 +Ethernet120 120,121,122,123 etp16a 16 200000 +Ethernet124 124,125,126,127 etp16b 16 200000 +Ethernet128 128,129,130,131 etp17a 17 200000 +Ethernet132 132,133,134,135 etp17b 17 200000 +Ethernet136 136,137,138,139 etp18a 18 200000 +Ethernet140 140,141,142,143 etp18b 18 200000 +Ethernet144 144,145,146,147 etp19a 19 200000 +Ethernet148 148,149,150,151 etp19b 19 200000 +Ethernet152 152,153,154,155 etp20a 20 200000 +Ethernet156 156,157,158,159 etp20b 20 200000 +Ethernet160 160,161,162,163 etp21a 21 200000 +Ethernet164 164,165,166,167 etp21b 21 200000 +Ethernet168 168,169,170,171 etp22a 22 200000 +Ethernet172 172,173,174,175 etp22b 22 200000 +Ethernet176 176,177,178,179 etp23a 23 200000 +Ethernet180 180,181,182,183 etp23b 23 200000 +Ethernet184 184,185,186,187 etp24a 24 200000 +Ethernet188 188,189,190,191 etp24b 24 200000 +Ethernet192 192,193 etp25a 25 100000 +Ethernet194 194,195 etp25b 25 100000 +Ethernet196 196,197 etp25c 25 100000 +Ethernet198 198,199 etp25d 25 100000 +Ethernet200 200,201 etp26a 26 100000 +Ethernet202 202,203 etp26b 26 100000 +Ethernet204 204,205 etp26c 26 100000 +Ethernet206 206,207 etp26d 26 100000 +Ethernet208 208,209 etp27a 27 100000 +Ethernet210 210,211 etp27b 27 100000 +Ethernet212 212,213 etp27c 27 100000 +Ethernet214 214,215 etp27d 27 100000 +Ethernet216 216,217 etp28a 28 100000 +Ethernet218 218,219 etp28b 28 100000 +Ethernet220 220,221 etp28c 28 100000 +Ethernet222 222,223 etp28d 28 100000 +Ethernet224 224,225 etp29a 29 100000 +Ethernet226 226,227 etp29b 29 100000 +Ethernet228 228,229 etp29c 29 100000 +Ethernet230 230,231 etp29d 29 100000 +Ethernet232 232,233 etp30a 30 100000 +Ethernet234 234,235 etp30b 30 100000 +Ethernet236 236,237 etp30c 30 100000 +Ethernet238 238,239 etp30d 30 100000 +Ethernet240 240,241 etp31a 31 100000 +Ethernet242 242,243 etp31b 31 100000 +Ethernet244 244,245 etp31c 31 100000 +Ethernet246 246,247 etp31d 31 100000 +Ethernet248 248,249 etp32a 32 100000 +Ethernet250 250,251 etp32b 32 100000 +Ethernet252 252,253 etp32c 32 100000 +Ethernet254 254,255 etp32d 32 100000 diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/qos.json.j2 new file mode 120000 index 00000000000..eccf286dc87 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/qos.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/sai.profile b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/sai.profile new file mode 100644 index 00000000000..42518df9d9e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/sai.profile @@ -0,0 +1,3 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_4700_32x100g_48x200g.xml +SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps +SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/sai_4700_32x100g_48x200g.xml b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/sai_4700_32x100g_48x200g.xml new file mode 100644 index 00000000000..fd382f8bd93 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/Mellanox-SN4700-V48C32/sai_4700_32x100g_48x200g.xml @@ -0,0 +1,277 @@ + + + + + 00:02:03:04:05:00 + + + 1 + + + 32 + + + + + 1 + 8 + 17 + 1 + 4096 + 2 + + + 5 + 8 + 16 + 1 + 4096 + 2 + + + 9 + 8 + 19 + 1 + 4096 + 2 + + + 13 + 8 + 18 + 1 + 4096 + 2 + + + 17 + 8 + 21 + 1 + 4096 + 2 + + + 21 + 8 + 20 + 1 + 4096 + 2 + + + 25 + 8 + 23 + 1 + 4096 + 2 + + + 29 + 8 + 22 + 1 + 4096 + 2 + + + 33 + 8 + 29 + 3 + 1536 + 4 + + + 37 + 8 + 28 + 3 + 1536 + 4 + + + 41 + 8 + 31 + 3 + 1536 + 4 + + + 45 + 8 + 30 + 3 + 1536 + 4 + + + 49 + 8 + 25 + 3 + 1536 + 4 + + + 53 + 8 + 24 + 3 + 1536 + 4 + + + 57 + 8 + 27 + 3 + 1536 + 4 + + + 61 + 8 + 26 + 3 + 1536 + 4 + + + 65 + 8 + 14 + 1 + 4096 + 2 + + + 69 + 8 + 15 + 1 + 4096 + 2 + + + 73 + 8 + 12 + 1 + 4096 + 2 + + + 77 + 8 + 13 + 1 + 4096 + 2 + + + 81 + 8 + 10 + 1 + 4096 + 2 + + + 85 + 8 + 11 + 1 + 4096 + 2 + + + 89 + 8 + 8 + 1 + 4096 + 2 + + + 93 + 8 + 9 + 1 + 4096 + 2 + + + 97 + 8 + 2 + 1 + 4096 + 2 + + + 101 + 8 + 3 + 1 + 4096 + 2 + + + 105 + 8 + 0 + + + 1 + + + 4096 + 2 + + + 109 + 8 + 1 + 1 + 4096 + 2 + + + 113 + 8 + 6 + 1 + 4096 + 2 + + + 117 + 8 + 7 + 1 + 4096 + 2 + + + 121 + 8 + 4 + 1 + 4096 + 2 + + + 125 + 8 + 5 + 1 + 4096 + 2 + + + + diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_asic b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_asic index a554752878b..64b1d7dbb42 100644 --- a/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_asic +++ b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_asic @@ -1 +1 @@ -marvell +marvell-armhf 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 3eb3ba20a42..856d429a7e6 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 @@ -2092,3 +2092,4 @@ modreg IPS_FORCE_LOCAL_OR_FABRIC FORCE_FABRIC=1 xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 cmic_dma_abort_in_cold_boot=0 +sai_pfc_dlr_init_capability=0 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 57e966b3531..0d1b3972a5c 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 @@ -2093,3 +2093,4 @@ modreg IPS_FORCE_LOCAL_OR_FABRIC FORCE_FABRIC=1 xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 cmic_dma_abort_in_cold_boot=0 +sai_pfc_dlr_init_capability=0 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/jr2cp-nokia-18x400g-config.bcm b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/jr2cp-nokia-18x400g-config.bcm index 1da65733155..32fe9ef4370 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/jr2cp-nokia-18x400g-config.bcm +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/jr2cp-nokia-18x400g-config.bcm @@ -2093,3 +2093,4 @@ modreg IPS_FORCE_LOCAL_OR_FABRIC FORCE_FABRIC=1 xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 cmic_dma_abort_in_cold_boot=0 +sai_pfc_dlr_init_capability=0 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/jr2cp-nokia-18x400g-config.bcm b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/jr2cp-nokia-18x400g-config.bcm index 4d6790d5398..8dec8b48477 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/jr2cp-nokia-18x400g-config.bcm +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/jr2cp-nokia-18x400g-config.bcm @@ -2095,3 +2095,4 @@ modreg IPS_FORCE_LOCAL_OR_FABRIC FORCE_FABRIC=1 xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 cmic_dma_abort_in_cold_boot=0 +sai_pfc_dlr_init_capability=0 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_components.template b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_components.template new file mode 100755 index 00000000000..7b05296ae13 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_components.template @@ -0,0 +1,19 @@ + { + "module": { + "LINE-CARD": { + "component": {} + }, + "SUPERVISOR0": { + "component": {} + } + }, + "chassis": { + "Nokia-IXR7250E-36x400G": { + "component": { + "FPGA2": {}, + "FPGA1": {}, + "BIOS": {} + } + } + } + } diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_env.conf b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_env.conf index 45697fe72fc..15a060d467b 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_env.conf +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_env.conf @@ -1,3 +1,4 @@ usemsi=1 dmasize=512M default_mtu=9100 +macsec_enabled=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_ndk.json b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_ndk.json index 2220f874789..f7be1409804 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_ndk.json +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_ndk.json @@ -1,8 +1,8 @@ { "options": [ { - "key": "sfp_init_tx_en", - "stringval": "yes" + "key": "module_direct_ipc_ue", + "stringval": "no" }, { "key": "midplane_subnet", @@ -39,6 +39,10 @@ { "key": "enable_firmware_update", "intval": 0 + }, + { + "key": "sonic_log_level", + "stringval": "error" } ] } diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_reboot b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_reboot index a32a3549bc3..b086d09bddc 100755 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_reboot +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_reboot @@ -1,5 +1,24 @@ #!/bin/bash +update_reboot_cause_for_supervisor_reboot() +{ + DEVICE_MGR_REBOOT_FILE=/tmp/device_mgr_reboot + REBOOT_CAUSE_FILE=/host/reboot-cause/reboot-cause.txt + TMP_REBOOT_CAUSE_FILE=/tmp/tmp-reboot-cause.txt + if [ -f $DEVICE_MGR_REBOOT_FILE ]; then + if [ -f $REBOOT_CAUSE_FILE ]; then + t1=`sudo grep "User: ," $REBOOT_CAUSE_FILE` + if [ ! -z "$t1" ]; then + echo $t1 | sed 's/reboot/reboot from Supervisor/g' | sed 's/User: /User: admin/g' > $TMP_REBOOT_CAUSE_FILE + cp $TMP_REBOOT_CAUSE_FILE $REBOOT_CAUSE_FILE + fi + fi + fi +} + +# update the reboot_cuase file when reboot is trigger by device-mgr +update_reboot_cause_for_supervisor_reboot + systemctl stop nokia-watchdog.service sleep 2 echo "w" > /dev/watchdog diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform.json b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform.json index e41b6fc8e5e..4d7b66229f3 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform.json +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform.json @@ -7,6 +7,9 @@ }, { "name": "FPGA1" + }, + { + "name": "SFM-FPGA" } ], "watchdog": { diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform_components.json b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform_components.json new file mode 100644 index 00000000000..6acb33f5bff --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform_components.json @@ -0,0 +1,81 @@ +{ + "chassis": { + "Nokia-IXR7250E-SUP-10": { + "component": { + "BIOS": { }, + "FPGA1": { }, + "SFM-FPGA": { } + } + } + }, + "module": { + "SUPERVISOR0": { + "component": { + } + }, + "LINE-CARD0": { + "component": { + } + }, + "LINE-CARD1": { + "component": { + } + }, + "LINE-CARD2": { + "component": { + } + }, + "LINE-CARD3": { + "component": { + } + }, + "LINE-CARD4": { + "component": { + } + }, + "LINE-CARD5": { + "component": { + } + }, + "LINE-CARD6": { + "component": { + } + }, + "LINE-CARD7": { + "component": { + } + }, + "FABRIC-CARD0": { + "component": { + } + }, + "FABRIC-CARD1": { + "component": { + } + }, + "FABRIC-CARD2": { + "component": { + } + }, + "FABRIC-CARD3": { + "component": { + } + }, + "FABRIC-CARD4": { + "component": { + } + }, + "FABRIC-CARD5": { + "component": { + } + }, + "FABRIC-CARD6": { + "component": { + } + }, + "FABRIC-CARD7": { + "component": { + } + } + } +} diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_ndk.json b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_ndk.json index a6d6bbf8a45..e40ac505747 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_ndk.json +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_ndk.json @@ -27,6 +27,10 @@ { "key": "enable_firmware_update", "intval": 0 + }, + { + "key": "sonic_log_level", + "stringval": "error" } ] } diff --git a/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/psuutil.py b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/psuutil.py index 0b2027afdda..2cdcf10f8d4 100755 --- a/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/psuutil.py +++ b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/psuutil.py @@ -7,6 +7,7 @@ import os.path import subprocess import logging +from sonic_py_common.general import check_output_pipe try: from sonic_psu.psu_base import PsuBase @@ -22,11 +23,13 @@ def show_log(txt): return -def exec_cmd(cmd, show): +def exec_cmd(cmd_args, out_file, show): + cmd = ' '.join(cmd_args) + ' > ' + out_file logging.info('Run :'+cmd) try: - output = subprocess.check_output(cmd, shell=True, universal_newlines=True) - show_log(cmd + "output:"+str(output)) + with open(out_file, 'w') as f: + output = subprocess.check_output(cmd_args, stdout=f, universal_newlines=True) + show_log(cmd + "output:"+str(output)) except subprocess.CalledProcessError as e: logging.info("Failed :"+cmd) if show: @@ -40,12 +43,13 @@ def my_log(txt): return -def log_os_system(cmd, show): +def log_os_system(cmd1_args, cmd2_args, show): + cmd = ' '.join(cmd1_args) + ' | ' + ' '.join(cmd2_args) logging.info('Run :'+cmd) status = 1 output = "" try: - output = subprocess.check_output(cmd, shell=True, universal_newlines=True) + output = check_output_pipe(cmd1_args, cmd2_args) my_log(cmd + "output:"+str(output)) except subprocess.CalledProcessError as e: logging.info('Failed :'+cmd) @@ -55,28 +59,28 @@ def log_os_system(cmd, show): def gpio16_exist(): - ls = log_os_system("ls /sys/class/gpio/ | grep gpio16", 0) + ls = log_os_system(["ls", "/sys/class/gpio/"], ["grep", "gpio16"], 0) logging.info('mods:'+ls) if len(ls) == 0: return False def gpio17_exist(): - ls = log_os_system("ls /sys/class/gpio/ | grep gpio17", 0) + ls = log_os_system(["ls", "/sys/class/gpio/"], ["grep", "gpio17"], 0) logging.info('mods:'+ls) if len(ls) == 0: return False def gpio19_exist(): - ls = log_os_system("ls /sys/class/gpio/ | grep gpio19", 0) + ls = log_os_system(["ls", "/sys/class/gpio/"], ["grep", "gpio19"], 0) logging.info('mods:'+ls) if len(ls) == 0: return False def gpio20_exist(): - ls = log_os_system("ls /sys/class/gpio/ | grep gpio20", 0) + ls = log_os_system(["ls", "/sys/class/gpio/"], ["grep", "gpio20"], 0) logging.info('mods:'+ls) if len(ls) == 0: return False @@ -95,20 +99,20 @@ def __init__(self): PsuBase.__init__(self) if gpio16_exist() == False: - output = exec_cmd("echo 16 > /sys/class/gpio/export ", 1) - output = exec_cmd("echo in > /sys/class/gpio/gpio16/direction ", 1) + output = exec_cmd(["echo", "16"], "/sys/class/gpio/export", 1) + output = exec_cmd(["echo", "in"], "/sys/class/gpio/gpio16/direction", 1) if gpio17_exist() == False: - output = exec_cmd("echo 17 > /sys/class/gpio/export ", 1) - output = exec_cmd("echo in > /sys/class/gpio/gpio17/direction ", 1) + output = exec_cmd(["echo", "17"], "/sys/class/gpio/export", 1) + output = exec_cmd(["echo", "in"], "/sys/class/gpio/gpio17/direction", 1) if gpio19_exist() == False: - output = exec_cmd("echo 19 > /sys/class/gpio/export ", 1) - output = exec_cmd("echo in > /sys/class/gpio/gpio19/direction ", 1) + output = exec_cmd(["echo", "19"], "/sys/class/gpio/export", 1) + output = exec_cmd(["echo", "in"], "/sys/class/gpio/gpio19/direction", 1) if gpio20_exist() == False: - output = exec_cmd("echo 20 > /sys/class/gpio/export ", 1) - output = exec_cmd("echo in > /sys/class/gpio/gpio20/direction ", 1) + output = exec_cmd(["echo", "20"], "/sys/class/gpio/export", 1) + output = exec_cmd(["echo", "in"], "/sys/class/gpio/gpio20/direction", 1) # Get sysfs attribute def get_attr_value(self, attr_path): diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/gearbox_config.json b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/gearbox_config.json index f40be4f3eb6..40b8cd29ef1 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/gearbox_config.json +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/gearbox_config.json @@ -20,7 +20,17 @@ "index": 0, "phy_id" : 1, "system_lanes": [200,201], - "line_lanes": [206] + "line_lanes": [206], + "system_tx_fir_pre2": [1,1], + "system_tx_fir_pre1": [-5,-5], + "system_tx_fir_main": [14,14], + "system_tx_fir_post1": [0,0], + "system_tx_fir_post2": [0,0], + "line_tx_fir_pre2": [0], + "line_tx_fir_pre1": [-1], + "line_tx_fir_main": [13], + "line_tx_fir_post1": [-5], + "line_tx_fir_post2": [0] }, { "name": "Ethernet4", diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 index 8d197d3c901..c237015500d 100644 --- a/dockers/docker-base-bullseye/Dockerfile.j2 +++ b/dockers/docker-base-bullseye/Dockerfile.j2 @@ -27,13 +27,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Configure data sources for apt/dpkg COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] -{% if CONFIGURED_ARCH == "armhf" %} -COPY ["sources.list.armhf", "/etc/apt/sources.list"] -{% elif CONFIGURED_ARCH == "arm64" %} -COPY ["sources.list.arm64", "/etc/apt/sources.list"] -{% else %} -COPY ["sources.list", "/etc/apt/sources.list"] -{% endif %} +COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"] COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"] diff --git a/dockers/docker-base-bullseye/sources.list b/dockers/docker-base-bullseye/sources.list deleted file mode 100644 index 4a68761df7c..00000000000 --- a/dockers/docker-base-bullseye/sources.list +++ /dev/null @@ -1,13 +0,0 @@ -## Debian mirror on Microsoft Azure -## Ref: http://debian-archive.trafficmanager.net/ - -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye-backports main contrib non-free - -# Debian mirror supports multiple versions for a package -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye-backports main contrib non-free diff --git a/dockers/docker-base-bullseye/sources.list.arm64 b/dockers/docker-base-bullseye/sources.list.arm64 deleted file mode 100644 index 5a0652aa3c7..00000000000 --- a/dockers/docker-base-bullseye/sources.list.arm64 +++ /dev/null @@ -1,9 +0,0 @@ -## Debian mirror for ARM repo - -# ARM repo -deb [arch=arm64] http://deb.debian.org/debian bullseye main contrib non-free -deb [arch=arm64] http://deb.debian.org/debian bullseye-updates main contrib non-free -deb [arch=arm64] http://security.debian.org bullseye-security main contrib non-free -deb [arch=arm64] http://deb.debian.org/debian bullseye-backports main -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free diff --git a/dockers/docker-base-bullseye/sources.list.armhf b/dockers/docker-base-bullseye/sources.list.armhf deleted file mode 100644 index 435f4692de9..00000000000 --- a/dockers/docker-base-bullseye/sources.list.armhf +++ /dev/null @@ -1,9 +0,0 @@ -## Debian mirror for ARM repo - -# ARM repo -deb [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free -deb [arch=armhf] http://deb.debian.org/debian bullseye-updates main contrib non-free -deb [arch=armhf] http://security.debian.org bullseye-security main contrib non-free -deb [arch=armhf] http://deb.debian.org/debian bullseye-backports main -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free diff --git a/dockers/docker-base-buster/Dockerfile.j2 b/dockers/docker-base-buster/Dockerfile.j2 index 9118287cac3..6977b44d341 100644 --- a/dockers/docker-base-buster/Dockerfile.j2 +++ b/dockers/docker-base-buster/Dockerfile.j2 @@ -27,13 +27,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Configure data sources for apt/dpkg COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] -{% if CONFIGURED_ARCH == "armhf" %} -COPY ["sources.list.armhf", "/etc/apt/sources.list"] -{% elif CONFIGURED_ARCH == "arm64" %} -COPY ["sources.list.arm64", "/etc/apt/sources.list"] -{% else %} -COPY ["sources.list", "/etc/apt/sources.list"] -{% endif %} +COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"] COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"] diff --git a/dockers/docker-base-buster/sources.list b/dockers/docker-base-buster/sources.list deleted file mode 100644 index 0eef72d9fa2..00000000000 --- a/dockers/docker-base-buster/sources.list +++ /dev/null @@ -1,13 +0,0 @@ -## Debian mirror on Microsoft Azure -## Ref: http://debian-archive.trafficmanager.net/ - -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster-backports main contrib non-free - -# Debian mirror supports multiple versions for a package -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster-backports main contrib non-free diff --git a/dockers/docker-base-buster/sources.list.arm64 b/dockers/docker-base-buster/sources.list.arm64 deleted file mode 100644 index 6375734e99e..00000000000 --- a/dockers/docker-base-buster/sources.list.arm64 +++ /dev/null @@ -1,11 +0,0 @@ -## Debian mirror for ARM repo - -# ARM repo -deb [arch=arm64] http://deb.debian.org/debian buster main contrib non-free -deb-src [arch=arm64] http://deb.debian.org/debian buster main contrib non-free -deb [arch=arm64] http://security.debian.org buster/updates main contrib non-free -deb-src [arch=arm64] http://security.debian.org buster/updates main contrib non-free -deb [arch=arm64] http://deb.debian.org/debian/ buster-backports main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-backports main contrib non-free diff --git a/dockers/docker-base-buster/sources.list.armhf b/dockers/docker-base-buster/sources.list.armhf deleted file mode 100644 index a03af1a33ac..00000000000 --- a/dockers/docker-base-buster/sources.list.armhf +++ /dev/null @@ -1,11 +0,0 @@ -## Debian mirror for ARM repo - -# ARM repo -deb [arch=armhf] http://deb.debian.org/debian buster main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian buster main contrib non-free -deb [arch=armhf] http://security.debian.org buster/updates main contrib non-free -deb-src [arch=armhf] http://security.debian.org buster/updates main contrib non-free -deb [arch=armhf] http://deb.debian.org/debian/ buster-backports main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-backports main contrib non-free diff --git a/dockers/docker-base-stretch/Dockerfile.j2 b/dockers/docker-base-stretch/Dockerfile.j2 index 5603dc50279..9e11c4ea35f 100644 --- a/dockers/docker-base-stretch/Dockerfile.j2 +++ b/dockers/docker-base-stretch/Dockerfile.j2 @@ -27,13 +27,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Configure data sources for apt/dpkg COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] -{% if CONFIGURED_ARCH == "armhf" %} -COPY ["sources.list.armhf", "/etc/apt/sources.list"] -{% elif CONFIGURED_ARCH == "arm64" %} -COPY ["sources.list.arm64", "/etc/apt/sources.list"] -{% else %} -COPY ["sources.list", "/etc/apt/sources.list"] -{% endif %} +COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"] COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"] diff --git a/dockers/docker-base-stretch/sources.list b/dockers/docker-base-stretch/sources.list deleted file mode 100644 index 0c29b339bb8..00000000000 --- a/dockers/docker-base-stretch/sources.list +++ /dev/null @@ -1,11 +0,0 @@ -## Debian mirror on Microsoft Azure -## Ref: http://debian-archive.trafficmanager.net/ - -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ stretch-backports main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian stretch main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian stretch-updates main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian stretch-backports main contrib non-free diff --git a/dockers/docker-base-stretch/sources.list.arm64 b/dockers/docker-base-stretch/sources.list.arm64 deleted file mode 100644 index 520c4651991..00000000000 --- a/dockers/docker-base-stretch/sources.list.arm64 +++ /dev/null @@ -1,11 +0,0 @@ -## Debian mirror for ARM repo - -# ARM repo -deb [arch=arm64] http://deb.debian.org/debian stretch main contrib non-free -deb-src [arch=arm64] http://deb.debian.org/debian stretch main contrib non-free -deb [arch=arm64] http://security.debian.org stretch/updates main contrib non-free -deb-src [arch=arm64] http://security.debian.org stretch/updates main contrib non-free -deb [arch=arm64] http://deb.debian.org/debian/ stretch-backports main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian stretch main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian stretch-updates main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian stretch-backports main contrib non-free diff --git a/dockers/docker-base-stretch/sources.list.armhf b/dockers/docker-base-stretch/sources.list.armhf deleted file mode 100644 index 58077f31042..00000000000 --- a/dockers/docker-base-stretch/sources.list.armhf +++ /dev/null @@ -1,11 +0,0 @@ -## Debian mirror for ARM repo - -# ARM repo -deb [arch=armhf] http://deb.debian.org/debian stretch main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian stretch main contrib non-free -deb [arch=armhf] http://security.debian.org stretch/updates main contrib non-free -deb-src [arch=armhf] http://security.debian.org stretch/updates main contrib non-free -deb [arch=armhf] http://deb.debian.org/debian/ stretch-backports main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian stretch main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian stretch-updates main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian stretch-backports main contrib non-free diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index e1aa3c4bcd7..899c111da41 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -32,7 +32,8 @@ RUN apt-get clean -y && \ s/^# syslog-enabled no$/syslog-enabled no/; \ s/^# unixsocket/unixsocket/; \ s/redis-server.sock/redis.sock/g; \ - s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ + s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/; \ + s/^notify-keyspace-events ""$/notify-keyspace-events AKE/ \ ' /etc/redis/redis.conf COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"] diff --git a/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2 b/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2 index cca0b1c4b21..8f83e05efc7 100644 --- a/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2 +++ b/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2 @@ -12,6 +12,9 @@ {% set _dummy = relay_for_ipv6.update({'flag': False}) %} [program:dhcp6relay] command=/usr/sbin/dhcp6relay +{#- Dual ToR Option #} +{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} -d{% endif %} + priority=3 autostart=false autorestart=false diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 index b224a697b5b..13499a6e6c5 100644 --- a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -21,8 +21,28 @@ function wait_until_iface_ready echo "Interface ${IFACE_NAME} is ready!" } +function check_for_ipv6_link_local +{ + IFACE_NAME=$1 + echo "Waiting until interface ${IFACE_NAME} has a link-local ipv6 address configured...." + + # Status of link local address is not populated in STATE_DB + while true; do + HAS_LL=$(ip -6 addr show ${IFACE_NAME} scope link 2> /dev/null) + RC=$? + if [[ ${RC} == "0" ]] && [[ ! -z ${HAS_LL} ]]; then + break + fi + + sleep 1 + done + + echo "Link-Local address is configured on ${IFACE_NAME}" +} # Wait for all interfaces with IPv4 addresses to be up and ready +# dhcp6relay binds to ipv6 addresses configured on these vlan ifaces +# Thus check if they are ready before launching dhcp6relay {% for (name, prefix) in INTERFACE|pfx_filter %} {% if prefix | ipv4 %} wait_until_iface_ready {{ name }} {{ prefix }} @@ -32,6 +52,12 @@ wait_until_iface_ready {{ name }} {{ prefix }} {% if prefix | ipv4 %} wait_until_iface_ready {{ name }} {{ prefix }} {% endif %} +{% if prefix | ipv6 %} +{% if DHCP_RELAY and name in DHCP_RELAY %} +wait_until_iface_ready {{ name }} {{ prefix }} +check_for_ipv6_link_local {{ name }} +{% endif %} +{% endif %} {% endfor %} {% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %} {% if prefix | ipv4 %} diff --git a/dockers/docker-fpm-frr/TS b/dockers/docker-fpm-frr/TS index 5057802c766..1ff08431edb 100755 --- a/dockers/docker-fpm-frr/TS +++ b/dockers/docker-fpm-frr/TS @@ -1,9 +1,10 @@ #!/bin/bash +switch_type=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['switch_type']"` # Check whether the routemap is for internal BGP sessions. function is_internal_route_map() { - [[ "$1" =~ .*"_INTERNAL_".* ]] + [[ "$1" =~ .*"_INTERNAL_".* && $switch_type != "chassis-packet" ]] } function check_not_installed() diff --git a/dockers/docker-fpm-frr/bgp_regex.json b/dockers/docker-fpm-frr/bgp_regex.json index 898b5b060eb..f02ae53ed26 100644 --- a/dockers/docker-fpm-frr/bgp_regex.json +++ b/dockers/docker-fpm-frr/bgp_regex.json @@ -3,6 +3,16 @@ "tag": "bgp-state", "regex": "Peer .default\\|([0-9a-f:.]*[0-9a-f]*). admin state is set to .(up|down).", "params": [ "ip", "status" ] + }, + { + "tag": "zebra-no-buff", + "regex": "No buffer space available", + "params": [] + }, + { + "tag": "notification", + "regex": "NOTIFICATION: (received|sent) (?:to|from) neighbor ([0-9a-f:.]*[0-9a-f+]*)\\s*.* (\\d*)\/(\\d*)", + "params": [ "is-sent", "ip", "major-code", "minor-code" ] } ] diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index b5891b9695a..4cee01ac973 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -61,6 +61,7 @@ route-map HIDE_INTERNAL permit 20 ! {% endif %} ! +{% if (DEVICE_METADATA is defined) and ('localhost' in DEVICE_METADATA) and ('bgp_asn' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['bgp_asn'].lower() != 'none') and (DEVICE_METADATA['localhost']['bgp_asn'].lower() != 'null') %} router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {% block bgp_init %} @@ -143,6 +144,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} exit-address-family {% endblock maximum_paths %} {% endif %} +{% endif %} ! ! end of template: bgpd/bgpd.main.conf.j2 ! diff --git a/dockers/docker-iccpd/Dockerfile.j2 b/dockers/docker-iccpd/Dockerfile.j2 index 95a55159e49..bdb0a9fbf36 100644 --- a/dockers/docker-iccpd/Dockerfile.j2 +++ b/dockers/docker-iccpd/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-lldp/lldpmgrd b/dockers/docker-lldp/lldpmgrd index 753aa678eae..331fedfb4ca 100755 --- a/dockers/docker-lldp/lldpmgrd +++ b/dockers/docker-lldp/lldpmgrd @@ -80,10 +80,10 @@ class LldpManager(daemon_base.DaemonBase): self.port_init_done = False def update_hostname(self, hostname): - cmd = "lldpcli configure system hostname {0}".format(hostname) + cmd = ["lldpcli", "configure", "system", "hostname", hostname] self.log_debug("Running command: '{}'".format(cmd)) - proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen(cmd,stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() if proc.returncode != 0: @@ -93,15 +93,15 @@ class LldpManager(daemon_base.DaemonBase): def update_mgmt_addr(self, ip): if ip == "None": - cmd = "lldpcli unconfigure system ip management pattern" + cmd = ["lldpcli", "unconfigure", "system", "ip", "management", "pattern"] self.log_info("Mgmt IP {0} deleted".format(self.mgmt_ip)) else: - cmd = "lldpcli configure system ip management pattern {0}".format(ip) + cmd = ["lldpcli", "configure", "system", "ip", "management", "pattern", ip] self.log_info("Mgmt IP changed old ip {0}, new ip {1}".format(self.mgmt_ip, ip)) self.log_debug("Running command: '{}'".format(cmd)) - proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() if proc.returncode != 0: @@ -150,11 +150,11 @@ class LldpManager(daemon_base.DaemonBase): # Get the port description. If None or empty string, we'll skip this configuration port_desc = port_table_dict.get("description") - lldpcli_cmd = "lldpcli configure ports {0} lldp portidsubtype local {1}".format(port_name, port_alias) + lldpcli_cmd = ["lldpcli", "configure", "ports", port_name, "lldp", "portidsubtype", "local", port_alias] # if there is a description available, also configure that if port_desc: - lldpcli_cmd += " description '{}'".format(port_desc) + lldpcli_cmd += ["description", port_desc] else: self.log_info("Unable to retrieve description for port '{}'. Not adding port description".format(port_name)) @@ -330,7 +330,7 @@ class LldpManager(daemon_base.DaemonBase): self.port_init_done = self.port_config_done = True if self.port_init_done and self.port_config_done: self.port_init_done = self.port_config_done = False - rc, stderr = run_cmd(self, "lldpcli resume") + rc, stderr = run_cmd(self, ["lldpcli", "resume"]) if rc != 0: self.log_error("Failed to resume lldpd with command: 'lldpcli resume': {}".format(stderr)) sys.exit(1) @@ -350,7 +350,7 @@ def main(): def run_cmd(self, cmd): - proc = subprocess.Popen(cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() return proc.returncode, stderr diff --git a/dockers/docker-nat/restore_nat_entries.py b/dockers/docker-nat/restore_nat_entries.py index cf10d983ab9..9249d95b22a 100755 --- a/dockers/docker-nat/restore_nat_entries.py +++ b/dockers/docker-nat/restore_nat_entries.py @@ -34,13 +34,13 @@ def add_nat_conntrack_entry_in_kernel(ipproto, srcip, dstip, srcport, dstport, natsrcip, natdstip, natsrcport, natdstport): # pyroute2 doesn't have support for adding conntrack entries via netlink yet. So, invoking the conntrack utility to add the entries. - state = '' + state = [] if (ipproto == IP_PROTO_TCP): - state = ' --state ESTABLISHED ' - ctcmd = 'conntrack -I -n ' + natdstip + ':' + natdstport + ' -g ' + natsrcip + ':' + natsrcport + \ - ' --protonum ' + ipproto + state + ' --timeout 432000 --src ' + srcip + ' --sport ' + srcport + \ - ' --dst ' + dstip + ' --dport ' + dstport + ' -u ASSURED' - subprocess.call(ctcmd, shell=True) + state = ['--state', 'ESTABLISHED'] + ctcmd = ['conntrack', '-I', '-n', natdstip + ':' + natdstport, '-g', natsrcip + ':' + natsrcport, \ + '--protonum', ipproto] + state + ['--timeout', '432000', '--src', srcip, '--sport', srcport, \ + '--dst', dstip, '--dport', dstport, '-u', 'ASSURED'] + subprocess.call(ctcmd) logger.log_info("Restored NAT entry: {}".format(ctcmd)) diff --git a/dockers/docker-orchagent/tunnel_packet_handler.py b/dockers/docker-orchagent/tunnel_packet_handler.py index 1ba29a54214..398d7956abf 100755 --- a/dockers/docker-orchagent/tunnel_packet_handler.py +++ b/dockers/docker-orchagent/tunnel_packet_handler.py @@ -16,6 +16,7 @@ from sonic_py_common import logger as log from pyroute2 import IPRoute +from pyroute2.netlink.exceptions import NetlinkError from scapy.layers.inet import IP from scapy.layers.inet6 import IPv6 from scapy.sendrecv import AsyncSniffer @@ -115,7 +116,14 @@ def get_up_portchannels(self): portchannel_intf_names = [name for name, _ in self.portchannel_intfs] link_statuses = [] for intf in portchannel_intf_names: - status = self.netlink_api.link("get", ifname=intf) + try: + status = self.netlink_api.link("get", ifname=intf) + except NetlinkError: + # Continue if we find a non-existent interface since we don't + # need to listen on it while it's down/not created. Once it comes up, + # we will get another netlink message which will trigger this check again + logger.log_notice("Skipping non-existent interface {}".format(intf)) + continue link_statuses.append(status[0]) up_portchannels = [] diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 5c34246ca8b..51d944d170d 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -26,7 +26,9 @@ RUN apt-get update && \ psmisc \ python3-jsonschema \ libpci3 \ - iputils-ping + iputils-ping \ +# smartmontools version should match the installed smartmontools in sonic_debian_extension build template + smartmontools=7.2-1 # On Arista devices, the sonic_platform wheel is not installed in the container. # Instead, the installation directory is mounted from the host OS. However, this method diff --git a/dockers/docker-ptf-sai/Dockerfile.j2 b/dockers/docker-ptf-sai/Dockerfile.j2 index d68b39abb01..65c24a977ed 100644 --- a/dockers/docker-ptf-sai/Dockerfile.j2 +++ b/dockers/docker-ptf-sai/Dockerfile.j2 @@ -16,7 +16,7 @@ RUN pip3 install crc16 \ getmac \ packet_helper \ psutil \ - scapy==2.4.4 \ + scapy \ scapy_helper \ pysubnettree \ xmlrunner @@ -39,3 +39,8 @@ RUN dpkg -r python-ptf RUN git clone https://github.com/p4lang/ptf.git \ && cd ptf \ && python3.7 setup.py install --single-version-externally-managed --record /tmp/ptf_install.txt + +run echo "declare -x LANG=\"C.UTF-8\"" >> /root/.bashrc +run echo "declare -x LC_ALL=\"C.UTF-8\"" >> /root/.bashrc +run echo "declare -x PYTHONIOENCODING=\"UTF-8\"" >> /root/.bashrc +run echo "declare -x VIRTUAL_ENV=\"/root/env-python3\"" >> /root/.bashrc diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index c6b4d1600a8..77b30ef784f 100755 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -7,7 +7,6 @@ RUN apt-get update && apt-get install -y build-essential \ cmake \ curl \ default-jre \ - gcc \ git \ inetutils-ping \ iproute2 \ @@ -16,7 +15,6 @@ RUN apt-get update && apt-get install -y build-essential \ libssl-dev \ libxml2 \ libxslt1-dev \ - make \ openssh-server \ psmisc \ python \ @@ -25,36 +23,43 @@ RUN apt-get update && apt-get install -y build-essential \ python3-venv \ rsyslog \ snmp \ + software-properties-common \ sshpass \ sudo \ tcpdump \ telnet \ - vim \ - python-is-python2 \ - software-properties-common + vim -RUN add-apt-repository -y universe -RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py \ - && python2 get-pip.py - -RUN curl -L http://archive.ubuntu.com/ubuntu/pool/universe/s/scapy/python-scapy_2.3.3-3_all.deb \ +RUN curl -fsSL http://archive.ubuntu.com/ubuntu/pool/universe/s/scapy/python-scapy_2.3.3-3_all.deb \ --output python-scapy_2.3.3-3_all.deb \ - && dpkg -i python-scapy_2.3.3-3_all.deb - -RUN pip install setuptools==44.1.1 -RUN pip install cffi==1.12.0 \ + && dpkg -i python-scapy_2.3.3-3_all.deb \ + && rm -f python-scapy_2.3.3-3_all.deb + +RUN curl -fsSL https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py \ + && python2 get-pip.py \ + && rm -f get-pip.py \ + && ln -sf `which pip2` /usr/bin/pip + +RUN pip install --upgrade pip setuptools wheel +RUN pip install allure-pytest==2.8.22 \ + ansible==2.8.12 \ + azure-storage-blob==12.9.0 \ + celery[redis]==4.4.7 \ + cffi==1.12.0 \ contextlib2==0.6.0.post1 \ cryptography==3.3.2 \ + dpkt \ "future>=0.16.0" \ gitpython \ ipaddr \ ipython==5.4.1 \ ixnetwork-restpy==1.0.64 \ ixnetwork-open-traffic-generator==0.0.79 \ - snappi[ixnetwork,convergence]==0.7.44 \ jinja2==2.7.2 \ jsonpatch \ + lazy-object-proxy==1.6.0 \ lxml \ + msrest==0.6.21 \ natsort \ netaddr \ netmiko==2.4.2 \ @@ -64,29 +69,29 @@ RUN pip install cffi==1.12.0 \ prettytable \ psutil \ pyasn1==0.1.9 \ + pycryptodome==3.9.8 \ pyfiglet \ - lazy-object-proxy==1.6.0 \ pylint==1.8.1 \ pyro4 \ pysnmp==4.2.5 \ + pysubnettree \ + pytest==4.6.11 \ + pytest-ansible \ pytest-repeat \ pytest-html \ pytest-xdist==1.28.0 \ - pytest==4.6.5 \ + python-dateutil \ redis \ requests \ + retry \ rpyc \ six \ - tabulate \ + snappi[ixnetwork,convergence]==0.7.44 \ statistics \ - textfsm==1.1.2 \ - virtualenv \ - retry \ + tabulate \ + textfsm==1.1.3 \ thrift==0.11.0 \ - allure-pytest==2.8.22 \ - celery[redis]==4.4.7 \ - msrest==0.6.21 \ - python-dateutil \ + virtualenv \ && git clone https://github.com/p4lang/scapy-vxlan.git \ && cd scapy-vxlan \ && python setup.py install \ @@ -103,8 +108,7 @@ RUN pip install cffi==1.12.0 \ && cd ../.. \ && rm -fr nanomsg-1.0.0 \ && rm -f 1.0.0.tar.gz \ - && pip install nnpy \ - && pip install dpkt \ + && pip install nnpy \ && pip install scapy==2.4.5 --upgrade --ignore-installed # Install docker-ce-cli @@ -112,9 +116,7 @@ RUN apt-get update \ && apt-get install -y \ apt-transport-https \ ca-certificates \ - curl \ gnupg-agent \ - software-properties-common \ && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ && apt-get update \ @@ -123,8 +125,6 @@ RUN apt-get update \ # Install Azure CLI RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash -RUN pip install wheel==0.33.6 - ## Copy and install sonic-mgmt docker dependencies COPY \ {% for deb in docker_sonic_mgmt_debs.split(' ') -%} @@ -137,18 +137,6 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -RUN pip install ansible==2.8.12 - -RUN pip install pysubnettree - -# Install pytest-ansible module with 'become', 'become_user' parameters support -RUN git clone https://github.com/ansible/pytest-ansible.git \ - && cd pytest-ansible \ - && git checkout d33c025f070a9c870220a157cc5a999fda68de44 \ - && python setup.py install \ - && cd .. \ - && rm -fr pytest-ansible - RUN mkdir /var/run/sshd EXPOSE 22 @@ -187,10 +175,6 @@ RUN env-201811/bin/pip install cryptography==3.3.2 ansible==2.0.0.2 RUN python3 -m venv env-python3 -# NOTE: There is an ordering dependency for pycryptodome. Leaving this at -# the end until we figure that out. -RUN pip install pycryptodome==3.9.8 - # Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD. ENV VIRTUAL_ENV=env-python3 ARG BACKUP_OF_PATH="$PATH" @@ -198,64 +182,66 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH" ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8 -RUN python3 -m pip install --upgrade --ignore-installed pip setuptools==58.4.0 wheel==0.33.6 -RUN python3 -m pip install setuptools-rust \ - aiohttp \ - defusedxml \ - azure-kusto-ingest \ - azure-kusto-data \ - cffi \ - contextlib2==0.6.0.post1 \ - cryptography==3.3.2 \ - "future>=0.16.0" \ - gitpython \ - ipaddr \ - ipython==5.4.1 \ - ixnetwork-restpy==1.0.64 \ - ixnetwork-open-traffic-generator==0.0.79 \ - snappi[ixnetwork,convergence]==0.7.44 \ - markupsafe==2.0.1 \ - jinja2==2.7.2 \ - jsonpatch \ - lxml \ - natsort \ - netaddr \ - netmiko==2.4.2 \ - paramiko==2.7.1 \ - passlib \ - pexpect \ - prettytable \ - psutil \ - pyasn1==0.4.8 \ - pyfiglet \ - pylint==1.8.1 \ - pyro4 \ - pysnmp==4.4.12 \ - pytest-repeat \ - pytest-html \ - pytest-xdist==1.28.0 \ - pytest \ - redis \ - requests \ - rpyc \ - six \ - tabulate \ - textfsm==1.1.2 \ - virtualenv \ - pysubnettree \ - nnpy \ - dpkt \ - pycryptodome==3.9.8 \ - ansible==2.8.12 \ - pytest-ansible \ - allure-pytest==2.8.22 \ - retry \ - thrift==0.11.0 \ - ptf \ - scapy==2.4.5 \ - celery[redis]==4.4.7 \ - msrest==0.6.21 \ - python-dateutil +RUN python3 -m pip install --upgrade pip setuptools wheel +RUN python3 -m pip install aiohttp \ + allure-pytest==2.8.22 \ + ansible==2.9.27 \ + azure-storage-blob==12.9.0 \ + azure-kusto-data \ + azure-kusto-ingest \ + defusedxml \ + celery[redis]==4.4.7 \ + cffi \ + contextlib2==0.6.0.post1 \ + cryptography==3.3.2 \ + dpkt \ + "future>=0.16.0" \ + gitpython \ + ipaddr \ + ipython==5.4.1 \ + ixnetwork-restpy==1.0.64 \ + ixnetwork-open-traffic-generator==0.0.79 \ + jinja2==2.7.2 \ + jsonpatch \ + lxml \ + markupsafe==2.0.1 \ + msrest==0.6.21 \ + natsort \ + ncclient \ + netaddr \ + netmiko==2.4.2 \ + nnpy \ + paramiko==2.7.1 \ + passlib \ + pexpect \ + prettytable \ + psutil \ + ptf \ + pyasn1==0.4.8 \ + pycryptodome==3.9.8 \ + pyfiglet \ + pylint==1.8.1 \ + pyro4 \ + pysnmp==4.4.12 \ + pysubnettree \ + pytest-ansible \ + pytest-html \ + pytest-repeat \ + pytest-xdist==1.28.0 \ + python-dateutil \ + pytest==7.1.3 \ + redis \ + requests \ + retry \ + rpyc \ + scapy==2.4.5 \ + setuptools-rust \ + six \ + snappi[ixnetwork,convergence]==0.7.44 \ + tabulate \ + textfsm==1.1.2 \ + thrift==0.11.0 \ + virtualenv # Deactivating a virtualenv ENV PATH="$BACKUP_OF_PATH" diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 0ca7ed4cf8f..cf09536a5e2 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -401,9 +401,14 @@ extract_image() { extract_image_secureboot() { info "Extracting necessary swi content" # NOTE: boot/ is not used by the boot process but only extracted for kdump - unzip -oq "$swipath" 'boot/*' platform/firsttime .imagehash -d "$image_path" + unzip -oq "$swipath" 'boot/*' .imagehash -d "$image_path" - info "Installing image as $installer_image_path" + ## Extract platform.tar.gz + info "Extracting platform.tar.gz" + mkdir -p "$image_path/platform" + unzip -oqp "$swipath" "platform.tar.gz" | tar xzf - -C "$image_path/platform" $TAR_EXTRA_OPTION + + info "Installing swi under $installer_image_path" mv "$swipath" "$installer_image_path" chmod a+r "$installer_image_path" swipath="$installer_image_path" @@ -487,7 +492,7 @@ write_platform_specific_cmdline() { aboot_machine=arista_7050_qx32s cmdline_add modprobe.blacklist=radeon,sp5100_tco fi - if [ "$sid" = "Upperlake" ] || [ "$sid" = "UpperlakeES" ]; then + if in_array "$sid" "Upperlake" "UpperlakeES" "UpperlakeElite"; then aboot_machine=arista_7060_cx32s flash_size=3700 fi diff --git a/files/apt/sources.list.amd64 b/files/apt/sources.list.amd64 deleted file mode 100644 index fb0a1e99493..00000000000 --- a/files/apt/sources.list.amd64 +++ /dev/null @@ -1,13 +0,0 @@ -## Debian mirror on Microsoft Azure -## Ref: http://debian-archive.trafficmanager.net/ - -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye-backports main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb-src [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free -deb-src [arch=amd64] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye-backports main contrib non-free diff --git a/files/apt/sources.list.arm64 b/files/apt/sources.list.arm64 deleted file mode 100644 index 75bebe1a91d..00000000000 --- a/files/apt/sources.list.arm64 +++ /dev/null @@ -1,13 +0,0 @@ -## Debian mirror for ARM -## Not the repo mirror site can change in future, and needs to be updated to be in sync - -deb [arch=arm64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free -deb-src [arch=arm64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free -deb [arch=arm64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free -deb-src [arch=arm64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free -deb [arch=arm64] http://debian-archive.trafficmanager.net/debian/ bullseye-backports main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb-src [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free -deb-src [arch=arm64] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye-backports main contrib non-free diff --git a/files/apt/sources.list.armhf b/files/apt/sources.list.armhf deleted file mode 100644 index 4f9d4d0a902..00000000000 --- a/files/apt/sources.list.armhf +++ /dev/null @@ -1,18 +0,0 @@ -## Debian mirror for ARM -## Not the repo mirror site can change in future, and needs to be updated to be in sync - -deb [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free -deb [arch=armhf] http://security.debian.org bullseye-security main contrib non-free -deb-src [arch=armhf] http://security.debian.org bullseye-security main contrib non-free -deb [arch=armhf] http://deb.debian.org/debian bullseye-backports main contrib non-free -#deb [arch=armhf] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free -#deb-src [arch=armhf] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free -#deb [arch=armhf] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free -#deb-src [arch=armhf] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free -#deb [arch=armhf] http://debian-archive.trafficmanager.net/debian/ bullseye-backports main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb-src [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free -deb-src [arch=armhf] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye-backports main contrib non-free diff --git a/files/apt/sources.list.j2 b/files/apt/sources.list.j2 new file mode 100644 index 00000000000..57d53b919b0 --- /dev/null +++ b/files/apt/sources.list.j2 @@ -0,0 +1,20 @@ +# The configuration is generated by template +# Please add additional sources in /etc/apt/sources.list.d + +{% for mirror_url in MIRROR_URLS.split(',') %} +deb [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }} main contrib non-free +deb-src [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }} main contrib non-free +deb [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }}-updates main contrib non-free +deb-src [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }}-updates main contrib non-free +deb [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }}-backports main contrib non-free +{% endfor %} +{% for mirror_url in MIRROR_SECURITY_URLS.split(',') %} +{% set dist_separator='/' %}{% if 'packages.trafficmanager.net/debian' in mirror_url %}{% set dist_separator='_' %}{% endif %} +{% if DISTRIBUTION == 'stretch' or DISTRIBUTION == 'buster' %} +deb [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }}{{ dist_separator }}updates main contrib non-free +deb-src [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }}{{ dist_separator }}updates main contrib non-free +{% else %} +deb [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }}-security main contrib non-free +deb-src [arch={{ ARCHITECTURE }}] {{ mirror_url }} {{ DISTRIBUTION }}-security main contrib non-free +{% endif %} +{% endfor %} diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 21d730c74b2..f15e54b5513 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -226,6 +226,11 @@ def "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { "AZURE": { "default_dynamic_th": "0" + {%- if shp is defined -%} + , + "max_headroom_size" : "0", + "over_subscribe_ratio" : "1" + {%- endif -%} } }, "LOSSLESS_TRAFFIC_PATTERN": { diff --git a/files/build_templates/dhcp_relay_regex.json b/files/build_templates/dhcp_relay_regex.json new file mode 100644 index 00000000000..83d90334305 --- /dev/null +++ b/files/build_templates/dhcp_relay_regex.json @@ -0,0 +1,12 @@ +[ + { + "tag": "dhcp-relay-discard", + "regex": "Discarding packet received on ([a-zA-Z0-9-_]*) interface that has no IPv4 address assigned.", + "params": [ "ifname" ] + }, + { + "tag": "dhcp-relay-bind-failure", + "regex": "Failed to bind socket to (link local|global) ipv6 address on interface ([a-zA-Z0-9]*)", + "params": [ "type:ret=(arg==\"link local\")and\"local\"or\"global\")", "vlan" ] + } +] diff --git a/files/build_templates/dockerd_regex.json b/files/build_templates/dockerd_regex.json new file mode 100644 index 00000000000..09270766ac7 --- /dev/null +++ b/files/build_templates/dockerd_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "invalid-freelist", + "regex": "invalid freelist", + "params": [] + } +] diff --git a/files/build_templates/events_info.json b/files/build_templates/events_info.json index d2e2eb151b4..b83afc3caf7 100644 --- a/files/build_templates/events_info.json +++ b/files/build_templates/events_info.json @@ -3,7 +3,7 @@ "proclist": [ { "name": "monit", - "parse_json": "monit_regex.json" + "parse_json": "monit_regex.json" }, { "name": "sshd", @@ -12,6 +12,30 @@ { "name": "systemd", "parse_json": "systemd_regex.json" + }, + { + "name": "dhcp_relay", + "parse_json": "dhcp_relay_regex.json" + }, + { + "name": "syncd", + "parse_json": "syncd_regex.json" + }, + { + "name": "kernel", + "parse_json": "kernel_regex.json" + }, + { + "name": "dockerd", + "parse_json": "dockerd_regex.json" + }, + { + "name": "arista", + "parse_json": "seu_regex.json" + }, + { + "name": "python3", + "parse_json": "seu_regex.json" } ] } diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 38bd7c2e43a..2235efb9b16 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -43,16 +43,16 @@ ("swss", "enabled", false, "enabled"), ("syncd", "enabled", false, "enabled"), ("teamd", "enabled", false, "enabled")] %} -{% 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']) %}enabled{% else %}disabled{% endif %}", false, "enabled")) %} +{% 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 %} {%- if include_mgmt_framework == "y" %}{% do features.append(("mgmt-framework", "enabled", true, "enabled")) %}{% endif %} {%- if include_mux == "y" %}{% do features.append(("mux", "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}", false, "enabled")) %}{% endif %} {%- if include_nat == "y" %}{% do features.append(("nat", "disabled", false, "enabled")) %}{% endif %} -{%- if include_p4rt == "y" %}{% do features.append(("p4rt", "enabled", false, "enabled")) %}{% endif %} +{%- if include_p4rt == "y" %}{% do features.append(("p4rt", "disabled", false, "enabled")) %}{% endif %} {%- if include_restapi == "y" %}{% do features.append(("restapi", "enabled", false, "enabled")) %}{% endif %} {%- if include_sflow == "y" %}{% do features.append(("sflow", "disabled", false, "enabled")) %}{% endif %} -{%- if include_macsec == "y" %}{% do features.append(("macsec", "disabled", false, "enabled")) %}{% endif %} +{%- if include_macsec == "y" %}{% do features.append(("macsec", "{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'SpineRouter' and DEVICE_RUNTIME_METADATA['MACSEC_SUPPORTED'] %}enabled{% else %}disabled{% endif %}", false, "enabled")) %}{% endif %} {%- if include_system_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %} "FEATURE": { {# has_timer field if set, will start the feature systemd .timer unit instead of .service unit #} diff --git a/files/build_templates/kernel_regex.json b/files/build_templates/kernel_regex.json new file mode 100644 index 00000000000..5afa166e0d6 --- /dev/null +++ b/files/build_templates/kernel_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "event-kernel", + "regex": "(write failed|Write protected|Remounting filesystem read-only|zlib decompression failed, data probably corrupt)", + "params": [ "fail_type:ret=(arg==\"write failed\")and\"write_failed\"or((arg==\"Write protected\")and\"write_protected\"or((arg==\"Remounting filesystem read-only\")and\"remount_read_only\"or((arg==\"zlib decompression failed, data probably corrupt\")and\"zlib_decompress\"or\"\")))" ] + } +] diff --git a/files/build_templates/per_namespace/bgp.service.j2 b/files/build_templates/per_namespace/bgp.service.j2 index 61eb71c4db9..e9c1a923109 100644 --- a/files/build_templates/per_namespace/bgp.service.j2 +++ b/files/build_templates/per_namespace/bgp.service.j2 @@ -7,6 +7,7 @@ After=updategraph.service BindsTo=sonic.target After=sonic.target Before=ntp-config.service +After=swss{% if multi_instance == 'true' %}@%i{% endif %}.service After=interfaces-config.service StartLimitIntervalSec=1200 StartLimitBurst=3 diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 358a114c11f..aeba03f595c 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -233,6 +233,7 @@ "global": { "dscp_to_tc_map" : "AZURE" }{% if PORT_ACTIVE %},{% endif %} + {% endif %} {% for port in PORT_ACTIVE %} "{{ port }}": { @@ -332,6 +333,12 @@ "{{ port }}|5": { "scheduler": "scheduler.0" }, +{# DSCP 48 is mapped to QUEUE 7 in macro generate_dscp_to_tc_map #} +{% if (generate_dscp_to_tc_map is defined) and tunnel_qos_remap_enable %} + "{{ port }}|7": { + "scheduler": "scheduler.0" + }, +{% endif %} {% endfor %} {% for port in PORT_ACTIVE %} "{{ port }}|6": { diff --git a/files/build_templates/seu_regex.json b/files/build_templates/seu_regex.json new file mode 100644 index 00000000000..034de15dcb4 --- /dev/null +++ b/files/build_templates/seu_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "event-seu", + "regex": "SEU error was detected", + "params": [] + } +] diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 08098b9c13e..c5e76d3c47c 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -130,13 +130,6 @@ if [[ $CONFIGURED_ARCH == amd64 ]]; then sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio-tools==1.39.0" fi -# Install SwSS SDK Python 3 package -# Note: the scripts will be overwritten by corresponding Python 2 package -SWSSSDK_PY3_WHEEL_NAME=$(basename {{swsssdk_py3_wheel_path}}) -sudo cp {{swsssdk_py3_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SWSSSDK_PY3_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME - # Install sonic-py-common Python 3 package SONIC_PY_COMMON_PY3_WHEEL_NAME=$(basename {{sonic_py_common_py3_wheel_path}}) sudo cp {{sonic_py_common_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY3_WHEEL_NAME @@ -228,6 +221,9 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/bash_*.deb || \ # in bash.bashrc, so we copy a version of the file with it enabled here. sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ +# Install readline's initialization file +sudo cp -f $IMAGE_CONFIGS/readline/inputrc $FILESYSTEM_ROOT/etc/ + # Install prerequisites needed for installing the dependent Python packages of sonic-host-services # These packages can be uninstalled after installation sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config @@ -328,6 +324,11 @@ j2 -f json $BUILD_TEMPLATES/rsyslog_plugin.conf.j2 $BUILD_TEMPLATES/events_info. sudo cp $BUILD_TEMPLATES/monit_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ sudo cp $BUILD_TEMPLATES/sshd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ sudo cp $BUILD_TEMPLATES/systemd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/dhcp_relay_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/syncd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/kernel_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/dockerd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/seu_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ # Install custom-built monit package and SONiC configuration files sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \ @@ -343,7 +344,7 @@ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/memory_checker sudo cp $IMAGE_CONFIGS/monit/restart_service $FILESYSTEM_ROOT/usr/bin/ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/restart_service -# Install custom-built smartmontools +# Installed smartmontools version should match installed smartmontools in docker-platform-monitor Dockerfile sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install smartmontools=7.2-1 # Install custom-built openssh sshd @@ -529,7 +530,7 @@ sudo cp $BUILD_TEMPLATES/buffers_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMP sudo cp $BUILD_TEMPLATES/qos_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ # Copy the templates for dynamically buffer calculation -{% if sonic_asic_platform == "mellanox" or sonic_asic_platform == "vs" %} +{% if sonic_asic_platform == "mellanox" or sonic_asic_platform == "vs" or sonic_asic_platform == "barefoot" %} if [ -f platform/{{ sonic_asic_platform }}/asic_table.j2 ] then sudo cp platform/{{ sonic_asic_platform }}/asic_table.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/asic_table.j2 diff --git a/files/build_templates/syncd_regex.json b/files/build_templates/syncd_regex.json new file mode 100644 index 00000000000..cc78c30f539 --- /dev/null +++ b/files/build_templates/syncd_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "syncd-failure", + "regex": "(MMU ERR Type|L3 route add failed with error|Assertion failed|Received switch event|SER Parity Check Error)", + "params": [ "fail_type:ret=(arg==\"Received switch event\")and\"switch_event\"or((arg==\"Assertion Failed\")and\"assert\"or((arg==\"SER Parity Check Error\")and\"parity_check\"or((arg==\"MMU ERR Type\")and\"mmu_err\"or((arg==\"route add failed\")and\"route_add_failed\"or\"\"))))" ] + } +] diff --git a/files/build_templates/systemd_regex.json b/files/build_templates/systemd_regex.json index d6ea5619eed..bb1b220f534 100644 --- a/files/build_templates/systemd_regex.json +++ b/files/build_templates/systemd_regex.json @@ -2,6 +2,11 @@ { "tag": "event-stopped-ctr", "regex": "Stopped ([a-zA-Z-_\\s]*) container", - "params": [ "ctr-name" ] + "params": [ "ctr_name" ] + }, + { + "tag": "watchdog-timeout", + "regex": "(?:watchdog|Watchdog) timeout .limit.([0-9])min.", + "params": [ "limit" ] } ] diff --git a/files/image_config/corefile_uploader/core_uploader.py b/files/image_config/corefile_uploader/core_uploader.py index aba78618307..efbe88f4a75 100755 --- a/files/image_config/corefile_uploader/core_uploader.py +++ b/files/image_config/corefile_uploader/core_uploader.py @@ -5,7 +5,7 @@ import socket import tarfile import time - +import subprocess import yaml from azure.storage.file import FileService from sonic_py_common.logger import Logger @@ -42,8 +42,8 @@ def make_new_dir(p): - os.system("rm -rf " + p) - os.system("mkdir -p " + p) + subprocess.call(["rm", "-rf", p]) + subprocess.call(["mkdir", "-p", p]) def parse_a_json(data, prefix, val): diff --git a/files/image_config/environment/motd b/files/image_config/environment/motd index 8562e330fe2..0d857e5c5f9 100644 --- a/files/image_config/environment/motd +++ b/files/image_config/environment/motd @@ -10,5 +10,5 @@ You are on Unauthorized access and/or use are prohibited. All access and/or use are subject to monitoring. -Help: http://azure.github.io/SONiC/ +Help: https://sonic-net.github.io/SONiC/ diff --git a/files/image_config/hostname/hostname-config.sh b/files/image_config/hostname/hostname-config.sh index e9f7fc12270..c2a4f1e546c 100755 --- a/files/image_config/hostname/hostname-config.sh +++ b/files/image_config/hostname/hostname-config.sh @@ -3,6 +3,11 @@ CURRENT_HOSTNAME=`hostname` HOSTNAME=`sonic-cfggen -d -v DEVICE_METADATA[\'localhost\'][\'hostname\']` +if [ -z "$HOSTNAME" ] ; then + echo "Missing hostname in the config file, setting to default 'sonic'" + HOSTNAME='sonic' +fi + echo $HOSTNAME > /etc/hostname hostname -F /etc/hostname diff --git a/files/image_config/logrotate/rsyslog.j2 b/files/image_config/logrotate/rsyslog.j2 index 28a7d9dd2ee..25db65ac48b 100644 --- a/files/image_config/logrotate/rsyslog.j2 +++ b/files/image_config/logrotate/rsyslog.j2 @@ -50,7 +50,11 @@ NUM_LOGS_TO_ROTATE=8 # Adjust LOG_FILE_ROTATE_SIZE_KB to reflect the "size" parameter specified above, in kB +{% if var_log_kb <= 204800 %} LOG_FILE_ROTATE_SIZE_KB=1024 +{% else %} + LOG_FILE_ROTATE_SIZE_KB=16384 +{% endif %} # Reserve space for btmp, wtmp, dpkg.log, monit.log, etc., as well as logs that # should be disabled, just in case they get created and rotated diff --git a/files/image_config/misc/docker-wait-any b/files/image_config/misc/docker-wait-any index 3a00a2c610d..f4001d7e02c 100755 --- a/files/image_config/misc/docker-wait-any +++ b/files/image_config/misc/docker-wait-any @@ -61,6 +61,7 @@ def wait_for_container(docker_client, container_name): # Signal the main thread to exit g_thread_exit_event.set() + return def main(): diff --git a/files/image_config/monit/container_checker b/files/image_config/monit/container_checker index 6d7f1403d7a..8ca86c0653d 100755 --- a/files/image_config/monit/container_checker +++ b/files/image_config/monit/container_checker @@ -158,7 +158,7 @@ def publish_events(lst): params = swsscommon.FieldValueMap() for ctr in lst: - params["name"] = ctr; + params["ctr_name"] = ctr; swsscommon.event_publish(events_handle, EVENTS_PUBLISHER_TAG, params) swsscommon.events_deinit_publisher(events_handle) diff --git a/files/image_config/monit/memory_checker b/files/image_config/monit/memory_checker index a93bc30b3fe..11604d4c378 100755 --- a/files/image_config/monit/memory_checker +++ b/files/image_config/monit/memory_checker @@ -27,6 +27,10 @@ import re import docker +from swsscommon import swsscommon + +EVENTS_PUBLISHER_SOURCE = "sonic-events-host" +EVENTS_PUBLISHER_TAG = "mem-threshold-exceeded" def get_command_result(command): """Executes the command and return the resulting output. @@ -41,7 +45,7 @@ def get_command_result(command): try: proc_instance = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=True, universal_newlines=True) + universal_newlines=True) command_stdout, command_stderr = proc_instance.communicate() if proc_instance.returncode != 0: syslog.syslog(syslog.LOG_ERR, "[memory_checker] Failed to execute the command '{}'. Return code: '{}'" @@ -54,8 +58,14 @@ def get_command_result(command): return command_stdout.strip() +def publish_events(events_handle, container_name, mem_usage_bytes, threshold_value): + params = swsscommon.FieldValueMap() + params["ctr_name"] = container_name + params["mem_usage"] = mem_usage_bytes + params["threshold"] = threshold_value + swsscommon.event_publish(events_handle, EVENTS_PUBLISHER_TAG, params) -def check_memory_usage(container_name, threshold_value): +def check_memory_usage(events_handle, container_name, threshold_value): """Checks the memory usage of a container and writes an alerting messages into the syslog if the memory usage is larger than the threshold value. @@ -66,7 +76,7 @@ def check_memory_usage(container_name, threshold_value): Returns: None. """ - command = "docker stats --no-stream --format \{{\{{.MemUsage\}}\}} {}".format(container_name) + command = ["docker", "stats", "--no-stream", "--format", "{{.MemUsage}}", container_name] command_stdout = get_command_result(command) mem_usage = command_stdout.split("/")[0].strip() match_obj = re.match(r"\d+\.?\d*", mem_usage) @@ -89,6 +99,8 @@ def check_memory_usage(container_name, threshold_value): .format(container_name, mem_usage_bytes, threshold_value)) syslog.syslog(syslog.LOG_INFO, "[{}]: Memory usage ({} Bytes) is larger than the threshold ({} Bytes)!" .format(container_name, mem_usage_bytes, threshold_value)) + # publish event + publish_events(events_handle, container_name, mem_usage_bytes, threshold_value) sys.exit(3) else: syslog.syslog(syslog.LOG_ERR, "[memory_checker] Failed to retrieve memory value from '{}'" @@ -105,7 +117,7 @@ def is_service_active(service_name): Returns: True if service is running, False otherwise """ - status = subprocess.run("systemctl is-active --quiet {}".format(service_name), shell=True, check=False) + status = subprocess.run(["systemctl", "is-active", "--quiet", service_name]) return status.returncode == 0 @@ -148,13 +160,14 @@ def main(): sys.exit(0) running_container_names = get_running_container_names() + events_handle = swsscommon.events_init_publisher(EVENTS_PUBLISHER_SOURCE) if args.container_name in running_container_names: - check_memory_usage(args.container_name, args.threshold_value) + check_memory_usage(events_handle, args.container_name, args.threshold_value) else: syslog.syslog(syslog.LOG_INFO, "[memory_checker] Exits without checking memory usage since container '{}' is not running!" .format(args.container_name)) - + swsscommon.events_deinit_publisher(events_handle) if __name__ == "__main__": main() diff --git a/files/image_config/monit/restart_service b/files/image_config/monit/restart_service index 40da147e952..94cc3b7a567 100755 --- a/files/image_config/monit/restart_service +++ b/files/image_config/monit/restart_service @@ -39,7 +39,7 @@ def get_command_result(command): try: proc_instance = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=True, universal_newlines=True) + universal_newlines=True) command_stdout, command_stderr = proc_instance.communicate() if proc_instance.returncode != 0: return 1, command_stdout.strip(), command_stderr.strip() @@ -58,7 +58,7 @@ def reset_failed_flag(service_name): Returns: None """ - reset_failed_command = "sudo systemctl reset-failed {}.service".format(service_name) + reset_failed_command = ["sudo", "systemctl", "reset-failed", "{}.service".format(service_name)] syslog.syslog(syslog.LOG_INFO, "Resetting failed status of service '{}' ..." .format(service_name)) @@ -81,7 +81,7 @@ def restart_service(service_name): Returns: None. """ - restart_command = "sudo systemctl restart {}.service".format(service_name) + restart_command = ["sudo", "systemctl", "restart", "{}.service".format(service_name)] reset_failed_flag(service_name) diff --git a/files/image_config/readline/inputrc b/files/image_config/readline/inputrc new file mode 100644 index 00000000000..f9a424c26de --- /dev/null +++ b/files/image_config/readline/inputrc @@ -0,0 +1,70 @@ +# /etc/inputrc - global inputrc for libreadline +# See readline(3readline) and `info rluserman' for more information. + +# Disable bracketed-paste mode which got enabled by default from bash v5.1 +set enable-bracketed-paste off + +# Be 8 bit clean. +set input-meta on +set output-meta on + +# To allow the use of 8bit-characters like the german umlauts, uncomment +# the line below. However this makes the meta key not work as a meta key, +# which is annoying to those which don't need to type in 8-bit characters. + +# set convert-meta off + +# try to enable the application keypad when it is called. Some systems +# need this to enable the arrow keys. +# set enable-keypad on + +# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys + +# do not bell on tab-completion +# set bell-style none +# set bell-style visible + +# some defaults / modifications for the emacs mode +$if mode=emacs + +# allow the use of the Home/End keys +"\e[1~": beginning-of-line +"\e[4~": end-of-line + +# allow the use of the Delete/Insert keys +"\e[3~": delete-char +"\e[2~": quoted-insert + +# mappings for "page up" and "page down" to step to the beginning/end +# of the history +# "\e[5~": beginning-of-history +# "\e[6~": end-of-history + +# alternate mappings for "page up" and "page down" to search the history +# "\e[5~": history-search-backward +# "\e[6~": history-search-forward + +# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving +"\e[1;5C": forward-word +"\e[1;5D": backward-word +"\e[5C": forward-word +"\e[5D": backward-word +"\e\e[C": forward-word +"\e\e[D": backward-word + +$if term=rxvt +"\e[7~": beginning-of-line +"\e[8~": end-of-line +"\eOc": forward-word +"\eOd": backward-word +$endif + +# for non RH/Debian xterm, can't hurt for RH/Debian xterm +# "\eOH": beginning-of-line +# "\eOF": end-of-line + +# for freebsd console +# "\e[H": beginning-of-line +# "\e[F": end-of-line + +$endif diff --git a/files/image_config/resolv-config/resolv.conf b/files/image_config/resolv-config/resolv.conf new file mode 100644 index 00000000000..e69de29bb2d diff --git a/files/scripts/arp_update b/files/scripts/arp_update index 5522ea46828..7f9a7e1dac7 100755 --- a/files/scripts/arp_update +++ b/files/scripts/arp_update @@ -86,7 +86,7 @@ while /bin/true; do # generates the following command for each failed or incomplete IPv6 neighbor # ip neigh replace dev nud incomplete neigh_replace_template="sed -e 's/^/ip neigh replace /' -e 's/,/ dev /' -e 's/$/ nud incomplete;/'" - ip_neigh_replace_cmd="ip -6 neigh show | grep -v fe80 | grep Vlan1000 | grep -E 'FAILED|INCOMPLETE' | cut -d ' ' -f 1,3 --output-delimiter=',' | $neigh_replace_template" + ip_neigh_replace_cmd="ip -6 neigh show | grep -v fe80 | grep $vlan | grep -E 'FAILED|INCOMPLETE' | cut -d ' ' -f 1,3 --output-delimiter=',' | $neigh_replace_template" eval `eval $ip_neigh_replace_cmd` # on dual ToR devices, try to resolve failed neighbor entries since diff --git a/files/scripts/mark_dhcp_packet.py b/files/scripts/mark_dhcp_packet.py index c80810f0316..4c8e6a728bb 100755 --- a/files/scripts/mark_dhcp_packet.py +++ b/files/scripts/mark_dhcp_packet.py @@ -73,18 +73,17 @@ def generate_mark_from_index(self, index): return intf_mark def run_command(self, cmd): - subprocess.call(cmd, shell=True) + subprocess.call(cmd) log.log_info("run command: {}".format(cmd)) def clear_dhcp_packet_marks(self): ''' Flush the INPUT chain in ebtables upon restart ''' - self.run_command("sudo ebtables -F INPUT") + self.run_command(["sudo", "ebtables", "-F", "INPUT"]) def apply_mark_in_ebtables(self, intf, mark): - self.run_command("sudo ebtables -A INPUT -i {} -j mark --mark-set {}" - .format(intf, mark)) + self.run_command(["sudo", "ebtables", "-A", "INPUT", "-i", intf, "-j", "mark", "--mark-set", mark]) def update_mark_in_state_db(self, intf, mark): self.state_db.set( diff --git a/files/scripts/supervisor-proc-exit-listener b/files/scripts/supervisor-proc-exit-listener index a17ffb7e45f..dbfdaf2c5ac 100755 --- a/files/scripts/supervisor-proc-exit-listener +++ b/files/scripts/supervisor-proc-exit-listener @@ -31,6 +31,8 @@ SELECT_TIMEOUT_SECS = 1.0 # Alerting message will be written into syslog in the following interval ALERTING_INTERVAL_SECS = 60 +EVENTS_PUBLISHER_SOURCE = "sonic-events-host" +EVENTS_PUBLISHER_TAG = "process-exited-unexpectedly" def get_critical_group_and_process_list(): """ @@ -106,6 +108,11 @@ def get_autorestart_state(container_name): return is_auto_restart +def publish_events(events_handle, process_name, container_name): + params = swsscommon.FieldValueMap() + params["process_name"] = process_name + params["ctr_name"] = container_name + swsscommon.event_publish(events_handle, EVENTS_PUBLISHER_TAG, params) def main(argv): container_name = None @@ -123,7 +130,7 @@ def main(argv): process_under_alerting = defaultdict(dict) # Transition from ACKNOWLEDGED to READY childutils.listener.ready() - + events_handle = swsscommon.events_init_publisher(EVENTS_PUBLISHER_SOURCE) while True: file_descriptor_list = select.select([sys.stdin], [], [], SELECT_TIMEOUT_SECS)[0] if len(file_descriptor_list) > 0: @@ -145,6 +152,8 @@ def main(argv): MSG_FORMAT_STR = "Process '{}' exited unexpectedly. Terminating supervisor '{}'" msg = MSG_FORMAT_STR.format(payload_headers['processname'], container_name) syslog.syslog(syslog.LOG_INFO, msg) + publish_events(events_handle, payload_headers['processname'], container_name) + swsscommon.events_deinit_publisher(events_handle) os.kill(os.getppid(), signal.SIGTERM) else: process_under_alerting[process_name]["last_alerted"] = time.time() @@ -174,6 +183,5 @@ def main(argv): process_under_alerting[process_name]["dead_minutes"] += elapsed_mins generate_alerting_message(process_name, process_under_alerting[process_name]["dead_minutes"]) - if __name__ == "__main__": main(sys.argv[1:]) diff --git a/platform/barefoot/asic_table.j2 b/platform/barefoot/asic_table.j2 new file mode 100644 index 00000000000..04670dd28e7 --- /dev/null +++ b/platform/barefoot/asic_table.j2 @@ -0,0 +1,24 @@ +{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %} +{%- set platform = DEVICE_METADATA['localhost']['platform'] %} +{%- endif -%} + + +[ +{% set platform2asic = { + 'x86_64-accton_as9516_32d-r0':'BAREFOOT-TOFINO-2', + 'x86_64-accton_as9516bf_32d-r0':'BAREFOOT-TOFINO-2' + } +%} +{% set asic_type = platform2asic[platform] %} +{% if asic_type == 'BAREFOOT-TOFINO-2' %} + { + "ASIC_TABLE:BAREFOOT-TOFINO-2": { + "cell_size": "176", + "pipeline_latency": "68", + "mac_phy_delay": "0.8", + "peer_response_time": "9" + }, + "OP": "SET" + } +{% endif %} +] diff --git a/platform/barefoot/peripheral_table.j2 b/platform/barefoot/peripheral_table.j2 new file mode 100644 index 00000000000..06b33810fb2 --- /dev/null +++ b/platform/barefoot/peripheral_table.j2 @@ -0,0 +1,18 @@ +{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %} +{%- set platform = DEVICE_METADATA['localhost']['platform'] %} +{%- endif -%} + +{% set platform2gearbox = { + 'x86_64-accton_as9516_32d-r0':'barefoot', + 'x86_64-accton_as9516bf_32d-r0':'barefoot' + } +%} +{% set gearbox_type = platform2gearbox[platform] %} +{% if gearbox_type == 'barefoot' %} + { + "PERIPHERAL TABLE:barefoot": { + "gearbox_delay" : "365" + }, + "OP": "SET" + } +{% endif %} diff --git a/platform/barefoot/rules.mk b/platform/barefoot/rules.mk index 7f159da63fc..3eaa35fdb2c 100644 --- a/platform/barefoot/rules.mk +++ b/platform/barefoot/rules.mk @@ -33,3 +33,5 @@ endif # Runtime dependency on sai is set only for syncd #$(SYNCD)_RDEPENDS += $(BFN_SAI) $(WNC_OSW1800_PLATFORM) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) $(SYNCD)_RDEPENDS += $(BFN_SAI) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) + +export SONIC_BUFFER_MODEL=dynamic diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index e12a04b24c5..2eae0dd1ad3 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit e12a04b24c5f752a9ca789d62bb7b94c563e1c4b +Subproject commit 2eae0dd1ad35b6fd5a78f3eebed466f2744d4fdc diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py index 1041561db42..5c60e49d91a 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py @@ -12,7 +12,7 @@ from sonic_platform.sfp import Sfp from sonic_platform.psu import psu_list_get from sonic_platform.fan_drawer import fan_drawer_list_get - from sonic_platform.thermal import thermal_list_get + from sonic_platform.thermal import chassis_thermals_list_get from sonic_platform.platform_utils import file_create from sonic_platform.eeprom import Eeprom @@ -40,9 +40,9 @@ class Chassis(ChassisBase): def __init__(self): ChassisBase.__init__(self) - self._eeprom = Eeprom() - self.__tlv_bin_eeprom = self._eeprom.get_raw_data() - self.__tlv_dict_eeprom = self._eeprom.get_data() + self.__eeprom = None + self.__tlv_bin_eeprom = None + self.__tlv_dict_eeprom = None self.__fan_drawers = None self.__fan_list = None @@ -60,6 +60,28 @@ def __init__(self): file_create(config_dict['handlers']['file']['filename'], '646') logging.config.dictConfig(config_dict) + @property + def _eeprom(self): + if self.__eeprom is None: + self.__eeprom = Eeprom() + return self.__eeprom + + @_eeprom.setter + def _eeprom(self, value): + pass + + @property + def _tlv_bin_eeprom(self): + if self.__tlv_bin_eeprom is None: + self.__tlv_bin_eeprom = self._eeprom.get_raw_data() + return self.__tlv_bin_eeprom + + @property + def _tlv_dict_eeprom(self): + if self.__tlv_dict_eeprom is None: + self.__tlv_dict_eeprom = self._eeprom.get_data() + return self.__tlv_dict_eeprom + @property def _fan_drawer_list(self): if self.__fan_drawers is None: @@ -85,7 +107,7 @@ def _fan_list(self, value): @property def _thermal_list(self): if self.__thermals is None: - self.__thermals = thermal_list_get() + self.__thermals = chassis_thermals_list_get() return self.__thermals @_thermal_list.setter @@ -145,7 +167,7 @@ def get_name(self): Returns: string: The name of the chassis """ - return self._eeprom.modelstr(self.__tlv_bin_eeprom) + return self._eeprom.modelstr(self._tlv_bin_eeprom) def get_presence(self): """ @@ -161,7 +183,7 @@ def get_model(self): Returns: string: Model/part number of chassis """ - return self._eeprom.part_number_str(self.__tlv_bin_eeprom) + return self._eeprom.part_number_str(self._tlv_bin_eeprom) def get_serial(self): """ @@ -169,7 +191,7 @@ def get_serial(self): Returns: string: Serial number of chassis """ - return self._eeprom.serial_number_str(self.__tlv_bin_eeprom) + return self._eeprom.serial_number_str(self._tlv_bin_eeprom) def get_revision(self): """ @@ -177,7 +199,7 @@ def get_revision(self): Returns: string: Revision number of chassis """ - return self.__tlv_dict_eeprom.get( + return self._tlv_dict_eeprom.get( "0x{:X}".format(Eeprom._TLV_CODE_LABEL_REVISION), 'N/A') def get_sfp(self, index): @@ -219,7 +241,7 @@ def get_base_mac(self): A string containing the MAC address in the format 'XX:XX:XX:XX:XX:XX' """ - return self._eeprom.base_mac_addr(self.__tlv_bin_eeprom) + return self._eeprom.base_mac_addr(self._tlv_bin_eeprom) def get_system_eeprom_info(self): """ @@ -230,7 +252,7 @@ def get_system_eeprom_info(self): OCP ONIE TlvInfo EEPROM format and values are their corresponding values. """ - return self.__tlv_dict_eeprom + return self._tlv_dict_eeprom def __get_transceiver_change_event(self, timeout=0): forever = False diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py index a7f236cb42a..13f8171f970 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py @@ -182,12 +182,10 @@ def __init__(self, component_index=0): self.name = self.bpcp.get_components_list()[self.index] except IndexError as e: print("Error: No components found in plaform_components.json") - + if (self.name == "BMC"): - self.version = get_bmc_version() self.description = "Chassis BMC" elif (self.name == "BIOS"): - self.version = get_bios_version() self.description = "Chassis BIOS" def get_name(self): @@ -214,6 +212,12 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ + if self.version == "N/A": + if (self.name == "BMC"): + self.version = get_bmc_version() + elif (self.name == "BIOS"): + self.version = get_bios_version() + return self.version def install_firmware(self, image_path): diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py index 4b5c1e3051f..973df917503 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py @@ -4,6 +4,7 @@ import datetime import logging import logging.config + import thrift sys.path.append(os.path.dirname(__file__)) @@ -60,7 +61,7 @@ def tlv_eeprom_get(client): try: self._eeprom_bin = bytearray.fromhex( thrift_try(tlv_eeprom_get, 1).raw_content_hex) - except TApplicationException as e: + except thrift.Thrift.TApplicationException as e: raise RuntimeError("api is not supported") except Exception as e: self._eeprom_bin = bytearray.fromhex( diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py index c13382fddb5..371bb86371a 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py @@ -17,15 +17,15 @@ def get_data(client): # Fan -> FanBase -> DeviceBase class Fan(FanBase): - def __init__(self, index, fantrayindex): + def __init__(self, index, max_index, fantrayindex): self.__index = index - self.__fantrayindex = fantrayindex + self.__glob_index = (fantrayindex - 1) * max_index + self.__index # FanBase interface methods: # returns speed in percents def get_speed(self): def cb(info): return info.percent - return _fan_info_get(self.__index, cb, 0) + return _fan_info_get(self.__glob_index, cb, 0) def set_speed(self, percent): # Fan tray speed controlled by BMC @@ -33,10 +33,10 @@ def set_speed(self, percent): # DeviceBase interface methods: def get_name(self): - return "counter-rotating-fan-{}".format((self.__fantrayindex - 1) * self.__index + self.__index) + return "counter-rotating-fan-{}".format(self.__glob_index) def get_presence(self): - return _fan_info_get(self.__index, lambda _: True, False) + return _fan_info_get(self.__glob_index, lambda _: True, False) def get_position_in_parent(self): return self.__index diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py index 269d3d43b0b..0711d1755d9 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py @@ -10,7 +10,7 @@ class FanDrawer(FanDrawerBase): def __init__(self, fantray_index, max_fan): # For now we return only present fans self.fantrayindex = fantray_index - self._fan_list = [Fan(i, self.fantrayindex) for i in range(1, max_fan + 1)] + self._fan_list = [Fan(i, max_fan, self.fantrayindex) for i in range(1, max_fan + 1)] # DeviceBase interface methods: def get_name(self): diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py index fbd83d6496a..8f7a431b82e 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py @@ -12,8 +12,8 @@ from .platform_thrift_client import thrift_try from sonic_platform_base.psu_base import PsuBase + from sonic_platform.thermal import psu_thermals_list_get from platform_utils import cancel_on_sigterm - except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -27,6 +27,7 @@ class Psu(PsuBase): def __init__(self, index): PsuBase.__init__(self) self.__index = index + self.__thermals = None self.__info = None self.__ts = 0 # STUB IMPLEMENTATION @@ -225,6 +226,34 @@ def get_position_in_parent(self): """ return self.__index + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + return self.get_thermal(0).get_temperature() + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return self.get_thermal(0).get_high_threshold() + + @property + def _thermal_list(self): + if self.__thermals is None: + self.__thermals = psu_thermals_list_get(self.get_name()) + return self.__thermals + + @_thermal_list.setter + def _thermal_list(self, value): + pass + def psu_list_get(): psu_list = [] for i in range(1, Psu.get_num_psus() + 1): diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py index 6a5534d8ba6..d63c03014c1 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py @@ -13,15 +13,6 @@ QSFP_DD_TYPE = "QSFP_DD" EEPROM_PAGE_SIZE = 128 -try: - from thrift.Thrift import TApplicationException - - def cached_num_bytes_get(client): - return client.pltfm_mgr.pltfm_mgr_qsfp_cached_num_bytes_get(1, 0, 0, 0) - thrift_try(cached_num_bytes_get, 1) - EEPROM_CACHED_API_SUPPORT = True -except TApplicationException as e: - EEPROM_CACHED_API_SUPPORT = False class Sfp(SfpOptoeBase): """ @@ -34,15 +25,27 @@ def __init__(self, port_num): self.port_num = port_num self.sfp_type = QSFP_TYPE self.SFP_EEPROM_PATH = "/var/run/platform/sfp/" - - if not EEPROM_CACHED_API_SUPPORT: - if not os.path.exists(self.SFP_EEPROM_PATH): - try: - os.makedirs(self.SFP_EEPROM_PATH) - except OSError as e: - if e.errno != errno.EEXIST: - raise - self.eeprom_path = self.SFP_EEPROM_PATH + "sfp{}-eeprom-cache".format(self.index) + self.eeprom_path = None + self.__cached_api_supported = None + + @property + def _cached_api_supported(self): + def cached_num_bytes_get(client): + return client.pltfm_mgr.pltfm_mgr_qsfp_cached_num_bytes_get(1, 0, 0, 0) + if self.__cached_api_supported is None: + try: + thrift_try(cached_num_bytes_get, 1) + self.__cached_api_supported = True + except Exception as e: + self.__cached_api_supported = False + if not os.path.exists(self.SFP_EEPROM_PATH): + try: + os.makedirs(self.SFP_EEPROM_PATH) + except OSError as e: + if e.errno != errno.EEXIST: + raise + self.eeprom_path = self.SFP_EEPROM_PATH + "sfp{}-eeprom-cache".format(self.index) + return self.__cached_api_supported def get_presence(self): """ @@ -94,7 +97,7 @@ def read_eeprom(self, offset, num_bytes): if not self.get_presence(): return None - if not EEPROM_CACHED_API_SUPPORT: + if not self._cached_api_supported: return super().read_eeprom(offset, num_bytes) def cached_num_bytes_get(page, offset, num_bytes): diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py index e5034f09f55..43c51c32a2d 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py @@ -1,5 +1,7 @@ try: import subprocess + import time + import threading from collections import namedtuple import json from bfn_extensions.platform_sensors import platform_sensors_get @@ -23,56 +25,12 @@ ''' Threshold = namedtuple('Threshold', ['crit', 'max', 'min', 'alarm']) -def _sensors_chip_parsed(data: str): - def kv(line): - k, v, *_ = [t.strip(': ') for t in line.split(':') if t] + [''] - return k, v - - chip, *data = data.strip().split('\n') - chip = chip.strip(': ') - - sensors = [] - for line in data: - if not line.startswith(' '): - sensor_label = line.strip(': ') - sensors.append((sensor_label, {})) - continue - - if len(sensors) == 0: - raise RuntimeError(f'invalid data to parse: {data}') - - attr, value = kv(line) - sensor_label, sensor_data = sensors[-1] - sensor_data.update({attr: value}) - - return chip, dict(sensors) - -''' -Example of returned dict: -{ - 'coretemp-isa-0000': { - 'Core 1': { "temp1_input": 40, ... }, - 'Core 2': { ... } - } -} -''' -def _sensors_get() -> dict: - data = platform_sensors_get(['-A', '-u']) or '' - data += subprocess.check_output("/usr/bin/sensors -A -u", - shell=True, text=True) - data = data.split('\n\n') - data = [_sensors_chip_parsed(chip_data) for chip_data in data if chip_data] - data = dict(data) - return data - -def _value_get(d: dict, key_prefix, key_suffix=''): - for k, v in d.items(): - if k.startswith(key_prefix) and k.endswith(key_suffix): - return v - return None # Thermal -> ThermalBase -> DeviceBase class Thermal(ThermalBase): + __sensors_info = None + __timestamp = 0 + __lock = threading.Lock() _thresholds = dict() _max_temperature = 100.0 _min_temperature = 0.0 @@ -96,6 +54,84 @@ def __init__(self, chip, label, index = 0): if f is not None: self.__get_thresholds(f) + @staticmethod + def __sensors_chip_parsed(data: str): + def kv(line): + k, v, *_ = [t.strip(': ') for t in line.split(':') if t] + [''] + return k, v + + chip, *data = data.strip().split('\n') + chip = chip.strip(': ') + + sensors = [] + for line in data: + if not line.startswith(' '): + sensor_label = line.strip(': ') + sensors.append((sensor_label, {})) + continue + + if len(sensors) == 0: + raise RuntimeError(f'invalid data to parse: {data}') + + attr, value = kv(line) + sensor_label, sensor_data = sensors[-1] + sensor_data.update({attr: value}) + + return chip, dict(sensors) + + @classmethod + def __sensors_get(cls, cached=True) -> dict: + cls.__lock.acquire() + if time.time() > cls.__timestamp + 15: + # Update cache once per 15 seconds + try: + data = platform_sensors_get(['-A', '-u']) or '' + data += subprocess.check_output("/usr/bin/sensors -A -u", + shell=True, text=True) + data = data.split('\n\n') + data = [cls.__sensors_chip_parsed(chip_data) for chip_data in data if chip_data] + cls.__sensors_info = dict(data) + cls.__timestamp = time.time() + except Exception as e: + logging.warning("Failed to update sensors cache: " + str(e)) + info = cls.__sensors_info + cls.__lock.release() + return info + + @staticmethod + def __sensor_value_get(d: dict, key_prefix, key_suffix=''): + for k, v in d.items(): + if k.startswith(key_prefix) and k.endswith(key_suffix): + return v + return None + + @staticmethod + def __get_platform_json(): + hwsku_path = device_info.get_path_to_platform_dir() + platform_json_path = "/".join([hwsku_path, "platform.json"]) + f = open(platform_json_path) + return json.load(f) + + @staticmethod + def get_chassis_thermals(): + try: + platform_json = Thermal.__get_platform_json() + return platform_json["chassis"]["thermals"] + except Exception as e: + logging.exception("Failed to collect chassis thermals: " + str(e)) + return None + + @staticmethod + def get_psu_thermals(psu_name): + try: + platform_json = Thermal.__get_platform_json() + for psu in platform_json["chassis"]["psus"]: + if psu["name"] == psu_name: + return psu["thermals"] + except Exception as e: + logging.exception("Failed to collect chassis thermals: " + str(e)) + return None + def __get_thresholds(self, f): def_threshold_json = json.load(f) all_data = def_threshold_json["thermals"] @@ -119,8 +155,18 @@ def check_high_threshold(self, temperature, attr_suffix): return check_range def __get(self, attr_prefix, attr_suffix): - sensor_data = _sensors_get().get(self.__chip, {}).get(self.__label, {}) - value = _value_get(sensor_data, attr_prefix, attr_suffix) + chip_data = Thermal.__sensors_get().get(self.__chip, {}) + sensor_data = {} + for sensor, data in chip_data.items(): + if sensor.lower().replace(' ', '-') == self.__label: + sensor_data = data + break + value = Thermal.__sensor_value_get(sensor_data, attr_prefix, attr_suffix) + + # Can be float value or None + if attr_prefix == 'temp' and attr_suffix == 'input': + return value + if value is not None and self.check_in_range(value) and self.check_high_threshold(value, attr_suffix): return value elif self.__name in self._thresholds and attr_prefix == 'temp': @@ -146,6 +192,8 @@ def __get(self, attr_prefix, attr_suffix): # ThermalBase interface methods: def get_temperature(self) -> float: temp = self.__get('temp', 'input') + if temp is None: + return None self.__collect_temp.append(float(temp)) self.__collect_temp.sort() if len(self.__collect_temp) == 3: @@ -214,13 +262,19 @@ def set_low_threshold(self, temperature): return True return False -def thermal_list_get(): - l = [] - index = 0 - for chip, chip_data in _sensors_get().items(): - for sensor, sensor_data in chip_data.items(): - # add only temperature sensors - if _value_get(sensor_data, "temp") is not None: - l.append(Thermal(chip, sensor, index)) - index += 1 - return l + +def chassis_thermals_list_get(): + thermal_list = [] + thermals = Thermal.get_chassis_thermals() + for index, thermal in enumerate(thermals): + thermal = thermal["name"].split(':') + thermal_list.append(Thermal(thermal[0], thermal[1], index)) + return thermal_list + +def psu_thermals_list_get(psu_name): + thermal_list = [] + thermals = Thermal.get_psu_thermals(psu_name) + for index, thermal in enumerate(thermals): + thermal = thermal["name"].split(':') + thermal_list.append(Thermal(thermal[0], thermal[1], index)) + return thermal_list diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/component.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/component.py index f2dfeb54f0d..41a0260bbc0 100644 --- a/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/component.py +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/component.py @@ -4,7 +4,7 @@ import os import re import logging - from subprocess import Popen, PIPE + from subprocess import call, Popen, PIPE from sonic_platform_base.component_base import ComponentBase except ImportError as e: @@ -39,10 +39,10 @@ FW_INSTALL_CMD_LIST = [ - "/usr/share/sonic/platform/plugins/cpld -b 1 -s 0x60 {}", - "/usr/share/sonic/platform/plugins/Yafuflash -cd {} -img-select 3 -non-interactive", - "/usr/share/sonic/platform/plugins/afulnx_64 {} /B /P /N /K", - "/usr/share/sonic/platform/plugins/afulnx_64 {} /B /P /N /K", + ["/usr/share/sonic/platform/plugins/cpld", "-b", "1", "-s", "0x60", ""], + ["/usr/share/sonic/platform/plugins/Yafuflash", "-cd", "", "-img-select", "3", "-non-interactive"], + ["/usr/share/sonic/platform/plugins/afulnx_64", "", "/B", "/P", "/N", "/K"], + ["/usr/share/sonic/platform/plugins/afulnx_64", "", "/B", "/P", "/N", "/K"], ] BIOS_ID_MAPPING_TABLE = { @@ -157,11 +157,20 @@ def __get_bios_version(self): return bios_version + def __get_cmd(self, image_path): + if self.index == 0: + FW_INSTALL_CMD_LIST[self.index][5] = image_path + elif self.index == 1: + FW_INSTALL_CMD_LIST[self.index][2] = image_path + elif self.index == 2 or self.index == 3: + FW_INSTALL_CMD_LIST[self.index][1] = image_path + return FW_INSTALL_CMD_LIST + def __install_cpld_firmware(self, image_path): result = False - cmd = FW_INSTALL_CMD_LIST[self.index].format(image_path) + cmd = self.__get_cmd(image_path) - ret = os.system(cmd) + ret = call(cmd) if ret == OS_SYSTEM_SUCCESS: result = True @@ -169,9 +178,9 @@ def __install_cpld_firmware(self, image_path): def __install_bmc_firmware(self, image_path): result = False - cmd = FW_INSTALL_CMD_LIST[self.index].format(image_path) + cmd = self.__get_cmd(image_path) - ret = os.system(cmd) + ret = call(cmd) if ret == OS_SYSTEM_SUCCESS: result = True return result @@ -200,8 +209,8 @@ def __install_bios_firmware(self, image_path): logging.error("Not support BIOS index %d", self.index) if ret: - cmd = FW_INSTALL_CMD_LIST[self.index].format(image_path) - ret = os.system(cmd) + cmd = self.__get_cmd(image_path) + ret = call(cmd) if ret == OS_SYSTEM_SUCCESS: result = True else: diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/qsfp.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/qsfp.py index 0da5af9b39a..ece9ba8348d 100644 --- a/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/qsfp.py +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/qsfp.py @@ -8,6 +8,7 @@ try: import os import logging + import subprocess from ctypes import create_string_buffer from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom @@ -131,7 +132,7 @@ def __set_attr_value(self, attr_path, value): return True def __is_host(self): - return os.system("docker > /dev/null 2>&1") == 0 + return subprocess.call(["docker"]) == 0 def __get_path_to_port_config_file(self): host_platform_root_path = '/usr/share/sonic/device' diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/sfp.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/sfp.py index bc26396279a..035b9955dce 100644 --- a/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/sfp.py +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-610/sonic_platform/sfp.py @@ -9,6 +9,7 @@ try: import os import logging + import subprocess from ctypes import create_string_buffer from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom @@ -115,7 +116,7 @@ def __set_attr_value(self, attr_path, value): return True def __is_host(self): - return os.system("docker > /dev/null 2>&1") == 0 + return subprocess.call(["docker"]) == 0 def __get_path_to_port_config_file(self): host_platform_root_path = '/usr/share/sonic/device' diff --git a/platform/broadcom/docker-saiserver-brcm.mk b/platform/broadcom/docker-saiserver-brcm.mk index 2ee39c8600e..f7684a7d5b7 100644 --- a/platform/broadcom/docker-saiserver-brcm.mk +++ b/platform/broadcom/docker-saiserver-brcm.mk @@ -2,7 +2,7 @@ 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)_DEPENDS += $(SAISERVER) $(SAISERVER_DBG) $(DOCKER_SAISERVER_BRCM)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SAISERVER_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_BRCM) diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index 95810f1cb47..13e713534ce 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -1,8 +1,17 @@ # docker image for brcm syncd with rpc -DOCKER_SYNCD_BRCM_RPC = docker-syncd-brcm-rpc.gz +DOCKER_SYNCD_BRCM_RPC = docker-syncd-brcm-rpc$(SAITHRIFT_VER).gz +DOCKER_SYNCD_BRCM_RPC_DBG = docker-syncd-brcm-rpc$(SAITHRIFT_VER)-$(DBG_IMAGE_MARK).gz $(DOCKER_SYNCD_BRCM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm-rpc + + +#Support two different versions of thrift +ifeq ($(SAITHRIFT_V2),y) +$(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) $(PTF) +else $(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(PTF) +endif + ifeq ($(INSTALL_DEBUG_TOOLS), y) $(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ $(LIBSWSSCOMMON_DBG) \ @@ -10,12 +19,21 @@ $(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ $(LIBSAIREDIS_DBG) endif $(DOCKER_SYNCD_BRCM_RPC)_FILES += $(DSSERVE) $(BCMCMD) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + $(DOCKER_SYNCD_BRCM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) +$(DOCKER_SYNCD_BRCM_RPC)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_SYNCD_BRCM_RPC)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) + SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) endif +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SYNCD_BRCM_RPC_DBG) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SYNCD_BRCM_RPC_DBG) +endif + $(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_BRCM_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_BRCM_RPC)_PACKAGE_NAME = syncd @@ -30,3 +48,4 @@ $(DOCKER_SYNCD_BRCM_RPC)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh $(DOCKER_SYNCD_BRCM_RPC)_MACHINE = broadcom SONIC_BULLSEYE_DOCKERS += $(DOCKER_SYNCD_BRCM_RPC) +SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_SYNCD_BRCM_RPC_DBG) diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index 3517b037a40..d6583085e2e 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -25,6 +25,7 @@ RUN apt-get update \ cmake \ libqt5core5a \ libqt5network5 \ + gdb \ libboost-atomic1.74.0 RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 6de969a662b..444df18c587 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,5 +1,5 @@ -LIBSAIBCM_XGS_VERSION = 7.1.7.2 -LIBSAIBCM_DNX_VERSION = 7.1.7.2 +LIBSAIBCM_XGS_VERSION = 7.1.17.4 +LIBSAIBCM_DNX_VERSION = 7.1.17.4 LIBSAIBCM_BRANCH_NAME = REL_7.0 LIBSAIBCM_XGS_URL_PREFIX = "https://sonicstorage.blob.core.windows.net/public/sai/bcmsai/$(LIBSAIBCM_BRANCH_NAME)/$(LIBSAIBCM_XGS_VERSION)" LIBSAIBCM_DNX_URL_PREFIX = "https://sonicstorage.blob.core.windows.net/public/sai/bcmsai/$(LIBSAIBCM_BRANCH_NAME)/$(LIBSAIBCM_DNX_VERSION)" diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py index 22696341523..2659d16f1c8 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py @@ -8,8 +8,8 @@ ############################################################################# try: - import subprocess from sonic_platform_base.component_base import ComponentBase + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -67,8 +67,8 @@ def get_firmware_version(self): if self.name == "BIOS": fw_version = self.__get_bios_version() elif "CPLD" in self.name: - cmd = "i2cget -f -y {0} {1} 0x1".format(self.cpld_mapping[self.index][0], self.cpld_mapping[self.index][1]) - status, value = subprocess.getstatusoutput(cmd) + cmd = ["i2cget", "-f", "-y", self.cpld_mapping[self.index][0], self.cpld_mapping[self.index][1], "0x1"] + status, value = getstatusoutput_noshell(cmd) if not status: fw_version = value.rstrip() diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py index b074177133a..e79137785d1 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py @@ -26,9 +26,9 @@ import logging.config import logging.handlers import time - import subprocess from as4630_54pe.fanutil import FanUtil from as4630_54pe.thermalutil import ThermalUtil + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -198,9 +198,9 @@ def manage_fans(self): if temp[0] >= 70000: #LM75-48 #critical case*/ logging.critical('Alarm-Critical for temperature critical is detected, reset DUT') - cmd_str="i2cset -y -f 3 0x60 0x4 0xE4" + cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0xE4"] time.sleep(2); - status, output = subprocess.getstatusoutput(cmd_str) + status, output = getstatusoutput_noshell(cmd_str) #logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n',ori_state, fan_policy_state, temp_val) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py index d9299b96a3b..6bbaeaa06d6 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py @@ -28,6 +28,7 @@ import logging.handlers import time from sonic_platform import platform + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -209,10 +210,12 @@ def manage_fans(self): # Critical: Either all the fans are faulty or they are removed, shutdown the system logging.critical('Alarm for all fan faulty/absent is detected') logging.critical("Alarm for all fan faulty/absent is detected, reset DUT") - cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4" + cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0xE4"] time.sleep(2) - subprocess.getstatusoutput('sync; sync; sync') - subprocess.getstatusoutput(cmd_str) + getstatusoutput_noshell('sync') + getstatusoutput_noshell('sync') + getstatusoutput_noshell('sync') + getstatusoutput_noshell(cmd_str) elif sum(fan_fail_list) != 0: # Set the 100% speed only for first fan failure detection logging.warning('Fan_{} failed, set remaining fan speed to 100%'.format( @@ -235,7 +238,7 @@ def manage_fans(self): as4630_54pe_set_fan_speed(new_duty_cycle) if test_temp == 1: time.sleep(3) - status, output = subprocess.getstatusoutput('pddf_fanutil getspeed') + status, output = getstatusoutput_noshell(['pddf_fanutil', 'getspeed']) logging.debug('\n%s\n', output) if temp[0] >= 70000: # LM77-48 @@ -252,10 +255,12 @@ def manage_fans(self): if status: logging.warning('Reboot cause file not updated. {}'.format(output)) - cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4" - subprocess.getstatusoutput('sync; sync; sync') + cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0xE4"] + getstatusoutput_noshell('sync') + getstatusoutput_noshell('sync') + getstatusoutput_noshell('sync') time.sleep(3) - subprocess.getstatusoutput(cmd_str) + getstatusoutput_noshell(cmd_str) logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n', ori_state, fan_policy_state, temp_val) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py index 5a505e19f19..5c00f338ba6 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py @@ -2,111 +2,111 @@ # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import commands +from sonic_py_common.general import getstatusoutput_noshell def check_pddf_support(): return True def stop_platform_svc(): - status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as4630-54pe-platform-monitor-fan.service"]) if status: - print "Disable as4630-54pe-platform-monitor-fan.service failed %d"%status + print("Disable as4630-54pe-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as4630-54pe-platform-monitor-fan.service"]) if status: - print "Stop as4630-54pe-platform-monitor-fan.service failed %d"%status + print("Stop as4630-54pe-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as4630-54pe-platform-monitor-psu.service"]) if status: - print "Disable as4630-54pe-platform-monitor-psu.service failed %d"%status + print("Disable as4630-54pe-platform-monitor-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as4630-54pe-platform-monitor-psu.service"]) if status: - print "Stop as4630-54pe-platform-monitor-psu.service failed %d"%status + print("Stop as4630-54pe-platform-monitor-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as4630-54pe-platform-monitor.service"]) if status: - print "Disable as4630-54pe-platform-monitor.service failed %d"%status + print("Disable as4630-54pe-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as4630-54pe-platform-monitor.service"]) if status: - print "Stop as4630-54pe-platform-monitor.service failed %d"%status + print("Stop as4630-54pe-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("/usr/local/bin/accton_as4630_54pe_util.py clean") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as4630_54pe_util.py", "clean"]) if status: - print "accton_as4630_54pe_util.py clean command failed %d"%status + print("accton_as4630_54pe_util.py clean command failed %d"%status) return False # HACK , stop the pddf-platform-init service if it is active - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: - print "Stop pddf-platform-init.service along with other platform serives failed %d"%status + print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as4630-54pe-pddf-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as4630-54pe-pddf-platform-monitor.service"]) if status: - print "Stop as4630-54pe-pddf-platform-monitor.service along with other platform serives failed %d"%status + print("Stop as4630-54pe-pddf-platform-monitor.service along with other platform serives failed %d"%status) return False return True def start_platform_svc(): - status, output = commands.getstatusoutput("/usr/local/bin/accton_as4630_54pe_util.py install") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as4630_54pe_util.py", "install"]) if status: - print "accton_as4630_54pe_util.py install command failed %d"%status + print("accton_as4630_54pe_util.py install command failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as4630-54pe-platform-monitor-fan.service"]) if status: - print "Enable as4630-54pe-platform-monitor-fan.service failed %d"%status + print("Enable as4630-54pe-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as4630-54pe-platform-monitor-fan.service"]) if status: - print "Start as4630-54pe-platform-monitor-fan.service failed %d"%status + print("Start as4630-54pe-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as4630-54pe-platform-monitor-psu.service"]) if status: - print "Enable as4630-54pe-platform-monitor-psu.service failed %d"%status + print("Enable as4630-54pe-platform-monitor-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as4630-54pe-platform-monitor-psu.service"]) if status: - print "Start as4630-54pe-platform-monitor-psu.service failed %d"%status + print("Start as4630-54pe-platform-monitor-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as4630-54pe-platform-monitor.service"]) if status: - print "Enable as4630-54pe-platform-monitor.service failed %d"%status + print("Enable as4630-54pe-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as4630-54pe-platform-monitor.service"]) if status: - print "Start as4630-54pe-platform-monitor.service failed %d"%status + print("Start as4630-54pe-platform-monitor.service failed %d"%status) return False return True def start_platform_pddf(): - status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "pddf-platform-init.service"]) if status: - print "Start pddf-platform-init.service failed %d"%status + print("Start pddf-platform-init.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as4630-54pe-pddf-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as4630-54pe-pddf-platform-monitor.service"]) if status: - print "Start as4630-54pe-pddf-platform-monitor.service failed %d"%status + print("Start as4630-54pe-pddf-platform-monitor.service failed %d"%status) return False return True def stop_platform_pddf(): - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: - print "Stop pddf-platform-init.service failed %d"%status + print("Stop pddf-platform-init.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as4630-54pe-pddf-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as4630-54pe-pddf-platform-monitor.service"]) if status: - print "Stop as4630-54pe-pddf-platform-monitor.service failed %d"%status + print("Stop as4630-54pe-pddf-platform-monitor.service failed %d"%status) return False return True diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py index d3c2b2c8609..aa5076c2caa 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py @@ -20,7 +20,6 @@ # ------------------------------------------------------------------ try: - import os import sys import getopt import logging @@ -194,9 +193,9 @@ def manage_fans(self): # critical case*/ logging.critical( 'Alarm-Critical for temperature critical is detected, reset DUT') - cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4" + cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0xE4"] time.sleep(2) - return_value = os.system(cmd_str) + return_value = subprocess.call(cmd_str) logging.warning('Fan set: i2cset -y -f 3 0x60 0x4 0xE4, status is %d', return_value) #logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n',ori_state, fan_policy_state, temp_val) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py index 31697f7c644..9dc8d94ef68 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py @@ -24,10 +24,8 @@ # ------------------------------------------------------------------ try: - import time import logging - from collections import namedtuple - import subprocess + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -65,10 +63,11 @@ def _get_fan_to_device_node(self, fan_num, node_num): return "fan{0}_{1}".format(fan_num, self.node_postfix[node_num-1]) def _get_fan_i2c_bus_addr(self): - cmd_template = 'i2cget -f -y {} 0x{} 0' + cmd_template = ['i2cget', '-f', '-y', '', '', '0'] for bus_no, dev_addr in self.I2CADDR_CANDIDATES: - cmd = cmd_template.format(bus_no, dev_addr) - if subprocess.getstatusoutput(cmd)[0] == 0: + cmd_template[3] = str(bus_no) + cmd_template[4] = '0x' + str(dev_addr) + if getstatusoutput_noshell(cmd_template)[0] == 0: return bus_no, dev_addr raise IOError('Unable to reach fan CPLD via I2C') diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py index ec3a4c133cd..da046335cdc 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py @@ -23,10 +23,10 @@ # ------------------------------------------------------------------ try: - import os import getopt import sys import logging + import subprocess import logging.config import logging.handlers import time # this is only being used as part of the example @@ -233,7 +233,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected, reboot DUT') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if ori_state==LEVEL_FAN_MID: if new_state==LEVEL_TEMP_HIGH: if alarm_state==0: @@ -242,7 +242,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if ori_state==LEVEL_FAN_MAX: if new_state==LEVEL_TEMP_HIGH: if alarm_state==0: @@ -251,7 +251,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if alarm_state==1: if temp_get < (fan_policy[3][0] - 5000): #below 65 C, clear alarm logging.warning('Alarm for temperature high is cleared') @@ -260,7 +260,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if new_state <= LEVEL_FAN_MID: logging.warning('Alarm for temperature high is cleared') alarm_state=0 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py index faa4f7d48b1..7f3add4e4d2 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py @@ -22,10 +22,10 @@ # ------------------------------------------------------------------ try: - import os import sys import getopt import logging + import subprocess import logging.config import logging.handlers import time @@ -218,7 +218,7 @@ def manage_fans(self): if new_state == LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected, reboot DUT') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if ori_state == LEVEL_FAN_MID: if new_state == LEVEL_TEMP_HIGH: if alarm_state == 0: @@ -227,7 +227,7 @@ def manage_fans(self): if new_state == LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if ori_state == LEVEL_FAN_MAX: if new_state == LEVEL_TEMP_HIGH: if alarm_state == 0: @@ -236,7 +236,7 @@ def manage_fans(self): if new_state == LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if alarm_state == 1: if temp_get < (fan_policy[3][0] - 5000): # below 65 C, clear alarm logging.warning('Alarm for temperature high is cleared') @@ -245,7 +245,7 @@ def manage_fans(self): if new_state == LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if new_state <= LEVEL_FAN_MID: logging.warning('Alarm for temperature high is cleared') alarm_state = 0 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py index c3e1c50366b..f4335bd4456 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py @@ -33,7 +33,7 @@ import re import time import os - +from sonic_py_common.general import getstatusoutput_noshell PROJECT_NAME = 'as7326_56x' @@ -100,16 +100,16 @@ def show_help(): def dis_i2c_ir3570a(addr): - cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr - status, output = subprocess.getstatusoutput(cmd) - cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr - status, output = subprocess.getstatusoutput(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0xE5", "0x01"] + status, output = getstatusoutput_noshell(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0x12", "0x02"] + status, output = getstatusoutput_noshell(cmd) return status def ir3570_check(): - cmd = "i2cdump -y 0 0x42 s 0x9a" + cmd = ["i2cdump", "-y", "0", "0x42", "s", "0x9a"] try: - status, output = subprocess.getstatusoutput(cmd) + status, output = getstatusoutput_noshell(cmd) lines = output.split('\n') hn = re.findall(r'\w+', lines[-1]) version = int(hn[1], 16) @@ -257,8 +257,8 @@ def i2c_order_check(): return 0 def eeprom_check(): - cmd = "i2cget -y -f 0 0x56" - status, output = subprocess.getstatusoutput(cmd) + cmd = ["i2cget", "-y", "-f", "0", "0x56"] + status, output = getstatusoutput_noshell(cmd) return status def device_install(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_switch_svc.py index 1b5f46ef0e1..f02202b210b 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_switch_svc.py @@ -2,39 +2,39 @@ # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import subprocess +from sonic_py_common.general import getstatusoutput_noshell def check_pddf_support(): return True def stop_platform_svc(): - status, output = subprocess.getstatusoutput("systemctl stop as7326-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as7326-platform-monitor-fan.service"]) if status: print("Stop as7326-platform-fan.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl stop as7326-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as7326-platform-monitor-psu.service"]) if status: print("Stop as7326-platform-psu.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl stop as7326-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as7326-platform-monitor.service"]) if status: print("Stop as7326-platform-init.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl disable as7326-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as7326-platform-monitor.service"]) if status: print("Disable as7326-platform-monitor.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7326_util.py clean") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as7326_util.py", "clean"]) if status: print("accton_as7326_util.py clean command failed %d"%status) return False # HACK , stop the pddf-platform-init service if it is active - status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) return False @@ -42,21 +42,21 @@ def stop_platform_svc(): return True def start_platform_svc(): - status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7326_util.py install") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as7326_util.py", "install"]) if status: print("accton_as7326_util.py install command failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl enable as7326-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as7326-platform-monitor.service"]) if status: print("Enable as7326-platform-monitor.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl start as7326-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as7326-platform-monitor-fan.service"]) if status: print("Start as7326-platform-monitor-fan.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl start as7326-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as7326-platform-monitor-psu.service"]) if status: print("Start as7326-platform-monitor-psu.service failed %d"%status) return False @@ -64,7 +64,7 @@ def start_platform_svc(): return True def start_platform_pddf(): - status, output = subprocess.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "pddf-platform-init.service"]) if status: print("Start pddf-platform-init.service failed %d"%status) return False @@ -72,7 +72,7 @@ def start_platform_pddf(): return True def stop_platform_pddf(): - status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print("Stop pddf-platform-init.service failed %d"%status) return False diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/pddf_switch_svc.py index 3ed3f7604e7..0f6c8289309 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/pddf_switch_svc.py @@ -1,28 +1,28 @@ #!/usr/bin/env python # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import commands +from sonic_py_common.general import getstatusoutput_noshell def check_pddf_support(): return True def stop_platform_svc(): - status, output = commands.getstatusoutput("systemctl stop as7712-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as7712-platform-init.service"]) if status: print("Stop as7712-platform-init.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl disable as7712-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as7712-platform-init.service"]) if status: print("Disable as7712-platform-init.service failed %d"%status) return False - status, output = commands.getstatusoutput("/usr/local/bin/accton_as7712_util.py clean") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as7712_util.py", "clean"]) if status: - print("accton_as7712_util.py clean command failed %d"%status) + print("accton_as7712_util.py clean failed %d"%status) return False # HACK , stop the pddf-platform-init service if it is active - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) return False @@ -30,16 +30,16 @@ def stop_platform_svc(): return True def start_platform_svc(): - status, output = commands.getstatusoutput("/usr/local/bin/accton_as7712_util.py install") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as7712_util.py", "install"]) if status: - print("accton_as7712_util.py install command failed %d"%status) + print("accton_as7712_util.py install failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as7712-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as7712-platform-init.service"]) if status: print("Enable as7712-platform-init.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as7712-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as7712-platform-init.service"]) if status: print("Start as7712-platform-init.service failed %d"%status) return False @@ -47,7 +47,7 @@ def start_platform_svc(): return True def start_platform_pddf(): - status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "pddf-platform-init.service"]) if status: print("Start pddf-platform-init.service failed %d"%status) return False @@ -55,7 +55,7 @@ def start_platform_pddf(): return True def stop_platform_pddf(): - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print("Stop pddf-platform-init.service failed %d"%status) return False diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py index 6322aac6bbd..f312d226163 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py @@ -36,6 +36,7 @@ import logging import re import time +from sonic_py_common.general import getstatusoutput_noshell PROJECT_NAME = 'as7716_32x' version = '0.0.1' @@ -220,16 +221,16 @@ def show_set_help(): sys.exit(0) def dis_i2c_ir3570a(addr): - cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr - status, output = subprocess.getstatusoutput(cmd) - cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr - status, output = subprocess.getstatusoutput(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0xE5", "0x01"] + status, output = getstatusoutput_noshell(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0x12", "0x02"] + status, output = getstatusoutput_noshell(cmd) return status def ir3570_check(): - cmd = "i2cdump -y 0 0x42 s 0x9a" + cmd = ["i2cdump", "-y", "0", "0x42", "s", "0x9a"] try: - status, output = subprocess.getstatusoutput(cmd) + status, output = getstatusoutput_noshell(cmd) lines = output.split('\n') hn = re.findall(r'\w+', lines[-1]) version = int(hn[1], 16) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py index f506b72f83a..b889dcf712d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py @@ -23,10 +23,10 @@ # ------------------------------------------------------------------ try: - import os import getopt import sys import logging + import subprocess import logging.config import logging.handlers import time # this is only being used as part of the example @@ -242,7 +242,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected, reboot DUT') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if ori_state==LEVEL_FAN_MID: if new_state==LEVEL_TEMP_HIGH: if alarm_state==0: @@ -251,7 +251,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if ori_state==LEVEL_FAN_MAX: if new_state==LEVEL_TEMP_HIGH: if alarm_state==0: @@ -260,7 +260,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if alarm_state==1: if temp_get < (fan_policy[3][0] - 5000): #below 65 C, clear alarm logging.warning('Alarm for temperature high is cleared') @@ -269,7 +269,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if new_state <= LEVEL_FAN_MID: logging.warning('Alarm for temperature high is cleared') alarm_state=0 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py index fd283cd6cc2..2b18ac646ac 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py @@ -24,10 +24,10 @@ # ------------------------------------------------------------------ try: - import os import sys import getopt import logging + import subprocess import logging.config import logging.handlers import time @@ -230,7 +230,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected, reboot DUT') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if ori_state==LEVEL_FAN_MID: if new_state==LEVEL_TEMP_HIGH: if alarm_state==0: @@ -239,7 +239,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if ori_state==LEVEL_FAN_MAX: if new_state==LEVEL_TEMP_HIGH: if alarm_state==0: @@ -248,7 +248,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if alarm_state==1: if temp_get < (fan_policy[3][0] - 5000): #below 65 C, clear alarm logging.warning('Alarm for temperature high is cleared') @@ -257,7 +257,7 @@ def manage_fans(self): if new_state==LEVEL_TEMP_CRITICAL: logging.critical('Alarm for temperature critical is detected') time.sleep(2) - os.system('reboot') + subprocess.call(['reboot']) if new_state <= LEVEL_FAN_MID: logging.warning('Alarm for temperature high is cleared') alarm_state=0 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py index bee413fe065..949f1230de9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py @@ -32,6 +32,7 @@ import logging import re import time +from sonic_py_common.general import getstatusoutput_noshell PROJECT_NAME = 'as7726_32x' version = '0.0.1' @@ -147,16 +148,16 @@ def show_help(): sys.exit(0) def dis_i2c_ir3570a(addr): - cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr - status, output = subprocess.getstatusoutput(cmd) - cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr - status, output = subprocess.getstatusoutput(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0xE5", "0x01"] + status, output = getstatusoutput_noshell(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0x12", "0x02"] + status, output = getstatusoutput_noshell(cmd) return status def ir3570_check(): - cmd = "i2cdump -y 0 0x42 s 0x9a" + cmd = ["i2cdump", "-y", "0", "0x42", "s", "0x9a"] try: - status, output = subprocess.getstatusoutput(cmd) + status, output = getstatusoutput_noshell(cmd) lines = output.split('\n') hn = re.findall(r'\w+', lines[-1]) version = int(hn[1], 16) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_switch_svc.py index 9664d21b6c3..e8b42aaa1b9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_switch_svc.py @@ -2,44 +2,44 @@ # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import subprocess +from sonic_py_common.general import getstatusoutput_noshell def check_pddf_support(): return True def stop_platform_svc(): - status, output = subprocess.getstatusoutput("systemctl stop as7726-32x-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as7726-32x-platform-monitor-fan.service"]) if status: print("Stop as7726-32x-platform-monitor-fan.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl disable as7726-32x-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as7726-32x-platform-monitor-fan.service"]) if status: print("Disable as7726-32x-platform-monitor-fan.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl stop as7726-32x-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as7726-32x-platform-monitor-psu.service"]) if status: print("Stop as7726-32x-platform-monitor-psu.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl disable as7726-32x-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as7726-32x-platform-monitor-psu.service"]) if status: print("Disable as7726-32x-platform-monitor-psu.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl stop as7726-32x-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as7726-32x-platform-monitor.service"]) if status: print("Stop as7726-32x-platform-monitor.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl disable as7726-32x-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as7726-32x-platform-monitor.service"]) if status: print("Disable as7726-32x-platform-monitor.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7726_32x_util.py clean") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as7726_32x_util.py", "clean"]) if status: print("accton_as7726_32x_util.py clean command failed %d"%status) return False # HACK , stop the pddf-platform-init service if it is active - status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) return False @@ -47,32 +47,32 @@ def stop_platform_svc(): return True def start_platform_svc(): - status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7726_32x_util.py install") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as7726_32x_util.py install"]) if status: print("accton_as7726_32x_util.py install command failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl enable as7726-32x-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as7726-32x-platform-monitor-fan.service"]) if status: print("Enable as7726-32x-platform-monitor-fan.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl start as7726-32x-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as7726-32x-platform-monitor-fan.service"]) if status: print("Start as7726-32x-platform-monitor-fan.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl enable as7726-32x-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as7726-32x-platform-monitor-psu.service"]) if status: print("Enable as7726-32x-platform-monitor-psu.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl start as7726-32x-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as7726-32x-platform-monitor-psu.service"]) if status: print("Start as7726-32x-platform-monitor-psu.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl enable as7726-32x-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as7726-32x-platform-monitor.service"]) if status: print("Enable as7726-32x-platform-monitor.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl start as7726-32x-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as7726-32x-platform-monitor.service"]) if status: print("Start as7726-32x-platform-monitor.service failed %d"%status) return False @@ -80,7 +80,7 @@ def start_platform_svc(): return True def start_platform_pddf(): - status, output = subprocess.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "pddf-platform-init.service"]) if status: print("Start pddf-platform-init.service failed %d"%status) return False @@ -88,7 +88,7 @@ def start_platform_pddf(): return True def stop_platform_pddf(): - status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print("Stop pddf-platform-init.service failed %d"%status) return False diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py index 1e9314fb824..5ab3d8f20e9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py @@ -32,7 +32,7 @@ import re import time import os - +from sonic_py_common.general import getstatusoutput_noshell PROJECT_NAME = 'as7816_64x' @@ -99,18 +99,17 @@ def show_help(): print( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) - def dis_i2c_ir3570a(addr): - cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr - status, output = subprocess.getstatusoutput(cmd) - cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr - status, output = subprocess.getstatusoutput(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0xE5", "0x01"] + status, output = getstatusoutput_noshell(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0x12", "0x02"] + status, output = getstatusoutput_noshell(cmd) return status def ir3570_check(): - cmd = "i2cdump -y 0 0x42 s 0x9a" + cmd = ["i2cdump", "-y", "0", "0x42", "s", "0x9a"] try: - status, output = subprocess.getstatusoutput(cmd) + status, output = getstatusoutput_noshell(cmd) lines = output.split('\n') hn = re.findall(r'\w+', lines[-1]) version = int(hn[1], 16) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_switch_svc.py index 98bf05eca11..166b9c12f0e 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_switch_svc.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import subprocess +from sonic_py_common.general import getstatusoutput_noshell def check_pddf_support(): @@ -10,22 +10,22 @@ def check_pddf_support(): def stop_platform_svc(): - status, output = subprocess.getstatusoutput("systemctl stop as7816-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as7816-platform-init.service"]) if status: print(("Stop as7816-platform-init.service failed %d" % status)) return False - status, output = subprocess.getstatusoutput("systemctl disable as7816-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as7816-platform-init.service"]) if status: print(("Disable as7816-platform-init.service failed %d" % status)) return False - status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7816_util.py clean") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as7816_util.py", "clean"]) if status: print(("accton_as7816_util.py clean command failed %d" % status)) return False # HACK , stop the pddf-platform-init service if it is active - status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print(("Stop pddf-platform-init.service along with other platform serives failed %d" % status)) return False @@ -34,12 +34,12 @@ def stop_platform_svc(): def start_platform_svc(): - status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7816_util.py install") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as7816_util.py", "install"]) if status: print(("accton_as7816_util.py install command failed %d" % status)) return False - status, output = subprocess.getstatusoutput("systemctl enable as7816-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as7816-platform-init.service"]) if status: print(("Enable as7816-platform-init.service failed %d" % status)) return False @@ -48,7 +48,7 @@ def start_platform_svc(): def start_platform_pddf(): - status, output = subprocess.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "pddf-platform-init.service"]) if status: print(("Start pddf-platform-init.service failed %d" % status)) return False @@ -57,7 +57,7 @@ def start_platform_pddf(): def stop_platform_pddf(): - status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print(("Stop pddf-platform-init.service failed %d" % status)) return False diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py index 647e26e07d2..53126109f96 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py @@ -32,6 +32,7 @@ import logging import re import time +from sonic_py_common.general import getstatusoutput_noshell PROJECT_NAME = 'as9716_32d' version = '0.0.1' @@ -153,16 +154,16 @@ def show_help(): sys.exit(0) def dis_i2c_ir3570a(addr): - cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr - status, output = subprocess.getstatusoutput(cmd) - cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr - status, output = subprocess.getstatusoutput(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0xE5", "0x01"] + status, output = getstatusoutput_noshell(cmd) + cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0x12", "0x02"] + status, output = getstatusoutput_noshell(cmd) return status def ir3570_check(): - cmd = "i2cdump -y 0 0x42 s 0x9a" + cmd = ["i2cdump", "-y", "0", "0x42", "s", "0x9a"] try: - status, output = subprocess.getstatusoutput(cmd) + status, output = getstatusoutput_noshell(cmd) lines = output.split('\n') hn = re.findall(r'\w+', lines[-1]) version = int(hn[1], 16) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_switch_svc.py index 95e42b5c897..1d672015d52 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_switch_svc.py @@ -1,39 +1,39 @@ #!/usr/bin/env python # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import subprocess +from sonic_py_common.general import getstatusoutput_noshell def check_pddf_support(): return True def stop_platform_svc(): - status, output = subprocess.getstatusoutput("systemctl stop as9716-32d-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as9716-32d-platform-monitor-fan.service"]) if status: print("Stop as9716-32d-platform-fan.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl stop as9716-32d-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as9716-32d-platform-monitor-psu.service"]) if status: print("Stop as9716-32d-platform-psu.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl stop as9716-32d-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "as9716-32d-platform-monitor.service"]) if status: print("Stop as9716-32d-platform-init.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl disable as9716-32d-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "disable", "as9716-32d-platform-monitor.service"]) if status: print("Disable as9716-32d-platform-monitor.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as9716_32d_util.py clean") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as9716_32d_util.py", "clean"]) if status: print("accton_as9716_32d_util.py clean command failed %d"%status) return False # HACK , stop the pddf-platform-init service if it is active - status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) return False @@ -41,21 +41,21 @@ def stop_platform_svc(): return True def start_platform_svc(): - status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as9716_32d_util.py install") + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as9716_32d_util.py", "install"]) if status: print("accton_as9716_32d_util.py install command failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl enable as9716-32d-platform-monitor.service") + status, output = getstatusoutput_noshell(["systemctl", "enable", "as9716-32d-platform-monitor.service"]) if status: print("Enable as9716-32d-platform-monitor.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl start as9716-32d-platform-monitor-fan.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as9716-32d-platform-monitor-fan.service"]) if status: print("Start as9716-32d-platform-monitor-fan.service failed %d"%status) return False - status, output = subprocess.getstatusoutput("systemctl start as9716-32d-platform-monitor-psu.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "as9716-32d-platform-monitor-psu.service"]) if status: print("Start as9716-32d-platform-monitor-psu.service failed %d"%status) return False @@ -64,7 +64,7 @@ def start_platform_svc(): def start_platform_pddf(): - status, output = subprocess.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "start", "pddf-platform-init.service"]) if status: print("Start pddf-platform-init.service failed %d"%status) return False @@ -73,7 +73,7 @@ def start_platform_pddf(): def stop_platform_pddf(): - status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) if status: print("Stop pddf-platform-init.service failed %d"%status) return False diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index e12a04b24c5..2eae0dd1ad3 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit e12a04b24c5f752a9ca789d62bb7b94c563e1c4b +Subproject commit 2eae0dd1ad35b6fd5a78f3eebed466f2744d4fdc diff --git a/platform/broadcom/sonic-platform-modules-brcm-xlr-gts/utils/brcm-xlr-gts-create-eeprom-file.py b/platform/broadcom/sonic-platform-modules-brcm-xlr-gts/utils/brcm-xlr-gts-create-eeprom-file.py index d8e7ec0ee13..e977a95f747 100755 --- a/platform/broadcom/sonic-platform-modules-brcm-xlr-gts/utils/brcm-xlr-gts-create-eeprom-file.py +++ b/platform/broadcom/sonic-platform-modules-brcm-xlr-gts/utils/brcm-xlr-gts-create-eeprom-file.py @@ -7,6 +7,7 @@ import struct from ctypes import * import os +from sonic_py_common.general import getstatusoutput_noshell_pipe TLV_CODE_PRODUCT_NAME = 0x21 TLV_CODE_SERIAL_NUMBER = 0x23 @@ -71,7 +72,7 @@ def main(): tlvinfo_data = TLVINFO_DATA() tlvinfo_data.add_tlv_str(TLV_CODE_SERIAL_NUMBER, 'S/N') - onie_machine = os.popen("cat /host/machine.conf | grep 'onie_machine=' | sed 's/onie_machine=//'").read().strip() + _, onie_machine = getstatusoutput_noshell_pipe(["cat", "/host/machine.conf"], ["grep", 'onie_machine='], ["sed", 's/onie_machine=//']) if onie_machine == 'bcm_xlr': tlvinfo_data.add_tlv_str(TLV_CODE_PRODUCT_NAME, 'BCM9COMX2XMC') else: @@ -83,11 +84,11 @@ def main(): eth0_mac = eth0_mac_str.split(':') tlvinfo_data.add_tlv_mac(TLV_CODE_MAC_BASE, eth0_mac) - brcm_dev = os.popen("lspci | grep -m1 'Ethernet controller: Broadcom ' | grep 'Device' | sed 's/(.*//' | awk '{print $NF}'").read().strip() + _, brcm_dev = getstatusoutput_noshell_pipe(["lspci"], ["grep", "-m1", 'Ethernet controller: Broadcom '], ["grep", 'Device'], ["sed", 's/(.*//'], ["awk", '{print $NF}']) if brcm_dev == 'b960': tlvinfo_data.add_tlv_str(TLV_CODE_PLATFORM_NAME, 'BCM956960K') - onie_version = os.popen("cat /host/machine.conf | grep 'onie_version' | sed 's/onie_version=//'").read().strip() + onie_version = getstatusoutput_noshell_pipe(["cat", "/host/machine.conf"], ["grep", 'onie_version'], ["sed", 's/onie_version=//']) tlvinfo_data.add_tlv_str(TLV_CODE_ONIE_VERSION, onie_version) tlvinfo_header.totallen = len(tlvinfo_data.dump())+4; diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/modules/pddf_custom_wdt.c b/platform/broadcom/sonic-platform-modules-cel/belgite/modules/pddf_custom_wdt.c index a73a6f6eb14..21ef0de9f31 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/modules/pddf_custom_wdt.c +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/modules/pddf_custom_wdt.c @@ -86,6 +86,7 @@ struct cpld_wdt_private { struct platform_device *pdev; struct watchdog_device wddev; struct cdev cdev; + struct miscdevice mdev; bool suspended; struct wdt_data wdat; }; @@ -100,7 +101,7 @@ MODULE_PARM_DESC(timeout, "Start watchdog timer on module load with" " Zero (default) disables this feature."); static bool nowayout = WATCHDOG_NOWAYOUT; -module_param(nowayout, bool, 0444); +module_param(nowayout, bool, 0644); MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); static unsigned int watchdog_get_timeleft(struct cpld_wdt_private *wdt) @@ -114,7 +115,7 @@ static unsigned int watchdog_get_timeleft(struct cpld_wdt_private *wdt) time = time << 8 | inb(WDT_TIMER_L_BIT_REG); time = time/1000; mutex_unlock(&wdt->wdat.lock); - //pr_crit("Watchdog Get Timeleft:%u\n", time); + return time; } static int watchdog_get_timeout(struct cpld_wdt_private *wdt) @@ -175,7 +176,7 @@ static int watchdog_ping(struct cpld_wdt_private *wdt) outb(WDT_START_FEED, WDT_FEED_REG); /* stop feed watchdog */ outb(WDT_STOP_FEED, WDT_FEED_REG); - //pr_crit("Watchdog Ping\n"); + mutex_unlock(&wdt->wdat.lock); return 0; @@ -198,7 +199,7 @@ static void watchdog_keepalive(struct cpld_wdt_private *wdt) val &= 0x1; /* start feed watchdog */ outb(val, WDT_FEED_REG); - //pr_crit("Watchdog Keepalive\n"); + mutex_unlock(&wdt->wdat.lock); return; } @@ -214,7 +215,7 @@ static int watchdog_start(struct cpld_wdt_private *wdt) outb(WDT_ENABLE, WDT_ENABLE_REG); outb(WDT_RESTART, WDT_PUNCH_REG); mutex_unlock(&wdt->wdat.lock); - //pr_crit("Watchdog Start:Enable and PUNCH\n"); + return 0; } @@ -226,7 +227,7 @@ static int watchdog_stop(struct cpld_wdt_private *wdt) mutex_lock(&wdt->wdat.lock); outb(WDT_DISABLE, WDT_ENABLE_REG); mutex_unlock(&wdt->wdat.lock); - //pr_crit("Watchdog Stop\n"); + return 0; } @@ -370,7 +371,7 @@ static int watchdog_open(struct inode *inode, struct file *file) { struct cpld_wdt_private *wdt; - wdt = container_of(inode->i_cdev, struct cpld_wdt_private, cdev); + wdt = container_of(file->private_data, struct cpld_wdt_private, mdev); /* If the watchdog is alive we don't need to start it again */ @@ -384,14 +385,14 @@ static int watchdog_open(struct inode *inode, struct file *file) wdt->wdat.expect_close = 0; - file->private_data = wdt; + return nonseekable_open(inode, file); } static int watchdog_release(struct inode *inode, struct file *file) { struct cpld_wdt_private *p; - p = (struct cpld_wdt_private *)file->private_data; + p = container_of(file->private_data, struct cpld_wdt_private, mdev); if(!p) return -EINVAL; @@ -423,7 +424,7 @@ static ssize_t watchdog_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct cpld_wdt_private *p; - p = (struct cpld_wdt_private *)file->private_data; + p = container_of(file->private_data, struct cpld_wdt_private, mdev); if(!p) return -EINVAL; @@ -480,7 +481,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, uarg.i = (int __user *)arg; struct cpld_wdt_private *p; - p = (struct cpld_wdt_private *)file->private_data; + p = container_of(file->private_data, struct cpld_wdt_private, mdev); if(!p) return -EINVAL; @@ -627,8 +628,8 @@ static int cpld_wdt_probe(struct platform_device *pdev) err = register_reboot_notifier(&watchdog_notifier); if (err) return err; - - err = misc_register(&watchdog_miscdev); + p->mdev = watchdog_miscdev; + err = misc_register(&p->mdev); if (err) { pr_err("cannot register miscdev on minor=%d\n", watchdog_miscdev.minor); @@ -672,7 +673,7 @@ static int cpld_wdt_remove(struct platform_device *pdev) sysfs_remove_group(&pdev->dev.kobj, &wdt_group); - misc_deregister(&watchdog_miscdev); + misc_deregister(&p->mdev); unregister_reboot_notifier(&watchdog_notifier); diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/asic_monitor.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/asic_monitor.py index bcb05b9cb84..9c994c572dd 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/common/utils/asic_monitor.py +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/asic_monitor.py @@ -17,13 +17,11 @@ try: import os - import commands - import sys, getopt - import logging import re import time import syslog from sonic_sfp.bcmshell import bcmshell + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -53,10 +51,10 @@ def initialLoop(): bcm_obj = BCMUtil() bcm_obj.execute_command("echo") initialNotOK = False - print bcm_obj + print(bcm_obj) log_message( syslog.LOG_INFO, "BCMUtil Object initialed successfully" ) - except Exception, e: - print "Exception. The warning is {0}".format(str(e)) + except Exception as e: + print("Exception. The warning is {0}".format(str(e))) time.sleep(10) class BCMUtil(bcmshell): @@ -66,7 +64,7 @@ class BCMUtil(bcmshell): def get_platform(self): if self.platform is None: - self.platform = os.popen("uname -n").read().strip() + _, self.platform = getstatusoutput_noshell(["uname", "-n"]).strip() return self.platform def get_asic_temperature( self ): @@ -102,14 +100,18 @@ def main(): content = readPtr.read().strip() if bcm_obj.get_platform() == INV_SEQUOIA_PLATFORM : if content == "inv_bmc" and SWITCH_TEMP_FILE_NAME in file_list : - os.system("echo {0} > {1}/{2}/device/{3}".format( ( bcm_obj.get_asic_temperature() * 1000 ), HWMON_PATH, index, SWITCH_TEMP_FILE_NAME )) + file = "{0}/{1}/device/{2}".format(HWMON_PATH, index, SWITCH_TEMP_FILE_NAME) + with open(file, 'w') as f: + f.write(str(bcm_obj.get_asic_temperature() * 1000) + '\n') break else : if content == "inv_psoc" and SWITCH_TEMP_FILE_NAME in file_list : - print "echo {0} > {1}/{2}/device/{3}".format( ( bcm_obj.get_asic_temperature() * 1000 ), HWMON_PATH, index, SWITCH_TEMP_FILE_NAME ) - os.system("echo {0} > {1}/{2}/device/{3}".format( ( bcm_obj.get_asic_temperature() * 1000 ), HWMON_PATH, index, SWITCH_TEMP_FILE_NAME )) + print("echo {0} > {1}/{2}/device/{3}".format( ( bcm_obj.get_asic_temperature() * 1000 ), HWMON_PATH, index, SWITCH_TEMP_FILE_NAME)) + file = "{0}/{1}/device/{2}".format(HWMON_PATH, index, SWITCH_TEMP_FILE_NAME) + with open(file, 'w') as f: + f.write(str(bcm_obj.get_asic_temperature() * 1000) + '\n') break - except Exception, e: + except Exception as e: log_message( syslog.LOG_WARNING, "Exception. The warning is {0}".format(str(e)) ) initialLoop() time.sleep(5) diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py index bab0e2dafe7..8f4564287dd 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py @@ -20,6 +20,7 @@ import syslog import re from sonic_sfp.bcmshell import bcmshell +from sonic_py_common.general import getstatusoutput_noshell # ===================================================================== @@ -120,8 +121,8 @@ def _board_init(): global SYNC_S global SYNC_P - cmd = "uname -n" - platform = os.popen(cmd).read() + cmd = ["uname", "-n"] + _, platform = getstatusoutput_noshell(cmd) if platform.rstrip() == INV_MAGNOLIA: BOARD_TPYE = "inventec_d6254qs" diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/platform_status.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/platform_status.py index f1e7f7fece7..d73687e025a 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/common/utils/platform_status.py +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/platform_status.py @@ -2,6 +2,7 @@ import os import socket +import subprocess from collections import OrderedDict # Purpose: Shutdown DUT upon receiving thermaltrip event from kernel (inv_pthread) @@ -59,6 +60,6 @@ def next_events(self): # Receive thermaltrip event if event['ACTION'] == 'remove' and event['DEVPATH'] == '/kernel/platform_status/fan': - os.system("shutdown -h now") + subprocess.call(["shutdown", "-h", "now"]) diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py index 9e4a44c167f..453c33deeaf 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py @@ -28,6 +28,7 @@ import syslog from sfputil import SfpUtil from sonic_sfp.bcmshell import bcmshell + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -127,7 +128,7 @@ class BCMUtil(bcmshell): def get_platform(self): if self.platform is None: - self.platform = os.popen("uname -n").read().strip() + _, self.platform = getstatusoutput_noshell(["uname", "-n"]) return self.platform def get_port_to_bcm_mapping(self): diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6332/sonic_platform/qsfp.py b/platform/broadcom/sonic-platform-modules-inventec/d6332/sonic_platform/qsfp.py index b1f8799ab59..f71a19d00e6 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d6332/sonic_platform/qsfp.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d6332/sonic_platform/qsfp.py @@ -8,6 +8,7 @@ try: import os import logging + import subprocess from ctypes import create_string_buffer from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom @@ -120,7 +121,7 @@ def __set_attr_value(self, attr_path, value): return True def __is_host(self): - return os.system("docker > /dev/null 2>&1") == 0 + return subprocess.call(["docker"]) == 0 def __get_path_to_port_config_file(self): host_platform_root_path = '/usr/share/sonic/device' diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6332/utils/inventec_d6332_util.py b/platform/broadcom/sonic-platform-modules-inventec/d6332/utils/inventec_d6332_util.py index a468a323d6f..d467fd8fb5d 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/d6332/utils/inventec_d6332_util.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d6332/utils/inventec_d6332_util.py @@ -33,6 +33,7 @@ import logging import syslog import time +from sonic_py_common.general import getstatusoutput_noshell_pipe DEBUG = False args = [] @@ -236,8 +237,9 @@ def system_install(boot_option): return status for addr_offset in range (0,FAN_NUM): addr=FAN_VPD_ADDR_BASE+addr_offset - cmd = "i2cdetect -y "+str(FAN_VPD_CHANNEL)+" "+str(addr)+" "+str(addr)+" | grep "+str(hex(addr)).replace('0x','') - result=os.system(cmd) + cmd1 = ["i2cdetect", "-y", str(FAN_VPD_CHANNEL), str(addr), str(addr)] + cmd2 = ["grep", f'{addr:x}'] + result, _ = getstatusoutput_noshell_pipe(cmd1, cmd2) if( result==0 ): cmd="echo inv_eeprom "+str(addr)+" > /sys/bus/i2c/devices/i2c-"+FAN_VPD_CHANNEL status, output = exec_cmd(cmd,1) diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/qsfp.py b/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/qsfp.py index fccde46df4c..22eae317f8c 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/qsfp.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/qsfp.py @@ -9,6 +9,7 @@ import os import sys import time + import subprocess from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId @@ -108,7 +109,7 @@ def __get_attr_value(self, attr_path): return retval def __is_host(self): - return os.system("docker > /dev/null 2>&1") == 0 + return subprocess.call(["docker"]) == 0 def __get_path_to_port_config_file(self): host_platform_root_path = '/usr/share/sonic/device' diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/sfp.py index 5c75a8749a4..de8d50b7abd 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/sfp.py @@ -7,7 +7,7 @@ try: import os - import sys + import subprocess from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId @@ -95,7 +95,7 @@ def __get_attr_value(self, attr_path): return retval def __is_host(self): - return os.system("docker > /dev/null 2>&1") == 0 + return subprocess.call(["docker"]) == 0 def __get_path_to_port_config_file(self): host_platform_root_path = '/usr/share/sonic/device' diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/sonic_platform/sfp.py index 9d6337195d5..ee5768a640f 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/sonic_platform/sfp.py @@ -153,7 +153,7 @@ class Sfp(SfpBase): # Path to QSFP sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-inventec_d7054q28b-r0" HWSKU = "INVENTEC-D7054Q28B-S48-Q6" @@ -285,7 +285,7 @@ def __read_txt_file(self, file_path): return "" def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/platform/broadcom/sonic-platform-modules-nokia b/platform/broadcom/sonic-platform-modules-nokia index 0f27485ea43..5ebea4ba7e1 160000 --- a/platform/broadcom/sonic-platform-modules-nokia +++ b/platform/broadcom/sonic-platform-modules-nokia @@ -1 +1 @@ -Subproject commit 0f27485ea43b98e4382aae12f3c4780b44e02c05 +Subproject commit 5ebea4ba7e14b44cfef7943443ce297ea996cba9 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/utils/quanta_ix1b_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/utils/quanta_ix1b_util.py index 2135932938e..b92c5cf828c 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/utils/quanta_ix1b_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/utils/quanta_ix1b_util.py @@ -27,13 +27,10 @@ clean : uninstall drivers and remove related sysfs nodes """ -import os import commands import sys, getopt import logging -import re import time -from collections import namedtuple DEBUG = False args = [] @@ -41,8 +38,8 @@ i2c_prefix = '/sys/bus/i2c/devices/' if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): global DEBUG @@ -56,10 +53,10 @@ def main(): 'debug', 'force', ]) - if DEBUG == True: - print options - print args - print len(sys.argv) + if DEBUG is True: + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -83,12 +80,12 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_log(txt): - if DEBUG == True: - print "[IX1B-32X]" + txt + if DEBUG is True: + print("[IX1B-32X]" + txt) return @@ -165,7 +162,7 @@ def system_install(): status, output = exec_cmd("modprobe " + drivers[i], 1) if status: - print output + print(output) if FORCE == 0: return status @@ -174,7 +171,7 @@ def system_install(): status, output = exec_cmd(instantiate[i], 1) if status: - print output + print(output) if FORCE == 0: return status @@ -184,7 +181,9 @@ def system_install(): #QSFP for 1~32 port for port_number in range(1, 33): bus_number = port_number + 31 - os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + file = "/sys/bus/i2c/devices/%d-0050/port_name" % bus_number + with open(file, 'w') as f: + f.write(str(port_number) + '\n') #Set system LED to green status, output = exec_cmd("echo 1 > /sys/class/leds/sysled_green/brightness", 1) @@ -199,14 +198,14 @@ def system_ready(): def install(): if not device_found(): - print "No device, installing...." + print("No device, installing....") status = system_install() if status: if FORCE == 0: return status else: - print " ix1b driver already installed...." + print(" ix1b driver already installed....") return @@ -215,10 +214,10 @@ def uninstall(): #uninstall drivers for i in range(len(drivers) - 1, -1, -1): - status, output = exec_cmd("rmmod " + drivers[i], 1) + status, output = exec_cmd("rmmod " + drivers[i], 1) if status: - print output + print(output) if FORCE == 0: return status diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/component.py index 9f5f69f422a..bbaf23533f2 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/component.py @@ -14,6 +14,7 @@ import subprocess from sonic_platform_base.component_base import ComponentBase from collections import namedtuple + from sonic_py_common.general import getstatusoutput_noshell_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -47,7 +48,7 @@ def _get_command_result(cmdline): try: proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, - shell=True, stderr=subprocess.STDOUT, + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] rc = proc.wait() @@ -60,12 +61,24 @@ def _get_command_result(cmdline): return result + @staticmethod + def _get_command_result_pipe(cmd1, cmd2): + try: + rc, result = getstatusoutput_noshell_pipe(cmd1, cmd2) + if rc != [0, 0]: + raise RuntimeError("Failed to execute command {} {}, return code {}, {}".format(cmd1, cmd2, rc, result)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} {} due to {}".format(cmd1, cmd2, repr(e))) + + return result + class ComponentBIOS(Component): COMPONENT_NAME = 'BIOS' COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' - BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + BIOS_QUERY_VERSION_COMMAND = ["dmidecode", "-s", "bios-version"] def __init__(self): super(ComponentBIOS, self).__init__() @@ -90,7 +103,8 @@ def get_firmware_version(self): class ComponentBMC(Component): COMPONENT_NAME = 'BMC' COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' - BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + BMC_QUERY_VERSION_COMMAND1 = ["ipmitool", "mc", "info"] + BMC_QUERY_VERSION_COMMAND2 = ["grep", 'Firmware Revision'] def __init__(self): super(ComponentBMC, self).__init__() @@ -105,7 +119,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + bmc_ver = self._get_command_result_pipe(self.BMC_QUERY_VERSION_COMMAND1, self.BMC_QUERY_VERSION_COMMAND2) if not bmc_ver: return 'ERR' else: @@ -159,7 +173,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) + res = self._get_command_result(["ipmitool", "raw", "0x32", "0xff", "0x02", str(self.cplds[self.index].cmd_index)]) if not res: return 'ERR' else: @@ -179,7 +193,8 @@ def get_component_list(cls): class ComponentPCIE(Component): COMPONENT_NAME = 'PCIe' COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' - PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + PCIE_QUERY_VERSION_COMMAND1 = ["bcmcmd", 'pciephy fw version'] + PCIE_QUERY_VERSION_COMMAND2 = ["grep", 'FW version'] def __init__(self): super(ComponentPCIE, self).__init__() @@ -194,7 +209,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + version = self._get_command_result_pipe(self.PCIE_QUERY_VERSION_COMMAND1, self.PCIE_QUERY_VERSION_COMMAND2) if not version: return 'ERR' else: diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py index c8336473051..a2da83d290c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py @@ -8,17 +8,17 @@ # ############################################################################# -import os import time +import subprocess from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -163,7 +163,7 @@ class Sfp(SfpBase): # Path to QSFP sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-quanta_ix7_rglbmc-r0" HWSKU = "Quanta-IX7-32X" @@ -259,7 +259,7 @@ def _convert_string_to_num(self, value_str): return 'N/A' def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py index 4196e24f462..9b679cacd91 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py @@ -27,7 +27,6 @@ clean : uninstall drivers and remove related sysfs nodes """ -import os import subprocess import sys, getopt import logging @@ -54,7 +53,7 @@ def main(): 'debug', 'force', ]) - if DEBUG == True: + if DEBUG is True: print(options) print(args) print(len(sys.argv)) @@ -84,7 +83,7 @@ def show_help(): sys.exit(0) def show_log(txt): - if DEBUG == True: + if DEBUG is True: print("[IX7-32X]" + txt) return @@ -204,7 +203,9 @@ def system_install(): #QSFP for 1~32 port for port_number in range(1, 33): bus_number = port_number + 16 - os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + file = "/sys/bus/i2c/devices/%d-0050/port_name" % bus_number + with open(file, 'w') as f: + f.write(str(port_number) + '\n') return diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/component.py index ae0c2522893..e5228829f5e 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/component.py @@ -14,6 +14,7 @@ import subprocess from sonic_platform_base.component_base import ComponentBase from collections import namedtuple + from sonic_py_common.general import getstatusoutput_noshell_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -47,7 +48,7 @@ def _get_command_result(cmdline): try: proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, - shell=True, stderr=subprocess.STDOUT, + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] rc = proc.wait() @@ -60,12 +61,24 @@ def _get_command_result(cmdline): return result + @staticmethod + def _get_command_result_pipe(cmd1, cmd2): + try: + rc, result = getstatusoutput_noshell_pipe(cmd1, cmd2) + if rc != [0, 0]: + raise RuntimeError("Failed to execute command {} {}, return code {}, {}".format(cmd1, cmd2, rc, result)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} {} due to {}".format(cmd1, cmd2, repr(e))) + + return result + class ComponentBIOS(Component): COMPONENT_NAME = 'BIOS' COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' - BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + BIOS_QUERY_VERSION_COMMAND = ["dmidecode", "-s", "bios-version"] def __init__(self): super(ComponentBIOS, self).__init__() @@ -90,7 +103,8 @@ def get_firmware_version(self): class ComponentBMC(Component): COMPONENT_NAME = 'BMC' COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' - BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + BMC_QUERY_VERSION_COMMAND1 = ["ipmitool", "mc", "info"] + BMC_QUERY_VERSION_COMMAND2 = ["grep", 'Firmware Revision'] def __init__(self): super(ComponentBMC, self).__init__() @@ -105,7 +119,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + bmc_ver = self._get_command_result_pipe(self.BMC_QUERY_VERSION_COMMAND1, self.BMC_QUERY_VERSION_COMMAND2) if not bmc_ver: return 'ERR' else: @@ -158,9 +172,9 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x01") - res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) - self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x00") + self._get_command_result(["ipmitool", "raw", "0x30", "0xe0", "0xd0", "0x01", "0x01"]) + res = self._get_command_result(["ipmitool", "raw", "0x32", "0xff", "0x02", str(self.cplds[self.index].cmd_index)]) + self._get_command_result(["ipmitool", "raw", "0x30", "0xe0", "0xd0", "0x01", "0x00"]) if not res: return 'ERR' else: @@ -180,7 +194,8 @@ def get_component_list(cls): class ComponentPCIE(Component): COMPONENT_NAME = 'PCIe' COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' - PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + PCIE_QUERY_VERSION_COMMAND1 = ["bcmcmd", 'pciephy fw version'] + PCIE_QUERY_VERSION_COMMAND2 = ["grep", 'FW version'] def __init__(self): super(ComponentPCIE, self).__init__() @@ -195,7 +210,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + version = self._get_command_result_pipe(self.PCIE_QUERY_VERSION_COMMAND1, self.PCIE_QUERY_VERSION_COMMAND2) if not version: return 'ERR' else: diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py index 1faf552c7b5..942074bb726 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py @@ -8,17 +8,17 @@ # ############################################################################# -import os import time +import subprocess from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -163,7 +163,7 @@ class Sfp(SfpBase): # Path to QSFP sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-quanta_ix7_bwde-r0" HWSKU = "Quanta-IX7-BWDE-32X" @@ -259,7 +259,7 @@ def _convert_string_to_num(self, value_str): return 'N/A' def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/utils/quanta_ix7_bwde_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/utils/quanta_ix7_bwde_util.py index a20aa33828e..8a3c896de5c 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/utils/quanta_ix7_bwde_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/utils/quanta_ix7_bwde_util.py @@ -27,7 +27,6 @@ clean : uninstall drivers and remove related sysfs nodes """ -import os import subprocess import sys, getopt import logging @@ -54,7 +53,7 @@ def main(): 'debug', 'force', ]) - if DEBUG == True: + if DEBUG is True: print(options) print(args) print(len(sys.argv)) @@ -84,7 +83,7 @@ def show_help(): sys.exit(0) def show_log(txt): - if DEBUG == True: + if DEBUG is True: print("[IX7-BWDE-32X]"+txt) return @@ -203,7 +202,9 @@ def system_install(): #QSFP for 1~32 port for port_number in range(1, 33): bus_number = port_number + 12 - os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + file = "/sys/bus/i2c/devices/%d-0050/port_name" % bus_number + with open(file, 'w') as f: + f.write(str(port_number) + '\n') status, output = exec_cmd("pip3 install /usr/share/sonic/device/x86_64-quanta_ix7_bwde-r0/sonic_platform-1.0-py3-none-any.whl",1) if status: diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/component.py index 95f275014f5..03b2b1c1745 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/component.py @@ -14,6 +14,7 @@ import subprocess from sonic_platform_base.component_base import ComponentBase from collections import namedtuple + from sonic_py_common.general import getstatusoutput_noshell_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -47,7 +48,7 @@ def _get_command_result(cmdline): try: proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, - shell=True, stderr=subprocess.STDOUT, + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] rc = proc.wait() @@ -60,12 +61,24 @@ def _get_command_result(cmdline): return result + @staticmethod + def _get_command_result_pipe(cmd1, cmd2): + try: + rc, result = getstatusoutput_noshell_pipe(cmd1, cmd2) + if rc != [0, 0]: + raise RuntimeError("Failed to execute command {} {}, return code {}, {}".format(cmd1, cmd2, rc, result)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} {} due to {}".format(cmd1, cmd2, repr(e))) + + return result + class ComponentBIOS(Component): COMPONENT_NAME = 'BIOS' COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' - BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + BIOS_QUERY_VERSION_COMMAND = ["dmidecode", "-s", "bios-version"] def __init__(self): super(ComponentBIOS, self).__init__() @@ -90,7 +103,8 @@ def get_firmware_version(self): class ComponentBMC(Component): COMPONENT_NAME = 'BMC' COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' - BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + BMC_QUERY_VERSION_COMMAND1 = ["ipmitool", "mc", "info"] + BMC_QUERY_VERSION_COMMAND2 = ["grep", 'Firmware Revision'] def __init__(self): super(ComponentBMC, self).__init__() @@ -105,7 +119,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + bmc_ver = self._get_command_result_pipe(self.BMC_QUERY_VERSION_COMMAND1, self.BMC_QUERY_VERSION_COMMAND2) if not bmc_ver: return 'ERR' else: @@ -160,7 +174,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) + res = self._get_command_result(["ipmitool", "raw", "0x32", "0xff", "0x02", str(self.cplds[self.index].cmd_index)]) if not res: return 'ERR' else: @@ -180,7 +194,8 @@ def get_component_list(cls): class ComponentPCIE(Component): COMPONENT_NAME = 'PCIe' COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' - PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + PCIE_QUERY_VERSION_COMMAND1 = ["bcmcmd", 'pciephy fw version'] + PCIE_QUERY_VERSION_COMMAND2 = ["grep", 'FW version'] def __init__(self): super(ComponentPCIE, self).__init__() @@ -195,7 +210,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + version = self._get_command_result_pipe(self.PCIE_QUERY_VERSION_COMMAND1, self.PCIE_QUERY_VERSION_COMMAND2) if not version: return 'ERR' else: diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py index f7a9a105a5c..45b14d64273 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py @@ -8,17 +8,17 @@ # ############################################################################# -import os import time +import subprocess from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -163,7 +163,7 @@ class Sfp(SfpBase): # Path to QSFP sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-quanta_ix8_rglbmc-r0" HWSKU = "Quanta-IX8-56X" @@ -281,7 +281,7 @@ def _convert_string_to_num(self, value_str): return 'N/A' def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py index 833bfe27c42..7875eec59a0 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py @@ -27,7 +27,6 @@ clean : uninstall drivers and remove related sysfs nodes """ -import os import subprocess import sys, getopt import logging @@ -54,7 +53,7 @@ def main(): 'debug', 'force', ]) - if DEBUG == True: + if DEBUG is True: print(options) print(args) print(len(sys.argv)) @@ -84,7 +83,7 @@ def show_help(): sys.exit(0) def show_log(txt): - if DEBUG == True: + if DEBUG is True: print("[IX8-56X]" + txt) return @@ -301,7 +300,9 @@ def system_install(): #QSFP for 1~56 port for port_number in range(1, 57): bus_number = port_number + 16 - os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + file = "/sys/bus/i2c/devices/%d-0050/port_name" % bus_number + with open(file, 'w') as f: + f.write(str(port_number) + '\n') status, output = exec_cmd("pip3 install /usr/share/sonic/device/x86_64-quanta_ix8_rglbmc-r0/sonic_platform-1.0-py3-none-any.whl",1) if status: diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/component.py index f697f9bbe53..414512fbf1b 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/component.py @@ -14,6 +14,7 @@ import subprocess from sonic_platform_base.component_base import ComponentBase from collections import namedtuple + from sonic_py_common.general import getstatusoutput_noshell_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -47,7 +48,7 @@ def _get_command_result(cmdline): try: proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, - shell=True, stderr=subprocess.STDOUT, + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] rc = proc.wait() @@ -60,12 +61,24 @@ def _get_command_result(cmdline): return result + @staticmethod + def _get_command_result_pipe(cmd1, cmd2): + try: + rc, result = getstatusoutput_noshell_pipe(cmd1, cmd2) + if rc != [0, 0]: + raise RuntimeError("Failed to execute command {} {}, return code {}, {}".format(cmd1, cmd2, rc, result)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} {} due to {}".format(cmd1, cmd2, repr(e))) + + return result + class ComponentBIOS(Component): COMPONENT_NAME = 'BIOS' COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' - BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + BIOS_QUERY_VERSION_COMMAND = ["dmidecode", "-s", "bios-version"] def __init__(self): super(ComponentBIOS, self).__init__() @@ -90,7 +103,8 @@ def get_firmware_version(self): class ComponentBMC(Component): COMPONENT_NAME = 'BMC' COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' - BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + BMC_QUERY_VERSION_COMMAND1 = ["ipmitool", "mc", "info"] + BMC_QUERY_VERSION_COMMAND2 = ["grep", 'Firmware Revision'] def __init__(self): super(ComponentBMC, self).__init__() @@ -105,7 +119,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + bmc_ver = self._get_command_result_pipe(self.BMC_QUERY_VERSION_COMMAND1, self.BMC_QUERY_VERSION_COMMAND2) if not bmc_ver: return 'ERR' else: @@ -159,9 +173,9 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x01") - res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) - self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x00") + self._get_command_result(["ipmitool", "raw", "0x30", "0xe0", "0xd0", "0x01", "0x01"]) + res = self._get_command_result(["ipmitool", "raw", "0x32", "0xff", "0x02", str(self.cplds[self.index].cmd_index)]) + self._get_command_result(["ipmitool", "raw", "0x30", "0xe0", "0xd0", "0x01", "0x00"]) if not res: return 'ERR' else: @@ -181,7 +195,8 @@ def get_component_list(cls): class ComponentPCIE(Component): COMPONENT_NAME = 'PCIe' COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' - PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + PCIE_QUERY_VERSION_COMMAND1 = ["bcmcmd", 'pciephy fw version'] + PCIE_QUERY_VERSION_COMMAND2 = ["grep", 'FW version'] def __init__(self): super(ComponentPCIE, self).__init__() @@ -196,7 +211,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + version = self._get_command_result_pipe(self.PCIE_QUERY_VERSION_COMMAND1, self.PCIE_QUERY_VERSION_COMMAND2) if not version: return 'ERR' else: diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py index abbebb03434..7d76740ca76 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py @@ -8,17 +8,17 @@ # ############################################################################# -import os import time +import subprocess from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -163,7 +163,7 @@ class Sfp(SfpBase): # Path to QSFP sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = ["docker"] PLATFORM = "x86_64-quanta_ix8a_bwde-r0" HWSKU = "Quanta-IX8A-BWDE-56X" @@ -281,7 +281,7 @@ def _convert_string_to_num(self, value_str): return 'N/A' def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/utils/quanta_ix8a_bwde_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/utils/quanta_ix8a_bwde_util.py index c2382477937..ff6141a5114 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/utils/quanta_ix8a_bwde_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/utils/quanta_ix8a_bwde_util.py @@ -27,7 +27,6 @@ clean : uninstall drivers and remove related sysfs nodes """ -import os import subprocess import sys, getopt import logging @@ -54,7 +53,7 @@ def main(): 'debug', 'force', ]) - if DEBUG == True: + if DEBUG is True: print(options) print(args) print(len(sys.argv)) @@ -84,7 +83,7 @@ def show_help(): sys.exit(0) def show_log(txt): - if DEBUG == True: + if DEBUG is True: print("[IX8A-BWDE-56X]" + txt) return @@ -301,7 +300,9 @@ def system_install(): #QSFP for 1~56 port for port_number in range(1, 57): bus_number = port_number + 12 - os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + file = "/sys/bus/i2c/devices/%d-0050/port_name" % bus_number + with open(file, 'w') as f: + f.write(str(port_number) + '\n') #Enable front-ports LED decoding exec_cmd('echo 1 > /sys/class/cpld-led/CPLDLED-1/led_decode', 1) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/component.py index 75066275d2c..15076314b3f 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/component.py @@ -14,6 +14,7 @@ import subprocess from sonic_platform_base.component_base import ComponentBase from collections import namedtuple + from sonic_py_common.general import getstatusoutput_noshell_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -47,7 +48,7 @@ def _get_command_result(cmdline): try: proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, - shell=True, stderr=subprocess.STDOUT, + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] rc = proc.wait() @@ -60,12 +61,24 @@ def _get_command_result(cmdline): return result + @staticmethod + def _get_command_result_pipe(cmd1, cmd2): + try: + rc, result = getstatusoutput_noshell_pipe(cmd1, cmd2) + if rc != [0, 0]: + raise RuntimeError("Failed to execute command {} {}, return code {}, {}".format(cmd1, cmd2, rc, result)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} {} due to {}".format(cmd1, cmd2, repr(e))) + + return result + class ComponentBIOS(Component): COMPONENT_NAME = 'BIOS' COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' - BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + BIOS_QUERY_VERSION_COMMAND = ["dmidecode", "-s", "bios-version"] def __init__(self): super(ComponentBIOS, self).__init__() @@ -90,7 +103,8 @@ def get_firmware_version(self): class ComponentBMC(Component): COMPONENT_NAME = 'BMC' COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' - BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + BMC_QUERY_VERSION_COMMAND1 = ["ipmitool", "mc", "info"] + BMC_QUERY_VERSION_COMMAND2 = ["grep", 'Firmware Revision'] def __init__(self): super(ComponentBMC, self).__init__() @@ -105,7 +119,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + bmc_ver = self._get_command_result_pipe(self.BMC_QUERY_VERSION_COMMAND1, self.BMC_QUERY_VERSION_COMMAND2) if not bmc_ver: return 'ERR' else: @@ -158,10 +172,10 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component - """ - self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x01") - res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) - self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x00") + """ + self._get_command_result(["ipmitool", "raw", "0x30", "0xe0", "0xd0", "0x01", "0x01"]) + res = self._get_command_result(["ipmitool", "raw", "0x32", "0xff", "0x02", str(self.cplds[self.index].cmd_index)]) + self._get_command_result(["ipmitool", "raw", "0x30", "0xe0", "0xd0", "0x01", "0x00"]) if not res: return 'ERR' else: @@ -181,7 +195,8 @@ def get_component_list(cls): class ComponentPCIE(Component): COMPONENT_NAME = 'PCIe' COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' - PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + PCIE_QUERY_VERSION_COMMAND1 = ["bcmcmd", 'pciephy fw version'] + PCIE_QUERY_VERSION_COMMAND2 = ["grep", 'FW version'] def __init__(self): super(ComponentPCIE, self).__init__() @@ -196,7 +211,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + version = self._get_command_result_pipe(self.PCIE_QUERY_VERSION_COMMAND1, self.PCIE_QUERY_VERSION_COMMAND2) if not version: return 'ERR' else: diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py index 305d78aba4c..a9baef8eab3 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py @@ -8,17 +8,17 @@ # ############################################################################# -import os +import subprocess import time from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -281,7 +281,7 @@ def _convert_string_to_num(self, value_str): return 'N/A' def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/utils/quanta_ix8c_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/utils/quanta_ix8c_util.py index a7e50d908fe..ffa80e613a6 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/utils/quanta_ix8c_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/utils/quanta_ix8c_util.py @@ -27,7 +27,6 @@ clean : uninstall drivers and remove related sysfs nodes """ -import os import subprocess import sys, getopt import logging @@ -54,7 +53,7 @@ def main(): 'debug', 'force', ]) - if DEBUG == True: + if DEBUG is True: print(options) print(args) print(len(sys.argv)) @@ -84,7 +83,7 @@ def show_help(): sys.exit(0) def show_log(txt): - if DEBUG == True: + if DEBUG is True: print("[IX8C-56X]" + txt) return @@ -297,7 +296,9 @@ def system_install(): #QSFP for 1~56 port for port_number in range(1, 57): bus_number = port_number + 12 - os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + file = "/sys/bus/i2c/devices/%d-0050/port_name" % bus_number + with open(file, 'w') as f: + f.write(str(port_number) + '\n') return diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/component.py index 49d25f31cbc..c1b94b62d31 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/component.py @@ -14,6 +14,7 @@ import subprocess from sonic_platform_base.component_base import ComponentBase from collections import namedtuple + from sonic_py_common.general import getstatusoutput_noshell_pipe except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -47,7 +48,7 @@ def _get_command_result(cmdline): try: proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, - shell=True, stderr=subprocess.STDOUT, + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] rc = proc.wait() @@ -60,12 +61,24 @@ def _get_command_result(cmdline): return result + @staticmethod + def _get_command_result_pipe(cmd1, cmd2): + try: + rc, result = getstatusoutput_noshell_pipe(cmd1, cmd2) + if rc != [0, 0]: + raise RuntimeError("Failed to execute command {} {}, return code {}, {}".format(cmd1, cmd2, rc, result)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} {} due to {}".format(cmd1, cmd2, repr(e))) + + return result + class ComponentBIOS(Component): COMPONENT_NAME = 'BIOS' COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' - BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + BIOS_QUERY_VERSION_COMMAND = ["dmidecode", "-s", "bios-version"] def __init__(self): super(ComponentBIOS, self).__init__() @@ -90,7 +103,8 @@ def get_firmware_version(self): class ComponentBMC(Component): COMPONENT_NAME = 'BMC' COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' - BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + BMC_QUERY_VERSION_COMMAND1 = ["ipmitool", "mc", "info"] + BMC_QUERY_VERSION_COMMAND2 = ["grep", 'Firmware Revision'] def __init__(self): super(ComponentBMC, self).__init__() @@ -105,7 +119,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + bmc_ver = self._get_command_result_pipe(self.BMC_QUERY_VERSION_COMMAND1, self.BMC_QUERY_VERSION_COMMAND2) if not bmc_ver: return 'ERR' else: @@ -158,9 +172,9 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x01") - res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) - self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x00") + self._get_command_result(["ipmitool", "raw", "0x30", "0xe0", "0xd0", "0x01", "0x01"]) + res = self._get_command_result(["ipmitool", "raw", "0x32", "0xff", "0x02", str(self.cplds[self.index].cmd_index)]) + self._get_command_result(["ipmitool", "raw", "0x30", "0xe0", "0xd0", "0x01", "0x00"]) if not res: return 'ERR' else: @@ -180,7 +194,8 @@ def get_component_list(cls): class ComponentPCIE(Component): COMPONENT_NAME = 'PCIe' COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' - PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + PCIE_QUERY_VERSION_COMMAND1 = ["bcmcmd", 'pciephy fw version'] + PCIE_QUERY_VERSION_COMMAND2 = ["grep", 'FW version'] def __init__(self): super(ComponentPCIE, self).__init__() @@ -195,7 +210,7 @@ def get_firmware_version(self): Returns: A string containing the firmware version of the component """ - version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + version = self._get_command_result_pipe(self.PCIE_QUERY_VERSION_COMMAND1, self.PCIE_QUERY_VERSION_COMMAND2) if not version: return 'ERR' else: diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py index 77176ad083f..30997115cb2 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py @@ -8,21 +8,21 @@ # ############################################################################# -import os import time +import subprocess from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.inf8628 import inf8628InterfaceId - from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_InterfaceId - from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_Dom - from sonic_py_common.logger import Logger - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.inf8628 import inf8628InterfaceId + from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_InterfaceId + from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_Dom + from sonic_py_common.logger import Logger + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -354,7 +354,7 @@ def _convert_string_to_num(self, value_str): return 'N/A' def __is_host(self): - return os.system(self.HOST_CHK_CMD) == 0 + return subprocess.call(self.HOST_CHK_CMD) == 0 def __get_path_to_port_config_file(self): platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/utils/quanta_ix9_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/utils/quanta_ix9_util.py index ec14e10ad6d..fa6466da3d3 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/utils/quanta_ix9_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/utils/quanta_ix9_util.py @@ -27,7 +27,6 @@ clean : uninstall drivers and remove related sysfs nodes """ -import os import subprocess import sys, getopt import logging @@ -54,7 +53,7 @@ def main(): 'debug', 'force', ]) - if DEBUG == True: + if DEBUG is True: print(options) print(args) print(len(sys.argv)) @@ -84,7 +83,7 @@ def show_help(): sys.exit(0) def show_log(txt): - if DEBUG == True: + if DEBUG is True: print("[IX9-32X]" + txt) return @@ -237,7 +236,9 @@ def system_install(): #QSFPDD for 1~32 port for port_number in range(1, 33): bus_number = port_number + 12 - os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + file = "/sys/bus/i2c/devices/%d-0050/port_name" % bus_number + with open(file, 'w') as f: + f.write(str(port_number) + '\n') return diff --git a/platform/components/docker-gbsyncd-broncos/Dockerfile.j2 b/platform/components/docker-gbsyncd-broncos/Dockerfile.j2 index 154c7735ce9..ca7670acb62 100644 --- a/platform/components/docker-gbsyncd-broncos/Dockerfile.j2 +++ b/platform/components/docker-gbsyncd-broncos/Dockerfile.j2 @@ -27,11 +27,14 @@ debs/{{ deb }}{{' '}} COPY ["docker-init.sh", "/usr/bin/"] COPY ["start.sh", "/usr/bin/"] +COPY ["bcmsh", "/usr/bin/"] COPY ["critical_processes.j2", "/usr/share/sonic/templates"] COPY ["supervisord.conf.j2", "/usr/share/sonic/templates"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] +COPY ["files/dsserve", "/usr/bin/"] +RUN chmod +x /usr/bin/dsserve ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/platform/components/docker-gbsyncd-broncos/bcmsh b/platform/components/docker-gbsyncd-broncos/bcmsh new file mode 100755 index 00000000000..bad7a105195 --- /dev/null +++ b/platform/components/docker-gbsyncd-broncos/bcmsh @@ -0,0 +1,40 @@ +#!/bin/bash +usage="$(basename "$0") [-h] [-q] [-t timeout] -- interactive shell for bcm service + +where: + -h show this help text + -t inactivity timeout in seconds (default 300 seconds, 0 for no timeout) + -q quite, no banner (default: verbose)" + +banner="Press Enter to show prompt. +Press Ctrl+C to exit. +NOTICE: Only one bcmsh or bcmcmd can connect to the shell at same time. +" + +# Default verbose +quiet=false +timeout=300 + +while getopts 'hqt:' option; do + case "$option" in + h) echo "$usage" + exit + ;; + q) quiet=true + ;; + t) timeout=$OPTARG + ;; + \?) printf "illegal option: -%s\n" "$OPTARG" >&2 + echo "$usage" >&2 + exit 1 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$quiet" = false ]; then + echo "$banner" +fi + +/usr/bin/socat -T$timeout readline UNIX-CONNECT:/var/run/sswsyncd/sswgbsyncd.socket + diff --git a/platform/components/docker-gbsyncd-broncos/critical_processes.j2 b/platform/components/docker-gbsyncd-broncos/critical_processes.j2 index bdd6903c569..d1163a9c304 100644 --- a/platform/components/docker-gbsyncd-broncos/critical_processes.j2 +++ b/platform/components/docker-gbsyncd-broncos/critical_processes.j2 @@ -1 +1,2 @@ +program:dsserve program:syncd diff --git a/platform/components/docker-gbsyncd-broncos/supervisord.conf.j2 b/platform/components/docker-gbsyncd-broncos/supervisord.conf.j2 index c274315ef67..2ac52c22c28 100644 --- a/platform/components/docker-gbsyncd-broncos/supervisord.conf.j2 +++ b/platform/components/docker-gbsyncd-broncos/supervisord.conf.j2 @@ -33,7 +33,7 @@ dependent_startup_wait_for=rsyslogd:running [program:syncd] environment=BRONCOS_DEVICE_PATH=/usr/lib -command=/usr/bin/syncd -s -p /etc/sai.d/psai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1 +command=/usr/bin/dsserve -f /var/run/sswsyncd/sswgbsyncd.socket /usr/bin/syncd --diag -s -p /etc/sai.d/psai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1 priority=3 autostart=false autorestart=false diff --git a/platform/marvell-armhf/platform.conf b/platform/marvell-armhf/platform.conf index bab1b62f745..cd74f5cbec7 100644 --- a/platform/marvell-armhf/platform.conf +++ b/platform/marvell-armhf/platform.conf @@ -165,11 +165,11 @@ prepare_boot_menu() { fw_setenv ${FW_ARG} mtdparts 'mtdparts=spi0.0:4m(boot),-(spi-rootfs)' > /dev/null fi fw_setenv ${FW_ARG} ubi_sonic_boot_mount_ubi 'ubi part SONIC; ubifsmount ubi0' > /dev/null - fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs $BOOTARGS > /dev/null - fw_setenv ${FW_ARG} ubi_sonic_boot_load $UBI_LOAD > /dev/null + fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs "$BOOTARGS" > /dev/null + fw_setenv ${FW_ARG} ubi_sonic_boot_load "$UBI_LOAD" > /dev/null fw_setenv ${FW_ARG} sonic_image_1 "$UBIBOOTCMD" > /dev/null - fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs_old $BOOTARGS_OLD > /dev/null - fw_setenv ${FW_ARG} ubi_sonic_boot_load_old $UBI_LOAD_OLD > /dev/null + fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs_old "$BOOTARGS_OLD" > /dev/null + fw_setenv ${FW_ARG} ubi_sonic_boot_load_old "$UBI_LOAD_OLD" > /dev/null fw_setenv ${FW_ARG} sonic_image_2 "$UBIBOOTCMD_OLD" > /dev/null fw_setenv ${FW_ARG} boot_next 'run sonic_image_1'> /dev/null fw_setenv ${FW_ARG} bootcmd 'run print_menu; usb start; test -n "$boot_once" && run boot_once; run boot_next' > /dev/null diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 962ea0ae31e..ebfec14fb6e 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -27,17 +27,17 @@ else FW_FROM_URL = n endif -MLNX_SPC_FW_VERSION = 13.2010.2320 +MLNX_SPC_FW_VERSION = 13.2010.3186 MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa $(MLNX_SPC_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) -MLNX_SPC2_FW_VERSION = 29.2010.2320 +MLNX_SPC2_FW_VERSION = 29.2010.3186 MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa $(MLNX_SPC2_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) -MLNX_SPC3_FW_VERSION = 30.2010.2320 +MLNX_SPC3_FW_VERSION = 30.2010.3186 MLNX_SPC3_FW_FILE = fw-SPC3-rel-$(subst .,_,$(MLNX_SPC3_FW_VERSION))-EVB.mfa $(MLNX_SPC3_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC3_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC3_FW_FILE) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index eb702a85a1d..047e87b0908 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -16,8 +16,8 @@ # # Mellanox SAI -MFT_VERSION = 4.20.0 -MFT_REVISION = 34 +MFT_VERSION = 4.21.0 +MFT_REVISION = 100 export MFT_VERSION MFT_REVISION diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py index 6f482f49719..4befc799842 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py @@ -30,6 +30,7 @@ import tempfile import subprocess from sonic_py_common import device_info + from sonic_py_common.general import check_output_pipe if sys.version_info[0] > 2: import configparser else: @@ -52,8 +53,8 @@ class MPFAManager(object): MPFA_EXTENSION = '.mpfa' - MPFA_EXTRACT_COMMAND = 'tar xzf {} -C {}' - MPFA_CLEANUP_COMMAND = 'rm -rf {}' + MPFA_EXTRACT_COMMAND = ['tar', 'xzf', '', '-C', ''] + MPFA_CLEANUP_COMMAND = ['rm', '-rf', ''] def __init__(self, mpfa_path): self.__mpfa_path = mpfa_path @@ -78,8 +79,9 @@ def __validate_path(self, mpfa_path): def __extract_contents(self, mpfa_path): contents_path = tempfile.mkdtemp(prefix='mpfa-') - cmd = self.MPFA_EXTRACT_COMMAND.format(mpfa_path, contents_path) - subprocess.check_call(cmd.split(), universal_newlines=True) + self.MPFA_EXTRACT_COMMAND[2] = mpfa_path + self.MPFA_EXTRACT_COMMAND[4] = contents_path + subprocess.check_call(self.MPFA_EXTRACT_COMMAND, universal_newlines=True) self.__contents_path = contents_path @@ -105,8 +107,8 @@ def extract(self): def cleanup(self): if os.path.exists(self.__contents_path): - cmd = self.MPFA_CLEANUP_COMMAND.format(self.__contents_path) - subprocess.check_call(cmd.split(), universal_newlines=True) + self.MPFA_CLEANUP_COMMAND[2] = self.__contents_path + subprocess.check_call(self.MPFA_CLEANUP_COMMAND, universal_newlines=True) self.__contents_path = None self.__metadata = None @@ -122,11 +124,11 @@ def is_extracted(self): class ONIEUpdater(object): - ONIE_FW_UPDATE_CMD_ADD = '/usr/bin/mlnx-onie-fw-update.sh add {}' - ONIE_FW_UPDATE_CMD_REMOVE = '/usr/bin/mlnx-onie-fw-update.sh remove {}' - ONIE_FW_UPDATE_CMD_UPDATE = '/usr/bin/mlnx-onie-fw-update.sh update' - ONIE_FW_UPDATE_CMD_INSTALL = '/usr/bin/mlnx-onie-fw-update.sh update --no-reboot' - ONIE_FW_UPDATE_CMD_SHOW_PENDING = '/usr/bin/mlnx-onie-fw-update.sh show-pending' + ONIE_FW_UPDATE_CMD_ADD = ['/usr/bin/mlnx-onie-fw-update.sh', 'add', ''] + ONIE_FW_UPDATE_CMD_REMOVE = ['/usr/bin/mlnx-onie-fw-update.sh', 'remove', ''] + ONIE_FW_UPDATE_CMD_UPDATE = ['/usr/bin/mlnx-onie-fw-update.sh', 'update'] + ONIE_FW_UPDATE_CMD_INSTALL = ['/usr/bin/mlnx-onie-fw-update.sh', 'update', '--no-reboot'] + ONIE_FW_UPDATE_CMD_SHOW_PENDING = ['/usr/bin/mlnx-onie-fw-update.sh', 'show-pending'] ONIE_VERSION_PARSE_PATTERN = '([0-9]{4})\.([0-9]{2})-([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)' ONIE_VERSION_BASE_PARSE_PATTERN = '([0-9]+)\.([0-9]+)\.([0-9]+)' @@ -135,7 +137,7 @@ class ONIEUpdater(object): ONIE_VERSION_ATTR = 'onie_version' ONIE_NO_PENDING_UPDATES_ATTR = 'No pending firmware updates present' - ONIE_IMAGE_INFO_COMMAND = '/bin/bash {} -q -i' + ONIE_IMAGE_INFO_COMMAND = ['/bin/bash', '', '-q', '-i'] # Upgrading fireware from ONIE is not supported from the beginning on some platforms, like SN2700. # There is a logic to check the ONIE version in order to know whether it is supported. @@ -167,14 +169,14 @@ def __mount_onie_fs(self): self.__umount_onie_fs() cmd = "fdisk -l | grep 'ONIE boot' | awk '{print $1}'" - fs_path = subprocess.check_output(cmd, - stderr=subprocess.STDOUT, - shell=True, - universal_newlines=True).rstrip('\n') + cmd1 = ['fdisk', '-l'] + cmd2 = ['grep', 'ONIE boot'] + cmd3 = ['awk', '{print $1}'] + fs_path = check_output_pipe(cmd1, cmd2, cmd3).rstrip('\n') os.mkdir(fs_mountpoint) - cmd = "mount -n -r -t ext4 {} {}".format(fs_path, fs_mountpoint) - subprocess.check_call(cmd, shell=True, universal_newlines=True) + cmd = ["mount", "-n", "-r", "-t", "ext4", fs_path, fs_mountpoint] + subprocess.check_call(cmd, universal_newlines=True) fs_onie_path = os.path.join(fs_mountpoint, 'onie/tools/lib/onie') os.symlink(fs_onie_path, onie_path) @@ -189,8 +191,8 @@ def __umount_onie_fs(self): os.unlink(onie_path) if os.path.ismount(fs_mountpoint): - cmd = "umount -rf {}".format(fs_mountpoint) - subprocess.check_call(cmd, shell=True, universal_newlines=True) + cmd = ["umount", "-rf", fs_mountpoint] + subprocess.check_call(cmd, universal_newlines=True) if os.path.exists(fs_mountpoint): os.rmdir(fs_mountpoint) @@ -198,20 +200,20 @@ def __umount_onie_fs(self): def __stage_update(self, image_path): rename_path = self.__add_prefix(image_path) - cmd = self.ONIE_FW_UPDATE_CMD_ADD.format(rename_path) + self.ONIE_FW_UPDATE_CMD_ADD[2] = rename_path try: - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(self.ONIE_FW_UPDATE_CMD_ADD, universal_newlines=True) except subprocess.CalledProcessError as e: raise RuntimeError("Failed to stage firmware update: {}".format(str(e))) def __unstage_update(self, image_path): rename_path = self.__add_prefix(image_path) - cmd = self.ONIE_FW_UPDATE_CMD_REMOVE.format(os.path.basename(rename_path)) + self.ONIE_FW_UPDATE_CMD_REMOVE[2] = os.path.basename(rename_path) try: - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(self.ONIE_FW_UPDATE_CMD_REMOVE, universal_newlines=True) except subprocess.CalledProcessError as e: raise RuntimeError("Failed to unstage firmware update: {}".format(str(e))) @@ -222,7 +224,7 @@ def __trigger_update(self, allow_reboot): cmd = self.ONIE_FW_UPDATE_CMD_INSTALL try: - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(cmd, universal_newlines=True) except subprocess.CalledProcessError as e: raise RuntimeError("Failed to trigger firmware update: {}".format(str(e))) @@ -230,7 +232,7 @@ def __is_update_staged(self, image_path): cmd = self.ONIE_FW_UPDATE_CMD_SHOW_PENDING try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -315,10 +317,10 @@ def get_onie_firmware_info(self, image_path): try: self.__mount_onie_fs() - cmd = self.ONIE_IMAGE_INFO_COMMAND.format(image_path) + self.ONIE_IMAGE_INFO_COMMAND[1] = image_path try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.ONIE_IMAGE_INFO_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -413,25 +415,6 @@ def _read_generic_file(filename, len, ignore_errors=False): return result - @staticmethod - def _get_command_result(cmdline): - try: - proc = subprocess.Popen(cmdline, - stdout=subprocess.PIPE, - shell=True, - stderr=subprocess.STDOUT, - universal_newlines=True) - stdout = proc.communicate()[0] - rc = proc.wait() - result = stdout.rstrip('\n') - if rc != 0: - raise RuntimeError("Failed to execute command {}, return code {}, message {}".format(cmdline, rc, stdout)) - - except OSError as e: - raise RuntimeError("Failed to execute command {} due to {}".format(cmdline, repr(e))) - - return result - def _check_file_validity(self, image_path): if not os.path.isfile(image_path): print("ERROR: File {} doesn't exist or is not a file".format(image_path)) @@ -502,10 +485,10 @@ class ComponentSSD(Component): POWER_CYCLE_REQUIRED_ATTR = 'Power Cycle Required' UPGRADE_REQUIRED_ATTR = 'Upgrade Required' - SSD_INFO_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -q" - SSD_FIRMWARE_INFO_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -q -i {}" - SSD_FIRMWARE_INSTALL_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh --no-power-cycle -y -u -i {}" - SSD_FIRMWARE_UPDATE_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -y -u -i {}" + SSD_INFO_COMMAND = ["/usr/bin/mlnx-ssd-fw-update.sh", "-q"] + SSD_FIRMWARE_INFO_COMMAND = ["/usr/bin/mlnx-ssd-fw-update.sh", "-q", "-i", ""] + SSD_FIRMWARE_INSTALL_COMMAND = ["/usr/bin/mlnx-ssd-fw-update.sh", "--no-power-cycle", "-y", "-u", "-i", ""] + SSD_FIRMWARE_UPDATE_COMMAND = ["/usr/bin/mlnx-ssd-fw-update.sh", "-y", "-u", "-i", ""] def __init__(self): super(ComponentSSD, self).__init__() @@ -519,13 +502,15 @@ def __install_firmware(self, image_path, allow_reboot=True): return False if allow_reboot: - cmd = self.SSD_FIRMWARE_UPDATE_COMMAND.format(image_path) + self.SSD_FIRMWARE_UPDATE_COMMAND[4] = image_path + cmd = self.SSD_FIRMWARE_UPDATE_COMMAND else: - cmd = self.SSD_FIRMWARE_INSTALL_COMMAND.format(image_path) + self.SSD_FIRMWARE_INSTALL_COMMAND[5] = image_path + cmd = self.SSD_FIRMWARE_INSTALL_COMMAND try: print("INFO: Installing {} firmware update".format(self.name)) - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(cmd, universal_newlines=True) except subprocess.CalledProcessError as e: print("ERROR: Failed to update {} firmware: {}".format(self.name, str(e))) return False @@ -563,10 +548,8 @@ def auto_update_firmware(self, image_path, boot_action): return FW_AUTO_SCHEDULED def get_firmware_version(self): - cmd = self.SSD_INFO_COMMAND - try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.SSD_INFO_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -579,10 +562,10 @@ def get_firmware_version(self): raise RuntimeError("Failed to parse {} version".format(self.name)) def get_available_firmware_version(self, image_path): - cmd = self.SSD_FIRMWARE_INFO_COMMAND.format(image_path) + self.SSD_FIRMWARE_INFO_COMMAND[3] = image_path try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.SSD_FIRMWARE_INFO_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -614,10 +597,10 @@ def get_available_firmware_version(self, image_path): return available_firmware_version def get_firmware_update_notification(self, image_path): - cmd = self.SSD_FIRMWARE_INFO_COMMAND.format(image_path) + self.SSD_FIRMWARE_INFO_COMMAND[3] = image_path try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.SSD_FIRMWARE_INFO_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -660,7 +643,7 @@ class ComponentBIOS(Component): COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' COMPONENT_FIRMWARE_EXTENSION = '.rom' - BIOS_VERSION_COMMAND = 'dmidecode --oem-string 1' + BIOS_VERSION_COMMAND = ['dmidecode', '--oem-string', '1'] def __init__(self): super(ComponentBIOS, self).__init__() @@ -688,10 +671,8 @@ def __install_firmware(self, image_path, allow_reboot=True): return True def get_firmware_version(self): - cmd = self.BIOS_VERSION_COMMAND - try: - version = subprocess.check_output(cmd.split(), + version = subprocess.check_output(self.BIOS_VERSION_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -716,7 +697,7 @@ class ComponentBIOSSN2201(Component): COMPONENT_NAME = 'BIOS' COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' - BIOS_VERSION_COMMAND = 'dmidecode -t0' + BIOS_VERSION_COMMAND = ['dmidecode', '-t0'] def __init__(self): super(ComponentBIOSSN2201, self).__init__() @@ -725,10 +706,8 @@ def __init__(self): self.description = self.COMPONENT_DESCRIPTION def get_firmware_version(self): - cmd = self.BIOS_VERSION_COMMAND - try: - output = subprocess.check_output(cmd.split(), + output = subprocess.check_output(self.BIOS_VERSION_COMMAND, stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: @@ -764,7 +743,7 @@ class ComponentCPLD(Component): CPLD_PART_NUMBER_DEFAULT = '0' CPLD_VERSION_MINOR_DEFAULT = '0' - CPLD_FIRMWARE_UPDATE_COMMAND = 'cpldupdate --dev {} --print-progress {}' + CPLD_FIRMWARE_UPDATE_COMMAND = ['cpldupdate', '--dev', '', '--print-progress', ''] def __init__(self, idx): super(ComponentCPLD, self).__init__() @@ -796,12 +775,13 @@ def _install_firmware(self, image_path): mst_dev = self.__get_mst_device() if mst_dev is None: return False - - cmd = self.CPLD_FIRMWARE_UPDATE_COMMAND.format(mst_dev, image_path) + self.CPLD_FIRMWARE_UPDATE_COMMAND[2] = mst_dev + self.CPLD_FIRMWARE_UPDATE_COMMAND[4] = image_path + cmd = self.CPLD_FIRMWARE_UPDATE_COMMAND try: print("INFO: Installing {} firmware update: path={}".format(self.name, image_path)) - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(cmd, universal_newlines=True) except subprocess.CalledProcessError as e: print("ERROR: Failed to update {} firmware: {}".format(self.name, str(e))) return False @@ -910,14 +890,14 @@ def get_component_list(cls): class ComponentCPLDSN2201(ComponentCPLD): - CPLD_FIRMWARE_UPDATE_COMMAND = 'cpldupdate --gpio {} --uncustomized --print-progress' + CPLD_FIRMWARE_UPDATE_COMMAND = ['cpldupdate', '--gpio', '', '--uncustomized', '--print-progress'] def _install_firmware(self, image_path): - cmd = self.CPLD_FIRMWARE_UPDATE_COMMAND.format(image_path) + self.CPLD_FIRMWARE_UPDATE_COMMAND[2] = image_path try: print("INFO: Installing {} firmware update: path={}".format(self.name, image_path)) - subprocess.check_call(cmd.split(), universal_newlines=True) + subprocess.check_call(self.CPLD_FIRMWARE_UPDATE_COMMAND, universal_newlines=True) except subprocess.CalledProcessError as e: print("ERROR: Failed to update {} firmware: {}".format(self.name, str(e))) return False diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py index 94ed64d7d38..522287cdb53 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py @@ -156,6 +156,10 @@ }, 'x86_64-nvidia_sn2201-r0': { 'thermal': { + 'minimum_table': { + "unk_trust": {"-127:30": 13, "31:35": 14, "36:40": 15, "41:120": 16}, + "unk_untrust": {"-127:15": 13, "16:20": 14, "21:25": 15, "26:30": 16, "31:35": 17, "36:40": 18, "41:120": 19}, + }, "capability": { "comex_amb": False, "cpu_amb": True diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py index 8c40e2b6180..ec205fe6043 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py @@ -218,8 +218,8 @@ def set_speed(self, speed): addr = utils.read_str_from_file(self.psu_i2c_addr_path, raise_exception=True) command = utils.read_str_from_file(self.psu_i2c_command_path, raise_exception=True) speed = self.PSU_FAN_SPEED[int(speed // 10)] - command = "i2cset -f -y {0} {1} {2} {3} wp".format(bus, addr, command, speed) - subprocess.check_call(command, shell = True, universal_newlines=True) + command = ["i2cset", "-f", "-y", bus, addr, command, speed, "wp"] + subprocess.check_call(command, universal_newlines=True) return True except subprocess.CalledProcessError as ce: logger.log_error('Failed to call command {}, return code={}, command output={}'.format(ce.cmd, ce.returncode, ce.output)) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 05f38f62a0f..e447bbb4356 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -551,7 +551,7 @@ def run(cls, psu, threshold_value, threshold_file): return threshold_value # Run a sensors -s command to triger hardware to get the real threashold value - utils.run_command('sensors -s') + utils.run_command(['sensors', '-s']) # Wait for the threshold value change return cls.wait_set_done(threshold_file) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index 617b4f33d63..2ca37fcefdf 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -23,10 +23,11 @@ ############################################################################# try: + import ctypes import subprocess import os - from sonic_platform_base.sonic_eeprom import eeprom_dts from sonic_py_common.logger import Logger + from sonic_py_common.general import check_output_pipe from . import utils from .device_data import DeviceDataManager from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase @@ -126,11 +127,42 @@ SFP_STATUS_INSERTED = '1' # SFP constants -SFP_PAGE_SIZE = 256 -SFP_UPPER_PAGE_OFFSET = 128 -SFP_VENDOR_PAGE_START = 640 - -BYTES_IN_DWORD = 4 +SFP_PAGE_SIZE = 256 # page size of page0h +SFP_UPPER_PAGE_OFFSET = 128 # page size of other pages + +# SFP sysfs path constants +SFP_PAGE0_PATH = '0/i2c-0x50/data' +SFP_A2H_PAGE0_PATH = '0/i2c-0x51/data' +SFP_EEPROM_ROOT_TEMPLATE = '/sys/module/sx_core/asic0/module{}/eeprom/pages' + +# SFP type constants +SFP_TYPE_CMIS = 'cmis' +SFP_TYPE_SFF8472 = 'sff8472' +SFP_TYPE_SFF8636 = 'sff8636' + +# SFP stderr +SFP_EEPROM_NOT_AVAILABLE = 'Input/output error' + +# SFP EEPROM limited bytes +limited_eeprom = { + SFP_TYPE_CMIS: { + 'write': { + 0: [26, (31, 36), (126, 127)], + 16: [(0, 128)] + } + }, + SFP_TYPE_SFF8472: { + 'write': { + 0: [110, (114, 115), 118, 127] + } + }, + SFP_TYPE_SFF8636: { + 'write': { + 0: [(86, 88), 93, (98, 99), (100, 106), 127], + 3: [(230, 241), (242, 251)] + } + } +} # Global logger class instance logger = Logger() @@ -157,75 +189,6 @@ def deinitialize_sdk_handle(sdk_handle): logger.log_warning("Sdk handle is none") return False -class MlxregManager: - def __init__(self, mst_pci_device, slot_id, sdk_index): - self.mst_pci_device = mst_pci_device - self.slot_id = slot_id - self.sdk_index = sdk_index - - def construct_dword(self, write_buffer): - if len(write_buffer) == 0: - return None - - used_bytes_in_dword = len(write_buffer) % BYTES_IN_DWORD - - res = "dword[0]=0x" - for idx, x in enumerate(write_buffer): - word = hex(x)[2:] - - if (idx > 0) and (idx % BYTES_IN_DWORD) == 0: - res += ",dword[{}]=0x".format(str((idx + 1)//BYTES_IN_DWORD)) - res += word.zfill(2) - - if used_bytes_in_dword > 0: - res += (BYTES_IN_DWORD - used_bytes_in_dword) * "00" - return res - - def write_mlxreg_eeprom(self, num_bytes, dword, device_address, page): - if not dword: - return False - - try: - cmd = "mlxreg -d /dev/mst/{} --reg_name MCIA --indexes \ - slot_index={},module={},device_address={},page_number={},i2c_device_address=0x50,size={},bank_number=0 \ - --set {} -y".format(self.mst_pci_device, self.slot_id, self.sdk_index, device_address, page, num_bytes, dword) - subprocess.check_call(cmd, shell=True, universal_newlines=True, stdout=subprocess.DEVNULL) - except subprocess.CalledProcessError as e: - logger.log_error("Error! Unable to write data dword={} for {} port, page {} offset {}, rc = {}, err msg: {}".format(dword, self.sdk_index, page, device_address, e.returncode, e.output)) - return False - return True - - def read_mlxred_eeprom(self, offset, page, num_bytes): - try: - cmd = "mlxreg -d /dev/mst/{} --reg_name MCIA --indexes \ - slot_index={},module={},device_address={},page_number={},i2c_device_address=0x50,size={},bank_number=0 \ - --get".format(self.mst_pci_device, self.slot_id, self.sdk_index, offset, page, num_bytes) - result = subprocess.check_output(cmd, universal_newlines=True, shell=True) - except subprocess.CalledProcessError as e: - logger.log_error("Error! Unable to read data for {} port, page {} offset {}, rc = {}, err msg: {}".format(self.sdk_index, page, offset, e.returncode, e.output)) - return None - return result - - def parse_mlxreg_read_output(self, read_output, num_bytes): - if not read_output: - return None - - res = "" - dword_num = num_bytes // BYTES_IN_DWORD - used_bytes_in_dword = num_bytes % BYTES_IN_DWORD - arr = [value for value in read_output.split('\n') if value[0:5] == "dword"] - for i in range(dword_num): - dword = arr[i].split()[2] - res += dword[2:] - - if used_bytes_in_dword > 0: - # Cut needed info and insert into final hex string - # Example: 3 bytes : 0x12345600 - # ^ ^ - dword = arr[dword_num].split()[2] - res += dword[2 : 2 + used_bytes_in_dword * 2] - - return bytearray.fromhex(res) if res else None class SdkHandleContext(object): def __init__(self): @@ -310,12 +273,13 @@ def __init__(self, sfp_index, sfp_type=None, slot_id=0, linecard_port_count=0, l self.slot_id = slot_id self.mst_pci_device = self.get_mst_pci_device() + self._sfp_type_str = None # get MST PCI device name def get_mst_pci_device(self): device_name = None try: - device_name = subprocess.check_output("ls /dev/mst/ | grep pciconf", universal_newlines=True, shell=True).strip() + device_name = check_output_pipe(["ls", "/dev/mst/"], ["grep", "pciconf"]).strip() except subprocess.CalledProcessError as e: logger.log_error("Failed to find mst PCI device rc={} err.msg={}".format(e.returncode, e.output)) return device_name @@ -335,6 +299,7 @@ def reinit(self): Re-initialize this SFP object when a new SFP inserted :return: """ + self._sfp_type_str = None self.refresh_xcvr_api() def get_presence(self): @@ -344,34 +309,9 @@ def get_presence(self): Returns: bool: True if device is present, False if not """ - eeprom_raw = self.read_eeprom(0, 1) - + eeprom_raw = self._read_eeprom(0, 1, log_on_error=False) return eeprom_raw is not None - # Read out any bytes from any offset - def _read_eeprom_specific_bytes(self, offset, num_bytes): - if offset + num_bytes > SFP_VENDOR_PAGE_START: - logger.log_error("Error mismatch between page size and bytes to read (offset: {} num_bytes: {}) ".format(offset, num_bytes)) - return None - - eeprom_raw = [] - ethtool_cmd = "ethtool -m sfp{} hex on offset {} length {}".format(self.index, offset, num_bytes) - try: - output = subprocess.check_output(ethtool_cmd, - shell=True, - universal_newlines=True) - output_lines = output.splitlines() - first_line_raw = output_lines[0] - if "Offset" in first_line_raw: - for line in output_lines[2:]: - line_split = line.split() - eeprom_raw = eeprom_raw + line_split[1:] - except subprocess.CalledProcessError as e: - return None - - eeprom_raw = list(map(lambda h: int(h, base=16), eeprom_raw)) - return bytearray(eeprom_raw) - # read eeprom specfic bytes beginning from offset with size as num_bytes def read_eeprom(self, offset, num_bytes): """ @@ -379,43 +319,37 @@ def read_eeprom(self, offset, num_bytes): Returns: bytearray, if raw sequence of bytes are read correctly from the offset of size num_bytes None, if the read_eeprom fails - Example: - mlxreg -d /dev/mst/mt52100_pciconf0 --reg_name MCIA --indexes slot_index=0,module=1,device_address=148,page_number=0,i2c_device_address=0x50,size=16,bank_number=0 -g - Sending access register... - Field Name | Data - =================================== - status | 0x00000000 - slot_index | 0x00000000 - module | 0x00000001 - l | 0x00000000 - device_address | 0x00000094 - page_number | 0x00000000 - i2c_device_address | 0x00000050 - size | 0x00000010 - bank_number | 0x00000000 - dword[0] | 0x43726564 - dword[1] | 0x6f202020 - dword[2] | 0x20202020 - dword[3] | 0x20202020 - dword[4] | 0x00000000 - dword[5] | 0x00000000 - .... - 16 bytes to read from dword -> 0x437265646f2020202020202020202020 -> Credo """ - # recalculate offset and page. Use 'ethtool' if there is no need to read vendor pages - if offset < SFP_VENDOR_PAGE_START: - return self._read_eeprom_specific_bytes(offset, num_bytes) - else: - page = (offset - SFP_PAGE_SIZE) // SFP_UPPER_PAGE_OFFSET + 1 - # calculate offset per page - device_address = (offset - SFP_PAGE_SIZE) % SFP_UPPER_PAGE_OFFSET + SFP_UPPER_PAGE_OFFSET + return self._read_eeprom(offset, num_bytes) + + def _read_eeprom(self, offset, num_bytes, log_on_error=True): + """Read eeprom specfic bytes beginning from a random offset with size as num_bytes - if not self.mst_pci_device: + Args: + offset (int): read offset + num_bytes (int): read size + log_on_error (bool, optional): whether log error when exception occurs. Defaults to True. + + Returns: + bytearray: the content of EEPROM + """ + _, page, page_offset = self._get_page_and_page_offset(offset) + if not page: return None - mlxreg_mngr = MlxregManager(self.mst_pci_device, self.slot_id, self.sdk_index) - read_output = mlxreg_mngr.read_mlxred_eeprom(device_address, page, num_bytes) - return mlxreg_mngr.parse_mlxreg_read_output(read_output, num_bytes) + try: + with open(page, mode='rb', buffering=0) as f: + f.seek(page_offset) + content = f.read(num_bytes) + if ctypes.get_errno() != 0: + 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}, \ + size={num_bytes}, offset={offset}, error = {e}') + return None + + return bytearray(content) # write eeprom specfic bytes beginning from offset with size as num_bytes def write_eeprom(self, offset, num_bytes, write_buffer): @@ -431,21 +365,28 @@ def write_eeprom(self, offset, num_bytes, write_buffer): logger.log_error("Error mismatch between buffer length and number of bytes to be written") return False - # recalculate offset and page - if offset < SFP_PAGE_SIZE: - page = 0 - device_address = offset - else: - page = (offset - SFP_PAGE_SIZE) // SFP_UPPER_PAGE_OFFSET + 1 - # calculate offset per page - device_address = (offset - SFP_PAGE_SIZE) % SFP_UPPER_PAGE_OFFSET + SFP_UPPER_PAGE_OFFSET - - if not self.mst_pci_device: + page_num, page, page_offset = self._get_page_and_page_offset(offset) + if not page: return False - mlxreg_mngr = MlxregManager(self.mst_pci_device, self.slot_id, self.sdk_index) - dword = mlxreg_mngr.construct_dword(write_buffer) - return mlxreg_mngr.write_mlxreg_eeprom(num_bytes, dword, device_address, page) + try: + if self._is_write_protected(page_num, page_offset, num_bytes): + # write limited eeprom is not supported + raise IOError('write limited bytes') + + with open(page, mode='r+b', buffering=0) as f: + f.seek(page_offset) + ret = f.write(write_buffer[0:num_bytes]) + if ret != num_bytes: + raise IOError(f'write return code = {ret}') + if ctypes.get_errno() != 0: + raise IOError(f'errno = {os.strerror(ctypes.get_errno())}') + except (OSError, IOError) as e: + data = ''.join('{:02x}'.format(x) for x in write_buffer) + logger.log_error(f'Failed to write EEPROM data sfp={self.sdk_index} EEPROM page={page}, page_offset={page_offset}, size={num_bytes}, \ + offset={offset}, data = {data}, error = {e}') + return False + return True @classmethod def mgmt_phy_mod_pwr_attr_get(cls, power_attr_type, sdk_handle, sdk_index, slot_id): @@ -478,9 +419,9 @@ def get_lpmode(self): get_lpmode_code = 'from sonic_platform import sfp;\n' \ 'with sfp.SdkHandleContext() as sdk_handle:' \ 'print(sfp.SFP._get_lpmode(sdk_handle, {}, {}))'.format(self.sdk_index, self.slot_id) - lpm_cmd = "docker exec pmon python3 -c \"{}\"".format(get_lpmode_code) + lpm_cmd = ["docker", "exec", "pmon", "python3", "-c", get_lpmode_code] try: - output = subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(lpm_cmd, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: print("Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) @@ -519,10 +460,10 @@ def reset(self): 'with sfp.SdkHandleContext() as sdk_handle:' \ 'print(sfp.SFP._reset(sdk_handle, {}, {}))' \ .format(self.sdk_index, self.slot_id) - reset_cmd = "docker exec pmon python3 -c \"{}\"".format(reset_code) + reset_cmd = ["docker", "exec", "pmon", "python3", "-c", reset_code] try: - output = subprocess.check_output(reset_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(reset_cmd, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) @@ -677,11 +618,11 @@ def set_lpmode(self, lpmode): 'with sfp.SdkHandleContext() as sdk_handle:' \ 'print(sfp.SFP._set_lpmode({}, sdk_handle, {}, {}))' \ .format('True' if lpmode else 'False', self.sdk_index, self.slot_id) - lpm_cmd = "docker exec pmon python3 -c \"{}\"".format(set_lpmode_code) + lpm_cmd = ["docker", "exec", "pmon", "python3", "-c", set_lpmode_code] # Set LPM try: - output = subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(lpm_cmd, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) @@ -755,6 +696,141 @@ def get_error_description(self): error_description = "Unknow SFP module status ({})".format(oper_status) return error_description + def _get_eeprom_path(self): + return SFP_EEPROM_ROOT_TEMPLATE.format(self.sdk_index) + + def _get_page_and_page_offset(self, overall_offset): + """Get EEPROM page and page offset according to overall offset + + Args: + overall_offset (int): Overall read offset + + Returns: + tuple: (, , ) + """ + eeprom_path = self._get_eeprom_path() + if not os.path.exists(eeprom_path): + logger.log_error(f'EEPROM file path for sfp {self.sdk_index} does not exist') + return None, None, None + + if overall_offset < SFP_PAGE_SIZE: + return 0, os.path.join(eeprom_path, SFP_PAGE0_PATH), overall_offset + + if self._get_sfp_type_str(eeprom_path) == SFP_TYPE_SFF8472: + page1h_start = SFP_PAGE_SIZE * 2 + if overall_offset < page1h_start: + return -1, os.path.join(eeprom_path, SFP_A2H_PAGE0_PATH), overall_offset - SFP_PAGE_SIZE + else: + page1h_start = SFP_PAGE_SIZE + + page_num = (overall_offset - page1h_start) // SFP_UPPER_PAGE_OFFSET + 1 + page = f'{page_num}/data' + offset = (overall_offset - page1h_start) % SFP_UPPER_PAGE_OFFSET + return page_num, os.path.join(eeprom_path, page), offset + + def _get_sfp_type_str(self, eeprom_path): + """Get SFP type by reading first byte of EEPROM + + Args: + eeprom_path (str): EEPROM path + + Returns: + str: SFP type in string + """ + if self._sfp_type_str is None: + page = os.path.join(eeprom_path, SFP_PAGE0_PATH) + try: + with open(page, mode='rb', buffering=0) as f: + id_byte_raw = bytearray(f.read(1)) + id = id_byte_raw[0] + if id == 0x18 or id == 0x19 or id == 0x1e: + self._sfp_type_str = SFP_TYPE_CMIS + elif id == 0x11 or id == 0x0D: + # in sonic-platform-common, 0x0D is treated as sff8436, + # but it shared the same implementation on Nvidia platforms, + # so, we treat it as sff8636 here. + self._sfp_type_str = SFP_TYPE_SFF8636 + elif id == 0x03: + self._sfp_type_str = SFP_TYPE_SFF8472 + else: + logger.log_error(f'Unsupported sfp type {id}') + except (OSError, IOError) as e: + # SFP_EEPROM_NOT_AVAILABLE usually indicates SFP is not present, no need + # print such error information to log + if SFP_EEPROM_NOT_AVAILABLE not in str(e): + logger.log_error(f'Failed to get SFP type, index={self.sdk_index}, error={e}') + return None + return self._sfp_type_str + + def _is_write_protected(self, page, page_offset, num_bytes): + """Check if the EEPROM read/write operation hit limitation bytes + + Args: + page (str): EEPROM page path + page_offset (int): EEPROM page offset + num_bytes (int): read/write size + + Returns: + bool: True if the limited bytes is hit + """ + eeprom_path = self._get_eeprom_path() + limited_data = limited_eeprom.get(self._get_sfp_type_str(eeprom_path)) + if not limited_data: + return False + + access_type = 'write' + limited_data = limited_data.get(access_type) + if not limited_data: + return False + + limited_ranges = limited_data.get(page) + if not limited_ranges: + return False + + access_begin = page_offset + access_end = page_offset + num_bytes - 1 + for limited_range in limited_ranges: + if isinstance(limited_range, int): + if access_begin <= limited_range <= access_end: + return True + else: # tuple + if not (access_end < limited_range[0] or access_begin > limited_range[1]): + return True + + return False + + def get_rx_los(self): + """Accessing rx los is not supproted, return all False + + Returns: + list: [False] * channels + """ + api = self.get_xcvr_api() + return [False] * api.NUM_CHANNELS if api else None + + def get_tx_fault(self): + """Accessing tx fault is not supproted, return all False + + Returns: + list: [False] * channels + """ + api = self.get_xcvr_api() + return [False] * api.NUM_CHANNELS if api else None + + def get_xcvr_api(self): + """ + Retrieves the XcvrApi associated with this SFP + + Returns: + An object derived from XcvrApi that corresponds to the SFP + """ + if self._xcvr_api is None: + self.refresh_xcvr_api() + if self._xcvr_api is not None: + self._xcvr_api.get_rx_los = self.get_rx_los + self._xcvr_api.get_tx_fault = self.get_tx_fault + return self._xcvr_api + class RJ45Port(NvidiaSFPCommon): """class derived from SFP, representing RJ45 ports""" @@ -792,9 +868,9 @@ def get_presence(self): get_presence_code = 'from sonic_platform import sfp;\n' \ 'with sfp.SdkHandleContext() as sdk_handle:' \ 'print(sfp.RJ45Port._get_presence(sdk_handle, {}))'.format(self.sdk_index) - presence_cmd = "docker exec pmon python3 -c \"{}\"".format(get_presence_code) + presence_cmd = ["docker", "exec", "pmon", "python3", "-c", get_presence_code] try: - output = subprocess.check_output(presence_cmd, shell=True, universal_newlines=True) + output = subprocess.check_output(presence_cmd, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: print("Error! Unable to get presence for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py index 0db7e1e26e3..2bc312cd223 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py @@ -187,9 +187,8 @@ def is_host(): return True for host and False for docker """ try: - proc = subprocess.Popen("docker --version 2>/dev/null", + proc = subprocess.Popen(["docker", "--version"], stdout=subprocess.PIPE, - shell=True, stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] @@ -221,7 +220,7 @@ def run_command(command): :return: Output of the shell command. """ try: - process = subprocess.Popen(command, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return process.communicate()[0].strip() except Exception: return None diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py b/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py index e69de29bb2d..07ebf17a113 100644 --- a/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py +++ b/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py @@ -0,0 +1,16 @@ +# +# Copyright (c) 2017-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/cmis_page0 b/platform/mellanox/mlnx-platform-api/tests/input_platform/cmis_page0 new file mode 100644 index 00000000000..623dcfe5f3f Binary files /dev/null and b/platform/mellanox/mlnx-platform-api/tests/input_platform/cmis_page0 differ diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py b/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py index 20a09d1b54f..170b0246430 100644 --- a/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py +++ b/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py @@ -1,3 +1,20 @@ +# +# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + """ module holding the correct values for the sfp_test.py """ diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/sff8472_page0 b/platform/mellanox/mlnx-platform-api/tests/input_platform/sff8472_page0 new file mode 100644 index 00000000000..edda806c8ab Binary files /dev/null and b/platform/mellanox/mlnx-platform-api/tests/input_platform/sff8472_page0 differ diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/sff8636_page0 b/platform/mellanox/mlnx-platform-api/tests/input_platform/sff8636_page0 new file mode 100644 index 00000000000..98155c8dbf5 Binary files /dev/null and b/platform/mellanox/mlnx-platform-api/tests/input_platform/sff8636_page0 differ diff --git a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py index 8ae4ece8eec..2aa4f78855f 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py @@ -17,6 +17,7 @@ import os import sys +import subprocess from mock import MagicMock if sys.version_info.major == 3: @@ -172,7 +173,6 @@ def test_sfp(self): @mock.patch('sonic_platform.device_data.DeviceDataManager.get_sfp_count', MagicMock(return_value=3)) def test_change_event(self): from sonic_platform.sfp_event import sfp_event - from sonic_platform.sfp import SFP return_port_dict = {1: '1'} def mock_check_sfp_status(self, port_dict, error_dict, timeout): @@ -276,12 +276,12 @@ def test_revision_permission(self): #Override the dmi file sonic_platform.chassis.DMI_FILE = "/tmp/dmi_file" new_dmi_file = sonic_platform.chassis.DMI_FILE - os.system("touch " + new_dmi_file) - os.system("chmod -r " + new_dmi_file) + subprocess.call(["touch", new_dmi_file]) + subprocess.call(["chmod", "-r", new_dmi_file]) chassis = Chassis() rev = chassis.get_revision() sonic_platform.chassis.DMI_FILE = old_dmi_file - os.system("rm -f " + new_dmi_file) + subprocess.call(["rm", "-f", new_dmi_file]) assert rev == "N/A" def test_get_port_or_cage_type(self): diff --git a/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py b/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py index 5845a1b2cad..75d1cbe707f 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py @@ -143,7 +143,7 @@ def mock_read_str_from_file(file_path, default='', raise_exception=False): assert subprocess.check_call.call_count == 0 fan.get_presence = MagicMock(return_value=True) assert fan.set_speed(60) - subprocess.check_call.assert_called_with("i2cset -f -y {0} {1} {2} {3} wp".format('bus', 'addr', 'command', hex(60)), shell=True, universal_newlines=True) + subprocess.check_call.assert_called_with(["i2cset", "-f", "-y", "bus", "addr", "command", hex(60), "wp"], universal_newlines=True) subprocess.check_call = MagicMock(side_effect=subprocess.CalledProcessError('', '')) assert not fan.set_speed(60) subprocess.check_call = MagicMock() diff --git a/platform/mellanox/mlnx-platform-api/tests/test_psu.py b/platform/mellanox/mlnx-platform-api/tests/test_psu.py index 5deb72bfb0e..d92b8f716a6 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_psu.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_psu.py @@ -160,4 +160,4 @@ def get_entry_value(key): # Normal vpd_info[InvalidPsuVolWA.CAPACITY_FIELD] = InvalidPsuVolWA.EXPECT_CAPACITY assert InvalidPsuVolWA.run(psu, InvalidPsuVolWA.INVALID_VOLTAGE_VALUE, '') == 9999 - mock_run_command.assert_called_with('sensors -s') + mock_run_command.assert_called_with(['sensors', '-s']) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_sfp.py b/platform/mellanox/mlnx-platform-api/tests/test_sfp.py index f599e0241d2..2a79b39308b 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_sfp.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_sfp.py @@ -14,7 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import ctypes import os +import pytest +import shutil import sys if sys.version_info.major == 3: from unittest import mock @@ -27,8 +30,6 @@ from sonic_platform.sfp import SFP, SX_PORT_MODULE_STATUS_INITIALIZING, SX_PORT_MODULE_STATUS_PLUGGED, SX_PORT_MODULE_STATUS_UNPLUGGED, SX_PORT_MODULE_STATUS_PLUGGED_WITH_ERROR, SX_PORT_MODULE_STATUS_PLUGGED_DISABLED from sonic_platform.chassis import Chassis -from sonic_platform.sfp import MlxregManager -from tests.input_platform import output_sfp class TestSfp: @@ -86,31 +87,61 @@ def test_sfp_get_error_status(self, mock_get_error_code): assert description == expected_description - @mock.patch('sonic_platform.sfp.SFP.get_mst_pci_device', mock.MagicMock(return_value="pciconf")) - @mock.patch('sonic_platform.sfp.MlxregManager.write_mlxreg_eeprom', mock.MagicMock(return_value=True)) - def test_sfp_write_eeprom(self): - mlxreg_mngr = MlxregManager("", 0, 0) - write_buffer = bytearray([1,2,3,4]) - offset = 793 - + @mock.patch('sonic_platform.sfp.SFP._get_page_and_page_offset') + @mock.patch('sonic_platform.sfp.SFP._is_write_protected') + def test_sfp_write_eeprom(self, mock_limited_eeprom, mock_get_page): + sfp = SFP(0) + assert not sfp.write_eeprom(0, 1, bytearray()) + + mock_get_page.return_value = (None, None, None) + assert not sfp.write_eeprom(0, 1, bytearray([1])) + + mock_get_page.return_value = (0, '/tmp/mock_page', 0) + mock_limited_eeprom.return_value = True + assert not sfp.write_eeprom(0, 1, bytearray([1])) + + mock_limited_eeprom.return_value = False + mo = mock.mock_open() + print('after mock open') + with mock.patch('sonic_platform.sfp.open', mo): + handle = mo() + handle.write.return_value = 1 + assert sfp.write_eeprom(0, 1, bytearray([1])) + + handle.seek.assert_called_once_with(0) + handle.write.assert_called_once_with(bytearray([1])) + handle.write.return_value = -1 + assert not sfp.write_eeprom(0, 1, bytearray([1])) + + handle.write.return_value = 1 + ctypes.set_errno(1) + assert not sfp.write_eeprom(0, 1, bytearray([1])) + ctypes.set_errno(0) + + handle.write.side_effect = OSError('') + assert not sfp.write_eeprom(0, 1, bytearray([1])) + + @mock.patch('sonic_platform.sfp.SFP.get_mst_pci_device', mock.MagicMock(return_value = None)) + @mock.patch('sonic_platform.sfp.SFP._get_page_and_page_offset') + def test_sfp_read_eeprom(self, mock_get_page): sfp = SFP(0) - sfp.write_eeprom(offset, 4, write_buffer) - MlxregManager.write_mlxreg_eeprom.assert_called_with(4, output_sfp.write_eeprom_dword1, 153, 5) + mock_get_page.return_value = (None, None, None) + assert sfp.read_eeprom(0, 1) is None - offset = 641 - write_buffer = bytearray([1,2,3,4,5,6]) - sfp.write_eeprom(offset, 6, write_buffer) - MlxregManager.write_mlxreg_eeprom.assert_called_with(6, output_sfp.write_eeprom_dword2, 129, 4) + mock_get_page.return_value = (0, '/tmp/mock_page', 0) + mo = mock.mock_open() + with mock.patch('sonic_platform.sfp.open', mo): + handle = mo() + handle.read.return_value = b'\x00' + assert sfp.read_eeprom(0, 1) == bytearray([0]) + handle.seek.assert_called_once_with(0) - @mock.patch('sonic_platform.sfp.SFP.get_mst_pci_device', mock.MagicMock(return_value="pciconf")) - @mock.patch('sonic_platform.sfp.MlxregManager.read_mlxred_eeprom', mock.MagicMock(return_value=output_sfp.read_eeprom_output)) - def test_sfp_read_eeprom(self): - mlxreg_mngr = MlxregManager("", 0, 0) - offset = 644 + ctypes.set_errno(1) + assert sfp.read_eeprom(0, 1) is None + ctypes.set_errno(0) - sfp = SFP(0) - assert output_sfp.y_cable_part_number == sfp.read_eeprom(offset, 16).decode() - MlxregManager.read_mlxred_eeprom.assert_called_with(132, 4, 16) + handle.read.side_effect = OSError('') + assert sfp.read_eeprom(0, 1) is None @mock.patch('sonic_platform.sfp.SFP._fetch_port_status') def test_is_port_admin_status_up(self, mock_port_status): @@ -119,3 +150,91 @@ def test_is_port_admin_status_up(self, mock_port_status): mock_port_status.return_value = (0, False) assert not SFP.is_port_admin_status_up(None, None) + + @mock.patch('sonic_platform.sfp.SFP._get_eeprom_path', mock.MagicMock(return_value = None)) + @mock.patch('sonic_platform.sfp.SFP._get_sfp_type_str') + def test_is_write_protected(self, mock_get_type_str): + sfp = SFP(0) + mock_get_type_str.return_value = 'cmis' + assert sfp._is_write_protected(page=0, page_offset=26, num_bytes=1) + assert not sfp._is_write_protected(page=0, page_offset=27, num_bytes=1) + + # not exist page + assert not sfp._is_write_protected(page=3, page_offset=0, num_bytes=1) + + # invalid sfp type str + mock_get_type_str.return_value = 'invalid' + assert not sfp._is_write_protected(page=0, page_offset=0, num_bytes=1) + + def test_get_sfp_type_str(self): + sfp = SFP(0) + expect_sfp_types = ['cmis', 'sff8636', 'sff8472'] + mock_eeprom_path = '/tmp/mock_eeprom' + mock_dir = '/tmp/mock_eeprom/0/i2c-0x50' + os.makedirs(os.path.join(mock_dir), exist_ok=True) + for expect_sfp_type in expect_sfp_types: + source_eeprom_file = os.path.join(test_path, 'input_platform', expect_sfp_type + '_page0') + shutil.copy(source_eeprom_file, os.path.join(mock_dir, 'data')) + assert sfp._get_sfp_type_str(mock_eeprom_path) == expect_sfp_type + sfp._sfp_type_str = None + + os.system('rm -rf {}'.format(mock_eeprom_path)) + assert sfp._get_sfp_type_str('invalid') is None + + @mock.patch('os.path.exists') + @mock.patch('sonic_platform.sfp.SFP._get_eeprom_path') + @mock.patch('sonic_platform.sfp.SFP._get_sfp_type_str') + def test_get_page_and_page_offset(self, mock_get_type_str, mock_eeprom_path, mock_path_exists): + sfp = SFP(0) + mock_path_exists.return_value = False + page_num, page, page_offset = sfp._get_page_and_page_offset(0) + assert page_num is None + assert page is None + assert page_offset is None + + mock_path_exists.return_value = True + mock_eeprom_path.return_value = '/tmp' + page_num, page, page_offset = sfp._get_page_and_page_offset(255) + assert page_num == 0 + assert page == '/tmp/0/i2c-0x50/data' + assert page_offset is 255 + + mock_get_type_str.return_value = 'cmis' + page_num, page, page_offset = sfp._get_page_and_page_offset(256) + assert page_num == 1 + assert page == '/tmp/1/data' + assert page_offset is 0 + + mock_get_type_str.return_value = 'sff8472' + page_num, page, page_offset = sfp._get_page_and_page_offset(511) + assert page_num == -1 + assert page == '/tmp/0/i2c-0x51/data' + assert page_offset is 255 + + page_num, page, page_offset = sfp._get_page_and_page_offset(512) + assert page_num == 1 + assert page == '/tmp/1/data' + assert page_offset is 0 + + @mock.patch('sonic_platform.sfp.SFP._read_eeprom') + def test_get_presence(self, mock_read_eeprom): + sfp = SFP(0) + mock_read_eeprom.return_value = None + assert not sfp.get_presence() + + mock_read_eeprom.return_value = bytearray([1]) + assert sfp.get_presence() + + @mock.patch('sonic_platform.sfp.SFP.get_xcvr_api') + def test_dummy_apis(self, mock_get_xcvr_api): + mock_api = mock.MagicMock() + mock_api.NUM_CHANNELS = 4 + mock_get_xcvr_api.return_value = mock_api + + sfp = SFP(0) + assert sfp.get_rx_los() == [False] * 4 + assert sfp.get_tx_fault() == [False] * 4 + + mock_get_xcvr_api.return_value = None + assert sfp.get_rx_los() is None + assert sfp.get_tx_fault() is None diff --git a/platform/mellanox/mlnx-platform-api/tests/test_thermal.py b/platform/mellanox/mlnx-platform-api/tests/test_thermal.py index a7fdc4d0baf..63da97161d2 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_thermal.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_thermal.py @@ -93,10 +93,10 @@ def test_chassis_thermal(self): assert gearbox_thermal_count == 2 assert cpu_thermal_count == 2 + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_platform_name', mock.MagicMock(return_value='x86_64-nvidia_sn2201-r0')) + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_thermal_capability', mock.MagicMock(return_value={'comex_amb': False, 'cpu_amb': True, 'swb_amb': True})) def test_chassis_thermal_includes(self): from sonic_platform.thermal import THERMAL_NAMING_RULE - DeviceDataManager.get_platform_name = mock.MagicMock(return_value='x86_64-nvidia_sn2201-r0') - DeviceDataManager.get_thermal_capability = mock.MagicMock(return_value={'comex_amb': False, 'cpu_amb': True, 'swb_amb': True}) chassis = Chassis() thermal_list = chassis.get_all_thermals() assert thermal_list diff --git a/platform/mellanox/mlnx-platform-api/tests/test_utils.py b/platform/mellanox/mlnx-platform-api/tests/test_utils.py index e1052202d41..c4c8d0c000a 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_utils.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_utils.py @@ -118,7 +118,7 @@ def func(): assert mock_log.call_count == 1 def test_run_command(self): - output = utils.run_command('ls') + output = utils.run_command(['ls']) assert output @mock.patch('sonic_py_common.device_info.get_path_to_hwsku_dir', mock.MagicMock(return_value='/tmp')) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 6eaa1dcf80b..90ca7430b0a 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,6 +1,6 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.21.2.0 +MLNX_SAI_VERSION = SAIBuild2205.22.1.19 export MLNX_SAI_VERSION diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation index f9a21df7136..82274ffaef7 160000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ b/platform/mellanox/mlnx-sai/SAI-Implementation @@ -1 +1 @@ -Subproject commit f9a21df713636fe648b8bb190698e4494a0f5239 +Subproject commit 82274ffaef7748120b7657362f7875fb7d6e6f5f diff --git a/platform/mellanox/non-upstream-patches/README.md b/platform/mellanox/non-upstream-patches/README.md new file mode 100644 index 00000000000..9138d750cbf --- /dev/null +++ b/platform/mellanox/non-upstream-patches/README.md @@ -0,0 +1,31 @@ +## Mellanox non-upstream linux kernel patches ## + +To include non-upstream patches into the sonic-linux image during build time, this folder must contain a patch archive. + +### Structure of the patch archive + + 1. It should contain a file named series. series should provide an order in which the patches have to be applied + ``` + admin@build-server:/sonic-buildimage/src/sonic-linux-kernel$ cat linux-5.10.103/non_upstream_patches/series + mlx5-Refactor-module-EEPROM-query.patch + mlx5-Implement-get_module_eeprom_by_page.patch + mlx5-Add-support-for-DSFP-module-EEPROM-dumps.patch + ``` + 2. All the patches should be present in the same folder where series resides. + 3. Developers should make sure patches apply cleanly over the existing patches present in the src/sonic-linux-kernel . + 4. Name of the tarball should match with the one specified under EXTERNAL_KERNEL_PATCH_TAR + +#### Example +``` +admin@build-server:/sonic-buildimage/platform/mellanox/non-upstream-patches$ tar -tf patches.tar.gz +./ +./mlx5-Implement-get_module_eeprom_by_page.patch +./mlx5-Add-support-for-DSFP-module-EEPROM-dumps.patch +./series +./mlx5-Refactor-module-EEPROM-query.patch +``` + +### Include the archive while building sonic linux kernel + +Set `INCLUDE_EXTERNAL_PATCH_TAR=y` using `SONIC_OVERRIDE_BUILD_VARS` to include these changes before building the kernel. +- Eg: `NOJESSIE=1 NOSTRETCH=1 NOBUSTER=1 make SONIC_OVERRIDE_BUILD_VARS=' INCLUDE_EXTERNAL_PATCH_TAR=y ' target/debs/bullseye/linux-headers-5.10.0-12-2-common_5.10.103-1_all.deb` diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 5b5e55cdf49..43aa1829953 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -51,4 +51,7 @@ $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(APPLIBS) $(SX_COMPLIB) $(SXD_LIBS) $(SX_ # Force the target bootloader for mellanox platforms to grub regardless of arch TARGET_BOOTLOADER = grub +# location for the platform specific external kernel patches tarball +override EXTERNAL_KERNEL_PATCH_TAR := $(BUILD_WORKDIR)/$(PLATFORM_PATH)/non-upstream-patches/patches.tar.gz + export SONIC_BUFFER_MODEL=dynamic diff --git a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers index 5650c3519b5..17a3b3089c9 160000 --- a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers +++ b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers @@ -1 +1 @@ -Subproject commit 5650c3519b55051124810a4625f8269694b1e592 +Subproject commit 17a3b3089c9cbca4a62fc7d2fe0894186b801625 diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index b620b07ee2f..5c3a42ab02e 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -16,7 +16,7 @@ # MLNX_SDK_BASE_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel/Switch-SDK-drivers/bin/ MLNX_SDK_PKG_BASE_PATH = $(MLNX_SDK_BASE_PATH)/$(BLDENV)/$(CONFIGURED_ARCH)/ -MLNX_SDK_VERSION = 4.5.2320 +MLNX_SDK_VERSION = 4.5.3186 MLNX_SDK_ISSU_VERSION = 101 MLNX_SDK_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SDK_VERSION))) diff --git a/platform/mellanox/zero_profiles.j2 b/platform/mellanox/zero_profiles.j2 index a953c18409b..007f19c83a0 100644 --- a/platform/mellanox/zero_profiles.j2 +++ b/platform/mellanox/zero_profiles.j2 @@ -1,3 +1,20 @@ +{# + Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} + [ { "BUFFER_POOL_TABLE:ingress_zero_pool": { diff --git a/platform/vs/docker-ptf-sai.mk b/platform/vs/docker-ptf-sai.mk index d3463c5a093..17fce00c1fe 100644 --- a/platform/vs/docker-ptf-sai.mk +++ b/platform/vs/docker-ptf-sai.mk @@ -3,7 +3,7 @@ DOCKER_PTF_SAI = docker-ptf-sai.gz DOCKER_PTF_BASE = docker-ptf.gz $(DOCKER_PTF_SAI)_PATH = $(DOCKERS_PATH)/docker-ptf-sai -$(DOCKER_PTF_SAI)_DEPENDS += $(LIBTHRIFT_2) $(PYTHON3_THRIFT_2) +$(DOCKER_PTF_SAI)_DEPENDS += $(LIBTHRIFT_0_14_1) $(PYTHON3_THRIFT_0_14_1) $(DOCKER_PTF_SAI)_LOAD_DOCKERS += $(DOCKER_PTF_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_PTF_SAI) SONIC_BUSTER_DOCKERS += $(DOCKER_PTF_SAI) diff --git a/platform/vs/docker-ptf.mk b/platform/vs/docker-ptf.mk index ef102be967f..a31757dd1f2 100644 --- a/platform/vs/docker-ptf.mk +++ b/platform/vs/docker-ptf.mk @@ -3,6 +3,12 @@ DOCKER_PTF = docker-ptf.gz $(DOCKER_PTF)_PYTHON_WHEELS += $(PTF_PY3) $(DOCKER_PTF)_PATH = $(DOCKERS_PATH)/docker-ptf -$(DOCKER_PTF)_DEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(PTF) $(PYTHON_SAITHRIFT) +$(DOCKER_PTF)_DEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(PTF) +#Don't need PYTHON_SAITHRIFT in SAITHRIFT_V2 environment +ifeq ($(SAITHRIFT_V2),) +$(DOCKER_PTF)_DEPENDS += $(PYTHON_SAITHRIFT) +else +$(info "SAITHRIFT_V2: $(SAITHRIFT_V2):skip install $(PYTHON_SAITHRIFT).") +endif SONIC_DOCKER_IMAGES += $(DOCKER_PTF) SONIC_BUSTER_DOCKERS += $(DOCKER_PTF) diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index 400d57c76d8..4adc9c10ac2 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -16,10 +16,7 @@ $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ $(SONIC_HOST_SERVICES_DATA) \ $(IPROUTE2) -# swsssdk is a dependency of sonic-py-common -# TODO: sonic-py-common should depend on swsscommon instead -$(DOCKER_SONIC_VS)_PYTHON_WHEELS += $(SWSSSDK_PY3) \ - $(SONIC_PY_COMMON_PY3) \ +$(DOCKER_SONIC_VS)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) \ $(SONIC_PLATFORM_COMMON_PY3) \ $(SONIC_YANG_MODELS_PY3) \ $(SONIC_YANG_MGMT_PY3) \ diff --git a/platform/vs/libsaithrift-dev.mk b/platform/vs/libsaithrift-dev.mk index ba8a63d539a..9519078a105 100644 --- a/platform/vs/libsaithrift-dev.mk +++ b/platform/vs/libsaithrift-dev.mk @@ -2,12 +2,20 @@ 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 +#Support two different versions of thrift +ifeq ($(SAITHRIFT_V2),y) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) \ + $(LIBSAIVS) $(LIBSAIVS_DEV) $(LIBSAIMETADATA) $(LIBSAIMETADATA_DEV) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1) $(LIBSAIVS) $(LIBSAIMETADATA) +$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SAITHRIFT_VER=v2 platform=vs +else $(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) \ $(LIBSAIVS) $(LIBSAIVS_DEV) $(LIBSAIMETADATA) $(LIBSAIMETADATA_DEV) $(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(LIBSAIVS) $(LIBSAIMETADATA) $(LIBSAITHRIFT_DEV)_BUILD_ENV = platform=vs +endif SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_$(CONFIGURED_ARCH).deb diff --git a/platform/vs/sonic-gns3a.sh b/platform/vs/sonic-gns3a.sh index 41e39cd8686..2a772ce5a33 100644 --- a/platform/vs/sonic-gns3a.sh +++ b/platform/vs/sonic-gns3a.sh @@ -41,9 +41,9 @@ echo " \"category\": \"router\", \"description\": \"SONiC Virtual Switch/Router\", \"vendor_name\": \"SONiC\", - \"vendor_url\": \"https://azure.github.io/SONiC/\", + \"vendor_url\": \"https://sonic-net.github.io/SONiC/\", \"product_name\": \"SONiC\", - \"product_url\": \"https://azure.github.io/SONiC/\", + \"product_url\": \"https://sonic-net.github.io/SONiC/\", \"registry_version\": 3, \"status\": \"experimental\", \"maintainer\": \"SONiC\", diff --git a/rules/config b/rules/config index 888c470cdee..0391abff36b 100644 --- a/rules/config +++ b/rules/config @@ -151,7 +151,7 @@ INCLUDE_NAT = y INCLUDE_DHCP_RELAY = y # INCLUDE_P4RT - build docker-p4rt for P4RT support -INCLUDE_P4RT = n +INCLUDE_P4RT = y # ENABLE_AUTO_TECH_SUPPORT - Enable the configuration for event-driven techsupport & coredump mgmt feature ENABLE_AUTO_TECH_SUPPORT = y diff --git a/rules/debootstrap.mk b/rules/debootstrap.mk index dc60599d5f3..a74fa22e9fa 100644 --- a/rules/debootstrap.mk +++ b/rules/debootstrap.mk @@ -1,6 +1,6 @@ # debootstrap package -DEBOOTSTRAP_VERSION = 1.0.123 +DEBOOTSTRAP_VERSION = 1.0.123+deb11u1 export DEBOOTSTRAP_VERSION diff --git a/rules/docker-iccpd.mk b/rules/docker-iccpd.mk index c0c74799795..eb58ee755cd 100644 --- a/rules/docker-iccpd.mk +++ b/rules/docker-iccpd.mk @@ -5,10 +5,10 @@ DOCKER_ICCPD = $(DOCKER_ICCPD_STEM).gz DOCKER_ICCPD_DBG = $(DOCKER_ICCPD_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_ICCPD)_PATH = $(DOCKERS_PATH)/$(DOCKER_ICCPD_STEM) $(DOCKER_ICCPD)_DEPENDS += $(SWSS) $(ICCPD) -$(DOCKER_ICCPD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_ICCPD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) $(DOCKER_ICCPD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) $(ICCPD_DBG) -$(DOCKER_ICCPD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) -$(DOCKER_ICCPD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ICCPD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) +$(DOCKER_ICCPD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_ICCPD)_VERSION = 1.0.0 $(DOCKER_ICCPD)_ICCPD = iccpd @@ -26,5 +26,5 @@ $(DOCKER_ICCPD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ICCPD)_BASE_IMAGE_FILES += mclagdctl:/usr/bin/mclagdctl -SONIC_BUSTER_DOCKERS += $(DOCKER_ICCPD) -SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_ICCPD_DBG) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_ICCPD) +SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_ICCPD_DBG) diff --git a/rules/docker-p4rt.mk b/rules/docker-p4rt.mk index 60e0d7d7524..172346742ce 100644 --- a/rules/docker-p4rt.mk +++ b/rules/docker-p4rt.mk @@ -19,12 +19,13 @@ $(DOCKER_P4RT)_PACKAGE_NAME = p4rt $(DOCKER_P4RT)_WARM_SHUTDOWN_BEFORE = swss $(DOCKER_P4RT)_FAST_SHUTDOWN_BEFORE = swss +# TODO: Enable P4RT DBG SONIC_DOCKER_IMAGES += $(DOCKER_P4RT) -SONIC_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) +# SONIC_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) ifeq ($(INCLUDE_P4RT), y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_P4RT) -SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) +# SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) endif $(DOCKER_P4RT)_CONTAINER_NAME = p4rt diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 5c3c760f192..a87a3024733 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -37,7 +37,7 @@ $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_PLATFORM_MONITOR)_VERSION = 1.0.0 $(DOCKER_PLATFORM_MONITOR)_PACKAGE_NAME = pmon -ifeq ($(CONFIGURED_PLATFORM),mellanox) +ifeq ($(CONFIGURED_PLATFORM),$(filter $(CONFIGURED_PLATFORM),mellanox barefoot)) $(DOCKER_PLATFORM_MONITOR)_WARM_SHUTDOWN_BEFORE = swss endif diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index b51c4d12d05..23d85054968 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -9,7 +9,17 @@ ifeq ($(CONFIGURED_ARCH), armhf) KVERSION = $(KVERSION_SHORT)-armmp endif +# Place an URL here to .tar.gz file if you want to include those patches +EXTERNAL_KERNEL_PATCH_URL = +# Set y to include non upstream patches tarball provided by the corresponding platform +INCLUDE_EXTERNAL_PATCH_TAR = n +# platforms should override this and provide an absolute path to the tarball +EXTERNAL_KERNEL_PATCH_TAR = + export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION +export EXTERNAL_KERNEL_PATCH_URL +export INCLUDE_EXTERNAL_PATCH_TAR +export EXTERNAL_KERNEL_PATCH_TAR LINUX_HEADERS_COMMON = linux-headers-$(KVERSION_SHORT)-common_$(KERNEL_VERSION)-$(KERNEL_SUBVERSION)_all.deb $(LINUX_HEADERS_COMMON)_SRC_PATH = $(SRC_PATH)/sonic-linux-kernel diff --git a/rules/openssh.mk b/rules/openssh.mk index 53438b76ab7..a5e4b5c4b7b 100644 --- a/rules/openssh.mk +++ b/rules/openssh.mk @@ -6,6 +6,7 @@ export OPENSSH_VERSION OPENSSH_SERVER = openssh-server_$(OPENSSH_VERSION)_$(CONFIGURED_ARCH).deb $(OPENSSH_SERVER)_SRC_PATH = $(SRC_PATH)/openssh +$(OPENSSH_SERVER)_DEPENDS += $(LIBNL3_DEV) $(LIBNL_ROUTE3_DEV) SONIC_MAKE_DEBS += $(OPENSSH_SERVER) # The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} diff --git a/rules/p4rt.mk b/rules/p4rt.mk index a402bac002f..9f191687950 100644 --- a/rules/p4rt.mk +++ b/rules/p4rt.mk @@ -17,4 +17,5 @@ export SONIC_P4RT SONIC_P4RT_DBG SONIC_P4RT_VERSION # The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} # are archived into debug one image to facilitate debugging. -DBG_SRC_ARCHIVE += sonic-p4rt +# TODO: Enable P4RT DBG +# DBG_SRC_ARCHIVE += sonic-p4rt diff --git a/rules/smartmontools.dep b/rules/smartmontools.dep deleted file mode 100644 index 0ca63f5f1fa..00000000000 --- a/rules/smartmontools.dep +++ /dev/null @@ -1,10 +0,0 @@ - -SPATH := $($(SMARTMONTOOLS)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/smartmontools.mk rules/smartmontools.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(shell git ls-files $(SPATH)) - -$(SMARTMONTOOLS)_CACHE_MODE := GIT_CONTENT_SHA -$(SMARTMONTOOLS)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SMARTMONTOOLS)_DEP_FILES := $(DEP_FILES) - diff --git a/rules/smartmontools.mk b/rules/smartmontools.mk deleted file mode 100644 index 7cc61eee6fe..00000000000 --- a/rules/smartmontools.mk +++ /dev/null @@ -1,12 +0,0 @@ -# smartmontools package -# - -SMARTMONTOOLS_VERSION_MAJOR = 6.6 -SMARTMONTOOLS_VERSION_FULL = $(SMARTMONTOOLS_VERSION_MAJOR)-1 - -export SMARTMONTOOLS_VERSION_MAJOR SMARTMONTOOLS_VERSION_FULL - -SMARTMONTOOLS = smartmontools_$(SMARTMONTOOLS_VERSION_FULL)_$(CONFIGURED_ARCH).deb -$(SMARTMONTOOLS)_SRC_PATH = $(SRC_PATH)/smartmontools - -SONIC_MAKE_DEBS += $(SMARTMONTOOLS) diff --git a/rules/sonic-config.dep b/rules/sonic-config.dep index 65aabe74d76..2b8b98fcd42 100644 --- a/rules/sonic-config.dep +++ b/rules/sonic-config.dep @@ -4,7 +4,7 @@ SPATH := $($(SONIC_CONFIG_ENGINE_PY3)_SRC_PATH) DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-config.mk rules/sonic-config.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(SPATH)) -DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(shell find device -type f) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 dockers/docker-orchagent/vxlan.json.j2 files/image_config/constants/constants.yml +DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(shell find device -type f | sort) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 dockers/docker-orchagent/vxlan.json.j2 files/image_config/constants/constants.yml ifeq ($(ENABLE_PY2_MODULES), y) $(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA diff --git a/rules/sonic-fips.mk b/rules/sonic-fips.mk index e5b6e4ad354..8303918e2e1 100644 --- a/rules/sonic-fips.mk +++ b/rules/sonic-fips.mk @@ -1,6 +1,6 @@ # fips packages -FIPS_VERSION = 0.3 +FIPS_VERSION = 0.4 FIPS_OPENSSL_VERSION = 1.1.1n-0+deb11u3+fips FIPS_OPENSSH_VERSION = 8.4p1-5+deb11u1+fips FIPS_PYTHON_MAIN_VERSION = 3.9 diff --git a/rules/syncd.mk b/rules/syncd.mk index 225f7ec0574..e62b2a66bc6 100644 --- a/rules/syncd.mk +++ b/rules/syncd.mk @@ -17,7 +17,13 @@ $(SYNCD_RPC)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(eval $(call add_derived_package,$(SYNCD),$(SYNCD_RPC))) # Inject libthrift build dependency for RPC build -$(SYNCD)_DEPENDS += $(LIBSWSSCOMMON_DEV) $(LIBTHRIFT_DEV) +# Support two different versions of thrift +ifeq ($(SAITHRIFT_V2),y) +$(SYNCD)_DEPENDS += $(LIBTHRIFT_0_14_1_DEV) +else +$(SYNCD)_DEPENDS += $(LIBTHRIFT_DEV) +endif +$(SYNCD)_DEPENDS += $(LIBSWSSCOMMON_DEV) $(SYNCD)_DPKG_TARGET = binary-syncd-rpc endif diff --git a/scripts/build_mirror_config.sh b/scripts/build_mirror_config.sh new file mode 100755 index 00000000000..5f94e701cbd --- /dev/null +++ b/scripts/build_mirror_config.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Generate the sources.list. in the config path +CONFIG_PATH=$1 +export ARCHITECTURE=$2 +export DISTRIBUTION=$3 + +# 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 + +[ -z "$MIRROR_URLS" ] && MIRROR_URLS=$DEFAULT_MIRROR_URLS +[ -z "$MIRROR_SECURITY_URLS" ] && MIRROR_SECURITY_URLS=$DEFAULT_MIRROR_SECURITY_URLS + +TEMPLATE=files/apt/sources.list.j2 +[ -f files/apt/sources.list.$ARCHITECTURE.j2 ] && TEMPLATE=files/apt/sources.list.$ARCHITECTURE.j2 +[ -f $CONFIG_PATH/sources.list.j2 ] && TEMPLATE=$CONFIG_PATH/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 diff --git a/scripts/prepare_docker_buildinfo.sh b/scripts/prepare_docker_buildinfo.sh index d2b2c57185d..3c1104eddc5 100755 --- a/scripts/prepare_docker_buildinfo.sh +++ b/scripts/prepare_docker_buildinfo.sh @@ -22,6 +22,10 @@ if [ -z "$DISTRO" ]; then [ -z "$DISTRO" ] && DISTRO=jessie fi +if [[ "$IMAGENAME" == docker-base-* ]]; then + scripts/build_mirror_config.sh ${DOCKERFILE_PATH} $ARCH $DISTRO +fi + # add script for reproducible build. using sha256 instead of tag for docker base image. scripts/docker_version_control.sh $@ diff --git a/slave.mk b/slave.mk index c521b380735..32ca3cb2bfe 100644 --- a/slave.mk +++ b/slave.mk @@ -43,7 +43,8 @@ BULLSEYE_DEBS_PATH = $(TARGET_PATH)/debs/bullseye BULLSEYE_FILES_PATH = $(TARGET_PATH)/files/bullseye DBG_IMAGE_MARK = dbg DBG_SRC_ARCHIVE_FILE = $(TARGET_PATH)/sonic_src.tar.gz -DPKG_ADMINDIR_PATH = /sonic/dpkg +BUILD_WORKDIR = /sonic +DPKG_ADMINDIR_PATH = $(BUILD_WORKDIR)/dpkg CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) @@ -84,6 +85,7 @@ export MULTIARCH_QEMU_ENVIRON export DOCKER_BASE_ARCH export CROSS_BUILD_ENVIRON export BLDENV +export BUILD_WORKDIR ############################################################################### ## Utility rules @@ -92,32 +94,32 @@ export BLDENV .platform : ifneq ($(CONFIGURED_PLATFORM),generic) - @echo Build system is not configured, please run make configure - @exit 1 + $(Q)echo Build system is not configured, please run make configure + $(Q)exit 1 endif configure : - @mkdir -p $(JESSIE_DEBS_PATH) - @mkdir -p $(STRETCH_DEBS_PATH) - @mkdir -p $(BUSTER_DEBS_PATH) - @mkdir -p $(BULLSEYE_DEBS_PATH) - @mkdir -p $(FILES_PATH) - @mkdir -p $(JESSIE_FILES_PATH) - @mkdir -p $(STRETCH_FILES_PATH) - @mkdir -p $(BUSTER_FILES_PATH) - @mkdir -p $(BULLSEYE_FILES_PATH) - @mkdir -p $(PYTHON_DEBS_PATH) - @mkdir -p $(PYTHON_WHEELS_PATH) - @mkdir -p $(DPKG_ADMINDIR_PATH) - @echo $(PLATFORM) > .platform - @echo $(PLATFORM_ARCH) > .arch + $(Q)mkdir -p $(JESSIE_DEBS_PATH) + $(Q)mkdir -p $(STRETCH_DEBS_PATH) + $(Q)mkdir -p $(BUSTER_DEBS_PATH) + $(Q)mkdir -p $(BULLSEYE_DEBS_PATH) + $(Q)mkdir -p $(FILES_PATH) + $(Q)mkdir -p $(JESSIE_FILES_PATH) + $(Q)mkdir -p $(STRETCH_FILES_PATH) + $(Q)mkdir -p $(BUSTER_FILES_PATH) + $(Q)mkdir -p $(BULLSEYE_FILES_PATH) + $(Q)mkdir -p $(PYTHON_DEBS_PATH) + $(Q)mkdir -p $(PYTHON_WHEELS_PATH) + $(Q)mkdir -p $(DPKG_ADMINDIR_PATH) + $(Q)echo $(PLATFORM) > .platform + $(Q)echo $(PLATFORM_ARCH) > .arch distclean : .platform clean - @rm -f .platform - @rm -f .arch + $(Q)rm -f .platform + $(Q)rm -f .arch list : - @$(foreach target,$(SONIC_TARGET_LIST),echo $(target);) + $(Q)$(foreach target,$(SONIC_TARGET_LIST),echo $(target);) ############################################################################### ## Include other rules @@ -135,6 +137,8 @@ export TRUSTED_GPG_URLS export SONIC_VERSION_CONTROL_COMPONENTS DEFAULT_CONTAINER_REGISTRY := $(SONIC_DEFAULT_CONTAINER_REGISTRY) export DEFAULT_CONTAINER_REGISTRY +export MIRROR_URLS +export MIRROR_SECURITY_URLS ifeq ($(SONIC_ENABLE_PFCWD_ON_START),y) ENABLE_PFCWD_ON_START = y @@ -176,10 +180,10 @@ endif # Pre-built Bazel is not available for armhf, so exclude P4RT # TODO(PINS): Remove when Bazel binaries are available for armhf ifeq ($(CONFIGURED_ARCH),armhf) - ifeq ($(INCLUDE_P4RT),y) - @echo "Disabling P4RT due to incompatible CPU architecture: $(CONFIGURED_ARCH)" - endif - override INCLUDE_P4RT = n +ifeq ($(INCLUDE_P4RT),y) +$(Q)echo "Disabling P4RT due to incompatible CPU architecture: $(CONFIGURED_ARCH)" +endif +override INCLUDE_P4RT = n endif ifeq ($(SONIC_INCLUDE_MACSEC),y) @@ -204,10 +208,10 @@ endif ifeq ($(ENABLE_ASAN),y) - ifneq ($(CONFIGURED_ARCH),amd64) - @echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)" - override ENABLE_ASAN = n - endif +ifneq ($(CONFIGURED_ARCH),amd64) +$(Q)echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)" +override ENABLE_ASAN = n +endif endif include $(RULES_PATH)/functions @@ -451,8 +455,10 @@ define docker-image-save docker tag $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG) $(1):latest $(LOG) @echo "Saving docker image $(1):latest" $(LOG) docker save $(1):latest | gzip -c > $(2) - @echo "Removing docker image $(1):latest" $(LOG) - docker rmi -f $(1):latest $(LOG) + if [ x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) == x"y" ]; then + @echo "Removing docker image $(1):latest" $(LOG) + docker rmi -f $(1):latest $(LOG) + fi $(call MOD_UNLOCK,$(1)) @echo "Released docker image lock for $(1) save" $(LOG) @echo "Removing docker image $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG)" $(LOG) @@ -474,8 +480,10 @@ define docker-image-load docker load -i $(TARGET_PATH)/$(1).gz $(LOG) @echo "Tagging docker image $(1):latest as $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG)" $(LOG) docker tag $(1):latest $(1)-$(DOCKER_USERNAME):$(DOCKER_USERTAG) $(LOG) - @echo "Removing docker image $(1):latest" $(LOG) - docker rmi -f $(1):latest $(LOG) + if [ x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) == x"y" ]; then + @echo "Removing docker image $(1):latest" $(LOG) + docker rmi -f $(1):latest $(LOG) + fi $(call MOD_UNLOCK,$(1)) @echo "Released docker image lock for $(1) load" $(LOG) endef @@ -870,12 +878,12 @@ endif # start docker daemon docker-start : - @sudo sed -i 's/--storage-driver=vfs/--storage-driver=$(SONIC_SLAVE_DOCKER_DRIVER)/' /etc/default/docker - @sudo sed -i -e '/http_proxy/d' -e '/https_proxy/d' /etc/default/docker - @sudo bash -c "{ echo \"export http_proxy=$$http_proxy\"; \ + $(Q)sudo sed -i 's/--storage-driver=vfs/--storage-driver=$(SONIC_SLAVE_DOCKER_DRIVER)/' /etc/default/docker + $(Q)sudo sed -i -e '/http_proxy/d' -e '/https_proxy/d' /etc/default/docker + $(Q)sudo bash -c "{ echo \"export http_proxy=$$http_proxy\"; \ echo \"export https_proxy=$$https_proxy\"; \ echo \"export no_proxy=$$no_proxy\"; } >> /etc/default/docker" - @test x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) != x"y" && sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && ./scripts/wait_for_docker.sh 60 ) + $(Q)test x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) != x"y" && sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && ./scripts/wait_for_docker.sh 60 ) # targets for building simple docker images that do not depend on any debian packages $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) @@ -896,6 +904,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g --label Tag=$(SONIC_IMAGE_VERSION) \ -f $(TARGET_DOCKERFILE)/Dockerfile.buildinfo \ -t $(DOCKER_IMAGE_REF) $($*.gz_PATH) $(LOG) + if [ x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) == x"y" ]; then docker tag $(DOCKER_IMAGE_REF) $*; fi scripts/collect_docker_version_files.sh $(DOCKER_IMAGE_REF) $(TARGET_PATH) $(call docker-image-save,$*,$@) # Clean up @@ -1015,6 +1024,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform --label Tag=$(SONIC_IMAGE_VERSION) \ $($(subst -,_,$(notdir $($*.gz_PATH)))_labels) \ -t $(DOCKER_IMAGE_REF) $($*.gz_PATH) $(LOG) + if [ x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) == x"y" ]; then docker tag $(DOCKER_IMAGE_REF) $*; fi scripts/collect_docker_version_files.sh $(DOCKER_IMAGE_REF) $(TARGET_PATH) $(call docker-image-save,$*,$@) # Clean up @@ -1067,6 +1077,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG --label Tag=$(SONIC_IMAGE_VERSION) \ --file $($*.gz_PATH)/Dockerfile-dbg \ -t $(DOCKER_DBG_IMAGE_REF) $($*.gz_PATH) $(LOG) + if [ x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) == x"y" ]; then docker tag $(DOCKER_IMAGE_REF) $*; fi scripts/collect_docker_version_files.sh $(DOCKER_DBG_IMAGE_REF) $(TARGET_PATH) $(call docker-image-save,$*-$(DBG_IMAGE_MARK),$@) # Clean up @@ -1214,8 +1225,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" export config_engine_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY2))" export config_engine_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY3))" - export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" - export swsssdk_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY3))" export platform_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY3))" export redis_dump_load_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(REDIS_DUMP_LOAD_PY2))" export redis_dump_load_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(REDIS_DUMP_LOAD_PY3))" @@ -1414,12 +1423,12 @@ SONIC_CLEAN_FILES = $(addsuffix -clean,$(addprefix $(FILES_PATH)/, \ $(SONIC_MAKE_FILES))) $(SONIC_CLEAN_DEBS) :: $(DEBS_PATH)/%-clean : .platform $$(addsuffix -clean,$$(addprefix $(DEBS_PATH)/,$$($$*_MAIN_DEB))) - @# remove derived or extra targets if main one is removed, because we treat them - @# as part of one package - @rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) + $(Q)# remove derived or extra targets if main one is removed, because we treat them + $(Q)# as part of one package + $(Q)rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) $(SONIC_CLEAN_FILES) :: $(FILES_PATH)/%-clean : .platform - @rm -f $(FILES_PATH)/$* + $(Q)rm -f $(FILES_PATH)/$* SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_DOCKER_IMAGES) \ @@ -1427,20 +1436,20 @@ SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_SIMPLE_DOCKER_IMAGES) \ $(SONIC_INSTALLERS))) $(SONIC_CLEAN_TARGETS) :: $(TARGET_PATH)/%-clean : .platform - @rm -f $(TARGET_PATH)/$* + $(Q)rm -f $(TARGET_PATH)/$* SONIC_CLEAN_STDEB_DEBS = $(addsuffix -clean,$(addprefix $(PYTHON_DEBS_PATH)/, \ $(SONIC_PYTHON_STDEB_DEBS))) $(SONIC_CLEAN_STDEB_DEBS) :: $(PYTHON_DEBS_PATH)/%-clean : .platform - @rm -f $(PYTHON_DEBS_PATH)/$* + $(Q)rm -f $(PYTHON_DEBS_PATH)/$* SONIC_CLEAN_WHEELS = $(addsuffix -clean,$(addprefix $(PYTHON_WHEELS_PATH)/, \ $(SONIC_PYTHON_WHEELS))) $(SONIC_CLEAN_WHEELS) :: $(PYTHON_WHEELS_PATH)/%-clean : .platform - @rm -f $(PYTHON_WHEELS_PATH)/$* + $(Q)rm -f $(PYTHON_WHEELS_PATH)/$* clean-logs :: .platform - @rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log $(FILES_PATH)/*.log $(PYTHON_DEBS_PATH)/*.log $(PYTHON_WHEELS_PATH)/*.log + $(Q)rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log $(FILES_PATH)/*.log $(PYTHON_DEBS_PATH)/*.log $(PYTHON_WHEELS_PATH)/*.log clean :: .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_FILES) $$(SONIC_CLEAN_TARGETS) $$(SONIC_CLEAN_STDEB_DEBS) $$(SONIC_CLEAN_WHEELS) diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index 1ffca8bc86c..b22639e8318 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -23,39 +23,10 @@ MAINTAINER gulv@microsoft.com COPY ["no-check-valid-until", "/etc/apt/apt.conf.d/"] -## TODO: Re-add in any necessary mirror URLs here as they become available -RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian bullseye-backports main" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list - -{%- if CONFIGURED_ARCH == "armhf" and CROSS_BUILD_ENVIRON != "y" %} -RUN echo "deb [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free" > /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://security.debian.org bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://security.debian.org bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo 'deb [arch=armhf] http://ftp.debian.org/debian bullseye-backports main' >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list -{%- elif CONFIGURED_ARCH == "arm64" and CROSS_BUILD_ENVIRON != "y" %} -RUN echo "deb [arch=arm64] http://deb.debian.org/debian bullseye main contrib non-free" > /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://deb.debian.org/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://security.debian.org bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://security.debian.org bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ - echo 'deb [arch=arm64] http://ftp.debian.org/debian bullseye-backports main' >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list -{%- elif CROSS_BUILD_ENVIRON == "y" %} +{%- if CROSS_BUILD_ENVIRON != "y" %} +COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] +{%- else %} +COPY ["sources.list.amd64", "/etc/apt/sources.list"] {%- if CONFIGURED_ARCH == "armhf" %} ARG arch=armhf ARG gcc_arch=arm-linux-gnueabihf @@ -404,7 +375,7 @@ RUN apt-get update && apt-get install -y \ libboost-dev \ libboost-program-options-dev \ libboost-system-dev \ - libboost-serialization-dev \ + libboost-serialization1.74-dev \ libboost-thread-dev \ libboost-atomic-dev \ libboost-chrono-dev \ diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index f2a91a27d54..73e9febda14 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -22,38 +22,10 @@ MAINTAINER gulv@microsoft.com COPY ["no-check-valid-until", "/etc/apt/apt.conf.d/"] -RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian buster-backports main" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian-security buster_updates main contrib non-free" >> /etc/apt/sources.list - -{%- if CONFIGURED_ARCH == "armhf" and CROSS_BUILD_ENVIRON != "y" %} -RUN echo "deb [arch=armhf] http://deb.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://deb.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://security.debian.org buster/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://security.debian.org buster/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo 'deb [arch=armhf] http://ftp.debian.org/debian buster-backports main' >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian-security buster_updates main contrib non-free" >> /etc/apt/sources.list -{%- elif CONFIGURED_ARCH == "arm64" and CROSS_BUILD_ENVIRON != "y" %} -RUN echo "deb [arch=arm64] http://deb.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://deb.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://security.debian.org buster/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://security.debian.org buster/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo 'deb [arch=arm64] http://ftp.debian.org/debian buster-backports main' >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian-security buster_updates main contrib non-free" >> /etc/apt/sources.list -{%- elif CROSS_BUILD_ENVIRON == "y" %} +{%- if CROSS_BUILD_ENVIRON != "y" %} +COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] +{%- else %} +COPY ["sources.list.amd64", "/etc/apt/sources.list"] {%- if CONFIGURED_ARCH == "armhf" %} ARG arch=armhf ARG gcc_arch=arm-linux-gnueabihf diff --git a/sonic-slave-stretch/Dockerfile.j2 b/sonic-slave-stretch/Dockerfile.j2 index e3815eab2d3..1397df1c736 100644 --- a/sonic-slave-stretch/Dockerfile.j2 +++ b/sonic-slave-stretch/Dockerfile.j2 @@ -10,40 +10,7 @@ FROM {{ prefix }}debian:stretch MAINTAINER gulv@microsoft.com COPY ["no-check-valid-until", "/etc/apt/apt.conf.d/"] - -RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian stretch-backports main" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian stretch main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian-security stretch_updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://packages.microsoft.com/debian/9/prod stretch main" >> /etc/apt/sources.list - -{%- if CONFIGURED_ARCH == "armhf" %} -RUN echo "deb [arch=armhf] http://deb.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://deb.debian.org/debian stretch main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://deb.debian.org/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://deb.debian.org/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://security.debian.org stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://security.debian.org stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo 'deb [arch=armhf] http://ftp.debian.org/debian stretch-backports main' >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian stretch main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian-security stretch_updates main contrib non-free" >> /etc/apt/sources.list -{%- elif CONFIGURED_ARCH == "arm64" %} -RUN echo "deb [arch=arm64] http://deb.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://deb.debian.org/debian stretch main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://deb.debian.org/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://deb.debian.org/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://security.debian.org stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://security.debian.org stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo 'deb [arch=arm64] http://ftp.debian.org/debian stretch-backports main' >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian stretch main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian-security stretch_updates main contrib non-free" >> /etc/apt/sources.list -{%- endif %} +COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"] ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/src/dhcpmon/src/dhcp_mon.cpp b/src/dhcpmon/src/dhcp_mon.cpp index 74d9869741d..4860b2b06a5 100644 --- a/src/dhcpmon/src/dhcp_mon.cpp +++ b/src/dhcpmon/src/dhcp_mon.cpp @@ -15,6 +15,7 @@ #include "dhcp_mon.h" #include "dhcp_devman.h" +#include "events.h" /** DHCP device/interface state */ typedef struct @@ -40,6 +41,8 @@ static struct event *ev_sigterm; /** libevent SIGUSR1 signal event struct */ static struct event *ev_sigusr1; +event_handle_t g_events_handle; + /** DHCP monitor state data for aggregate device for mgmt device */ static dhcp_mon_state_t state_data[] = { [0] = { @@ -95,7 +98,15 @@ 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) { - syslog(LOG_ALERT, state_data->msg, state_data->count * window_interval_sec, context->intf); + auto duration = state_data->count * window_interval_sec; + 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 = { + { "vlan", vlan }, + { "duration", std::to_string(duration) }}; + event_publish(g_events_handle, "dhcp-relay-disparity", ¶ms); + } dhcp_devman_print_status(context, DHCP_COUNTERS_SNAPSHOT); dhcp_devman_print_status(context, DHCP_COUNTERS_CURRENT); } @@ -179,6 +190,8 @@ int dhcp_mon_init(int window_sec, int max_count) break; } + g_events_handle = events_init_publisher("sonic-events-dhcp-relay"); + rv = 0; } while (0); @@ -203,6 +216,8 @@ void dhcp_mon_shutdown() event_free(ev_sigusr1); event_base_free(base); + + events_deinit_publisher(g_events_handle); } /** diff --git a/src/dhcprelay b/src/dhcprelay index 6f94c2ededb..9c3b73837f7 160000 --- a/src/dhcprelay +++ b/src/dhcprelay @@ -1 +1 @@ -Subproject commit 6f94c2ededb39ef4cdab788e295a041b2aec12b4 +Subproject commit 9c3b73837f768b3220d68ed01030d204c650d476 diff --git a/src/linkmgrd b/src/linkmgrd index 4bf8b3df8bd..b3501d27daa 160000 --- a/src/linkmgrd +++ b/src/linkmgrd @@ -1 +1 @@ -Subproject commit 4bf8b3df8bdebf1633b2dd54100aa1c6939fa7d8 +Subproject commit b3501d27daa12760e3203c66ea757800d7fe5102 diff --git a/src/lm-sensors/patch/0002-Patch-to-peform-dh_installinit-to-include-sensord.in.patch b/src/lm-sensors/patch/0002-Patch-to-peform-dh_installinit-to-include-sensord.in.patch index 7bfdee11e3b..bb88f423f4e 100644 --- a/src/lm-sensors/patch/0002-Patch-to-peform-dh_installinit-to-include-sensord.in.patch +++ b/src/lm-sensors/patch/0002-Patch-to-peform-dh_installinit-to-include-sensord.in.patch @@ -1,23 +1,13 @@ -From b11fd3d516b62c01513d289bc901820aa150c63e Mon Sep 17 00:00:00 2001 -From: Charlie Chen -Date: Wed, 1 Apr 2020 06:59:06 +0000 -Subject: Patch to peform dh_installinit to include sensord.install in the - packed deb - -Signed-off-by: Charlie Chen ---- - debian/rules | 1 + - 1 file changed, 1 insertion(+) - diff --git a/debian/rules b/debian/rules -index 5ebda06..1d77e28 100755 +index 3cd5314..1dd0983 100755 --- a/debian/rules +++ b/debian/rules -@@ -56,3 +56,4 @@ override_dh_auto_install-arch: - +@@ -66,6 +66,8 @@ override_dh_auto_install-arch: + override_dh_installinit-arch: dh_installinit -plm-sensors --no-start + dh_installinit -psensord --no-start --- -2.17.1 - + + override_dh_installsystemd-arch: + dh_installsystemd -plm-sensors --no-start ++ dh_installsystemd -psensord --no-start diff --git a/src/openssh/Makefile b/src/openssh/Makefile index ec7942fe7e5..29df8e76292 100644 --- a/src/openssh/Makefile +++ b/src/openssh/Makefile @@ -23,7 +23,6 @@ ifeq ($(CROSS_BUILD_ENVIRON), y) patch -p1 < ../patch/cross-compile-changes.patch dpkg-buildpackage -rfakeroot -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) else - sudo http_proxy=$(http_proxy) apt-get -y build-dep openssh dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) endif popd diff --git a/src/openssh/patch/0002-Revert-commit-69334996-make-sshd_config-ClientAliveC.patch b/src/openssh/patch/0002-Revert-commit-69334996-make-sshd_config-ClientAliveC.patch new file mode 100644 index 00000000000..3eb04bc4e06 --- /dev/null +++ b/src/openssh/patch/0002-Revert-commit-69334996-make-sshd_config-ClientAliveC.patch @@ -0,0 +1,48 @@ +From 2bc575c74aa811a60682e989d07675b8e7ac8a12 Mon Sep 17 00:00:00 2001 +From: Saikrishna Arcot +Date: Thu, 13 Oct 2022 13:45:17 -0700 +Subject: [PATCH] Revert commit 69334996: make + sshd_config:ClientAliveCountMax=0 disable the connection-killing behavior + +SONiC (and others) use this feature to kill connections when the session +is idle after some duration of time. OpenSSH 8.2 defined setting +ClientAliveCountMax=0, but by doing so, broke the current use case of +it. + +Signed-off-by: Saikrishna Arcot +--- + serverloop.c | 3 +-- + sshd_config.5 | 3 --- + 2 files changed, 1 insertion(+), 5 deletions(-) + +diff --git a/serverloop.c b/serverloop.c +index 48d936d..1b30498 100644 +--- a/serverloop.c ++++ b/serverloop.c +@@ -184,8 +184,7 @@ client_alive_check(struct ssh *ssh) + int r, channel_id; + + /* timeout, check to see how many we have had */ +- if (options.client_alive_count_max > 0 && +- ssh_packet_inc_alive_timeouts(ssh) > ++ if (ssh_packet_inc_alive_timeouts(ssh) > + options.client_alive_count_max) { + sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id)); + logit("Timeout, client not responding from %s", remote_id); +diff --git a/sshd_config.5 b/sshd_config.5 +index a555e7e..a5815d3 100644 +--- a/sshd_config.5 ++++ b/sshd_config.5 +@@ -545,9 +545,6 @@ is set to 15, and + .Cm ClientAliveCountMax + is left at the default, unresponsive SSH clients + will be disconnected after approximately 45 seconds. +-Setting a zero +-.Cm ClientAliveCountMax +-disables connection termination. + .It Cm ClientAliveInterval + Sets a timeout interval in seconds after which if no data has been received + from the client, +-- +2.25.1 + diff --git a/src/openssh/patch/0003-Export-remote-info-for-authorization.patch b/src/openssh/patch/0003-Export-remote-info-for-authorization.patch new file mode 100755 index 00000000000..3ef7623d7b8 --- /dev/null +++ b/src/openssh/patch/0003-Export-remote-info-for-authorization.patch @@ -0,0 +1,86 @@ +From 51b3d58afef6796fe0568deb4c3765e24cc828c9 Mon Sep 17 00:00:00 2001 +From: liuh-80 +Date: Fri, 30 Sep 2022 16:57:03 +0800 +Subject: [PATCH] Export remote info for authorization. authorization. + +--- + auth.c | 11 +++++++++++ + auth.h | 3 +++ + session.c | 3 +++ + sshd.c | 5 +++++ + 4 files changed, 22 insertions(+) + +diff --git a/auth.c b/auth.c +index c3693ba3f..96d551922 100644 +--- a/auth.c ++++ b/auth.c +@@ -914,3 +914,14 @@ auth_authorise_keyopts(struct ssh *ssh, struct passwd *pw, + + return 0; + } ++ ++/* Export remote IP address and port for authorization. */ ++void ++export_remote_info(struct ssh *ssh) ++{ ++ const char *remote_ip = ssh_remote_ipaddr(ssh); ++ const int remote_port = ssh_remote_port(ssh); ++ const char remote_addr_port[32 + INET6_ADDRSTRLEN]; ++ snprintf(remote_addr_port, sizeof(remote_addr_port), "%s %d", remote_ip, remote_port); ++ setenv("SSH_CLIENT_IPADDR_PORT", remote_addr_port, 1); ++} +\ No newline at end of file +diff --git a/auth.h b/auth.h +index 3cfce0eaf..3a34742b1 100644 +--- a/auth.h ++++ b/auth.h +@@ -229,6 +229,9 @@ struct passwd *fakepw(void); + + int sys_auth_passwd(struct ssh *, const char *); + ++/* Export remote IP address and port for authorization. */ ++void export_remote_info(struct ssh *); ++ + #if defined(KRB5) && !defined(HEIMDAL) + krb5_error_code ssh_krb5_cc_gen(krb5_context, krb5_ccache *); + #endif +diff --git a/session.c b/session.c +index a638ceef1..c615cb3d0 100644 +--- a/session.c ++++ b/session.c +@@ -619,6 +619,9 @@ do_exec_pty(struct ssh *ssh, Session *s, const char *command) + /* Close the extra descriptor for the pseudo tty. */ + close(ttyfd); + ++ /* Export remote IP address and port for authorization. */ ++ export_remote_info(ssh); ++ + /* record login, etc. similar to login(1) */ + #ifndef HAVE_OSF_SIA + do_login(ssh, s, command); +diff --git a/sshd.c b/sshd.c +index 3ef0c1452..2f67a0304 100644 +--- a/sshd.c ++++ b/sshd.c +@@ -1737,6 +1737,8 @@ main(int ac, char **av) + test_flag = 2; + break; + case 'C': ++ /* Export remote IP address and port for authorization. */ ++ export_remote_info(ssh); + connection_info = get_connection_info(ssh, 0, 0); + if (parse_server_match_testspec(connection_info, + optarg) == -1) +@@ -2252,6 +2254,9 @@ main(int ac, char **av) + */ + remote_ip = ssh_remote_ipaddr(ssh); + ++ /* Export remote IP address and port for authorization. */ ++ export_remote_info(ssh); ++ + #ifdef SSH_AUDIT_EVENTS + audit_connection_from(remote_ip, remote_port); + #endif +-- +2.35.1.windows.2 + diff --git a/src/openssh/patch/series b/src/openssh/patch/series index a645ad25833..d27f92e97b2 100644 --- a/src/openssh/patch/series +++ b/src/openssh/patch/series @@ -1 +1,3 @@ 0001-Put-style-as-line-number-to-ssh-session-environment-.patch +0002-Revert-commit-69334996-make-sshd_config-ClientAliveC.patch +0003-Export-remote-info-for-authorization.patch diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py b/src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py index 1d30a5b94a6..192527f1cd8 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py @@ -13,11 +13,13 @@ def __init__(self, common_objs, db, table): :param db: name of the db :param table: name of the table in the db """ + self.switch_type = "" self.directory = common_objs['directory'] self.cfg_mgr = common_objs['cfg_mgr'] self.constants = common_objs['constants'] self.tsa_template = common_objs['tf'].from_file("bgpd/tsa/bgpd.tsa.isolate.conf.j2") self.tsb_template = common_objs['tf'].from_file("bgpd/tsa/bgpd.tsa.unisolate.conf.j2") + self.directory.subscribe([("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/switch_type"),], self.on_switch_type_change) super(DeviceGlobalCfgMgr, self).__init__( common_objs, [], @@ -25,8 +27,16 @@ def __init__(self, common_objs, db, table): table, ) + def on_switch_type_change(self): + log_debug("DeviceGlobalCfgMgr:: Switch type update handler") + if self.directory.path_exist("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/switch_type"): + self.switch_type = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["switch_type"] + log_debug("DeviceGlobalCfgMgr:: Switch type: %s" % self.switch_type) + def set_handler(self, key, data): log_debug("DeviceGlobalCfgMgr:: set handler") + if self.switch_type: + log_debug("DeviceGlobalCfgMgr:: Switch type: %s" % self.switch_type) """ Handle device tsa_enabled state change """ if not data: log_err("DeviceGlobalCfgMgr:: data is None") @@ -78,7 +88,9 @@ def get_ts_routemaps(self, cmds, ts_template): def __generate_routemaps_from_template(self, route_map_names, template): cmd = "\n" for rm in sorted(route_map_names): - if "_INTERNAL_" in rm: + # For packet-based chassis, the bgp session between the linecards are also considered internal sessions + # While isolating a single linecard, these sessions should not be skipped + if "_INTERNAL_" in rm and self.switch_type != "chassis-packet": continue if "V4" in rm: ipv="V4" ; ipp="ip" diff --git a/src/sonic-bgpcfgd/bgpmon/bgpmon.py b/src/sonic-bgpcfgd/bgpmon/bgpmon.py index 928f72fc34b..b4b97a8d644 100755 --- a/src/sonic-bgpcfgd/bgpmon/bgpmon.py +++ b/src/sonic-bgpcfgd/bgpmon/bgpmon.py @@ -23,12 +23,12 @@ is a need to perform update or the peer is stale to be removed from the state DB """ -import subprocess import json import os import syslog from swsscommon import swsscommon import time +from sonic_py_common.general import getstatusoutput_noshell PIPE_BATCH_MAX_COUNT = 50 @@ -72,8 +72,8 @@ def update_new_peer_states(self, peer_dict): # Get a new snapshot of BGP neighbors and store them in the "new" location def get_all_neigh_states(self): - cmd = "vtysh -c 'show bgp summary json'" - rc, output = subprocess.getstatusoutput(cmd) + cmd = ["vtysh", "-c", 'show bgp summary json'] + rc, output = getstatusoutput_noshell(cmd) if rc: syslog.syslog(syslog.LOG_ERR, "*ERROR* Failed with rc:{} when execute: {}".format(rc, cmd)) return diff --git a/src/sonic-build-hooks/hooks/apt-get b/src/sonic-build-hooks/hooks/apt-get index 068293a3e35..3f099375c07 100755 --- a/src/sonic-build-hooks/hooks/apt-get +++ b/src/sonic-build-hooks/hooks/apt-get @@ -20,7 +20,7 @@ if [ "$INSTALL" == y ]; then [ "$lock_result" == y ] && release_apt_installation_lock exit $command_result else - if [[ "$1" == "purge" || "$@" == *" purge "* || "$@" == *" remove "* ]]; then + if [[ " $@ " == *" purge "* || " $@ " == *" remove "* ]]; then # When running the purge command, collect the debian versions dpkg-query -W -f '${Package}==${Version}\n' >> $POST_VERSION_PATH/purge-versions-deb chmod a+wr $POST_VERSION_PATH/purge-versions-deb diff --git a/src/sonic-build-hooks/hooks/dpkg b/src/sonic-build-hooks/hooks/dpkg new file mode 100644 index 00000000000..7fbc90f9fe5 --- /dev/null +++ b/src/sonic-build-hooks/hooks/dpkg @@ -0,0 +1,10 @@ +#!/bin/bash + +. /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" ) +$REAL_COMMAND "$@" +command_result=$? +[ "$lock_result" == y ] && release_apt_installation_lock +exit $command_result diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 85d9a91030c..74b3e514dc2 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1450,7 +1450,8 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw 'hostname': hostname, 'hwsku': hwsku, 'type': device_type, - 'synchronous_mode': 'enable' + 'synchronous_mode': 'enable', + 'yang_config_validation': 'disable' } } @@ -1790,6 +1791,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw if is_storage_device: results['DEVICE_METADATA']['localhost']['storage_device'] = "true" + # remove bgp monitor and slb peers for storage backend + if is_storage_device and 'BackEnd' in current_device['type']: + results['BGP_MONITORS'] = {} + results['BGP_PEER_RANGE'] = {} + results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members diff --git a/src/sonic-config-engine/tests/dhcp-relay-sample.json b/src/sonic-config-engine/tests/dhcp-relay-sample.json new file mode 100644 index 00000000000..dfd29ed80f4 --- /dev/null +++ b/src/sonic-config-engine/tests/dhcp-relay-sample.json @@ -0,0 +1,5 @@ +{ + "VLAN_INTERFACE": { + "Vlan1000|fc02:2000::2/24": {} + } +} diff --git a/src/sonic-config-engine/tests/sample-voq-graph.xml b/src/sonic-config-engine/tests/sample-voq-graph.xml index a43e64cf659..b152d74df8a 100644 --- a/src/sonic-config-engine/tests/sample-voq-graph.xml +++ b/src/sonic-config-engine/tests/sample-voq-graph.xml @@ -50,11 +50,6 @@ - - Vlan3094 - Vlan - 1.1.1.1/24 - Ethernet-IB0 port diff --git a/src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh index 8ba15b1c835..1d58bc956bd 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh +++ b/src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh @@ -21,10 +21,32 @@ function wait_until_iface_ready echo "Interface ${IFACE_NAME} is ready!" } +function check_for_ipv6_link_local +{ + IFACE_NAME=$1 + echo "Waiting until interface ${IFACE_NAME} has a link-local ipv6 address configured...." + + # Status of link local address is not populated in STATE_DB + while true; do + HAS_LL=$(ip -6 addr show ${IFACE_NAME} scope link 2> /dev/null) + RC=$? + if [[ ${RC} == "0" ]] && [[ ! -z ${HAS_LL} ]]; then + break + fi + + sleep 1 + done + + echo "Link-Local address is configured on ${IFACE_NAME}" +} # Wait for all interfaces with IPv4 addresses to be up and ready +# dhcp6relay binds to ipv6 addresses configured on these vlan ifaces +# Thus check if they are ready before launching dhcp6relay wait_until_iface_ready Vlan2000 192.168.200.1/27 wait_until_iface_ready Vlan1000 192.168.0.1/27 +wait_until_iface_ready Vlan1000 fc02:2000::2/24 +check_for_ipv6_link_local Vlan1000 wait_until_iface_ready PortChannel02 10.0.0.58/31 wait_until_iface_ready PortChannel03 10.0.0.60/31 wait_until_iface_ready PortChannel04 10.0.0.62/31 diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json index 00bf9a9a438..afe1e9946eb 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json @@ -1050,99 +1050,195 @@ "Ethernet0|5": { "scheduler": "scheduler.0" }, + "Ethernet0|7": { + "scheduler": "scheduler.0" + }, "Ethernet4|5": { "scheduler": "scheduler.0" }, + "Ethernet4|7": { + "scheduler": "scheduler.0" + }, "Ethernet8|5": { "scheduler": "scheduler.0" }, + "Ethernet8|7": { + "scheduler": "scheduler.0" + }, "Ethernet12|5": { "scheduler": "scheduler.0" }, + "Ethernet12|7": { + "scheduler": "scheduler.0" + }, "Ethernet16|5": { "scheduler": "scheduler.0" }, + "Ethernet16|7": { + "scheduler": "scheduler.0" + }, "Ethernet20|5": { "scheduler": "scheduler.0" }, + "Ethernet20|7": { + "scheduler": "scheduler.0" + }, "Ethernet24|5": { "scheduler": "scheduler.0" }, + "Ethernet24|7": { + "scheduler": "scheduler.0" + }, "Ethernet28|5": { "scheduler": "scheduler.0" }, + "Ethernet28|7": { + "scheduler": "scheduler.0" + }, "Ethernet32|5": { "scheduler": "scheduler.0" }, + "Ethernet32|7": { + "scheduler": "scheduler.0" + }, "Ethernet36|5": { "scheduler": "scheduler.0" }, + "Ethernet36|7": { + "scheduler": "scheduler.0" + }, "Ethernet40|5": { "scheduler": "scheduler.0" }, + "Ethernet40|7": { + "scheduler": "scheduler.0" + }, "Ethernet44|5": { "scheduler": "scheduler.0" }, + "Ethernet44|7": { + "scheduler": "scheduler.0" + }, "Ethernet48|5": { "scheduler": "scheduler.0" }, + "Ethernet48|7": { + "scheduler": "scheduler.0" + }, "Ethernet52|5": { "scheduler": "scheduler.0" }, + "Ethernet52|7": { + "scheduler": "scheduler.0" + }, "Ethernet56|5": { "scheduler": "scheduler.0" }, + "Ethernet56|7": { + "scheduler": "scheduler.0" + }, "Ethernet60|5": { "scheduler": "scheduler.0" }, + "Ethernet60|7": { + "scheduler": "scheduler.0" + }, "Ethernet64|5": { "scheduler": "scheduler.0" }, + "Ethernet64|7": { + "scheduler": "scheduler.0" + }, "Ethernet68|5": { "scheduler": "scheduler.0" }, + "Ethernet68|7": { + "scheduler": "scheduler.0" + }, "Ethernet72|5": { "scheduler": "scheduler.0" }, + "Ethernet72|7": { + "scheduler": "scheduler.0" + }, "Ethernet76|5": { "scheduler": "scheduler.0" }, + "Ethernet76|7": { + "scheduler": "scheduler.0" + }, "Ethernet80|5": { "scheduler": "scheduler.0" }, + "Ethernet80|7": { + "scheduler": "scheduler.0" + }, "Ethernet84|5": { "scheduler": "scheduler.0" }, + "Ethernet84|7": { + "scheduler": "scheduler.0" + }, "Ethernet88|5": { "scheduler": "scheduler.0" }, + "Ethernet88|7": { + "scheduler": "scheduler.0" + }, "Ethernet92|5": { "scheduler": "scheduler.0" }, + "Ethernet92|7": { + "scheduler": "scheduler.0" + }, "Ethernet96|5": { "scheduler": "scheduler.0" }, + "Ethernet96|7": { + "scheduler": "scheduler.0" + }, "Ethernet100|5": { "scheduler": "scheduler.0" }, + "Ethernet100|7": { + "scheduler": "scheduler.0" + }, "Ethernet104|5": { "scheduler": "scheduler.0" }, + "Ethernet104|7": { + "scheduler": "scheduler.0" + }, "Ethernet108|5": { "scheduler": "scheduler.0" }, + "Ethernet108|7": { + "scheduler": "scheduler.0" + }, "Ethernet112|5": { "scheduler": "scheduler.0" }, + "Ethernet112|7": { + "scheduler": "scheduler.0" + }, "Ethernet116|5": { "scheduler": "scheduler.0" }, + "Ethernet116|7": { + "scheduler": "scheduler.0" + }, "Ethernet120|5": { "scheduler": "scheduler.0" }, + "Ethernet120|7": { + "scheduler": "scheduler.0" + }, "Ethernet124|5": { "scheduler": "scheduler.0" }, + "Ethernet124|7": { + "scheduler": "scheduler.0" + }, "Ethernet0|6": { "scheduler": "scheduler.0" }, diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json index 4d16791f928..b4f5b5f42e7 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json @@ -1849,196 +1849,388 @@ }, "Ethernet0|5": { "scheduler": "scheduler.0" + }, + "Ethernet0|7": { + "scheduler": "scheduler.0" }, "Ethernet4|5": { "scheduler": "scheduler.0" }, + "Ethernet4|7": { + "scheduler": "scheduler.0" + }, "Ethernet8|5": { "scheduler": "scheduler.0" }, + "Ethernet8|7": { + "scheduler": "scheduler.0" + }, "Ethernet12|5": { "scheduler": "scheduler.0" }, + "Ethernet12|7": { + "scheduler": "scheduler.0" + }, "Ethernet16|5": { "scheduler": "scheduler.0" }, + "Ethernet16|7": { + "scheduler": "scheduler.0" + }, "Ethernet20|5": { "scheduler": "scheduler.0" }, + "Ethernet20|7": { + "scheduler": "scheduler.0" + }, "Ethernet24|5": { "scheduler": "scheduler.0" }, + "Ethernet24|7": { + "scheduler": "scheduler.0" + }, "Ethernet28|5": { "scheduler": "scheduler.0" }, + "Ethernet28|7": { + "scheduler": "scheduler.0" + }, "Ethernet32|5": { "scheduler": "scheduler.0" }, + "Ethernet32|7": { + "scheduler": "scheduler.0" + }, "Ethernet36|5": { "scheduler": "scheduler.0" }, + "Ethernet36|7": { + "scheduler": "scheduler.0" + }, "Ethernet40|5": { "scheduler": "scheduler.0" }, + "Ethernet40|7": { + "scheduler": "scheduler.0" + }, "Ethernet44|5": { "scheduler": "scheduler.0" }, + "Ethernet44|7": { + "scheduler": "scheduler.0" + }, "Ethernet48|5": { "scheduler": "scheduler.0" }, + "Ethernet48|7": { + "scheduler": "scheduler.0" + }, "Ethernet52|5": { "scheduler": "scheduler.0" }, + "Ethernet52|7": { + "scheduler": "scheduler.0" + }, "Ethernet56|5": { "scheduler": "scheduler.0" }, + "Ethernet56|7": { + "scheduler": "scheduler.0" + }, "Ethernet60|5": { "scheduler": "scheduler.0" }, + "Ethernet60|7": { + "scheduler": "scheduler.0" + }, "Ethernet64|5": { "scheduler": "scheduler.0" }, + "Ethernet64|7": { + "scheduler": "scheduler.0" + }, "Ethernet68|5": { "scheduler": "scheduler.0" }, + "Ethernet68|7": { + "scheduler": "scheduler.0" + }, "Ethernet72|5": { "scheduler": "scheduler.0" }, + "Ethernet72|7": { + "scheduler": "scheduler.0" + }, "Ethernet76|5": { "scheduler": "scheduler.0" }, + "Ethernet76|7": { + "scheduler": "scheduler.0" + }, "Ethernet80|5": { "scheduler": "scheduler.0" }, + "Ethernet80|7": { + "scheduler": "scheduler.0" + }, "Ethernet84|5": { "scheduler": "scheduler.0" }, + "Ethernet84|7": { + "scheduler": "scheduler.0" + }, "Ethernet88|5": { "scheduler": "scheduler.0" }, + "Ethernet88|7": { + "scheduler": "scheduler.0" + }, "Ethernet92|5": { "scheduler": "scheduler.0" }, + "Ethernet92|7": { + "scheduler": "scheduler.0" + }, "Ethernet96|5": { "scheduler": "scheduler.0" }, + "Ethernet96|7": { + "scheduler": "scheduler.0" + }, "Ethernet100|5": { "scheduler": "scheduler.0" }, + "Ethernet100|7": { + "scheduler": "scheduler.0" + }, "Ethernet104|5": { "scheduler": "scheduler.0" }, + "Ethernet104|7": { + "scheduler": "scheduler.0" + }, "Ethernet108|5": { "scheduler": "scheduler.0" }, + "Ethernet108|7": { + "scheduler": "scheduler.0" + }, "Ethernet112|5": { "scheduler": "scheduler.0" }, + "Ethernet112|7": { + "scheduler": "scheduler.0" + }, "Ethernet116|5": { "scheduler": "scheduler.0" }, + "Ethernet116|7": { + "scheduler": "scheduler.0" + }, "Ethernet120|5": { "scheduler": "scheduler.0" }, + "Ethernet120|7": { + "scheduler": "scheduler.0" + }, "Ethernet124|5": { "scheduler": "scheduler.0" }, + "Ethernet124|7": { + "scheduler": "scheduler.0" + }, "Ethernet128|5": { "scheduler": "scheduler.0" }, + "Ethernet128|7": { + "scheduler": "scheduler.0" + }, "Ethernet132|5": { "scheduler": "scheduler.0" }, + "Ethernet132|7": { + "scheduler": "scheduler.0" + }, "Ethernet136|5": { "scheduler": "scheduler.0" }, + "Ethernet136|7": { + "scheduler": "scheduler.0" + }, "Ethernet140|5": { "scheduler": "scheduler.0" }, + "Ethernet140|7": { + "scheduler": "scheduler.0" + }, "Ethernet144|5": { "scheduler": "scheduler.0" }, + "Ethernet144|7": { + "scheduler": "scheduler.0" + }, "Ethernet148|5": { "scheduler": "scheduler.0" }, + "Ethernet148|7": { + "scheduler": "scheduler.0" + }, "Ethernet152|5": { "scheduler": "scheduler.0" }, + "Ethernet152|7": { + "scheduler": "scheduler.0" + }, "Ethernet156|5": { "scheduler": "scheduler.0" }, + "Ethernet156|7": { + "scheduler": "scheduler.0" + }, "Ethernet160|5": { "scheduler": "scheduler.0" }, + "Ethernet160|7": { + "scheduler": "scheduler.0" + }, "Ethernet164|5": { "scheduler": "scheduler.0" }, + "Ethernet164|7": { + "scheduler": "scheduler.0" + }, "Ethernet168|5": { "scheduler": "scheduler.0" }, + "Ethernet168|7": { + "scheduler": "scheduler.0" + }, "Ethernet172|5": { "scheduler": "scheduler.0" }, + "Ethernet172|7": { + "scheduler": "scheduler.0" + }, "Ethernet176|5": { "scheduler": "scheduler.0" }, + "Ethernet176|7": { + "scheduler": "scheduler.0" + }, "Ethernet180|5": { "scheduler": "scheduler.0" }, + "Ethernet180|7": { + "scheduler": "scheduler.0" + }, "Ethernet184|5": { "scheduler": "scheduler.0" }, + "Ethernet184|7": { + "scheduler": "scheduler.0" + }, "Ethernet188|5": { "scheduler": "scheduler.0" }, + "Ethernet188|7": { + "scheduler": "scheduler.0" + }, "Ethernet192|5": { "scheduler": "scheduler.0" }, + "Ethernet192|7": { + "scheduler": "scheduler.0" + }, "Ethernet196|5": { "scheduler": "scheduler.0" }, + "Ethernet196|7": { + "scheduler": "scheduler.0" + }, "Ethernet200|5": { "scheduler": "scheduler.0" }, + "Ethernet200|7": { + "scheduler": "scheduler.0" + }, "Ethernet204|5": { "scheduler": "scheduler.0" }, + "Ethernet204|7": { + "scheduler": "scheduler.0" + }, "Ethernet208|5": { "scheduler": "scheduler.0" }, + "Ethernet208|7": { + "scheduler": "scheduler.0" + }, "Ethernet212|5": { "scheduler": "scheduler.0" }, + "Ethernet212|7": { + "scheduler": "scheduler.0" + }, "Ethernet216|5": { "scheduler": "scheduler.0" }, + "Ethernet216|7": { + "scheduler": "scheduler.0" + }, "Ethernet220|5": { "scheduler": "scheduler.0" }, + "Ethernet220|7": { + "scheduler": "scheduler.0" + }, "Ethernet224|5": { "scheduler": "scheduler.0" }, + "Ethernet224|7": { + "scheduler": "scheduler.0" + }, "Ethernet228|5": { "scheduler": "scheduler.0" }, + "Ethernet228|7": { + "scheduler": "scheduler.0" + }, "Ethernet232|5": { "scheduler": "scheduler.0" }, + "Ethernet232|7": { + "scheduler": "scheduler.0" + }, "Ethernet236|5": { "scheduler": "scheduler.0" }, + "Ethernet236|7": { + "scheduler": "scheduler.0" + }, "Ethernet240|5": { "scheduler": "scheduler.0" }, + "Ethernet240|7": { + "scheduler": "scheduler.0" + }, "Ethernet244|5": { "scheduler": "scheduler.0" }, + "Ethernet244|7": { + "scheduler": "scheduler.0" + }, "Ethernet248|5": { "scheduler": "scheduler.0" }, + "Ethernet248|7": { + "scheduler": "scheduler.0" + }, "Ethernet252|5": { "scheduler": "scheduler.0" }, + "Ethernet252|7": { + "scheduler": "scheduler.0" + }, "Ethernet0|6": { "scheduler": "scheduler.0" }, diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json index a0e9ad63147..26e7dd8be50 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json @@ -925,87 +925,171 @@ "Ethernet0|5": { "scheduler": "scheduler.0" }, + "Ethernet0|7": { + "scheduler": "scheduler.0" + }, "Ethernet4|5": { "scheduler": "scheduler.0" }, + "Ethernet4|7": { + "scheduler": "scheduler.0" + }, "Ethernet16|5": { "scheduler": "scheduler.0" }, + "Ethernet16|7": { + "scheduler": "scheduler.0" + }, "Ethernet20|5": { "scheduler": "scheduler.0" }, + "Ethernet20|7": { + "scheduler": "scheduler.0" + }, "Ethernet64|5": { "scheduler": "scheduler.0" }, + "Ethernet64|7": { + "scheduler": "scheduler.0" + }, "Ethernet68|5": { "scheduler": "scheduler.0" }, + "Ethernet68|7": { + "scheduler": "scheduler.0" + }, "Ethernet80|5": { "scheduler": "scheduler.0" }, + "Ethernet80|7": { + "scheduler": "scheduler.0" + }, "Ethernet84|5": { "scheduler": "scheduler.0" }, + "Ethernet84|7": { + "scheduler": "scheduler.0" + }, "Ethernet136|5": { "scheduler": "scheduler.0" }, + "Ethernet136|7": { + "scheduler": "scheduler.0" + }, "Ethernet144|5": { "scheduler": "scheduler.0" }, + "Ethernet144|7": { + "scheduler": "scheduler.0" + }, "Ethernet148|5": { "scheduler": "scheduler.0" }, + "Ethernet148|7": { + "scheduler": "scheduler.0" + }, "Ethernet152|5": { "scheduler": "scheduler.0" }, + "Ethernet152|7": { + "scheduler": "scheduler.0" + }, "Ethernet156|5": { "scheduler": "scheduler.0" }, + "Ethernet156|7": { + "scheduler": "scheduler.0" + }, "Ethernet168|5": { "scheduler": "scheduler.0" }, + "Ethernet168|7": { + "scheduler": "scheduler.0" + }, "Ethernet176|5": { "scheduler": "scheduler.0" }, + "Ethernet176|7": { + "scheduler": "scheduler.0" + }, "Ethernet180|5": { "scheduler": "scheduler.0" }, + "Ethernet180|7": { + "scheduler": "scheduler.0" + }, "Ethernet184|5": { "scheduler": "scheduler.0" }, + "Ethernet184|7": { + "scheduler": "scheduler.0" + }, "Ethernet188|5": { "scheduler": "scheduler.0" }, + "Ethernet188|7": { + "scheduler": "scheduler.0" + }, "Ethernet200|5": { "scheduler": "scheduler.0" }, + "Ethernet200|7": { + "scheduler": "scheduler.0" + }, "Ethernet208|5": { "scheduler": "scheduler.0" }, + "Ethernet208|7": { + "scheduler": "scheduler.0" + }, "Ethernet212|5": { "scheduler": "scheduler.0" }, + "Ethernet212|7": { + "scheduler": "scheduler.0" + }, "Ethernet216|5": { "scheduler": "scheduler.0" }, + "Ethernet216|7": { + "scheduler": "scheduler.0" + }, "Ethernet220|5": { "scheduler": "scheduler.0" }, + "Ethernet220|7": { + "scheduler": "scheduler.0" + }, "Ethernet232|5": { "scheduler": "scheduler.0" }, + "Ethernet232|7": { + "scheduler": "scheduler.0" + }, "Ethernet240|5": { "scheduler": "scheduler.0" }, + "Ethernet240|7": { + "scheduler": "scheduler.0" + }, "Ethernet244|5": { "scheduler": "scheduler.0" }, + "Ethernet244|7": { + "scheduler": "scheduler.0" + }, "Ethernet248|5": { "scheduler": "scheduler.0" }, + "Ethernet248|7": { + "scheduler": "scheduler.0" + }, "Ethernet252|5": { "scheduler": "scheduler.0" }, + "Ethernet252|7": { + "scheduler": "scheduler.0" + }, "Ethernet0|6": { "scheduler": "scheduler.0" }, diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-c64.json b/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-c64.json index 7da43b0d8f3..df3e773b732 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-c64.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-mellanox4600c-c64.json @@ -922,87 +922,171 @@ "Ethernet0|5": { "scheduler": "scheduler.0" }, + "Ethernet0|7": { + "scheduler": "scheduler.0" + }, "Ethernet4|5": { "scheduler": "scheduler.0" }, + "Ethernet4|7": { + "scheduler": "scheduler.0" + }, "Ethernet16|5": { "scheduler": "scheduler.0" }, + "Ethernet16|7": { + "scheduler": "scheduler.0" + }, "Ethernet20|5": { "scheduler": "scheduler.0" }, + "Ethernet20|7": { + "scheduler": "scheduler.0" + }, "Ethernet64|5": { "scheduler": "scheduler.0" }, + "Ethernet64|7": { + "scheduler": "scheduler.0" + }, "Ethernet68|5": { "scheduler": "scheduler.0" }, + "Ethernet68|7": { + "scheduler": "scheduler.0" + }, "Ethernet80|5": { "scheduler": "scheduler.0" }, + "Ethernet80|7": { + "scheduler": "scheduler.0" + }, "Ethernet84|5": { "scheduler": "scheduler.0" }, + "Ethernet84|7": { + "scheduler": "scheduler.0" + }, "Ethernet136|5": { "scheduler": "scheduler.0" }, + "Ethernet136|7": { + "scheduler": "scheduler.0" + }, "Ethernet144|5": { "scheduler": "scheduler.0" }, + "Ethernet144|7": { + "scheduler": "scheduler.0" + }, "Ethernet148|5": { "scheduler": "scheduler.0" }, + "Ethernet148|7": { + "scheduler": "scheduler.0" + }, "Ethernet152|5": { "scheduler": "scheduler.0" }, + "Ethernet152|7": { + "scheduler": "scheduler.0" + }, "Ethernet156|5": { "scheduler": "scheduler.0" }, + "Ethernet156|7": { + "scheduler": "scheduler.0" + }, "Ethernet168|5": { "scheduler": "scheduler.0" }, + "Ethernet168|7": { + "scheduler": "scheduler.0" + }, "Ethernet176|5": { "scheduler": "scheduler.0" }, + "Ethernet176|7": { + "scheduler": "scheduler.0" + }, "Ethernet180|5": { "scheduler": "scheduler.0" }, + "Ethernet180|7": { + "scheduler": "scheduler.0" + }, "Ethernet184|5": { "scheduler": "scheduler.0" }, + "Ethernet184|7": { + "scheduler": "scheduler.0" + }, "Ethernet188|5": { "scheduler": "scheduler.0" }, + "Ethernet188|7": { + "scheduler": "scheduler.0" + }, "Ethernet200|5": { "scheduler": "scheduler.0" }, + "Ethernet200|7": { + "scheduler": "scheduler.0" + }, "Ethernet208|5": { "scheduler": "scheduler.0" }, + "Ethernet208|7": { + "scheduler": "scheduler.0" + }, "Ethernet212|5": { "scheduler": "scheduler.0" }, + "Ethernet212|7": { + "scheduler": "scheduler.0" + }, "Ethernet216|5": { "scheduler": "scheduler.0" }, + "Ethernet216|7": { + "scheduler": "scheduler.0" + }, "Ethernet220|5": { "scheduler": "scheduler.0" }, + "Ethernet220|7": { + "scheduler": "scheduler.0" + }, "Ethernet232|5": { "scheduler": "scheduler.0" }, + "Ethernet232|7": { + "scheduler": "scheduler.0" + }, "Ethernet240|5": { "scheduler": "scheduler.0" }, + "Ethernet240|7": { + "scheduler": "scheduler.0" + }, "Ethernet244|5": { "scheduler": "scheduler.0" }, + "Ethernet244|7": { + "scheduler": "scheduler.0" + }, "Ethernet248|5": { "scheduler": "scheduler.0" }, + "Ethernet248|7": { + "scheduler": "scheduler.0" + }, "Ethernet252|5": { "scheduler": "scheduler.0" }, + "Ethernet252|7": { + "scheduler": "scheduler.0" + }, "Ethernet0|6": { "scheduler": "scheduler.0" }, diff --git a/src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh index 6e5012d5939..5f0f46a5914 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh +++ b/src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh @@ -21,8 +21,30 @@ function wait_until_iface_ready echo "Interface ${IFACE_NAME} is ready!" } +function check_for_ipv6_link_local +{ + IFACE_NAME=$1 + echo "Waiting until interface ${IFACE_NAME} has a link-local ipv6 address configured...." + + # Status of link local address is not populated in STATE_DB + while true; do + HAS_LL=$(ip -6 addr show ${IFACE_NAME} scope link 2> /dev/null) + RC=$? + if [[ ${RC} == "0" ]] && [[ ! -z ${HAS_LL} ]]; then + break + fi + + sleep 1 + done + + echo "Link-Local address is configured on ${IFACE_NAME}" +} # Wait for all interfaces with IPv4 addresses to be up and ready +# dhcp6relay binds to ipv6 addresses configured on these vlan ifaces +# Thus check if they are ready before launching dhcp6relay +wait_until_iface_ready Vlan1000 fc02:2000::2/24 +check_for_ipv6_link_local Vlan1000 wait_until_iface_ready Vlan1000 192.168.0.1/27 wait_until_iface_ready Vlan2000 192.168.200.1/27 wait_until_iface_ready PortChannel01 10.0.0.56/31 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 1190ef9680e..bcc0625ec8a 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -804,6 +804,14 @@ def verify_sub_intf(self, **kwargs): output = self.run_script(argument) self.assertEqual(output.strip(), "") + # SLB and BGP Monitor table does not exist + argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "BGP_PEER_RANGE"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{}") + argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "BGP_MONITORS"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{}") + # ACL_TABLE should not contain EVERFLOW related entries argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "ACL_TABLE"' output = self.run_script(argument) @@ -905,19 +913,6 @@ def test_minigraph_voq_port_macsec_enabled(self): utils.to_dict("{'lanes': '6,7', 'fec': 'rs', 'alias': 'Ethernet1/1', 'index': '1', 'role': 'Ext', 'speed': '100000', 'macsec': 'macsec-profile', 'description': 'Ethernet1/1', 'mtu': '9100', 'tpid': '0x8100', 'pfc_asym': 'off'}") ) - def test_minigraph_voq_inband_interface_vlan(self): - argument = "-j {} -m {} -p {} --var-json VOQ_INBAND_INTERFACE".format(self.macsec_profile, self.sample_graph_voq, self.voq_port_config) - output = self.run_script(argument) - output_dict = utils.to_dict(output.strip()) - self.assertDictEqual( - output_dict['Vlan3094'], - {'inband_type': 'Vlan'} - ) - self.assertDictEqual( - output_dict['Vlan3094|1.1.1.1/24'], - {} - ) - def test_minigraph_voq_inband_interface_port(self): argument = "-j {} -m {} -p {} --var-json VOQ_INBAND_INTERFACE".format(self.macsec_profile, self.sample_graph_voq, self.voq_port_config) output = self.run_script(argument) @@ -1021,4 +1016,4 @@ def test_minigraph_packet_chassis_400g_zr_port_config(self): output = self.run_script(argument) output_dict = utils.to_dict(output.strip()) self.assertEqual(output_dict['tx_power'], '7.5') - self.assertEqual(output_dict['laser_freq'], 131000) \ No newline at end of file + self.assertEqual(output_dict['laser_freq'], 131000) diff --git a/src/sonic-config-engine/tests/test_cfggen_from_yang.py b/src/sonic-config-engine/tests/test_cfggen_from_yang.py index d673e1e206d..801340ea472 100644 --- a/src/sonic-config-engine/tests/test_cfggen_from_yang.py +++ b/src/sonic-config-engine/tests/test_cfggen_from_yang.py @@ -81,7 +81,8 @@ def test_device_metadata(self): 'hostname': 'sonic', 'hwsku': 'Force10-S6000', 'platform': 'x86_64-kvm_x86_64-r0', - 'type': 'LeafRouter' + 'type': 'LeafRouter', + 'yang_config_validation': 'disable' }) diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index fef27be40b7..3ac219468e4 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -142,8 +142,9 @@ def test_ports_json(self): def test_dhcp_relay(self): # Test generation of wait_for_intf.sh + dhc_sample_data = os.path.join(self.test_dir, "dhcp-relay-sample.json") template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'wait_for_intf.sh.j2') - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file + argument = '-m ' + self.t0_minigraph + ' -j ' + dhc_sample_data + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file self.run_script(argument) self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'wait_for_intf.sh'), self.output_file)) diff --git a/src/sonic-config-engine/tests/test_yang_data.json b/src/sonic-config-engine/tests/test_yang_data.json index 3a28872317a..69c8125f783 100644 --- a/src/sonic-config-engine/tests/test_yang_data.json +++ b/src/sonic-config-engine/tests/test_yang_data.json @@ -161,7 +161,8 @@ "hostname": "sonic", "hwsku": "Force10-S6000", "type": "LeafRouter", - "platform": "x86_64-kvm_x86_64-r0" + "platform": "x86_64-kvm_x86_64-r0", + "yang_config_validation": "disable" } } }, @@ -378,4 +379,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/sonic-ctrmgrd/.gitignore b/src/sonic-ctrmgrd/.gitignore index bdebd5e838c..2f42f4d2c5e 100644 --- a/src/sonic-ctrmgrd/.gitignore +++ b/src/sonic-ctrmgrd/.gitignore @@ -10,3 +10,4 @@ tests/__pycache__/ ctrmgr/__pycache__/ venv tests/.coverage* +.pytest_cache/ \ No newline at end of file diff --git a/src/sonic-ctrmgrd/ctrmgr/container b/src/sonic-ctrmgrd/ctrmgr/container index db6ded635ee..ca2394b057b 100755 --- a/src/sonic-ctrmgrd/ctrmgr/container +++ b/src/sonic-ctrmgrd/ctrmgr/container @@ -30,6 +30,10 @@ STATE = "state" KUBE_LABEL_TABLE = "KUBE_LABELS" KUBE_LABEL_SET_KEY = "SET" +SERVER_TABLE = "KUBERNETES_MASTER" +SERVER_KEY = "SERVER" +ST_SER_CONNECTED = "connected" +ST_SER_UPDATE_TS = "update_time" # Get seconds to wait for remote docker to start. # If not, revert to local @@ -75,8 +79,10 @@ def read_data(is_config, feature, fields): ret = [] db = cfg_db if is_config else state_db - - tbl = swsscommon.Table(db, FEATURE_TABLE) + if feature == SERVER_KEY: + tbl = swsscommon.Table(db, SERVER_TABLE) + else: + tbl = swsscommon.Table(db, FEATURE_TABLE) data = dict(tbl.get(feature)[1]) for (field, default) in fields: @@ -104,6 +110,13 @@ def read_state(feature): [(CURRENT_OWNER, "none"), (REMOTE_STATE, "none"), (CONTAINER_ID, "")]) +def read_server_state(): + """ Read requried feature state """ + + return read_data(False, SERVER_KEY, + [(ST_SER_CONNECTED, "false"), (ST_SER_UPDATE_TS, "")]) + + def docker_action(action, feature, **kwargs): """ Execute docker action """ try: @@ -192,9 +205,10 @@ def container_start(feature, **kwargs): set_owner, fallback, _ = read_config(feature) _, remote_state, _ = read_state(feature) + server_connected, _ = read_server_state() - debug_msg("{}: set_owner:{} fallback:{} remote_state:{}".format( - feature, set_owner, fallback, remote_state)) + debug_msg("{}: set_owner:{} fallback:{} remote_state:{} server_connected:{}".format( + feature, set_owner, fallback, remote_state, server_connected)) data = { SYSTEM_STATE: "up", @@ -207,8 +221,9 @@ def container_start(feature, **kwargs): start_val = START_LOCAL else: start_val = START_KUBE - if fallback and (remote_state == "none"): + if fallback and (remote_state == "none" or server_connected == "false"): start_val |= START_LOCAL + data[REMOTE_STATE] = "none" if start_val == START_LOCAL: # Implies *only* local. diff --git a/src/sonic-ctrmgrd/ctrmgr/container_startup.py b/src/sonic-ctrmgrd/ctrmgr/container_startup.py index c56160aa488..c22ceb2f9ce 100755 --- a/src/sonic-ctrmgrd/ctrmgr/container_startup.py +++ b/src/sonic-ctrmgrd/ctrmgr/container_startup.py @@ -4,11 +4,11 @@ import datetime import inspect import json -import subprocess import syslog import time from swsscommon import swsscommon +from sonic_py_common.general import getstatusoutput_noshell_pipe # DB field names SET_OWNER = "set_owner" @@ -28,7 +28,6 @@ def debug_msg(m): msg = "{}: {}".format(inspect.stack()[1][3], m) - print(msg) syslog.syslog(syslog.LOG_DEBUG, msg) @@ -114,9 +113,12 @@ def get_docker_id(): # Read the container-id # Note: This script runs inside the context of container # - cmd = 'cat /proc/self/cgroup | grep -e ":memory:" | rev | cut -f1 -d\'/\' | rev' - proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) - output = proc.communicate()[0].decode("utf-8") + cmd0 = ['cat', '/proc/self/cgroup'] + cmd1 = ['grep', '-e', ":memory:"] + cmd2 = ['rev'] + cmd3 = ['cut', '-f1', '-d', '/'] + cmd4 = ['rev'] + _, output = getstatusoutput_noshell_pipe(cmd0, cmd1, cmd2, cmd3, cmd4) return output.strip()[:12] @@ -229,15 +231,6 @@ def container_up(feature, owner, version): do_freeze(feature, "This version is marked disabled. Exiting ...") return - if not instance_higher(feature, state_data[VERSION], version): - # TODO: May Remove label __enabled - # Else kubelet will continue to re-deploy every 5 mins, until - # master removes the lable to un-deploy. - # - do_freeze(feature, "bail out as current deploy version {} is not higher". - format(version)) - return - update_data(state_db, feature, { VERSION: version }) mode = state_data[REMOTE_STATE] diff --git a/src/sonic-ctrmgrd/ctrmgr/ctrmgr_iptables.py b/src/sonic-ctrmgrd/ctrmgr/ctrmgr_iptables.py index 74b9bfe44fc..aae2131a498 100644 --- a/src/sonic-ctrmgrd/ctrmgr/ctrmgr_iptables.py +++ b/src/sonic-ctrmgrd/ctrmgr/ctrmgr_iptables.py @@ -105,8 +105,8 @@ def iptable_proxy_rule_upd(ip_str, port = SQUID_PORT): while True: num += 1 - cmd = "sudo iptables -t nat -n -L OUTPUT {}".format(num) - proc = subprocess.run(cmd, shell=True, capture_output=True) + cmd = ["sudo", "iptables", "-t", "nat", "-n", "-L", "OUTPUT", str(num)] + proc = subprocess.run(cmd, shell=False, capture_output=True) check_proc(proc) if not proc.stdout: @@ -119,16 +119,15 @@ def iptable_proxy_rule_upd(ip_str, port = SQUID_PORT): found = True else: # Duplicate or different IP - delete it - cmd = "sudo iptables -t nat -D OUTPUT {}".format(num) - proc = subprocess.run(cmd, shell=True, capture_output=True) + cmd = ["sudo", "iptables", "-t", "nat", "-D", "OUTPUT", str(num)] + proc = subprocess.run(cmd, shell=False, capture_output=True) check_proc(proc) # Decrement number to accommodate deleted rule num -= 1 if destination and not found: - cmd = "sudo iptables -t nat -A OUTPUT -p tcp -d {} --dport {} -j DNAT --to-destination {}".format( - DST_IP, DST_PORT, destination) - proc = subprocess.run(cmd, shell=True, capture_output=True) + cmd = ["sudo", "iptables", "-t", "nat", "-A", "OUTPUT", "-p", "tcp", "-d", DST_IP, "--dport", DST_PORT, "-j", "DNAT", "--to-destination", destination] + proc = subprocess.run(cmd, shell=False, capture_output=True) check_proc(proc) diff --git a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py index 2defb6e4538..b6e9249fcb1 100755 --- a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py +++ b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py @@ -6,7 +6,7 @@ import os import sys import syslog - +import subprocess from collections import defaultdict from ctrmgr.ctrmgr_iptables import iptable_proxy_rule_upd @@ -60,7 +60,7 @@ CFG_SER_IP: "", CFG_SER_PORT: "6443", CFG_SER_DISABLE: "false", - CFG_SER_INSECURE: "false" + CFG_SER_INSECURE: "true" } dflt_st_ser = { @@ -88,18 +88,19 @@ JOIN_LATENCY = "join_latency_on_boot_seconds" JOIN_RETRY = "retry_join_interval_seconds" LABEL_RETRY = "retry_labels_update_seconds" +TAG_IMAGE_LATEST = "tag_latest_image_on_wait_seconds" USE_K8S_PROXY = "use_k8s_as_http_proxy" remote_ctr_config = { JOIN_LATENCY: 10, JOIN_RETRY: 10, LABEL_RETRY: 2, + TAG_IMAGE_LATEST: 30, USE_K8S_PROXY: "" } def log_debug(m): msg = "{}: {}".format(inspect.stack()[1][3], m) - print(msg) syslog.syslog(syslog.LOG_DEBUG, msg) @@ -119,7 +120,7 @@ def ts_now(): def is_systemd_active(feat): if not UNIT_TESTING: - status = os.system('systemctl is-active --quiet {}'.format(feat)) + status = subprocess.call(['systemctl', 'is-active', '--quiet', str(feat)]) else: status = UNIT_TESTING_ACTIVE log_debug("system status for {}: {}".format(feat, str(status))) @@ -129,7 +130,7 @@ def is_systemd_active(feat): def restart_systemd_service(server, feat, owner): log_debug("Restart service {} to owner:{}".format(feat, owner)) if not UNIT_TESTING: - status = os.system("systemctl restart {}".format(feat)) + status = subprocess.call(["systemctl", "restart", str(feat)]) else: server.mod_db_entry(STATE_DB_NAME, FEATURE_TABLE, feat, {"restart": "true"}) @@ -148,6 +149,8 @@ def init(): with open(SONIC_CTR_CONFIG, "r") as s: d = json.load(s) remote_ctr_config.update(d) + if UNIT_TESTING: + remote_ctr_config[TAG_IMAGE_LATEST] = 0 class MainServer: @@ -172,11 +175,11 @@ def register_db(self, db_name): self.db_connectors[db_name] = swsscommon.DBConnector(db_name, 0) - def register_timer(self, ts, handler): + def register_timer(self, ts, handler, args=None): """ Register timer based handler. The handler will be called on/after give timestamp, ts """ - self.timer_handlers[ts].append(handler) + self.timer_handlers[ts].append((handler, args)) def register_handler(self, db_name, table_name, handler): @@ -235,7 +238,10 @@ def run(self): lst = self.timer_handlers[k] del self.timer_handlers[k] for fn in lst: - fn() + if fn[1] is None: + fn[0]() + else: + fn[0](*fn[1]) else: timeout = (k - ct_ts).seconds break @@ -426,6 +432,54 @@ def do_join(self, ip, port, insecure): format(remote_ctr_config[JOIN_RETRY], self.start_time)) +def tag_latest_image(server, feat, docker_id, image_ver): + res = 1 + if not UNIT_TESTING: + status = os.system("docker ps |grep {} >/dev/null".format(docker_id)) + if status: + syslog.syslog(syslog.LOG_ERR, + "Feature {}:{} is not stable".format(feat, image_ver)) + else: + image_item = os.popen("docker inspect {} |jq -r .[].Image".format(docker_id)).read().strip() + if image_item: + image_id = image_item.split(":")[1][:12] + image_info = os.popen("docker images |grep {}".format(image_id)).read().split() + if image_info: + image_rep = image_info[0] + res = os.system("docker tag {} {}:latest".format(image_id, image_rep)) + if res != 0: + syslog.syslog(syslog.LOG_ERR, + "Failed to tag {}:{} to latest".format(image_rep, image_ver)) + else: + syslog.syslog(syslog.LOG_INFO, + "Successfully tag {}:{} to latest".format(image_rep, image_ver)) + feat_status = os.popen("docker inspect {} |jq -r .[].State.Running".format(feat)).read().strip() + if feat_status: + if feat_status == 'true': + os.system("docker stop {}".format(feat)) + syslog.syslog(syslog.LOG_ERR, + "{} should not run, stop it".format(feat)) + os.system("docker rm {}".format(feat)) + syslog.syslog(syslog.LOG_INFO, + "Delete previous {} container".format(feat)) + else: + syslog.syslog(syslog.LOG_ERR, + "Failed to docker images |grep {} to get image repo".format(image_id)) + else: + syslog.syslog(syslog.LOG_ERR, + "Failed to inspect container:{} to get image id".format(docker_id)) + else: + server.mod_db_entry(STATE_DB_NAME, + FEATURE_TABLE, feat, {"tag_latest": "true"}) + res = 0 + if res: + log_debug("failed to tag {}:{} to latest".format(feat, image_ver)) + else: + log_debug("successfully tag {}:{} to latest".format(feat, image_ver)) + + return res + + # # Feature changes # @@ -523,6 +577,19 @@ def on_state_update(self, key, op, data): self.st_data[key] = _update_entry(dflt_st_feat, data) remote_state = self.st_data[key][ST_FEAT_REMOTE_STATE] + if (old_remote_state != remote_state) and (remote_state == "running"): + # Tag latest + start_time = datetime.datetime.now() + datetime.timedelta( + seconds=remote_ctr_config[TAG_IMAGE_LATEST]) + self.server.register_timer(start_time, tag_latest_image, ( + self.server, + key, + self.st_data[key][ST_FEAT_CTR_ID], + self.st_data[key][ST_FEAT_CTR_VER])) + + log_debug("try to tag latest label after {} seconds @{}".format( + remote_ctr_config[TAG_IMAGE_LATEST], start_time)) + if (not init) and ( (old_remote_state == remote_state) or (remote_state != "pending")): # no change or nothing to do. diff --git a/src/sonic-ctrmgrd/ctrmgr/kube_commands.py b/src/sonic-ctrmgrd/ctrmgr/kube_commands.py index 3adea36ef12..783f122ec91 100755 --- a/src/sonic-ctrmgrd/ctrmgr/kube_commands.py +++ b/src/sonic-ctrmgrd/ctrmgr/kube_commands.py @@ -84,7 +84,7 @@ def _run_command(cmd, timeout=5): def kube_read_labels(): """ Read current labels on node and return as dict. """ - KUBECTL_GET_CMD = "kubectl --kubeconfig {} get nodes {} --show-labels |tr -s ' ' | cut -f6 -d' '" + KUBECTL_GET_CMD = "kubectl --kubeconfig {} get nodes {} --show-labels --no-headers |tr -s ' ' | cut -f6 -d' '" labels = {} ret, out, _ = _run_command(KUBECTL_GET_CMD.format( @@ -332,13 +332,11 @@ def _do_reset(pending_join = False): def _do_join(server, port, insecure): - KUBEADM_JOIN_CMD = "kubeadm join --discovery-file {} --node-name {} --apiserver-advertise-address {}" + KUBEADM_JOIN_CMD = "kubeadm join --discovery-file {} --node-name {}" err = "" out = "" ret = 0 try: - local_ipv6 = _get_local_ipv6() - #_download_file(server, port, insecure) _gen_cli_kubeconf(server, port, insecure) _do_reset(True) _run_command("modprobe br_netfilter") @@ -349,7 +347,7 @@ def _do_join(server, port, insecure): if ret == 0: (ret, out, err) = _run_command(KUBEADM_JOIN_CMD.format( - KUBE_ADMIN_CONF, get_device_name(), local_ipv6), timeout=60) + KUBE_ADMIN_CONF, get_device_name()), timeout=60) log_debug("ret = {}".format(ret)) except IOError as e: diff --git a/src/sonic-ctrmgrd/ctrmgr/remote_ctr.config.json b/src/sonic-ctrmgrd/ctrmgr/remote_ctr.config.json index 3fb0c20fddc..0b91fde3647 100644 --- a/src/sonic-ctrmgrd/ctrmgr/remote_ctr.config.json +++ b/src/sonic-ctrmgrd/ctrmgr/remote_ctr.config.json @@ -3,6 +3,7 @@ "retry_join_interval_seconds": 30, "retry_labels_update_seconds": 5, "revert_to_local_on_wait_seconds": 60, + "tag_latest_image_on_wait_seconds": 600, "use_k8s_as_http_proxy": "n" } diff --git a/src/sonic-ctrmgrd/tests/container_startup_test.py b/src/sonic-ctrmgrd/tests/container_startup_test.py index bffffaadca9..b21fe855662 100755 --- a/src/sonic-ctrmgrd/tests/container_startup_test.py +++ b/src/sonic-ctrmgrd/tests/container_startup_test.py @@ -169,7 +169,7 @@ common_test.FEATURE_TABLE: { "snmp": { "container_id": "no_change", - "container_version": "20201230.77", + "container_version": "20201230.11", "current_owner": "no_change", "remote_state": "no_change", "system_state": "up" diff --git a/src/sonic-ctrmgrd/tests/container_test.py b/src/sonic-ctrmgrd/tests/container_test.py index 4738597c72c..4581111015e 100755 --- a/src/sonic-ctrmgrd/tests/container_test.py +++ b/src/sonic-ctrmgrd/tests/container_test.py @@ -125,6 +125,11 @@ "current_owner": "none", "container_id": "" } + }, + common_test.SERVER_TABLE: { + "SERVER": { + "connected": "true" + } } } }, diff --git a/src/sonic-ctrmgrd/tests/ctrmgr_iptables_test.py b/src/sonic-ctrmgrd/tests/ctrmgr_iptables_test.py index fc28cbecc8d..cb7178fb43b 100755 --- a/src/sonic-ctrmgrd/tests/ctrmgr_iptables_test.py +++ b/src/sonic-ctrmgrd/tests/ctrmgr_iptables_test.py @@ -103,30 +103,31 @@ def __init__(self, ret, stdout, stderr): def mock_subproc_run(cmd, shell, capture_output): - cmd_prefix = "sudo iptables -t nat " - list_cmd = "{}-n -L OUTPUT ".format(cmd_prefix) - del_cmd = "{}-D OUTPUT ".format(cmd_prefix) - ins_cmd = "{}-A OUTPUT -p tcp -d ".format(cmd_prefix) + list_cmd = ["sudo", "iptables", "-t", "nat", "-n", "-L", "OUTPUT"] + del_cmd = ["sudo", "iptables", "-t", "nat", "-D", "OUTPUT"] + ins_cmd = ["sudo", "iptables", "-t", "nat", "-A", "OUTPUT", "-p", "tcp", "-d"] - assert shell + assert shell == False print("cmd={}".format(cmd)) - if cmd.startswith(list_cmd): - num = int(cmd[len(list_cmd):]) - out = current_rules[num] if len(current_rules) > num else "" - return proc(0, out, "") - - if cmd.startswith(del_cmd): - num = int(cmd[len(del_cmd):]) - if num >= len(current_rules): - print("delete num={} is greater than len={}".format(num, len(current_rules))) - print("current_rules = {}".format(current_rules)) - assert False - del current_rules[num] - return proc(0, "", "") + if list_cmd == cmd[:len(list_cmd)]: + if len(cmd) == len(list_cmd) + 1: + num = int(cmd[len(list_cmd)]) + out = current_rules[num] if len(current_rules) > num else "" + return proc(0, out, "") + + if del_cmd == cmd[:len(del_cmd)]: + if len(cmd) == len(del_cmd) + 1: + num = int(cmd[len(del_cmd)]) + if num >= len(current_rules): + print("delete num={} is greater than len={}".format(num, len(current_rules))) + print("current_rules = {}".format(current_rules)) + assert False + del current_rules[num] + return proc(0, "", "") - if cmd.startswith(ins_cmd): - l = cmd.split() + if ins_cmd == cmd[:len(ins_cmd)]: + l = cmd assert len(l) == 16 rule = "DNAT tcp -- 0.0.0.0/0 {} tcp dpt:{} to:{}".format(l[9], l[11], l[-1]) current_rules.append(rule) diff --git a/src/sonic-ctrmgrd/tests/ctrmgrd_test.py b/src/sonic-ctrmgrd/tests/ctrmgrd_test.py index 171534b5a8d..842b935396d 100755 --- a/src/sonic-ctrmgrd/tests/ctrmgrd_test.py +++ b/src/sonic-ctrmgrd/tests/ctrmgrd_test.py @@ -106,7 +106,7 @@ common_test.KUBE_JOIN: { "ip": "10.10.10.10", "port": "6443", - "insecure": "false" + "insecure": "true" } } }, @@ -151,7 +151,7 @@ common_test.KUBE_JOIN: { "ip": "10.10.10.10", "port": "6443", - "insecure": "false" + "insecure": "true" }, common_test.KUBE_RESET: { "flag": "true" @@ -276,6 +276,51 @@ } } } + }, + 3: { + common_test.DESCR: "Tag image latest when remote_state changes to running", + common_test.ARGS: "ctrmgrd", + common_test.PRE: { + common_test.CONFIG_DB_NO: { + common_test.FEATURE_TABLE: { + "snmp": { + "set_owner": "kube" + } + } + }, + common_test.STATE_DB_NO: { + common_test.FEATURE_TABLE: { + "snmp": { + "remote_state": "pending" + } + } + } + }, + common_test.UPD: { + common_test.CONFIG_DB_NO: { + common_test.FEATURE_TABLE: { + "snmp": { + "set_owner": "kube" + } + } + }, + common_test.STATE_DB_NO: { + common_test.FEATURE_TABLE: { + "snmp": { + "remote_state": "running" + } + } + } + }, + common_test.POST: { + common_test.STATE_DB_NO: { + common_test.FEATURE_TABLE: { + "snmp": { + "tag_latest": "true" + } + } + } + } } } diff --git a/src/sonic-ctrmgrd/tests/kube_commands_test.py b/src/sonic-ctrmgrd/tests/kube_commands_test.py index d8e0939efb8..60da7fd2c07 100755 --- a/src/sonic-ctrmgrd/tests/kube_commands_test.py +++ b/src/sonic-ctrmgrd/tests/kube_commands_test.py @@ -27,7 +27,7 @@ common_test.DESCR: "read labels", common_test.RETVAL: 0, common_test.PROC_CMD: ["\ -kubectl --kubeconfig {} get nodes none --show-labels |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF)], +kubectl --kubeconfig {} get nodes none --show-labels --no-headers |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF)], common_test.PROC_OUT: ["foo=bar,hello=world"], common_test.POST: { "foo": "bar", @@ -40,7 +40,7 @@ common_test.TRIGGER_THROW: True, common_test.RETVAL: -1, common_test.PROC_CMD: ["\ -kubectl --kubeconfig {} get nodes none --show-labels |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF)], +kubectl --kubeconfig {} get nodes none --show-labels --no-headers |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF)], common_test.POST: { }, common_test.PROC_KILLED: 1 @@ -49,7 +49,7 @@ common_test.DESCR: "read labels fail", common_test.RETVAL: -1, common_test.PROC_CMD: ["\ -kubectl --kubeconfig {} get nodes none --show-labels |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF)], +kubectl --kubeconfig {} get nodes none --show-labels --no-headers |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF)], common_test.PROC_OUT: [""], common_test.PROC_ERR: ["command failed"], common_test.POST: { @@ -64,7 +64,7 @@ common_test.RETVAL: 0, common_test.ARGS: { "foo": "bar", "hello": "World!", "test": "ok" }, common_test.PROC_CMD: [ -"kubectl --kubeconfig {} get nodes none --show-labels |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF), +"kubectl --kubeconfig {} get nodes none --show-labels --no-headers |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF), "kubectl --kubeconfig {} label --overwrite nodes none hello-".format( KUBE_ADMIN_CONF), "kubectl --kubeconfig {} label --overwrite nodes none hello=World! test=ok".format( @@ -77,7 +77,7 @@ common_test.RETVAL: 0, common_test.ARGS: { "foo": "bar", "hello": "world" }, common_test.PROC_CMD: [ -"kubectl --kubeconfig {} get nodes none --show-labels |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF) +"kubectl --kubeconfig {} get nodes none --show-labels --no-headers |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF) ], common_test.PROC_OUT: ["foo=bar,hello=world"] }, @@ -87,7 +87,7 @@ common_test.ARGS: { "any": "thing" }, common_test.RETVAL: -1, common_test.PROC_CMD: [ -"kubectl --kubeconfig {} get nodes none --show-labels |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF) +"kubectl --kubeconfig {} get nodes none --show-labels --no-headers |tr -s ' ' | cut -f6 -d' '".format(KUBE_ADMIN_CONF) ], common_test.PROC_ERR: ["read failed"] } @@ -110,19 +110,10 @@ "mkdir -p {}".format(CNI_DIR), "cp {} {}".format(FLANNEL_CONF_FILE, CNI_DIR), "systemctl start kubelet", - "kubeadm join --discovery-file {} --node-name none --apiserver-advertise-address FC00:2::32".format( + "kubeadm join --discovery-file {} --node-name none".format( KUBE_ADMIN_CONF) ], common_test.PROC_RUN: [True, True], - common_test.PRE: { - common_test.CONFIG_DB_NO: { - common_test.MGMT_INTERFACE_TABLE: { - "eth0|FC00:2::32/64": { - "gwaddr": "fc00:2::1" - } - } - } - }, common_test.REQ: { "data": {"ca.crt": "test"} } @@ -143,19 +134,10 @@ "mkdir -p {}".format(CNI_DIR), "cp {} {}".format(FLANNEL_CONF_FILE, CNI_DIR), "systemctl start kubelet", - "kubeadm join --discovery-file {} --node-name none --apiserver-advertise-address FC00:2::32".format( + "kubeadm join --discovery-file {} --node-name none".format( KUBE_ADMIN_CONF) ], common_test.PROC_RUN: [True, True], - common_test.PRE: { - common_test.CONFIG_DB_NO: { - common_test.MGMT_INTERFACE_TABLE: { - "eth0|FC00:2::32/64": { - "gwaddr": "fc00:2::1" - } - } - } - }, common_test.REQ: { "data": {"ca.crt": "test"} } diff --git a/src/sonic-device-data/README.md b/src/sonic-device-data/README.md index e8ccad58b81..d9d403758a8 100644 --- a/src/sonic-device-data/README.md +++ b/src/sonic-device-data/README.md @@ -1,4 +1,4 @@ # sonic-device-data Device-specific data for the SONiC project -See the [SONiC Website](http://azure.github.io/SONiC/) for more information about the SONiC project. +See the [SONiC Website](https://sonic-net.github.io/SONiC/) for more information about the SONiC project. diff --git a/src/sonic-eventd/tools/events_volume_test.py b/src/sonic-eventd/tools/events_volume_test.py index 73143d483cd..af830e26510 100644 --- a/src/sonic-eventd/tools/events_volume_test.py +++ b/src/sonic-eventd/tools/events_volume_test.py @@ -32,17 +32,16 @@ def run_test(process, file, count, duplicate): time.sleep(2) # buffer for events_tool to startup logging.info("Generating logger messages\n") + sub_cmd = ["logger", "-p", "local0.notice", "-t", process, "test", "message"] for i in range(count): - line = "" - state = "up" if duplicate: - line = "{} test message testmessage state up".format(process) + command = sub_cmd + ["testmessage", "state", "up"] else: if i % 2 != 1: - state = "down" - line = "{} test message testmessage{} state {}".format(process, i, state) - command = "logger -p local0.notice -t {}".format(line) - subprocess.run(command, shell=True, stdout=subprocess.PIPE) + command = sub_cmd + ["testmessage"+str(i), "state", "down"] + else: + command = sub_cmd + ["testmessage"+str(i), "state", "up"] + subprocess.run(command, stdout=subprocess.PIPE) time.sleep(2) # some buffer for all events to be published to file read_events_from_file(file, count) diff --git a/src/sonic-frr/patch/0010-zebra-Note-when-the-netlink-DUMP-command-is-interrup.patch b/src/sonic-frr/patch/0010-zebra-Note-when-the-netlink-DUMP-command-is-interrup.patch new file mode 100644 index 00000000000..3da1ab318d1 --- /dev/null +++ b/src/sonic-frr/patch/0010-zebra-Note-when-the-netlink-DUMP-command-is-interrup.patch @@ -0,0 +1,45 @@ +From 8f10590a85669f300d2706d5ef1e560cdbaaf0f8 Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Fri, 25 Mar 2022 19:08:14 -0400 +Subject: [PATCH 10/10] zebra: Note when the netlink DUMP command is + interrupted + +There exists code paths in the linux kernel where a dump command +will be interrupted( I am not sure I understand what this really +means ) and the data sent back from the kernel is wrong or incomplete. + +At this point in time I am not 100% certain what should be done, but +let's start noticing that this has happened so we can formulate a plan +or allow the end operator to know bad stuff is a foot at the circle K. + +Signed-off-by: Donald Sharp +--- + zebra/kernel_netlink.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c +index ccafc8f0c..9dc597fad 100644 +--- a/zebra/kernel_netlink.c ++++ b/zebra/kernel_netlink.c +@@ -972,6 +972,18 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int), + return err; + } + ++ /* ++ * What is the right thing to do? The kernel ++ * is telling us that the dump request was interrupted ++ * and we more than likely are out of luck and have ++ * missed data from the kernel. At this point in time ++ * lets just note that this is happening. ++ */ ++ if (h->nlmsg_flags & NLM_F_DUMP_INTR) ++ flog_err( ++ EC_ZEBRA_NETLINK_BAD_SEQUENCE, ++ "netlink recvmsg: The Dump request was interrupted"); ++ + /* OK we got netlink message. */ + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug( +-- +2.17.1 + diff --git a/src/sonic-frr/patch/0011-bgpd-enhanced-capability-is-always-turned-on-for-int.patch b/src/sonic-frr/patch/0011-bgpd-enhanced-capability-is-always-turned-on-for-int.patch new file mode 100644 index 00000000000..cefa7c31449 --- /dev/null +++ b/src/sonic-frr/patch/0011-bgpd-enhanced-capability-is-always-turned-on-for-int.patch @@ -0,0 +1,36 @@ +From 4db4fc1bf0599f79067bfd62aa435be8e161d81e Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Tue, 3 May 2022 12:51:21 -0400 +Subject: [PATCH] bgpd: enhanced capability is always turned on for interface + based peers + +FRR is displaying that the peer enhanced capability command is not +turned on when the interface is part of a peer group. Saving the +config and then reloading actually turns it off. + +Fix the code so that FRR does not display the enhanced capability +for interface based peers. + +Fixes: #11108 +Signed-off-by: Donald Sharp +--- + bgpd/bgp_vty.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c +index 4df2abef8..6fcce239b 100644 +--- a/bgpd/bgp_vty.c ++++ b/bgpd/bgp_vty.c +@@ -16586,7 +16586,8 @@ static void bgp_config_write_peer_global(struct vty *vty, struct bgp *bgp, + + /* capability extended-nexthop */ + if (peergroup_flag_check(peer, PEER_FLAG_CAPABILITY_ENHE)) { +- if (CHECK_FLAG(peer->flags_invert, PEER_FLAG_CAPABILITY_ENHE)) ++ if (CHECK_FLAG(peer->flags_invert, PEER_FLAG_CAPABILITY_ENHE) && ++ !peer->conf_if) + vty_out(vty, + " no neighbor %s capability extended-nexthop\n", + addr); +-- +2.17.1 + diff --git a/src/sonic-frr/patch/0012-Ensure-ospf_apiclient_lsa_originate-cannot-accidently-write-into-stack.patch b/src/sonic-frr/patch/0012-Ensure-ospf_apiclient_lsa_originate-cannot-accidently-write-into-stack.patch new file mode 100644 index 00000000000..d46f13a3caf --- /dev/null +++ b/src/sonic-frr/patch/0012-Ensure-ospf_apiclient_lsa_originate-cannot-accidently-write-into-stack.patch @@ -0,0 +1,108 @@ +From d8d77d3733bc299ed5dd7b44c4d464ba2bfed288 Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Wed, 20 Jul 2022 16:43:17 -0400 +Subject: [PATCH 1/3] ospfclient: Ensure ospf_apiclient_lsa_originate cannot + accidently write into stack + +Even though OSPF_MAX_LSA_SIZE is quite large and holds the upper bound +on what can be written into a lsa, let's add a small check to ensure +it is not possible to do a bad thing. + +This wins one of the long standing bug awards. 2003! + +Fixes: #11602 +Signed-off-by: Donald Sharp +--- + ospfclient/ospf_apiclient.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c +index 29f1c0807db..51c8a5b8c06 100644 +--- a/ospfclient/ospf_apiclient.c ++++ b/ospfclient/ospf_apiclient.c +@@ -447,6 +447,12 @@ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient, + return OSPF_API_ILLEGALLSATYPE; + } + ++ if ((size_t)opaquelen > sizeof(buf) - sizeof(struct lsa_header)) { ++ fprintf(stderr, "opaquelen(%d) is larger than buf size %zu\n", ++ opaquelen, sizeof(buf)); ++ return OSPF_API_NOMEMORY; ++ } ++ + /* Make a new LSA from parameters */ + lsah = (struct lsa_header *)buf; + lsah->ls_age = 0; + +From 519929cdd47ac4d9f7f33e13922e1a063f69bb24 Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Wed, 20 Jul 2022 16:49:09 -0400 +Subject: [PATCH 2/3] isisd: Ensure rcap is freed in error case + +unpack_tlv_router_cap allocates memory that in the error +case is not being freed. + +Signed-off-by: Donald Sharp +--- + isisd/isis_tlvs.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c +index f1aae7caf10..dad271225b3 100644 +--- a/isisd/isis_tlvs.c ++++ b/isisd/isis_tlvs.c +@@ -2966,9 +2966,9 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, + } + + static int unpack_tlv_router_cap(enum isis_tlv_context context, +- uint8_t tlv_type, uint8_t tlv_len, +- struct stream *s, struct sbuf *log, +- void *dest, int indent) ++ uint8_t tlv_type, uint8_t tlv_len, ++ struct stream *s, struct sbuf *log, void *dest, ++ int indent) + { + struct isis_tlvs *tlvs = dest; + struct isis_router_cap *rcap; +@@ -3013,7 +3013,7 @@ static int unpack_tlv_router_cap(enum isis_tlv_context context, + log, indent, + "WARNING: Router Capability subTLV length too large compared to expected size\n"); + stream_forward_getp(s, STREAM_READABLE(s)); +- ++ XFREE(MTYPE_ISIS_TLV, rcap); + return 0; + } + + +From 3c4821679f2362bcd38fcc7803f28a5210441ddb Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Thu, 21 Jul 2022 08:11:58 -0400 +Subject: [PATCH 3/3] bgpd: Make sure hdr length is at a minimum of what is + expected + +Ensure that if the capability length specified is enough data. + +Signed-off-by: Donald Sharp +--- + bgpd/bgp_packet.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c +index 7c92a8d9e83..bcd47e32d45 100644 +--- a/bgpd/bgp_packet.c ++++ b/bgpd/bgp_packet.c +@@ -2440,6 +2440,14 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt, + "%s CAPABILITY has action: %d, code: %u, length %u", + peer->host, action, hdr->code, hdr->length); + ++ if (hdr->length < sizeof(struct capability_mp_data)) { ++ zlog_info( ++ "%s Capability structure is not properly filled out, expected at least %zu bytes but header length specified is %d", ++ peer->host, sizeof(struct capability_mp_data), ++ hdr->length); ++ return BGP_Stop; ++ } ++ + /* Capability length check. */ + if ((pnt + hdr->length + 3) > end) { + zlog_info("%s Capability length error", peer->host); diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index a474b918a8c..d7d7046ee6f 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -9,3 +9,6 @@ Disable-ipv6-src-address-test-in-pceplib.patch cross-compile-changes.patch 0009-ignore-route-from-default-table.patch +0010-zebra-Note-when-the-netlink-DUMP-command-is-interrup.patch +0011-bgpd-enhanced-capability-is-always-turned-on-for-int.patch +0012-Ensure-ospf_apiclient_lsa_originate-cannot-accidently-write-into-stack.patch diff --git a/src/sonic-gnmi b/src/sonic-gnmi index 437fc357fd9..176c385b885 160000 --- a/src/sonic-gnmi +++ b/src/sonic-gnmi @@ -1 +1 @@ -Subproject commit 437fc357fd95a0b25715b8ab869b8cf8a7a22681 +Subproject commit 176c385b885bd27eb865f8e9f8023f9a11e9efc6 diff --git a/src/sonic-host-services b/src/sonic-host-services index 709046bbec9..6eac2d3bb25 160000 --- a/src/sonic-host-services +++ b/src/sonic-host-services @@ -1 +1 @@ -Subproject commit 709046bbec9d05c9bf06e7c54a23ae0f9c970281 +Subproject commit 6eac2d3bb25405cd03424ece6ec8a469b7b9844c diff --git a/src/sonic-host-services-data/README.md b/src/sonic-host-services-data/README.md index 93af66a83d6..0b9e714932d 100644 --- a/src/sonic-host-services-data/README.md +++ b/src/sonic-host-services-data/README.md @@ -16,4 +16,4 @@ dpkg-buildpackage -rfakeroot -Tclean --- -See the [SONiC Website](http://azure.github.io/SONiC/) for more information about the SONiC project. +See the [SONiC Website](https://sonic-net.github.io/SONiC/) for more information about the SONiC project. diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 443253f637e..686b9b16acc 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 443253f637ec3dccac246199977a6d65346d7878 +Subproject commit 686b9b16acc1f453cae2a697e9d8009c441c0ab0 diff --git a/src/sonic-mgmt-framework b/src/sonic-mgmt-framework index 3c3384cec8d..744602bbd85 160000 --- a/src/sonic-mgmt-framework +++ b/src/sonic-mgmt-framework @@ -1 +1 @@ -Subproject commit 3c3384cec8d15e493e6889bff6361a5a280a8811 +Subproject commit 744602bbd8541546dfe977f598f917e3471f85d0 diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 50c24a5c43e..aa86083707c 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 50c24a5c43e5c33f79f70dfb3d0aecc30e13739d +Subproject commit aa86083707c8f6eff24e02df1e5f2198259a8086 diff --git a/src/sonic-py-common/sonic_py_common/device_info.py b/src/sonic-py-common/sonic_py_common/device_info.py index 8173c267727..48a7e76e2f8 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -6,7 +6,7 @@ import yaml from natsort import natsorted - +from sonic_py_common.general import getstatusoutput_noshell_pipe from swsscommon.swsscommon import ConfigDBConnector, SonicV2Connector USR_SHARE_SONIC_PATH = "/usr/share/sonic" @@ -469,6 +469,27 @@ def is_supervisor(): return True return False +# Check if this platform has macsec capability. +def is_macsec_supported(): + supported = 0 + platform_env_conf_file_path = get_platform_env_conf_file_path() + + # platform_env.conf file not present for platform + if platform_env_conf_file_path is None: + return supported + + # Else open the file check for keyword - macsec_enabled - + with open(platform_env_conf_file_path) as platform_env_conf_file: + for line in platform_env_conf_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + if tokens[0].lower() == 'macsec_enabled': + supported = tokens[1].strip() + break + return int(supported) + + def get_device_runtime_metadata(): chassis_metadata = {} if is_chassis(): @@ -476,9 +497,11 @@ def get_device_runtime_metadata(): 'chassis_type': 'voq' if is_voq_chassis() else 'packet'}} port_metadata = {'ETHERNET_PORTS_PRESENT': True if get_path_to_port_config_file(hwsku=None, asic="0" if is_multi_npu() else None) else False} + macsec_support_metadata = {'MACSEC_SUPPORTED': True if is_macsec_supported() else False} runtime_metadata = {} runtime_metadata.update(chassis_metadata) runtime_metadata.update(port_metadata) + runtime_metadata.update(macsec_support_metadata) return {'DEVICE_RUNTIME_METADATA': runtime_metadata } def get_npu_id_from_name(npu_name): @@ -531,7 +554,27 @@ def _valid_mac_address(mac): return bool(re.match("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", mac)) +def run_command(cmd): + proc = subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (out, err) = proc.communicate() + return (out, err) + + +def run_command_pipe(cmd0, cmd1, cmd2): + exitcodes, out = getstatusoutput_noshell_pipe(cmd0, cmd1, cmd2) + if exitcodes == [0, 0, 0]: + err = None + else: + err = out + return (out, err) + + def get_system_mac(namespace=None): + hw_mac_entry_outputs = [] + syseeprom_cmd = ["sudo", "decode-syseeprom", "-m"] + iplink_cmd0 = ["ip", 'link', 'show', 'eth0'] + iplink_cmd1 = ['grep', 'ether'] + iplink_cmd2 = ['awk', '{print $2}'] version_info = get_sonic_version_info() if (version_info['asic_type'] == 'mellanox'): @@ -548,36 +591,51 @@ def get_system_mac(namespace=None): if _valid_mac_address(mac): return mac - hw_mac_entry_cmds = [ "sudo decode-syseeprom -m" ] + (mac, err) = run_command(syseeprom_cmd) + hw_mac_entry_outputs.append((mac, err)) elif (version_info['asic_type'] == 'marvell'): # Try valid mac in eeprom, else fetch it from eth0 platform = get_platform() machine_key = "onie_machine" machine_vars = get_machine_info() + (mac, err) = run_command(syseeprom_cmd) + hw_mac_entry_outputs.append((mac, err)) if machine_vars is not None and machine_key in machine_vars: hwsku = machine_vars[machine_key] - profile_cmd = 'cat ' + HOST_DEVICE_PATH + '/' + platform + '/' + hwsku + '/profile.ini | grep switchMacAddress | cut -f2 -d=' + profile_cmd0 = ['cat', HOST_DEVICE_PATH + '/' + platform + '/' + hwsku + '/profile.ini'] + profile_cmd1 = ['grep', 'switchMacAddress'] + profile_cmd2 = ['cut', '-f2', '-d', '='] + (mac, err) = run_command_pipe(profile_cmd0, profile_cmd1, profile_cmd2) else: - profile_cmd = "false" - hw_mac_entry_cmds = ["sudo decode-syseeprom -m", profile_cmd, "ip link show eth0 | grep ether | awk '{print $2}'"] + profile_cmd = ["false"] + (mac, err) = run_command(profile_cmd) + hw_mac_entry_outputs.append((mac, err)) + (mac, err) = run_command_pipe(iplink_cmd0, iplink_cmd1, iplink_cmd2) + hw_mac_entry_outputs.append((mac, err)) elif (version_info['asic_type'] == 'cisco-8000'): # Try to get valid MAC from profile.ini first, else fetch it from syseeprom or eth0 platform = get_platform() if namespace is not None: - profile_cmd = 'cat ' + HOST_DEVICE_PATH + '/' + platform + '/profile.ini | grep ' + namespace + 'switchMacAddress | cut -f2 -d=' + profile_cmd0 = ['cat', HOST_DEVICE_PATH + '/' + platform + '/profile.ini'] + profile_cmd1 = ['grep', str(namespace)+'switchMacAddress'] + profile_cmd2 = ['cut', '-f2', '-d', '='] + (mac, err) = run_command_pipe(profile_cmd0, profile_cmd1, profile_cmd2) else: - profile_cmd = "false" - hw_mac_entry_cmds = [profile_cmd, "sudo decode-syseeprom -m", "ip link show eth0 | grep ether | awk '{print $2}'"] + profile_cmd = ["false"] + (mac, err) = run_command(profile_cmd) + hw_mac_entry_outputs.append((mac, err)) + (mac, err) = run_command(syseeprom_cmd) + hw_mac_entry_outputs.append((mac, err)) + (mac, err) = run_command_pipe(iplink_cmd0, iplink_cmd1, iplink_cmd2) + hw_mac_entry_outputs.append((mac, err)) else: - mac_address_cmd = "cat /sys/class/net/eth0/address" + mac_address_cmd = ["cat", "/sys/class/net/eth0/address"] if namespace is not None: - mac_address_cmd = "sudo ip netns exec {} {}".format(namespace, mac_address_cmd) - - hw_mac_entry_cmds = [mac_address_cmd] + mac_address_cmd = ['sudo', 'ip', 'netns', 'exec', str(namespace)] + mac_address_cmd + (mac, err) = run_command(mac_address_cmd) + hw_mac_entry_outputs.append((mac, err)) - for get_mac_cmd in hw_mac_entry_cmds: - proc = subprocess.Popen(get_mac_cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (mac, err) = proc.communicate() + for (mac, err) in hw_mac_entry_outputs: if err: continue mac = mac.strip() @@ -602,17 +660,14 @@ def get_system_routing_stack(): Returns: A string containing the name of the routing stack in use on the device """ - command = "sudo docker ps | grep bgp | awk '{print$2}' | cut -d'-' -f3 | cut -d':' -f1" + cmd0 = ['sudo', 'docker', 'ps'] + cmd1 = ['grep', 'bgp'] + cmd2 = ['awk', '{print$2}'] + cmd3 = ['cut', '-d', '-', '-f3'] + cmd4 = ['cut', '-d', ':', '-f1'] try: - proc = subprocess.Popen(command, - stdout=subprocess.PIPE, - shell=True, - universal_newlines=True, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - result = stdout.rstrip('\n') + _, result = getstatusoutput_noshell_pipe(cmd0, cmd1, cmd2, cmd3, cmd4) except OSError as e: raise OSError("Cannot detect routing stack") @@ -644,8 +699,8 @@ def is_warm_restart_enabled(container_name): # Check if System fast reboot is enabled. def is_fast_reboot_enabled(): fb_system_state = 0 - cmd = 'sonic-db-cli STATE_DB get "FAST_REBOOT|system"' - proc = subprocess.Popen(cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + cmd = ['sonic-db-cli', 'STATE_DB', 'get', "FAST_REBOOT|system"] + proc = subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE) (stdout, stderr) = proc.communicate() if proc.returncode != 0: diff --git a/src/sonic-py-common/sonic_py_common/multi_asic.py b/src/sonic-py-common/sonic_py_common/multi_asic.py index d63c698392e..54f9a01dec5 100644 --- a/src/sonic-py-common/sonic_py_common/multi_asic.py +++ b/src/sonic-py-common/sonic_py_common/multi_asic.py @@ -157,10 +157,9 @@ def get_current_namespace(pid=None): """ net_namespace = None - command = ["sudo /bin/ip netns identify {}".format(os.getpid() if not pid else pid)] + command = ["sudo", '/bin/ip', 'netns', 'identify', "{}".format(os.getpid() if not pid else pid)] proc = subprocess.Popen(command, stdout=subprocess.PIPE, - shell=True, universal_newlines=True, stderr=subprocess.STDOUT) try: diff --git a/src/sonic-restapi b/src/sonic-restapi index bcc6f704a54..dac446feb2b 160000 --- a/src/sonic-restapi +++ b/src/sonic-restapi @@ -1 +1 @@ -Subproject commit bcc6f704a54454f326f069501b01759dbb732bb3 +Subproject commit dac446feb2be3aa348f633a4d2e3c64993d7483a diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 228e37c5e99..b7c85caa547 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 228e37c5e9968278280202ba77cb85714ba2d8fa +Subproject commit b7c85caa547c8ef81c58bd0ed6ae80ade4ebe425 diff --git a/src/sonic-swss b/src/sonic-swss index fd0c585d34d..81f4ea994fb 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit fd0c585d34de63dc9cca57bb7d508cadfe1125d4 +Subproject commit 81f4ea994fb3b440709f2db3c50c257148fe5e9e diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 651f52b8e51..276f47cab17 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 651f52b8e51107112c8205d12608723357ecbe5e +Subproject commit 276f47cab1768efd5a80da86904063b3ada5dd22 diff --git a/src/sonic-utilities b/src/sonic-utilities index 3af8ba4acc2..d5a6da31ef9 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 3af8ba4acc2bbc77d17be0d67943703021c7d1e1 +Subproject commit d5a6da31ef94e350c2cb66c3c981145524d7de6f diff --git a/src/sonic-yang-mgmt/sonic_yang_ext.py b/src/sonic-yang-mgmt/sonic_yang_ext.py index 8f427909188..6fd4f4ef4ef 100644 --- a/src/sonic-yang-mgmt/sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/sonic_yang_ext.py @@ -17,7 +17,8 @@ 'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST', 'DSCP_TO_FC_MAP_LIST', 'EXP_TO_FC_MAP_LIST', - 'CABLE_LENGTH_LIST' + 'CABLE_LENGTH_LIST', + 'MPLS_TC_TO_TC_MAP_LIST' ] # Workaround for those fields who is defined as leaf-list in YANG model but have string value in config DB. @@ -422,7 +423,7 @@ def _yangConvert(val): vValue = list() if isinstance(value, str) and (self.elementPath[0], self.elementPath[-1]) in LEAF_LIST_WITH_STRING_VALUE_DICT: # For field defined as leaf-list but has string value in CONFIG DB, need do special handling here. For exampe: - # port.adv_speeds in CONFIG DB has value "100,1000,10000", it shall be transferred to [100,1000,10000] as YANG value here to + # port.adv_speeds in CONFIG DB has value "100,1000,10000", it shall be transferred to [100,1000,10000] as YANG value here to # make it align with its YANG definition. value = (x.strip() for x in value.split(LEAF_LIST_WITH_STRING_VALUE_DICT[(self.elementPath[0], self.elementPath[-1])])) for v in value: diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py index a13d4c02e9a..86b27ef174e 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py @@ -292,11 +292,13 @@ def test_validate_yang_models(self, sonic_yang_data): ''' test_file = sonic_yang_data['test_file'] syc = sonic_yang_data['syc'] - # Currently only 3 YANG files are not directly related to config + # Currently only 3 YANG files are not directly related to config, along with event YANG models # which are: sonic-extension.yang, sonic-types.yang and sonic-bgp-common.yang. Hard coding # it right now. + # event YANG models do not map directly to config_db and are included to NON_CONFIG_YANG_FILES at run time # If any more such helper yang files are added, we need to update here. - NON_CONFIG_YANG_FILES = 3 + EVENT_YANG_FILES = sum(1 for yang_model in syc.yangFiles if 'sonic-events' in yang_model) + NON_CONFIG_YANG_FILES = 3 + EVENT_YANG_FILES # read config jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_JSON') jIn = json.loads(jIn) diff --git a/src/sonic-yang-mgmt/tests/test_cfghelp.py b/src/sonic-yang-mgmt/tests/test_cfghelp.py index 2c09625a0e6..5867c78e528 100644 --- a/src/sonic-yang-mgmt/tests/test_cfghelp.py +++ b/src/sonic-yang-mgmt/tests/test_cfghelp.py @@ -1,7 +1,6 @@ import json import subprocess import os - from unittest import TestCase output1="""\ @@ -126,8 +125,8 @@ def setUp(self): self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfg-help') def run_script(self, argument): - print('\n Running sonic-cfg-help ' + argument) - output = subprocess.check_output(self.script_file + ' ' + argument, shell=True) + print('\n Running sonic-cfg-help ' + ' '.join(argument)) + output = subprocess.check_output([self.script_file] + argument) output = output.decode() @@ -139,32 +138,32 @@ def run_script(self, argument): return output def test_dummy_run(self): - argument = '' + argument = [] output = self.run_script(argument) self.assertEqual(output, output1) def test_single_table(self): - argument = '-t AUTO_TECHSUPPORT' + argument = ['-t', 'AUTO_TECHSUPPORT'] output = self.run_script(argument) self.assertEqual(output, techsupport_table_output) def test_single_field(self): - argument = '-t AUTO_TECHSUPPORT -f state' + argument = ['-t', 'AUTO_TECHSUPPORT', '-f', 'state'] output = self.run_script(argument) self.assertEqual(output, techsupport_table_field_output) def test_leaf_list(self): - argument = '-t PORTCHANNEL -f members' + argument = ['-t', 'PORTCHANNEL', '-f', 'members'] output = self.run_script(argument) self.assertEqual(output, portchannel_table_field_output) def test_leaf_list_map(self): - argument = '-t DSCP_TO_TC_MAP' + argument = ['-t', 'DSCP_TO_TC_MAP'] output = self.run_script(argument) self.maxDiff = None self.assertEqual(output, dscp_to_tc_table_field_output) def test_when_condition(self): - argument = '-t ACL_RULE -f ICMP_TYPE' + argument = ['-t', 'ACL_RULE', '-f', 'ICMP_TYPE'] output = self.run_script(argument) self.assertEqual(output, acl_rule_table_field_output) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index bd7b51ce5ae..ba51e8e1aa1 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -28,6 +28,7 @@ Table of Contents * [DSCP_TO_TC_MAP](#dscp_to_tc_map) * [FLEX_COUNTER_TABLE](#flex_counter_table) * [KDUMP](#kdump) + * [Kubernetes Master](#kubernetes-master) * [L2 Neighbors](#l2-neighbors) * [Loopback Interface](#loopback-interface) * [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN) @@ -46,15 +47,18 @@ Table of Contents * [Scheduler](#scheduler) * [Port QoS Map](#port-qos-map) * [Queue](#queue) + * [Restapi](#restapi) * [Tacplus Server](#tacplus-server) * [TC to Priority group map](#tc-to-priority-group-map) * [TC to Queue map](#tc-to-queue-map) * [Telemetry](#telemetry) * [Versions](#versions) * [VLAN](#vlan) - * [VLAN_MEMBER](#vlan_member) + * [VLAN_MEMBER](#vlan_member) + * [VOQ Inband Interface](#voq-inband-interface) * [VXLAN](#vxlan) * [Virtual router](#virtual-router) + * [LOGGER](#logger) * [WRED_PROFILE](#wred_profile) * [PASSWORD_HARDENING](#password_hardening) * [SYSTEM_DEFAULTS table](#systemdefaults-table) @@ -828,7 +832,8 @@ instance is supported in SONiC. "deployment_id": "1", "type": "ToRRouter", "bgp_adv_lo_prefix_as_128" : "true", - "buffer_model": "traditional" + "buffer_model": "traditional", + "yang_config_validation": "disable" } } } @@ -934,6 +939,27 @@ instance is supported in SONiC. ``` +### Kubernetes Master + +Kubernetes Master related configurations are stored in +**KUBERNETES_MASTER** table. These configurations are used mainly +for CTRMGR service. CTRMGR service will interactive with +kubernetes master according to these configurations. + +``` +{ + "KUBERNETES_MASTER": { + "SERVER": { + "disable": "False", + "insecure": "True", + "ip": "k8s.apiserver.com", + "port": "6443" + } + } +} + +``` + ### L2 Neighbors The L2 neighbor and connection information can be configured in @@ -1411,6 +1437,23 @@ name as object key and member list as attribute. } ``` +### Restapi +``` +{ +"RESTAPI": { + "certs": { + "ca_crt": "/etc/sonic/credentials/ame_root.pem", + "server_key": "/etc/sonic/credentials/restapiserver.key", + "server_crt": "/etc/sonic/credentials/restapiserver.crt", + "client_crt_cname": "client.sonic.net" + }, + "config": { + "client_auth": "true", + "log_level": "trace", + "allow_insecure": "false" + } +} +``` ### Tacplus Server @@ -1551,6 +1594,20 @@ channel name as object key, and tagging mode as attributes. } ``` +### VOQ INBAND INTERFACE + +VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu communication. At this time, only inband_type of "port" is supported + +``` +"VOQ_INBAND_INTERFACE": { + "Ethernet-IB0": { + "inband_type": "port" + }, + "Ethernet-IB0|3.3.3.1/32": {}, + "Ethernet-IB0|3333::3:5/128": {} +} +``` + ### VXLAN VXLAN_TUNNEL holds the VTEP source ip configuration. @@ -1649,6 +1706,34 @@ The packet action could be: } } ``` + +### Logger + +In this table, the loglevel and logoutput of the components are defined. Each component +will have the component name as its key; and LOGLEVEL and LOGOUTPUT as attributes. +The LOGLEVEL attribute will define the verbosity of the component. +The LOGOUTPUT attribute will define the file of printing the logs. + +``` +{ + "LOGGER": { + "orchagent": { + "LOGLEVEL": "NOTICE", + "LOGOUTPUT": "SYSLOG" + }, + "syncd": { + "LOGLEVEL": "DEBUG", + "LOGOUTPUT": "STDOUT" + }, + "SAI_API_LAG": { + "LOGLEVEL": "ERROR", + "LOGOUTPUT": "STDERR" + } + } +} + +``` + ### PASSWORD_HARDENING Password Hardening, a user password is the key credential used in order to verify the user accessing the switch and acts as the first line of defense in regards to securing the switch. PASSWORD_HARDENING - support the enforce strong policies. diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index aee9d4650c7..8c318e583fa 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -104,19 +104,28 @@ def run(self): './yang-models/sonic-device_metadata.yang', './yang-models/sonic-device_neighbor.yang', './yang-models/sonic-device_neighbor_metadata.yang', + './yang-models/sonic-dhcp-server.yang', './yang-models/sonic-dhcpv6-relay.yang', + './yang-models/sonic-events-bgp.yang', + './yang-models/sonic-events-common.yang', + './yang-models/sonic-events-dhcp-relay.yang', + './yang-models/sonic-events-host.yang', + './yang-models/sonic-events-swss.yang', + './yang-models/sonic-events-syncd.yang', './yang-models/sonic-extension.yang', './yang-models/sonic-flex_counter.yang', './yang-models/sonic-feature.yang', './yang-models/sonic-system-defaults.yang', './yang-models/sonic-interface.yang', './yang-models/sonic-kdump.yang', + './yang-models/sonic-kubernetes_master.yang', './yang-models/sonic-loopback-interface.yang', './yang-models/sonic-lossless-traffic-pattern.yang', './yang-models/sonic-mgmt_interface.yang', './yang-models/sonic-mgmt_port.yang', './yang-models/sonic-mgmt_vrf.yang', './yang-models/sonic-mirror-session.yang', + './yang-models/sonic-mpls-tc-map.yang', './yang-models/sonic-mux-cable.yang', './yang-models/sonic-ntp.yang', './yang-models/sonic-nat.yang', @@ -139,6 +148,7 @@ def run(self): './yang-models/sonic-types.yang', './yang-models/sonic-versions.yang', './yang-models/sonic-vlan.yang', + './yang-models/sonic-voq-inband-interface.yang', './yang-models/sonic-vxlan.yang', './yang-models/sonic-vrf.yang', './yang-models/sonic-mclag.yang', @@ -148,6 +158,7 @@ def run(self): './yang-models/sonic-scheduler.yang', './yang-models/sonic-wred-profile.yang', './yang-models/sonic-queue.yang', + './yang-models/sonic-restapi.yang', './yang-models/sonic-dscp-fc-map.yang', './yang-models/sonic-exp-fc-map.yang', './yang-models/sonic-dscp-tc-map.yang', @@ -158,6 +169,7 @@ def run(self): './yang-models/sonic-peer-switch.yang', './yang-models/sonic-pfc-priority-queue-map.yang', './yang-models/sonic-pfc-priority-priority-group-map.yang', + './yang-models/sonic-logger.yang', './yang-models/sonic-port-qos-map.yang', './yang-models/sonic-static-route.yang', './yang-models/sonic-macsec.yang']), @@ -174,6 +186,12 @@ def run(self): './cvlyang-models/sonic-crm.yang', './cvlyang-models/sonic-device_metadata.yang', './cvlyang-models/sonic-device_neighbor.yang', + './cvlyang-models/sonic-events-bgp.yang', + './cvlyang-models/sonic-events-common.yang', + './cvlyang-models/sonic-events-dhcp-relay.yang', + './cvlyang-models/sonic-events-host.yang', + './cvlyang-models/sonic-events-swss.yang', + './cvlyang-models/sonic-events-syncd.yang', './cvlyang-models/sonic-device_neighbor_metadata.yang', './cvlyang-models/sonic-extension.yang', './cvlyang-models/sonic-flex_counter.yang', @@ -181,6 +199,7 @@ def run(self): './cvlyang-models/sonic-system-defaults.yang', './cvlyang-models/sonic-interface.yang', './cvlyang-models/sonic-kdump.yang', + './cvlyang-models/sonic-kubernetes_master.yang', './cvlyang-models/sonic-loopback-interface.yang', './cvlyang-models/sonic-mgmt_interface.yang', './cvlyang-models/sonic-mgmt_port.yang', @@ -216,6 +235,7 @@ def run(self): './cvlyang-models/sonic-tc-queue-map.yang', './cvlyang-models/sonic-pfc-priority-queue-map.yang', './cvlyang-models/sonic-pfc-priority-priority-group-map.yang', + './cvlyang-models/sonic-logger.yang', './cvlyang-models/sonic-port-qos-map.yang', './cvlyang-models/sonic-static-route.yang', './cvlyang-models/sonic-macsec.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 6c1f47d80f5..ab4aae47a1d 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -4,6 +4,10 @@ "Vrf_blue": { } }, + "DHCP_SERVER": { + "192.0.0.8": {}, + "192.0.0.8": {} + }, "BUFFER_POOL": { "ingress_lossy_pool": { "mode": "static", @@ -328,7 +332,8 @@ "max_cores": "8", "sub_role": "FrontEnd", "dhcp_server": "disabled", - "bgp_adv_lo_prefix_as_128": "true" + "bgp_adv_lo_prefix_as_128": "true", + "yang_config_validation": "disable" } }, "VLAN": { @@ -830,7 +835,21 @@ "role": "Int", "speed": "40000", "tpid": "0x8100" - } + } + }, + "LOGGER": { + "orchagent": { + "LOGLEVEL": "NOTICE", + "LOGOUTPUT": "SYSLOG" + }, + "syncd": { + "LOGLEVEL": "NOTICE", + "LOGOUTPUT": "SYSLOG" + }, + "SAI_API_LAG": { + "LOGLEVEL": "SAI_LOG_LEVEL_NOTICE", + "LOGOUTPUT": "SYSLOG" + } }, "ACL_TABLE": { "V4-ACL-TABLE": { @@ -1118,6 +1137,19 @@ "port": "50051" } }, + "RESTAPI": { + "certs": { + "ca_crt": "/etc/sonic/credentials/ame_root.pem", + "server_key": "/etc/sonic/credentials/restapiserver.key", + "server_crt": "/etc/sonic/credentials/restapiserver.crt", + "client_crt_cname": "client.sonic.net" + }, + "config": { + "client_auth": "true", + "log_level": "trace", + "allow_insecure": "false" + } + }, "FLEX_COUNTER_TABLE": { "PFCWD": { "FLEX_COUNTER_STATUS": "enable" @@ -1680,6 +1712,17 @@ } }, + "MPLS_TC_TO_TC_MAP": { + "Mpls_tc_to_tc_map1": { + "1": "1", + "3": "2" + }, + "Mpls_tc_to_tc_map2": { + "2": "3", + "4": "4" + } + }, + "DOT1P_TO_TC_MAP": { "Dot1p_to_tc_map1": { "1": "1", @@ -1831,7 +1874,7 @@ "server_ipv6": "fc02:1000::30/128", "soc_ipv4": "192.168.0.3/32", "state": "auto" - }, + }, "Ethernet0": { "server_ipv4": "192.168.0.2/32", "server_ipv6": "fc02:1000::30/128", @@ -1887,6 +1930,14 @@ } }, + "VOQ_INBAND_INTERFACE": { + "Ethernet-IB0": { + "inband_type": "port" + }, + "Ethernet-IB0|3.3.3.1/32": {}, + "Ethernet-IB0|3333::3:5/128": {} + }, + "PASSW_HARDENING": { "POLICIES": { "state": "enabled", @@ -2026,6 +2077,14 @@ "nexthop": "10.184.229.212", "nexthop-vrf": "default" } + }, + "KUBERNETES_MASTER": { + "SERVER": { + "disable": "True", + "insecure": "False", + "ip": "kubernetes.apiserver.com", + "port": "6443" + } } }, "SAMPLE_CONFIG_DB_UNKNOWN": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index 8a562ef536a..e55ba4c8257 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -51,6 +51,15 @@ "value": "enable" } }, + "DEVICE_METADATA_DEFAULT_YANG_CONFIG_VALIDATION": { + "desc": "DEVICE_METADATA DEFAULT VALUE FOR YANG CONFIG VALIDATION.", + "eStrKey" : "Verify", + "verify": { + "xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname", + "key": "sonic-device_metadata:yang_config_validation", + "value": "disable" + } + }, "DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN": { "desc": "DEVICE_METADATA correct value for BUFFER_MODEL field" }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server.json b/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server.json new file mode 100644 index 00000000000..bf9242f51be --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server.json @@ -0,0 +1,5 @@ +{ + "DHCP_SERVER_POSITIVE_CONFIG": { + "desc": "Configure DHCP_SERVER POSITIVE_CONFIGs." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/kubernetes_master.json b/src/sonic-yang-models/tests/yang_model_tests/tests/kubernetes_master.json new file mode 100644 index 00000000000..6518f425da1 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/kubernetes_master.json @@ -0,0 +1,27 @@ +{ + "KUBERNETES_MASTER_WITH_CORRECT_VALUES_IP": { + "desc": "CONFIG KUBERNETES_MASTER TABLE WITH ALL THE CORRECT VALUES" + }, + "KUBERNETES_MASTER_WITH_CORRECT_VALUES_DNS": { + "desc": "CONFIG KUBERNETES_MASTER TABLE WITH ALL THE CORRECT VALUES" + }, + "KUBERNETES_MASTER_WITH_INVALID_BOOLEAN_TYPE" : { + "desc": "Referring invalid kubernetes_master boolean types.", + "eStrKey": "Pattern", + "eStr": ["false|true|False|True"] + }, + "KUBERNETES_MASTER_INVALID_PORT": { + "desc": "Configure invalid PORT in kubernetes_master.", + "eStrKey": "InvalidValue" + }, + "KUBERNETES_MASTER_INVALID_IP" : { + "desc": "Configure invalid IP in kubernetes_master.", + "eStrKey": "InvalidValue", + "eStr": ["ip"] + }, + "KUBERNETES_MASTER_INVALID_DNS" : { + "desc": "Configure invalid DNS in kubernetes_master.", + "eStrKey": "InvalidValue", + "eStr": ["ip"] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/logger.json b/src/sonic-yang-models/tests/yang_model_tests/tests/logger.json new file mode 100644 index 00000000000..523755afd40 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/logger.json @@ -0,0 +1,18 @@ +{ + "LOGGER_CORRECT_LOGLEVEL_AND_LOGOUTPUT": { + "desc": "LOGGER_CORRECT_LOGLEVEL_AND_LOGOUTPUT_1 no failure." + }, + "LOGGER_WRONG_LOGLEVEL": { + "desc": "LOGGER_WRONG_LOGLEVEL pattern failure.", + "eStr": ["wrong", "LOGLEVEL"] + }, + "LOGGER_WRONG_LOGOUTPUT": { + "desc": "LOGGER_WRONG_LOGOUTPUT pattern failure.", + "eStr": ["wrong", "LOGOUTPUT"] + }, + "LOGGER_MANDATORY_LOGLEVEL": { + "desc": "LOGGER_MANDATORY_LOGOUTPUT no logoutput.", + "estr": ["LOGLEVEL"], + "eStrKey": "Mandatory" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/mpls_tc_to_tc_map.json b/src/sonic-yang-models/tests/yang_model_tests/tests/mpls_tc_to_tc_map.json new file mode 100644 index 00000000000..1362a8424e1 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/mpls_tc_to_tc_map.json @@ -0,0 +1,11 @@ +{ + "MPLS_TCP_MAP_INCORRECT_MPLS_PATTERN": { + "desc": "Configure INCORRECT_MPLS_PATTERN in MPLS_TCP_MAP Table.", + "eStr": ["Invalid MPLS"] + + }, + "MPLS_TCP_MAP_INCORRECT_TC_PATTERN": { + "desc": "Configure INCORRECT_TC_PATTERN in MPLS_TCP_MAP Table.", + "eStr": ["Invalid Traffic Class"] + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json index 3b94cedab4d..6f7af54c4ad 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json @@ -13,6 +13,12 @@ "eStrKey" : "Pattern", "eStr": ["rc"] }, + "PORT_VALID_MTU_TEST_1": { + "desc": "PORT_VALID_MTU_TEST_1 no failure." + }, + "PORT_VALID_MTU_TEST_2": { + "desc": "PORT_VALID_MTU_TEST_2 no failure." + }, "PORT_VALID_AUTONEG_TEST_1": { "desc": "PORT_VALID_AUTONEG_TEST_1 no failure." }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json b/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json new file mode 100644 index 00000000000..42ce64ba330 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json @@ -0,0 +1,16 @@ +{ + "RESTAPI_TABLE_WITH_INCORRECT_CERT": { + "desc": "RESTAPI TABLE_WITH_INCORRECT_CERT failure.", + "eStr": ["Value", "does not satisfy the constraint"] + }, + "RESTAPI_TABLE_WITH_INCORRECT_CLIENT": { + "desc": "RESTAPI TABLE_WITH_INCORRECT_CLIENT failure.", + "eStr": ["Value", "does not satisfy the constraint"] + }, + "RESTAPI_TABLE_WITH_VALID_CONFIG": { + "desc": "RESTAPI TABLE WITH VALID CONFIG." + }, + "RESTAPI_TABLE_WITH_MULTIPLE_CERTS": { + "desc": "RESTAPI TABLE WITH MULTIPLE CERTS." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json new file mode 100644 index 00000000000..6749860b2f7 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json @@ -0,0 +1,47 @@ +{ + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_IP": { + "desc": "BGP_STATE_EVENT_INCORRECT_IP failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_STATUS": { + "desc": "BGP_STATE_EVENT_INCORRECT_STATUS failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_TIMESTAMP": { + "desc": "BGP_STATE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_BGP_BGP_STATE_VALID": { + "desc": "VALID BGP STATE EVENT." + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MAJOR_CODE": { + "desc": "BGP_NOTIFICATION_INCORRECT_MAJOR_CODE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MINOR_CODE": { + "desc": "BGP_NOTIFICATION_INCORRECT_MINOR_CODE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IP": { + "desc": "BGP_NOTIFICATION_INCORRECT_IP failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IS-SENT": { + "desc": "BGP_NOTIFICATION_INCORRECT_IS-SENT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_TIMESTAMP": { + "desc": "BGP_NOTIFICATION_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_VALID": { + "desc": "VALID BGP NOTIFICATION." + }, + "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_INCORRECT_TIMESTAMP": { + "desc": "ZEBRA_NO_BUFF_EVENT_INCORRECT_TIMESTAMP.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_VALID": { + "desc": "VALID ZEBRA_NO_BUFF EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json new file mode 100644 index 00000000000..f99b279e39f --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json @@ -0,0 +1,44 @@ +{ + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_IFNAME": { + "desc": "DHCP_RELAY_DISCARD_EVENT_INCORRECT_IFNAME failure.", + "eStrKey": "InvalidValue", + "eStr": ["Eth"] + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_TIMESTAMP": { + "desc": "DHCP_RELAY_DISCARD_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_VALID": { + "desc": "VALID DHCP_RELAY_DISCARD EVENT." + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_VLAN": { + "desc": "DHCP_RELAY_DISPARITY_EVENT_INCORRECT_VLAN failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_DURATION": { + "desc": "DHCP_RELAY_DISPARITY_EVENT_INCORRECT_DURATION failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_TIMESTAMP": { + "desc": "DHCP_RELAY_DISPARITY_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_VALID": { + "desc": "VALID DHCP_RELAY_DISPARITY EVENT." + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_VLAN": { + "desc": "DHCP_RELAY_BIND_FAILURE_EVENT_INCORRECT_VLAN failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TYPE": { + "desc": "DHCP_RELAY_BIND_FAILURE_EVENT_INCORRECT_TYPE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TIMESTAMP": { + "desc": "DHCP_RELAY_BIND_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_VALID": { + "desc": "VALID DHCP_RELAY_BIND_FAILURE EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json new file mode 100644 index 00000000000..b26d8e68a53 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json @@ -0,0 +1,186 @@ +{ + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_USAGE": { + "desc": "DISK_USAGE_EVENT_INCORRECT_USAGE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_LIMIT": { + "desc": "DISK_USAGE_EVENT_INCORRECT_LIMIT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_TIMESTAMP": { + "desc": "DISK_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_DISK_USAGE_VALID": { + "desc": "VALID DISK_USAGE EVENT." + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_USAGE": { + "desc": "MEMORY_USAGE_EVENT_INCORRECT_USAGE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_LIMIT": { + "desc": "MEMORY_USAGE_EVENT_INCORRECT_LIMIT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_TIMESTAMP": { + "desc": "MEMORY_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_VALID": { + "desc": "VALID MEMORY_USAGE EVENT." + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_USAGE": { + "desc": "CPU_USAGE_EVENT_INCORRECT_USAGE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_LIMIT": { + "desc": "CPU_USAGE_EVENT_INCORRECT_LIMIT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_TIMESTAMP": { + "desc": "CPU_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_CPU_USAGE_VALID": { + "desc": "VALID CPU_USAGE EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_SSHD_INCORRECT_TIMESTAMP": { + "desc": "EVENT_SSHD_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_SSHD_VALID": { + "desc": "VALID EVENT_SSHD EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_FAIL_TYPE": { + "desc": "EVENT_DISK_EVENT_INCORRECT_FAIL_TYPE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_TIMESTAMP": { + "desc": "EVENT_DISK_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_DISK_VALID": { + "desc": "VALID EVENT_DISK EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_FAIL_TYPE": { + "desc": "EVENT_KERNEL_EVENT_INCORRECT_FAIL_TYPE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_TIMESTAMP": { + "desc": "EVENT_KERNEL_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_VALID": { + "desc": "VALID EVENT_KERNEL EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_INCORRECT_TIMESTAMP": { + "desc": "EVENT_DOWN_CTR_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_VALID": { + "desc": "VALID EVENT_DOWN_CTR EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_INCORRECT_TIMESTAMP": { + "desc": "EVENT_STOPPED_CTR_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_VALID": { + "desc": "VALID EVENT_STOPPED_CTR EVENT." + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_LIMIT": { + "desc": "WATCHDOG_TIMEOUT_EVENT_INCORRECT_LIMIT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_TIMESTAMP": { + "desc": "WATCHDOG_TIMEOUT_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_VALID": { + "desc": "VALID WATCHDOG_TIMEOUT EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_SEU_INCORRECT_TIMESTAMP": { + "desc": "EVENT_SEU_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_SEU_VALID": { + "desc": "VALID EVENT_SEU EVENT." + }, + "SONIC_EVENTS_HOST_INVALID_FREELIST_INCORRECT_TIMESTAMP": { + "desc": "INVALID_FREELIST_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_INVALID_FREELIST_VALID": { + "desc": "VALID INVALID_FREELIST EVENT." + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_CTR_NAME": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_CTR_NAME failure.", + "eStr": "Invalid ctr_name." + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_CTR_NAME_LENGTH": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_CTR_NAME_LENGTH failure.", + "eStr": "Invalid length for ctr_name." + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_MEM_USAGE": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_MEM_USAGE failure.", + "eStrKey": "InvalidValue", + "eStr": ["mem_usage"] + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_THRESHOLD": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_THRESHOLD failure.", + "eStrKey": "InvalidValue", + "eStr": ["threshold"] + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_TIMESTAMP": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_VALID": { + "desc": "VALID MEM_THRESHOLD_EXCEEDED EVENT." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_CTR_NAME": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_CTR_NAME failure.", + "eStr": "Invalid ctr_name." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_CTR_NAME_LENGTH": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_CTR_NAME_LENGTH failure.", + "eStr": "Invalid length for ctr_name." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_PROCESS_NAME": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_PROCESS_NAME failure.", + "eStr": "Invalid process_name." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_PROCESS_NAME_LENGTH": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_PROCESS_NAME_LENGTH failure.", + "eStr": "Invalid length for process_name." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_TIMESTAMP": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_VALID": { + "desc": "VALID_PROCESS_EXITED_UNEXPECTEDLY EVENT." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_CTR_NAME": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_CTR_NAME failure.", + "eStr": "Invalid ctr_name." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_CTR_NAME_LENGTH": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_CTR_NAME_LENGTH failure.", + "eStr": "Invalid length for ctr_name." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_PROCESS_NAME": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_PROCESS_NAME failure.", + "eStr": "Invalid process_name." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_PROCESS_NAME_LENGTH": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_PROCESS_NAME_LENGTH failure.", + "eStr": "Invalid length for process_name." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_TIMESTAMP": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_VALID": { + "desc": "VALID_PROCESS_NOT_RUNNING EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json new file mode 100644 index 00000000000..dec47231eb5 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json @@ -0,0 +1,84 @@ +{ + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_IFNAME": { + "desc": "IF_STATE_EVENT_INCORRECT_IFNAME failure.", + "eStrKey": "LeafRef", + "eStr": ["Eth"] + }, + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_STATUS": { + "desc": "IF_STATE_EVENT_INCORRECT_STATUS failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_TIMESTAMP": { + "desc": "IF_STATE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_IF_STATE_VALID": { + "desc": "VALID IF_STATE EVENT." + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_IFNAME": { + "desc": "PFC_STORM_EVENT_INCORRECT_IFNAME failure.", + "eStrKey": "LeafRef", + "eStr": ["Eth"] + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_INDEX": { + "desc": "PFC_STORM_EVENT_INCORRECT_QUEUE_INDEX failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_ID": { + "desc": "PFC_STORM_EVENT_INCORRECT_QUEUE_ID failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_PORT_ID": { + "desc": "PFC_STORM_EVENT_INCORRECT_PORT_ID failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_TIMESTAMP": { + "desc": "PFC_STORM_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_VALID": { + "desc": "VALID IF_STATE EVENT." + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_PERCENT": { + "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_PERCENT failure.", + "eStrKey": "Range" + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_USED_CNT": { + "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_USED_CNT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_FREE_CNT": { + "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_FREE_CNT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_TIMESTAMP": { + "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_VALID": { + "desc": "VALID CHK_CRM_THRESHOLD EVENT." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_OPERATION_RESULT": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_OPERATION_RESULT failure.", + "eStr": "Invalid select operation failure operation_result." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_OPERATION_RESULT_LENGTH": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_OPERATION_RESULT_LENGTH failure.", + "eStr": "Invalid length for select operation failure operation_result." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_COMMAND": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_COMMAND failure.", + "eStr": "Invalid select operation failure command." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_COMMAND_LENGTH": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_COMMAND_LENGTH failure.", + "eStr": "Invalid length for select operation failure command." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_TIMESTAMP": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_VALID": { + "desc": "VALID SELECT_OPERATION_FAILURE EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json new file mode 100644 index 00000000000..ed528e1bc29 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json @@ -0,0 +1,13 @@ +{ + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_FAIL_TYPE": { + "desc": "SYNCD_FAILURE_EVENT_INCORRECT_FAIL_TYPE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_TIMESTAMP": { + "desc": "SYNCD_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_VALID": { + "desc": "VALID SYNCD_FAILURE EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/voq-inband-interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests/voq-inband-interface.json new file mode 100644 index 00000000000..44531e73a8c --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/voq-inband-interface.json @@ -0,0 +1,25 @@ +{ + "VOQ_INBAND_INTERFACE_TEST": { + "desc": "Configure voq inband interface" + }, + "VOQ_INBAND_INTERFACE_WRONG_PATTERN_FOR_INTERFACE_NAME_TEST": { + "desc": "Configure incorrect interface name in VOQ_INBAND_INTERFACE table", + "eStrKey" : "Pattern", + "eStr": ["Ethernet-IB[0-9]+"] + }, + "VOQ_INBAND_INTERFACE_DEFAULT_INBAND_TYPE_TEST": { + "desc": "Configure voq_inband_interface with default inband type" + }, + "VOQ_INBAND_INTERFACE_INVALID_INBAND_TYPE_TEST": { + "desc": "Configure incorrect inband type", + "eStrKey": "Pattern" + }, + "VOQ_INBAND_INTERFACE_IP_PREFIX_PORT_NON_EXISTING_LEAF_TEST": { + "desc": "Configure ip prefix on voq-inband-interface with non-existing reference", + "eStrKey": "LeafRef" + }, + "VOQ_INBAND_INTERFACE_IP_PREFIX_EMPTY_STRING_TEST": { + "desc": "Configure ip prefix voq-inband-interface with empty ip prefix", + "eStrKey": "InvalidValue" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index ece046f2afb..638f83d562c 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -85,6 +85,17 @@ } } }, + "DEVICE_METADATA_DEFAULT_YANG_CONFIG_VALIDATION": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65001", + "hostname": "DUT-CSW", + "platform": "Stone-DX010" + } + } + } + }, "DEV_META_DEV_NEIGH_VERSION_TABLE": { "sonic-device_metadata:sonic-device_metadata": { "sonic-device_metadata:DEVICE_METADATA": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcp_server.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcp_server.json new file mode 100644 index 00000000000..9fb7ccce99f --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcp_server.json @@ -0,0 +1,16 @@ +{ + "DHCP_SERVER_POSITIVE_CONFIG": { + "sonic-dhcp-server:sonic-dhcp-server": { + "sonic-dhcp-server:DHCP_SERVER": { + "DHCP_SERVER_LIST": [ + { + "ip": "10.1.1.2" + }, + { + "ip": "10.1.9.2" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/kubernetes_master.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/kubernetes_master.json new file mode 100644 index 00000000000..096cea0ee36 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/kubernetes_master.json @@ -0,0 +1,74 @@ +{ + "KUBERNETES_MASTER_WITH_CORRECT_VALUES_IP": { + "sonic-kubernetes_master:sonic-kubernetes_master": { + "sonic-kubernetes_master:KUBERNETES_MASTER": { + "sonic-kubernetes_master:SERVER": { + "ip": "192.168.122.11", + "port": "6443", + "disable": "False", + "insecure": "True" + } + } + } + }, + "KUBERNETES_MASTER_WITH_CORRECT_VALUES_DNS": { + "sonic-kubernetes_master:sonic-kubernetes_master": { + "sonic-kubernetes_master:KUBERNETES_MASTER": { + "sonic-kubernetes_master:SERVER": { + "ip": "k8s.apiserver.com", + "port": "6443", + "disable": "False", + "insecure": "True" + } + } + } + }, + "KUBERNETES_MASTER_WITH_INVALID_BOOLEAN_TYPE": { + "sonic-kubernetes_master:sonic-kubernetes_master": { + "sonic-kubernetes_master:KUBERNETES_MASTER": { + "sonic-kubernetes_master:SERVER": { + "ip": "192.168.122.11", + "port": "6443", + "disable": "FAlse", + "insecure": "True" + } + } + } + }, + "KUBERNETES_MASTER_INVALID_PORT": { + "sonic-kubernetes_master:sonic-kubernetes_master": { + "sonic-kubernetes_master:KUBERNETES_MASTER": { + "sonic-kubernetes_master:SERVER": { + "ip": "192.168.122.11", + "port": "65536", + "disable": "False", + "insecure": "True" + } + } + } + }, + "KUBERNETES_MASTER_INVALID_IP": { + "sonic-kubernetes_master:sonic-kubernetes_master": { + "sonic-kubernetes_master:KUBERNETES_MASTER": { + "sonic-kubernetes_master:SERVER": { + "ip": "2001:aa:aa:aa", + "port": "6443", + "disable": "False", + "insecure": "True" + } + } + } + }, + "KUBERNETES_MASTER_INVALID_DNS": { + "sonic-kubernetes_master:sonic-kubernetes_master": { + "sonic-kubernetes_master:KUBERNETES_MASTER": { + "sonic-kubernetes_master:SERVER": { + "ip": "k8s@.apiserver.com", + "port": "6443", + "disable": "False", + "insecure": "True" + } + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/logger.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/logger.json new file mode 100644 index 00000000000..8ee308c8485 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/logger.json @@ -0,0 +1,55 @@ +{ + "LOGGER_CORRECT_LOGLEVEL_AND_LOGOUTPUT": { + "sonic-logger:sonic-logger": { + "sonic-logger:LOGGER": { + "LOGGER_LIST": [{ + "name": "orchagent", + "LOGLEVEL": "NOTICE", + "LOGOUTPUT": "SYSLOG" + }, + { + "name": "syncd", + "LOGLEVEL": "DEBUG", + "LOGOUTPUT": "STDOUT" + }, + { + "name": "SAI_API_LAG", + "LOGLEVEL": "SAI_LOG_LEVEL_ERROR", + "LOGOUTPUT": "STDERR" + }] + } + } + }, + "LOGGER_WRONG_LOGLEVEL": { + "sonic-logger:sonic-logger": { + "sonic-logger:LOGGER": { + "LOGGER_LIST": [{ + "name": "orchagent", + "LOGLEVEL": "wrong", + "LOGOUTPUT": "SYSLOG" + }] + } + } + }, + "LOGGER_WRONG_LOGOUTPUT": { + "sonic-logger:sonic-logger": { + "sonic-logger:LOGGER": { + "LOGGER_LIST": [{ + "name": "orchagent", + "LOGLEVEL": "NOTICE", + "LOGOUTPUT": "wrong" + }] + } + } + }, + "LOGGER_MANDATORY_LOGLEVEL": { + "sonic-logger:sonic-logger": { + "sonic-logger:LOGGER": { + "LOGGER_LIST": [{ + "name": "orchagent", + "LOGOUTPUT": "SYSLOG" + }] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/mpls_tc_to_tc_map.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mpls_tc_to_tc_map.json new file mode 100644 index 00000000000..dc11e184424 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mpls_tc_to_tc_map.json @@ -0,0 +1,36 @@ +{ + "MPLS_TCP_MAP_INCORRECT_MPLS_PATTERN": { + "sonic-mpls-tc-map:sonic-mpls-tc-map": { + "sonic-mpls-tc-map:MPLS_TC_TO_TC_MAP": { + "MPLS_TC_TO_TC_MAP_LIST": [ + { + "name": "Mpls_tc_to_tc_map1", + "MPLS_TC_TO_TC_MAP": [ + { + "mpls": "8", + "tc": "1" + } + ] + } + ] + } + } + }, + "MPLS_TCP_MAP_INCORRECT_TC_PATTERN": { + "sonic-mpls-tc-map:sonic-mpls-tc-map": { + "sonic-mpls-tc-map:MPLS_TC_TO_TC_MAP": { + "MPLS_TC_TO_TC_MAP_LIST": [ + { + "name": "Mpls_tc_to_tc_map2", + "MPLS_TC_TO_TC_MAP": [ + { + "mpls": "1", + "tc": "16" + } + ] + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json index b6ccf9ec878..684caa2432b 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json @@ -39,6 +39,36 @@ } } }, + "PORT_VALID_MTU_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "mtu": 68 + } + ] + } + } + }, + "PORT_VALID_MTU_TEST_2": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "mtu": 9216 + } + ] + } + } + }, "PORT_VALID_AUTONEG_TEST_1": { "sonic-port:sonic-port": { "sonic-port:PORT": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json new file mode 100644 index 00000000000..f2a3b15643c --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json @@ -0,0 +1,50 @@ +{ + "RESTAPI_TABLE_WITH_INCORRECT_CERT": { + "sonic-restapi:sonic-restapi": { + "sonic-restapi:RESTAPI": { + "certs": { + "ca_crt": "/etc/sonic/credentials/ame_root.pem", + "server_crt": "a/b/c", + "server_key": "/etc/sonic/credentials/restapiserver.key", + "client_crt_cname": "client" + } + } + } + }, + "RESTAPI_TABLE_WITH_INCORRECT_CLIENT": { + "sonic-restapi:sonic-restapi": { + "sonic-restapi:RESTAPI": { + "certs": { + "ca_crt": "/etc/sonic/credentials/ame_root.pem", + "server_crt": "/etc/sonic/credentials/restapiserver.crt", + "server_key": "/etc/sonic/credentials/restapiserver.key", + "client_crt_cname": "/client" + } + } + } + }, + "RESTAPI_TABLE_WITH_VALID_CONFIG": { + "sonic-restapi:sonic-restapi": { + "sonic-restapi:RESTAPI": { + "certs": { + "ca_crt": "/etc/sonic/credentials/ame_root.pem", + "server_crt": "/etc/sonic/credentials/restapiserver.crt", + "server_key": "/etc/sonic/credentials/restapiserver.key", + "client_crt_cname": "client.sonic.net" + } + } + } + }, + "RESTAPI_TABLE_WITH_MULTIPLE_CERTS": { + "sonic-restapi:sonic-restapi": { + "sonic-restapi:RESTAPI": { + "certs": { + "ca_crt": "/etc/sonic/credentials/ame_root.pem", + "server_crt": "/etc/sonic/credentials/restapiserver.crt", + "server_key": "/etc/sonic/credentials/restapiserver.key", + "client_crt_cname": "client.sonic.net,clientds.prod.net" + } + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json new file mode 100644 index 00000000000..2fa562f5efa --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json @@ -0,0 +1,118 @@ +{ + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_IP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:bgp-state": { + "ip": "INCORRECT_IP", + "status": "up", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_STATUS": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:bgp-state": { + "ip": "10.0.0.0", + "status": "INCORRECT_STATUS", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_TIMESTAMP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:bgp-state": { + "ip": "10.0.0.0", + "status": "down", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_BGP_BGP_STATE_VALID": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:bgp-state": { + "ip": "10.0.0.0", + "status": "down", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MAJOR_CODE": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": "INCORRECT_MAJOR_CODE", + "minor-code": 2, + "ip": "10.0.0.0", + "is-sent": true, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MINOR_CODE": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": "INCORRECT_MINOR_CODE", + "ip": "10.0.0.0", + "is-sent": true, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": 2, + "ip": "INCORRECT_IP", + "is-sent": true, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IS-SENT": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": 2, + "ip": "10.0.0.0", + "is-sent": "INCORRECT_VALUE", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_TIMESTAMP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": 2, + "ip": "10.0.0.0", + "is-sent": true, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_VALID": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": 2, + "ip": "10.0.0.0", + "is-sent": true, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_INCORRECT_TIMESTAMP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:zebra-no-buff": { + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_VALID": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:zebra-no-buff": { + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json new file mode 100644 index 00000000000..70d7786b71d --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json @@ -0,0 +1,173 @@ +{ + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_IFNAME": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "name": "PortChannel10" + } + ] + } + }, + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-discard": { + "ifname": "Eth", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_TIMESTAMP": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "name": "PortChannel10" + } + ] + } + }, + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-discard": { + "ifname": "Ethernet0", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_VALID": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "name": "PortChannel10" + } + ] + } + }, + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-discard": { + "ifname": "Ethernet0", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_VLAN": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-disparity": { + "vlan": "INCORRECT_VLAN", + "duration": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_DURATION": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-disparity": { + "vlan": "Agg-Vlan100", + "duration": "INCORRECT_DURATION", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_TIMESTAMP": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-disparity": { + "vlan": "Vlan100", + "duration": 0, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_VALID": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-disparity": { + "vlan": "Agg-Vlan100", + "duration": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_VLAN": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-bind-failure": { + "vlan": "INCORRECT_VLAN", + "type": "local", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TYPE": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-bind-failure": { + "vlan": "Vlan100", + "type": "INCORRECT_TYPE", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TIMESTAMP": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-bind-failure": { + "vlan": "Vlan100", + "type": "global", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_VALID": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-bind-failure": { + "vlan": "Vlan100", + "type": "local", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json new file mode 100644 index 00000000000..5c771de041b --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json @@ -0,0 +1,430 @@ +{ + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_USAGE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:disk-usage": { + "fs": "FILESYSTEM", + "usage": -30, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_LIMIT": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:disk-usage": { + "fs": "FILESYSTEM", + "usage": 32, + "limit": "INCORRECT_LIMIT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:disk-usage": { + "fs": "FILESYSTEM", + "usage": 32, + "limit": 99, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_DISK_USAGE_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:disk-usage": { + "fs": "FILESYSTEM", + "usage": 32, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_USAGE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:memory-usage": { + "usage": -30, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_LIMIT": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:memory-usage": { + "usage": 32, + "limit": "INCORRECT_LIMIT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:memory-usage": { + "usage": 32, + "limit": 99, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:memory-usage": { + "usage": 32, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_USAGE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:cpu-usage": { + "usage": -30, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_LIMIT": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:cpu-usage": { + "usage": 32, + "limit": "INCORRECT_LIMIT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:cpu-usage": { + "usage": 32, + "limit": 99, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_CPU_USAGE_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:cpu-usage": { + "usage": 32, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_SSHD_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-sshd": { + "username": "username", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_SSHD_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-sshd": { + "username": "username", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_FAIL_TYPE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-disk": { + "fail_type": -32, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-disk": { + "fail_type": "read_only", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DISK_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-disk": { + "fail_type": "read_only", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_FAIL_TYPE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-kernel": { + "fail_type": -32, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-kernel": { + "fail_type": "write_failed", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-kernel": { + "fail_type": "write_protected", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-down-ctr": { + "ctr_name": "container_name", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-down-ctr": { + "ctr_name": "container_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-stopped-ctr": { + "ctr_name": "container_name", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-stopped-ctr": { + "ctr_name": "container_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_LIMIT": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:watchdog-timeout": { + "limit": "INCORRECT_LIMIT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:watchdog-timeout": { + "limit": 5, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:watchdog-timeout": { + "limit": 5, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_SEU_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-seu": { + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_SEU_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-seu": { + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_INVALID_FREELIST_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:invalid-freelist": { + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_INVALID_FREELIST_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:invalid-freelist": { + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_CTR_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "Invalid$", + "mem_usage": 123456, + "threshold": 123456, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_CTR_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "invalid-length-for-ctr-name-too-long", + "mem_usage": 123456, + "threshold": 123456, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_MEM_USAGE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "container_name", + "mem_usage": "INCORRECT_MEM_USAGE", + "threshold": 123456, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_THRESHOLD": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "container_name", + "mem_usage": 123456, + "threshold": "INCORRECT_THRESHOLD", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "container_name", + "mem_usage": 123456, + "threshold": 123456, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "container_name", + "mem_usage": 123456, + "threshold": 123456, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_CTR_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "Invalid$", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_CTR_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "invalid-length-for-ctr-name-too-long", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_PROCESS_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "container_name", + "process_name": "Invalid$", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_PROCESS_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "container_name", + "process_name": "invalid-length-for-process-name-too-long", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "container_name", + "process_name": "process_name", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "container_name", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_CTR_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "Invalid$", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_CTR_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "invalid-length-for-ctr-name-too-long", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_PROCESS_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "container_name", + "process_name": "Invalid$", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_PROCESS_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "container_name", + "process_name": "invalid-length-for-process-name-too-long", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "container_name", + "process_name": "process_name", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "container_name", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json new file mode 100644 index 00000000000..62ce9c35c2e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json @@ -0,0 +1,358 @@ +{ + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_IFNAME": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:if-state": { + "ifname": "Eth", + "status": "up", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_STATUS": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:if-state": { + "ifname": "Ethernet0", + "status": "INCORRECT_STATUS", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_TIMESTAMP": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:if-state": { + "ifname": "Ethernet0", + "status": "down", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SWSS_IF_STATE_VALID": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:if-state": { + "ifname": "Ethernet0", + "status": "down", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_IFNAME": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Eth", + "queue_index": 0, + "queue_id": 0, + "port_id": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_INDEX": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": "INCORRECT_QUEUE_INDEX", + "queue_id": 0, + "port_id": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_ID": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": "INCORRECT_QUEUE_ID", + "port_id": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_PORT_ID": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": 0, + "port_id": "INCORRECT_PORT_ID", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_TIMESTAMP": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": 0, + "port_id": 0, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_VALID": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": 65, + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": 0, + "port_id": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_PERCENT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 123, + "used_cnt": 0, + "free_cnt": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_USED_CNT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 0, + "used_cnt": "INCORRECT_USED_CNT", + "free_cnt": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_FREE_CNT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 0, + "used_cnt": 0, + "free_cnt": "INCORRECT_FREE_CNT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_TIMESTAMP": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 0, + "used_cnt": 0, + "free_cnt": 0, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_VALID": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 0, + "used_cnt": 0, + "free_cnt": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_OPERATION_RESULT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "Invalid$", + "command": "command", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_OPERATION_RESULT_LENGTH": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "invalid-length-for-operation-result-too-long", + "command": "command", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_COMMAND": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "operation_result", + "command": "Invalid$", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_COMMAND_LENGTH": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "operation_result", + "command": "invalid-length-for-command-too-long", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_TIMESTAMP": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "operation_result", + "command": "command", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_VALID": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "operation_result", + "command": "command", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json new file mode 100644 index 00000000000..778aad816b1 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json @@ -0,0 +1,26 @@ +{ + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_FAIL_TYPE": { + "sonic-events-syncd:sonic-events-syncd": { + "sonic-events-syncd:syncd-failure": { + "fail_type": "INCORRECT_FAIL_TYPE", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_TIMESTAMP": { + "sonic-events-syncd:sonic-events-syncd": { + "sonic-events-syncd:syncd-failure": { + "fail_type": "mmu_err", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_VALID": { + "sonic-events-syncd:sonic-events-syncd": { + "sonic-events-syncd:syncd-failure": { + "fail_type": "switch_event", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/voq-inband-interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/voq-inband-interface.json new file mode 100644 index 00000000000..7fdb07bb2ba --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/voq-inband-interface.json @@ -0,0 +1,121 @@ +{ + "VOQ_INBAND_INTERFACE_TEST": { + "sonic-voq-inband-interface:sonic-voq-inband-interface" : { + "sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": { + "VOQ_INBAND_INTERFACE_LIST": [ + { + "name": "Ethernet-IB0", + "inband_type": "port" + } + ], + "VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet-IB0", + "ip-prefix": "3.3.3.1/32" + }, + { + "name": "Ethernet-IB0", + "ip-prefix": "3333::3:5/128" + } + ] + } + } + }, + "VOQ_INBAND_INTERFACE_WRONG_PATTERN_FOR_INTERFACE_NAME_TEST": { + "sonic-voq-inband-interface:sonic-voq-inband-interface" : { + "sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": { + "VOQ_INBAND_INTERFACE_LIST": [ + { + "name": "Ethernet-0IB", + "inband_type": "port" + } + ], + "VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet-0IB", + "ip-prefix": "3.3.3.1/32" + }, + { + "name": "Ethernet-0IB", + "ip-prefix": "3333::3:5/128" + } + ] + } + } + }, + "VOQ_INBAND_INTERFACE_DEFAULT_INBAND_TYPE_TEST": { + "sonic-voq-inband-interface:sonic-voq-inband-interface" : { + "sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": { + "VOQ_INBAND_INTERFACE_LIST": [ + { + "name": "Ethernet-IB0" + } + ], + "VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet-IB0", + "ip-prefix": "3.3.3.1/32" + } + ] + } + } + }, + "VOQ_INBAND_INTERFACE_INVALID_INBAND_TYPE_TEST": { + "sonic-voq-inband-interface:sonic-voq-inband-interface" : { + "sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": { + "VOQ_INBAND_INTERFACE_LIST": [ + { + "name": "Ethernet-IB0", + "inband_type": "System-port" + } + ], + "VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet-IB0", + "ip-prefix": "3.3.3.1/32" + } + ] + } + } + }, + "VOQ_INBAND_INTERFACE_IP_PREFIX_PORT_NON_EXISTING_LEAF_TEST": { + "sonic-voq-inband-interface:sonic-voq-inband-interface" : { + "sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": { + "VOQ_INBAND_INTERFACE_LIST": [ + { + "name": "Ethernet-IB0", + "inband_type": "port" + } + ], + "VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet-IB0", + "ip-prefix": "3.3.3.1/32" + }, + { + "name": "Ethernet-IB1", + "ip-prefix": "3333::3:5/128" + } + ] + } + } + }, + "VOQ_INBAND_INTERFACE_IP_PREFIX_EMPTY_STRING_TEST": { + "sonic-voq-inband-interface:sonic-voq-inband-interface" : { + "sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": { + "VOQ_INBAND_INTERFACE_LIST": [ + { + "name": "Ethernet-IB0", + "inband_type": "port" + } + ], + "VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet-IB0", + "ip-prefix": "" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-auto_techsupport.yang b/src/sonic-yang-models/yang-models/sonic-auto_techsupport.yang index 02e29463d59..078609c0e1f 100644 --- a/src/sonic-yang-models/yang-models/sonic-auto_techsupport.yang +++ b/src/sonic-yang-models/yang-models/sonic-auto_techsupport.yang @@ -2,7 +2,7 @@ module sonic-auto_techsupport { yang-version 1.1; - namespace "http://github.com/Azure/sonic-auto_techsupport"; + namespace "http://github.com/sonic-net/sonic-auto_techsupport"; prefix auto_techsupport; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-allowed-prefix.yang b/src/sonic-yang-models/yang-models/sonic-bgp-allowed-prefix.yang index 94238798377..65f5dab7473 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-allowed-prefix.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-allowed-prefix.yang @@ -1,5 +1,5 @@ module sonic-bgp-allowed-prefix { - namespace "http://github.com/Azure/sonic-bgp-allowed-prefix"; + namespace "http://github.com/sonic-net/sonic-bgp-allowed-prefix"; prefix bgppre; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-common.yang b/src/sonic-yang-models/yang-models/sonic-bgp-common.yang index 1c360faa9cd..5d9f7102632 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-common.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-common.yang @@ -1,5 +1,5 @@ module sonic-bgp-common { - namespace "http://github.com/Azure/sonic-bgp-common"; + namespace "http://github.com/sonic-net/sonic-bgp-common"; prefix bgpcmn; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-device-global.yang b/src/sonic-yang-models/yang-models/sonic-bgp-device-global.yang index 728714c7d51..277be687092 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-device-global.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-device-global.yang @@ -1,5 +1,5 @@ module sonic-bgp-device-global { - namespace "http://github.com/Azure/sonic-bgp-device-global"; + namespace "http://github.com/sonic-net/sonic-bgp-device-global"; prefix bgp_device_global; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-global.yang b/src/sonic-yang-models/yang-models/sonic-bgp-global.yang index a428635e603..db6c02356aa 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-global.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-global.yang @@ -1,5 +1,5 @@ module sonic-bgp-global { - namespace "http://github.com/Azure/sonic-bgp-global"; + namespace "http://github.com/sonic-net/sonic-bgp-global"; prefix bgpg; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang b/src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang index 69a089f7cab..a58f404cb69 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang @@ -1,5 +1,5 @@ module sonic-bgp-internal-neighbor { - namespace "http://github.com/Azure/sonic-bgp-internal-neighbor"; + namespace "http://github.com/sonic-net/sonic-bgp-internal-neighbor"; prefix bgpintnbr; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang b/src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang index d152ea94166..537a919b6f9 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang @@ -1,5 +1,5 @@ module sonic-bgp-monitor { - namespace "http://github.com/Azure/sonic-bgp-monitor"; + namespace "http://github.com/sonic-net/sonic-bgp-monitor"; prefix bgpmon; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang b/src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang index 12432ffc35b..3ae4d89d52d 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang @@ -1,5 +1,5 @@ module sonic-bgp-neighbor { - namespace "http://github.com/Azure/sonic-bgp-neighbor"; + namespace "http://github.com/sonic-net/sonic-bgp-neighbor"; prefix bgpnbr; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-peergroup.yang b/src/sonic-yang-models/yang-models/sonic-bgp-peergroup.yang index 0cc9d5cb3f6..a1f9bd2ce9e 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-peergroup.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-peergroup.yang @@ -1,5 +1,5 @@ module sonic-bgp-peergroup { - namespace "http://github.com/Azure/sonic-bgp-peergroup"; + namespace "http://github.com/sonic-net/sonic-bgp-peergroup"; prefix pg; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-peerrange.yang b/src/sonic-yang-models/yang-models/sonic-bgp-peerrange.yang index 88d39d82d68..01348096cca 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-peerrange.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-peerrange.yang @@ -1,5 +1,5 @@ module sonic-bgp-peerrange { - namespace "http://github.com/Azure/sonic-bgp-peerrange"; + namespace "http://github.com/sonic-net/sonic-bgp-peerrange"; prefix pr; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-voq-chassis-neighbor.yang b/src/sonic-yang-models/yang-models/sonic-bgp-voq-chassis-neighbor.yang index 662f77c3c89..ad4d227ee0a 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-voq-chassis-neighbor.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-voq-chassis-neighbor.yang @@ -1,5 +1,5 @@ module sonic-bgp-voq-chassis-neighbor { - namespace "http://github.com/Azure/sonic-bgp-voq-chassis-neighbor"; + namespace "http://github.com/sonic-net/sonic-bgp-voq-chassis-neighbor"; prefix bgpintnbr; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang b/src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang index 85c0cf997d4..7d77669c19d 100644 --- a/src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang +++ b/src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang @@ -2,7 +2,7 @@ module sonic-breakout_cfg { yang-version 1.1; - namespace "http://github.com/Azure/sonic-breakout_cfg"; + namespace "http://github.com/sonic-net/sonic-breakout_cfg"; prefix breakout_cfg; import sonic-extension { diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang index 60d06bf6ef6..2886174faed 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang @@ -1,5 +1,5 @@ module sonic-buffer-pg { - namespace "http://github.com/Azure/sonic-buffer-pg"; + namespace "http://github.com/sonic-net/sonic-buffer-pg"; prefix bpg; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang index c59d4ec66ab..fd83218573b 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang @@ -1,5 +1,5 @@ module sonic-buffer-pool { - namespace "http://github.com/Azure/sonic-buffer-pool"; + namespace "http://github.com/sonic-net/sonic-buffer-pool"; prefix bpl; organization diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang index 10af27b7745..6c1a75fbfd3 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang @@ -1,5 +1,5 @@ module sonic-buffer-port-egress-profile-list { - namespace "http://github.com/Azure/sonic-buffer-port-egress-profile-list"; + namespace "http://github.com/sonic-net/sonic-buffer-port-egress-profile-list"; prefix bpg; import sonic-extension { diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang index 603f50bf2ec..01a7f6bb6e2 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang @@ -1,5 +1,5 @@ module sonic-buffer-port-ingress-profile-list { - namespace "http://github.com/Azure/sonic-buffer-port-ingress-profile-list"; + namespace "http://github.com/sonic-net/sonic-buffer-port-ingress-profile-list"; prefix bpg; import sonic-extension { diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang index 204e8aa796b..418302e9fc6 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -1,5 +1,5 @@ module sonic-buffer-profile { - namespace "http://github.com/Azure/sonic-buffer-profile"; + namespace "http://github.com/sonic-net/sonic-buffer-profile"; prefix bpf; import sonic-buffer-pool { diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang index f8c951aa4dd..bd1130fcc4e 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang @@ -1,5 +1,5 @@ module sonic-buffer-queue { - namespace "http://github.com/Azure/sonic-buffer-queue"; + namespace "http://github.com/sonic-net/sonic-buffer-queue"; prefix bqueue; import sonic-extension { diff --git a/src/sonic-yang-models/yang-models/sonic-cable-length.yang b/src/sonic-yang-models/yang-models/sonic-cable-length.yang index 2af765f17d1..84ca01f34a0 100644 --- a/src/sonic-yang-models/yang-models/sonic-cable-length.yang +++ b/src/sonic-yang-models/yang-models/sonic-cable-length.yang @@ -2,7 +2,7 @@ module sonic-cable-length { yang-version 1.1; - namespace "http://github.com/Azure/sonic-cable-length"; + namespace "http://github.com/sonic-net/sonic-cable-length"; prefix cable-length; diff --git a/src/sonic-yang-models/yang-models/sonic-console.yang b/src/sonic-yang-models/yang-models/sonic-console.yang index ed0af5390f4..65a8e0dc5b4 100644 --- a/src/sonic-yang-models/yang-models/sonic-console.yang +++ b/src/sonic-yang-models/yang-models/sonic-console.yang @@ -1,6 +1,6 @@ module sonic-console { yang-version 1.1; - namespace "http://github.com/Azure/sonic-console"; + namespace "http://github.com/sonic-net/sonic-console"; prefix console; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-copp.yang b/src/sonic-yang-models/yang-models/sonic-copp.yang index d735150a5c4..0c282472548 100644 --- a/src/sonic-yang-models/yang-models/sonic-copp.yang +++ b/src/sonic-yang-models/yang-models/sonic-copp.yang @@ -2,7 +2,7 @@ module sonic-copp { yang-version 1.1; - namespace "http://github.com/Azure/sonic-copp"; + namespace "http://github.com/sonic-net/sonic-copp"; prefix copp; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-crm.yang b/src/sonic-yang-models/yang-models/sonic-crm.yang index f554358645f..87b36276d66 100644 --- a/src/sonic-yang-models/yang-models/sonic-crm.yang +++ b/src/sonic-yang-models/yang-models/sonic-crm.yang @@ -2,7 +2,7 @@ module sonic-crm { yang-version 1.1; - namespace "http://github.com/Azure/sonic-crm"; + namespace "http://github.com/sonic-net/sonic-crm"; prefix crm; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-default-lossless-buffer-parameter.yang b/src/sonic-yang-models/yang-models/sonic-default-lossless-buffer-parameter.yang index 6f98d9a922b..4fccf943fc3 100644 --- a/src/sonic-yang-models/yang-models/sonic-default-lossless-buffer-parameter.yang +++ b/src/sonic-yang-models/yang-models/sonic-default-lossless-buffer-parameter.yang @@ -2,7 +2,7 @@ module sonic-default-lossless-buffer-parameter { yang-version 1.1; - namespace "http://github.com/Azure/sonic-default-lossless-buffer-parameter"; + namespace "http://github.com/sonic-net/sonic-default-lossless-buffer-parameter"; prefix default-lossless-buffer-parameter; diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index b04f929cddc..d7b92bea82f 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -2,7 +2,7 @@ module sonic-device_metadata { yang-version 1.1; - namespace "http://github.com/Azure/sonic-device_metadata"; + namespace "http://github.com/sonic-net/sonic-device_metadata"; prefix device_metadata; import ietf-yang-types { @@ -119,6 +119,11 @@ module sonic-device_metadata { default enable; } + leaf yang_config_validation { + type stypes:mode-status; + default disable; + } + leaf cloudtype { type string; } diff --git a/src/sonic-yang-models/yang-models/sonic-device_neighbor.yang b/src/sonic-yang-models/yang-models/sonic-device_neighbor.yang index a7284ccec50..efca22dafe6 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_neighbor.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_neighbor.yang @@ -2,7 +2,7 @@ module sonic-device_neighbor { yang-version 1.1; - namespace "http://github.com/Azure/sonic-device_neighbor"; + namespace "http://github.com/sonic-net/sonic-device_neighbor"; prefix device_neighbor; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang index 76526f801c9..6f1aa6b84d7 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang @@ -2,7 +2,7 @@ module sonic-device_neighbor_metadata { yang-version 1.1; - namespace "http://github.com/Azure/sonic-device_neighbor_metadata"; + namespace "http://github.com/sonic-net/sonic-device_neighbor_metadata"; prefix device_neighbor_metadata; import ietf-yang-types { diff --git a/src/sonic-yang-models/yang-models/sonic-dhcp-server.yang b/src/sonic-yang-models/yang-models/sonic-dhcp-server.yang new file mode 100644 index 00000000000..0ca5e8636c9 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-dhcp-server.yang @@ -0,0 +1,52 @@ +module sonic-dhcp-server { + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-dhcp-server"; + + prefix dhcp-server; + + import ietf-inet-types { + prefix inet; + } + + import sonic-port { + prefix port; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description "DHCP SERVER YANG module for SONiC OS"; + + revision 2022-09-23 { + description "Initial version"; + } + + container sonic-dhcp-server { + + container DHCP_SERVER { + + description "DHCP_SERVER part of config_db.json"; + + list DHCP_SERVER_LIST { + + description "List of IPs in DHCP_SERVER Table"; + + key "ip"; + + leaf ip { + description "IP as DHCP_SERVER"; + type inet:ipv4-address; + } + + } /* end of list IPS_LIST */ + + } /* end of container DHCP_SERVER */ + + } /* end of container sonic-dhcp-server */ + +} /* end of module sonic-dhcp-server */ diff --git a/src/sonic-yang-models/yang-models/sonic-dhcpv6-relay.yang b/src/sonic-yang-models/yang-models/sonic-dhcpv6-relay.yang index f1e73397dff..80794114e64 100644 --- a/src/sonic-yang-models/yang-models/sonic-dhcpv6-relay.yang +++ b/src/sonic-yang-models/yang-models/sonic-dhcpv6-relay.yang @@ -1,6 +1,6 @@ module sonic-dhcpv6-relay { - namespace "http://github.com/Azure/sonic-dhcpv6-relay"; + namespace "http://github.com/sonic-net/sonic-dhcpv6-relay"; prefix sdhcpv6relay; diff --git a/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang index 1636f43f6c6..12564956b11 100644 --- a/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang @@ -2,7 +2,7 @@ module sonic-dot1p-tc-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-dot1p-tc-map"; + namespace "http://github.com/sonic-net/sonic-dot1p-tc-map"; prefix dot1ptm; diff --git a/src/sonic-yang-models/yang-models/sonic-dscp-fc-map.yang b/src/sonic-yang-models/yang-models/sonic-dscp-fc-map.yang index 0b489a57bd0..369064ea588 100644 --- a/src/sonic-yang-models/yang-models/sonic-dscp-fc-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-dscp-fc-map.yang @@ -2,7 +2,7 @@ module sonic-dscp-fc-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-dscp-fc-map"; + namespace "http://github.com/sonic-net/sonic-dscp-fc-map"; prefix dtm; diff --git a/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang index fb590b85c6f..8bfc02fdf5f 100644 --- a/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang @@ -2,7 +2,7 @@ module sonic-dscp-tc-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-dscp-tc-map"; + namespace "http://github.com/sonic-net/sonic-dscp-tc-map"; prefix dtm; diff --git a/src/sonic-yang-models/yang-models/sonic-events-bgp.yang b/src/sonic-yang-models/yang-models/sonic-events-bgp.yang new file mode 100644 index 00000000000..26d2b85e954 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-bgp.yang @@ -0,0 +1,94 @@ +module sonic-events-bgp { + namespace "http://github.com/sonic-net/sonic-events-bgp"; + prefix events-bgp; + yang-version 1.1; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + import sonic-types { + prefix stypes; + } + + import ietf-inet-types { + prefix inet; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BGP events"; + + revision 2022-12-01 { + description "BGP alert events."; + } + + container sonic-events-bgp { + container bgp-state { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for BGP state for a neighbor IP going up/down."; + + leaf ip { + type inet:ip-address; + description "IP of neighbor"; + } + + leaf status { + type stypes:admin_status; + description "Provides the status as up (true) or down (false)"; + } + + uses evtcmn:sonic-events-cmn; + } + + container notification { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Reports an notification. + The error codes as per IANA. + The other params are as in the message"; + + leaf major-code { + type uint8; + description "Major IANA error code; [RFC4271][RFC7313]"; + } + + leaf minor-code { + type uint8; + description "Minor IANA error code; [RFC4271][RFC7313]"; + } + + leaf ip { + type inet:ip-address; + description "IP of neighbor associated with this notification"; + } + + leaf is-sent { + type boolean; + description "true - if this notification was for sent messages; false if it was for received."; + } + + uses evtcmn:sonic-events-cmn; + } + + container zebra-no-buff { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for zebra running out of buffer. + This event does not have any other parameter. + Hence source + tag identifies an event"; + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-common.yang b/src/sonic-yang-models/yang-models/sonic-events-common.yang new file mode 100644 index 00000000000..822a6eefaf4 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-common.yang @@ -0,0 +1,80 @@ +module sonic-events-common { + namespace "http://github.com/sonic-net/sonic-events-common"; + prefix evtcmn; + yang-version 1.1; + + import ietf-yang-types { + prefix yang; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC Events common definition"; + + revision 2022-12-01 { + description + "Common reusable definitions"; + } + + grouping sonic-events-cmn { + leaf timestamp { + type yang:date-and-time; + description "time of the event"; + } + } + + grouping sonic-events-usage { + leaf usage { + type uint8 { + range "0..100" { + error-message "Incorrect val for %"; + } + } + description "Percentage in use"; + } + + leaf limit { + type uint8 { + range "0..100" { + error-message "Incorrect val for %"; + } + } + description "Percentage limit set"; + } + } + + extension EVENT_SEVERITY_2 { + description + "Indicates that the severity level of this type of event is 2"; + } + + extension EVENT_SEVERITY_3 { + description + "Indicates that the severity level of this type of event is 3"; + } + + extension EVENT_SEVERITY_4 { + description + "Indicates that the severity level of this type of event is 4"; + } + + extension ALARM_SEVERITY_MINOR { + description + "Indicates the existence of a non-service affecting fault condition + and that corrective action should be taken in order to prevent a more serious + (for example, service affecting) fault. Such a severity can be reported, + for example, when the detected alarm condition is not currently degrading the capacity of the resource"; + } + + extension ALARM_SEVERITY_MAJOR { + description + "Indicates that a service affecting condition has developed and an urgent corrective + action is required. Such a severity can be reported, for example, when there is a severe + degradation in the capability of the resource and its full capability must be restored."; + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang b/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang new file mode 100644 index 00000000000..1c85a55347d --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang @@ -0,0 +1,109 @@ +module sonic-events-dhcp-relay { + namespace "http://github.com/sonic-net/sonic-events-dhcp-relay"; + yang-version 1.1; + prefix events-dhcp-relay; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + import sonic-port { + prefix port; + } + + import sonic-portchannel { + prefix lag; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC dhcp-relay events"; + + revision 2022-12-01 { + description "dhcp-relay alert events."; + } + + container sonic-events-dhcp-relay { + container dhcp-relay-discard { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for dhcp-relay discarding packet on an + interface due to missing IP address assigned. + Params: + name of the interface discarding."; + + leaf ifname { + 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"; + } + } + description "Name of the i/f discarding"; + } + + uses evtcmn:sonic-events-cmn; + } + + container dhcp-relay-disparity { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for disparity detected in + DHCP Relay behavior by dhcpmon. + parameters: + vlan that shows this disparity + The duration of disparity"; + + leaf vlan { + type string { + pattern '(Agg-Vlan|Vlan)([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])'; + } + description "Name of the vlan affected"; + } + + leaf duration { + type uint32; + description "Duration of disparity"; + } + + uses evtcmn:sonic-events-cmn; + } + + container dhcp-relay-bind-failure { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for socket binding failure. + parameters: + vlan that shows this failure + type either local or global"; + + leaf vlan { + type string { + pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])'; + } + description "Name of the vlan affected"; + } + + leaf type { + type enumeration { + enum "local"; + enum "global"; + } + description "Address type"; + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-host.yang b/src/sonic-yang-models/yang-models/sonic-events-host.yang new file mode 100644 index 00000000000..cbb129d9fe2 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-host.yang @@ -0,0 +1,249 @@ +module sonic-events-host { + namespace "http://github.com/sonic-net/sonic-events-host"; + yang-version 1.1; + prefix events-host; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + import sonic-types { + prefix stypes; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "YANG schema defined for host events"; + + revision 2022-12-01 { + description "BGP alert events."; + } + + container sonic-events-host { + container disk-usage { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for disk usage crossing set limit + The parameters describe the usage & limit set."; + + leaf fs { + type string; + description "Name of the file system"; + } + + uses evtcmn:sonic-events-usage; + + uses evtcmn:sonic-events-cmn; + } + + container memory-usage { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for memory usage crossing set limit + The parameters describe the usage & limit set."; + + uses evtcmn:sonic-events-usage; + + uses evtcmn:sonic-events-cmn; + } + + container cpu-usage { + evtcmn:ALARM_SEVERITY_MINOR; + description " + Declares an event for cpu usage crossing set limit + The parameters describe the usage & limit set."; + + uses evtcmn:sonic-events-usage; + + uses evtcmn:sonic-events-cmn; + } + + container event-sshd { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares and event reported by sshd. + This implies an internal system state blocks sshd from + creating the new user."; + + leaf username { + type string; + description "Name of the new user"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-disk { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event reported by disk check. + The fail type declares the type of failure. + read-only - denotes that disk is in RO state."; + + leaf fail_type { + type enumeration { + enum "read_only"; + } + description "Type of failure"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-kernel { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event reported by kernel. + The fail type declares the type of failure."; + + leaf fail_type { + type enumeration { + enum "write_failed"; + enum "write_protected"; + enum "remount_read_only"; + enum "zlib_decompress"; + } + description "Type of failure"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-down-ctr { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an container that is expected to be up is down. + Reported by monit periodically."; + + leaf ctr_name { + type string; + description "Name of the container not running"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-stopped-ctr { + evtcmn:EVENT_SEVERITY_2; + + description " + Declare an event at the time point of container stopping. + event-down-ctr fires periodically until it starts up."; + + leaf ctr_name { + type string; + description "Name of the container"; + } + + uses evtcmn:sonic-events-cmn; + } + + container watchdog-timeout { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event for watchdog timeout failure. + Params: + limit provides max timeout limit"; + + leaf limit { + type uint8; + description "Timeout limit"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-seu { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event for SEU error."; + + uses evtcmn:sonic-events-cmn; + } + + container invalid-freelist { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event for invalid freelist failure."; + + uses evtcmn:sonic-events-cmn; + } + + container mem-threshold-exceeded { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event for memory exceeding threshold failure."; + + leaf ctr_name { + type stypes:ctr_name; + description "Container name of mem-threshold-exceeded event"; + } + + leaf mem_usage { + type uint64; + description "Memory usage of process"; + } + + leaf threshold { + type uint64; + description "Threshold value of process"; + } + + uses evtcmn:sonic-events-cmn; + } + + container process-exited-unexpectedly { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event in which a critical process exits unexpectedly."; + + leaf process_name { + type stypes:process_name; + description "Name of process that is exiting unexpectedly"; + } + + leaf ctr_name { + type stypes:ctr_name; + description "Container name of process that is exiting unexpectedly"; + } + + uses evtcmn:sonic-events-cmn; + } + + container process-not-running { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event in which a critical process exits unexpectedly."; + + leaf process_name { + type stypes:process_name; + description "Name of process that is not running"; + } + + leaf ctr_name { + type stypes:ctr_name; + description "Container name"; + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-swss.yang b/src/sonic-yang-models/yang-models/sonic-events-swss.yang new file mode 100644 index 00000000000..33a3999364c --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-swss.yang @@ -0,0 +1,145 @@ +module sonic-events-swss { + namespace "http://github.com/sonic-net/sonic-events-swss"; + yang-version 1.1; + prefix events-swss; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + import sonic-types { + prefix stypes; + } + + import sonic-port { + prefix port; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC SWSS events"; + + revision 2022-12-01 { + description "SWSS alert events."; + } + + container sonic-events-swss { + container if-state { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for i/f flap. + The name of the flapping i/f and status are the only params."; + + leaf ifname { + type leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + description "Interface name"; + } + + leaf status { + type stypes:admin_status; + description "Provides the status as up (true) or down (false)"; + } + + uses evtcmn:sonic-events-cmn; + } + + container pfc-storm { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for PFC storm. + The name of the i/f facing the storm is the only param."; + + leaf ifname { + type leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + description "Interface name"; + } + + leaf queue_index { + type uint8; + } + + leaf queue_id { + type uint64; + } + + leaf port_id { + type uint64; + } + + uses evtcmn:sonic-events-cmn; + } + + container chk_crm_threshold { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for CRM threshold."; + + leaf percent { + type uint8 { + range 0..100; + } + description "percentage used"; + } + + leaf used_cnt { + type uint8; + } + + leaf free_cnt { + type uint64; + } + + uses evtcmn:sonic-events-cmn; + } + + container select-operation-failure { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Describes select operation fails due to timeout or other reason."; + + leaf operation_result { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid select operation failure operation_result."; + error-app-tag select-operation-failure-invalid-operation-result; + } + length 1..32 { + error-message "Invalid length for select operation failure operation_result."; + error-app-tag select-operation-failure-invalid-operation-result-length; + } + } + description "Select operation result"; + } + + leaf command { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid select operation failure command."; + error-app-tag select-operation-failure-invalid-command; + } + length 1..32 { + error-message "Invalid length for select operation failure command."; + error-app-tag select-operation-failure-invalid-command-length; + } + } + description "Operation command."; + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-syncd.yang b/src/sonic-yang-models/yang-models/sonic-events-syncd.yang new file mode 100644 index 00000000000..945afd79cf6 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-syncd.yang @@ -0,0 +1,47 @@ +module sonic-events-syncd { + namespace "http://github.com/sonic-net/sonic-events-syncd"; + yang-version 1.1; + prefix events-syncd; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC syncd events"; + + revision 2022-12-01 { + description "syncd alert events."; + } + + container sonic-events-syncd { + container syncd-failure { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for all types of syncd failure. + The type of failure and the asic-index of failing syncd are + provided along with a human readable message to give the + dev debugging additional info."; + + leaf fail_type { + type enumeration { + enum "route_add_failed"; + enum "switch_event"; + enum "assert"; + enum "mmu_err"; + enum "parity_check"; + } + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-exp-fc-map.yang b/src/sonic-yang-models/yang-models/sonic-exp-fc-map.yang index 79f492bff4f..43f182c03bd 100644 --- a/src/sonic-yang-models/yang-models/sonic-exp-fc-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-exp-fc-map.yang @@ -2,7 +2,7 @@ module sonic-exp-fc-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-exp-fc-map"; + namespace "http://github.com/sonic-net/sonic-exp-fc-map"; prefix dtm; diff --git a/src/sonic-yang-models/yang-models/sonic-feature.yang b/src/sonic-yang-models/yang-models/sonic-feature.yang index f27411788e8..797affc7ca3 100644 --- a/src/sonic-yang-models/yang-models/sonic-feature.yang +++ b/src/sonic-yang-models/yang-models/sonic-feature.yang @@ -2,7 +2,7 @@ module sonic-feature{ yang-version 1.1; - namespace "http://github.com/Azure/sonic-feature"; + namespace "http://github.com/sonic-net/sonic-feature"; prefix feature; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-flex_counter.yang b/src/sonic-yang-models/yang-models/sonic-flex_counter.yang index 9ced223e94b..e94aa76ccf4 100644 --- a/src/sonic-yang-models/yang-models/sonic-flex_counter.yang +++ b/src/sonic-yang-models/yang-models/sonic-flex_counter.yang @@ -2,7 +2,7 @@ module sonic-flex_counter { yang-version 1.1; - namespace "http://github.com/Azure/sonic-flex_counter"; + namespace "http://github.com/sonic-net/sonic-flex_counter"; prefix flex_counter; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-interface.yang b/src/sonic-yang-models/yang-models/sonic-interface.yang index 74f241fed0d..afd46a65550 100644 --- a/src/sonic-yang-models/yang-models/sonic-interface.yang +++ b/src/sonic-yang-models/yang-models/sonic-interface.yang @@ -2,7 +2,7 @@ module sonic-interface { yang-version 1.1; - namespace "http://github.com/Azure/sonic-interface"; + namespace "http://github.com/sonic-net/sonic-interface"; prefix intf; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-kdump.yang b/src/sonic-yang-models/yang-models/sonic-kdump.yang index c7640ee0c75..364ccdc1a2c 100644 --- a/src/sonic-yang-models/yang-models/sonic-kdump.yang +++ b/src/sonic-yang-models/yang-models/sonic-kdump.yang @@ -1,5 +1,5 @@ module sonic-kdump { - namespace "http://github.com/Azure/sonic-kdump"; + namespace "http://github.com/sonic-net/sonic-kdump"; prefix kdump; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-kubernetes_master.yang b/src/sonic-yang-models/yang-models/sonic-kubernetes_master.yang new file mode 100644 index 00000000000..331270122ef --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-kubernetes_master.yang @@ -0,0 +1,63 @@ +module sonic-kubernetes_master { + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-kubernetes_master"; + + prefix kubernetes_master; + + import ietf-inet-types { + prefix inet; + } + + import sonic-types { + prefix stypes; + } + + description "KUBERNETES_MASTER YANG Module for SONiC OS"; + + revision 2022-10-09 { + description "First Revision"; + } + + container sonic-kubernetes_master { + + container KUBERNETES_MASTER { + + description "KUBERNETES_MASTER part of config_db.json"; + + container SERVER { + + leaf ip { + description "Kubernetes api server endpoint(an IP address or a DNS + domain name.)"; + type inet:host; + } + + leaf port { + description "Kubernetes api server port"; + type inet:port-number; + default 6443; + } + + leaf disable { + description "This configuration identicates whether disable kubernetes"; + type stypes:boolean_type; + default "false"; + } + + leaf insecure { + description "This configuration identicates it will download kubernetes + CA by http other than https"; + type stypes:boolean_type; + default "true"; + } + + } + /* end of container SERVER */ + } + /* end of container KUBERNETES_MASTER */ + } + /* end of top level container */ +} +/* end of module sonic-kubernetes_master */ diff --git a/src/sonic-yang-models/yang-models/sonic-lldp.yang b/src/sonic-yang-models/yang-models/sonic-lldp.yang index a3620f30fe6..e83d73bbc91 100644 --- a/src/sonic-yang-models/yang-models/sonic-lldp.yang +++ b/src/sonic-yang-models/yang-models/sonic-lldp.yang @@ -1,5 +1,5 @@ module sonic-lldp { - namespace "http://github.com/Azure/sonic-lldp"; + namespace "http://github.com/sonic-net/sonic-lldp"; prefix slldp; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-logger.yang b/src/sonic-yang-models/yang-models/sonic-logger.yang new file mode 100644 index 00000000000..f9a89bda49e --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-logger.yang @@ -0,0 +1,73 @@ +module sonic-logger{ + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-logger"; + prefix logger; + + import sonic-types { + prefix stypes; + } + + description "Logger Table yang Module for SONiC"; + + typedef swss_loglevel { + type enumeration { + enum EMERG; + enum ALERT; + enum CRIT; + enum ERROR; + enum WARN; + enum NOTICE; + enum INFO; + enum DEBUG; + } + } + + typedef sai_loglevel { + type enumeration { + enum SAI_LOG_LEVEL_CRITICAL; + enum SAI_LOG_LEVEL_ERROR; + enum SAI_LOG_LEVEL_WARN; + enum SAI_LOG_LEVEL_NOTICE; + enum SAI_LOG_LEVEL_INFO; + enum SAI_LOG_LEVEL_DEBUG; + } + } + + container sonic-logger { + + container LOGGER { + + description "Logger table in config_db.json"; + + list LOGGER_LIST { + + key "name"; + + leaf name { + description "Component name in LOGGER table (example for component: orchagent, Syncd, SAI components)."; + type string; + } + + leaf LOGLEVEL { + description "The log verbosity for the component"; + mandatory true; + type union { + type swss_loglevel; + type sai_loglevel; + } + } + + leaf LOGOUTPUT { + type enumeration { + enum SYSLOG; + enum STDOUT; + enum STDERR; + } + default SYSLOG; + } + }/* end of list LOGGER_LIST */ + }/* end of LOGGER container */ + }/* end of sonic-logger container */ +}/* end of sonic-logger module */ diff --git a/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang b/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang index c3ada71aaea..5d64b61c59c 100644 --- a/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang +++ b/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang @@ -2,7 +2,7 @@ module sonic-loopback-interface { yang-version 1.1; - namespace "http://github.com/Azure/sonic-loopback-interface"; + namespace "http://github.com/sonic-net/sonic-loopback-interface"; prefix lointf; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-lossless-traffic-pattern.yang b/src/sonic-yang-models/yang-models/sonic-lossless-traffic-pattern.yang index 6901dc01e00..5ac4d9243b0 100644 --- a/src/sonic-yang-models/yang-models/sonic-lossless-traffic-pattern.yang +++ b/src/sonic-yang-models/yang-models/sonic-lossless-traffic-pattern.yang @@ -2,7 +2,7 @@ module sonic-lossless-traffic-pattern { yang-version 1.1; - namespace "http://github.com/Azure/sonic-lossless-traffic-pattern"; + namespace "http://github.com/sonic-net/sonic-lossless-traffic-pattern"; prefix lossless-traffic-pattern; diff --git a/src/sonic-yang-models/yang-models/sonic-macsec.yang b/src/sonic-yang-models/yang-models/sonic-macsec.yang index 4e3412f86a3..f9085891900 100644 --- a/src/sonic-yang-models/yang-models/sonic-macsec.yang +++ b/src/sonic-yang-models/yang-models/sonic-macsec.yang @@ -2,7 +2,7 @@ module sonic-macsec { yang-version 1.1; - namespace "http://github.com/Azure/sonic-macsec"; + namespace "http://github.com/sonic-net/sonic-macsec"; prefix macsec; diff --git a/src/sonic-yang-models/yang-models/sonic-mclag.yang b/src/sonic-yang-models/yang-models/sonic-mclag.yang index 39e4c0b2b46..59799baf4e4 100644 --- a/src/sonic-yang-models/yang-models/sonic-mclag.yang +++ b/src/sonic-yang-models/yang-models/sonic-mclag.yang @@ -1,5 +1,5 @@ module sonic-mclag { - namespace "http://github.com/Azure/sonic-mclag"; + namespace "http://github.com/sonic-net/sonic-mclag"; prefix smclag; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-mgmt_interface.yang b/src/sonic-yang-models/yang-models/sonic-mgmt_interface.yang index c834a28d44e..119e02f478a 100644 --- a/src/sonic-yang-models/yang-models/sonic-mgmt_interface.yang +++ b/src/sonic-yang-models/yang-models/sonic-mgmt_interface.yang @@ -2,7 +2,7 @@ module sonic-mgmt_interface { yang-version 1.1; - namespace "http://github.com/Azure/sonic-mgmt_interface"; + namespace "http://github.com/sonic-net/sonic-mgmt_interface"; prefix mgmtintf; import sonic-mgmt_port { diff --git a/src/sonic-yang-models/yang-models/sonic-mgmt_port.yang b/src/sonic-yang-models/yang-models/sonic-mgmt_port.yang index fc722abf648..96a2dfaf3fd 100644 --- a/src/sonic-yang-models/yang-models/sonic-mgmt_port.yang +++ b/src/sonic-yang-models/yang-models/sonic-mgmt_port.yang @@ -2,7 +2,7 @@ module sonic-mgmt_port { yang-version 1.1; - namespace "http://github.com/Azure/sonic-mgmt_port"; + namespace "http://github.com/sonic-net/sonic-mgmt_port"; prefix mgmtprt; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-mgmt_vrf.yang b/src/sonic-yang-models/yang-models/sonic-mgmt_vrf.yang index 35ac15e1fb8..c851d057b87 100644 --- a/src/sonic-yang-models/yang-models/sonic-mgmt_vrf.yang +++ b/src/sonic-yang-models/yang-models/sonic-mgmt_vrf.yang @@ -2,7 +2,7 @@ module sonic-mgmt_vrf { yang-version 1.1; - namespace "http://github.com/Azure/sonic-mgmt_vrf"; + namespace "http://github.com/sonic-net/sonic-mgmt_vrf"; prefix mvrf; description diff --git a/src/sonic-yang-models/yang-models/sonic-mirror-session.yang b/src/sonic-yang-models/yang-models/sonic-mirror-session.yang index 9ea1954d7a3..98e0e9dfac8 100644 --- a/src/sonic-yang-models/yang-models/sonic-mirror-session.yang +++ b/src/sonic-yang-models/yang-models/sonic-mirror-session.yang @@ -2,7 +2,7 @@ module sonic-mirror-session { yang-version 1.1; - namespace "http://github.com/Azure/sonic-mirror-session"; + namespace "http://github.com/sonic-net/sonic-mirror-session"; prefix sms; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-mpls-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-mpls-tc-map.yang new file mode 100644 index 00000000000..96392222d1d --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-mpls-tc-map.yang @@ -0,0 +1,70 @@ +module sonic-mpls-tc-map { + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-mpls-tc-map"; + + prefix mpls_tc_map; + + import sonic-types { + prefix stypes; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "MPLS_TC_TO_TC_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-mpls-tc-map { + + container MPLS_TC_TO_TC_MAP { + + description "MPLS_TC_TO_TC_MAP part of config_db.json"; + + list MPLS_TC_TO_TC_MAP_LIST { + + key "name"; + + leaf name { + description "Name of MPLS TC Mpping List"; + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list MPLS_TC_TO_TC_MAP { //this is list inside list for storing mapping between two fields + + key "mpls"; + + leaf mpls { + description "MPLS TC Value"; + type string { + pattern "[0-7]?" { + error-message "Invalid MPLS"; + error-app-tag mpls-invalid; + } + } + } + + leaf tc { + description "Matching TC Value"; + type stypes:tc_type; + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-mux-cable.yang b/src/sonic-yang-models/yang-models/sonic-mux-cable.yang index a66a588c91d..c70002afdd1 100644 --- a/src/sonic-yang-models/yang-models/sonic-mux-cable.yang +++ b/src/sonic-yang-models/yang-models/sonic-mux-cable.yang @@ -1,5 +1,5 @@ module sonic-mux-cable { - namespace "http://github.com/Azure/sonic-mux-cable"; + namespace "http://github.com/sonic-net/sonic-mux-cable"; prefix mux_cable; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-nat.yang b/src/sonic-yang-models/yang-models/sonic-nat.yang index d01a1a9617f..c1e55401252 100644 --- a/src/sonic-yang-models/yang-models/sonic-nat.yang +++ b/src/sonic-yang-models/yang-models/sonic-nat.yang @@ -1,5 +1,5 @@ module sonic-nat { - namespace "http://github.com/Azure/sonic-nat"; + namespace "http://github.com/sonic-net/sonic-nat"; prefix snat; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-ntp.yang b/src/sonic-yang-models/yang-models/sonic-ntp.yang index bea02cb0d34..65ee51052d0 100644 --- a/src/sonic-yang-models/yang-models/sonic-ntp.yang +++ b/src/sonic-yang-models/yang-models/sonic-ntp.yang @@ -2,7 +2,7 @@ module sonic-ntp { yang-version 1.1; - namespace "http://github.com/Azure/sonic-system-ntp"; + namespace "http://github.com/sonic-net/sonic-system-ntp"; prefix ntp; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-nvgre-tunnel.yang b/src/sonic-yang-models/yang-models/sonic-nvgre-tunnel.yang index b10c35d9404..d010812b25b 100644 --- a/src/sonic-yang-models/yang-models/sonic-nvgre-tunnel.yang +++ b/src/sonic-yang-models/yang-models/sonic-nvgre-tunnel.yang @@ -2,7 +2,7 @@ module sonic-nvgre-tunnel { yang-version 1.1; - namespace "http://github.com/Azure/sonic-nvgre-tunnel"; + namespace "http://github.com/sonic-net/sonic-nvgre-tunnel"; prefix nvgre; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-passwh.yang b/src/sonic-yang-models/yang-models/sonic-passwh.yang index 8814bc2e5a2..347a740180d 100755 --- a/src/sonic-yang-models/yang-models/sonic-passwh.yang +++ b/src/sonic-yang-models/yang-models/sonic-passwh.yang @@ -1,6 +1,6 @@ module sonic-passwh { yang-version 1.1; - namespace "http://github.com/Azure/sonic-passwh"; + namespace "http://github.com/sonic-net/sonic-passwh"; prefix password; description "PASSWORD HARDENING YANG Module for SONiC OS"; diff --git a/src/sonic-yang-models/yang-models/sonic-pbh.yang b/src/sonic-yang-models/yang-models/sonic-pbh.yang index 21a4b5fecc6..54c728a939a 100644 --- a/src/sonic-yang-models/yang-models/sonic-pbh.yang +++ b/src/sonic-yang-models/yang-models/sonic-pbh.yang @@ -2,7 +2,7 @@ module sonic-pbh { yang-version 1.1; - namespace "http://github.com/Azure/sonic-pbh"; + namespace "http://github.com/sonic-net/sonic-pbh"; prefix pbh; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-peer-switch.yang b/src/sonic-yang-models/yang-models/sonic-peer-switch.yang index 79a94c95c2c..7f953c71bd1 100644 --- a/src/sonic-yang-models/yang-models/sonic-peer-switch.yang +++ b/src/sonic-yang-models/yang-models/sonic-peer-switch.yang @@ -1,6 +1,6 @@ module sonic-peer-switch { yang-version 1.1; - namespace "http://github.com/Azure/sonic-peer-switch"; + namespace "http://github.com/sonic-net/sonic-peer-switch"; prefix peer_switch; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang b/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang index ccc86c064ef..8c537aa7a6b 100644 --- a/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang @@ -2,7 +2,7 @@ module sonic-pfc-priority-priority-group-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-pfc-priority-priority-group-map"; + namespace "http://github.com/sonic-net/sonic-pfc-priority-priority-group-map"; prefix pppgm; diff --git a/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang b/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang index fb659d89bb4..805cf841786 100644 --- a/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang @@ -2,7 +2,7 @@ module sonic-pfc-priority-queue-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-pfc-priority-queue-map"; + namespace "http://github.com/sonic-net/sonic-pfc-priority-queue-map"; prefix ppqm; diff --git a/src/sonic-yang-models/yang-models/sonic-pfcwd.yang b/src/sonic-yang-models/yang-models/sonic-pfcwd.yang index 4ea0ffb8537..27c2a49f2ed 100644 --- a/src/sonic-yang-models/yang-models/sonic-pfcwd.yang +++ b/src/sonic-yang-models/yang-models/sonic-pfcwd.yang @@ -1,5 +1,5 @@ module sonic-pfcwd { - namespace "http://github.com/Azure/sonic-pfcwd"; + namespace "http://github.com/sonic-net/sonic-pfcwd"; prefix sonic-pfcwd; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang index 09dcb7ce9c3..6a2c69ab993 100644 --- a/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang @@ -2,7 +2,7 @@ module sonic-port-qos-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-port-qos-map"; + namespace "http://github.com/sonic-net/sonic-port-qos-map"; prefix pqm; diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index 6e03f777a85..e2408d593dd 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -2,7 +2,7 @@ module sonic-port{ yang-version 1.1; - namespace "http://github.com/Azure/sonic-port"; + namespace "http://github.com/sonic-net/sonic-port"; prefix port; import sonic-types { @@ -117,7 +117,7 @@ module sonic-port{ leaf mtu { type uint16 { - range 1..9216; + range 68..9216; } } diff --git a/src/sonic-yang-models/yang-models/sonic-portchannel.yang b/src/sonic-yang-models/yang-models/sonic-portchannel.yang index 27df0625dfe..31235a0d227 100644 --- a/src/sonic-yang-models/yang-models/sonic-portchannel.yang +++ b/src/sonic-yang-models/yang-models/sonic-portchannel.yang @@ -2,7 +2,7 @@ module sonic-portchannel { yang-version 1.1; - namespace "http://github.com/Azure/sonic-portchannel"; + namespace "http://github.com/sonic-net/sonic-portchannel"; prefix lag; import sonic-types { diff --git a/src/sonic-yang-models/yang-models/sonic-queue.yang b/src/sonic-yang-models/yang-models/sonic-queue.yang index 8e24faa72cb..e764f8149a3 100644 --- a/src/sonic-yang-models/yang-models/sonic-queue.yang +++ b/src/sonic-yang-models/yang-models/sonic-queue.yang @@ -2,7 +2,7 @@ module sonic-queue { yang-version 1.1; - namespace "http://github.com/Azure/sonic-queue"; + namespace "http://github.com/sonic-net/sonic-queue"; prefix squeue; diff --git a/src/sonic-yang-models/yang-models/sonic-restapi.yang b/src/sonic-yang-models/yang-models/sonic-restapi.yang new file mode 100644 index 00000000000..094ed18eb7b --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-restapi.yang @@ -0,0 +1,85 @@ +module sonic-restapi { + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-restapi"; + prefix restapi; + + import ietf-inet-types { + prefix inet; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description "RESTAPI YANG Module for SONiC OS"; + + revision 2022-10-05 { + description "First Revision"; + } + + container sonic-restapi { + + container RESTAPI { + + description "RESTAPI TABLE part of config_db.json"; + + container certs { + + leaf ca_crt { + type string { + pattern '(/[a-zA-Z0-9_-]+)*/([a-zA-Z0-9_-]+).([a-z]+)'; + } + description "Local path for ca_crt."; + } + + leaf server_crt { + type string { + pattern '(/[a-zA-Z0-9_-]+)*/([a-zA-Z0-9_-]+).crt'; + } + description "Local path for server_crt."; + } + + leaf client_crt_cname { + type string { + pattern '([a-zA-Z0-9_\-\.]+,)*([a-zA-Z0-9_\-\.]+)'; + } + description "Client cert name."; + } + + leaf server_key { + type string { + pattern '(/[a-zA-Z0-9_-]+)*/([a-zA-Z0-9_-]+).key'; + } + description "Local path for server_key."; + } + + } + + container config { + + leaf client_auth { + type boolean; + default true; + description "Enable client authentication"; + } + + leaf log_level { + type string { + pattern "trace|info"; + } + description "container log level for restapi"; + } + + leaf allow_insecure { + type boolean; + default false; + description "Allow insecure connection"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-route-common.yang b/src/sonic-yang-models/yang-models/sonic-route-common.yang index 9579739bcdd..df0eae8f4ea 100644 --- a/src/sonic-yang-models/yang-models/sonic-route-common.yang +++ b/src/sonic-yang-models/yang-models/sonic-route-common.yang @@ -1,5 +1,5 @@ module sonic-route-common { - namespace "http://github.com/Azure/sonic-route-common"; + namespace "http://github.com/sonic-net/sonic-route-common"; prefix rtcmn; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-route-map.yang b/src/sonic-yang-models/yang-models/sonic-route-map.yang index e4717cbc628..cdfe5c6eda5 100644 --- a/src/sonic-yang-models/yang-models/sonic-route-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-route-map.yang @@ -1,5 +1,5 @@ module sonic-route-map { - namespace "http://github.com/Azure/sonic-route-map"; + namespace "http://github.com/sonic-net/sonic-route-map"; prefix rmap; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-routing-policy-sets.yang b/src/sonic-yang-models/yang-models/sonic-routing-policy-sets.yang index 5b178831fb8..9b3e18960c4 100644 --- a/src/sonic-yang-models/yang-models/sonic-routing-policy-sets.yang +++ b/src/sonic-yang-models/yang-models/sonic-routing-policy-sets.yang @@ -1,5 +1,5 @@ module sonic-routing-policy-sets { - namespace "http://github.com/Azure/sonic-routing-policy-lists"; + namespace "http://github.com/sonic-net/sonic-routing-policy-lists"; prefix rpolsets; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-scheduler.yang b/src/sonic-yang-models/yang-models/sonic-scheduler.yang index 8dcd4bef79b..7e580d848d4 100644 --- a/src/sonic-yang-models/yang-models/sonic-scheduler.yang +++ b/src/sonic-yang-models/yang-models/sonic-scheduler.yang @@ -2,7 +2,7 @@ module sonic-scheduler { yang-version 1.1; - namespace "http://github.com/Azure/sonic-scheduler"; + namespace "http://github.com/sonic-net/sonic-scheduler"; prefix sch; diff --git a/src/sonic-yang-models/yang-models/sonic-sflow.yang b/src/sonic-yang-models/yang-models/sonic-sflow.yang index 62984f064c5..adbeda80c4d 100644 --- a/src/sonic-yang-models/yang-models/sonic-sflow.yang +++ b/src/sonic-yang-models/yang-models/sonic-sflow.yang @@ -1,6 +1,6 @@ module sonic-sflow{ - namespace "http://github.com/Azure/sonic-sflow"; + namespace "http://github.com/sonic-net/sonic-sflow"; prefix sflow; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-snmp.yang b/src/sonic-yang-models/yang-models/sonic-snmp.yang index 7e3db7b5dd0..68eebd2fa48 100644 --- a/src/sonic-yang-models/yang-models/sonic-snmp.yang +++ b/src/sonic-yang-models/yang-models/sonic-snmp.yang @@ -1,5 +1,5 @@ module sonic-snmp { - namespace "http://github.com/Azure/sonic-snmp"; + namespace "http://github.com/sonic-net/sonic-snmp"; prefix ssnmp; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-static-route.yang b/src/sonic-yang-models/yang-models/sonic-static-route.yang index 48a562f242d..019825b7888 100644 --- a/src/sonic-yang-models/yang-models/sonic-static-route.yang +++ b/src/sonic-yang-models/yang-models/sonic-static-route.yang @@ -1,6 +1,6 @@ module sonic-static-route { yang-version 1.1; - namespace "http://github.com/Azure/sonic-static-route"; + namespace "http://github.com/sonic-net/sonic-static-route"; prefix sroute; import sonic-vrf { diff --git a/src/sonic-yang-models/yang-models/sonic-storm-control.yang b/src/sonic-yang-models/yang-models/sonic-storm-control.yang index 6d4e2b66a0f..3f0e48d413a 100644 --- a/src/sonic-yang-models/yang-models/sonic-storm-control.yang +++ b/src/sonic-yang-models/yang-models/sonic-storm-control.yang @@ -1,5 +1,5 @@ module sonic-storm-control { - namespace "http://github.com/Azure/sonic-storm-control"; + namespace "http://github.com/sonic-net/sonic-storm-control"; yang-version "1"; prefix ssc; diff --git a/src/sonic-yang-models/yang-models/sonic-syslog.yang b/src/sonic-yang-models/yang-models/sonic-syslog.yang index c2aa73827f0..dc1925f463f 100644 --- a/src/sonic-yang-models/yang-models/sonic-syslog.yang +++ b/src/sonic-yang-models/yang-models/sonic-syslog.yang @@ -2,7 +2,7 @@ module sonic-syslog { yang-version 1.1; - namespace "http://github.com/Azure/sonic-system-syslog"; + namespace "http://github.com/sonic-net/sonic-system-syslog"; prefix syslog; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-system-aaa.yang b/src/sonic-yang-models/yang-models/sonic-system-aaa.yang index c3a44212695..f842d63cf6e 100644 --- a/src/sonic-yang-models/yang-models/sonic-system-aaa.yang +++ b/src/sonic-yang-models/yang-models/sonic-system-aaa.yang @@ -1,5 +1,5 @@ module sonic-system-aaa { - namespace "http://github.com/Azure/sonic-system-aaa"; + namespace "http://github.com/sonic-net/sonic-system-aaa"; prefix ssys; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-system-tacacs.yang b/src/sonic-yang-models/yang-models/sonic-system-tacacs.yang index f82340b0e68..6abbcf3523b 100644 --- a/src/sonic-yang-models/yang-models/sonic-system-tacacs.yang +++ b/src/sonic-yang-models/yang-models/sonic-system-tacacs.yang @@ -1,5 +1,5 @@ module sonic-system-tacacs { - namespace "http://github.com/Azure/sonic-system-tacacs"; + namespace "http://github.com/sonic-net/sonic-system-tacacs"; prefix ssys; yang-version 1.1; diff --git a/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang b/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang index 1b21673f58a..e01fb7e6ac1 100644 --- a/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang @@ -2,7 +2,7 @@ module sonic-tc-priority-group-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-tc-priority-group-map"; + namespace "http://github.com/sonic-net/sonic-tc-priority-group-map"; prefix tpgm; diff --git a/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang b/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang index 3bcfab1f459..c70a3ffe7ea 100644 --- a/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang @@ -2,7 +2,7 @@ module sonic-tc-queue-map { yang-version 1.1; - namespace "http://github.com/Azure/sonic-tc-queue-map"; + namespace "http://github.com/sonic-net/sonic-tc-queue-map"; prefix tqm; diff --git a/src/sonic-yang-models/yang-models/sonic-telemetry.yang b/src/sonic-yang-models/yang-models/sonic-telemetry.yang index 0164da5157e..d3d7600a8e9 100644 --- a/src/sonic-yang-models/yang-models/sonic-telemetry.yang +++ b/src/sonic-yang-models/yang-models/sonic-telemetry.yang @@ -2,7 +2,7 @@ module sonic-telemetry { yang-version 1.1; - namespace "http://github.com/Azure/sonic-telemetry"; + namespace "http://github.com/sonic-net/sonic-telemetry"; prefix telemetry; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-versions.yang b/src/sonic-yang-models/yang-models/sonic-versions.yang index 15610212270..ad9b95f9418 100644 --- a/src/sonic-yang-models/yang-models/sonic-versions.yang +++ b/src/sonic-yang-models/yang-models/sonic-versions.yang @@ -2,7 +2,7 @@ module sonic-versions { yang-version 1.1; - namespace "http://github.com/Azure/sonic-versions"; + namespace "http://github.com/sonic-net/sonic-versions"; prefix versions; diff --git a/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang b/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang index bc13113ef53..5a7f02c7514 100644 --- a/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang +++ b/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang @@ -2,7 +2,7 @@ module sonic-vlan-sub-interface { yang-version 1.1; - namespace "http://github.com/Azure/sonic-vlan-sub-interface"; + namespace "http://github.com/sonic-net/sonic-vlan-sub-interface"; prefix vlan-sub-interface; diff --git a/src/sonic-yang-models/yang-models/sonic-vlan.yang b/src/sonic-yang-models/yang-models/sonic-vlan.yang index 48ec466b825..b8f3e28c43f 100644 --- a/src/sonic-yang-models/yang-models/sonic-vlan.yang +++ b/src/sonic-yang-models/yang-models/sonic-vlan.yang @@ -2,7 +2,7 @@ module sonic-vlan { yang-version 1.1; - namespace "http://github.com/Azure/sonic-vlan"; + namespace "http://github.com/sonic-net/sonic-vlan"; prefix vlan; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-models/sonic-voq-inband-interface.yang b/src/sonic-yang-models/yang-models/sonic-voq-inband-interface.yang new file mode 100644 index 00000000000..d197a91f80e --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-voq-inband-interface.yang @@ -0,0 +1,56 @@ +module sonic-voq-inband-interface { + namespace "http://github.com/sonic-net/sonic-voq-inband-interface"; + prefix voq-inband-intf; + yang-version 1.1; + + import sonic-types { + prefix stypes; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BGP Internal Neighbor for voq chassis platforms"; + + revision 2022-10-06 { + description + "Initial revision."; + } + + container sonic-voq-inband-interface { + container VOQ_INBAND_INTERFACE { + description "VOQ inband interface in VOQ Chassis"; + list VOQ_INBAND_INTERFACE_LIST { + key "name"; + leaf name { + type string { + pattern "Ethernet-IB[0-9]+"; + } + } + leaf inband_type { + description "Type of inband interface"; + type string { + pattern "port|Port"; + } + default "port"; + } + } + list VOQ_INBAND_INTERFACE_IPPREFIX_LIST { + description "Prefix for VOQ_INBAND_INTERFACE"; + key "name ip-prefix"; + leaf name { + type leafref { + path "../../VOQ_INBAND_INTERFACE_LIST/name"; + } + } + leaf ip-prefix { + type stypes:sonic-ip-prefix; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-vrf.yang b/src/sonic-yang-models/yang-models/sonic-vrf.yang index 0d7d0561dd1..ff9fc5b5a4c 100644 --- a/src/sonic-yang-models/yang-models/sonic-vrf.yang +++ b/src/sonic-yang-models/yang-models/sonic-vrf.yang @@ -1,5 +1,5 @@ module sonic-vrf { - namespace "http://github.com/Azure/sonic-vrf"; + namespace "http://github.com/sonic-net/sonic-vrf"; prefix vrf; import sonic-extension { diff --git a/src/sonic-yang-models/yang-models/sonic-vxlan.yang b/src/sonic-yang-models/yang-models/sonic-vxlan.yang index 6a9b4ffb5e3..fc23ea9141a 100644 --- a/src/sonic-yang-models/yang-models/sonic-vxlan.yang +++ b/src/sonic-yang-models/yang-models/sonic-vxlan.yang @@ -1,6 +1,6 @@ module sonic-vxlan { yang-version 1.1; - namespace "http://github.com/Azure/sonic-vxlan"; + namespace "http://github.com/sonic-net/sonic-vxlan"; prefix svxlan; import ietf-yang-types { diff --git a/src/sonic-yang-models/yang-models/sonic-warm-restart.yang b/src/sonic-yang-models/yang-models/sonic-warm-restart.yang index 8366016746a..3025260d275 100644 --- a/src/sonic-yang-models/yang-models/sonic-warm-restart.yang +++ b/src/sonic-yang-models/yang-models/sonic-warm-restart.yang @@ -2,7 +2,7 @@ module sonic-warm-restart { yang-version 1.1; - namespace "http://github.com/Azure/sonic-warm-restart"; + namespace "http://github.com/sonic-net/sonic-warm-restart"; prefix wrm; description "SONIC WARMRESTART"; diff --git a/src/sonic-yang-models/yang-models/sonic-wred-profile.yang b/src/sonic-yang-models/yang-models/sonic-wred-profile.yang index 2ca7be26ca0..2f3559a23f9 100644 --- a/src/sonic-yang-models/yang-models/sonic-wred-profile.yang +++ b/src/sonic-yang-models/yang-models/sonic-wred-profile.yang @@ -2,7 +2,7 @@ module sonic-wred-profile { yang-version 1.1; - namespace "http://github.com/Azure/sonic-wred-profile"; + namespace "http://github.com/sonic-net/sonic-wred-profile"; prefix wrd; diff --git a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 index e9461be2cee..2658016575e 100644 --- a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 @@ -7,7 +7,7 @@ module sonic-acl { yang-version 1.1; - namespace "http://github.com/Azure/sonic-acl"; + namespace "http://github.com/sonic-net/sonic-acl"; prefix acl; import ietf-inet-types { diff --git a/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2 index 142ef517b7c..2ee583f1811 100644 --- a/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2 @@ -2,7 +2,7 @@ module sonic-extension { yang-version 1.1; - namespace "http://github.com/Azure/sonic-extension"; + namespace "http://github.com/sonic-net/sonic-extension"; prefix sonic-extension; description "Extension yang Module for SONiC OS"; diff --git a/src/sonic-yang-models/yang-templates/sonic-policer.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-policer.yang.j2 index a8c6f1445a4..90bba27425a 100644 --- a/src/sonic-yang-models/yang-templates/sonic-policer.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-policer.yang.j2 @@ -7,7 +7,7 @@ module sonic-policer { yang-version 1.1; - namespace "http://github.com/Azure/sonic-policer"; + namespace "http://github.com/sonic-net/sonic-policer"; prefix policer; import sonic-types { diff --git a/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 index 9de37d2cfc0..498abb3aae3 100644 --- a/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 @@ -2,7 +2,7 @@ module sonic-types { yang-version 1.1; - namespace "http://github.com/Azure/sonic-head"; + namespace "http://github.com/sonic-net/sonic-head"; prefix sonic-types; description "SONiC type for yang Models of SONiC OS"; @@ -279,6 +279,34 @@ module sonic-types { } } + typedef process_name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid process_name."; + error-app-tag invalid-process-name; + } + length 1..32 { + error-message "Invalid length for process_name."; + error-app-tag invalid-process-name-length; + } + } + } + + typedef ctr_name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid ctr_name."; + error-app-tag invalid-ctr-name; + } + length 1..32 { + error-message "Invalid length for ctr_name."; + error-app-tag invalid-ctr-name-length; + } + } + } + + + {% if yang_model_type == "cvl" %} /* Required for CVL */ container operation { diff --git a/src/system-health/health_checker/service_checker.py b/src/system-health/health_checker/service_checker.py index 674ad994428..ed6c7296fde 100644 --- a/src/system-health/health_checker/service_checker.py +++ b/src/system-health/health_checker/service_checker.py @@ -12,6 +12,8 @@ SYSLOG_IDENTIFIER = 'service_checker' logger = Logger(log_identifier=SYSLOG_IDENTIFIER) +EVENTS_PUBLISHER_SOURCE = "sonic-events-host" +EVENTS_PUBLISHER_TAG = "process-not-running" class ServiceChecker(HealthChecker): """ @@ -24,13 +26,13 @@ class ServiceChecker(HealthChecker): CRITICAL_PROCESSES_PATH = 'etc/supervisor/critical_processes' # Command to get merged directory of a container - GET_CONTAINER_FOLDER_CMD = 'docker inspect {} --format "{{{{.GraphDriver.Data.MergedDir}}}}"' + GET_CONTAINER_FOLDER_CMD = ['docker', 'inspect', '', '--format', "{{.GraphDriver.Data.MergedDir}}"] # Command to query the status of monit service. - CHECK_MONIT_SERVICE_CMD = 'systemctl is-active monit.service' + CHECK_MONIT_SERVICE_CMD = ['systemctl', 'is-active', 'monit.service'] # Command to get summary of critical system service. - CHECK_CMD = 'monit summary -B' + CHECK_CMD = ['monit', 'summary', '-B'] MIN_CHECK_CMD_LINES = 3 # Expect status for different system service category. @@ -55,6 +57,8 @@ def __init__(self): self.load_critical_process_cache() + self.events_handle = swsscommon.events_init_publisher(EVENTS_PUBLISHER_SOURCE) + def get_expected_running_containers(self, feature_table): """Get a set of containers that are expected to running on SONiC @@ -168,7 +172,8 @@ def _update_container_critical_processes(self, container, critical_process_list) self.need_save_cache = True def _get_container_folder(self, container): - container_folder = utils.run_command(ServiceChecker.GET_CONTAINER_FOLDER_CMD.format(container)) + ServiceChecker.GET_CONTAINER_FOLDER_CMD[2] = str(container) + container_folder = utils.run_command(ServiceChecker.GET_CONTAINER_FOLDER_CMD) if container_folder is None: return container_folder @@ -287,7 +292,7 @@ def check(self, config): self.reset() self.check_by_monit(config) self.check_services(config) - + swsscommon.events_deinit_publisher(self.events_handle) def _parse_supervisorctl_status(self, process_status): """Expected input: @@ -308,6 +313,13 @@ def _parse_supervisorctl_status(self, process_status): data[items[0].strip()] = items[1].strip() return data + def publish_events(self, container_name, critical_process_list): + params = swsscommon.FieldValueMap() + params["ctr_name"] = container_name + for process_name in critical_process_list: + params["process_name"] = process_name + swsscommon.event_publish(self.events_handle, EVENTS_PUBLISHER_TAG, params) + def check_process_existence(self, container_name, critical_process_list, config, feature_table): """Check whether the process in the specified container is running or not. @@ -327,11 +339,12 @@ def check_process_existence(self, container_name, critical_process_list, config, # We are using supervisorctl status to check the critical process status. We cannot leverage psutil here because # it not always possible to get process cmdline in supervisor.conf. E.g, cmdline of orchagent is "/usr/bin/orchagent", # however, in supervisor.conf it is "/usr/bin/orchagent.sh" - cmd = 'docker exec {} bash -c "supervisorctl status"'.format(container_name) + cmd = ['docker', 'exec', str(container_name), 'bash', '-c', "supervisorctl status"] process_status = utils.run_command(cmd) if process_status is None: for process_name in critical_process_list: self.set_object_not_ok('Process', '{}:{}'.format(container_name, process_name), "'{}' is not running".format(process_name)) + self.publish_events(container_name, critical_process_list) return process_status = self._parse_supervisorctl_status(process_status.strip().splitlines()) diff --git a/src/system-health/health_checker/sysmonitor.py b/src/system-health/health_checker/sysmonitor.py index e69d289fc53..e4dbc68ebf1 100755 --- a/src/system-health/health_checker/sysmonitor.py +++ b/src/system-health/health_checker/sysmonitor.py @@ -235,7 +235,7 @@ def get_app_ready_status(self, service): #Gets the service properties def run_systemctl_show(self, service): - command = ('systemctl show {} --property=Id,LoadState,UnitFileState,Type,ActiveState,SubState,Result'.format(service)) + command = ['systemctl', 'show', str(service), '--property=Id,LoadState,UnitFileState,Type,ActiveState,SubState,Result'] output = utils.run_command(command) srv_properties = output.split('\n') prop_dict = {} diff --git a/src/system-health/health_checker/utils.py b/src/system-health/health_checker/utils.py index 00e7754e1ec..338ef1d3afe 100644 --- a/src/system-health/health_checker/utils.py +++ b/src/system-health/health_checker/utils.py @@ -8,7 +8,7 @@ def run_command(command): :return: Output of the shell command. """ try: - process = subprocess.Popen(command, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return process.communicate()[0] except Exception: return None diff --git a/src/system-health/tests/test_system_health.py b/src/system-health/tests/test_system_health.py index d58c69becec..ab0a3bcb114 100644 --- a/src/system-health/tests/test_system_health.py +++ b/src/system-health/tests/test_system_health.py @@ -504,10 +504,10 @@ def test_manager(mock_hw_info, mock_service_info, mock_udc_info): manager._set_system_led(chassis, manager.config, 'normal') def test_utils(): - output = utils.run_command('some invalid command') + output = utils.run_command(['some', 'invalid', 'command']) assert not output - output = utils.run_command('ls') + output = utils.run_command(['ls']) assert output diff --git a/src/tacacs/nss/patch/0010-Send-remote-address-in-TACACS-authorization-message.patch b/src/tacacs/nss/patch/0010-Send-remote-address-in-TACACS-authorization-message.patch new file mode 100755 index 00000000000..b0251a9a38a --- /dev/null +++ b/src/tacacs/nss/patch/0010-Send-remote-address-in-TACACS-authorization-message.patch @@ -0,0 +1,127 @@ +From ee47eb11cbfc37600a59f06ae153da5c2c486fea Mon Sep 17 00:00:00 2001 +From: liuh-80 +Date: Tue, 25 Oct 2022 10:34:08 +0800 +Subject: [PATCH] Send remote address in TACACS+ authorization message. + +--- + nss_tacplus.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 76 insertions(+), 1 deletion(-) + +diff --git a/nss_tacplus.c b/nss_tacplus.c +index 2de00a6..048745a 100644 +--- a/nss_tacplus.c ++++ b/nss_tacplus.c +@@ -33,12 +33,20 @@ + #include + #include + #include ++#include + + #include + + #define MIN_TACACS_USER_PRIV (1) + #define MAX_TACACS_USER_PRIV (15) + ++#define GET_ENV_VARIABLE_OK 0 ++#define GET_ENV_VARIABLE_NOT_FOUND 1 ++#define GET_ENV_VARIABLE_INCORRECT_FORMAT 2 ++#define GET_ENV_VARIABLE_NOT_ENOUGH_BUFFER 3 ++#define GET_REMOTE_ADDRESS_OK 0 ++#define GET_REMOTE_ADDRESS_FAILED 1 ++ + static const char *nssname = "nss_tacplus"; /* for syslogs */ + static const char *config_file = "/etc/tacplus_nss.conf"; + static const char *user_conf = "/etc/tacplus_user"; +@@ -717,6 +725,66 @@ connect_tacacs(struct tac_attrib **attr, int srvr) + return fd; + } + ++/* ++ * Get environment variable first part by name and delimiters ++ */ ++int get_environment_variable_first_part(char* dst, socklen_t size, const char* name, const char* delimiters) ++{ ++ memset(dst, 0, size); ++ ++ const char* variable = getenv(name); ++ if (variable == NULL) { ++ if (debug) { ++ syslog(LOG_DEBUG, "%s: can't get environment variable %s, errno=%d", nssname, name, errno); ++ } ++ ++ return GET_ENV_VARIABLE_NOT_FOUND; ++ } ++ ++ char* context = NULL; ++ char* first_part = strtok_r((char *)variable, delimiters, &context); ++ if (first_part == NULL) { ++ if (debug) { ++ syslog(LOG_DEBUG, "%s: can't split %s by delimiters %s", nssname, variable, delimiters); ++ } ++ ++ return GET_ENV_VARIABLE_INCORRECT_FORMAT; ++ } ++ ++ int first_part_len = strlen(first_part); ++ if (first_part_len >= size) { ++ if (debug) { ++ syslog(LOG_DEBUG, "%s: dest buffer size %d not enough for %s", nssname, size, first_part); ++ } ++ ++ return GET_ENV_VARIABLE_NOT_ENOUGH_BUFFER; ++ } ++ ++ strncpy(dst, first_part, size); ++ if (debug) { ++ syslog(LOG_DEBUG, "%s: remote address=%s", nssname, dst); ++ } ++ ++ return GET_ENV_VARIABLE_OK; ++} ++ ++/* ++ * Get current SSH session remote address from environment variable ++ */ ++int get_remote_address(char* dst, socklen_t size) ++{ ++ // SSHD will create environment variable SSH_CONNECTION after user session created. ++ if (get_environment_variable_first_part(dst, size, "SSH_CONNECTION", " ") == GET_ENV_VARIABLE_OK) { ++ return GET_REMOTE_ADDRESS_OK; ++ } ++ ++ // Before user session created, SSHD will create environment variable SSH_CLIENT_IPADDR_PORT. ++ if (get_environment_variable_first_part(dst, size, "SSH_CLIENT_IPADDR_PORT", " ") == GET_ENV_VARIABLE_OK) { ++ return GET_REMOTE_ADDRESS_OK; ++ } ++ ++ return GET_REMOTE_ADDRESS_FAILED; ++} + + /* + * lookup the user on a TACACS server. Returns 0 on successful lookup, else 1 +@@ -735,6 +803,13 @@ lookup_tacacs_user(struct pwbuf *pb) + int ret = 1, done = 0; + struct tac_attrib *attr; + int tac_fd, srvr; ++ char remote_addr[INET6_ADDRSTRLEN]; ++ const char* current_tty = getenv("SSH_TTY"); ++ ++ int result = get_remote_address(remote_addr, sizeof(remote_addr)); ++ if ((result != GET_REMOTE_ADDRESS_OK) && debug) { ++ syslog(LOG_DEBUG, "%s: can't get remote address from environment variable, result=%d", nssname, result); ++ } + + for(srvr=0; srvr < tac_srv_no && !done; srvr++) { + arep.msg = NULL; +@@ -748,7 +823,7 @@ lookup_tacacs_user(struct pwbuf *pb) + tac_ntop(tac_srv[srvr].addr->ai_addr) : "unknown", tac_fd); + continue; + } +- ret = tac_author_send(tac_fd, pb->name, "", "", attr); ++ ret = tac_author_send(tac_fd, pb->name, current_tty != NULL ? (char *)current_tty : "", remote_addr, attr); + if(ret < 0) { + if(debug) + syslog(LOG_WARNING, "%s: TACACS+ server %s send failed (%d) for" +-- +2.37.1.windows.1 + diff --git a/src/tacacs/nss/patch/series b/src/tacacs/nss/patch/series index 83e2b31e484..7b9b5c5779a 100644 --- a/src/tacacs/nss/patch/series +++ b/src/tacacs/nss/patch/series @@ -7,3 +7,4 @@ 0007-Add-support-for-TACACS-source-address.patch 0008-do-not-create-or-modify-local-user-if-there-is-no-pr.patch 0009-fix-compile-error-strncpy.patch +0010-Send-remote-address-in-TACACS-authorization-message.patch diff --git a/src/test.py b/src/test.py new file mode 100644 index 00000000000..240922b30e7 --- /dev/null +++ b/src/test.py @@ -0,0 +1,439 @@ +import argparse +import fcntl +import inspect +import json +import os +import shutil +import ssl +import subprocess +import sys +import syslog +import tempfile +import urllib.request +import base64 +from urllib.parse import urlparse + +import yaml +import requests +from sonic_py_common import device_info +from jinja2 import Template +from swsscommon import swsscommon + +KUBE_ADMIN_CONF = "/etc/sonic/kube_admin.conf" +KUBELET_YAML = "/var/lib/kubelet/config.yaml" +SERVER_ADMIN_URL = "https://{}/admin.conf" +LOCK_FILE = "/var/lock/kube_join.lock" +FLANNEL_CONF_FILE = "/usr/share/sonic/templates/kube_cni.10-flannel.conflist" +CNI_DIR = "/etc/cni/net.d" +K8S_CA_URL = "https://{}:{}/api/v1/namespaces/default/configmaps/kube-root-ca.crt" +AME_CRT = "/etc/sonic/credentials/restapiserver.crt" +AME_KEY = "/etc/sonic/credentials/restapiserver.key" + +def log_debug(m): + msg = "{}: {}".format(inspect.stack()[1][3], m) + print(msg) + syslog.syslog(syslog.LOG_DEBUG, msg) + + +def log_error(m): + msg = "{}: {}".format(inspect.stack()[1][3], m) + print(msg) + syslog.syslog(syslog.LOG_ERR, m) + + +def to_str(s): + if isinstance(s, str): + return s + + if isinstance(s, bytes): + return s.decode('utf-8') + + return str(s) + +def get_device_name(): + return str(device_info.get_hostname()).lower() + + +def _run_command(cmd, timeout=5): + """ Run shell command and return exit code, along with stdout. """ + ret = 0 + try: + proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (o, e) = proc.communicate(timeout) + output = to_str(o) + err = to_str(e) + ret = proc.returncode + except subprocess.TimeoutExpired as error: + proc.kill() + output = "" + err = str(error) + ret = -1 + + log_debug("cmd:{}\nret={}".format(cmd, ret)) + if output: + log_debug("out:{}".format(output)) + if err: + log_debug("err:{}".format(err)) + + return (ret, output.strip(), err.strip()) + + +def kube_read_labels(): + """ Read current labels on node and return as dict. """ + KUBECTL_GET_CMD = "kubectl --kubeconfig {} get nodes {} --show-labels |tr -s ' ' | cut -f6 -d' '" + + labels = {} + ret, out, _ = _run_command(KUBECTL_GET_CMD.format( + KUBE_ADMIN_CONF, get_device_name())) + + if ret == 0: + lst = out.split(",") + + for label in lst: + tmp = label.split("=") + labels[tmp[0]] = tmp[1] + + # log_debug("{} kube labels {} ret={}".format( + # "Applied" if ret == 0 else "Failed to apply", + # json.dumps(labels, indent=4), ret)) + + return (ret, labels) + + +def kube_write_labels(set_labels): + """ Set given set_labels. + """ + KUBECTL_SET_CMD = "kubectl --kubeconfig {} label --overwrite nodes {} {}" + + ret, node_labels = kube_read_labels() + if ret != 0: + log_debug("Read before set failed. Hence skipping set {}". + format(str(set_labels))) + return ret + + del_label_str = "" + add_label_str = "" + for (name, val) in set_labels.items(): + skip = False + if name in node_labels: + if val != node_labels[name]: + # label value can't be modified. Remove it first + # and then add + del_label_str += "{}- ".format(name) + else: + # Already exists with same value. + skip = True + if not skip: + # Add label + add_label_str += "{}={} ".format(name, val) + + + if add_label_str: + # First remove if any + if del_label_str: + (ret, _, _) = _run_command(KUBECTL_SET_CMD.format( + KUBE_ADMIN_CONF, get_device_name(), del_label_str.strip())) + (ret, _, _) = _run_command(KUBECTL_SET_CMD.format( + KUBE_ADMIN_CONF, get_device_name(), add_label_str.strip())) + + log_debug("{} kube labels {} ret={}".format( + "Applied" if ret == 0 else "Failed to apply", add_label_str, ret)) + else: + log_debug("Given labels are in sync with node labels. Hence no-op") + + return ret + + +def func_get_labels(args): + """ args parser default function for get labels""" + ret, node_labels = kube_read_labels() + if ret != 0: + log_debug("Labels read failed.") + return ret + + log_debug(json.dumps(node_labels, indent=4)) + return 0 + + +def is_connected(server=""): + """ Check if we are currently connected """ + + if (os.path.exists(KUBELET_YAML) and os.path.exists(KUBE_ADMIN_CONF)): + with open(KUBE_ADMIN_CONF, 'r') as s: + d = yaml.load(s, yaml.SafeLoader) + d = d['clusters'] if 'clusters' in d else [] + d = d[0] if len(d) > 0 else {} + d = d['cluster'] if 'cluster' in d else {} + d = d['server'] if 'server' in d else "" + if d: + o = urlparse(d) + if o.hostname: + return not server or server == o.hostname + return False + + +def func_is_connected(args): + """ Get connected state """ + connected = is_connected() + log_debug("Currently {} to Kube master".format( + "connected" if connected else "not connected")) + return 0 if connected else 1 + + +def _take_lock(): + """ Take a lock to block concurrent calls """ + lock_fd = None + try: + lock_fd = open(LOCK_FILE, "w") + fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB) + log_debug("Lock taken {}".format(LOCK_FILE)) + except IOError as e: + lock_fd = None + log_error("Lock {} failed: {}".format(LOCK_FILE, str(e))) + return lock_fd + + +def _download_file(server, port, insecure): + """ Download file from Kube master to assist join as node. """ + + if insecure: + r = urllib.request.urlopen(SERVER_ADMIN_URL.format(server), + context=ssl._create_unverified_context()) + else: + r = urllib.request.urlopen(SERVER_ADMIN_URL.format(server)) + + (h, fname) = tempfile.mkstemp(suffix="_kube_join") + data = r.read() + os.write(h, data) + os.close(h) + log_debug("Downloaded = {}".format(fname)) + + shutil.copyfile(fname, KUBE_ADMIN_CONF) + + log_debug("{} downloaded".format(KUBE_ADMIN_CONF)) + + +def _gen_cli_kubeconf(server, port, insecure): + """generate identity which can help authenticate and + authorization to k8s cluster + """ + client_kubeconfig_template = """ +apiVersion: v1 +clusters: +- cluster: + certificate-authority-data: {{ k8s_ca }} + server: https://{{ vip }}:{{ port }} + name: kubernetes +contexts: +- context: + cluster: kubernetes + user: user + name: user@kubernetes +current-context: user@kubernetes +kind: Config +preferences: {} +users: +- name: user + user: + client-certificate-data: {{ ame_crt }} + client-key-data: {{ ame_key }} + """ + if insecure: + r = requests.get(K8S_CA_URL.format(server, port), cert=(AME_CRT, AME_KEY), verify=False) + else: + r = requests.get(K8S_CA_URL.format(server, port), cert=(AME_CRT, AME_KEY)) + if not r.ok: + raise requests.RequestException("Something wrong with AME cert or something wrong about sonic role in k8s cluster") + k8s_ca = r.json()["data"]["ca.crt"] + k8s_ca_b64 = base64.b64encode(k8s_ca.encode("utf-8")).decode("utf-8") + ame_crt_raw = open(AME_CRT, "rb") + ame_crt_b64 = base64.b64encode(ame_crt_raw.read()).decode("utf-8") + ame_key_raw = open(AME_KEY, "rb") + ame_key_b64 = base64.b64encode(ame_key_raw.read()).decode("utf-8") + client_kubeconfig_template_j2 = Template(client_kubeconfig_template) + client_kubeconfig = client_kubeconfig_template_j2.render( + k8s_ca=k8s_ca_b64, vip=server, port=port, ame_crt=ame_crt_b64, ame_key=ame_key_b64) + (h, fname) = tempfile.mkstemp(suffix="_kube_join") + os.write(h, client_kubeconfig.encode("utf-8")) + os.close(h) + log_debug("Downloaded = {}".format(fname)) + + shutil.copyfile(fname, KUBE_ADMIN_CONF) + + log_debug("{} downloaded".format(KUBE_ADMIN_CONF)) + + +def _get_local_ipv6(): + try: + config_db = swsscommon.DBConnector("CONFIG_DB", 0) + mgmt_ip_data = swsscommon.Table(config_db, 'MGMT_INTERFACE') + for key in mgmt_ip_data.getKeys(): + if key.find(":") >= 0: + return key.split("|")[1].split("/")[0] + raise IOError("IPV6 not find from MGMT_INTERFACE table") + except Exception as e: + raise IOError(str(e)) + + +def _troubleshoot_tips(): + """ log troubleshoot tips which could be handy, + when in trouble with join + """ + msg = """ +if join fails, check the following +a. Ensure both master & node run same or compatible k8s versions +b. Check if this node already exists in master + Use 'sudo kubectl --kubeconfig=${KUBE_ADMIN_CONF} get nodes' to list nodes at master. + If yes, delete it, as the node is attempting a new join. + 'kubectl --kubeconfig=${KUBE_ADMIN_CONF} drain --ignore-daemonsets' + 'kubectl --kubeconfig=${KUBE_ADMIN_CONF} delete node ' +c. In Master check if all system pods are running good. + 'kubectl get pods --namespace kube-system' + If any not running properly, say READY column has 0/1, decribe pod for more detail. + 'kubectl --namespace kube-system describe pod ' + For additional details, look into pod's logs. + @ node: /var/log/pods//... + @ master: 'kubectl logs -n kube-system ' + """ + + (h, fname) = tempfile.mkstemp(suffix="kube_hints_") + os.write(h, str.encode(msg)) + os.close(h) + + log_error("Refer file {} for troubleshooting tips".format(fname)) + + +def _do_reset(pending_join = False): + # Drain & delete self from cluster. If not, the next join would fail + # + if os.path.exists(KUBE_ADMIN_CONF): + _run_command( + "kubectl --kubeconfig {} --request-timeout 20s drain {} --ignore-daemonsets". + format(KUBE_ADMIN_CONF, get_device_name())) + + _run_command("kubectl --kubeconfig {} --request-timeout 20s delete node {}". + format(KUBE_ADMIN_CONF, get_device_name())) + + _run_command("kubeadm reset -f", 10) + _run_command("rm -rf {}".format(CNI_DIR)) + if not pending_join: + _run_command("rm -f {}".format(KUBE_ADMIN_CONF)) + _run_command("systemctl stop kubelet") + + +def _do_join(server, port, insecure): + KUBEADM_JOIN_CMD = "kubeadm join --discovery-file {} --node-name {} --apiserver-advertise-address {}" + err = "" + out = "" + ret = 0 + try: + local_ipv6 = _get_local_ipv6() + #_download_file(server, port, insecure) + _gen_cli_kubeconf(server, port, insecure) + _do_reset(True) + _run_command("modprobe br_netfilter") + # Copy flannel.conf + _run_command("mkdir -p {}".format(CNI_DIR)) + _run_command("cp {} {}".format(FLANNEL_CONF_FILE, CNI_DIR)) + (ret, _, _) = _run_command("systemctl start kubelet") + + if ret == 0: + (ret, out, err) = _run_command(KUBEADM_JOIN_CMD.format( + KUBE_ADMIN_CONF, get_device_name(), local_ipv6), timeout=60) + log_debug("ret = {}".format(ret)) + + except IOError as e: + err = "Join failed: {}".format(str(e)) + ret = -1 + out = "" + + _troubleshoot_tips() + + if (ret != 0): + log_error(err) + + return (ret, out, err) + + +def kube_join_master(server, port, insecure, force=False): + """ The main function that initiates join to master """ + + out = "" + err = "" + ret = 0 + + log_debug("join: server:{} port:{} insecure:{} force:{}". + format(server, port, insecure, force)) + + lock_fd = _take_lock() + if not lock_fd: + log_error("Lock {} is active; Bail out".format(LOCK_FILE)) + return (-1, "", "") + + if ((not force) and is_connected(server)): + _run_command("systemctl start kubelet") + err = "Master {} is already connected. " + err += "Reset or join with force".format(server) + else: + (ret, out, err) = _do_join(server, port, insecure) + + log_debug("join: ret={} out:{} err:{}".format(ret, out, err)) + return (ret, out, err) + + +def kube_reset_master(force): + err = "" + ret = 0 + + lock_fd = _take_lock() + if not lock_fd: + log_error("Lock {} is active; Bail out".format(LOCK_FILE)) + return (-1, "") + + if not force: + if not is_connected(): + err = "Currently not connected to master. " + err += "Use force reset if needed" + log_debug("Not connected ... bailing out") + ret = -1 + + if ret == 0: + _do_reset() + else: + _run_command("systemctl stop kubelet") + + return (ret, err) + + + +def main(): + syslog.openlog("kube_commands") + parser=argparse.ArgumentParser(description= + "get-labels") + subparsers = parser.add_subparsers(title='actions') + + parser_get_labels = subparsers.add_parser("get-labels", + help="Get current labels on node") + parser_get_labels.set_defaults(func=func_get_labels) + + parser_is_connected = subparsers.add_parser("connected", + help="Get connnected status") + parser_is_connected.set_defaults(func=func_is_connected) + + if len(sys.argv) < 2: + parser.print_help() + return -1 + + args = parser.parse_args() + ret = args.func(args) + + syslog.closelog() + return ret + + +if __name__ == "__main__": + if os.geteuid() != 0: + exit("Please run as root. Exiting ...") + main() + sys.exit(0)