diff --git a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml index 35988f71b9b4..cc6135b045ef 100644 --- a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml +++ b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml @@ -38,7 +38,6 @@ parameters: - centec - centec-arm64 - generic - - innovium - marvell-armhf - mellanox diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index 7c312de85931..c84c91441806 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -50,6 +50,7 @@ jobs: swi_image: yes - name: broadcom + timeoutInMinutes: 1440 variables: dbg_image: yes swi_image: yes @@ -131,3 +132,4 @@ jobs: make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin fi displayName: "Build sonic image" + - template: check-dirty-version.yml diff --git a/.azure-pipelines/azure-pipelines-download-certificate.yml b/.azure-pipelines/azure-pipelines-download-certificate.yml new file mode 100644 index 000000000000..3e1a58582f61 --- /dev/null +++ b/.azure-pipelines/azure-pipelines-download-certificate.yml @@ -0,0 +1,33 @@ +parameters: +- name: connectionName + type: string + default: sonic-dev-connection +- name: kevaultName + type: string + default: sonic-kv +- name: certificateName + type: string + default: sonic-secure-boot + +steps: +- task: AzureKeyVault@2 + inputs: + connectedServiceName: ${{ parameters.connectionName }} + keyVaultName: ${{ parameters.kevaultName }} + secretsFilter: ${{ parameters.certificateName }} + +- script: | + set -e + TMP_FILE=$(mktemp) + echo "$CERTIFICATE" | base64 -d > $TMP_FILE + sudo mkdir -p /etc/certificates + mkdir -p $(Build.StagingDirectory)/target + # Save the public key + openssl pkcs12 -in $TMP_FILE -clcerts --nokeys -nodes -passin pass: | sed -z -e "s/.*\(-----BEGIN CERTIFICATE\)/\1/" > $(SIGNING_CERT) + # Save the private key + openssl pkcs12 -in $TMP_FILE -nocerts -nodes -passin pass: | sed -z -e "s/.*\(-----BEGIN PRIVATE KEY\)/\1/" | sudo tee $(SIGNING_KEY) 1>/dev/null + ls -lt $(SIGNING_CERT) $(SIGNING_KEY) + rm $TMP_FILE + env: + CERTIFICATE: $(${{ parameters.certificateName }}) + displayName: "Save certificate" diff --git a/.azure-pipelines/check-dirty-version.yml b/.azure-pipelines/check-dirty-version.yml new file mode 100644 index 000000000000..5d3909bd280e --- /dev/null +++ b/.azure-pipelines/check-dirty-version.yml @@ -0,0 +1,16 @@ +steps: +- script: | + . functions.sh + SONIC_VERSION=$(sonic_get_version) + echo "SONIC_VERSION=$SONIC_VERSION" + if [[ "$SONIC_VERSION" == *dirty* ]]; then + # Print the detail dirty info + git status --untracked-files=no -s --ignore-submodules + + # Exit with error, if it is a PR build + if [ "$(Build.Reason)" == "PullRequest" ]; then + echo "Build failed for the dirty version: $SONIC_VERSION" 1>&2 + exit 1 + fi + fi + displayName: "Check the dirty version" diff --git a/.azure-pipelines/docker-sonic-slave-template.yml b/.azure-pipelines/docker-sonic-slave-template.yml index ac5eb9a34722..2cf06638a4cc 100644 --- a/.azure-pipelines/docker-sonic-slave-template.yml +++ b/.azure-pipelines/docker-sonic-slave-template.yml @@ -101,10 +101,13 @@ jobs: containerRegistry: ${{ parameters.registry_conn }} repository: $(VARIABLE_SLAVE_BASE_IMAGE) command: push - tags: | - $(VARIABLE_SLAVE_BASE_TAG) - ${{ if eq(variables['Build.SourceBranchName'], 'master') }}: + ${{ if eq(variables['Build.SourceBranchName'], 'master') }}: + tags: | + $(VARIABLE_SLAVE_BASE_TAG) latest + ${{ else }}: + tags: | + $(VARIABLE_SLAVE_BASE_TAG) - ${{ if ne(parameters.arch, 'amd64') }}: - task: Docker@2 condition: ne(variables['Build.Reason'], 'PullRequest') diff --git a/.azure-pipelines/docker-sonic-slave.yml b/.azure-pipelines/docker-sonic-slave.yml index 7b812b8a4349..3ae3f88f0154 100644 --- a/.azure-pipelines/docker-sonic-slave.yml +++ b/.azure-pipelines/docker-sonic-slave.yml @@ -60,7 +60,7 @@ stages: - ${{ each dist in parameters.dists }}: - ${{ if endswith(variables['Build.DefinitionName'], dist) }}: - ${{ each arch in parameters.arches }}: - - ${{ if eq(variables['System.PullRequest.TargetBranch'], 'master') }}: + - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: - template: docker-sonic-slave-template.yml parameters: pool: sonicbld diff --git a/.azure-pipelines/official-build-cisco-8000.yml b/.azure-pipelines/official-build-cisco-8000.yml index 61b6b03171e3..474d3e743ff7 100644 --- a/.azure-pipelines/official-build-cisco-8000.yml +++ b/.azure-pipelines/official-build-cisco-8000.yml @@ -22,10 +22,17 @@ resources: name: Cisco-8000-sonic/platform-cisco-8000 endpoint: cisco-connection + variables: - group: SONIC-AKV-STROAGE-1 - name: StorageSASKey value: $(sonicstorage-SasToken) +- name: SONIC_ENABLE_SECUREBOOT_SIGNATURE + value: y +- name: SIGNING_KEY + value: /etc/certificates/sonic-secure-boot-private.pem +- name: SIGNING_CERT + value: $(Build.StagingDirectory)/target/sonic-secure-boot-public.pem stages: - stage: Build @@ -41,6 +48,7 @@ stages: parameters: buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}' preSteps: + - template: azure-pipelines-download-certificate.yml - checkout: self submodules: recursive path: s @@ -90,5 +98,10 @@ stages: StorageSASKey: $(StorageSASKey) condition: ne(variables['Build.Reason'], 'PullRequest') displayName: "Override cisco sai packages" + - script: | + echo "SONIC_ENABLE_SECUREBOOT_SIGNATURE := y" >> rules/config.user + echo "SIGNING_KEY := $(SIGNING_KEY)" >> rules/config.user + echo "SIGNING_CERT := $(SIGNING_CERT)" >> rules/config.user + displayName: "Enable secure boot signature" jobGroups: - name: cisco-8000 diff --git a/.azure-pipelines/template-commonlib.yml b/.azure-pipelines/template-commonlib.yml index 0e42cb4e17ac..61a801e3f526 100644 --- a/.azure-pipelines/template-commonlib.yml +++ b/.azure-pipelines/template-commonlib.yml @@ -2,33 +2,39 @@ jobs: - job: Build timeoutInMinutes: 120 pool: sonicbld + variables: + - template: template-variables.yml steps: - checkout: self clean: true submodules: recursive - script: | set -ex - case $(Build.SourceBranchName) in - 202012 | 202106) - bldenv=buster - ;; - *) - bldenv=bullseye - ;; - esac - BLDENV=$bldenv make -f Makefile.work configure PLATFORM=vs ENABLE_DOCKER_BASE_PULL=y - echo "##vso[task.setvariable variable=bldenv;]$bldenv" + branch=$(Build.SourceBranchName) + # DIST_MASTER is set in variable. + BRANCH=DIST_${branch^^} + bldenvs=${!BRANCH} + [ "$bldenvs" == "" ] && bldenvs="$(COMMON_LIB_BUILD_ENVS)" + for bldenv in $bldenvs + do + BLDENV=$bldenv make -f Makefile.work configure PLATFORM=vs ENABLE_DOCKER_BASE_PULL=y + done + set +x + echo "##vso[task.setvariable variable=bldenvs;]$bldenvs" displayName: Make configure - script: | set -ex - LIBNL3_VERSION_BASE=$(grep "LIBNL3_VERSION_BASE =" rules/libnl3.mk | awk '{print$3}') - LIBNL3_VERSION=$(grep "LIBNL3_VERSION =" rules/libnl3.mk | awk '{print$3}' | sed -e "s/(//" -e "s/)//" -e "s/\\$//" -e "s/LIBNL3_VERSION_BASE/$LIBNL3_VERSION_BASE/") - BLDENV=$(bldenv) make -f Makefile.work target/debs/$(bldenv)/libnl-3-200_${LIBNL3_VERSION}_amd64.deb ENABLE_DOCKER_BASE_PULL=y + for bldenv in $(bldenvs) + do + LIBNL3_VERSION_BASE=$(grep "LIBNL3_VERSION_BASE =" rules/libnl3.mk | awk '{print$3}') + LIBNL3_VERSION=$(grep "LIBNL3_VERSION =" rules/libnl3.mk | awk '{print$3}' | sed -e "s/(//" -e "s/)//" -e "s/\\$//" -e "s/LIBNL3_VERSION_BASE/$LIBNL3_VERSION_BASE/") + SONIC_BUILD_JOBS=$(nproc) BLDENV=$bldenv make -f Makefile.work target/debs/$bldenv/libnl-3-200_${LIBNL3_VERSION}_amd64.deb ENABLE_DOCKER_BASE_PULL=y - LIBYANG_VERSION_BASE=$(grep "LIBYANG_VERSION_BASE =" rules/libyang.mk | awk '{print$3}') - LIBYANG_VERSION=$(grep "LIBYANG_VERSION =" rules/libyang.mk | awk '{print$3}' | sed -e "s/\\$//" -e "s/(//" -e "s/)//" -e "s/LIBYANG_VERSION_BASE/$LIBYANG_VERSION_BASE/") - BLDENV=$(bldenv) make -f Makefile.work target/debs/$(bldenv)/libyang_${LIBYANG_VERSION}_amd64.deb - find target -name *.deb | xargs -i cp {} $(Build.ArtifactStagingDirectory) + LIBYANG_VERSION_BASE=$(grep "LIBYANG_VERSION_BASE =" rules/libyang.mk | awk '{print$3}') + LIBYANG_VERSION=$(grep "LIBYANG_VERSION =" rules/libyang.mk | awk '{print$3}' | sed -e "s/\\$//" -e "s/(//" -e "s/)//" -e "s/LIBYANG_VERSION_BASE/$LIBYANG_VERSION_BASE/") + SONIC_BUILD_JOBS=$(nproc) BLDENV=$bldenv make -f Makefile.work target/debs/$bldenv/libyang_${LIBYANG_VERSION}_amd64.deb + done + mv target $(Build.ArtifactStagingDirectory) displayName: Make common lib packages - publish: $(Build.ArtifactStagingDirectory) artifact: common-lib diff --git a/.azure-pipelines/template-variables.yml b/.azure-pipelines/template-variables.yml index f28768e39efe..9f192d35bd5e 100644 --- a/.azure-pipelines/template-variables.yml +++ b/.azure-pipelines/template-variables.yml @@ -1,2 +1,3 @@ variables: DEFAULT_CONTAINER_REGISTRY: 'publicmirror.azurecr.io' + COMMON_LIB_BUILD_ENVS: 'bullseye' diff --git a/.gitmodules b/.gitmodules index d503fcc4db39..f551e1dcbbc3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -62,6 +62,9 @@ [submodule "src/redis-dump-load"] path = src/redis-dump-load url = https://github.com/p/redis-dump-load.git +[submodule "src/scapy"] + path = src/scapy + url = https://github.com/secdev/scapy.git [submodule "platform/mellanox/mlnx-sai/SAI-Implementation"] path = platform/mellanox/mlnx-sai/SAI-Implementation url = https://github.com/Mellanox/SAI-Implementation @@ -103,6 +106,6 @@ [submodule "src/sonic-p4rt/sonic-pins"] path = src/sonic-p4rt/sonic-pins url = https://github.com/Azure/sonic-pins.git -[submodule "src/thrift_0_14_1/thrift"] - path = src/thrift_0_14_1/thrift - url = https://github.com/apache/thrift.git +[submodule "src/ptf-py3"] + path = src/ptf-py3 + url = https://github.com/p4lang/ptf.git diff --git a/Makefile.work b/Makefile.work index db1e5b74d3a5..787091a9f268 100644 --- a/Makefile.work +++ b/Makefile.work @@ -188,6 +188,17 @@ ifneq ($(SONIC_DPKG_CACHE_SOURCE),) DOCKER_RUN += -v "$(SONIC_DPKG_CACHE_SOURCE):/dpkg_cache:rw" endif +ifeq ($(SONIC_ENABLE_SECUREBOOT_SIGNATURE), y) +ifneq ($(SIGNING_KEY),) + DOCKER_SIGNING_SOURCE := $(shell dirname $(SIGNING_KEY)) + DOCKER_RUN += -v "$(DOCKER_SIGNING_SOURCE):$(DOCKER_SIGNING_SOURCE):ro" +endif +ifneq ($(SIGNING_CERT),) + DOCKER_SIGNING_SOURCE := $(shell dirname $(SIGNING_CERT)) + DOCKER_RUN += -v "$(DOCKER_SIGNING_SOURCE):$(DOCKER_SIGNING_SOURCE):ro" +endif +endif + ifeq ($(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD), y) ifneq ($(MULTIARCH_QEMU_ENVIRON), y) DOCKER_RUN += -v /var/run/docker.sock:/var/run/docker.sock @@ -297,6 +308,7 @@ SONIC_BUILD_INSTRUCTION := make \ EXTRA_DOCKER_TARGETS=$(EXTRA_DOCKER_TARGETS) \ BUILD_LOG_TIMESTAMP=$(BUILD_LOG_TIMESTAMP) \ SONIC_ENABLE_IMAGE_SIGNATURE=$(ENABLE_IMAGE_SIGNATURE) \ + SONIC_ENABLE_SECUREBOOT_SIGNATURE=$(SONIC_ENABLE_SECUREBOOT_SIGNATURE) \ SONIC_DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ ENABLE_HOST_SERVICE_ON_START=$(ENABLE_HOST_SERVICE_ON_START) \ SLAVE_DIR=$(SLAVE_DIR) \ diff --git a/build_debian.sh b/build_debian.sh index 0208d7d9711d..ad6b9522e3ec 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -113,6 +113,12 @@ sudo cp files/apt/apt.conf.d/{81norecommends,apt-{clean,gzip-indexes,no-language ## Note: set lang to prevent locale warnings in your chroot sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y update sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y upgrade + +echo '[INFO] Install and setup eatmydata' +sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install eatmydata +sudo LANG=C chroot $FILESYSTEM_ROOT ln -s /usr/bin/eatmydata /usr/local/bin/dpkg +echo 'Dir::Bin::dpkg "/usr/local/bin/dpkg";' | sudo tee $FILESYSTEM_ROOT/etc/apt/apt.conf.d/00image-install-eatmydata > /dev/null + echo '[INFO] Install packages for building image' sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install makedev psmisc @@ -143,6 +149,23 @@ if [[ $CONFIGURED_ARCH == amd64 ]]; then sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install dmidecode hdparm fi +## Sign the Linux kernel +if [ "$SONIC_ENABLE_SECUREBOOT_SIGNATURE" = "y" ]; then + if [ ! -f $SIGNING_KEY ]; then + echo "Error: SONiC linux kernel signing key missing" + exit 1 + fi + if [ ! -f $SIGNING_CERT ]; then + echo "Error: SONiC linux kernel signing certificate missing" + exit 1 + fi + + echo '[INFO] Signing SONiC linux kernel image' + K=$FILESYSTEM_ROOT/boot/vmlinuz-${LINUX_KERNEL_VERSION}-amd64 + sbsign --key $SIGNING_KEY --cert $SIGNING_CERT --output /tmp/${K##*/} ${K} + sudo cp -f /tmp/${K##*/} ${K} +fi + ## Update initramfs for booting with squashfs+overlay cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null @@ -397,7 +420,8 @@ fi ## Remove sshd host keys, and will regenerate on first sshd start sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* sudo cp files/sshd/host-ssh-keygen.sh $FILESYSTEM_ROOT/usr/local/bin/ -sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.service +sudo mkdir $FILESYSTEM_ROOT/etc/systemd/system/ssh.service.d +sudo cp files/sshd/override.conf $FILESYSTEM_ROOT/etc/systemd/system/ssh.service.d/override.conf # Config sshd # 1. Set 'UseDNS' to 'no' # 2. Configure sshd to close all SSH connetions after 15 minutes of inactivity @@ -460,7 +484,7 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'setup sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'wheel==0.35.1' # docker Python API package is needed by Ansible docker module as well as some SONiC applications -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'docker==4.3.1' +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'docker==5.0.3' # Install scapy sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'scapy==2.4.4' @@ -586,6 +610,10 @@ scripts/collect_host_image_version_files.sh $TARGET_PATH $FILESYSTEM_ROOT # Remove GCC sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc +# Remove eatmydata +sudo rm $FILESYSTEM_ROOT/etc/apt/apt.conf.d/00image-install-eatmydata $FILESYSTEM_ROOT/usr/local/bin/dpkg +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove eatmydata + ## Clean up apt sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y autoremove sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean diff --git a/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json index ce592286078c..6bde8eab7648 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json +++ b/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json @@ -53,7 +53,8 @@ ], "custom_kos": [ - "pddf_custom_psu" + "pddf_custom_psu", + "accton_as9716_32d_ioport" ] }, diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/td3-a7050cx3-32s-32x100G.config.bcm b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/td3-a7050cx3-32s-32x100G.config.bcm index 59e9a4e6a5bb..ec6bb2c391bf 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/td3-a7050cx3-32s-32x100G.config.bcm +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/td3-a7050cx3-32s-32x100G.config.bcm @@ -6,6 +6,7 @@ sai_trap_group_priority=1000 use_all_splithorizon_groups=1 riot_enable=1 sai_tunnel_support=1 +sai_tunnel_underlay_route_mode=1 riot_overlay_l3_intf_mem_size=4096 riot_overlay_l3_egress_mem_size=32768 l3_ecmp_levels=2 @@ -52,7 +53,7 @@ stable_size=0x5500000 tdma_timeout_usec=15000000 tslam_timeout_usec=15000000 sai_optimized_mmu=1 -mmu_init_config="TD3-MSFT-T0-100G" +mmu_init_config="TD3-MSFT-CUSTOM" buf.map.egress_pool0.ingress_pool=0 buf.map.egress_pool1.ingress_pool=0 buf.map.egress_pool2.ingress_pool=1 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 index 04fddf486ace..413bd575413c 100644 --- 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 @@ -66,6 +66,72 @@ "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": "2", + "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 %} @@ -80,6 +146,16 @@ "5": "0", "6": "0", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0" } }, {%- endmacro %} @@ -94,6 +170,30 @@ "5": "5", "6": "6", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "33", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48" } }, {%- endmacro %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/td3-a7050cx3-32s-48x50G+8x100G.config.bcm b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/td3-a7050cx3-32s-48x50G+8x100G.config.bcm index 797503aa6818..ee134caf33eb 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/td3-a7050cx3-32s-48x50G+8x100G.config.bcm +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/td3-a7050cx3-32s-48x50G+8x100G.config.bcm @@ -6,6 +6,7 @@ sai_trap_group_priority=1000 use_all_splithorizon_groups=1 riot_enable=1 sai_tunnel_support=1 +sai_tunnel_underlay_route_mode=1 riot_overlay_l3_intf_mem_size=4096 riot_overlay_l3_egress_mem_size=32768 l3_ecmp_levels=2 @@ -52,7 +53,7 @@ stable_size=0x5500000 tdma_timeout_usec=15000000 tslam_timeout_usec=15000000 sai_optimized_mmu=1 -mmu_init_config="TD3-MSFT-T0-50G" +mmu_init_config="TD3-MSFT-CUSTOM" buf.map.egress_pool0.ingress_pool=0 buf.map.egress_pool1.ingress_pool=0 buf.map.egress_pool2.ingress_pool=1 diff --git a/device/arista/x86_64-arista_7050cx3_32s/td3-a7050cx3-32s-flex.config.bcm b/device/arista/x86_64-arista_7050cx3_32s/td3-a7050cx3-32s-flex.config.bcm index fef962c852b7..70a579e01eeb 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/td3-a7050cx3-32s-flex.config.bcm +++ b/device/arista/x86_64-arista_7050cx3_32s/td3-a7050cx3-32s-flex.config.bcm @@ -397,6 +397,7 @@ robust_hash_disable_mpls=1 robust_hash_disable_vlan=1 sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ sai_tunnel_support=1 +sai_tunnel_underlay_route_mode=1 serdes_core_rx_polarity_flip_physical{1}=0x8 serdes_core_rx_polarity_flip_physical{5}=0x2 serdes_core_rx_polarity_flip_physical{9}=0xc diff --git a/device/arista/x86_64-arista_7060dx4_32/platform.json b/device/arista/x86_64-arista_7060dx4_32/platform.json index 7a38cbe3d9f3..425d9c87d6ce 100644 --- a/device/arista/x86_64-arista_7060dx4_32/platform.json +++ b/device/arista/x86_64-arista_7060dx4_32/platform.json @@ -236,6 +236,9 @@ "Ethernet1/3", "Ethernet1/5", "Ethernet1/7" + ], + "1x100G(4)": [ + "Ethernet1/1" ] } }, @@ -255,6 +258,9 @@ "Ethernet2/3", "Ethernet2/5", "Ethernet2/7" + ], + "1x100G(4)": [ + "Ethernet2/1" ] } }, @@ -274,6 +280,9 @@ "Ethernet3/3", "Ethernet3/5", "Ethernet3/7" + ], + "1x100G(4)": [ + "Ethernet3/1" ] } }, @@ -293,6 +302,9 @@ "Ethernet4/3", "Ethernet4/5", "Ethernet4/7" + ], + "1x100G(4)": [ + "Ethernet4/1" ] } }, @@ -312,6 +324,9 @@ "Ethernet5/3", "Ethernet5/5", "Ethernet5/7" + ], + "1x100G(4)": [ + "Ethernet5/1" ] } }, @@ -331,6 +346,9 @@ "Ethernet6/3", "Ethernet6/5", "Ethernet6/7" + ], + "1x100G(4)": [ + "Ethernet6/1" ] } }, @@ -350,6 +368,9 @@ "Ethernet7/3", "Ethernet7/5", "Ethernet7/7" + ], + "1x100G(4)": [ + "Ethernet7/1" ] } }, @@ -369,6 +390,9 @@ "Ethernet8/3", "Ethernet8/5", "Ethernet8/7" + ], + "1x100G(4)": [ + "Ethernet8/1" ] } }, @@ -388,6 +412,9 @@ "Ethernet9/3", "Ethernet9/5", "Ethernet9/7" + ], + "1x100G(4)": [ + "Ethernet9/1" ] } }, @@ -407,6 +434,9 @@ "Ethernet10/3", "Ethernet10/5", "Ethernet10/7" + ], + "1x100G(4)": [ + "Ethernet10/1" ] } }, @@ -426,6 +456,9 @@ "Ethernet11/3", "Ethernet11/5", "Ethernet11/7" + ], + "1x100G(4)": [ + "Ethernet11/1" ] } }, @@ -445,6 +478,9 @@ "Ethernet12/3", "Ethernet12/5", "Ethernet12/7" + ], + "1x100G(4)": [ + "Ethernet12/1" ] } }, @@ -464,6 +500,9 @@ "Ethernet13/3", "Ethernet13/5", "Ethernet13/7" + ], + "1x100G(4)": [ + "Ethernet13/1" ] } }, @@ -483,6 +522,9 @@ "Ethernet14/3", "Ethernet14/5", "Ethernet14/7" + ], + "1x100G(4)": [ + "Ethernet14/1" ] } }, @@ -502,6 +544,9 @@ "Ethernet15/3", "Ethernet15/5", "Ethernet15/7" + ], + "1x100G(4)": [ + "Ethernet15/1" ] } }, @@ -521,6 +566,9 @@ "Ethernet16/3", "Ethernet16/5", "Ethernet16/7" + ], + "1x100G(4)": [ + "Ethernet16/1" ] } }, @@ -540,6 +588,9 @@ "Ethernet17/3", "Ethernet17/5", "Ethernet17/7" + ], + "1x100G(4)": [ + "Ethernet17/1" ] } }, @@ -559,6 +610,9 @@ "Ethernet18/3", "Ethernet18/5", "Ethernet18/7" + ], + "1x100G(4)": [ + "Ethernet18/1" ] } }, @@ -578,6 +632,9 @@ "Ethernet19/3", "Ethernet19/5", "Ethernet19/7" + ], + "1x100G(4)": [ + "Ethernet19/1" ] } }, @@ -597,6 +654,9 @@ "Ethernet20/3", "Ethernet20/5", "Ethernet20/7" + ], + "1x100G(4)": [ + "Ethernet20/1" ] } }, @@ -616,6 +676,9 @@ "Ethernet21/3", "Ethernet21/5", "Ethernet21/7" + ], + "1x100G(4)": [ + "Ethernet21/1" ] } }, @@ -635,6 +698,9 @@ "Ethernet22/3", "Ethernet22/5", "Ethernet22/7" + ], + "1x100G(4)": [ + "Ethernet22/1" ] } }, @@ -654,6 +720,9 @@ "Ethernet23/3", "Ethernet23/5", "Ethernet23/7" + ], + "1x100G(4)": [ + "Ethernet23/1" ] } }, @@ -673,6 +742,9 @@ "Ethernet24/3", "Ethernet24/5", "Ethernet24/7" + ], + "1x100G(4)": [ + "Ethernet24/1" ] } }, @@ -692,6 +764,9 @@ "Ethernet25/3", "Ethernet25/5", "Ethernet25/7" + ], + "1x100G(4)": [ + "Ethernet25/1" ] } }, @@ -711,6 +786,9 @@ "Ethernet26/3", "Ethernet26/5", "Ethernet26/7" + ], + "1x100G(4)": [ + "Ethernet26/1" ] } }, @@ -730,6 +808,9 @@ "Ethernet27/3", "Ethernet27/5", "Ethernet27/7" + ], + "1x100G(4)": [ + "Ethernet27/1" ] } }, @@ -749,6 +830,9 @@ "Ethernet28/3", "Ethernet28/5", "Ethernet28/7" + ], + "1x100G(4)": [ + "Ethernet28/1" ] } }, @@ -768,6 +852,9 @@ "Ethernet29/3", "Ethernet29/5", "Ethernet29/7" + ], + "1x100G(4)": [ + "Ethernet29/1" ] } }, @@ -787,6 +874,9 @@ "Ethernet30/3", "Ethernet30/5", "Ethernet30/7" + ], + "1x100G(4)": [ + "Ethernet30/1" ] } }, @@ -806,6 +896,9 @@ "Ethernet31/3", "Ethernet31/5", "Ethernet31/7" + ], + "1x100G(4)": [ + "Ethernet31/1" ] } }, @@ -825,6 +918,9 @@ "Ethernet32/3", "Ethernet32/5", "Ethernet32/7" + ], + "1x100G(4)": [ + "Ethernet32/1" ] } }, diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/buffers_defaults_t0.j2 index 568b74b34a41..a6eefe8d36b0 100644 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/buffers_defaults_t0.j2 +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/buffers_defaults_t0.j2 @@ -61,11 +61,15 @@ {%- macro generate_queue_buffers(port_names) %} "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "egress_lossless_profile" - }, - "{{ port_names }}|0-1": { +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { "profile" : "q_lossy_profile" - } + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} } {%- endmacro %} diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/buffers_defaults_t1.j2 index 161afd10cea3..563137d90b90 100644 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/buffers_defaults_t1.j2 +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/buffers_defaults_t1.j2 @@ -61,11 +61,15 @@ {%- macro generate_queue_buffers(port_names) %} "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "egress_lossless_profile" - }, - "{{ port_names }}|0-1": { +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { "profile" : "q_lossy_profile" - } + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} } {%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/config.bcm.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/config.bcm.j2 index 9410a83b6716..db5b2562cca2 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/config.bcm.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/config.bcm.j2 @@ -12,6 +12,7 @@ {%- set switch_subtype = DEVICE_METADATA['localhost']['subtype'] -%} {%- if 'dualtor' in switch_subtype.lower() %} {%- set IPinIP_sock = 'sai_tunnel_support=1 + sai_tunnel_underlay_route_mode=1 host_as_route_disable=1 l3_ecmp_levels=2' -%} {%- endif %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 index 4178efbcb7aa..27f6b531cb08 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 @@ -151,6 +151,72 @@ "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": "2", + "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 %} @@ -165,6 +231,16 @@ "5": "0", "6": "0", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0" } }, {%- endmacro %} @@ -173,12 +249,36 @@ "AZURE": { "0": "0", "1": "1", - "2": "1", + "2": "1", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "33", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48" } }, {%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/config.bcm.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/config.bcm.j2 index d9d8347b50ae..70512203f206 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/config.bcm.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/config.bcm.j2 @@ -4,6 +4,7 @@ {%- set switch_subtype = DEVICE_METADATA['localhost']['subtype'] -%} {%- if 'dualtor' in switch_subtype.lower() %} {%- set IPinIP_sock = 'sai_tunnel_support=1 + sai_tunnel_underlay_route_mode=1 host_as_route_disable=1 l3_ecmp_levels=2' -%} {%- endif %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/config.bcm.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/config.bcm.j2 index de65d73d40a1..ce8efa8572b5 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/config.bcm.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/config.bcm.j2 @@ -12,6 +12,7 @@ {%- set switch_subtype = DEVICE_METADATA['localhost']['subtype'] -%} {%- if 'dualtor' in switch_subtype.lower() %} {%- set IPinIP_sock = 'sai_tunnel_support=1 + sai_tunnel_underlay_route_mode=1 host_as_route_disable=1 l3_ecmp_levels=2' -%} {%- endif %} diff --git a/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_config.json b/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_config.json index e05ee11290ac..5a1fd88d49ad 100644 --- a/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_config.json +++ b/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_config.json @@ -5,7 +5,7 @@ "name": "phy1", "address": "1", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy1_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -19,7 +19,7 @@ "name": "phy2", "address": "2", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy2_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -33,7 +33,7 @@ "name": "phy3", "address": "3", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy3_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -47,7 +47,7 @@ "name": "phy4", "address": "4", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy4_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -61,7 +61,7 @@ "name": "phy5", "address": "5", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy5_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -75,7 +75,7 @@ "name": "phy6", "address": "6", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy6_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -89,7 +89,7 @@ "name": "phy7", "address": "7", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy7_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -103,7 +103,7 @@ "name": "phy8", "address": "8", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy8_config.json", "sai_init_config_file": "", "phy_access": "mdio", 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 61026aad524e..f6f1774d8ee2 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 @@ -362,6 +362,55 @@ ucode_port_46=CGE2_25:core_1.46 ucode_port_47=CGE2_26:core_1.47 ucode_port_48=CGE2_24:core_1.48 +serdes_tx_taps_1=pam4:-18:86:0:4:0:0 +serdes_tx_taps_2=pam4:-18:86:0:4:0:0 +serdes_tx_taps_3=pam4:-18:86:0:4:0:0 +serdes_tx_taps_4=pam4:-18:86:0:4:0:0 +serdes_tx_taps_5=pam4:-18:86:0:4:0:0 +serdes_tx_taps_6=pam4:-18:86:0:4:0:0 +serdes_tx_taps_7=pam4:-18:86:0:4:0:0 +serdes_tx_taps_8=pam4:-18:86:0:4:0:0 +serdes_tx_taps_9=pam4:-18:86:0:4:0:0 +serdes_tx_taps_10=pam4:-18:86:0:4:0:0 +serdes_tx_taps_11=pam4:-18:86:0:4:0:0 +serdes_tx_taps_12=pam4:-18:86:0:4:0:0 +serdes_tx_taps_13=pam4:-18:86:0:4:0:0 +serdes_tx_taps_14=pam4:-18:86:0:4:0:0 +serdes_tx_taps_15=pam4:-18:86:0:4:0:0 +serdes_tx_taps_16=pam4:-18:86:0:4:0:0 +serdes_tx_taps_17=pam4:-18:86:0:4:0:0 +serdes_tx_taps_18=pam4:-18:86:0:4:0:0 +serdes_tx_taps_19=pam4:-18:86:0:4:0:0 +serdes_tx_taps_20=pam4:-18:86:0:4:0:0 +serdes_tx_taps_21=pam4:-18:86:0:4:0:0 +serdes_tx_taps_22=pam4:-18:86:0:4:0:0 +serdes_tx_taps_23=pam4:-18:86:0:4:0:0 +serdes_tx_taps_24=pam4:-18:86:0:4:0:0 +serdes_tx_taps_25=pam4:-18:86:0:4:0:0 +serdes_tx_taps_26=pam4:-18:86:0:4:0:0 +serdes_tx_taps_27=pam4:-18:86:0:4:0:0 +serdes_tx_taps_28=pam4:-18:86:0:4:0:0 +serdes_tx_taps_29=pam4:-18:86:0:4:0:0 +serdes_tx_taps_30=pam4:-18:86:0:4:0:0 +serdes_tx_taps_31=pam4:-18:86:0:4:0:0 +serdes_tx_taps_32=pam4:-18:86:0:4:0:0 +serdes_tx_taps_33=pam4:-18:86:0:4:0:0 +serdes_tx_taps_34=pam4:-18:86:0:4:0:0 +serdes_tx_taps_35=pam4:-18:86:0:4:0:0 +serdes_tx_taps_36=pam4:-18:86:0:4:0:0 +serdes_tx_taps_37=pam4:-18:86:0:4:0:0 +serdes_tx_taps_38=pam4:-18:86:0:4:0:0 +serdes_tx_taps_39=pam4:-18:86:0:4:0:0 +serdes_tx_taps_40=pam4:-18:86:0:4:0:0 +serdes_tx_taps_41=pam4:-18:86:0:4:0:0 +serdes_tx_taps_42=pam4:-18:86:0:4:0:0 +serdes_tx_taps_43=pam4:-18:86:0:4:0:0 +serdes_tx_taps_44=pam4:-18:86:0:4:0:0 +serdes_tx_taps_45=pam4:-18:86:0:4:0:0 +serdes_tx_taps_46=pam4:-18:86:0:4:0:0 +serdes_tx_taps_47=pam4:-18:86:0:4:0:0 +serdes_tx_taps_48=pam4:-18:86:0:4:0:0 + ucode_port_0.BCM8869X=CPU.0:core_0.0 ucode_port_200.BCM8869X=CPU.8:core_1.200 ucode_port_201.BCM8869X=CPU.16:core_0.201 diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_100G_PAM4.xml b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_100G_PAM4.xml index 95e20b91787e..044ef034a52d 100644 --- a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_100G_PAM4.xml +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_100G_PAM4.xml @@ -4,11 +4,6 @@ 0 gearbox 2 - - 2,-8,17,0,0 - 0,-8,17,0,0 - - 0,0,1,0,0 @@ -34,4 +29,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_config.json b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_config.json index d72df085bb88..b082868e95be 100644 --- a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_config.json +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_config.json @@ -5,7 +5,7 @@ "name": "phy1", "address": "1", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy1_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -19,7 +19,7 @@ "name": "phy2", "address": "2", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy2_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -33,7 +33,7 @@ "name": "phy3", "address": "3", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy3_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -47,7 +47,7 @@ "name": "phy4", "address": "4", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy4_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -61,7 +61,7 @@ "name": "phy5", "address": "5", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy5_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -75,7 +75,7 @@ "name": "phy6", "address": "6", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy6_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -89,7 +89,7 @@ "name": "phy7", "address": "7", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy7_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -103,7 +103,7 @@ "name": "phy8", "address": "8", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy8_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -117,7 +117,7 @@ "name": "phy9", "address": "9", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy9_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -131,7 +131,7 @@ "name": "phy10", "address": "10", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy10_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -145,7 +145,7 @@ "name": "phy11", "address": "11", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy11_config.json", "sai_init_config_file": "", "phy_access": "mdio", @@ -159,7 +159,7 @@ "name": "phy12", "address": "12", "lib_name": "", - "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.92.1.bin", + "firmware_path": "/usr/etc/credo/firmware/owl.lz4.fw.1.94.0.bin", "config_file": "/usr/share/sonic/hwsku/phy12_config.json", "sai_init_config_file": "", "phy_access": "mdio", 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 34c5db2ef708..a06f62f733ae 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 @@ -16,8 +16,7 @@ "ingress_lossless_pool": { "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", - "mode": "dynamic", - "xoff": "36222208" + "mode": "dynamic" }, "ingress_lossy_pool": { "size": "{{ ingress_lossy_pool_size }}", @@ -61,11 +60,15 @@ {%- macro generate_queue_buffers(port_names) %} "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "egress_lossless_profile" - }, - "{{ port_names }}|0-1": { +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { "profile" : "q_lossy_profile" - } + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} } {%- endmacro %} 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 34c5db2ef708..a06f62f733ae 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 @@ -16,8 +16,7 @@ "ingress_lossless_pool": { "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", - "mode": "dynamic", - "xoff": "36222208" + "mode": "dynamic" }, "ingress_lossy_pool": { "size": "{{ ingress_lossy_pool_size }}", @@ -61,11 +60,15 @@ {%- macro generate_queue_buffers(port_names) %} "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "egress_lossless_profile" - }, - "{{ port_names }}|0-1": { +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { "profile" : "q_lossy_profile" - } + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} } {%- endmacro %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t0.j2 b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t0.j2 index 3e18b6dbad08..0e096c39d4dd 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t0.j2 +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t0.j2 @@ -63,21 +63,17 @@ }, {%- endmacro %} -{%- macro generate_pg_profils(port_names) %} - "BUFFER_PG": { - "{{ port_names }}|3-4": { - "profile" : "ingress_lossless_profile" - } - }, -{%- endmacro %} - {%- macro generate_queue_buffers(port_names) %} "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "egress_lossless_profile" - }, - "{{ port_names }}|0-1": { +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { "profile" : "q_lossy_profile" - } + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} } {%- endmacro %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t1.j2 b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t1.j2 index 923e5a102836..0067d92c926c 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t1.j2 +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t1.j2 @@ -63,21 +63,17 @@ }, {%- endmacro %} -{%- macro generate_pg_profils(port_names) %} - "BUFFER_PG": { - "{{ port_names }}|3-4": { - "profile" : "ingress_lossless_profile" - } - }, -{%- endmacro %} - {%- macro generate_queue_buffers(port_names) %} "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "egress_lossless_profile" - }, - "{{ port_names }}|0-1": { +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { "profile" : "q_lossy_profile" - } + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} } {%- endmacro %} diff --git a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/helix4-e1031-48x1G+4x10G.config.bcm b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/helix4-e1031-48x1G+4x10G.config.bcm index 02d785aa4cb0..3da3ff365e21 100644 --- a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/helix4-e1031-48x1G+4x10G.config.bcm +++ b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/helix4-e1031-48x1G+4x10G.config.bcm @@ -1,3 +1,7 @@ +sai_postinit_cmd_file=/usr/share/sonic/hwsku/sai_postinit_cmd.soc + +ipv6_lpm_128b_enable=1 + # disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose l3_alpm_hit_skip=1 diff --git a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/sai_postinit_cmd.soc b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/sai_postinit_cmd.soc new file mode 100644 index 000000000000..573706e302bd --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/sai_postinit_cmd.soc @@ -0,0 +1 @@ +setreg RTAG7_IPV4_TCP_UDP_HASH_FIELD_BMAP_2 IPV4_TCP_UDP_FIELD_BITMAP_A=0xf70 diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf index 281f0a54dfa3..59c99ac98e39 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf @@ -85,6 +85,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2 12V Rail Pwr (out)" label curr1 "PSU-2 220V Rail Curr (in)" label curr2 "PSU-2 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 chip "dps460-i2c-*-59" label in1 "PSU-1 220V Rail (in)" ignore in2 @@ -99,6 +102,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-1 12V Rail Pwr (out)" label curr1 "PSU-1 220V Rail Curr (in)" label curr2 "PSU-1 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 # Chassis fans chip "mlxreg_fan-isa-*" diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf index 094cd78cde57..343385fcd4de 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf @@ -85,6 +85,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2 12V Rail Pwr (out)" label curr1 "PSU-2 220V Rail Curr (in)" label curr2 "PSU-2 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 chip "dps460-i2c-*-59" label in1 "PSU-1 220V Rail (in)" ignore in2 @@ -99,6 +102,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-1 12V Rail Pwr (out)" label curr1 "PSU-1 220V Rail Curr (in)" label curr2 "PSU-1 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 # Chassis fans chip "mlxreg_fan-isa-*" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf index 7ba5f9c8c050..0b1cfc75548a 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf @@ -106,6 +106,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2 12V Rail Pwr (out)" label curr1 "PSU-2 220V Rail Curr (in)" label curr2 "PSU-2 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 chip "dps460-i2c-*-59" label in1 "PSU-1 220V Rail (in)" ignore in2 @@ -120,6 +123,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-1 12V Rail Pwr (out)" label curr1 "PSU-1 220V Rail Curr (in)" label curr2 "PSU-1 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 # Chassis fans chip "mlxreg_fan-isa-*" diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf index 9c80350e19ad..3ff78f15023f 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf @@ -167,6 +167,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-1(L) 12V Rail Pwr (out)" label curr1 "PSU-1(L) 220V Rail Curr (in)" label curr2 "PSU-1(L) 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 chip "dps460-i2c-*-59" label in1 "PSU-2(R) 220V Rail (in)" ignore in2 @@ -181,6 +184,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2(R) 12V Rail Pwr (out)" label curr1 "PSU-2(R) 220V Rail Curr (in)" label curr2 "PSU-2(R) 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 # Chassis fans chip "mlxreg_fan-isa-*" diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 index 44fff272e544..a0ebc677ad56 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 @@ -123,6 +123,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-1(L) 12V Rail Pwr (out)" label curr1 "PSU-1(L) 220V Rail Curr (in)" label curr2 "PSU-1(L) 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 chip "dps460-i2c-*-59" label in1 "PSU-2(R) 220V Rail (in)" ignore in2 @@ -137,6 +140,9 @@ bus "i2c-4" "i2c-1-mux (chan_id 3)" label power2 "PSU-2(R) 12V Rail Pwr (out)" label curr1 "PSU-2(R) 220V Rail Curr (in)" label curr2 "PSU-2(R) 12V Rail Curr (out)" + set in3_lcrit in3_crit * 0.662 + set in3_min in3_crit * 0.745 + set in3_max in3_crit * 0.952 # Chassis fans chip "mlxreg_fan-isa-*" 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 2ede5ab6d0d0..bbafccdc377e 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 @@ -1263,8 +1263,9 @@ phy_tx_polarity_flip_phy143.BCM8885X=0 polled_irq_delay.BCM8885X=5 -polled_irq_mode.BCM8885X=1 +polled_irq_mode.BCM8885X=0 port_fec_fabric.BCM8885X=7 +bcm_stat_interval.BCM8885X=1000000 port_init_cl72_1=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 fd96c3ac4368..ce7f77de5bb2 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 @@ -1263,8 +1263,9 @@ phy_tx_polarity_flip_phy143.BCM8885X=0 polled_irq_delay.BCM8885X=5 -polled_irq_mode.BCM8885X=1 +polled_irq_mode.BCM8885X=0 port_fec_fabric.BCM8885X=7 +bcm_stat_interval.BCM8885X=1000000 port_init_cl72_1=0 diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 2d2afd922471..f214edc8516c 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -30,7 +30,7 @@ RUN apt-get clean -y && \ COPY ["docker_init.sh", "start.sh", "/usr/bin/"] COPY ["docker-dhcp-relay.supervisord.conf.j2", "port-name-alias-map.txt.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] -COPY ["dhcp-relay.programs.j2", "dhcpv4-relay.agents.j2", "dhcpv6-relay.agents.j2", "dhcpv6-relay.monitors.j2", "/usr/share/sonic/templates/"] +COPY ["dhcp-relay.programs.j2", "dhcpv4-relay.agents.j2", "dhcpv6-relay.agents.j2", "dhcp-relay.monitors.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] COPY ["cli", "/cli/"] diff --git a/dockers/docker-dhcp-relay/dhcpv6-relay.monitors.j2 b/dockers/docker-dhcp-relay/dhcp-relay.monitors.j2 similarity index 97% rename from dockers/docker-dhcp-relay/dhcpv6-relay.monitors.j2 rename to dockers/docker-dhcp-relay/dhcp-relay.monitors.j2 index 9f2d0f01b59f..ae11105ae3ba 100644 --- a/dockers/docker-dhcp-relay/dhcpv6-relay.monitors.j2 +++ b/dockers/docker-dhcp-relay/dhcp-relay.monitors.j2 @@ -59,8 +59,6 @@ command=/usr/sbin/dhcpmon -id {{ vlan_name }} {% if prefix | ipv4 %} -im {{ name }}{% endif -%} {% endfor %} {% endif %} -{% if relay_for_ipv4.flag %} -4{% endif %} -{% if relay_for_ipv6.flag %} -6{% endif %} priority=4 autostart=false diff --git a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 index 664e1f36c05e..41a13dd496ad 100644 --- a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 +++ b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 @@ -65,6 +65,6 @@ dependent_startup_wait_for=rsyslogd:running {% include 'dhcpv6-relay.agents.j2' %} {% endfor %} -{% include 'dhcpv6-relay.monitors.j2' %} +{% include 'dhcp-relay.monitors.j2' %} {% endif %} {% endif %} diff --git a/dockers/docker-lldp/lldpmgrd b/dockers/docker-lldp/lldpmgrd index 9e85406d4510..93461a42837e 100755 --- a/dockers/docker-lldp/lldpmgrd +++ b/dockers/docker-lldp/lldpmgrd @@ -22,7 +22,7 @@ try: from sonic_py_common import daemon_base from swsscommon import swsscommon - from sonic_py_common.interface import inband_prefix + from sonic_py_common.interface import inband_prefix, recirc_prefix except ImportError as err: raise ImportError("%s - required module not found" % str(err)) @@ -133,9 +133,9 @@ class LldpManager(daemon_base.DaemonBase): """ port_desc = None - # Skip inband interface prefixes. These are recycle ports exposed in PORT_TABLE for + # Skip recirc and inband interface prefixes. These are recycle ports exposed in PORT_TABLE for # asic-to-asic communication in VOQ based chassis system. We do not configure LLDP on these. - if port_name.startswith(inband_prefix()): + if port_name.startswith(inband_prefix()) or port_name.startswith(recirc_prefix()): return # Get the port alias. If None or empty string, use port name instead diff --git a/dockers/docker-macsec/Dockerfile.j2 b/dockers/docker-macsec/Dockerfile.j2 index 0239d6529096..586983533e77 100644 --- a/dockers/docker-macsec/Dockerfile.j2 +++ b/dockers/docker-macsec/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-swss-layer-buster +FROM docker-config-engine-bullseye 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-mux/Dockerfile.j2 b/dockers/docker-mux/Dockerfile.j2 index 66ec315f0809..f7e1ee3b4454 100755 --- a/dockers/docker-mux/Dockerfile.j2 +++ b/dockers/docker-mux/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 +FROM docker-config-engine-bullseye 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-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index f71f31cfc0ac..ea4e0abbc2ef 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -40,7 +40,6 @@ RUN ln -s -f /usr/bin/gcc-8 /usr/bin/aarch64-linux-gnu-gcc # Dependencies of restore_neighbors.py RUN pip3 install \ - scapy==2.4.4 \ pyroute2==0.5.14 \ netifaces==0.10.9 @@ -57,6 +56,14 @@ RUN apt-get remove -y gcc-8 {{ install_debian_packages(docker_orchagent_debs.split(' ')) }} {%- endif %} +{% if docker_orchagent_whls.strip() -%} +# Copy locally-built Python wheel dependencies +{{ copy_files("python-wheels/", docker_orchagent_whls.split(' '), "/python-wheels/") }} + +# Install locally-built Python wheel dependencies +{{ install_python_wheels(docker_orchagent_whls.split(' ')) }} +{% endif %} + # Clean up RUN apt-get purge -y \ build-essential \ diff --git a/dockers/docker-orchagent/docker-init.j2 b/dockers/docker-orchagent/docker-init.j2 index 7235358cbc07..de228a2f5e83 100755 --- a/dockers/docker-orchagent/docker-init.j2 +++ b/dockers/docker-orchagent/docker-init.j2 @@ -41,4 +41,21 @@ if [ "$VLAN" != "" ]; then cp /usr/share/sonic/templates/ndppd.conf /etc/supervisor/conf.d/ fi +USE_PCI_ID_IN_CHASSIS_STATE_DB=/usr/share/sonic/platform/use_pci_id_chassis +ASIC_ID="asic$NAMESPACE_ID" +if [ -f "$USE_PCI_ID_IN_CHASSIS_STATE_DB" ]; then + while true; do + PCI_ID=$(sonic-db-cli -s CHASSIS_STATE_DB HGET "CHASSIS_ASIC_TABLE|$ASIC_ID" asic_pci_address) + if [ -z "$PCI_ID" ]; then + sleep 3 + else + # Update asic_id in CONFIG_DB, which is used by orchagent and fed to syncd + if [[ $PCI_ID == ????:??:??.? ]]; then + sonic-db-cli CONFIG_DB HSET 'DEVICE_METADATA|localhost' 'asic_id' ${PCI_ID#*:} + break + fi + fi + done +fi + exec /usr/local/bin/supervisord diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 index 965746446de5..65572cb5f669 100644 --- a/dockers/docker-orchagent/switch.json.j2 +++ b/dockers/docker-orchagent/switch.json.j2 @@ -3,7 +3,7 @@ {% set hash_seed = 0 %} {% set hash_seed_offset = 0 %} {% if DEVICE_METADATA.localhost.type %} -{% if "ToRRouter" in DEVICE_METADATA.localhost.type %} +{% if "ToRRouter" in DEVICE_METADATA.localhost.type or DEVICE_METADATA.localhost.type in ["EPMS", "MgmtTsToR"] %} {% set hash_seed = 0 %} {% elif "LeafRouter" in DEVICE_METADATA.localhost.type %} {% set hash_seed = 10 %} diff --git a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 index b93f0cef3cee..4a13d76edb0a 100644 --- a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 +++ b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 @@ -171,7 +171,7 @@ dependent_startup_wait_for=rsyslogd:running {% if not skip_pcied %} [program:pcied] -command={% if API_VERSION == 3 and 'pcied' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/pcied +command=/usr/local/bin/pcied priority=11 autostart=false autorestart=unexpected diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index d999d01e0026..bf22ba97ea06 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -7,6 +7,11 @@ FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch FROM {{ prefix }}debian:buster {% endif %} +{% from "dockers/dockerfile-macros.j2" import install_python_wheels, copy_files %} + +USER root +WORKDIR /root + MAINTAINER Pavel Shirshov RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian buster-backports main" >> /etc/apt/sources.list @@ -51,6 +56,13 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / python-libpcap \ python-scapy \ python-six \ + python3 \ + python3-venv \ + python3-pip \ + python3-dev \ + python3-scapy \ + python3-six \ + libpcap-dev \ tacacs+ \ rsyslog \ ntp \ @@ -59,7 +71,9 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / arping \ bridge-utils \ libteam-utils \ - gdb + gdb \ + automake \ + iproute2 # Install all python modules from pypi. python-scapy is exception, ptf debian package requires python-scapy # TODO: Clean up this step @@ -117,10 +131,61 @@ RUN rm -rf /debs \ && pip install pybrctl pyro4 rpyc yabgp \ && pip install unittest-xml-reporting \ && pip install pyrasite \ + && pip install retrying \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py +RUN python3 -m venv env-python3 + +# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD. +ENV VIRTUAL_ENV=/root/env-python3 +ARG BACKUP_OF_PATH="$PATH" +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 + +# Install all python modules from pypi. python3-scapy is exception, ptf debian package requires python3-scapy +RUN python3 -m pip install setuptools \ + && pip3 install supervisor \ + && pip3 install ipython==5.4.1 \ + && pip3 install Cython \ + && pip3 install cffi \ + && pip3 install nnpy \ + && pip3 install dpkt \ + && pip3 install ipaddress \ + && pip3 install pysubnettree \ + && pip3 install paramiko \ + && pip3 install Flask \ + && pip3 install exabgp \ + && pip3 install pyaml \ + && pip3 install pybrctl pyro4 rpyc yabgp \ + && pip3 install unittest-xml-reporting \ + && pip3 install pyrasite \ + && pip3 install python-libpcap \ + && pip3 install enum34 \ + && pip3 install grpcio \ + && pip3 install grpcio-tools \ + && pip3 install protobuf \ + && pip3 install six==1.16.0 \ + && pip3 install itsdangerous \ + && pip3 install retrying \ + && pip3 install jinja2 \ + && pip3 install scapy==2.4.5 + +{% if docker_ptf_whls.strip() -%} +# Copy locally-built Python wheel dependencies +{{ copy_files("python-wheels/", docker_ptf_whls.split(' '), "/python-wheels/") }} + +# Install locally-built Python wheel dependencies +{{ install_python_wheels(docker_ptf_whls.split(' ')) }} +{% endif %} + +# Deactivating a virtualenv. +ENV PATH="$BACKUP_OF_PATH" + ## Adjust sshd settings RUN mkdir /var/run/sshd \ && echo 'root:root' | chpasswd \ diff --git a/dockers/docker-sonic-telemetry/base_image_files/monit_telemetry b/dockers/docker-sonic-telemetry/base_image_files/monit_telemetry index b3ba8b25fe1a..3941aecd4b0c 100644 --- a/dockers/docker-sonic-telemetry/base_image_files/monit_telemetry +++ b/dockers/docker-sonic-telemetry/base_image_files/monit_telemetry @@ -2,4 +2,4 @@ ## Monit configuration for telemetry container ############################################################################### check program container_memory_telemetry with path "/usr/bin/memory_checker telemetry 419430400" - if status == 3 for 10 times within 20 cycles then exec "/usr/bin/restart_service telemetry" + if status == 3 for 10 times within 20 cycles then exec "/usr/bin/restart_service telemetry" repeat every 2 cycles diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 7306c36cfc0c..2510695d1363 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -355,9 +355,6 @@ extract_image() { local rootdev="$(echo $mountstr | cut -f1 -d' ')" rootfs_type="$(echo $mountstr | cut -d' ' -f3)" - ## Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $rootdev - info "Extracting $dockerfs from swi" ## Unpacking dockerfs delayed ## 1. when disk is vfat as it does not support symbolic link diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index b139eb570b3a..81efc39231e9 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -233,6 +233,11 @@ start() { source $ASIC_CONF fi + PLATFORM_ENV_CONF=/usr/share/sonic/device/$PLATFORM/platform_env.conf + if [ -f "$PLATFORM_ENV_CONF" ]; then + source $PLATFORM_ENV_CONF + fi + {%- if docker_container_name == "database" %} # Don't mount HWSKU in {{docker_container_name}} container. HWSKU="" @@ -421,6 +426,7 @@ start() { {%- endif %} {%- if sonic_asic_platform == "broadcom" %} {%- if docker_container_name == "syncd" %} + --shm-size=${SYNCD_SHM_SIZE:-64m} \ -v /var/run/docker-syncd$DEV:/var/run/sswsyncd \ {%- endif %} {%- endif %} @@ -429,9 +435,9 @@ start() { {%- endif %} {%- if docker_container_name == "swss" %} -e ASIC_VENDOR={{ sonic_asic_platform }} \ -{%- if enable_asan == "y" %} - -v /var/log/asan/:/var/log/asan \ {%- endif -%} +{%- if docker_container_name in ["swss", "syncd"] and enable_asan == "y" %} + -v /var/log/asan/:/var/log/asan \ {%- endif -%} {%- if docker_container_name == "bgp" %} -v /etc/sonic/frr/$DEV:/etc/frr:rw \ @@ -493,7 +499,7 @@ stop() { {%- elif docker_container_name == "teamd" %} # Longer timeout of 60 sec to wait for Portchannels to be cleaned. /usr/local/bin/container stop -t 60 $DOCKERNAME - {%- elif docker_container_name == "swss" and enable_asan == "y" %} + {%- elif docker_container_name in ["swss", "syncd"] and enable_asan == "y" %} /usr/local/bin/container stop -t 60 $DOCKERNAME {%- else %} /usr/local/bin/container stop $DOCKERNAME diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 27f87b789caa..f48a47935a17 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -36,7 +36,7 @@ ("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'] != 'ToRRouter') %}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']) %}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 %} diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 9df061283034..4062755827ab 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -172,6 +172,9 @@ } }, {% endif %} +{% if generate_tc_to_dscp_map is defined %} + {{- generate_tc_to_dscp_map() }} +{% endif %} {% if 'resource_type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['resource_type'] in apollo_resource_types %} "SCHEDULER": { "scheduler.0": { diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index a49e29406eeb..c51d6d4543e8 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -233,7 +233,10 @@ sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ 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 # Mark runtime dependencies as manually installed to avoid them being auto-removed while uninstalling build dependencies -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-mark manual gir1.2-glib-2.0 libdbus-1-3 libgirepository-1.0-1 libsystemd0 +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-mark manual gir1.2-glib-2.0 libdbus-1-3 libgirepository-1.0-1 libsystemd0 python3-dbus + +# Install systemd-python for SONiC host services +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install systemd-python # Install SONiC host services package SONIC_HOST_SERVICES_PY3_WHEEL_NAME=$(basename {{sonic_host_services_py3_wheel_path}}) @@ -329,6 +332,11 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in # Install custom-built openssh sshd sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_*.deb +# Remove sshd host keys, and will regenerate on first sshd start. This needs to be +# done again here because our custom version of sshd is being installed, which +# will regenerate the sshd host keys. +sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* + {% if sonic_asic_platform == 'broadcom' %} # Install custom-built flashrom sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/flashrom_*.deb diff --git a/files/build_templates/sonic_version.yml.j2 b/files/build_templates/sonic_version.yml.j2 index 6e3f3acac95a..bc6fb54189d4 100644 --- a/files/build_templates/sonic_version.yml.j2 +++ b/files/build_templates/sonic_version.yml.j2 @@ -26,4 +26,6 @@ built_by: {{ built_by }} {{ name }}: {{ version }} {% endfor -%} {% endif -%} - +{% if ENABLE_ASAN == "y" -%} +asan: 'yes' +{% endif -%} diff --git a/files/image_config/monit/memory_checker b/files/image_config/monit/memory_checker index 4f7912c1e56c..3cd0f2d80225 100755 --- a/files/image_config/monit/memory_checker +++ b/files/image_config/monit/memory_checker @@ -85,6 +85,8 @@ def check_memory_usage(container_name, threshold_value): if mem_usage_bytes > threshold_value: print("[{}]: Memory usage ({} Bytes) is larger than the threshold ({} Bytes)!" .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)) sys.exit(3) else: syslog.syslog(syslog.LOG_ERR, "[memory_checker] Failed to retrieve memory value from '{}'" diff --git a/files/initramfs-tools/arista-net b/files/initramfs-tools/arista-net index 64308630098c..bfa4f8a6507c 100644 --- a/files/initramfs-tools/arista-net +++ b/files/initramfs-tools/arista-net @@ -47,7 +47,9 @@ arista_net_rename() { local new_name="$2" local from_name="$3" devname=$(arista_net_devname "$device_path" "$from_name") - [ -n "$devname" ] && ip link set "$devname" name "$new_name" + if [ -n "$devname" ]; then + ip link set "$devname" name "$new_name" + fi } # Sets the MAC address to the value passed by Aboot through /proc/cmdline diff --git a/files/initramfs-tools/mke2fs b/files/initramfs-tools/mke2fs index 1f98f20c23c4..2c6d45ea5bc9 100644 --- a/files/initramfs-tools/mke2fs +++ b/files/initramfs-tools/mke2fs @@ -21,6 +21,7 @@ copy_exec /usr/sbin/mke2fs /usr/local/sbin/ copy_exec /sbin/sfdisk copy_exec /sbin/fdisk copy_exec /sbin/resize2fs +copy_exec /sbin/tune2fs copy_exec /sbin/findfs fstypes="ext4 ext3" diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index 471640a5bec4..f078b41666d0 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -140,6 +140,7 @@ case "${ROOT}" in *) ## Mount the raw partition again mount -t ext4 ${ROOT} ${rootmnt}/host + tune2fs -m 0 -r 0 ${ROOT} ;; esac diff --git a/files/scripts/gbsyncd.sh b/files/scripts/gbsyncd.sh index 512ceed2d747..0990de5d8257 100755 --- a/files/scripts/gbsyncd.sh +++ b/files/scripts/gbsyncd.sh @@ -3,7 +3,11 @@ . /usr/local/bin/syncd_common.sh function startplatform() { - : + # Add gbsyncd to FEATURE table, if not in. It did have same config as syncd. + if [ -z $($SONIC_DB_CLI CONFIG_DB HGET 'FEATURE|gbsyncd' state) ]; then + local CMD="local r=redis.call('DUMP', KEYS[1]); redis.call('RESTORE', KEYS[2], 0, r)" + $SONIC_DB_CLI CONFIG_DB EVAL "$CMD" 2 'FEATURE|syncd' 'FEATURE|gbsyncd' + fi } function waitplatform() { diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 4f8f1b1af054..40acaa33c573 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -112,11 +112,13 @@ start_peer_and_dependent_services() { check_warm_boot if [[ x"$WARM_BOOT" != x"true" ]]; then - if [[ ! -z $DEV ]]; then - /bin/systemctl start ${PEER}@$DEV - else - /bin/systemctl start ${PEER} - fi + for peer in ${PEER}; do + if [[ ! -z $DEV ]]; then + /bin/systemctl start ${peer}@$DEV + else + /bin/systemctl start ${peer} + fi + done for dep in ${DEPENDENT}; do /bin/systemctl start ${dep} done @@ -143,11 +145,13 @@ stop_peer_and_dependent_services() { for dep in ${DEPENDENT}; do /bin/systemctl stop ${dep} done - if [[ ! -z $DEV ]]; then - /bin/systemctl stop ${PEER}@$DEV - else - /bin/systemctl stop ${PEER} - fi + for peer in ${PEER}; do + if [[ ! -z $DEV ]]; then + /bin/systemctl stop ${peer}@$DEV + else + /bin/systemctl stop ${peer} + fi + done fi } @@ -207,11 +211,18 @@ wait() { # NOTE: This assumes Docker containers share the same names as their # corresponding services for SECS in {1..60}; do - if [[ ! -z $DEV ]]; then - RUNNING=$(docker inspect -f '{{.State.Running}}' ${PEER}$DEV) - else - RUNNING=$(docker inspect -f '{{.State.Running}}' ${PEER}) - fi + ALL_PEERS_RUNNING=true + for peer in ${PEER}; do + if [[ ! -z $DEV ]]; then + RUNNING=$(docker inspect -f '{{.State.Running}}' ${peer}$DEV) + else + RUNNING=$(docker inspect -f '{{.State.Running}}' ${peer}) + fi + if [[ x"$RUNNING" != x"true" ]]; then + ALL_PEERS_RUNNING=false + break + fi + done ALL_DEPS_RUNNING=true for dep in ${MULTI_INST_DEPENDENT}; do if [[ ! -z $DEV ]]; then @@ -225,7 +236,7 @@ wait() { fi done - if [[ x"$RUNNING" == x"true" && x"$ALL_DEPS_RUNNING" == x"true" ]]; then + if [[ x"$ALL_PEERS_RUNNING" == x"true" && x"$ALL_DEPS_RUNNING" == x"true" ]]; then break else sleep 1 @@ -243,7 +254,7 @@ wait() { done if [[ ! -z $DEV ]]; then - /usr/bin/docker-wait-any -s ${SERVICE}$DEV -d ${PEER}$DEV ${ALL_DEPS} + /usr/bin/docker-wait-any -s ${SERVICE}$DEV -d `printf "%s$DEV " ${PEER}` ${ALL_DEPS} else /usr/bin/docker-wait-any -s ${SERVICE} -d ${PEER} ${ALL_DEPS} fi @@ -283,6 +294,17 @@ stop() { stop_peer_and_dependent_services } +function check_peer_gbsyncd() +{ + PLATFORM=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' platform` + HWSKU=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' hwsku` + GEARBOX_CONFIG=/usr/share/sonic/device/$PLATFORM/$HWSKU/$DEV/gearbox_config.json + + if [ -f $GEARBOX_CONFIG ]; then + PEER="$PEER gbsyncd" + fi +} + if [ "$DEV" ]; then NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace SONIC_DB_CLI="sonic-db-cli -n $NET_NS" @@ -291,6 +313,7 @@ else SONIC_DB_CLI="sonic-db-cli" fi +check_peer_gbsyncd read_dependent_services case "$1" in diff --git a/files/sshd/override.conf b/files/sshd/override.conf new file mode 100644 index 000000000000..a1e63ce22b5d --- /dev/null +++ b/files/sshd/override.conf @@ -0,0 +1,4 @@ +[Service] +ExecStartPre= +ExecStartPre=/usr/local/bin/host-ssh-keygen.sh +ExecStartPre=/usr/sbin/sshd -t diff --git a/files/sshd/sshd.service b/files/sshd/sshd.service deleted file mode 100644 index 25d524171c6f..000000000000 --- a/files/sshd/sshd.service +++ /dev/null @@ -1,18 +0,0 @@ -[Unit] -Description=OpenBSD Secure Shell server -After=network.target auditd.service -ConditionPathExists=!/etc/ssh/sshd_not_to_be_run - -[Service] -EnvironmentFile=-/etc/default/ssh -ExecStartPre=-/usr/local/bin/host-ssh-keygen.sh -ExecStart=/usr/sbin/sshd -D $SSHD_OPTS -ExecReload=/bin/kill -HUP $MAINPID -KillMode=process -Restart=on-failure -RuntimeDirectory=sshd -RuntimeDirectoryMode=0755 - -[Install] -WantedBy=multi-user.target -Alias=sshd.service diff --git a/installer/arm64/install.sh b/installer/arm64/install.sh index 249c5b521700..dee3ceec9038 100755 --- a/installer/arm64/install.sh +++ b/installer/arm64/install.sh @@ -139,11 +139,6 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done - - demo_dev=$(findmnt -n -o SOURCE --target /host) - - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev fi # Create target directory or clean it up if exists diff --git a/installer/armhf/install.sh b/installer/armhf/install.sh index 8cffa755734f..9ade40d5149e 100755 --- a/installer/armhf/install.sh +++ b/installer/armhf/install.sh @@ -139,11 +139,6 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done - - demo_dev=$(findmnt -n -o SOURCE --target /host) - - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev fi # Create target directory or clean it up if exists diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 950d765d2418..dbab4d54ab72 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -477,9 +477,6 @@ if [ "$install_env" = "onie" ]; then # Make filesystem mkfs.ext4 -L $demo_volume_label $demo_dev - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev - # Mount demo filesystem demo_mnt=$(${onie_bin} mktemp -d) || { echo "Error: Unable to create file system mount point" @@ -512,20 +509,12 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done - - demo_dev=$(findmnt -n -o SOURCE --target /host) - - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev else demo_mnt="build_raw_image_mnt" demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" mkfs.ext4 -L $demo_volume_label $demo_dev - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev - echo "Mounting $demo_dev on $demo_mnt..." mkdir $demo_mnt mount -t auto -o loop $demo_dev $demo_mnt diff --git a/platform/barefoot/bfn-modules/modules/bf_ioctl.h b/platform/barefoot/bfn-modules/modules/bf_ioctl.h index 0644feb7c8c1..fcb8f86ae7e5 100644 --- a/platform/barefoot/bfn-modules/modules/bf_ioctl.h +++ b/platform/barefoot/bfn-modules/modules/bf_ioctl.h @@ -1,7 +1,7 @@ /******************************************************************************* Barefoot Networks Switch ASIC Linux driver Copyright(c) 2015 - 2019 Barefoot Networks, Inc. - + This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, version 2, as published by the Free Software Foundation. @@ -39,6 +39,7 @@ typedef uint64_t phys_addr_t; #define BF_IOC_MAGIC 'b' #define BF_TBUS_MSIX_INDICES_MAX 3 +#define BF_TBUS_MSIX_INDICES_MIN 1 typedef struct bf_dma_bus_map_s { diff --git a/platform/barefoot/bfn-modules/modules/bf_kdrv.c b/platform/barefoot/bfn-modules/modules/bf_kdrv.c index 2bddc72cbbf7..4f48de9ba99b 100644 --- a/platform/barefoot/bfn-modules/modules/bf_kdrv.c +++ b/platform/barefoot/bfn-modules/modules/bf_kdrv.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include "bf_ioctl.h" #include "bf_kdrv.h" @@ -60,6 +61,7 @@ extern int bf_kpkt_init(struct pci_dev *pdev, u8 *bar0_vaddr, void **adapter_ptr, int dev_id, + int subdev_id, int pci_use_highmem, unsigned long head_room, int kpkt_dr_int_en, @@ -72,14 +74,15 @@ extern void bf_kpkt_set_pci_error(void *adapter_ptr, u8 pci_error); /* Keep any global information here that must survive even after the * bf_pci_dev is free-ed up. */ -struct bf_global { +struct bf_global_s { struct bf_pci_dev *bfdev; struct cdev *bf_cdev; struct fasync_struct *async_queue; + /* Pending user space error signal. */ + bool pending_signal; }; -static int bf_major; -static int bf_minor[BF_MAX_DEVICE_CNT] = {0}; +static int bf_minor[BF_MAX_DEV_SUBDEV_CNT] = {0}; static struct class *bf_class = NULL; static char *intr_mode = NULL; static int kpkt_mode = 0; @@ -91,7 +94,10 @@ static enum bf_intr_mode bf_intr_mode_default = BF_INTR_MODE_MSI; static spinlock_t bf_nonisr_lock; /* dev->minor should index into this array */ -static struct bf_global bf_global[BF_MAX_DEVICE_CNT]; +static struct bf_global_s bf_global[BF_MAX_DEV_SUBDEV_CNT]; + +/* global tofino3 info to group subdevices to a parent device */ +static struct bf_tof3_info_s bf_tof3_info[BF_MAX_DEVICE_CNT]; static void bf_add_listener(struct bf_pci_dev *bfdev, struct bf_listener *listener) { @@ -145,7 +151,7 @@ static int bf_get_next_minor_no(int *minor) { int i; spin_lock(&bf_nonisr_lock); - for (i = 0; i < BF_MAX_DEVICE_CNT; i++) { + for (i = 0; i < BF_MAX_DEV_SUBDEV_CNT; i++) { if (bf_minor[i] == 0) { *minor = i; bf_minor[i] = 1; /* mark it as taken */ @@ -276,7 +282,7 @@ static irqreturn_t bf_pci_irqhandler(int irq, struct bf_pci_dev *bfdev) { bf_kpkt_irqhandler(irq, bfdev->adapter_ptr); } } else if (bfdev->mode == BF_INTR_MODE_MSIX) { - if (bfdev->info.tof_type == BF_TOFINO_2 && bf_irq_is_tbus_msix(bfdev,irq)) { + if ((bfdev->info.tof_type == BF_TOFINO_2 || bfdev->info.tof_type == BF_TOFINO_3) && bf_irq_is_tbus_msix(bfdev, irq)) { bf_kpkt_irqhandler(irq, bfdev->adapter_ptr); } } @@ -470,6 +476,7 @@ static int bf_mmap(struct file *filep, struct vm_area_struct *vma) { static int bf_fasync(int fd, struct file *filep, int mode) { int minor; + int res; if (!filep->private_data) { return (-EINVAL); @@ -479,17 +486,32 @@ static int bf_fasync(int fd, struct file *filep, int mode) { return (-EINVAL); } if (mode == 0 && &bf_global[minor].async_queue == NULL) { + bf_global[minor].pending_signal = false; return 0; /* nothing to do */ } - return (fasync_helper(fd, filep, mode, &bf_global[minor].async_queue)); + res = fasync_helper(fd, filep, mode, &bf_global[minor].async_queue); + if (bf_global[minor].pending_signal && bf_global[minor].async_queue) { + kill_fasync(&bf_global[minor].async_queue, SIGIO, POLL_ERR); + } + bf_global[minor].pending_signal = false; + return res; } static int bf_open(struct inode *inode, struct file *filep) { + unsigned id; struct bf_pci_dev *bfdev; struct bf_listener *listener; int i; - bfdev = bf_global[iminor(inode)].bfdev; + id = iminor(inode); + if (id >= BF_MAX_DEVICE_CNT) { + return (-EINVAL); + } + + bfdev = bf_global[id].bfdev; + if (bfdev->in_use) { + return (-EBUSY); + } listener = kmalloc(sizeof(*listener), GFP_KERNEL); if (listener) { listener->bfdev = bfdev; @@ -500,6 +522,7 @@ static int bf_open(struct inode *inode, struct file *filep) { listener->event_count[i] = atomic_read(&bfdev->info.event[i]); } filep->private_data = listener; + bfdev->in_use = 1; return 0; } else { return (-ENOMEM); @@ -512,6 +535,7 @@ static int bf_release(struct inode *inode, struct file *filep) { bf_fasync(-1, filep, 0); /* empty any process id in the notification list */ if (listener->bfdev) { bf_remove_listener(listener->bfdev, listener); + listener->bfdev->in_use = 0; } kfree(listener); return 0; @@ -645,7 +669,15 @@ static long bf_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) } switch(cmd) { case BF_IOCMAPDMAADDR: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) +#if defined(RHEL_RELEASE_CODE) +#if defined(RHEL_RELEASE_VERSION) +#if RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(7, 9) + if (access_ok(addr, sizeof(bf_dma_bus_map_t))) { +#else + if (access_ok(VERIFY_WRITE, addr, sizeof(bf_dma_bus_map_t))) { +#endif +#endif /* RHEL_RELEASE_CODE && RHEL_RELEASE_VERSION */ +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) if (access_ok(addr, sizeof(bf_dma_bus_map_t))) { #else if (access_ok(VERIFY_WRITE, addr, sizeof(bf_dma_bus_map_t))) { @@ -669,7 +701,15 @@ static long bf_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) } break; case BF_IOCUNMAPDMAADDR: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) +#if defined(RHEL_RELEASE_CODE) +#if defined(RHEL_RELEASE_VERSION) +#if RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(7, 9) + if (access_ok(addr, sizeof(bf_dma_bus_map_t))) { +#else + if (access_ok(VERIFY_WRITE, addr, sizeof(bf_dma_bus_map_t))) { +#endif +#endif /* RHEL_RELEASE_CODE && RHEL_RELEASE_VERSION */ +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) if (access_ok(addr, sizeof(bf_dma_bus_map_t))) { #else if (access_ok(VERIFY_READ, addr, sizeof(bf_dma_bus_map_t))) { @@ -692,21 +732,39 @@ static long bf_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) } else { int i; bf_tbus_msix_indices_t msix_ind; - if (copy_from_user(&msix_ind, addr, sizeof(bf_tbus_msix_indices_t))) { - return EFAULT; - } - if (msix_ind.cnt > BF_TBUS_MSIX_INDICES_MAX) { - return EINVAL; - } - for (i = 0; i < msix_ind.cnt; i++) { - if (msix_ind.indices[i] >= BF_MSIX_ENTRY_CNT) { +#if defined(RHEL_RELEASE_CODE) +#if defined(RHEL_RELEASE_VERSION) +#if RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(7, 9) + if (access_ok(addr, sizeof(bf_tbus_msix_indices_t))) { +#else + if (access_ok(VERIFY_WRITE, addr, sizeof(bf_tbus_msix_indices_t))) { +#endif +#endif /* RHEL_RELEASE_CODE && RHEL_RELEASE_VERSION */ +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) + if (access_ok(addr, sizeof(bf_tbus_msix_indices_t))) { +#else + if (access_ok(VERIFY_READ, addr, sizeof(bf_tbus_msix_indices_t))) { +#endif + if (copy_from_user(&msix_ind, addr, sizeof(bf_tbus_msix_indices_t))) { + return EFAULT; + } + if (msix_ind.cnt < BF_TBUS_MSIX_INDICES_MIN || + msix_ind.cnt > BF_TBUS_MSIX_INDICES_MAX) { return EINVAL; } + for (i = 0; i < msix_ind.cnt; i++) { + if (msix_ind.indices[i] < 0 || + msix_ind.indices[i] >= BF_MSIX_ENTRY_CNT) { + return EINVAL; + } + } + for (i = 0; i < msix_ind.cnt; i++) { + bfdev->info.tbus_msix_ind[i] = msix_ind.indices[i]; + } + bfdev->info.tbus_msix_map_enable = 1; + } else { + return EFAULT; } - for (i = 0; i < msix_ind.cnt; i++) { - bfdev->info.tbus_msix_ind[i] = msix_ind.indices[i]; - } - bfdev->info.tbus_msix_map_enable = 1; } break; case BF_GET_INTR_MODE: @@ -761,7 +819,7 @@ static int bf_major_init(struct bf_pci_dev *bfdev, int minor) { goto fail_dev_add; } - bf_major = MAJOR(bf_dev); + bfdev->info.major = MAJOR(bf_dev); bf_global[minor].bf_cdev = cdev; return 0; @@ -771,33 +829,93 @@ static int bf_major_init(struct bf_pci_dev *bfdev, int minor) { } static void bf_major_cleanup(struct bf_pci_dev *bfdev, int minor) { - unregister_chrdev_region(MKDEV(bf_major, 0), BF_MAX_DEVICE_CNT); + unregister_chrdev_region(MKDEV(bfdev->info.major, 0), BF_MAX_DEVICE_CNT); cdev_del(bf_global[minor].bf_cdev); } static int bf_init_cdev(struct bf_pci_dev *bfdev, int minor) { int ret; ret = bf_major_init(bfdev, minor); - if (ret) return ret; - - bf_class = class_create(THIS_MODULE, BF_CLASS_NAME); - if (!bf_class) { - printk(KERN_ERR "create_class failed for bf_dev\n"); - ret = -ENODEV; - goto err_class_register; - } - return 0; - -err_class_register: - bf_major_cleanup(bfdev, minor); return ret; } static void bf_remove_cdev(struct bf_pci_dev *bfdev) { - class_destroy(bf_class); bf_major_cleanup(bfdev, bfdev->info.minor); } +/* return the first unused dev_id based on invalid chip_id */ +static int bf_multisub_tof_unused_devid_get(void) { + int i; + for (i = 0; i < BF_MAX_DEVICE_CNT; i++) { + if ((bf_tof3_info[i]).minor[0] == -1 && + (bf_tof3_info[i]).minor[1] == -1) { + return i; + } + } + return -1; +} + +/* special case handling for TOF3. each subdevice creates its own device node + * device node is named as /dev/bfs +*/ +static int bf_tof3_register_device(struct device *parent, + struct bf_pci_dev *bfdev) { + struct bf_dev_info *info = &bfdev->info; + int minor = 0; + u8 *bf_base_addr; + volatile u32 *bf_addr; + int dev_id = 0, subdev_id = 0, ret = 0; + + if (!info || !info->version) { + return -EINVAL; + } + bf_base_addr = (info->mem[0].internal_addr); + if (!bf_base_addr) { + return -ENODEV; + } + /* *** TBD for multi Tofino(with 2 subdevices) systems *** */ + /* We must be able to identify multiple sub devices as belonging to one + physical Tofino(3) device. We have not figured that out yet. + until then, we support only one CB device per host CPU */ + bf_addr = (u32 *)((u8 *)bf_base_addr + TOFINO3_MISC_PAD_STATUS_OFFSET); +#if 1 /* USING EMULATOR where subdevice info is not possible to have */ + bf_multisub_tof_unused_devid_get(); /* keep compiler happy */ + subdev_id = 0; + if (bf_get_next_minor_no(&minor)) { + return -EINVAL; + } + dev_id = minor; +#else + subdev_id = (int)(*bf_addr & TOFINO3_MISC_PAD_STATUS_DIEID0); + if (bf_get_next_minor_no(&minor)) { + return -EINVAL; + } + /* we cannot assume the order in which sub devices are probed */ + if (subdev_id == 0) { + dev_id = bf_multisub_tof_unused_devid_get(); + bf_tof3_info[dev_id].dev_id = dev_id; /* back reference */ + (bf_tof3_info[dev_id].minor)[subdev_id] = minor; + } else { + dev_id = 0; /* TBD : for Tofino with multi sub devices */ + (bf_tof3_info[dev_id].minor)[subdev_id] = minor; + } +#endif + ret = bf_init_cdev(bfdev, minor); + if (ret) { + printk(KERN_ERR "BF: device cdev creation failed dev_id %d\n", dev_id); + return ret; + } + info->tof3_info = &(bf_tof3_info[dev_id]); + info->dev_id = dev_id; + info->subdev_id = subdev_id; + printk(KERN_NOTICE "BF: registering dev_id %d subdev_id %d\n", + dev_id, subdev_id); + info->dev = device_create(bf_class, parent, MKDEV(bfdev->info.major, minor), + bfdev, "bf%ds%1d", dev_id, subdev_id); + info->minor = minor; + return 0; +} + /** * bf_register_device - register a new userspace mem device * @parent: parent device @@ -808,7 +926,7 @@ static void bf_remove_cdev(struct bf_pci_dev *bfdev) { int bf_register_device(struct device *parent, struct bf_pci_dev *bfdev) { struct bf_dev_info *info = &bfdev->info; int i, j, ret = 0; - int minor; + int minor = 0; if (!parent || !info || !info->version) { return -EINVAL; @@ -820,25 +938,33 @@ int bf_register_device(struct device *parent, struct bf_pci_dev *bfdev) { atomic_set(&info->event[i], 0); } - if (bf_get_next_minor_no(&minor)) { - return -EINVAL; - } + if (info->tof_type == BF_TOFINO_3) { + if ((ret = bf_tof3_register_device(parent, bfdev)) != 0) { + printk(KERN_ERR "BF: TOF3 device cdev creation failed %d\n", ret); + return ret; + } + } else { + if (bf_get_next_minor_no(&minor)) { + return -EINVAL; + } - ret = bf_init_cdev(bfdev, minor); - if (ret) { - printk(KERN_ERR "BF: device cdev creation failed\n"); - return ret; - } + ret = bf_init_cdev(bfdev, minor); + if (ret) { + printk(KERN_ERR "BF: device cdev creation failed\n"); + return ret; + } - info->dev = device_create( - bf_class, parent, MKDEV(bf_major, minor), bfdev, "bf%d", minor); + info->dev = device_create( + bf_class, parent, MKDEV(bfdev->info.major, minor), bfdev, "bf%d", minor); + info->minor = minor; + info->dev_id = minor; + info->subdev_id = 0; + } if (!info->dev) { printk(KERN_ERR "BF: device creation failed\n"); return -ENODEV; } - info->minor = minor; - /* bind ISRs and request interrupts */ if (info->irq && (bfdev->mode != BF_INTR_MODE_NONE)) { /* @@ -906,6 +1032,33 @@ int bf_register_device(struct device *parent, struct bf_pci_dev *bfdev) { return 0; } +/* special case handling for TOF3. return minor number only after all + * sub devices using the minor number are unregistered */ +static int bf_tof3_unregister_device(struct bf_pci_dev *bfdev) { + struct bf_dev_info *info = &bfdev->info; +#if 1 //HACK until emulator implements efuse + bf_return_minor_no(info->minor); +#else + int j, dev_id, subdev_id, found; + + if (!info->tof3_info) { + printk(KERN_ERR "BF TOF3 bad info in tof3_unregister_device\n"); + return -1; + } + dev_id = info->tof3_info->dev_id; + subdev_id = info->subdev_id; + if (dev_id >= BF_MAX_DEVICE_CNT || subdev_id >= BF_MAX_SUBDEV_CNT) { + return -1; + } + /* update bf_tof3_info structure for the device being unregistered */ + (bf_tof3_info[dev_id].minor)[subdev_id] = -1; + /* return the minor number */ + bf_return_minor_no(info->minor); + info->subdev_id = -1; +#endif + return 0; +} + /** * bf_unregister_device - register a new userspace mem device * @bfdev: bf pci device @@ -914,8 +1067,12 @@ int bf_register_device(struct device *parent, struct bf_pci_dev *bfdev) { */ void bf_unregister_device(struct bf_pci_dev *bfdev) { struct bf_dev_info *info = &bfdev->info; - int i; + int i, ret; + if (!info) { + printk(KERN_ERR "BF: bad data in device unregister\n"); + return; + } if (info->irq) { if (bfdev->mode == BF_INTR_MODE_LEGACY) { free_irq(info->irq, (void *)&(bfdev->bf_int_vec[0])); @@ -929,9 +1086,16 @@ void bf_unregister_device(struct bf_pci_dev *bfdev) { } } } - device_destroy(bf_class, MKDEV(bf_major, info->minor)); + device_destroy(bf_class, MKDEV(info->major, info->minor)); bf_remove_cdev(bfdev); - bf_return_minor_no(info->minor); + if (bfdev->info.tof_type == BF_TOFINO_3) { + if ((ret = bf_tof3_unregister_device(bfdev)) != 0) { + printk(KERN_ERR "BF: TOF3 device cdev unregister failed %d\n", ret); + return; + } + } else { + bf_return_minor_no(info->minor); + } return; } @@ -944,13 +1108,13 @@ static void bf_disable_int_dma(struct bf_pci_dev *bfdev) { u32 *bf_addr; volatile u32 val; - /* maskinterrupts and DMA */ + /* mask interrupts and DMA */ bf_base_addr = (bfdev->info.mem[0].internal_addr); /* return if called before mmap */ if (!bf_base_addr) { return; } - /* mask interrupt at shadow level */ + /* mask interrupts at shadow level */ bf_addr = (u32 *)((u8 *)bf_base_addr + 0xc0); for (i = 0; i < 16; i++) { *bf_addr = 0xffffffffUL; @@ -968,8 +1132,6 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { int err, pci_use_highmem; int i, num_irq; - memset(bf_global, 0, sizeof(bf_global)); - bfdev = kzalloc(sizeof(struct bf_pci_dev), GFP_KERNEL); if (!bfdev) { return -ENOMEM; @@ -995,6 +1157,9 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { case TOFINO2_DEV_ID_B0: bfdev->info.tof_type = BF_TOFINO_2; break; + case TOFINO3_DEV_ID_A0: + bfdev->info.tof_type = BF_TOFINO_3; + break; default: bfdev->info.tof_type = BF_TOFINO_1; break; @@ -1005,6 +1170,8 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { bfdev->info.tbus_msix_ind[i] = BF_TBUS_MSIX_BASE_INDEX_TOF1 + i; } else if (bfdev->info.tof_type == BF_TOFINO_2) { bfdev->info.tbus_msix_ind[i] = BF_TBUS_MSIX_INDEX_INVALID; + } else if (bfdev->info.tof_type == BF_TOFINO_3) { + bfdev->info.tbus_msix_ind[i] = BF_TBUS_MSIX_INDEX_INVALID; } } /* @@ -1068,7 +1235,6 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { bfdev->info.version = "0.2"; bfdev->info.owner = THIS_MODULE; bfdev->pdev = pdev; - switch (bf_intr_mode_default) { #ifdef CONFIG_PCI_MSI case BF_INTR_MODE_MSIX: @@ -1113,6 +1279,7 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { } #endif /* LINUX_VERSION_CODE */ /* ** intentional no-break */ + /* FALLTHRU */ case BF_INTR_MODE_MSI: #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) num_irq = pci_enable_msi_block(pdev, BF_MSI_ENTRY_CNT); @@ -1150,6 +1317,7 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { #endif /* LINUX_VERSION_CODE */ #endif /* CONFIG_PCI_MSI */ /* fall back to Legacy Interrupt, intentional no-break */ + /* FALLTHRU */ case BF_INTR_MODE_LEGACY: if (pci_intx_mask_supported(pdev)) { @@ -1161,6 +1329,7 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { } printk(KERN_NOTICE " bf PCI INTx mask not supported\n"); /* fall back to no Interrupt, intentional no-break */ + /* FALLTHRU */ case BF_INTR_MODE_NONE: bfdev->info.irq = 0; bfdev->info.num_irq = 0; @@ -1183,6 +1352,7 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { bf_global[bfdev->info.minor].async_queue = NULL; bf_global[bfdev->info.minor].bfdev = bfdev; + bf_global[bfdev->info.minor].pending_signal = false; dev_info(&pdev->dev, "bf device %d registered with irq %ld\n", @@ -1194,15 +1364,18 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { err = bf_kpkt_init(pdev, bfdev->info.mem[0].internal_addr, &bfdev->adapter_ptr, - bfdev->info.minor, + bfdev->info.dev_id, + bfdev->info.subdev_id, pci_use_highmem, kpkt_hd_room, kpkt_dr_int_en, kpkt_rx_count); if (err == 0) { - printk(KERN_ALERT "bf_kpkt kernel processing enabled\n"); + printk(KERN_ALERT "bf_kpkt kernel processing enabled for dev %d subdev_id %d\n", + bfdev->info.dev_id, bfdev->info.subdev_id); } else { - printk(KERN_ALERT "error starting bf_kpkt kernel processing\n"); + printk(KERN_ERR "error starting bf_kpkt kernel processing for dev %d subdev_id %d\n", + bfdev->info.dev_id, bfdev->info.subdev_id); bfdev->adapter_ptr = NULL; } } @@ -1316,16 +1489,29 @@ static pci_ers_result_t bf_pci_mmio_enabled(struct pci_dev *dev) { struct bf_pci_dev *bfdev = pci_get_drvdata(dev); printk(KERN_ERR "BF pci_mmio_enabled invoked after pci error\n"); - #if KERNEL_VERSION(5, 8, 0) <= LINUX_VERSION_CODE - pci_aer_clear_nonfatal_status(dev); - #else - pci_cleanup_aer_uncorrect_error_status(dev); - #endif +#if defined(RHEL_RELEASE_CODE) +#if defined(RHEL_RELEASE_VERSION) +#if RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(7, 9) + pci_aer_clear_nonfatal_status(dev); +#else + pci_cleanup_aer_uncorrect_error_status(dev); +#endif +#endif /* RHEL_RELEASE_CODE && RHEL_RELEASE_VERSION */ +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) + pci_aer_clear_nonfatal_status(dev); +#else + pci_cleanup_aer_uncorrect_error_status(dev); +#endif + if (bfdev) { /* send a signal to the user space program of the error */ int minor = bfdev->info.minor; - if (minor < BF_MAX_DEVICE_CNT && bf_global[minor].async_queue) { - kill_fasync(&bf_global[minor].async_queue, SIGIO, POLL_ERR); + if (minor < BF_MAX_DEVICE_CNT) { + if (bf_global[minor].async_queue) { + kill_fasync(&bf_global[minor].async_queue, SIGIO, POLL_ERR); + } else { + bf_global[minor].pending_signal = true; + } } } return PCI_ERS_RESULT_RECOVERED; @@ -1389,6 +1575,7 @@ static const struct pci_device_id bf_pci_tbl[] = { {PCI_VDEVICE(BF, TOFINO2_DEV_ID_A0), 0}, {PCI_VDEVICE(BF, TOFINO2_DEV_ID_A00), 0}, {PCI_VDEVICE(BF, TOFINO2_DEV_ID_B0), 0}, + {PCI_VDEVICE(INTEL, TOFINO3_DEV_ID_A0), 0}, /* required last entry */ {.device = 0}}; @@ -1409,12 +1596,36 @@ static struct pci_driver bf_pci_driver = {.name = "bf", static int __init bfdrv_init(void) { int ret; + pr_info("%s: %s - version %s\n", DRV_NAME(kpkt_mode), + DRV_DESCRIPTION(kpkt_mode),DRV_VERSION); + pr_info("%s: %s\n", DRV_NAME(kpkt_mode),DRV_COPYRIGHT); + memset(bf_global, 0, sizeof(bf_global)); + memset(bf_tof3_info, 0xff, sizeof(bf_tof3_info)); + bf_class = class_create(THIS_MODULE, BF_CLASS_NAME); + if (!bf_class) { + printk(KERN_ERR "create_class failed for bf device\n"); + return -ENODEV; + } else { + printk(KERN_NOTICE "bf device class created\n"); + } + ret = bf_config_intr_mode(intr_mode); + + if (ret < 0) { + printk(KERN_ERR "config interrupt mode failed for bf device\n"); + if (bf_class) { + class_destroy(bf_class); + bf_class = NULL; + } + return ret; + } + /* do not enable DR interrupt if not using MSI or not in kpkt mode */ if ((bf_intr_mode_default != BF_INTR_MODE_MSI && bf_intr_mode_default != BF_INTR_MODE_LEGACY) || kpkt_mode == 0) { kpkt_dr_int_en = 0; } + if (kpkt_mode) { printk(KERN_NOTICE "kpkt_mode %d hd_room %d dr_int_en %d rx_count %d\n", kpkt_mode, @@ -1422,15 +1633,17 @@ static int __init bfdrv_init(void) { kpkt_dr_int_en, kpkt_rx_count); } - if (ret < 0) { - return ret; - } + spin_lock_init(&bf_nonisr_lock); return pci_register_driver(&bf_pci_driver); } static void __exit bfdrv_exit(void) { + pr_info("%s: module unloading ...\n", DRV_NAME(kpkt_mode)); pci_unregister_driver(&bf_pci_driver); + class_destroy(bf_class); + pr_info("%s: module unloaded successfully\n", DRV_NAME(kpkt_mode)); + bf_class = NULL; intr_mode = NULL; kpkt_mode = 0; } diff --git a/platform/barefoot/bfn-modules/modules/bf_kdrv.h b/platform/barefoot/bfn-modules/modules/bf_kdrv.h index de5ca4bbc71c..d2fb6e7dce06 100644 --- a/platform/barefoot/bfn-modules/modules/bf_kdrv.h +++ b/platform/barefoot/bfn-modules/modules/bf_kdrv.h @@ -1,7 +1,7 @@ /******************************************************************************* Barefoot Networks Switch ASIC Linux driver Copyright(c) 2015 - 2019 Barefoot Networks, Inc. - + This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, version 2, as published by the Free Software Foundation. @@ -35,11 +35,13 @@ typedef uint64_t phys_addr_t; #endif #define PCI_VENDOR_ID_BF 0x1d1c +#define PCI_VENDOR_ID_INTEL 0x8086 #define TOFINO_DEV_ID_A0 0x01 #define TOFINO_DEV_ID_B0 0x10 #define TOFINO2_DEV_ID_A0 0x0100 #define TOFINO2_DEV_ID_A00 0x0000 #define TOFINO2_DEV_ID_B0 0x0110 +#define TOFINO3_DEV_ID_A0 0x0DA2 #ifndef PCI_MSIX_ENTRY_SIZE #define PCI_MSIX_ENTRY_SIZE 16 @@ -51,7 +53,9 @@ typedef uint64_t phys_addr_t; #endif #define BF_CLASS_NAME "bf" -#define BF_MAX_DEVICE_CNT 256 +#define BF_MAX_DEVICE_CNT 8 +#define BF_MAX_SUBDEV_CNT 2 +#define BF_MAX_DEV_SUBDEV_CNT (BF_MAX_DEVICE_CNT * BF_MAX_SUBDEV_CNT) #define BF_INTR_MODE_NONE_NAME "none" #define BF_INTR_MODE_LEGACY_NAME "legacy" #define BF_INTR_MODE_MSI_NAME "msi" @@ -64,11 +68,22 @@ typedef uint64_t phys_addr_t; #define BF_TBUS_MSIX_INDEX_INVALID (0) #define BF_TBUS_MSIX_BASE_INDEX_TOF1 (32) +#define TOFINO3_MISC_PAD_STATUS_OFFSET 0x80238UL +#define TOFINO3_MISC_PAD_STATUS_DIEID0 (1 << 3) + +#define DRV_NAME(kpkt_mode) (kpkt_mode ? "bf_kpkt" : "bf_kdrv") +#define DRV_DESCRIPTION(kpkt_mode) (kpkt_mode ? \ + "Intel(R) Switch ASIC Linux Packet Driver" : \ + "Intel(R) Switch ASIC Linux Driver" ) +#define DRV_COPYRIGHT "Copyright (c) 2015-2022 Intel Corporation." +#define DRV_VERSION "1.0" + /* Tofino generation type */ typedef enum { BF_TOFINO_NONE = 0, BF_TOFINO_1, BF_TOFINO_2, + BF_TOFINO_3, } bf_tof_type; /* device memory */ @@ -86,10 +101,16 @@ struct bf_listener { struct bf_listener *next; }; +struct bf_tof3_info_s { + int dev_id; + int minor[BF_MAX_SUBDEV_CNT]; +}; + /* device information */ struct bf_dev_info { struct module *owner; struct device *dev; + int major; int minor; atomic_t event[BF_MSIX_ENTRY_CNT]; wait_queue_head_t wait; @@ -104,6 +125,9 @@ struct bf_dev_info { /* msix index assigned to tbus MSIX for Tofino-2 only */ int tbus_msix_ind[BF_TBUS_MSIX_INDICES_MAX]; int tbus_msix_map_enable; + struct bf_tof3_info_s *tof3_info; + int dev_id; /* same as minor number for T1 and T2 */ + int subdev_id; int pci_error_state; /* was there a pci bus error */ }; @@ -126,6 +150,7 @@ struct bf_pci_dev { struct bf_listener * listener_head; /* head of a singly linked list of listeners */ void *adapter_ptr; /* pkt processing adapter */ + int in_use; /* indicates a user space process is using the device */ }; /* TBD: Need to build with CONFIG_PCI_MSI */ diff --git a/platform/barefoot/bfn-platform.mk b/platform/barefoot/bfn-platform.mk index 7ea4cbcd5cb8..f12bbaa8a966 100644 --- a/platform/barefoot/bfn-platform.mk +++ b/platform/barefoot/bfn-platform.mk @@ -1,4 +1,4 @@ -BFN_PLATFORM = bfnplatform_20220127_sai_1.9.1_deb10.deb +BFN_PLATFORM = bfnplatform_20220408_sai_1.9.1_deb10.deb $(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/dev/$(BFN_PLATFORM)" SONIC_ONLINE_DEBS += $(BFN_PLATFORM) diff --git a/platform/barefoot/bfn-sai.mk b/platform/barefoot/bfn-sai.mk index c61abeb0ae5d..a0a1d2348dea 100644 --- a/platform/barefoot/bfn-sai.mk +++ b/platform/barefoot/bfn-sai.mk @@ -1,4 +1,4 @@ -BFN_SAI = bfnsdk_20220127_sai_1.9.1_deb10.deb +BFN_SAI = bfnsdk_20220408_sai_1.9.1_deb10.deb $(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/dev/$(BFN_SAI)" $(BFN_SAI)_DEPENDS += $(LIBNL_GENL3_DEV) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index da8370423b07..9b61f8bdbe65 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit da8370423b07c9271fad515c9ef1fd6149abbeed +Subproject commit 9b61f8bdbe657e8798bc40c09039a6e0a7f5d150 diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_ioctl.c b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_ioctl.c index b0792556caf6..8f4a5ca7fc6a 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_ioctl.c +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_ioctl.c @@ -110,9 +110,10 @@ int bf_fpga_ioctl(struct bf_pci_dev *bfdev, /* copy read data to user area */ for (i = 0; i < i2c_op.num_i2c; i++) { if (i2c_op.i2c_inst[i].rd_cnt) { - if (copy_to_user(&(((bf_fpga_i2c_t *)addr)->i2c_inst[i].rd_buf), - &i2c_op.i2c_inst[i].rd_buf, - i2c_op.i2c_inst[i].rd_cnt)) { + if (copy_to_user( + &(((bf_fpga_i2c_t *)addr)->i2c_inst[i].fpga_i2c_buf.rd_buf), + &i2c_op.i2c_inst[i].fpga_i2c_buf.rd_buf, + i2c_op.i2c_inst[i].rd_cnt)) { return -EFAULT; } } diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_ioctl.h b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_ioctl.h index 4c5eb7bf0386..f7035647af50 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_ioctl.h +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_ioctl.h @@ -93,7 +93,7 @@ typedef struct bf_fpga_i2c_inst_s { unsigned char wr_buf[BF_FPGA_MAX_I2C_WR_DATA]; /* write data source buffer */ unsigned char rd_buf[BF_FPGA_MAX_I2C_RD_DATA]; /* read data dest buffer */ - }; + } fpga_i2c_buf; unsigned char status; unsigned char retry_cnt; /* if fpga maintains retry count */ unsigned char mux; /* if fpga maintains internal MUX */ diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_main.c b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_main.c index 563cc5120df1..9910117b72cb 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_main.c +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_main.c @@ -120,7 +120,7 @@ static void bf_remove_listener(struct bf_pci_dev *bfdev, /* in case of certain error conditions, this function might be called after * bf_pci_remove() - */ + */ if (!bfdev || !listener) { return; } @@ -294,7 +294,12 @@ static int bf_setup_bars(struct pci_dev *dev, struct bf_dev_info *info) { int i, iom, ret; unsigned long flags; static const char *bar_names[BF_MAX_BAR_MAPS] = { - "BAR0", "BAR1", "BAR2", "BAR3", "BAR4", "BAR5", + "BAR0", + "BAR1", + "BAR2", + "BAR3", + "BAR4", + "BAR5", }; iom = 0; @@ -849,7 +854,7 @@ static void fpga_print_build_date(u32 build_date) { month = (char)(build_date & 0x0f); build_date >>= 4; day = (char)(build_date & 0x1f); - printk(KERN_ALERT "fpga version %02d/%02d/%2d %02d:%02d:%02d", + printk(KERN_ALERT "fpga build %02d/%02d/%2d %02d:%02d:%02d", month, day, year, @@ -991,6 +996,7 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { } #endif /* LINUX_VERSION_CODE */ /* ** intentional no-break */ + /* FALLTHRU */ case BF_INTR_MODE_MSI: #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) num_irq = pci_enable_msi_block(pdev, BF_MSI_ENTRY_CNT); @@ -1032,7 +1038,8 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { } #endif /* LINUX_VERSION_CODE */ #endif /* CONFIG_PCI_MSI */ - /* fall back to Legacy Interrupt, intentional no-break */ + /* fall back to Legacy Interrupt, intentional no-break */ + /* FALLTHRU */ case BF_INTR_MODE_LEGACY: if (pci_intx_mask_supported(pdev)) { @@ -1044,6 +1051,7 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { } printk(KERN_NOTICE "bf_fpga PCI INTx mask not supported\n"); /* fall back to no Interrupt, intentional no-break */ + /* FALLTHRU */ case BF_INTR_MODE_NONE: bfdev->info.irq = 0; bfdev->info.num_irq = 0; @@ -1084,7 +1092,7 @@ static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { build_date = *((u32 *)(bfdev->info.mem[0].internal_addr) + (BF_FPGA_BUILD_DATE / 4)); fpga_print_build_date(build_date); - printk(KERN_ALERT "bf_fpga version %hu:%hu probe ok\n", + printk(KERN_ALERT "bf_fpga version %hu.%hu probe ok\n", (u16)(build_ver >> 16), (u16)(build_ver)); return 0; @@ -1239,6 +1247,7 @@ static int bf_config_intr_mode(char *intr_str) { static const struct pci_device_id bf_pci_tbl[] = { {PCI_VDEVICE(BF, BF_FPGA_DEV_ID_JBAY_0), 0}, + {PCI_VDEVICE(BF, BF_FPGA_DEV_ID_CB_0), 0}, /* required last entry */ {.device = 0}}; diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_priv.h b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_priv.h index 7515bde7458d..5d259fb8a9f7 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_priv.h +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_priv.h @@ -28,6 +28,7 @@ #define PCI_VENDOR_ID_BF 0x1d1c #define BF_FPGA_DEV_ID_JBAY_0 0x01F0 +#define BF_FPGA_DEV_ID_CB_0 0x01F1 #ifndef PCI_MSIX_ENTRY_SIZE #define PCI_MSIX_ENTRY_SIZE 16 @@ -123,8 +124,8 @@ struct bf_pci_dev { u8 instance; char name[16]; struct bf_int_vector bf_int_vec[BF_MSIX_ENTRY_CNT]; - struct bf_listener * - listener_head; /* head of a singly linked list of listeners */ + struct bf_listener + *listener_head; /* head of a singly linked list of listeners */ struct bf_fpga_sysfs_buff fpga_sysfs_buff[BF_FPGA_SYSFS_CNT]; struct bf_fpga_sysfs_buff fpga_sysfs_new_device; struct bf_fpga_sysfs_buff fpga_sysfs_rm_device; diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_sysfs.c b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_sysfs.c index 6970a7a95985..6d5259e6a46e 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_sysfs.c +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/bf_fpga_sysfs.c @@ -76,7 +76,7 @@ static ssize_t bf_fpga_sysfs_i2c_get(struct device *dev, i2c_op.i2c_inst[0].status); return -EIO; } - memcpy(buf, i2c_op.i2c_inst[0].rd_buf, cur_cnt); + memcpy(buf, i2c_op.i2c_inst[0].fpga_i2c_buf.rd_buf, cur_cnt); buf += cur_cnt; size += cur_cnt; cur_size -= cur_cnt; @@ -108,7 +108,7 @@ static ssize_t bf_fpga_sysfs_i2c_set(struct device *dev, } i2c_op.i2c_inst[0].wr_cnt = cur_cnt; i2c_op.i2c_inst[0].rd_cnt = 0; - memcpy(i2c_op.i2c_inst[0].wr_buf, buf, cur_cnt); + memcpy(i2c_op.i2c_inst[0].fpga_i2c_buf.wr_buf, buf, cur_cnt); i2c_op.num_i2c = 1; i2c_op.one_time = 1; i2c_op.inst_hndl.bus_id = sysfs_buf->bus_id; diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c.c b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c.c index c8ebd3e63c6f..1f0520990188 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c.c +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c.c @@ -146,11 +146,11 @@ static int fpga_i2c_enqueue(int bus_id, wd0 |= (I2C_WR_ADDR_DATA | (delay << I2C_DELAY_SHF)); wd1 |= (i2c_inst->i2c_addr << I2C_DEV_ADDR_SHF); /* copy the first byte into register address */ - wd1 |= ((i2c_inst->wr_buf[0]) << I2C_CMD_OFFSET); + wd1 |= ((i2c_inst->fpga_i2c_buf.wr_buf[0]) << I2C_CMD_OFFSET); wd1 |= ((num_wr - 1) << I2C_WR_CNT_SHF); if (num_wr <= 9) { /* copy data into instruction area */ - memcpy(i2c_data, &i2c_inst->wr_buf[1], (num_wr - 1)); + memcpy(i2c_data, &i2c_inst->fpga_i2c_buf.wr_buf[1], (num_wr - 1)); bf_fpga_i2c_reg_write32( i2c_ctrl, Bf_FPGA_I2C_INST_DATA_LO(inst_id), i2c_data[0]); bf_fpga_i2c_reg_write32( @@ -159,7 +159,7 @@ static int fpga_i2c_enqueue(int bus_id, /* copy the data in data area */ int len = num_wr - 1; uint32_t addr; - uint8_t *val = (uint8_t *)(&i2c_inst->wr_buf[1]); + uint8_t *val = (uint8_t *)(&i2c_inst->fpga_i2c_buf.wr_buf[1]); /* store the data pointer Note the indexing required by FPGA specs */ i2c_data[0] = BF_FPGA_I2C_DATA_AREA(inst_id); addr = i2c_data[0]; @@ -195,11 +195,11 @@ static int fpga_i2c_enqueue(int bus_id, wd1 |= (i2c_inst->i2c_addr << I2C_DEV_ADDR_SHF); /* 1st byte of the write buf goes into "register address" field */ wd1 |= ((num_wr - 1) << I2C_WR_CNT_SHF); - wd1 |= ((i2c_inst->wr_buf[0]) << I2C_CMD_OFFSET); + wd1 |= ((i2c_inst->fpga_i2c_buf.wr_buf[0]) << I2C_CMD_OFFSET); wd1 |= ((num_rd) << I2C_RD_CNT_SHF); /* less than 8 bytes data goes to the instruction area */ if ((num_wr - 1 + num_rd) <= 8) { - memcpy(i2c_data, &i2c_inst->wr_buf[1], (num_wr - 1)); + memcpy(i2c_data, &i2c_inst->fpga_i2c_buf.wr_buf[1], (num_wr - 1)); bf_fpga_i2c_reg_write32( i2c_ctrl, Bf_FPGA_I2C_INST_DATA_LO(inst_id), i2c_data[0]); bf_fpga_i2c_reg_write32( @@ -207,7 +207,7 @@ static int fpga_i2c_enqueue(int bus_id, } else { int len = num_wr - 1; uint32_t addr; - uint8_t *val = (uint8_t *)(&i2c_inst->wr_buf[1]); + uint8_t *val = (uint8_t *)(&i2c_inst->fpga_i2c_buf.wr_buf[1]); /* store the data area pointer */ i2c_data[0] = BF_FPGA_I2C_DATA_AREA(inst_id); addr = i2c_data[0]; @@ -419,7 +419,7 @@ int fpga_i2c_oneshot(bf_fpga_i2c_t *i2c_op) { i, offset, i2c_op->i2c_inst[i].rd_cnt, - i2c_op->i2c_inst[i].rd_buf)) { + i2c_op->i2c_inst[i].fpga_i2c_buf.rd_buf)) { ret = BF_FPGA_EIO; goto oneshot_error_exit; } diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules.init b/platform/broadcom/saibcm-modules/debian/opennsl-modules.init index 09112f5331ce..62274eaa36aa 100755 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules.init +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules.init @@ -14,17 +14,27 @@ function create_devices() { - rm -f /dev/linux-knet-cb - rm -f /dev/linux-bcm-knet - rm -f /dev/linux-bcm-bde - rm -f /dev/linux-kernel-bde - rm -f /dev/linux_ngbde - - mknod /dev/linux_ngbde c 120 0 - mknod /dev/linux-knet-cb c 121 0 - mknod /dev/linux-bcm-knet c 122 0 - mknod /dev/linux-bcm-bde c 126 0 - mknod /dev/linux-kernel-bde c 127 0 + if [[ $is_ltsw_chip -eq 1 ]]; then + rm -f /dev/linux_ngbde + rm -f /dev/linux_ngknet + rm -f /dev/linux_ngknetcb + + mknod /dev/linux_ngbde c 120 0 + mknod /dev/linux_ngknet c 121 0 + mknod /dev/linux_ngknetcb c 122 0 + else + rm -f /dev/linux-knet-cb + rm -f /dev/linux-bcm-knet + rm -f /dev/linux-bcm-bde + rm -f /dev/linux-kernel-bde + rm -f /dev/linux_ngbde + + mknod /dev/linux_ngbde c 120 0 + mknod /dev/linux-knet-cb c 121 0 + mknod /dev/linux-bcm-knet c 122 0 + mknod /dev/linux-bcm-bde c 126 0 + mknod /dev/linux-kernel-bde c 127 0 + fi } # linux-kernel-bde debug=4 ==> Verbose level debug @@ -33,6 +43,44 @@ function create_devices() # Events(0x20) and Instance(0x4000) # level logs function load_kernel_modules() +{ + if [[ $is_ltsw_chip -eq 1 ]]; then + insmod /lib/modules/$(uname -r)/extra/psample.ko + modprobe linux_ngbde + modprobe linux_ngknet + modprobe linux_ngknetcb + else + modprobe linux-kernel-bde dmasize=$dmasize maxpayload=128 debug=4 dma_debug=1 usemsi=$usemsi + modprobe linux-user-bde + + # Using insmod with absolute path for psample to make sure bcm psample is loaded. + # There is a different psample.ko module getting created at net/psample/psample.ko + insmod /lib/modules/$(uname -r)/extra/psample.ko + + modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238 debug=0x5020 default_mtu=9100 + modprobe linux-knet-cb + modprobe linux_ngbde + fi +} + +function remove_kernel_modules() +{ + if [[ $is_ltsw_chip -eq 1 ]]; then + rmmod linux_ngknetcb + rmmod linux_ngknet + rmmod linux_ngbde + rmmod psample.ko + else + rmmod psample.ko + rmmod linux-knet-cb + rmmod linux-bcm-knet + rmmod linux-user-bde + rmmod linux-kernel-bde + rmmod linux_ngbde + fi +} + +function load_platform_env() { . /host/machine.conf @@ -47,37 +95,18 @@ function load_kernel_modules() # Set the default configuration for dmasize and usemsi parameters dmasize=32M usemsi=0 + is_ltsw_chip=0 # Source the platform env file env_file="/usr/share/sonic/device/$platform/platform_env.conf" source $env_file - - modprobe linux-kernel-bde dmasize=$dmasize maxpayload=128 debug=4 dma_debug=1 usemsi=$usemsi - modprobe linux-user-bde - - # Using insmod with absolute path for psample to make sure bcm psample is loaded. - # There is a different psample.ko module getting created at net/psample/psample.ko - insmod /lib/modules/$(uname -r)/extra/psample.ko - - modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238 debug=0x5020 default_mtu=9100 - modprobe linux-knet-cb - modprobe linux_ngbde -} - -function remove_kernel_modules() -{ - rmmod psample.ko - rmmod linux-knet-cb - rmmod linux-bcm-knet - rmmod linux-user-bde - rmmod linux-kernel-bde - rmmod linux_ngbde } case "$1" in start) echo -n "Load OpenNSL kernel modules... " + load_platform_env create_devices load_kernel_modules @@ -87,6 +116,7 @@ start) stop) echo -n "Unload OpenNSL kernel modules... " + load_platform_env remove_kernel_modules echo "done." diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules.install b/platform/broadcom/saibcm-modules/debian/opennsl-modules.install index 59bf020cb22c..c739b6a5fc40 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules.install +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules.install @@ -4,3 +4,5 @@ systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/5.10.0-8 systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/5.10.0-8-2-amd64/extra systemd/opennsl-modules.service lib/systemd/system sdklt/linux/bde/linux_ngbde.ko lib/modules/5.10.0-8-2-amd64/extra +sdklt/linux/knet/linux_ngknet.ko lib/modules/5.10.0-8-2-amd64/extra +sdklt/linux/knetcb/linux_ngknetcb.ko lib/modules/5.10.0-8-2-amd64/extra diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/Makefile index 6ac9d418a3d2..d3811d459f04 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/Makefile @@ -1,7 +1,7 @@ ifneq ($(KERNELRELEASE),) obj-m:= accton_as9716_32d_cpld.o accton_as9716_32d_fan.o \ accton_as9716_32d_leds.o accton_as9716_32d_psu.o accton_i2c_psu.o \ - pddf_custom_psu.o + pddf_custom_psu.o accton_as9716_32d_ioport.o CFLAGS_pddf_custom_psu.o := -I$(M)/../../../../pddf/i2c/modules/include KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_ioport.c b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_ioport.c new file mode 100644 index 000000000000..e6d9e8adf373 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_ioport.c @@ -0,0 +1,180 @@ +/* + * A hwmon driver for the Accton as9926 24d fan + * + * Copyright (C) 2016 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as9716_32d_ioport" +#define IOPORT_I2C_MUX_RST 0x50D + +static ssize_t show_i2c_mux_rst(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_i2c_mux_rst(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +static struct as9716_ioport_data *data = NULL; + +/* ioport data */ +struct as9716_ioport_data { + struct platform_device *pdev; + struct device *hwmon_dev; + struct mutex update_lock; +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(i2c_mux_rst, S_IRUGO | S_IWUSR, show_i2c_mux_rst, + set_i2c_mux_rst, 0); + +static struct attribute *sys_attributes[] = { + &sensor_dev_attr_i2c_mux_rst.dev_attr.attr, + NULL +}; + +static struct attribute_group sys_group = { + .attrs = sys_attributes, +}; + +static ssize_t show_i2c_mux_rst(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0; + mutex_lock(&data->update_lock); + val = inb(IOPORT_I2C_MUX_RST); + mutex_unlock(&data->update_lock); + return sprintf(buf, "%d\n", !(val & 0xEF)); +} + +static ssize_t set_i2c_mux_rst(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + u8 val = 0; + long value = 0; + int status = 0; + + status = kstrtol(buf, 10, &value); + if (status) + return status; + + mutex_lock(&data->update_lock); + + val = inb(IOPORT_I2C_MUX_RST); + if (value) + outb(val & 0xEF, IOPORT_I2C_MUX_RST); + else + outb(val | 0x10, IOPORT_I2C_MUX_RST); + + mutex_unlock(&data->update_lock); + return count; +} + +static int as9716_32d_ioport_probe(struct platform_device *pdev) +{ + int status = -1; + + request_region(IOPORT_I2C_MUX_RST, 1, "mux_rst"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&pdev->dev.kobj, &sys_group); + if (status) { + goto exit; + } + + dev_info(&pdev->dev, "device created\n"); + return 0; + +exit: + sysfs_remove_group(&pdev->dev.kobj, &sys_group); + return status; +} + +static int as9716_32d_ioport_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &sys_group); + release_region(IOPORT_I2C_MUX_RST, 1); + return 0; +} + +static struct platform_driver as9716_32d_ioport_driver = { + .probe = as9716_32d_ioport_probe, + .remove = as9716_32d_ioport_remove, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init as9716_32d_ioport_init(void) +{ + int ret; + + data = kzalloc(sizeof(struct as9716_ioport_data), GFP_KERNEL); + if (!data) { + ret = -ENOMEM; + goto alloc_err; + } + + mutex_init(&data->update_lock); + + ret = platform_driver_register(&as9716_32d_ioport_driver); + if (ret < 0) + goto dri_reg_err; + + data->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(data->pdev)) { + ret = PTR_ERR(data->pdev); + goto dev_reg_err; + } + + return 0; + +dev_reg_err: + platform_driver_unregister(&as9716_32d_ioport_driver); +dri_reg_err: + kfree(data); +alloc_err: + return ret; +} + +static void __exit as9716_32d_ioport_exit(void) +{ + platform_device_unregister(data->pdev); + platform_driver_unregister(&as9716_32d_ioport_driver); + kfree(data); +} + +module_init(as9716_32d_ioport_init); +module_exit(as9716_32d_ioport_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as9716_32d_ioport driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index da8370423b07..9b61f8bdbe65 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit da8370423b07c9271fad515c9ef1fd6149abbeed +Subproject commit 9b61f8bdbe657e8798bc40c09039a6e0a7f5d150 diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init index 21587bfbd3fd..12f8fc61f2ea 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init @@ -61,19 +61,19 @@ start) [ $found -eq 0 ] && echo "cannot find iSMT" && exit 1 i2cset -y ${devnum} 0x70 0x10 0x00 0x01 i - sleep 1 + sleep 0.1 # Attach PCA9548 0x71 Channel Extender for Main Board echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-${devnum}/new_device - sleep 1 + sleep 0.1 # Attach PCA9548 0x73 Channel Extender for CPU Board echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-${devnum}/new_device - sleep 1 + sleep 0.1 # Attach PCA9548 0x77 Channel Extender for Fan's EEPROMs echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-${devnum}/new_device - sleep 1 + sleep 0.1 # Attach syseeprom echo 24lc64t 0x50 > /sys/bus/i2c/devices/i2c-12/new_device @@ -106,7 +106,7 @@ start) echo pca9505 0x20 > /sys/bus/i2c/devices/i2c-17/new_device modprobe dx010_cpld - sleep 2 + sleep 1 # Export platform gpio sysfs export_gpio 10 "in" # Fan 1 present @@ -148,15 +148,14 @@ start) done bus_en=8 - sleep 1 cfg_r=`i2cget -y -f 8 0x60 0xD1` ((cfg_w=$cfg_r+$bus_en)) i2cset -y -f 8 0x60 0xD1 $cfg_w - sleep 1 + sleep 0.1 cfg_r=`i2cget -y -f 9 0x20 0xD1` ((cfg_w=$cfg_r+$bus_en)) i2cset -y -f 9 0x20 0xD1 $cfg_w - sleep 1 + sleep 0.1 /bin/sh /usr/local/bin/platform_api_mgnt.sh init diff --git a/platform/broadcom/sonic-platform-modules-nokia b/platform/broadcom/sonic-platform-modules-nokia index ded0344a6819..b67d4795e691 160000 --- a/platform/broadcom/sonic-platform-modules-nokia +++ b/platform/broadcom/sonic-platform-modules-nokia @@ -1 +1 @@ -Subproject commit ded0344a68197363c8c0eefff87b1be0a4591f87 +Subproject commit b67d4795e691cccd4321b196ba92942f5e8fe395 diff --git a/platform/components/docker-gbsyncd-credo.mk b/platform/components/docker-gbsyncd-credo.mk index 4f7c37980dee..6f5c69b506e6 100644 --- a/platform/components/docker-gbsyncd-credo.mk +++ b/platform/components/docker-gbsyncd-credo.mk @@ -1,9 +1,9 @@ DOCKER_GBSYNCD_PLATFORM_CODE = credo -LIBSAI_CREDO = libsaicredo_0.7.2_amd64.deb -$(LIBSAI_CREDO)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo_0.7.2_amd64.deb?sv=2020-08-04&st=2021-11-23T03%3A17%3A40Z&se=2100-11-24T03%3A17%3A00Z&sr=b&sp=r&sig=q1hj3YHdkSnaKkN%2Bv0SYw01keE4ottLffuxSGre9mu0%3D" -LIBSAI_CREDO_OWL = libsaicredo-owl_0.7.2_amd64.deb -$(LIBSAI_CREDO_OWL)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo-owl_0.7.2_amd64.deb?sv=2020-08-04&st=2021-11-23T03%3A50%3A31Z&se=2100-11-24T03%3A50%3A00Z&sr=b&sp=r&sig=mhiqfhHsBwa5AZOuNSj0U8uLsr46Tet6OGC41Mx5B6I%3D" +LIBSAI_CREDO = libsaicredo_0.7.5_amd64.deb +$(LIBSAI_CREDO)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo_0.7.5_amd64.deb?sv=2020-10-02&st=2022-04-14T02%3A21%3A31Z&se=2100-04-15T02%3A21%3A00Z&sr=b&sp=r&sig=iDv9Fprntpw9iVBFYVjW8iygy4qcSWT8O90nAXdXR0A%3D" +LIBSAI_CREDO_OWL = libsaicredo-owl_0.7.5_amd64.deb +$(LIBSAI_CREDO_OWL)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo-owl_0.7.5_amd64.deb?sv=2020-10-02&st=2022-04-14T02%3A23%3A22Z&se=2100-04-15T02%3A23%3A00Z&sr=b&sp=r&sig=58z6E2nPcLIGjqAoxRAo7du%2FzjIBZkFdoXfSzw96Kxc%3D" ifneq ($($(LIBSAI_CREDO)_URL),) include $(PLATFORM_PATH)/../template/docker-gbsyncd-base.mk diff --git a/platform/components/docker-gbsyncd-credo/supervisord.conf.j2 b/platform/components/docker-gbsyncd-credo/supervisord.conf.j2 index 6f12053ce236..01ef324450a9 100644 --- a/platform/components/docker-gbsyncd-credo/supervisord.conf.j2 +++ b/platform/components/docker-gbsyncd-credo/supervisord.conf.j2 @@ -10,6 +10,14 @@ autorestart=unexpected startretries=0 exitcodes=0,3 events=PROCESS_STATE +buffer_size=1024 + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener --container-name gbsyncd +events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING +autostart=true +autorestart=unexpected +buffer_size=1024 [program:rsyslogd] command=/usr/sbin/rsyslogd -n -iNONE diff --git a/platform/marvell-armhf/sai.mk b/platform/marvell-armhf/sai.mk index 4df1b2c5b6f6..4ecfdce244a1 100644 --- a/platform/marvell-armhf/sai.mk +++ b/platform/marvell-armhf/sai.mk @@ -1,6 +1,6 @@ # Marvell SAI -export MRVL_SAI_VERSION = 1.9.1-1 +export MRVL_SAI_VERSION = 1.9.1-2 export MRVL_SAI = mrvllibsai_$(MRVL_SAI_VERSION)_$(PLATFORM_ARCH).deb $(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py index 91ef75d8f9a7..95cc8e89f0d8 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py @@ -30,7 +30,7 @@ def main(): high_thresh = "NA" print(" Low Threshold(C): {}, High Threshold(C): {}".format(low_thresh, - high_thresh)) + high_thresh)) try: crit_low_thresh = thermal.get_low_critical_threshold() diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py index c7e408c3f3e9..444ca5b137d7 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py @@ -44,8 +44,8 @@ def __init__(self, thermal_index): if self.index < 3: i2c_path = self.I2C_CLASS_DIR + self.I2C_DEV_MAPPING[self.index - 1][0] sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1] - sensor_max_suffix = "max" - sensor_crit_suffix = None + sensor_high_suffix = "max" + sensor_high_crit_suffix = None hwmon_node = os.listdir(i2c_path)[0] self.SENSOR_DIR = i2c_path + hwmon_node + '/' @@ -53,8 +53,8 @@ def __init__(self, thermal_index): elif self.index < 6: i2c_path = self.I2C_CLASS_DIR + self.I2C_DEV_MAPPING[self.index - 1][0] sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1] - sensor_max_suffix = "max" - sensor_crit_suffix = "crit" + sensor_high_suffix = "crit" + sensor_high_crit_suffix = None hwmon_node = os.listdir(i2c_path)[0] self.SENSOR_DIR = i2c_path + hwmon_node + '/' @@ -62,8 +62,8 @@ def __init__(self, thermal_index): else: dev_path = self.HWMON_CLASS_DIR sensor_index = 1 - sensor_max_suffix = None - sensor_crit_suffix = None + sensor_high_suffix = None + sensor_high_crit_suffix = None hwmon_node = os.listdir(dev_path)[0] self.SENSOR_DIR = dev_path + hwmon_node + '/' @@ -72,16 +72,16 @@ def __init__(self, thermal_index): + "temp{}_input".format(sensor_index) # sysfs file for high threshold value if supported for this sensor - if sensor_max_suffix: + if sensor_high_suffix: self.thermal_high_threshold_file = self.SENSOR_DIR \ - + "temp{}_{}".format(sensor_index, sensor_max_suffix) + + "temp{}_{}".format(sensor_index, sensor_high_suffix) else: self.thermal_high_threshold_file = None # sysfs file for crit high threshold value if supported for this sensor - if sensor_crit_suffix: + if sensor_high_crit_suffix: self.thermal_high_crit_threshold_file = self.SENSOR_DIR \ - + "temp{}_{}".format(sensor_index, sensor_crit_suffix) + + "temp{}_{}".format(sensor_index, sensor_high_crit_suffix) else: self.thermal_high_crit_threshold_file = None diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 404db43c70aa..386f00e3fe31 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -31,6 +31,9 @@ RUN apt-get update && \ libxml2 \ python-pip \ python-dev \ +{%- if ENABLE_ASAN == "y" %} + libasan5 \ +{%- endif %} python-setuptools RUN pip2 install --upgrade pip @@ -58,8 +61,12 @@ RUN apt-get clean -y && \ apt-get autoremove -y && \ rm -rf /debs -COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor/"] +RUN mkdir -p /etc/supervisor/conf.d/ +RUN sonic-cfggen -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf +RUN rm -f /usr/share/sonic/templates/supervisord.conf.j2 + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/mellanox/docker-syncd-mlnx/supervisord.conf b/platform/mellanox/docker-syncd-mlnx/supervisord.conf.j2 similarity index 89% rename from platform/mellanox/docker-syncd-mlnx/supervisord.conf rename to platform/mellanox/docker-syncd-mlnx/supervisord.conf.j2 index 6fd59606062d..cc07096b20c6 100644 --- a/platform/mellanox/docker-syncd-mlnx/supervisord.conf +++ b/platform/mellanox/docker-syncd-mlnx/supervisord.conf.j2 @@ -37,3 +37,6 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=rsyslogd:running +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/syncd-asan.log" +{% endif %} diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 1cc3d0f75660..c7bafc0d8921 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -657,24 +657,23 @@ def initialize_reboot_cause(self): self.reboot_major_cause_dict = { 'reset_main_pwr_fail' : self.REBOOT_CAUSE_POWER_LOSS, 'reset_aux_pwr_or_ref' : self.REBOOT_CAUSE_POWER_LOSS, + 'reset_comex_pwr_fail' : self.REBOOT_CAUSE_POWER_LOSS, 'reset_asic_thermal' : self.REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC, + 'reset_comex_thermal' : self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, 'reset_hotswap_or_wd' : self.REBOOT_CAUSE_WATCHDOG, + 'reset_comex_wd' : self.REBOOT_CAUSE_WATCHDOG, 'reset_swb_wd' : self.REBOOT_CAUSE_WATCHDOG, - 'reset_sff_wd' : self.REBOOT_CAUSE_WATCHDOG - } - self.reboot_minor_cause_dict = { - 'reset_fw_reset' : "Reset by ASIC firmware", - 'reset_long_pb' : "Reset by long press on power button", - 'reset_short_pb' : "Reset by short press on power button", - 'reset_comex_thermal' : "ComEx thermal shutdown", - 'reset_comex_pwr_fail' : "ComEx power fail", - 'reset_comex_wd' : "Reset requested from ComEx", - 'reset_from_asic' : "Reset requested from ASIC", - 'reset_reload_bios' : "Reset caused by BIOS reload", - 'reset_hotswap_or_halt' : "Reset caused by hotswap or halt", - 'reset_from_comex' : "Reset from ComEx", - 'reset_voltmon_upgrade_fail': "Reset due to voltage monitor devices upgrade failure" + 'reset_sff_wd' : self.REBOOT_CAUSE_WATCHDOG, + 'reset_hotswap_or_halt' : self.REBOOT_CAUSE_HARDWARE_OTHER, + 'reset_voltmon_upgrade_fail': self.REBOOT_CAUSE_HARDWARE_OTHER, + 'reset_reload_bios' : self.REBOOT_CAUSE_HARDWARE_BIOS, + 'reset_from_comex' : self.REBOOT_CAUSE_HARDWARE_CPU, + 'reset_fw_reset' : self.REBOOT_CAUSE_HARDWARE_RESET_FROM_ASIC, + 'reset_from_asic' : self.REBOOT_CAUSE_HARDWARE_RESET_FROM_ASIC, + 'reset_long_pb' : self.REBOOT_CAUSE_HARDWARE_BUTTON, + 'reset_short_pb' : self.REBOOT_CAUSE_HARDWARE_BUTTON } + self.reboot_minor_cause_dict = {} self.reboot_by_software = 'reset_sw_reset' self.reboot_cause_initialized = True diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 39494a124ed4..69f2f8930cc4 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -24,8 +24,10 @@ try: import os + import time from sonic_platform_base.psu_base import PsuBase from sonic_py_common.logger import Logger + from .device_data import DeviceDataManager from .led import PsuLed, SharedLed, ComponentFaultyIndicator from . import utils from .vpd_parser import VpdParser @@ -395,6 +397,7 @@ def get_temperature_high_threshold(self): return None + @utils.default_return(None) def get_voltage_high_threshold(self): """ Retrieves the high threshold PSU voltage output @@ -411,10 +414,13 @@ def get_voltage_high_threshold(self): capability = utils.read_str_from_file(self.psu_voltage_capability) if 'max' in capability: max_voltage = utils.read_int_from_file(self.psu_voltage_max, log_func=logger.log_info) - return float(max_voltage) / 1000 + max_voltage = InvalidPsuVolWA.run(self, max_voltage, self.psu_voltage_max) + if max_voltage: + return float(max_voltage) / 1000 return None + @utils.default_return(None) def get_voltage_low_threshold(self): """ Retrieves the low threshold PSU voltage output @@ -431,7 +437,9 @@ def get_voltage_low_threshold(self): capability = utils.read_str_from_file(self.psu_voltage_capability) if 'min' in capability: min_voltage = utils.read_int_from_file(self.psu_voltage_min, log_func=logger.log_info) - return float(min_voltage) / 1000 + min_voltage = InvalidPsuVolWA.run(self, min_voltage, self.psu_voltage_min) + if min_voltage: + return float(min_voltage) / 1000 return None @@ -448,3 +456,71 @@ def get_maximum_supplied_power(self): return float(power_max) / 1000000 else: return None + + +class InvalidPsuVolWA: + """This class is created as a workaround for a known hardware issue that the PSU voltage threshold could be a + invalid value 127998. Once we read a voltage threshold value equal to 127998, we should do following: + 1. Check the PSU vendor, it should be Delta + 2. Generate a temp sensor configuration file which contains a few set commands. Those set commands are the WA provided by low level team. + 3. Call "sensors -s -c " + 4. Wait for it to take effect + + This issue is found on 3700, 3700c, 3800, 4600c + """ + + INVALID_VOLTAGE_VALUE = 127998 + EXPECT_VENDOR_NAME = 'DELTA' + EXPECT_CAPACITY = '1100' + EXPECT_PLATFORMS = ['x86_64-mlnx_msn3700-r0', 'x86_64-mlnx_msn3700c-r0', 'x86_64-mlnx_msn3800-r0', 'x86_64-mlnx_msn4600c-r0'] + MFR_FIELD = 'MFR_NAME' + CAPACITY_FIELD = 'CAPACITY' + WAIT_TIME = 1 + + @classmethod + def run(cls, psu, threshold_value, threshold_file): + if threshold_value != cls.INVALID_VOLTAGE_VALUE: + # If the threshold value is not an invalid value, just return + return threshold_value + + platform_name = DeviceDataManager.get_platform_name() + # Apply the WA to specified platforms + if platform_name not in cls.EXPECT_PLATFORMS: + # It is unlikely to go to this branch, so we log a warning here + logger.log_warning('PSU {} threshold file {} value {}, but platform is {}'.format(psu.index, threshold_file, threshold_value, platform_name)) + return threshold_value + + # Check PSU vendor, make sure it is DELTA + vendor_name = psu.vpd_parser.get_entry_value(cls.MFR_FIELD) + if vendor_name != 'N/A' and vendor_name != cls.EXPECT_VENDOR_NAME: + # It is unlikely to go to this branch, so we log a warning here + logger.log_warning('PSU {} threshold file {} value {}, but its vendor is {}'.format(psu.index, threshold_file, threshold_value, vendor_name)) + return threshold_value + + # Check PSU version, make sure it is 1100 + capacity = psu.vpd_parser.get_entry_value(cls.CAPACITY_FIELD) + if capacity != 'N/A' and capacity != cls.EXPECT_CAPACITY: + logger.log_warning('PSU {} threshold file {} value {}, but its capacity is {}'.format(psu.index, threshold_file, threshold_value, capacity)) + return threshold_value + + # Run a sensors -s command to triger hardware to get the real threashold value + utils.run_command('sensors -s') + + # Wait for the threshold value change + return cls.wait_set_done(threshold_file) + + @classmethod + def wait_set_done(cls, threshold_file): + wait_time = cls.WAIT_TIME + while wait_time > 0: + value = utils.read_int_from_file(threshold_file, log_func=logger.log_info) + if value != cls.INVALID_VOLTAGE_VALUE: + return value + + wait_time -= 1 + time.sleep(1) + + # It is enough to use warning here because user might power off/on the PSU which may cause threshold_file + # does not exist + logger.log_warning('sensors -s does not recover PSU threshold sensor after {} seconds'.format(cls.WAIT_TIME)) + return None diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py index 0650d9af1a1c..22ef4bb1f27d 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py @@ -194,3 +194,16 @@ def _impl(*args, **kwargs): return return_value return _impl return wrapper + + +def run_command(command): + """ + Utility function to run an shell command and return the output. + :param command: Shell command string. + :return: Output of the shell command. + """ + try: + process = subprocess.Popen(command, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + return process.communicate()[0].strip() + except Exception: + return None \ No newline at end of file diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/vpd_parser.py b/platform/mellanox/mlnx-platform-api/sonic_platform/vpd_parser.py index ea66234e4bff..e53d825adfd6 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/vpd_parser.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/vpd_parser.py @@ -24,6 +24,7 @@ SN_VPD_FIELD = "SN_VPD_FIELD" PN_VPD_FIELD = "PN_VPD_FIELD" REV_VPD_FIELD = "REV_VPD_FIELD" +MFR_VPD_FIELD = "MFR_NAME" class VpdParser: @@ -82,3 +83,17 @@ def get_revision(self): logger.log_error("Fail to read revision: No key {} in VPD {}".format(REV_VPD_FIELD, self.vpd_file)) return 'N/A' return self.vpd_data.get(REV_VPD_FIELD, 'N/A') + + def get_entry_value(self, key): + """ + Retrieves an vpd entry of the device + + Returns: + string: Vpd entry value of device + """ + if self._get_data() and key not in self.vpd_data: + logger.log_warning("Fail to read vpd info: No key {} in VPD {}".format(key, self.vpd_file)) + return 'N/A' + return self.vpd_data.get(key, 'N/A') + + diff --git a/platform/mellanox/mlnx-platform-api/tests/test_psu.py b/platform/mellanox/mlnx-platform-api/tests/test_psu.py index c53a9d44797d..68260ef630f7 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_psu.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_psu.py @@ -116,3 +116,40 @@ def test_psu_vpd(self): assert psu.get_model() == 'MTEF-PSF-AC-C' assert psu.get_serial() == 'MT1946X07684' assert psu.get_revision() == 'A3' + + assert psu.vpd_parser.get_entry_value('MFR_NAME') == 'DELTA' + + @mock.patch('sonic_platform.utils.read_int_from_file', mock.MagicMock(return_value=9999)) + @mock.patch('sonic_platform.utils.run_command') + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_platform_name') + @mock.patch('sonic_platform.vpd_parser.VpdParser.get_entry_value') + def test_psu_workaround(self, mock_get_entry_value, mock_get_platform_name, mock_run_command): + from sonic_platform.psu import InvalidPsuVolWA + psu = Psu(0) + # Threshold value is not InvalidPsuVolWA.INVALID_VOLTAGE_VALUE + assert InvalidPsuVolWA.run(psu, 9999, '') == 9999 + + # Platform name is not in InvalidPsuVolWA.EXPECT_PLATFORMS + mock_get_platform_name.return_value = 'some platform' + assert InvalidPsuVolWA.run(psu, InvalidPsuVolWA.INVALID_VOLTAGE_VALUE, '') == InvalidPsuVolWA.INVALID_VOLTAGE_VALUE + + # PSU vendor is not InvalidPsuVolWA.EXPECT_VENDOR_NAME + vpd_info = { + InvalidPsuVolWA.MFR_FIELD: 'some psu', + InvalidPsuVolWA.CAPACITY_FIELD: 'some capacity' + } + def get_entry_value(key): + return vpd_info[key] + + mock_get_entry_value.side_effect = get_entry_value + mock_get_platform_name.return_value = 'x86_64-mlnx_msn3700-r0' + assert InvalidPsuVolWA.run(psu, InvalidPsuVolWA.INVALID_VOLTAGE_VALUE, '') == InvalidPsuVolWA.INVALID_VOLTAGE_VALUE + + # PSU capacity is not InvalidPsuVolWA.EXPECT_CAPACITY + vpd_info[InvalidPsuVolWA.MFR_FIELD] = InvalidPsuVolWA.EXPECT_VENDOR_NAME + assert InvalidPsuVolWA.run(psu, InvalidPsuVolWA.INVALID_VOLTAGE_VALUE, '') == InvalidPsuVolWA.INVALID_VOLTAGE_VALUE + + # 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') diff --git a/platform/mellanox/mlnx-platform-api/tests/test_utils.py b/platform/mellanox/mlnx-platform-api/tests/test_utils.py index 7da17dc5e7bc..bbc3ab28e58c 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_utils.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_utils.py @@ -116,3 +116,7 @@ def func(): assert func() == 100 assert mock_log.call_count == 1 + + def test_run_command(self): + output = utils.run_command('ls') + assert output diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py index d90949184d5b..ef211b9933c4 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py @@ -96,11 +96,11 @@ def get_model(self): """ return self._eeprom.part_number_str() - def get_serial(self): + def get_service_tag(self): """ - Retrieves the serial number of the chassis (Service tag) + Retrieves the service tag of the chassis Returns: - string: Serial number of chassis + string: Sevice tag of chassis """ return self._eeprom.serial_str() @@ -123,7 +123,7 @@ def get_base_mac(self): """ return self._eeprom.base_mac_addr() - def get_serial_number(self): + def get_serial(self): """ Retrieves the hardware serial number for the chassis diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py index 2a8ef46085c5..c0e95c896910 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py @@ -150,7 +150,7 @@ def get_speed(self): if output['status'].isalpha(): return 0 else: - speed = int(output['status']) + speed = int(float(output['status'])) max_speed = int(self.plugin_data['PSU']['PSU_FAN_MAX_SPEED']) speed_percentage = round((speed*100)/max_speed) diff --git a/platform/vs/docker-ptf.mk b/platform/vs/docker-ptf.mk index 445fc8daf4d3..ef102be967f4 100644 --- a/platform/vs/docker-ptf.mk +++ b/platform/vs/docker-ptf.mk @@ -1,6 +1,7 @@ # docker image for docker-ptf 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) SONIC_DOCKER_IMAGES += $(DOCKER_PTF) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 21c607e28c9e..cc867e3d0eeb 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -66,6 +66,9 @@ RUN apt-get install -y net-tools \ gir1.2-glib-2.0 \ libdbus-1-3 \ libgirepository-1.0-1 \ + {%- if ENABLE_ASAN == "y" %} + libasan5 \ + {%- endif %} libsystemd0 # Install redis-server @@ -160,7 +163,7 @@ RUN sed -ri 's/^(save .*$)/# \1/g; COPY ["50-default.conf", "/etc/rsyslog.d/"] COPY ["start.sh", "orchagent.sh", "files/update_chassisdb_config", "/usr/bin/"] -COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"] COPY ["files/configdb-load.sh", "/usr/bin/"] COPY ["files/arp_update", "/usr/bin/"] COPY ["files/buffers_config.j2", "files/qos_config.j2", "files/arp_update_vars.j2", "files/copp_cfg.j2", "/usr/share/sonic/templates/"] @@ -179,6 +182,10 @@ COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Force10-S6000/ COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/"] COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Mellanox-SN2700/"] +RUN mkdir -p /etc/supervisor/conf.d/ +RUN sonic-cfggen -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf +RUN rm -f /usr/share/sonic/templates/supervisord.conf.j2 + # Workaround the tcpdump issue RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf.j2 similarity index 69% rename from platform/vs/docker-sonic-vs/supervisord.conf rename to platform/vs/docker-sonic-vs/supervisord.conf.j2 index 96f027131520..a49f33866edf 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf.j2 @@ -42,6 +42,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/syncd-asan.log" +{% endif %} [program:gbsyncd] command=/usr/bin/syncd -s -p /usr/share/sonic/hwsku/pai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1 @@ -67,6 +70,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/portsyncd-asan.log" +{% endif %} [program:orchagent] command=/usr/bin/orchagent.sh @@ -75,6 +81,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/orchagent-asan.log" +{% endif %} [program:coppmgrd] command=/usr/bin/coppmgrd @@ -83,6 +92,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/coppmgrd-asan.log" +{% endif %} [program:neighsyncd] command=/usr/bin/neighsyncd @@ -91,6 +103,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/neighsyncd-asan.log" +{% endif %} [program:teamsyncd] command=/usr/bin/teamsyncd @@ -99,6 +114,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/teamsyncd-asan.log" +{% endif %} [program:vlanmgrd] command=/usr/bin/vlanmgrd @@ -107,6 +125,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/vlanmgrd-asan.log" +{% endif %} [program:intfmgrd] command=/usr/bin/intfmgrd @@ -115,6 +136,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/intfmgrd-asan.log" +{% endif %} [program:portmgrd] command=/usr/bin/portmgrd @@ -123,6 +147,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/portmgrd-asan.log" +{% endif %} [program:teammgrd] command=/usr/bin/teammgrd @@ -131,6 +158,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/teammgrd-asan.log" +{% endif %} [program:zebra] command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm @@ -163,6 +193,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/fpmsyncd-asan.log" +{% endif %} [program:arp_update] command=/usr/bin/arp_update @@ -179,6 +212,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/buffermgrd-asan.log" +{% endif %} [program:vrfmgrd] command=/usr/bin/vrfmgrd @@ -187,6 +223,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/vrfmgrd-asan.log" +{% endif %} [program:restore_neighbors] command=/usr/bin/restore_neighbors.py @@ -205,6 +244,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/nbrmgrd-asan.log" +{% endif %} [program:vxlanmgrd] command=/usr/bin/vxlanmgrd @@ -213,6 +255,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/vxlanmgrd-asan.log" +{% endif %} [program:sflowmgrd] command=/usr/bin/sflowmgrd @@ -221,6 +266,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/sflowmgrd-asan.log" +{% endif %} [program:natmgrd] command=/usr/bin/natmgrd @@ -229,6 +277,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/natmgrd-asan.log" +{% endif %} [program:natsyncd] command=/usr/bin/natsyncd @@ -237,6 +288,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/natsyncd-asan.log" +{% endif %} [program:fdbsyncd] command=/usr/bin/fdbsyncd @@ -245,6 +299,9 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/fdbsyncd-asan.log" +{% endif %} [program:tunnelmgrd] command=/usr/bin/tunnelmgrd @@ -253,3 +310,6 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/tunnelmgrd-asan.log" +{% endif %} diff --git a/platform/vs/docker-sonic-vs/zero_profiles.json b/platform/vs/docker-sonic-vs/zero_profiles.json index fbd42bf7ec3e..7648fec56b15 100644 --- a/platform/vs/docker-sonic-vs/zero_profiles.json +++ b/platform/vs/docker-sonic-vs/zero_profiles.json @@ -43,7 +43,7 @@ "BUFFER_PROFILE_TABLE:egress_lossless_zero_profile" : { "pool":"egress_lossless_pool", "size":"0", - "dynamic_th":"-8" + "static_th":"0" }, "OP": "SET" }, diff --git a/rules/config b/rules/config index 46091daa0328..59e656f4de3e 100644 --- a/rules/config +++ b/rules/config @@ -185,6 +185,13 @@ INCLUDE_VNET_MONITOR = n # The relative path is build root folder. SONIC_ENABLE_IMAGE_SIGNATURE ?= n +# SONIC_ENABLE_SECUREBOOT_SIGNATURE - enable SONiC kernel signing to support UEFI secureboot +# To support UEFI secureboot chain of trust requires EFI kernel to be signed as a PE binary +# SIGNING_KEY = +# SIGNING_CERT = +# The absolute path should be provided. +SONIC_ENABLE_SECUREBOOT_SIGNATURE ?= n + # PACKAGE_URL_PREFIX - the package url prefix PACKAGE_URL_PREFIX ?= https://packages.trafficmanager.net/public/packages diff --git a/rules/debootstrap.dep b/rules/debootstrap.dep new file mode 100644 index 000000000000..82ca11d7e4df --- /dev/null +++ b/rules/debootstrap.dep @@ -0,0 +1,10 @@ + +SPATH := $($(DEBOOTSTRAP)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/debootstrap.mk rules/debootstrap.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) + +$(DEBOOTSTRAP)_CACHE_MODE := GIT_CONTENT_SHA +$(DEBOOTSTRAP)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DEBOOTSTRAP)_DEP_FILES := $(DEP_FILES) + diff --git a/rules/debootstrap.mk b/rules/debootstrap.mk new file mode 100644 index 000000000000..dc60599d5f3f --- /dev/null +++ b/rules/debootstrap.mk @@ -0,0 +1,9 @@ +# debootstrap package + +DEBOOTSTRAP_VERSION = 1.0.123 + +export DEBOOTSTRAP_VERSION + +DEBOOTSTRAP = debootstrap_$(DEBOOTSTRAP_VERSION)_all.deb +$(DEBOOTSTRAP)_SRC_PATH = $(SRC_PATH)/debootstrap +SONIC_MAKE_DEBS += $(DEBOOTSTRAP) diff --git a/rules/docker-macsec.mk b/rules/docker-macsec.mk index 1cb14246e86a..7bea7ef321b8 100644 --- a/rules/docker-macsec.mk +++ b/rules/docker-macsec.mk @@ -6,14 +6,13 @@ DOCKER_MACSEC_DBG = $(DOCKER_MACSEC_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_MACSEC)_PATH = $(DOCKERS_PATH)/$(DOCKER_MACSEC_STEM) -$(DOCKER_MACSEC)_DEPENDS += $(SWSS) $(WPASUPPLICANT) $(REDIS_TOOLS) $(LIBNL3) $(LIBNL_GENL3) $(LIBNL_ROUTE3) -$(DOCKER_MACSEC)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) -$(DOCKER_MACSEC)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) -$(DOCKER_MACSEC)_DBG_DEPENDS += $(WPASUPPLICANT_DBG) +$(DOCKER_MACSEC)_DEPENDS += $(SWSS) $(WPASUPPLICANT) $(LIBSWSSCOMMON) $(LIBNL3) $(LIBNL_GENL3) $(LIBNL_ROUTE3) +$(DOCKER_MACSEC)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_MACSEC)_DBG_DEPENDS += $(SWSS_DBG) $(WPASUPPLICANT_DBG) $(LIBSWSSCOMMON_DBG) -$(DOCKER_MACSEC)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_MACSEC)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) -$(DOCKER_MACSEC)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) +$(DOCKER_MACSEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) SONIC_DOCKER_IMAGES += $(DOCKER_MACSEC) ifeq ($(INCLUDE_MACSEC), y) @@ -34,5 +33,5 @@ $(DOCKER_MACSEC)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_MACSEC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) -SONIC_BUSTER_DOCKERS += $(DOCKER_MACSEC) -SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MACSEC_DBG) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_MACSEC) +SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_MACSEC_DBG) diff --git a/rules/docker-mux.mk b/rules/docker-mux.mk index 31c3212ea11f..cbdc1c06510d 100644 --- a/rules/docker-mux.mk +++ b/rules/docker-mux.mk @@ -7,12 +7,12 @@ DOCKER_MUX_DBG = $(DOCKER_MUX_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_MUX)_PATH = $(DOCKERS_PATH)/$(DOCKER_MUX_STEM) $(DOCKER_MUX)_DEPENDS = $(SONIC_LINKMGRD) $(LIBSWSSCOMMON) $(LIBHIREDIS) -$(DOCKER_MUX)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_MUX)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) $(DOCKER_MUX)_DBG_DEPENDS += $(SONIC_LINKMGRD_DBG) $(LIBSWSSCOMMON_DBG) $(LIBHIREDIS_DBG) -$(DOCKER_MUX)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_MUX)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) -$(DOCKER_MUX)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_MUX)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_MUX)_VERSION = 1.0.0 $(DOCKER_MUX)_PACKAGE_NAME = mux @@ -32,8 +32,4 @@ endif $(DOCKER_MUX)_CONTAINER_NAME = mux $(DOCKER_MUX)_RUN_OPT += --privileged -t $(DOCKER_MUX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT)_RUN_OPT += -v /var/log/mux:/var/log/mux:rw $(DOCKER_MUX)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) - -SONIC_BUSTER_DOCKERS += $(DOCKER_MUX) -SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MUX_DBG) diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk index d9453465c702..ef0c203877d8 100644 --- a/rules/docker-orchagent.mk +++ b/rules/docker-orchagent.mk @@ -10,6 +10,7 @@ $(DOCKER_ORCHAGENT)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) $(DOCKER_ORCHAGENT)_DBG_DEPENDS += $(SWSS_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIREDIS_DBG) +$(DOCKER_ORCHAGENT)_PYTHON_WHEELS += $(SCAPY) $(DOCKER_ORCHAGENT)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) diff --git a/rules/ptf-py3.dep b/rules/ptf-py3.dep new file mode 100644 index 000000000000..eadb32aabdf4 --- /dev/null +++ b/rules/ptf-py3.dep @@ -0,0 +1,11 @@ + +SPATH := $($(PTF_PY3)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/ptf-py3.mk rules/ptf-py3.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) + +$(PTF_PY3)_CACHE_MODE := GIT_CONTENT_SHA +$(PTF_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(PTF_PY3)_DEP_FILES := $(DEP_FILES) +$(PTF_PY3)_SMDEP_FILES := $(SMDEP_FILES) +$(PTF_PY3)_SMDEP_PATHS := $(SPATH) diff --git a/rules/ptf-py3.mk b/rules/ptf-py3.mk new file mode 100644 index 000000000000..bf583b57b622 --- /dev/null +++ b/rules/ptf-py3.mk @@ -0,0 +1,7 @@ +# ptf package + +PTF_PY3 = ptf-0.9.3-py3-none-any.whl +$(PTF_PY3)_SRC_PATH = $(SRC_PATH)/ptf-py3 +$(PTF_PY3)_PYTHON_VERSION = 3 +$(PTF_PY3)_TEST = n +SONIC_PYTHON_WHEELS += $(PTF_PY3) diff --git a/rules/scapy.dep b/rules/scapy.dep new file mode 100644 index 000000000000..ef09fb12223b --- /dev/null +++ b/rules/scapy.dep @@ -0,0 +1,10 @@ +SPATH := $($(SCAPY)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/scapy.mk rules/scapy.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files -- ':!:doc/*')) + +$(SCAPY)_CACHE_MODE := GIT_CONTENT_SHA +$(SCAPY)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SCAPY)_DEP_FILES := $(DEP_FILES) +$(SCAPY)_SMDEP_FILES := $(SMDEP_FILES) +$(SCAPY)_SMDEP_PATHS := $(SPATH) diff --git a/rules/scapy.mk b/rules/scapy.mk new file mode 100644 index 000000000000..6953c1ef10e2 --- /dev/null +++ b/rules/scapy.mk @@ -0,0 +1,7 @@ +# scapy python3 wheel + +SCAPY = scapy-2.4.5-py2.py3-none-any.whl +$(SCAPY)_SRC_PATH = $(SRC_PATH)/scapy +$(SCAPY)_PYTHON_VERSION = 3 +$(SCAPY)_TEST = n +SONIC_PYTHON_WHEELS += $(SCAPY) diff --git a/rules/sonic-pcied.dep b/rules/sonic-pcied.dep index ddb07f722f6d..05cd1fe5cf42 100644 --- a/rules/sonic-pcied.dep +++ b/rules/sonic-pcied.dep @@ -3,12 +3,6 @@ DEP_FILES:= $(SONIC_COMMON_FILES_LIST) rules/sonic-pcied.mk rules/sonic-pcied.de DEP_FILES+= $(SONIC_COMMON_BASE_FILES_LIST) SMDEP_FILES:= $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) -$(SONIC_PCIED_PY2)_CACHE_MODE:= GIT_CONTENT_SHA -$(SONIC_PCIED_PY2)_DEP_FLAGS:= $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_PCIED_PY2)_DEP_FILES:= $(DEP_FILES) -$(SONIC_PCIED_PY2)_SMDEP_FILES:= $(SMDEP_FILES) -$(SONIC_PCIED_PY2)_SMDEP_PATHS:= $(SPATH) - $(SONIC_PCIED_PY3)_CACHE_MODE:= GIT_CONTENT_SHA $(SONIC_PCIED_PY3)_DEP_FLAGS:= $(SONIC_COMMON_FLAGS_LIST) $(SONIC_PCIED_PY3)_DEP_FILES:= $(DEP_FILES) diff --git a/rules/sonic-pcied.mk b/rules/sonic-pcied.mk index 5c80ae276860..a5d0c8d5054c 100644 --- a/rules/sonic-pcied.mk +++ b/rules/sonic-pcied.mk @@ -1,17 +1,9 @@ # sonic-pcied (SONiC PCIe Monitor daemon) Debian package -# SONIC_PCIED_PY2 package - -SONIC_PCIED_PY2 = sonic_pcied-1.0-py2-none-any.whl -$(SONIC_PCIED_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-pcied -$(SONIC_PCIED_PY2)_DEPENDS = $(SONIC_PY_COMMON_PY2) -$(SONIC_PCIED_PY2)_PYTHON_VERSION = 2 -SONIC_PYTHON_WHEELS += $(SONIC_PCIED_PY2) - # SONIC_PCIED_PY3 package SONIC_PCIED_PY3 = sonic_pcied-1.0-py3-none-any.whl $(SONIC_PCIED_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-pcied -$(SONIC_PCIED_PY3)_DEPENDS = $(SONIC_PY_COMMON_PY3) $(SONIC_PCIED_PY2) +$(SONIC_PCIED_PY3)_DEPENDS = $(SONIC_PY_COMMON_PY3) $(SONIC_PCIED_PY3)_PYTHON_VERSION = 3 SONIC_PYTHON_WHEELS += $(SONIC_PCIED_PY3) diff --git a/rules/thrift_0_14_1.mk b/rules/thrift_0_14_1.mk index b986e0a4dceb..6fc0d05c14bc 100644 --- a/rules/thrift_0_14_1.mk +++ b/rules/thrift_0_14_1.mk @@ -4,8 +4,8 @@ THRIFT_0_14_1_VERSION = 0.14.1 THRIFT_0_14_1_VERSION_FULL = $(THRIFT_0_14_1_VERSION) LIBTHRIFT_0_14_1 = libthrift0_$(THRIFT_0_14_1_VERSION)_$(CONFIGURED_ARCH).deb -$(LIBTHRIFT_0_14_1)_SRC_PATH = $(SRC_PATH)/thrift_0_14_1/thrift -SONIC_DPKG_DEBS += $(LIBTHRIFT_0_14_1) +$(LIBTHRIFT_0_14_1)_SRC_PATH = $(SRC_PATH)/thrift_0_14_1 +SONIC_MAKE_DEBS += $(LIBTHRIFT_0_14_1) LIBTHRIFT_0_14_1_DEV = libthrift-dev_$(THRIFT_0_14_1_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(LIBTHRIFT_0_14_1),$(LIBTHRIFT_0_14_1_DEV))) diff --git a/slave.mk b/slave.mk index 13aff0e6571d..2b44fcb54e16 100644 --- a/slave.mk +++ b/slave.mk @@ -1002,6 +1002,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ $$(addprefix $(TARGET_PATH)/,$$(SONIC_PACKAGES_LOCAL)) \ $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ + $(addsuffix -install,$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(DEBOOTSTRAP))) \ $(if $(findstring y,$(ENABLE_ZTP)),$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(SONIC_ZTP))) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2)) \ @@ -1189,6 +1190,9 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ TARGET_PATH=$(TARGET_PATH) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) \ + SONIC_ENABLE_SECUREBOOT_SIGNATURE="$(SONIC_ENABLE_SECUREBOOT_SIGNATURE)" \ + SIGNING_KEY="$(SIGNING_KEY)" \ + SIGNING_CERT="$(SIGNING_CERT)" \ PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) \ ./build_debian.sh $(LOG) diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index 741f708de269..2c3224999a19 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -117,6 +117,7 @@ RUN apt-get update && apt-get install -y \ devscripts \ quilt \ stgit \ + sbsigntool \ # For platform-modules build module-assistant \ # For thrift build\ @@ -341,6 +342,7 @@ RUN apt-get update && apt-get install -y \ libboost-regex-dev \ googletest \ libgtest-dev \ + libgmock-dev \ libgcc-10-dev \ # For sonic-host-services build libcairo2-dev \ diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index fa8ac44f1b9e..401f032725cf 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -125,6 +125,7 @@ RUN apt-get update && apt-get install -y \ devscripts \ quilt \ stgit \ + sbsigntool \ # For platform-modules build module-assistant \ # For thrift build\ @@ -353,6 +354,7 @@ RUN apt-get update && apt-get install -y \ libboost-regex1.71-dev \ googletest \ libgtest-dev \ + libgmock-dev \ libgcc-8-dev \ # For sonic-host-services build libcairo2-dev \ diff --git a/src/debootstrap/.gitignore b/src/debootstrap/.gitignore new file mode 100644 index 000000000000..2aa8324ad667 --- /dev/null +++ b/src/debootstrap/.gitignore @@ -0,0 +1,3 @@ +debootstrap*.udeb +debootstrap*.dsc +debootstrap-*/ diff --git a/src/debootstrap/Makefile b/src/debootstrap/Makefile new file mode 100644 index 000000000000..04e8646a1b2e --- /dev/null +++ b/src/debootstrap/Makefile @@ -0,0 +1,24 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = debootstrap_$(DEBOOTSTRAP_VERSION)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./debootstrap-$(DEBOOTSTRAP_VERSION) ./debootstrap*.{deb,udeb,dsc} + + # Get source package + dget https://deb.debian.org/debian/pool/main/d/debootstrap/debootstrap_$(DEBOOTSTRAP_VERSION).dsc + + # Build source and Debian packages + pushd debootstrap-$(DEBOOTSTRAP_VERSION) + patch -p1 -i ../proc-mount.patch + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + popd + + # Move the newly-built .deb packages to the destination directory + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) + diff --git a/src/debootstrap/proc-mount.patch b/src/debootstrap/proc-mount.patch new file mode 100644 index 000000000000..93084576490a --- /dev/null +++ b/src/debootstrap/proc-mount.patch @@ -0,0 +1,34 @@ +From 87cdebbcad6f4e16ba711227cbbbd70039f88752 Mon Sep 17 00:00:00 2001 +From: YunQiang Su +Date: Mon, 7 Sep 2020 09:29:37 +0800 +Subject: [PATCH] stage1: re-mkdir /proc instead of umount if it is a symlink + +In docker, the TARGET/proc will be a symlink to /proc. +And if the docker instance is called with --privileged, it will umount +the /proc of the whole instance in setup_proc. +--- + debian/changelog | 3 +++ + functions | 7 ++++++- + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/functions b/functions +index 1ac63f7..065320d 100644 +--- a/functions ++++ b/functions +@@ -1183,7 +1183,12 @@ setup_proc () { + umount_on_exit /dev/shm + umount_on_exit /proc + umount_on_exit /proc/bus/usb +- umount "$TARGET/proc" 2>/dev/null || true ++ if [ -L "$TARGET/proc" ];then ++ rm -f $TARGET/proc ++ mkdir $TARGET/proc ++ else ++ umount "$TARGET/proc" 2>/dev/null || true ++ fi + + # some container environment are used at second-stage, it already treats /proc and so on + if [ -z "$(ls -A "$TARGET/proc")" ]; then +-- +GitLab + diff --git a/src/dhcpmon/src/dhcp_device.c b/src/dhcpmon/src/dhcp_device.c index e4fbc7f56909..f45483f8504c 100644 --- a/src/dhcpmon/src/dhcp_device.c +++ b/src/dhcpmon/src/dhcp_device.c @@ -21,51 +21,25 @@ #include #include #include -#include -#include -#include #include "dhcp_device.h" -/** DHCP versions flags */ -static bool dhcpv4_enabled; -static bool dhcpv6_enabled; - /** Counter print width */ #define DHCP_COUNTER_WIDTH 9 /** Start of Ether header of a captured frame */ #define ETHER_START_OFFSET 0 -/** EtherType field offset from Ether header of a captured frame */ -#define ETHER_TYPE_OFFSET (ETHER_START_OFFSET + 12) /** Start of IP header of a captured frame */ #define IP_START_OFFSET (ETHER_START_OFFSET + ETHER_HDR_LEN) -/** Start of UDP header on IPv4 packet of a captured frame */ -#define UDPv4_START_OFFSET (IP_START_OFFSET + sizeof(struct ip)) -/** Start of DHCPv4 header of a captured frame */ -#define DHCPv4_START_OFFSET (UDPv4_START_OFFSET + sizeof(struct udphdr)) -/** Start of DHCPv4 Options segment of a captured frame */ -#define DHCPv4_OPTIONS_HEADER_SIZE 240 +/** Start of UDP header of a captured frame */ +#define UDP_START_OFFSET (IP_START_OFFSET + sizeof(struct ip)) +/** Start of DHCP header of a captured frame */ +#define DHCP_START_OFFSET (UDP_START_OFFSET + sizeof(struct udphdr)) +/** Start of DHCP Options segment of a captured frame */ +#define DHCP_OPTIONS_HEADER_SIZE 240 /** Offset of DHCP GIADDR */ #define DHCP_GIADDR_OFFSET 24 -/** IPv6 link-local prefix */ -#define IPV6_LINK_LOCAL_PREFIX 0x80fe -/** Start of UDP header on IPv6 packet of a captured frame */ -#define UDPv6_START_OFFSET (IP_START_OFFSET + sizeof(struct ip6_hdr)) -/** Start of DHCPv6 header of a captured frame */ -#define DHCPv6_START_OFFSET (UDPv6_START_OFFSET + sizeof(struct udphdr)) -/** Size of 'type' field on DHCPv6 header */ -#define DHCPv6_TYPE_LENGTH 1 -/** Size of DHCPv6 relay message header to first option */ -#define DHCPv6_RELAY_MSG_OPTIONS_OFFSET 34 -/** Size of 'option' field on DHCPv6 header */ -#define DHCPv6_OPTION_LENGTH 2 -/** Size of 'option length' field on DHCPv6 header */ -#define DHCPv6_OPTION_LEN_LENGTH 2 -/** DHCPv6 OPTION_RELAY_MSG */ -#define DHCPv6_OPTION_RELAY_MSG 9 - #define OP_LDHA (BPF_LD | BPF_H | BPF_ABS) /** bpf ldh Abs */ #define OP_LDHI (BPF_LD | BPF_H | BPF_IND) /** bpf ldh Ind */ #define OP_LDB (BPF_LD | BPF_B | BPF_ABS) /** bpf ldb Abs*/ @@ -75,40 +49,34 @@ static bool dhcpv6_enabled; #define OP_JSET (BPF_JMP | BPF_JSET | BPF_K) /** bpf jset */ #define OP_LDXB (BPF_LDX | BPF_B | BPF_MSH) /** bpf ldxb */ -/** Berkeley Packet Filter program for "udp and (port 546 or port 547 or port 67 or port 68)". +/** Berkeley Packet Filter program for "udp and (port 67 or port 68)". * This program is obtained using the following command tcpdump: - * `tcpdump -dd "udp and (port 546 or port 547 or port 67 or port 68)"` + * `tcpdump -dd "udp and (port 67 or port 68)"` */ static struct sock_filter dhcp_bpf_code[] = { - {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x0000000c}, // (000) ldh [12] - {.code = OP_JEQ, .jt = 0, .jf = 9, .k = 0x000086dd}, // (001) jeq #0x86dd jt 2 jf 11 - {.code = OP_LDB, .jt = 0, .jf = 0, .k = 0x00000014}, // (002) ldb [20] - {.code = OP_JEQ, .jt = 0, .jf = 24, .k = 0x00000011}, // (003) jeq #0x11 jt 4 jf 28 - {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000036}, // (004) ldh [54] - {.code = OP_JEQ, .jt = 21, .jf = 0, .k = 0x00000222}, // (005) jeq #0x222 jt 27 jf 6 - {.code = OP_JEQ, .jt = 20, .jf = 0, .k = 0x00000223}, // (006) jeq #0x223 jt 27 jf 7 - {.code = OP_JEQ, .jt = 19, .jf = 0, .k = 0x00000043}, // (007) jeq #0x43 jt 27 jf 8 - {.code = OP_JEQ, .jt = 18, .jf = 0, .k = 0x00000044}, // (008) jeq #0x44 jt 27 jf 9 - {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000038}, // (009) ldh [56] - {.code = OP_JEQ, .jt = 16, .jf = 13, .k = 0x00000222}, // (010) jeq #0x222 jt 27 jf 24 - {.code = OP_JEQ, .jt = 0, .jf = 16, .k = 0x00000800}, // (011) jeq #0x800 jt 12 jf 28 - {.code = OP_LDB, .jt = 0, .jf = 0, .k = 0x00000017}, // (012) ldb [23] - {.code = OP_JEQ, .jt = 0, .jf = 14, .k = 0x00000011}, // (013) jeq #0x11 jt 14 jf 28 - {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000014}, // (014) ldh [20] - {.code = OP_JSET, .jt = 12, .jf = 0, .k = 0x00001fff}, // (015) jset #0x1fff jt 28 jf 16 - {.code = OP_LDXB, .jt = 0, .jf = 0, .k = 0x0000000e}, // (016) ldxb 4*([14]&0xf) - {.code = OP_LDHI, .jt = 0, .jf = 0, .k = 0x0000000e}, // (017) ldh [x + 14] - {.code = OP_JEQ, .jt = 8, .jf = 0, .k = 0x00000222}, // (018) jeq #0x222 jt 27 jf 19 - {.code = OP_JEQ, .jt = 7, .jf = 0, .k = 0x00000223}, // (019) jeq #0x223 jt 27 jf 20 - {.code = OP_JEQ, .jt = 6, .jf = 0, .k = 0x00000043}, // (020) jeq #0x43 jt 27 jf 21 - {.code = OP_JEQ, .jt = 5, .jf = 0, .k = 0x00000044}, // (021) jeq #0x44 jt 27 jf 22 - {.code = OP_LDHI, .jt = 0, .jf = 0, .k = 0x00000010}, // (022) ldh [x + 16] - {.code = OP_JEQ, .jt = 3, .jf = 0, .k = 0x00000222}, // (023) jeq #0x222 jt 27 jf 24 - {.code = OP_JEQ, .jt = 2, .jf = 0, .k = 0x00000223}, // (024) jeq #0x223 jt 27 jf 25 - {.code = OP_JEQ, .jt = 1, .jf = 0, .k = 0x00000043}, // (025) jeq #0x43 jt 27 jf 26 - {.code = OP_JEQ, .jt = 0, .jf = 1, .k = 0x00000044}, // (026) jeq #0x44 jt 27 jf 28 - {.code = OP_RET, .jt = 0, .jf = 0, .k = 0x00040000}, // (027) ret #262144 - {.code = OP_RET, .jt = 0, .jf = 0, .k = 0x00000000}, // (028) ret + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x0000000c}, // (000) ldh [12] + {.code = OP_JEQ, .jt = 0, .jf = 7, .k = 0x000086dd}, // (001) jeq #0x86dd jt 2 jf 9 + {.code = OP_LDB, .jt = 0, .jf = 0, .k = 0x00000014}, // (002) ldb [20] + {.code = OP_JEQ, .jt = 0, .jf = 18, .k = 0x00000011}, // (003) jeq #0x11 jt 4 jf 22 + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000036}, // (004) ldh [54] + {.code = OP_JEQ, .jt = 15, .jf = 0, .k = 0x00000043}, // (005) jeq #0x43 jt 21 jf 6 + {.code = OP_JEQ, .jt = 14, .jf = 0, .k = 0x00000044}, // (006) jeq #0x44 jt 21 jf 7 + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000038}, // (007) ldh [56] + {.code = OP_JEQ, .jt = 12, .jf = 11, .k = 0x00000043}, // (008) jeq #0x43 jt 21 jf 20 + {.code = OP_JEQ, .jt = 0, .jf = 12, .k = 0x00000800}, // (009) jeq #0x800 jt 10 jf 22 + {.code = OP_LDB, .jt = 0, .jf = 0, .k = 0x00000017}, // (010) ldb [23] + {.code = OP_JEQ, .jt = 0, .jf = 10, .k = 0x00000011}, // (011) jeq #0x11 jt 12 jf 22 + {.code = OP_LDHA, .jt = 0, .jf = 0, .k = 0x00000014}, // (012) ldh [20] + {.code = OP_JSET, .jt = 8, .jf = 0, .k = 0x00001fff}, // (013) jset #0x1fff jt 22 jf 14 + {.code = OP_LDXB, .jt = 0, .jf = 0, .k = 0x0000000e}, // (014) ldxb 4*([14]&0xf) + {.code = OP_LDHI, .jt = 0, .jf = 0, .k = 0x0000000e}, // (015) ldh [x + 14] + {.code = OP_JEQ, .jt = 4, .jf = 0, .k = 0x00000043}, // (016) jeq #0x43 jt 21 jf 17 + {.code = OP_JEQ, .jt = 3, .jf = 0, .k = 0x00000044}, // (017) jeq #0x44 jt 21 jf 18 + {.code = OP_LDHI, .jt = 0, .jf = 0, .k = 0x00000010}, // (018) ldh [x + 16] + {.code = OP_JEQ, .jt = 1, .jf = 0, .k = 0x00000043}, // (019) jeq #0x43 jt 21 jf 20 + {.code = OP_JEQ, .jt = 0, .jf = 1, .k = 0x00000044}, // (020) jeq #0x44 jt 21 jf 22 + {.code = OP_RET, .jt = 0, .jf = 0, .k = 0x00040000}, // (021) ret #262144 + {.code = OP_RET, .jt = 0, .jf = 0, .k = 0x00000000}, // (022) ret #0 }; /** Filter program socket struct */ @@ -121,29 +89,16 @@ static struct sock_fprog dhcp_sock_bfp = { */ static dhcp_device_context_t aggregate_dev = {0}; -static dhcp_device_context_t *mgmt_intf = NULL; - -/** Monitored DHCPv4 message type */ -static dhcpv4_message_type_t v4_monitored_msgs[] = { - DHCPv4_MESSAGE_TYPE_DISCOVER, - DHCPv4_MESSAGE_TYPE_OFFER, - DHCPv4_MESSAGE_TYPE_REQUEST, - DHCPv4_MESSAGE_TYPE_ACK -}; - -/** Monitored DHCPv6 message type */ -static dhcpv6_message_type_t v6_monitored_msgs[] = { - DHCPv6_MESSAGE_TYPE_SOLICIT, - DHCPv6_MESSAGE_TYPE_ADVERTISE, - DHCPv6_MESSAGE_TYPE_REQUEST, - DHCPv6_MESSAGE_TYPE_REPLY +/** Monitored DHCP message type */ +static dhcp_message_type_t monitored_msgs[] = { + DHCP_MESSAGE_TYPE_DISCOVER, + DHCP_MESSAGE_TYPE_OFFER, + DHCP_MESSAGE_TYPE_REQUEST, + DHCP_MESSAGE_TYPE_ACK }; -/** Number of monitored DHCPv4 message type */ -static uint8_t v4_monitored_msg_sz = sizeof(v4_monitored_msgs) / sizeof(*v4_monitored_msgs); - -/** Number of monitored DHCPv6 message type */ -static uint8_t v6_monitored_msg_sz = sizeof(v6_monitored_msgs) / sizeof(*v6_monitored_msgs); +/** Number of monitored DHCP message type */ +static uint8_t monitored_msg_sz = sizeof(monitored_msgs) / sizeof(*monitored_msgs); /** * @code handle_dhcp_option_53(context, dhcp_option, dir, iphdr, dhcphdr); @@ -168,37 +123,27 @@ static void handle_dhcp_option_53(dhcp_device_context_t *context, switch (dhcp_option[2]) { // DHCP messages send by client - case DHCPv4_MESSAGE_TYPE_DISCOVER: - case DHCPv4_MESSAGE_TYPE_REQUEST: - case DHCPv4_MESSAGE_TYPE_DECLINE: - case DHCPv4_MESSAGE_TYPE_RELEASE: - case DHCPv4_MESSAGE_TYPE_INFORM: + case DHCP_MESSAGE_TYPE_DISCOVER: + case DHCP_MESSAGE_TYPE_REQUEST: + case DHCP_MESSAGE_TYPE_DECLINE: + case DHCP_MESSAGE_TYPE_RELEASE: + case DHCP_MESSAGE_TYPE_INFORM: giaddr = ntohl(dhcphdr[DHCP_GIADDR_OFFSET] << 24 | dhcphdr[DHCP_GIADDR_OFFSET + 1] << 16 | dhcphdr[DHCP_GIADDR_OFFSET + 2] << 8 | dhcphdr[DHCP_GIADDR_OFFSET + 3]); if ((context->giaddr_ip == giaddr && context->is_uplink && dir == DHCP_TX) || (!context->is_uplink && dir == DHCP_RX && iphdr->ip_dst.s_addr == INADDR_BROADCAST)) { - context->counters.v4counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; - // If the packet recieved on the mgmt interface, we don't want to increment the aggregate device - if (context == mgmt_intf) - { - break; - } - aggregate_dev.counters.v4counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; + context->counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; + aggregate_dev.counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; } break; // DHCP messages send by server - case DHCPv4_MESSAGE_TYPE_OFFER: - case DHCPv4_MESSAGE_TYPE_ACK: - case DHCPv4_MESSAGE_TYPE_NAK: + case DHCP_MESSAGE_TYPE_OFFER: + case DHCP_MESSAGE_TYPE_ACK: + case DHCP_MESSAGE_TYPE_NAK: if ((context->giaddr_ip == iphdr->ip_dst.s_addr && context->is_uplink && dir == DHCP_RX) || (!context->is_uplink && dir == DHCP_TX)) { - context->counters.v4counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; - // If the packet recieved on the mgmt interface, we don't want to increment the aggregate device - if (context == mgmt_intf) - { - break; - } - aggregate_dev.counters.v4counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; + context->counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; + aggregate_dev.counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; } break; default: @@ -207,48 +152,6 @@ static void handle_dhcp_option_53(dhcp_device_context_t *context, } } -/** - * @code handle_dhcpv6_option(context, dhcp_option, dir); - * - * @brief handle the logic related to DHCPv6 option - * - * @param context Device (interface) context - * @param dhcp_option pointer to DHCP option buffer space - * @param dir packet direction - * - * @return none - */ -static void handle_dhcpv6_option(dhcp_device_context_t *context, - const u_char dhcp_option, - dhcp_packet_direction_t dir) -{ - switch (dhcp_option) - { - case DHCPv6_MESSAGE_TYPE_SOLICIT: - case DHCPv6_MESSAGE_TYPE_REQUEST: - case DHCPv6_MESSAGE_TYPE_CONFIRM: - case DHCPv6_MESSAGE_TYPE_RENEW: - case DHCPv6_MESSAGE_TYPE_REBIND: - case DHCPv6_MESSAGE_TYPE_RELEASE: - case DHCPv6_MESSAGE_TYPE_DECLINE: - case DHCPv6_MESSAGE_TYPE_ADVERTISE: - case DHCPv6_MESSAGE_TYPE_REPLY: - case DHCPv6_MESSAGE_TYPE_RECONFIGURE: - case DHCPv6_MESSAGE_TYPE_INFORMATION_REQUEST: - context->counters.v6counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option]++; - // If the packet recieved on the mgmt interface, we don't want to increment the aggregate device - if (context == mgmt_intf) - { - break; - } - aggregate_dev.counters.v6counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option]++; - break; - default: - syslog(LOG_WARNING, "handle_dhcpv6_option(%s): Unknown DHCPv6 option type %d", context->intf, dhcp_option); - break; - } -} - /** * @code read_callback(fd, event, arg); * @@ -268,29 +171,16 @@ static void read_callback(int fd, short event, void *arg) while ((event == EV_READ) && ((buffer_sz = recv(fd, context->buffer, context->snaplen, MSG_DONTWAIT)) > 0)) { struct ether_header *ethhdr = (struct ether_header*) context->buffer; - struct ip *iphdr; - struct ip6_hdr *ipv6hdr; - struct udphdr *udp; - uint8_t *dhcphdr; - int dhcp_option_offset; - - bool is_ipv4 = (ntohs(ethhdr->ether_type) == ETHERTYPE_IP); - if (is_ipv4) { - iphdr = (struct ip*) (context->buffer + IP_START_OFFSET); - udp = (struct udphdr*) (context->buffer + UDPv4_START_OFFSET); - dhcphdr = context->buffer + DHCPv4_START_OFFSET; - dhcp_option_offset = DHCPv4_START_OFFSET + DHCPv4_OPTIONS_HEADER_SIZE; - } else { - ipv6hdr = (struct ip6_hdr*) (context->buffer + IP_START_OFFSET); - udp = (struct udphdr*) (context->buffer + UDPv6_START_OFFSET); - dhcphdr = context->buffer + DHCPv6_START_OFFSET; - dhcp_option_offset = DHCPv6_START_OFFSET; - } - if (is_ipv4 && dhcpv4_enabled && (buffer_sz > UDPv4_START_OFFSET + sizeof(struct udphdr) + DHCPv4_OPTIONS_HEADER_SIZE) && - (ntohs(udp->len) > DHCPv4_OPTIONS_HEADER_SIZE)) { - int dhcp_sz = ntohs(udp->len) < buffer_sz - UDPv4_START_OFFSET - sizeof(struct udphdr) ? - ntohs(udp->len) : buffer_sz - UDPv4_START_OFFSET - sizeof(struct udphdr); - int dhcp_option_sz = dhcp_sz - DHCPv4_OPTIONS_HEADER_SIZE; + struct ip *iphdr = (struct ip*) (context->buffer + IP_START_OFFSET); + struct udphdr *udp = (struct udphdr*) (context->buffer + UDP_START_OFFSET); + uint8_t *dhcphdr = context->buffer + DHCP_START_OFFSET; + int dhcp_option_offset = DHCP_START_OFFSET + DHCP_OPTIONS_HEADER_SIZE; + + if ((buffer_sz > UDP_START_OFFSET + sizeof(struct udphdr) + DHCP_OPTIONS_HEADER_SIZE) && + (ntohs(udp->len) > DHCP_OPTIONS_HEADER_SIZE)) { + int dhcp_sz = ntohs(udp->len) < buffer_sz - UDP_START_OFFSET - sizeof(struct udphdr) ? + ntohs(udp->len) : buffer_sz - UDP_START_OFFSET - sizeof(struct udphdr); + int dhcp_option_sz = dhcp_sz - DHCP_OPTIONS_HEADER_SIZE; const u_char *dhcp_option = context->buffer + dhcp_option_offset; dhcp_packet_direction_t dir = (ethhdr->ether_shost[0] == context->mac[0] && ethhdr->ether_shost[1] == context->mac[1] && @@ -324,37 +214,6 @@ static void read_callback(int fd, short event, void *arg) offset += dhcp_option[offset + 1] + 2; } } - } - else if (!is_ipv4 && dhcpv6_enabled && (buffer_sz > UDPv6_START_OFFSET + sizeof(struct udphdr) + DHCPv6_TYPE_LENGTH)) { - const u_char* dhcp_header = context->buffer + dhcp_option_offset; - dhcp_packet_direction_t dir = (ethhdr->ether_shost[0] == context->mac[0] && - ethhdr->ether_shost[1] == context->mac[1] && - ethhdr->ether_shost[2] == context->mac[2] && - ethhdr->ether_shost[3] == context->mac[3] && - ethhdr->ether_shost[4] == context->mac[4] && - ethhdr->ether_shost[5] == context->mac[5]) ? - DHCP_TX : DHCP_RX; - int offset = 0; - uint16_t option = 0; - uint16_t current_option_len = 0; - // Get to inner DHCP header from encapsulated RELAY_FORWARD or RELAY_REPLY header - while (dhcp_header[offset] == DHCPv6_MESSAGE_TYPE_RELAY_FORWARD || dhcp_header[offset] == DHCPv6_MESSAGE_TYPE_RELAY_REPLY) - { - // Get to DHCPv6_OPTION_RELAY_MSG from all options - offset += DHCPv6_RELAY_MSG_OPTIONS_OFFSET; - option = htons(*((uint16_t*)(&(dhcp_header[offset])))); - - while (option != DHCPv6_OPTION_RELAY_MSG) - { - // Add to offset the option length and get the next option ID - current_option_len = htons(*((uint16_t*)(&(dhcp_header[offset + DHCPv6_OPTION_LENGTH])))); - offset += DHCPv6_OPTION_LENGTH + DHCPv6_OPTION_LEN_LENGTH + current_option_len; - option = htons(*((uint16_t*)(&(dhcp_header[offset])))); - } - // Set the offset to DHCP-relay-message data - offset += DHCPv6_OPTION_LENGTH + DHCPv6_OPTION_LEN_LENGTH; - } - handle_dhcpv6_option(context, dhcp_header[offset], dir); } else { syslog(LOG_WARNING, "read_callback(%s): read length (%ld) is too small to capture DHCP options", context->intf, buffer_sz); @@ -363,73 +222,29 @@ static void read_callback(int fd, short event, void *arg) } /** - * @code dhcp_device_is_dhcp_inactive(v4counters, v6counters, type); + * @code dhcp_device_is_dhcp_inactive(counters); * * @brief Check if there were no DHCP activity * - * @param v4counters current/snapshot v4counter - * - * @param v6counters current/snapshot v6counter - * - * @param type DHCP type + * @param counters current/snapshot counter * * @return true if there were no DHCP activity, false otherwise */ -static bool dhcp_device_is_dhcp_inactive(uint64_t v4counters[][DHCP_DIR_COUNT][DHCPv4_MESSAGE_TYPE_COUNT], - uint64_t v6counters[][DHCP_DIR_COUNT][DHCPv6_MESSAGE_TYPE_COUNT], - dhcp_type_t type) +static bool dhcp_device_is_dhcp_inactive(uint64_t counters[][DHCP_DIR_COUNT][DHCP_MESSAGE_TYPE_COUNT]) { - bool rv = true; - uint64_t *rx_counters; - uint64_t *rx_counter_snapshot; - - switch (type) - { - case DHCPv4_TYPE: - rx_counters = v4counters[DHCP_COUNTERS_CURRENT][DHCP_RX]; - rx_counter_snapshot = v4counters[DHCP_COUNTERS_SNAPSHOT][DHCP_RX]; - for (uint8_t i = 0; (i < v4_monitored_msg_sz) && rv; i++) { - rv = rx_counters[v4_monitored_msgs[i]] == rx_counter_snapshot[v4_monitored_msgs[i]]; - } - break; - - case DHCPv6_TYPE: - rx_counters = v6counters[DHCP_COUNTERS_CURRENT][DHCP_RX]; - rx_counter_snapshot = v6counters[DHCP_COUNTERS_SNAPSHOT][DHCP_RX]; - for (uint8_t i = 0; (i < v6_monitored_msg_sz) && rv; i++) { - rv = rx_counters[v6_monitored_msgs[i]] == rx_counter_snapshot[v6_monitored_msgs[i]]; - } - break; + uint64_t *rx_counters = counters[DHCP_COUNTERS_CURRENT][DHCP_RX]; + uint64_t *rx_counter_snapshot = counters[DHCP_COUNTERS_SNAPSHOT][DHCP_RX]; - default: - syslog(LOG_ERR, "Unknown DHCP type %d\n", type); - break; + bool rv = true; + for (uint8_t i = 0; (i < monitored_msg_sz) && rv; i++) { + rv = rx_counters[monitored_msgs[i]] == rx_counter_snapshot[monitored_msgs[i]]; } return rv; } /** - * @code dhcp_device_is_dhcpv4_msg_unhealthy(type, counters); - * - * @brief Check if DHCP relay is functioning properly for message of type 'type'. - * For every rx of message 'type', there should be increment of the same message type. - * - * @param type DHCP message type - * @param counters current/snapshot counter - * - * @return true if DHCP message 'type' is transmitted,false otherwise - */ -static bool dhcp_device_is_dhcpv4_msg_unhealthy(dhcpv4_message_type_t type, - uint64_t v4counters[][DHCP_DIR_COUNT][DHCPv4_MESSAGE_TYPE_COUNT]) -{ - // check if DHCP message 'type' is being relayed - return ((v4counters[DHCP_COUNTERS_CURRENT][DHCP_RX][type] > v4counters[DHCP_COUNTERS_SNAPSHOT][DHCP_RX][type]) && - (v4counters[DHCP_COUNTERS_CURRENT][DHCP_TX][type] <= v4counters[DHCP_COUNTERS_SNAPSHOT][DHCP_TX][type]) ); -} - -/** - * @code dhcp_device_is_dhcpv6_msg_unhealthy(type, counters); + * @code dhcp_device_is_dhcp_msg_unhealthy(type, counters); * * @brief Check if DHCP relay is functioning properly for message of type 'type'. * For every rx of message 'type', there should be increment of the same message type. @@ -439,57 +254,34 @@ static bool dhcp_device_is_dhcpv4_msg_unhealthy(dhcpv4_message_type_t type, * * @return true if DHCP message 'type' is transmitted,false otherwise */ -static bool dhcp_device_is_dhcpv6_msg_unhealthy(dhcpv6_message_type_t type, - uint64_t v6counters[][DHCP_DIR_COUNT][DHCPv6_MESSAGE_TYPE_COUNT]) +static bool dhcp_device_is_dhcp_msg_unhealthy(dhcp_message_type_t type, + uint64_t counters[][DHCP_DIR_COUNT][DHCP_MESSAGE_TYPE_COUNT]) { // check if DHCP message 'type' is being relayed - return ((v6counters[DHCP_COUNTERS_CURRENT][DHCP_RX][type] > v6counters[DHCP_COUNTERS_SNAPSHOT][DHCP_RX][type]) && - (v6counters[DHCP_COUNTERS_CURRENT][DHCP_TX][type] <= v6counters[DHCP_COUNTERS_SNAPSHOT][DHCP_TX][type]) ); + return ((counters[DHCP_COUNTERS_CURRENT][DHCP_RX][type] > counters[DHCP_COUNTERS_SNAPSHOT][DHCP_RX][type]) && + (counters[DHCP_COUNTERS_CURRENT][DHCP_TX][type] <= counters[DHCP_COUNTERS_SNAPSHOT][DHCP_TX][type]) ); } /** - * @code dhcp_device_check_positive_health(v4counters, v6counters, type); + * @code dhcp_device_check_positive_health(counters, counters_snapshot); * - * @brief Check if DHCPv4/6 relay is functioning properly for monitored messages. - * DHCPv4 (Discover, Offer, Request, ACK.) and DHCPv6 (Solicit, Advertise, Request, Reply). + * @brief Check if DHCP relay is functioning properly for monitored messages (Discover, Offer, Request, ACK.) * For every rx of monitored messages, there should be increment of the same message type. * - * @param v4counters current/snapshot counter - * - * @param v6counters current/snapshot counter - * - * @param type DHCP type + * @param counters current/snapshot counter * * @return DHCP_MON_STATUS_HEALTHY, DHCP_MON_STATUS_UNHEALTHY, or DHCP_MON_STATUS_INDETERMINATE */ -static dhcp_mon_status_t dhcp_device_check_positive_health(uint64_t v4counters[][DHCP_DIR_COUNT][DHCPv4_MESSAGE_TYPE_COUNT], - uint64_t v6counters[][DHCP_DIR_COUNT][DHCPv6_MESSAGE_TYPE_COUNT], - dhcp_type_t type) +static dhcp_mon_status_t dhcp_device_check_positive_health(uint64_t counters[][DHCP_DIR_COUNT][DHCP_MESSAGE_TYPE_COUNT]) { dhcp_mon_status_t rv = DHCP_MON_STATUS_HEALTHY; bool is_dhcp_unhealthy = false; - - switch (type) - { - case DHCPv4_TYPE: - for (uint8_t i = 0; (i < v4_monitored_msg_sz) && !is_dhcp_unhealthy; i++) { - is_dhcp_unhealthy = dhcp_device_is_dhcpv4_msg_unhealthy(v4_monitored_msgs[i], v4counters); - } - break; - - case DHCPv6_TYPE: - for (uint8_t i = 0; (i < v6_monitored_msg_sz) && !is_dhcp_unhealthy; i++) { - is_dhcp_unhealthy = dhcp_device_is_dhcpv6_msg_unhealthy(v6_monitored_msgs[i], v6counters); - } - break; - - default: - syslog(LOG_ERR, "Unknown DHCP type %d\n", type); - break; + for (uint8_t i = 0; (i < monitored_msg_sz) && !is_dhcp_unhealthy; i++) { + is_dhcp_unhealthy = dhcp_device_is_dhcp_msg_unhealthy(monitored_msgs[i], counters); } - // if we have rx DORA/SARR then we should have corresponding tx DORA/SARR (DORA/SARR being relayed) + // if we have rx DORA then we should have corresponding tx DORA (DORA being relayed) if (is_dhcp_unhealthy) { rv = DHCP_MON_STATUS_UNHEALTHY; } @@ -498,47 +290,27 @@ static dhcp_mon_status_t dhcp_device_check_positive_health(uint64_t v4counters[] } /** - * @code dhcp_device_check_negative_health(v4counters, v6counters, type); + * @code dhcp_device_check_negative_health(counters); * * @brief Check that DHCP relayed messages are not being transmitted out of this interface/dev * using its counters. The interface is negatively healthy if there are not DHCP message * travelling through it. * - * @param v4counters current/snapshot counter - * @param v6counters current/snapshot counter - * @param type DHCP type + * @param counters recent interface counter + * @param counters_snapshot snapshot counters * * @return DHCP_MON_STATUS_HEALTHY, DHCP_MON_STATUS_UNHEALTHY, or DHCP_MON_STATUS_INDETERMINATE */ -static dhcp_mon_status_t dhcp_device_check_negative_health(uint64_t v4counters[][DHCP_DIR_COUNT][DHCPv4_MESSAGE_TYPE_COUNT], - uint64_t v6counters[][DHCP_DIR_COUNT][DHCPv6_MESSAGE_TYPE_COUNT], - dhcp_type_t type) +static dhcp_mon_status_t dhcp_device_check_negative_health(uint64_t counters[][DHCP_DIR_COUNT][DHCP_MESSAGE_TYPE_COUNT]) { dhcp_mon_status_t rv = DHCP_MON_STATUS_HEALTHY; - bool is_dhcp_unhealthy = false; - uint64_t *tx_counters; - uint64_t *tx_counter_snapshot; + uint64_t *tx_counters = counters[DHCP_COUNTERS_CURRENT][DHCP_TX]; + uint64_t *tx_counter_snapshot = counters[DHCP_COUNTERS_SNAPSHOT][DHCP_TX]; - switch (type) - { - case DHCPv4_TYPE: - tx_counters = v4counters[DHCP_COUNTERS_CURRENT][DHCP_TX]; - tx_counter_snapshot = v4counters[DHCP_COUNTERS_SNAPSHOT][DHCP_TX]; - for (uint8_t i = 0; (i < v4_monitored_msg_sz) && !is_dhcp_unhealthy; i++) { - is_dhcp_unhealthy = tx_counters[v4_monitored_msgs[i]] > tx_counter_snapshot[v4_monitored_msgs[i]]; - } - break; - case DHCPv6_TYPE: - tx_counters = v6counters[DHCP_COUNTERS_CURRENT][DHCP_TX]; - tx_counter_snapshot = v6counters[DHCP_COUNTERS_SNAPSHOT][DHCP_TX]; - for (uint8_t i = 0; (i < v6_monitored_msg_sz) && !is_dhcp_unhealthy; i++) { - is_dhcp_unhealthy = tx_counters[v6_monitored_msgs[i]] > tx_counter_snapshot[v6_monitored_msgs[i]]; - } - break; - default: - syslog(LOG_ERR, "Unknown DHCP type %d\n", type); - break; + bool is_dhcp_unhealthy = false; + for (uint8_t i = 0; (i < monitored_msg_sz) && !is_dhcp_unhealthy; i++) { + is_dhcp_unhealthy = tx_counters[monitored_msgs[i]] > tx_counter_snapshot[monitored_msgs[i]]; } // for negative validation, return unhealthy if DHCP packet are being @@ -551,7 +323,7 @@ static dhcp_mon_status_t dhcp_device_check_negative_health(uint64_t v4counters[] } /** - * @code dhcp_device_check_health(check_type, v4counters, v6counters, type); + * @code dhcp_device_check_health(check_type, counters, counters_snapshot); * * @brief Check that DHCP relay is functioning properly given a check type. Positive check * indicates for every rx of DHCP message of type 'type', there would increment of @@ -560,80 +332,59 @@ static dhcp_mon_status_t dhcp_device_check_negative_health(uint64_t v4counters[] * considered unhealthy. * * @param check_type type of health check - * @param v4counters current/snapshot counters - * @param v6counters current/snapshot counters - * @param type DHCP type + * @param counters current/snapshot counter * * @return DHCP_MON_STATUS_HEALTHY, DHCP_MON_STATUS_UNHEALTHY, or DHCP_MON_STATUS_INDETERMINATE */ static dhcp_mon_status_t dhcp_device_check_health(dhcp_mon_check_t check_type, - uint64_t v4counters[][DHCP_DIR_COUNT][DHCPv4_MESSAGE_TYPE_COUNT], - uint64_t v6counters[][DHCP_DIR_COUNT][DHCPv6_MESSAGE_TYPE_COUNT], - dhcp_type_t type) + uint64_t counters[][DHCP_DIR_COUNT][DHCP_MESSAGE_TYPE_COUNT]) { dhcp_mon_status_t rv = DHCP_MON_STATUS_HEALTHY; - if (dhcp_device_is_dhcp_inactive(v4counters, v6counters, type)) { + if (dhcp_device_is_dhcp_inactive(aggregate_dev.counters)) { rv = DHCP_MON_STATUS_INDETERMINATE; } else if (check_type == DHCP_MON_CHECK_POSITIVE) { - rv = dhcp_device_check_positive_health(v4counters, v6counters, type); + rv = dhcp_device_check_positive_health(counters); } else if (check_type == DHCP_MON_CHECK_NEGATIVE) { - rv = dhcp_device_check_negative_health(v4counters, v6counters, type); + rv = dhcp_device_check_negative_health(counters); } return rv; } /** - * @code dhcp_print_counters(vlan_intf, type, v4counters, v6counters); + * @code dhcp_print_counters(vlan_intf, type, counters); * * @brief prints DHCP counters to sylsog. * - * @param vlan_intf vlan interface name - * @param type counter type - * @param v4counters interface counter - * @param v6counters interface counter + * @param vlan_intf vlan interface name + * @param type counter type + * @param counters interface counter * * @return none */ static void dhcp_print_counters(const char *vlan_intf, dhcp_counters_type_t type, - uint64_t v4counters[][DHCPv4_MESSAGE_TYPE_COUNT], - uint64_t v6counters[][DHCPv6_MESSAGE_TYPE_COUNT]) + uint64_t counters[][DHCP_MESSAGE_TYPE_COUNT]) { - static const char *v4_counter_desc[DHCP_COUNTERS_COUNT] = { - [DHCP_COUNTERS_CURRENT] = " Current", - [DHCP_COUNTERS_SNAPSHOT] = "Snapshot" - }; - static const char *v6_counter_desc[DHCP_COUNTERS_COUNT] = { + static const char *counter_desc[DHCP_COUNTERS_COUNT] = { [DHCP_COUNTERS_CURRENT] = " Current", [DHCP_COUNTERS_SNAPSHOT] = "Snapshot" }; syslog( LOG_NOTICE, - "DHCPv4 [%*s-%*s rx/tx] Discover: %*lu/%*lu, Offer: %*lu/%*lu, Request: %*lu/%*lu, ACK: %*lu/%*lu\n\ - DHCPv6 [%*s-%*s rx/tx] Solicit: %*lu/%*lu, Advertise: %*lu/%*lu, Request: %*lu/%*lu, Reply: %*lu/%*lu\n", + "[%*s-%*s rx/tx] Discover: %*lu/%*lu, Offer: %*lu/%*lu, Request: %*lu/%*lu, ACK: %*lu/%*lu\n", IF_NAMESIZE, vlan_intf, - (int) strlen(v4_counter_desc[type]), v4_counter_desc[type], - DHCP_COUNTER_WIDTH, v4counters[DHCP_RX][DHCPv4_MESSAGE_TYPE_DISCOVER], - DHCP_COUNTER_WIDTH, v4counters[DHCP_TX][DHCPv4_MESSAGE_TYPE_DISCOVER], - DHCP_COUNTER_WIDTH, v4counters[DHCP_RX][DHCPv4_MESSAGE_TYPE_OFFER], - DHCP_COUNTER_WIDTH, v4counters[DHCP_TX][DHCPv4_MESSAGE_TYPE_OFFER], - DHCP_COUNTER_WIDTH, v4counters[DHCP_RX][DHCPv4_MESSAGE_TYPE_REQUEST], - DHCP_COUNTER_WIDTH, v4counters[DHCP_TX][DHCPv4_MESSAGE_TYPE_REQUEST], - DHCP_COUNTER_WIDTH, v4counters[DHCP_RX][DHCPv4_MESSAGE_TYPE_ACK], - DHCP_COUNTER_WIDTH, v4counters[DHCP_TX][DHCPv4_MESSAGE_TYPE_ACK], - IF_NAMESIZE, vlan_intf, - (int) strlen(v6_counter_desc[type]), v6_counter_desc[type], - DHCP_COUNTER_WIDTH, v6counters[DHCP_RX][DHCPv6_MESSAGE_TYPE_SOLICIT], - DHCP_COUNTER_WIDTH, v6counters[DHCP_TX][DHCPv6_MESSAGE_TYPE_SOLICIT], - DHCP_COUNTER_WIDTH, v6counters[DHCP_RX][DHCPv6_MESSAGE_TYPE_ADVERTISE], - DHCP_COUNTER_WIDTH, v6counters[DHCP_TX][DHCPv6_MESSAGE_TYPE_ADVERTISE], - DHCP_COUNTER_WIDTH, v6counters[DHCP_RX][DHCPv6_MESSAGE_TYPE_REQUEST], - DHCP_COUNTER_WIDTH, v6counters[DHCP_TX][DHCPv6_MESSAGE_TYPE_REQUEST], - DHCP_COUNTER_WIDTH, v6counters[DHCP_RX][DHCPv6_MESSAGE_TYPE_REPLY], - DHCP_COUNTER_WIDTH, v6counters[DHCP_TX][DHCPv6_MESSAGE_TYPE_REPLY] + (int) strlen(counter_desc[type]), counter_desc[type], + DHCP_COUNTER_WIDTH, counters[DHCP_RX][DHCP_MESSAGE_TYPE_DISCOVER], + DHCP_COUNTER_WIDTH, counters[DHCP_TX][DHCP_MESSAGE_TYPE_DISCOVER], + DHCP_COUNTER_WIDTH, counters[DHCP_RX][DHCP_MESSAGE_TYPE_OFFER], + DHCP_COUNTER_WIDTH, counters[DHCP_TX][DHCP_MESSAGE_TYPE_OFFER], + DHCP_COUNTER_WIDTH, counters[DHCP_RX][DHCP_MESSAGE_TYPE_REQUEST], + DHCP_COUNTER_WIDTH, counters[DHCP_TX][DHCP_MESSAGE_TYPE_REQUEST], + DHCP_COUNTER_WIDTH, counters[DHCP_RX][DHCP_MESSAGE_TYPE_ACK], + DHCP_COUNTER_WIDTH, counters[DHCP_TX][DHCP_MESSAGE_TYPE_ACK] ); } @@ -703,12 +454,12 @@ int initialize_intf_mac_and_ip_addr(dhcp_device_context_t *context) strncpy(ifr.ifr_name, context->intf, sizeof(ifr.ifr_name) - 1); ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; - // Get v4 network address + // Get network address if (ioctl(fd, SIOCGIFADDR, &ifr) == -1) { syslog(LOG_ALERT, "ioctl: %s", explain_ioctl(fd, SIOCGIFADDR, &ifr)); break; } - context->ipv4 = ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr; + context->ip = ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr; // Get mac address if (ioctl(fd, SIOCGIFHWADDR, &ifr) == -1) { @@ -719,30 +470,6 @@ int initialize_intf_mac_and_ip_addr(dhcp_device_context_t *context) close(fd); - // Get v6 network address - memset(&context->ipv6, 0, sizeof(context->ipv6)); - struct ifaddrs *ifa, *ifa_tmp; - - if (getifaddrs(&ifa) == -1) { - syslog(LOG_ALERT, "getifaddrs failed"); - break; - } - - ifa_tmp = ifa; - while (ifa_tmp) { - // Check if current interface has a valid IPv6 address (not link local address) - if ((strncmp(ifa_tmp->ifa_name, context->intf, sizeof(context->intf)) == 0) && - (ifa_tmp->ifa_addr) && - (ifa_tmp->ifa_addr->sa_family == AF_INET6) && - (((struct sockaddr_in6*)(ifa_tmp->ifa_addr))->sin6_addr.__in6_u.__u6_addr16[0] != IPV6_LINK_LOCAL_PREFIX)) { - - struct sockaddr_in6 *in6 = (struct sockaddr_in6*) ifa_tmp->ifa_addr; - memcpy(&context->ipv6, &in6->sin6_addr, sizeof(context->ipv6)); - } - ifa_tmp = ifa_tmp->ifa_next; - } - freeifaddrs(ifa); - rv = 0; } while (0); @@ -750,41 +477,20 @@ int initialize_intf_mac_and_ip_addr(dhcp_device_context_t *context) } /** - * @code dhcp_device_get_ipv4(context); + * @code dhcp_device_get_ip(context); * * @brief Accessor method * * @param context pointer to device (interface) context * - * @return interface IPv4 + * @return interface IP */ -int dhcp_device_get_ipv4(dhcp_device_context_t *context, in_addr_t *ip) +int dhcp_device_get_ip(dhcp_device_context_t *context, in_addr_t *ip) { int rv = -1; if (context != NULL && ip != NULL) { - *ip = context->ipv4; - rv = 0; - } - - return rv; -} - -/** - * @code dhcp_device_get_ipv6(context); - * - * @brief Accessor method - * - * @param context pointer to device (interface) context - * - * @return interface IPv6 - */ -int dhcp_device_get_ipv6(dhcp_device_context_t *context, struct in6_addr *ip) -{ - int rv = -1; - - if (context != NULL && ip != NULL) { - *ip = context->ipv6; + *ip = context->ip; rv = 0; } @@ -822,8 +528,7 @@ int dhcp_device_init(dhcp_device_context_t **context, const char *intf, uint8_t dev_context->is_uplink = is_uplink; - memset(dev_context->counters.v4counters, 0, sizeof(dev_context->counters.v4counters)); - memset(dev_context->counters.v6counters, 0, sizeof(dev_context->counters.v6counters)); + memset(dev_context->counters, 0, sizeof(dev_context->counters)); *context = dev_context; rv = 0; @@ -838,15 +543,14 @@ int dhcp_device_init(dhcp_device_context_t **context, const char *intf, uint8_t } /** - * @code dhcp_device_start_capture(context, snaplen, base, giaddr_ip, v6_vlan_ip); + * @code dhcp_device_start_capture(context, snaplen, base, giaddr_ip); * * @brief starts packet capture on this interface */ int dhcp_device_start_capture(dhcp_device_context_t *context, size_t snaplen, struct event_base *base, - in_addr_t giaddr_ip, - struct in6_addr v6_vlan_ip) + in_addr_t giaddr_ip) { int rv = -1; @@ -856,20 +560,12 @@ int dhcp_device_start_capture(dhcp_device_context_t *context, break; } - // snaplen check for DHCPv4 size - if (dhcpv4_enabled && snaplen < UDPv4_START_OFFSET + sizeof(struct udphdr) + DHCPv4_OPTIONS_HEADER_SIZE) { - syslog(LOG_ALERT, "dhcp_device_start_capture(%s): snap length is too low to capture DHCPv4 options", context->intf); - break; - } - - // snaplen check for DHCPv6 size - DHCPv6 message type is the first byte of the udp payload - if (dhcpv6_enabled && snaplen < DHCPv6_START_OFFSET + 1) { - syslog(LOG_ALERT, "dhcp_device_start_capture(%s): snap length is too low to capture DHCPv6 option", context->intf); + if (snaplen < UDP_START_OFFSET + sizeof(struct udphdr) + DHCP_OPTIONS_HEADER_SIZE) { + syslog(LOG_ALERT, "dhcp_device_start_capture(%s): snap length is too low to capture DHCP options", context->intf); break; } context->giaddr_ip = giaddr_ip; - context->v6_vlan_ip = v6_vlan_ip; context->buffer = (uint8_t *) malloc(snaplen); if (context->buffer == NULL) { @@ -907,17 +603,17 @@ void dhcp_device_shutdown(dhcp_device_context_t *context) } /** - * @code dhcp_device_get_status(check_type, context, type); + * @code dhcp_device_get_status(check_type, context); * * @brief collects DHCP relay status info for a given interface. If context is null, it will report aggregate * status */ -dhcp_mon_status_t dhcp_device_get_status(dhcp_mon_check_t check_type, dhcp_device_context_t *context, dhcp_type_t type) +dhcp_mon_status_t dhcp_device_get_status(dhcp_mon_check_t check_type, dhcp_device_context_t *context) { dhcp_mon_status_t rv = DHCP_MON_STATUS_HEALTHY; if (context != NULL) { - rv = dhcp_device_check_health(check_type, context->counters.v4counters, context->counters.v6counters, type); + rv = dhcp_device_check_health(check_type, context->counters); } return rv; @@ -931,17 +627,9 @@ dhcp_mon_status_t dhcp_device_get_status(dhcp_mon_check_t check_type, dhcp_devic void dhcp_device_update_snapshot(dhcp_device_context_t *context) { if (context != NULL) { - if (dhcpv4_enabled) { - memcpy(context->counters.v4counters[DHCP_COUNTERS_SNAPSHOT], - context->counters.v4counters[DHCP_COUNTERS_CURRENT], - sizeof(context->counters.v4counters[DHCP_COUNTERS_SNAPSHOT])); - } - - if (dhcpv6_enabled) { - memcpy(context->counters.v6counters[DHCP_COUNTERS_SNAPSHOT], - context->counters.v6counters[DHCP_COUNTERS_CURRENT], - sizeof(context->counters.v6counters[DHCP_COUNTERS_SNAPSHOT])); - } + memcpy(context->counters[DHCP_COUNTERS_SNAPSHOT], + context->counters[DHCP_COUNTERS_CURRENT], + sizeof(context->counters[DHCP_COUNTERS_SNAPSHOT])); } } @@ -953,27 +641,6 @@ void dhcp_device_update_snapshot(dhcp_device_context_t *context) void dhcp_device_print_status(dhcp_device_context_t *context, dhcp_counters_type_t type) { if (context != NULL) { - dhcp_print_counters(context->intf, type, context->counters.v4counters[type], context->counters.v6counters[type]); + dhcp_print_counters(context->intf, type, context->counters[type]); } } - -/** - * @code dhcp_device_active_types(dhcpv4, dhcpv6); - * - * @brief update local variables with active protocols - */ -void dhcp_device_active_types(bool dhcpv4, bool dhcpv6) -{ - dhcpv4_enabled = dhcpv4; - dhcpv6_enabled = dhcpv6; -} - -/** - * @code dhcp_device_init_mgmt_intf(mgmt_intf_context); - * - * @brief assign context address of mgmt interface - */ -void dhcp_device_init_mgmt_intf(dhcp_device_context_t *mgmt_intf_context) -{ - mgmt_intf = mgmt_intf_context; -} diff --git a/src/dhcpmon/src/dhcp_device.h b/src/dhcpmon/src/dhcp_device.h index 433eb0907626..aa686f4e2718 100644 --- a/src/dhcpmon/src/dhcp_device.h +++ b/src/dhcpmon/src/dhcp_device.h @@ -18,43 +18,21 @@ /** - * DHCPv4 message types + * DHCP message types **/ typedef enum { - DHCPv4_MESSAGE_TYPE_DISCOVER = 1, - DHCPv4_MESSAGE_TYPE_OFFER = 2, - DHCPv4_MESSAGE_TYPE_REQUEST = 3, - DHCPv4_MESSAGE_TYPE_DECLINE = 4, - DHCPv4_MESSAGE_TYPE_ACK = 5, - DHCPv4_MESSAGE_TYPE_NAK = 6, - DHCPv4_MESSAGE_TYPE_RELEASE = 7, - DHCPv4_MESSAGE_TYPE_INFORM = 8, - - DHCPv4_MESSAGE_TYPE_COUNT -} dhcpv4_message_type_t; - -/** - * DHCPv6 message types - **/ -typedef enum -{ - DHCPv6_MESSAGE_TYPE_SOLICIT = 1, - DHCPv6_MESSAGE_TYPE_ADVERTISE = 2, - DHCPv6_MESSAGE_TYPE_REQUEST = 3, - DHCPv6_MESSAGE_TYPE_CONFIRM = 4, - DHCPv6_MESSAGE_TYPE_RENEW = 5, - DHCPv6_MESSAGE_TYPE_REBIND = 6, - DHCPv6_MESSAGE_TYPE_REPLY = 7, - DHCPv6_MESSAGE_TYPE_RELEASE = 8, - DHCPv6_MESSAGE_TYPE_DECLINE = 9, - DHCPv6_MESSAGE_TYPE_RECONFIGURE = 10, - DHCPv6_MESSAGE_TYPE_INFORMATION_REQUEST = 11, - DHCPv6_MESSAGE_TYPE_RELAY_FORWARD = 12, - DHCPv6_MESSAGE_TYPE_RELAY_REPLY = 13, - - DHCPv6_MESSAGE_TYPE_COUNT -} dhcpv6_message_type_t; + DHCP_MESSAGE_TYPE_DISCOVER = 1, + DHCP_MESSAGE_TYPE_OFFER = 2, + DHCP_MESSAGE_TYPE_REQUEST = 3, + DHCP_MESSAGE_TYPE_DECLINE = 4, + DHCP_MESSAGE_TYPE_ACK = 5, + DHCP_MESSAGE_TYPE_NAK = 6, + DHCP_MESSAGE_TYPE_RELEASE = 7, + DHCP_MESSAGE_TYPE_INFORM = 8, + + DHCP_MESSAGE_TYPE_COUNT +} dhcp_message_type_t; /** packet direction */ typedef enum @@ -82,13 +60,6 @@ typedef enum DHCP_MON_STATUS_INDETERMINATE, /** DHCP relay health could not be determined */ } dhcp_mon_status_t; -/** dhcp type */ -typedef enum -{ - DHCPv4_TYPE, - DHCPv6_TYPE, -} dhcp_type_t; - /** dhcp check type */ typedef enum { @@ -96,28 +67,19 @@ typedef enum DHCP_MON_CHECK_POSITIVE, /** Validate that received DORA packets are relayed */ } dhcp_mon_check_t; -typedef struct -{ - uint64_t v4counters[DHCP_COUNTERS_COUNT][DHCP_DIR_COUNT][DHCPv4_MESSAGE_TYPE_COUNT]; - /** current/snapshot counters of DHCPv4 packets */ - uint64_t v6counters[DHCP_COUNTERS_COUNT][DHCP_DIR_COUNT][DHCPv6_MESSAGE_TYPE_COUNT]; - /** current/snapshot counters of DHCPv6 packets */ -} counters_t; - /** DHCP device (interface) context */ typedef struct { int sock; /** Raw socket associated with this device/interface */ - in_addr_t ipv4; /** ipv4 network address of this device (interface) */ - struct in6_addr ipv6; /** ipv6 network address of this device (interface) */ + in_addr_t ip; /** network address of this device (interface) */ uint8_t mac[ETHER_ADDR_LEN]; /** hardware address of this device (interface) */ - in_addr_t giaddr_ip; /** Gateway IPv4 address */ - struct in6_addr v6_vlan_ip; /** Vlan IPv6 address */ + in_addr_t giaddr_ip; /** Gateway IP address */ uint8_t is_uplink; /** north interface? */ char intf[IF_NAMESIZE]; /** device (interface) name */ uint8_t *buffer; /** buffer used to read socket data */ size_t snaplen; /** snap length or buffer size */ - counters_t counters; /** counters for DHCPv4/6 packets */ + uint64_t counters[DHCP_COUNTERS_COUNT][DHCP_DIR_COUNT][DHCP_MESSAGE_TYPE_COUNT]; + /** current/snapshot counters of DHCP packets */ } dhcp_device_context_t; /** @@ -132,28 +94,16 @@ typedef struct int initialize_intf_mac_and_ip_addr(dhcp_device_context_t *context); /** - * @code dhcp_device_get_ipv4(context, ip); + * @code dhcp_device_get_ip(context, ip); * * @brief Accessor method * * @param context pointer to device (interface) context - * @param ip(out) pointer to device IPv4 + * @param ip(out) pointer to device IP * * @return 0 on success, otherwise for failure */ -int dhcp_device_get_ipv4(dhcp_device_context_t *context, in_addr_t *ip); - -/** - * @code dhcp_device_get_ipv6(context, ip); - * - * @brief Accessor method - * - * @param context pointer to device (interface) context - * @param ip(out) pointer to device IPv6 - * - * @return 0 on success, otherwise for failure - */ -int dhcp_device_get_ipv6(dhcp_device_context_t *context, struct in6_addr *ip); +int dhcp_device_get_ip(dhcp_device_context_t *context, in_addr_t *ip); /** * @code dhcp_device_get_aggregate_context(); @@ -180,7 +130,7 @@ int dhcp_device_init(dhcp_device_context_t **context, uint8_t is_uplink); /** - * @code dhcp_device_start_capture(context, snaplen, base, giaddr_ip, v6_vlan_ip); + * @code dhcp_device_start_capture(context, snaplen, base, giaddr_ip); * * @brief starts packet capture on this interface * @@ -188,15 +138,13 @@ int dhcp_device_init(dhcp_device_context_t **context, * @param snaplen length of packet capture * @param base pointer to libevent base * @param giaddr_ip gateway IP address - * @param v6_vlan_ip vlan IPv6 address * * @return 0 on success, otherwise for failure */ int dhcp_device_start_capture(dhcp_device_context_t *context, size_t snaplen, struct event_base *base, - in_addr_t giaddr_ip, - struct in6_addr v6_vlan_ip); + in_addr_t giaddr_ip); /** * @code dhcp_device_shutdown(context); @@ -210,18 +158,17 @@ int dhcp_device_start_capture(dhcp_device_context_t *context, void dhcp_device_shutdown(dhcp_device_context_t *context); /** - * @code dhcp_device_get_status(check_type, context, type); + * @code dhcp_device_get_status(check_type, context); * * @brief collects DHCP relay status info for a given interface. If context is null, it will report aggregate * status * * @param check_type Type of validation * @param context Device (interface) context - * @param type DHCP type * * @return DHCP_MON_STATUS_HEALTHY, DHCP_MON_STATUS_UNHEALTHY, or DHCP_MON_STATUS_INDETERMINATE */ -dhcp_mon_status_t dhcp_device_get_status(dhcp_mon_check_t check_type, dhcp_device_context_t *context, dhcp_type_t type); +dhcp_mon_status_t dhcp_device_get_status(dhcp_mon_check_t check_type, dhcp_device_context_t *context); /** * @code dhcp_device_update_snapshot(context); @@ -238,32 +185,10 @@ void dhcp_device_update_snapshot(dhcp_device_context_t *context); * @brief prints status counters to syslog. If context is null, it will print aggregate status * * @param context Device (interface) context - * @param type Counter type to be printed + * @param counters_type Counter type to be printed * * @return none */ void dhcp_device_print_status(dhcp_device_context_t *context, dhcp_counters_type_t type); -/** - * @code dhcp_device_active_types(dhcpv4, dhcpv6); - * - * @brief update local variables with active protocols - * - * @param dhcpv4 DHCPv4 enable flag - * @param dhcpv6 DHCPv6 enable flag - * - * @return none - */ -void dhcp_device_active_types(bool dhcpv4, bool dhcpv6); - -/** - * @code dhcp_device_init_mgmt_intf(mgmt_intf_context); - * - * @brief assign context address of mgmt interface - * - * @param mgmt_intf_context MGMT interface context struct address - * - * @return none - */ -void dhcp_device_init_mgmt_intf(dhcp_device_context_t *mgmt_intf_context); #endif /* DHCP_DEVICE_H_ */ diff --git a/src/dhcpmon/src/dhcp_devman.c b/src/dhcpmon/src/dhcp_devman.c index b36d926c1d5b..65484798dbd6 100644 --- a/src/dhcpmon/src/dhcp_devman.c +++ b/src/dhcpmon/src/dhcp_devman.c @@ -9,8 +9,6 @@ #include #include #include -#include -#include #include "dhcp_devman.h" @@ -37,8 +35,7 @@ static uint32_t dhcp_num_mgmt_intf = 0; /** On Device vlan interface IP address corresponding vlan downlink IP * This IP is used to filter Offer/Ack packet coming from DHCP server */ -static in_addr_t v4_vlan_ip = 0; -static struct in6_addr v6_vlan_ip = {0}; +static in_addr_t vlan_ip = 0; /* Device loopback interface ip, which will be used as the giaddr in dual tor setup. */ static in_addr_t loopback_ip = 0; @@ -139,8 +136,7 @@ int dhcp_devman_add_intf(const char *name, char intf_type) rv = dhcp_device_init(&dev->dev_context, dev->name, dev->is_uplink); if (rv == 0 && intf_type == 'd') { - rv = dhcp_device_get_ipv4(dev->dev_context, &v4_vlan_ip); - rv = dhcp_device_get_ipv6(dev->dev_context, &v6_vlan_ip); + rv = dhcp_device_get_ip(dev->dev_context, &vlan_ip); dhcp_device_context_t *agg_dev = dhcp_device_get_aggregate_context(); @@ -148,9 +144,6 @@ int dhcp_devman_add_intf(const char *name, char intf_type) strncpy(agg_dev->intf + sizeof(AGG_DEV_PREFIX) - 1, name, sizeof(agg_dev->intf) - sizeof(AGG_DEV_PREFIX)); agg_dev->intf[sizeof(agg_dev->intf) - 1] = '\0'; } - else if (rv == 0 && intf_type == 'm') { - dhcp_device_init_mgmt_intf(dev->dev_context); - } LIST_INSERT_HEAD(&intfs, dev, entry); } @@ -181,7 +174,7 @@ int dhcp_devman_setup_dual_tor_mode(const char *name) } if (initialize_intf_mac_and_ip_addr(&loopback_intf_context) == 0 && - dhcp_device_get_ipv4(&loopback_intf_context, &loopback_ip) == 0) { + dhcp_device_get_ip(&loopback_intf_context, &loopback_ip) == 0) { dual_tor_mode = 1; } else { syslog(LOG_ALERT, "failed to retrieve ip addr for loopback interface (%s)", name); @@ -204,13 +197,11 @@ int dhcp_devman_start_capture(size_t snaplen, struct event_base *base) if ((dhcp_num_south_intf == 1) && (dhcp_num_north_intf >= 1)) { LIST_FOREACH(int_ptr, &intfs, entry) { - rv = dhcp_device_start_capture(int_ptr->dev_context, snaplen, base, dual_tor_mode ? loopback_ip : v4_vlan_ip, v6_vlan_ip); + rv = dhcp_device_start_capture(int_ptr->dev_context, snaplen, base, dual_tor_mode ? loopback_ip : vlan_ip); if (rv == 0) { - char ipv6_addr[INET6_ADDRSTRLEN]; - inet_ntop(AF_INET6, &int_ptr->dev_context->ipv6, ipv6_addr, sizeof(ipv6_addr)); syslog(LOG_INFO, - "Capturing DHCP packets on interface %s, ipv4: 0x%08x, ipv6: %s, mac [%02x:%02x:%02x:%02x:%02x:%02x] \n", - int_ptr->name, int_ptr->dev_context->ipv4, ipv6_addr, int_ptr->dev_context->mac[0], + "Capturing DHCP packets on interface %s, ip: 0x%08x, mac [%02x:%02x:%02x:%02x:%02x:%02x] \n", + int_ptr->name, int_ptr->dev_context->ip, int_ptr->dev_context->mac[0], int_ptr->dev_context->mac[1], int_ptr->dev_context->mac[2], int_ptr->dev_context->mac[3], int_ptr->dev_context->mac[4], int_ptr->dev_context->mac[5]); } @@ -228,13 +219,13 @@ int dhcp_devman_start_capture(size_t snaplen, struct event_base *base) } /** - * @code dhcp_devman_get_status(check_type, context, type); + * @code dhcp_devman_get_status(check_type, context); * * @brief collects DHCP relay status info. */ -dhcp_mon_status_t dhcp_devman_get_status(dhcp_mon_check_t check_type, dhcp_device_context_t *context, dhcp_type_t type) +dhcp_mon_status_t dhcp_devman_get_status(dhcp_mon_check_t check_type, dhcp_device_context_t *context) { - return dhcp_device_get_status(check_type, context, type); + return dhcp_device_get_status(check_type, context); } /** @@ -276,13 +267,3 @@ void dhcp_devman_print_status(dhcp_device_context_t *context, dhcp_counters_type dhcp_device_print_status(context, type); } } - -/** - * @code dhcp_devman_active_types(dhcpv4, dhcpv6); - * - * @brief update local variables with active protocols - */ -void dhcp_devman_active_types(bool dhcpv4, bool dhcpv6) -{ - dhcp_device_active_types(dhcpv4, dhcpv6); -} diff --git a/src/dhcpmon/src/dhcp_devman.h b/src/dhcpmon/src/dhcp_devman.h index 6e30c654f69e..948e79cde4f4 100644 --- a/src/dhcpmon/src/dhcp_devman.h +++ b/src/dhcpmon/src/dhcp_devman.h @@ -87,17 +87,16 @@ int dhcp_devman_setup_dual_tor_mode(const char *name); int dhcp_devman_start_capture(size_t snaplen, struct event_base *base); /** - * @code dhcp_devman_get_status(check_type, context, type); + * @code dhcp_devman_get_status(check_type, context); * * @brief collects DHCP relay status info. * * @param check_type Type of validation * @param context pointer to device (interface) context - * @param type DHCP type * * @return DHCP_MON_STATUS_HEALTHY, DHCP_MON_STATUS_UNHEALTHY, or DHCP_MON_STATUS_INDETERMINATE */ -dhcp_mon_status_t dhcp_devman_get_status(dhcp_mon_check_t check_type, dhcp_device_context_t *context, dhcp_type_t type); +dhcp_mon_status_t dhcp_devman_get_status(dhcp_mon_check_t check_type, dhcp_device_context_t *context); /** * @code dhcp_devman_update_snapshot(context); @@ -120,16 +119,4 @@ void dhcp_devman_update_snapshot(dhcp_device_context_t *context); */ void dhcp_devman_print_status(dhcp_device_context_t *context, dhcp_counters_type_t type); -/** - * @code dhcp_devman_active_types(dhcpv4, dhcpv6); - * - * @brief update local variables with active protocols - * - * @param dhcpv4 flag indicating dhcpv4 is enabled - * @param dhcpv6 flag indicating dhcpv6 is enabled - * - * @return none - */ -void dhcp_devman_active_types(bool dhcpv4, bool dhcpv6); - #endif /* DHCP_DEVMAN_H_ */ diff --git a/src/dhcpmon/src/dhcp_mon.c b/src/dhcpmon/src/dhcp_mon.c index 2777b6484082..74d9869741d1 100644 --- a/src/dhcpmon/src/dhcp_mon.c +++ b/src/dhcpmon/src/dhcp_mon.c @@ -12,24 +12,16 @@ #include #include #include -#include #include "dhcp_mon.h" #include "dhcp_devman.h" -/** DHCP device/interface state counters */ -typedef struct -{ - int v4_count; /** count in the number of DHCPv4 unhealthy checks */ - int v6_count; /** count in the number of DHCPv6 unhealthy checks */ -} dhcp_mon_count_t; - /** DHCP device/interface state */ typedef struct { dhcp_mon_check_t check_type; /** check type */ dhcp_device_context_t* (*get_context)(); /** functor to a device context accessor function */ - dhcp_mon_count_t counters; /** count in the number of unhealthy checks */ + int count; /** count in the number of unhealthy checks */ const char *msg; /** message to be printed if unhealthy state is determined */ } dhcp_mon_state_t; @@ -37,10 +29,6 @@ typedef struct static int window_interval_sec = 18; /** dhcp_unhealthy_max_count max count of consecutive unhealthy statuses before reporting to syslog */ static int dhcp_unhealthy_max_count = 10; -/** DHCP versions flags */ -static bool dhcpv4_enabled; -static bool dhcpv6_enabled; - /** libevent base struct */ static struct event_base *base; /** libevent timeout event struct */ @@ -57,15 +45,13 @@ static dhcp_mon_state_t state_data[] = { [0] = { .check_type = DHCP_MON_CHECK_POSITIVE, .get_context = dhcp_devman_get_agg_dev, - .counters.v4_count = 0, - .counters.v6_count = 0, + .count = 0, .msg = "dhcpmon detected disparity in DHCP Relay behavior. Duration: %d (sec) for vlan: '%s'\n" }, [1] = { .check_type = DHCP_MON_CHECK_NEGATIVE, .get_context = dhcp_devman_get_mgmt_dev, - .counters.v4_count = 0, - .counters.v6_count = 0, + .count = 0, .msg = "dhcpmon detected DHCP packets traveling through mgmt interface (please check BGP routes.)" " Duration: %d (sec) for intf: '%s'\n" } @@ -92,89 +78,36 @@ static void signal_callback(evutil_socket_t fd, short event, void *arg) } /** - * @code check_dhcp_relay_health(state_data, dhcp_type); + * @code check_dhcp_relay_health(state_data); * * @brief check DHCP relay overall health * * @param state_data pointer to dhcpmon state data * - * @param type DHCP type - * * @return none */ -static void check_dhcp_relay_health(dhcp_mon_state_t *state_data, dhcp_type_t type) +static void check_dhcp_relay_health(dhcp_mon_state_t *state_data) { dhcp_device_context_t *context = state_data->get_context(); - dhcp_mon_status_t dhcp_mon_status = dhcp_devman_get_status(state_data->check_type, context, type); + dhcp_mon_status_t dhcp_mon_status = dhcp_devman_get_status(state_data->check_type, context); switch (dhcp_mon_status) { case DHCP_MON_STATUS_UNHEALTHY: - switch (type) - { - case DHCPv4_TYPE: - if (++state_data->counters.v4_count > dhcp_unhealthy_max_count) { - syslog(LOG_ALERT, state_data->msg, state_data->counters.v4_count * window_interval_sec, context->intf); - dhcp_devman_print_status(context, DHCP_COUNTERS_SNAPSHOT); - dhcp_devman_print_status(context, DHCP_COUNTERS_CURRENT); - } - break; - case DHCPv6_TYPE: - if (++state_data->counters.v6_count > dhcp_unhealthy_max_count) { - syslog(LOG_ALERT, state_data->msg, state_data->counters.v6_count * window_interval_sec, context->intf); - dhcp_devman_print_status(context, DHCP_COUNTERS_SNAPSHOT); - dhcp_devman_print_status(context, DHCP_COUNTERS_CURRENT); - } - break; - - default: - syslog(LOG_ERR, "Unknown DHCP type %d\n", type); - break; + if (++state_data->count > dhcp_unhealthy_max_count) { + syslog(LOG_ALERT, state_data->msg, state_data->count * window_interval_sec, context->intf); + dhcp_devman_print_status(context, DHCP_COUNTERS_SNAPSHOT); + dhcp_devman_print_status(context, DHCP_COUNTERS_CURRENT); } break; - case DHCP_MON_STATUS_HEALTHY: - switch (type) - { - case DHCPv4_TYPE: - state_data->counters.v4_count = 0; - break; - case DHCPv6_TYPE: - state_data->counters.v6_count = 0; - break; - default: - syslog(LOG_ERR, "Unknown DHCP type %d\n", type); - break; - } + state_data->count = 0; break; - case DHCP_MON_STATUS_INDETERMINATE: - switch (type) - { - case DHCPv4_TYPE: - if (state_data->counters.v4_count) { - if (++state_data->counters.v4_count > dhcp_unhealthy_max_count) { - syslog(LOG_ALERT, state_data->msg, state_data->counters.v4_count * window_interval_sec, context->intf); - dhcp_devman_print_status(context, DHCP_COUNTERS_SNAPSHOT); - dhcp_devman_print_status(context, DHCP_COUNTERS_CURRENT); - } - } - break; - case DHCPv6_TYPE: - if (state_data->counters.v6_count) { - if (++state_data->counters.v6_count > dhcp_unhealthy_max_count) { - syslog(LOG_ALERT, state_data->msg, state_data->counters.v6_count * window_interval_sec, context->intf); - dhcp_devman_print_status(context, DHCP_COUNTERS_SNAPSHOT); - dhcp_devman_print_status(context, DHCP_COUNTERS_CURRENT); - } - } - break; - default: - syslog(LOG_ERR, "Unknown DHCP type %d\n", type); - break; + if (state_data->count) { + state_data->count++; } break; - default: syslog(LOG_ERR, "DHCP Relay returned unknown status %d\n", dhcp_mon_status); break; @@ -195,12 +128,7 @@ static void check_dhcp_relay_health(dhcp_mon_state_t *state_data, dhcp_type_t ty static void timeout_callback(evutil_socket_t fd, short event, void *arg) { for (uint8_t i = 0; i < sizeof(state_data) / sizeof(*state_data); i++) { - if (dhcpv4_enabled) { - check_dhcp_relay_health(&state_data[i], DHCPv4_TYPE); - } - if (dhcpv6_enabled) { - check_dhcp_relay_health(&state_data[i], DHCPv6_TYPE); - } + check_dhcp_relay_health(&state_data[i]); } dhcp_devman_update_snapshot(NULL); @@ -213,17 +141,13 @@ static void timeout_callback(evutil_socket_t fd, short event, void *arg) * seconds. It also writes to syslog when dhcp relay has been unhealthy for consecutive max_count checks. * */ -int dhcp_mon_init(int window_sec, int max_count, bool dhcpv4, bool dhcpv6) +int dhcp_mon_init(int window_sec, int max_count) { int rv = -1; do { window_interval_sec = window_sec; dhcp_unhealthy_max_count = max_count; - dhcpv4_enabled = dhcpv4; - dhcpv6_enabled = dhcpv6; - - dhcp_devman_active_types(dhcpv4, dhcpv6); base = event_base_new(); if (base == NULL) { diff --git a/src/dhcpmon/src/dhcp_mon.h b/src/dhcpmon/src/dhcp_mon.h index facd46da6860..ae8911ab51fc 100644 --- a/src/dhcpmon/src/dhcp_mon.h +++ b/src/dhcpmon/src/dhcp_mon.h @@ -17,12 +17,10 @@ * * @param window_sec time interval between health checks * @param max_count max count of consecutive unhealthy statuses before reporting to syslog - * @param dhcpv4 flag indicating dhcpv4 is enabled - * @param dhcpv6 flag indicating dhcpv6 is enabled * * @return 0 upon success, otherwise upon failure */ -int dhcp_mon_init(int window_sec, int max_count, bool dhcpv4, bool dhcpv6); +int dhcp_mon_init(int window_sec, int max_count); /** * @code dhcp_mon_shutdown(); diff --git a/src/dhcpmon/src/main.c b/src/dhcpmon/src/main.c index 1cf931821495..29bc534accf0 100644 --- a/src/dhcpmon/src/main.c +++ b/src/dhcpmon/src/main.c @@ -16,7 +16,6 @@ #include #include #include -#include #include "dhcp_mon.h" #include "dhcp_devman.h" @@ -42,8 +41,7 @@ static const uint32_t dhcpmon_default_unhealthy_max_count = 10; static void usage(const char *prog) { printf("Usage: %s -id {-iu }+ -im [-u ]" - "[-w ] [-c ] [-s ]" - "[-4 ] [-6 ] [-d]\n", prog); + "[-w ] [-c ] [-s ] [-d]\n", prog); printf("where\n"); printf("\tsouth interface: is a vlan interface,\n"); printf("\tnorth interface: is a TOR-T1 interface,\n"); @@ -114,8 +112,6 @@ int main(int argc, char **argv) int max_unhealthy_count = dhcpmon_default_unhealthy_max_count; size_t snaplen = dhcpmon_default_snaplen; int make_daemon = 0; - bool dhcpv4_enabled = false; - bool dhcpv6_enabled = false; setlogmask(LOG_UPTO(LOG_INFO)); openlog(basename(argv[0]), LOG_CONS | LOG_PID | LOG_NDELAY, LOG_DAEMON); @@ -159,14 +155,6 @@ int main(int argc, char **argv) max_unhealthy_count = atoi(argv[i + 1]); i += 2; break; - case '4': - dhcpv4_enabled = true; - i++; - break; - case '6': - dhcpv6_enabled = true; - i++; - break; default: fprintf(stderr, "%s: %c: Unknown option\n", basename(argv[0]), argv[i][1]); usage(basename(argv[0])); @@ -177,11 +165,7 @@ int main(int argc, char **argv) dhcpmon_daemonize(); } - if (!dhcpv4_enabled && !dhcpv6_enabled) { - dhcpv4_enabled = true; - } - - if ((dhcp_mon_init(window_interval, max_unhealthy_count, dhcpv4_enabled, dhcpv6_enabled) == 0) && + if ((dhcp_mon_init(window_interval, max_unhealthy_count) == 0) && (dhcp_mon_start(snaplen) == 0)) { rv = EXIT_SUCCESS; diff --git a/src/linkmgrd b/src/linkmgrd index 83dfc992d1b2..41f5fb9d44f2 160000 --- a/src/linkmgrd +++ b/src/linkmgrd @@ -1 +1 @@ -Subproject commit 83dfc992d1b24b01bb9b125cc86a8ce63ba060f6 +Subproject commit 41f5fb9d44f2fd789dea372f2b647d40ec71ed75 diff --git a/src/ptf-py3 b/src/ptf-py3 new file mode 160000 index 000000000000..405513bcad2e --- /dev/null +++ b/src/ptf-py3 @@ -0,0 +1 @@ +Subproject commit 405513bcad2eae3092b0ac4ceb31e8dec5e32311 diff --git a/src/ptf-py3.patch/0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch b/src/ptf-py3.patch/0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch new file mode 100644 index 000000000000..cb2b992548a7 --- /dev/null +++ b/src/ptf-py3.patch/0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch @@ -0,0 +1,26 @@ +From a8b13b9fbaa16ddd305ba2df2238ef606ef222a7 Mon Sep 17 00:00:00 2001 +From: Zhaohui Sun +Date: Wed, 13 Apr 2022 09:24:46 +0000 +Subject: [PATCH 1/2] Remove ord in get_mac() to avoid TypeError + +Signed-off-by: Zhaohui Sun +--- + src/ptf/netutils.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ptf/netutils.py b/src/ptf/netutils.py +index 752e76c..6aabe79 100644 +--- a/src/ptf/netutils.py ++++ b/src/ptf/netutils.py +@@ -54,7 +54,7 @@ def get_if_index(iff): + + + def get_mac(iff): +- return ":".join(["%02x" % ord(char) for char in get_if(iff, SIOCGIFHWADDR)[18:24]]) ++ return ":".join(["%02x" % char for char in get_if(iff, SIOCGIFHWADDR)[18:24]]) + + + def set_promisc(s, iff, val=1): +-- +2.25.1 + diff --git a/src/ptf-py3.patch/0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch b/src/ptf-py3.patch/0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch new file mode 100644 index 000000000000..a0582994539e --- /dev/null +++ b/src/ptf-py3.patch/0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch @@ -0,0 +1,36 @@ +From 6e570e00ea05882d2db1e480ed041ea631bf37da Mon Sep 17 00:00:00 2001 +From: Zhaohui Sun +Date: Wed, 13 Apr 2022 09:25:28 +0000 +Subject: [PATCH 2/2] Fill byte formatted client mac address in DHCP Discover + packet + +Signed-off-by: Zhaohui Sun +--- + src/ptf/testutils.py | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/ptf/testutils.py b/src/ptf/testutils.py +index ab67cea..83a9075 100755 +--- a/src/ptf/testutils.py ++++ b/src/ptf/testutils.py +@@ -2712,12 +2712,13 @@ def __dhcp_mac_to_chaddr(mac_addr="00:01:02:03:04:05"): + """ + Private helper function to convert a 6-byte MAC address of form: + '00:01:02:03:04:05' +- into a 16-byte chaddr byte string of form: +- '\x00\x01\x02\x03\x04\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' ++ into a 16-byte chaddr byte of form: ++ b'\x00\x01\x02\x03\x04\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + + """ +- chaddr = "".join([chr(int(octet, 16)) for octet in mac_addr.split(":")]) +- chaddr += "\x00" * 10 ++ import binascii ++ chaddr = binascii.unhexlify(mac_addr.replace(':', '')) ++ chaddr += b'\x00\x00\x00\x00\x00\x00' + return chaddr + + +-- +2.25.1 + diff --git a/src/ptf-py3.patch/series b/src/ptf-py3.patch/series new file mode 100644 index 000000000000..d18987dd5913 --- /dev/null +++ b/src/ptf-py3.patch/series @@ -0,0 +1,2 @@ +0001-Remove-ord-in-get_mac-to-avoid-TypeError.patch +0002-Fill-byte-formatted-client-mac-address-in-DHCP-Disco.patch \ No newline at end of file diff --git a/src/scapy b/src/scapy new file mode 160000 index 000000000000..8b63d73a1726 --- /dev/null +++ b/src/scapy @@ -0,0 +1 @@ +Subproject commit 8b63d73a17266bae2a61513ea97ded5283a7ccd3 diff --git a/src/scapy.patch/0001-Fix-version-string-generation-when-scapy-is-a-submod.patch b/src/scapy.patch/0001-Fix-version-string-generation-when-scapy-is-a-submod.patch new file mode 100644 index 000000000000..37f5253db0cc --- /dev/null +++ b/src/scapy.patch/0001-Fix-version-string-generation-when-scapy-is-a-submod.patch @@ -0,0 +1,27 @@ +From 988c808af6065b740006aef0e94496821d41fb98 Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Mon, 4 Apr 2022 09:57:39 +0000 +Subject: [PATCH] Fix version string generation when scapy is a submodule + +Signed-off-by: Stepan Blyschak +--- + scapy/__init__.py | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/scapy/__init__.py b/scapy/__init__.py +index f920151e..2adbea19 100644 +--- a/scapy/__init__.py ++++ b/scapy/__init__.py +@@ -42,9 +42,6 @@ def _version_from_git_describe(): + :raises CalledProcessError: if git is unavailable + :return: Scapy's latest tag + """ +- if not os.path.isdir(os.path.join(os.path.dirname(_SCAPY_PKG_DIR), '.git')): # noqa: E501 +- raise ValueError('not in scapy git repo') +- + def _git(cmd): + # type: (str) -> str + process = subprocess.Popen( +-- +2.14.1 + diff --git a/src/scapy.patch/0002-Check-if-the-network-interface-still-exists.patch b/src/scapy.patch/0002-Check-if-the-network-interface-still-exists.patch new file mode 100644 index 000000000000..c42c12e1a8aa --- /dev/null +++ b/src/scapy.patch/0002-Check-if-the-network-interface-still-exists.patch @@ -0,0 +1,42 @@ +From 7ffd8101c1e535f9c3225db2c319958a64412686 Mon Sep 17 00:00:00 2001 +From: Guillaume Valadon +Date: Tue, 14 Sep 2021 19:34:43 +0200 +Subject: [PATCH] Check if the network interface still exists + +Signed-off-by: Stepan Blyschak +--- + scapy/arch/linux.py | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/scapy/arch/linux.py b/scapy/arch/linux.py +index 94fac8f0..b86e98ab 100644 +--- a/scapy/arch/linux.py ++++ b/scapy/arch/linux.py +@@ -414,13 +414,17 @@ class LinuxInterfaceProvider(InterfaceProvider): + data = {} + ips = in6_getifaddr() + for i in _get_if_list(): +- ifflags = struct.unpack("16xH14x", get_if(i, SIOCGIFFLAGS))[0] +- index = get_if_index(i) +- mac = scapy.utils.str2mac( +- get_if_raw_hwaddr(i, siocgifhwaddr=SIOCGIFHWADDR)[1] +- ) +- ip = None # type: Optional[str] +- ip = inet_ntop(socket.AF_INET, get_if_raw_addr(i)) ++ try: ++ ifflags = struct.unpack("16xH14x", get_if(i, SIOCGIFFLAGS))[0] ++ index = get_if_index(i) ++ mac = scapy.utils.str2mac( ++ get_if_raw_hwaddr(i, siocgifhwaddr=SIOCGIFHWADDR)[1] ++ ) ++ ip = None # type: Optional[str] ++ ip = inet_ntop(socket.AF_INET, get_if_raw_addr(i)) ++ except IOError: ++ warning("Interface %s does not exist!", i) ++ continue + if ip == "0.0.0.0": + ip = None + ifflags = FlagValue(ifflags, _iff_flags) +-- +2.14.1 + diff --git a/src/scapy.patch/series b/src/scapy.patch/series new file mode 100644 index 000000000000..d64f20f136c1 --- /dev/null +++ b/src/scapy.patch/series @@ -0,0 +1,2 @@ +0001-Fix-version-string-generation-when-scapy-is-a-submod.patch +0002-Check-if-the-network-interface-still-exists.patch diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index 3873d1362926..e1ef80b01162 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -169,6 +169,10 @@ run_pip_command() elif [[ "$para" == *.whl ]]; then package_name=$(echo $para | cut -d- -f1 | tr _ .) $SUDO sed "/^${package_name}==/d" -i $tmp_version_file + elif [[ "$para" == *==* ]]; then + # fix pip package constraint conflict issue + package_name=$(echo $para | cut -d= -f1) + $SUDO sed "/^${package_name}==/d" -i $tmp_version_file fi done diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index ff2c1a0e614e..b2e1d07a7d6c 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -537,28 +537,36 @@ def parse_dpg(dpg, hname): vlan_members = {} vlan_member_list = {} dhcp_relay_table = {} - vlantype_name = "" - intf_vlan_mbr = defaultdict(list) + # Dict: vlan member (port/PortChannel) -> set of VlanID, in which the member if an untagged vlan member + untagged_vlan_mbr = defaultdict(set) for vintf in vlanintfs.findall(str(QName(ns, "VlanInterface"))): vlanid = vintf.find(str(QName(ns, "VlanID"))).text + vlantype = vintf.find(str(QName(ns, "Type"))) + if vlantype is None: + vlantype_name = "" + else: + vlantype_name = vlantype.text vintfmbr = vintf.find(str(QName(ns, "AttachTo"))).text vmbr_list = vintfmbr.split(';') - for i, member in enumerate(vmbr_list): - intf_vlan_mbr[member].append(vlanid) + if vlantype_name != "Tagged": + for member in vmbr_list: + untagged_vlan_mbr[member].add(vlanid) for vintf in vlanintfs.findall(str(QName(ns, "VlanInterface"))): vintfname = vintf.find(str(QName(ns, "Name"))).text vlanid = vintf.find(str(QName(ns, "VlanID"))).text vintfmbr = vintf.find(str(QName(ns, "AttachTo"))).text vlantype = vintf.find(str(QName(ns, "Type"))) - if vlantype != None: - vlantype_name = vintf.find(str(QName(ns, "Type"))).text + if vlantype is None: + vlantype_name = "" + else: + vlantype_name = vlantype.text vmbr_list = vintfmbr.split(';') for i, member in enumerate(vmbr_list): vmbr_list[i] = port_alias_map.get(member, member) sonic_vlan_member_name = "Vlan%s" % (vlanid) if vlantype_name == "Tagged": vlan_members[(sonic_vlan_member_name, vmbr_list[i])] = {'tagging_mode': 'tagged'} - elif len(intf_vlan_mbr[member]) > 1: + elif len(untagged_vlan_mbr[member]) > 1: vlan_members[(sonic_vlan_member_name, vmbr_list[i])] = {'tagging_mode': 'tagged'} else: vlan_members[(sonic_vlan_member_name, vmbr_list[i])] = {'tagging_mode': 'untagged'} diff --git a/src/sonic-config-engine/portconfig.py b/src/sonic-config-engine/portconfig.py index 0c056d1cdab7..ea9985a3beb0 100644 --- a/src/sonic-config-engine/portconfig.py +++ b/src/sonic-config-engine/portconfig.py @@ -72,12 +72,7 @@ def db_connect_configdb(namespace=None): """ Connect to configdb """ - try: - if namespace is not None: - swsscommon.SonicDBConfig.load_sonic_global_db_config(namespace=namespace) - config_db = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=namespace) - except Exception as e: - return None + config_db = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=namespace) if config_db is None: return None try: diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index bf93ad849fcb..3f0e047f76fa 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -32,7 +32,7 @@ from functools import partial from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role, parse_asic_switch_type from portconfig import get_port_config, get_breakout_mode from redis_bcc import RedisBytecodeCache -from sonic_py_common.multi_asic import get_asic_id_from_name, get_asic_device_id +from sonic_py_common.multi_asic import get_asic_id_from_name, get_asic_device_id, is_multi_asic from sonic_py_common import device_info from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector @@ -296,6 +296,12 @@ def main(): 'localhost': {'namespace_id': namespace_id} } }) + # load db config + if not SonicDBConfig.isInit(): + if is_multi_asic(): + SonicDBConfig.load_sonic_global_db_config(namespace=asic_name) + else: + SonicDBConfig.load_sonic_db_config() if hwsku is not None: hardware_data = {'DEVICE_METADATA': {'localhost': { 'hwsku': hwsku diff --git a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph-noportchannel.xml b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph-noportchannel.xml index 460f71e21c2a..6ec84dc4fe31 100644 --- a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph-noportchannel.xml +++ b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph-noportchannel.xml @@ -1119,6 +1119,294 @@ 0 40000 + + DeviceInterface + + true + 1 + Ethernet-BP0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP4 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP256 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP260 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP264 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP268 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP272 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP276 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP280 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP284 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP384 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP388 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP392 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP396 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP400 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP404 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP408 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP412 + + false + 0 + 0 + 40000 + true 0 diff --git a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml index 5dac8e95bf1a..935d2c0c833a 100644 --- a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml +++ b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml @@ -1105,6 +1105,294 @@ 0 40000 + + DeviceInterface + + true + 1 + Ethernet-BP0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP4 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP256 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP260 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP264 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP268 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP272 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP276 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP280 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP284 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP384 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP388 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP392 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP396 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP400 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP404 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP408 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP412 + + false + 0 + 0 + 40000 + true 0 diff --git a/src/sonic-config-engine/tests/pc-test-graph.xml b/src/sonic-config-engine/tests/pc-test-graph.xml index 814686d8ff06..4a7ecabaf9f4 100644 --- a/src/sonic-config-engine/tests/pc-test-graph.xml +++ b/src/sonic-config-engine/tests/pc-test-graph.xml @@ -202,6 +202,400 @@ + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + Force10-S6000 + + + diff --git a/src/sonic-config-engine/tests/radv-test-sample-graph.xml b/src/sonic-config-engine/tests/radv-test-sample-graph.xml index a45e38f64030..94cb73d67464 100644 --- a/src/sonic-config-engine/tests/radv-test-sample-graph.xml +++ b/src/sonic-config-engine/tests/radv-test-sample-graph.xml @@ -508,6 +508,374 @@ + + + + + DeviceInterface + + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + Force10-S6000 + + + diff --git a/src/sonic-config-engine/tests/sample-arista-7050-t0-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7050-t0-minigraph.xml index 4d216b30f203..4d79d6f2c457 100644 --- a/src/sonic-config-engine/tests/sample-arista-7050-t0-minigraph.xml +++ b/src/sonic-config-engine/tests/sample-arista-7050-t0-minigraph.xml @@ -463,6 +463,66 @@ + + DeviceInterface + + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet1 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet2 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet3 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet4 + + false + 0 + 0 + 40000 + DeviceInterface diff --git a/src/sonic-config-engine/tests/sample-graph-resource-type.xml b/src/sonic-config-engine/tests/sample-graph-resource-type.xml index aecc1bc3249f..3f289869fa34 100644 --- a/src/sonic-config-engine/tests/sample-graph-resource-type.xml +++ b/src/sonic-config-engine/tests/sample-graph-resource-type.xml @@ -190,6 +190,14 @@ 1000 192.168.0.0/27 + + ab4 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1001 + 1001 + 192.168.0.32/27 + kk1 fortyGigE0/12 @@ -205,6 +213,7 @@ 192.0.0.1;192.0.0.2 2000 2000 + Tagged 192.168.0.240/27 @@ -305,7 +314,7 @@ switch-t0 - Force10-S6000 + Arista-7050-QX-32S AAA00PrdStr00 @@ -415,10 +424,334 @@ 0 100000 + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 - Force10-S6000 + Arista-7050-QX-32S DeviceInterface @@ -442,16 +775,11 @@ 1 - - ResourceType - - Storage - switch-t0 - Force10-S6000 + Arista-7050-QX-32S diff --git a/src/sonic-config-engine/tests/sample-graph-subintf.xml b/src/sonic-config-engine/tests/sample-graph-subintf.xml index fe18baa79db1..a23b668c2c2f 100644 --- a/src/sonic-config-engine/tests/sample-graph-subintf.xml +++ b/src/sonic-config-engine/tests/sample-graph-subintf.xml @@ -208,6 +208,14 @@ 1000 192.168.0.0/27 + + ab4 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1001 + 1001 + 192.168.0.32/27 + kk1 fortyGigE0/12 @@ -423,6 +431,330 @@ 0 100000 + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 diff --git a/src/sonic-config-engine/tests/sample-voq-graph.xml b/src/sonic-config-engine/tests/sample-voq-graph.xml index 5257efd4b0ae..5205265ee384 100644 --- a/src/sonic-config-engine/tests/sample-voq-graph.xml +++ b/src/sonic-config-engine/tests/sample-voq-graph.xml @@ -202,6 +202,366 @@ 100000 Interface description + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + Recycle0 + + false + 0 + 0 + 100000 + true 0 diff --git a/src/sonic-config-engine/tests/sample_graph.xml b/src/sonic-config-engine/tests/sample_graph.xml index 7bd08ab8f7c8..478fdd5ba8d4 100644 --- a/src/sonic-config-engine/tests/sample_graph.xml +++ b/src/sonic-config-engine/tests/sample_graph.xml @@ -88,7 +88,7 @@ - Ethernet1 + Ethernet4 10.10.2.13/30 @@ -112,7 +112,7 @@ 40000 DeviceInterfaceLink OCPSCH01040DDLF - Ethernet1 + Ethernet4 OCPSCH0104002MS Ethernet12 @@ -124,6 +124,424 @@ + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + Ethernet1 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + Ethernet2 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + Force10-Z9100 + + + diff --git a/src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf index a9004e2b00f5..407ac2c80bc9 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf @@ -68,7 +68,7 @@ dependent_startup_wait_for=start:exited programs=dhcpmon-Vlan1000 [program:dhcpmon-Vlan1000] -command=/usr/sbin/dhcpmon -id Vlan1000 -iu Vlan2000 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -iu PortChannel01 -im eth0 -4 -6 +command=/usr/sbin/dhcpmon -id Vlan1000 -iu Vlan2000 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -iu PortChannel01 -im eth0 priority=4 autostart=false autorestart=false diff --git a/src/sonic-config-engine/tests/sample_output/py2/ports.json b/src/sonic-config-engine/tests/sample_output/py2/ports.json index 4b36790c7cd0..959a234eaace 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/ports.json +++ b/src/sonic-config-engine/tests/sample_output/py2/ports.json @@ -20,6 +20,104 @@ }, "OP": "SET" }, + { + "PORT_TABLE:Ethernet108": { + "speed": "100000", + "description": "fortyGigE0/108" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet100": { + "speed": "100000", + "description": "fortyGigE0/100" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet104": { + "speed": "100000", + "description": "fortyGigE0/104" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet68": { + "speed": "100000", + "description": "fortyGigE0/68" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet96": { + "speed": "100000", + "description": "fortyGigE0/96" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet124": { + "speed": "100000", + "description": "fortyGigE0/124" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet92": { + "speed": "100000", + "description": "fortyGigE0/92" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet120": { + "speed": "100000", + "description": "fortyGigE0/120" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet52": { + "speed": "100000", + "description": "fortyGigE0/52" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet56": { + "speed": "100000", + "description": "fortyGigE0/56" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet76": { + "speed": "100000", + "description": "fortyGigE0/76" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet72": { + "speed": "100000", + "description": "fortyGigE0/72" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet64": { + "speed": "100000", + "description": "fortyGigE0/64" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet32": { + "speed": "100000", + "description": "fortyGigE0/32" + }, + "OP": "SET" + }, { "PORT_TABLE:Ethernet16": { "speed": "1000", @@ -27,11 +125,102 @@ }, "OP": "SET" }, + { + "PORT_TABLE:Ethernet36": { + "speed": "100000", + "description": "fortyGigE0/36" + }, + "OP": "SET" + }, { "PORT_TABLE:Ethernet12": { "speed": "100000", "description": "Interface description" }, "OP": "SET" + }, + { + "PORT_TABLE:Ethernet88": { + "speed": "100000", + "description": "fortyGigE0/88" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet116": { + "speed": "100000", + "description": "fortyGigE0/116" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet80": { + "speed": "100000", + "description": "fortyGigE0/80" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet112": { + "speed": "100000", + "description": "fortyGigE0/112" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet84": { + "speed": "100000", + "description": "fortyGigE0/84" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet48": { + "speed": "100000", + "description": "fortyGigE0/48" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet44": { + "speed": "100000", + "description": "fortyGigE0/44" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet40": { + "speed": "100000", + "description": "fortyGigE0/40" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet28": { + "speed": "100000", + "description": "fortyGigE0/28" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet60": { + "speed": "100000", + "description": "fortyGigE0/60" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet20": { + "speed": "100000", + "description": "fortyGigE0/20" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet24": { + "speed": "100000", + "description": "fortyGigE0/24" + }, + "OP": "SET" } ] diff --git a/src/sonic-config-engine/tests/sample_output/py3/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/py3/docker-dhcp-relay.supervisord.conf index 521899b939f4..5456409738e6 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/docker-dhcp-relay.supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/docker-dhcp-relay.supervisord.conf @@ -68,7 +68,7 @@ dependent_startup_wait_for=start:exited programs=dhcpmon-Vlan1000 [program:dhcpmon-Vlan1000] -command=/usr/sbin/dhcpmon -id Vlan1000 -iu Vlan2000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -im eth0 -4 -6 +command=/usr/sbin/dhcpmon -id Vlan1000 -iu Vlan2000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -im eth0 priority=4 autostart=false autorestart=false diff --git a/src/sonic-config-engine/tests/sample_output/py3/ports.json b/src/sonic-config-engine/tests/sample_output/py3/ports.json index 1fee36338bd2..de9d4e25d1f3 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/ports.json +++ b/src/sonic-config-engine/tests/sample_output/py3/ports.json @@ -33,5 +33,194 @@ "description": "fortyGigE0/16" }, "OP": "SET" + }, + { + "PORT_TABLE:Ethernet20": { + "speed": "100000", + "description": "fortyGigE0/20" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet24": { + "speed": "100000", + "description": "fortyGigE0/24" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet28": { + "speed": "100000", + "description": "fortyGigE0/28" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet32": { + "speed": "100000", + "description": "fortyGigE0/32" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet36": { + "speed": "100000", + "description": "fortyGigE0/36" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet40": { + "speed": "100000", + "description": "fortyGigE0/40" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet44": { + "speed": "100000", + "description": "fortyGigE0/44" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet48": { + "speed": "100000", + "description": "fortyGigE0/48" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet52": { + "speed": "100000", + "description": "fortyGigE0/52" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet56": { + "speed": "100000", + "description": "fortyGigE0/56" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet60": { + "speed": "100000", + "description": "fortyGigE0/60" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet64": { + "speed": "100000", + "description": "fortyGigE0/64" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet68": { + "speed": "100000", + "description": "fortyGigE0/68" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet72": { + "speed": "100000", + "description": "fortyGigE0/72" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet76": { + "speed": "100000", + "description": "fortyGigE0/76" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet80": { + "speed": "100000", + "description": "fortyGigE0/80" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet84": { + "speed": "100000", + "description": "fortyGigE0/84" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet88": { + "speed": "100000", + "description": "fortyGigE0/88" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet92": { + "speed": "100000", + "description": "fortyGigE0/92" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet96": { + "speed": "100000", + "description": "fortyGigE0/96" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet100": { + "speed": "100000", + "description": "fortyGigE0/100" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet104": { + "speed": "100000", + "description": "fortyGigE0/104" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet108": { + "speed": "100000", + "description": "fortyGigE0/108" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet112": { + "speed": "100000", + "description": "fortyGigE0/112" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet116": { + "speed": "100000", + "description": "fortyGigE0/116" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet120": { + "speed": "100000", + "description": "fortyGigE0/120" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet124": { + "speed": "100000", + "description": "fortyGigE0/124" + }, + "OP": "SET" } ] 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 84a2613df90d..dbab298bb76a 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 @@ -21,6 +21,16 @@ "5": "5", "6": "6", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7" } }, "DSCP_TO_TC_MAP": { @@ -89,6 +99,72 @@ "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": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" } }, "TC_TO_PRIORITY_GROUP_MAP": { @@ -101,6 +177,28 @@ "5": "0", "6": "0", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0" + } + }, + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "33", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48" } }, "SCHEDULER": { 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 e8476cc0c865..41f36a273d06 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 @@ -21,6 +21,16 @@ "5": "5", "6": "6", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7" } }, "DSCP_TO_TC_MAP": { @@ -89,6 +99,72 @@ "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": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" } }, "TC_TO_PRIORITY_GROUP_MAP": { @@ -101,6 +177,28 @@ "5": "0", "6": "0", "7": "7" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0" + } + }, + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "33", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48" } }, "SCHEDULER": { diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index 08f750457499..d6a8c394f604 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -527,6 +527,342 @@ 100000 Interface description + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 diff --git a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml index 5691ff81578a..fbc33b49862a 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml @@ -321,6 +321,342 @@ 100000 Interface description + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index aef72017d72b..8d7800686c7a 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -190,6 +190,14 @@ 1000 192.168.0.0/27 + + ab4 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1001 + 1001 + 192.168.0.32/27 + kk1 fortyGigE0/12 @@ -205,6 +213,7 @@ 192.0.0.1;192.0.0.2 2000 2000 + Tagged 192.168.0.240/27 @@ -415,6 +424,330 @@ 0 100000 + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 diff --git a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml index f2690985d9f3..552d219964c2 100644 --- a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml +++ b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml @@ -327,6 +327,400 @@ + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + Force10-S6000 + + + diff --git a/src/sonic-config-engine/tests/t0-sample-deployment-id.xml b/src/sonic-config-engine/tests/t0-sample-deployment-id.xml index b6b47d979102..30517dfee19f 100644 --- a/src/sonic-config-engine/tests/t0-sample-deployment-id.xml +++ b/src/sonic-config-engine/tests/t0-sample-deployment-id.xml @@ -327,6 +327,400 @@ + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + Force10-S6000 + + + diff --git a/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml b/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml index e7e2b5789816..3fd73f7369fe 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml @@ -387,6 +387,398 @@ + + + + + DeviceInterface + + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet4 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet124 + + false + 0 + 0 + 40000 + + + Force10-S6000 + + + diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index 6d9e21c4f81b..15fb1dc79210 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -498,6 +498,374 @@ + + + + + DeviceInterface + + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + Force10-S6000 + + + diff --git a/src/sonic-config-engine/tests/t2-chassis-fe-graph-pc.xml b/src/sonic-config-engine/tests/t2-chassis-fe-graph-pc.xml index bc1a5142fc86..212d9c76a647 100644 --- a/src/sonic-config-engine/tests/t2-chassis-fe-graph-pc.xml +++ b/src/sonic-config-engine/tests/t2-chassis-fe-graph-pc.xml @@ -296,6 +296,318 @@ 0 25000 + + DeviceInterface + + false + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet124 + + false + 0 + 0 + 40000 + false 0 diff --git a/src/sonic-config-engine/tests/t2-chassis-fe-graph-vni.xml b/src/sonic-config-engine/tests/t2-chassis-fe-graph-vni.xml index 0dc534b3de88..9384446aa913 100644 --- a/src/sonic-config-engine/tests/t2-chassis-fe-graph-vni.xml +++ b/src/sonic-config-engine/tests/t2-chassis-fe-graph-vni.xml @@ -224,6 +224,354 @@ 0 40000 + + DeviceInterface + + false + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet124 + + false + 0 + 0 + 40000 + false 0 diff --git a/src/sonic-config-engine/tests/t2-chassis-fe-graph.xml b/src/sonic-config-engine/tests/t2-chassis-fe-graph.xml index 3b0c56a57a70..3fd8ed01c215 100644 --- a/src/sonic-config-engine/tests/t2-chassis-fe-graph.xml +++ b/src/sonic-config-engine/tests/t2-chassis-fe-graph.xml @@ -223,6 +223,354 @@ 0 40000 + + DeviceInterface + + false + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet124 + + false + 0 + 0 + 40000 + false 0 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index dd84ed003a80..20f8ff875609 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -32,11 +32,12 @@ def setUp(self): self.output_file = os.path.join(self.test_dir, 'output') self.output2_file = os.path.join(self.test_dir, 'output2') self.ecmp_graph = os.path.join(self.test_dir, 'fg-ecmp-sample-minigraph.xml') - self.sample_backend_graph = os.path.join(self.test_dir, 'sample-graph-backend-hwsku.xml') + self.sample_resource_graph = os.path.join(self.test_dir, 'sample-graph-resource-type.xml') self.sample_subintf_graph = os.path.join(self.test_dir, 'sample-graph-subintf.xml') self.voq_port_config = os.path.join(self.test_dir, 'voq-sample-port-config.ini') self.packet_chassis_graph = os.path.join(self.test_dir, 'sample-chassis-packet-lc-graph.xml') self.packet_chassis_port_ini = os.path.join(self.test_dir, 'sample-chassis-packet-lc-port-config.ini') + self.maxDiff = None # To ensure that mock config_db data is used for unit-test cases os.environ["CFGGEN_UNIT_TESTING"] = "2" @@ -151,6 +152,7 @@ def test_var_json_data(self, **kwargs): utils.to_dict(output.strip()), utils.to_dict( '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan1001|Ethernet8": {\n "tagging_mode": "tagged"\n },' ' \n "Vlan2000|Ethernet12": {\n "tagging_mode": "tagged"\n },' ' \n "Vlan2001|Ethernet12": {\n "tagging_mode": "tagged"\n },' ' \n "Vlan2020|Ethernet12": {\n "tagging_mode": "tagged"\n }\n}' @@ -160,9 +162,10 @@ def test_var_json_data(self, **kwargs): self.assertEqual( utils.to_dict(output.strip()), utils.to_dict( - '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "untagged"\n },' + '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan1001|Ethernet8": {\n "tagging_mode": "tagged"\n },' ' \n "Vlan2000|Ethernet12": {\n "tagging_mode": "tagged"\n },' - ' \n "Vlan2001|Ethernet12": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan2001|Ethernet12": {\n "tagging_mode": "untagged"\n },' ' \n "Vlan2020|Ethernet12": {\n "tagging_mode": "tagged"\n }\n}' ) ) @@ -249,6 +252,7 @@ def test_minigraph_vlans(self, **kwargs): utils.to_dict(output.strip()), utils.to_dict( "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}, " + "'Vlan1001': {'alias': 'ab4', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1001'}," "'Vlan2001': {'alias': 'ab3', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2001'}," "'Vlan2000': {'alias': 'ab2', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2000'}," "'Vlan2020': {'alias': 'kk1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2020'}}" @@ -265,6 +269,7 @@ def test_minigraph_vlan_members(self, **kwargs): utils.to_dict(output.strip()), utils.to_dict( "{('Vlan2000', 'Ethernet12'): {'tagging_mode': 'tagged'}, " + "('Vlan1001', 'Ethernet8'): {'tagging_mode': 'tagged'}, " "('Vlan1000', 'Ethernet8'): {'tagging_mode': 'tagged'}, " "('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}, " "('Vlan2001', 'Ethernet12'): {'tagging_mode': 'tagged'}}" @@ -275,9 +280,10 @@ def test_minigraph_vlan_members(self, **kwargs): utils.to_dict(output.strip()), utils.to_dict( "{('Vlan2000', 'Ethernet12'): {'tagging_mode': 'tagged'}, " - "('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}, " + "('Vlan1000', 'Ethernet8'): {'tagging_mode': 'tagged'}, " + "('Vlan1001', 'Ethernet8'): {'tagging_mode': 'tagged'}, " "('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}, " - "('Vlan2001', 'Ethernet12'): {'tagging_mode': 'tagged'}}" + "('Vlan2001', 'Ethernet12'): {'tagging_mode': 'untagged'}}" ) ) @@ -396,37 +402,37 @@ def test_minigraph_port_autonegotiation(self): self.assertEqual( utils.to_dict(output.strip()), utils.to_dict( - "{'Ethernet0': {'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'tpid': '0x8100'}, " + "{'Ethernet0': {'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'tpid': '0x8100', 'speed': '40000'}, " "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000', 'fec': 'none'}, " - "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up'}, " - "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'admin_status': 'up'}, " - "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/20', 'admin_status': 'up'}, " - "'Ethernet24': {'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/24', 'admin_status': 'up'}, " - "'Ethernet28': {'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/28', 'admin_status': 'up'}, " - "'Ethernet32': {'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/32', 'admin_status': 'up'}, " - "'Ethernet36': {'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/36', 'admin_status': 'up'}, " - "'Ethernet40': {'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/40', 'admin_status': 'up'}, " - "'Ethernet44': {'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/44', 'admin_status': 'up'}, " - "'Ethernet48': {'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/48', 'admin_status': 'up'}, " - "'Ethernet52': {'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/52', 'admin_status': 'up'}, " - "'Ethernet56': {'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/56', 'admin_status': 'up'}, " - "'Ethernet60': {'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/60', 'admin_status': 'up'}, " - "'Ethernet64': {'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/64', 'admin_status': 'up'}, " - "'Ethernet68': {'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/68', 'admin_status': 'up'}, " - "'Ethernet72': {'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/72', 'admin_status': 'up'}, " - "'Ethernet76': {'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/76', 'admin_status': 'up'}, " - "'Ethernet80': {'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/80', 'admin_status': 'up'}, " - "'Ethernet84': {'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/84', 'admin_status': 'up'}, " - "'Ethernet88': {'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/88', 'admin_status': 'up'}, " - "'Ethernet92': {'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/92', 'admin_status': 'up'}, " - "'Ethernet96': {'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/96', 'admin_status': 'up'}, " - "'Ethernet100': {'lanes': '125,126,127,128', 'description': 'Servers100:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/100', 'admin_status': 'up'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet112': {'lanes': '89,90,91,92', 'description': 'ARISTA01T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/112', 'admin_status': 'up'}, " - "'Ethernet116': {'lanes': '93,94,95,96', 'description': 'ARISTA02T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/116', 'admin_status': 'up'}, " - "'Ethernet120': {'lanes': '97,98,99,100', 'description': 'ARISTA03T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/120', 'admin_status': 'up'}, " + "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none', 'speed': '40000'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/20', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet24': {'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/24', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet28': {'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/28', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet32': {'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/32', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet36': {'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/36', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet40': {'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/40', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet44': {'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/44', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet48': {'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/48', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet52': {'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/52', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet56': {'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/56', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet60': {'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/60', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet64': {'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/64', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet68': {'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/68', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet72': {'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/72', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet76': {'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/76', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet80': {'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/80', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet84': {'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/84', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet88': {'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/88', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet92': {'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/92', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet96': {'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/96', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet100': {'lanes': '125,126,127,128', 'description': 'Servers100:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/100', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'speed': '40000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'speed': '40000'}, " + "'Ethernet112': {'lanes': '89,90,91,92', 'description': 'ARISTA01T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/112', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet116': {'lanes': '93,94,95,96', 'description': 'ARISTA02T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/116', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet120': {'lanes': '97,98,99,100', 'description': 'ARISTA03T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/120', 'admin_status': 'up', 'speed': '40000'}, " "'Ethernet124': {'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1'}}" ) ) @@ -437,38 +443,38 @@ def test_minigraph_port_autonegotiation(self): self.assertEqual( utils.to_dict(output.strip()), utils.to_dict( - "{'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'autoneg': 'off'}, " + "{'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'autoneg': 'off', 'speed': '40000'}, " "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000', 'fec': 'none'}, " - "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/20', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet24': {'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/24', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet28': {'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/28', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet32': {'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/32', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet36': {'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/36', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet40': {'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/40', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet44': {'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/44', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet48': {'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/48', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet52': {'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/52', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet56': {'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/56', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet60': {'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/60', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet64': {'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/64', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet68': {'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/68', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet72': {'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/72', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet76': {'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/76', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet80': {'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/80', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet84': {'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/84', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet88': {'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/88', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet92': {'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/92', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet96': {'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/96', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet100': {'lanes': '125,126,127,128', 'description': 'Servers100:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/100', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet104': {'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'autoneg': 'off'}, " - "'Ethernet108': {'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'autoneg': 'off'}, " - "'Ethernet112': {'lanes': '89,90,91,92', 'description': 'ARISTA01T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/112', 'admin_status': 'up', 'autoneg': 'on'}, " - "'Ethernet116': {'lanes': '93,94,95,96', 'description': 'ARISTA02T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/116', 'admin_status': 'up', 'autoneg': 'on'}, " - "'Ethernet120': {'lanes': '97,98,99,100', 'description': 'ARISTA03T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/120', 'admin_status': 'up', 'autoneg': 'on'}, " - "'Ethernet124': {'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1'}}" + "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none', 'speed': '40000'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/20', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet24': {'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/24', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet28': {'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/28', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet32': {'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/32', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet36': {'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/36', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet40': {'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/40', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet44': {'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/44', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet48': {'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/48', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet52': {'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/52', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet56': {'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/56', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet60': {'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/60', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet64': {'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/64', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet68': {'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/68', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet72': {'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/72', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet76': {'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/76', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet80': {'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/80', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet84': {'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/84', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet88': {'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/88', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet92': {'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/92', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet96': {'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/96', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet100': {'lanes': '125,126,127,128', 'description': 'Servers100:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/100', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet104': {'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet108': {'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet112': {'lanes': '89,90,91,92', 'description': 'ARISTA01T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/112', 'admin_status': 'up', 'autoneg': 'on', 'speed': '40000'}, " + "'Ethernet116': {'lanes': '93,94,95,96', 'description': 'ARISTA02T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/116', 'admin_status': 'up', 'autoneg': 'on', 'speed': '40000'}, " + "'Ethernet120': {'lanes': '97,98,99,100', 'description': 'ARISTA03T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/120', 'admin_status': 'up', 'autoneg': 'on', 'speed': '40000'}, " + "'Ethernet124': {'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1', 'speed': '100000'}}" ) ) @@ -532,34 +538,34 @@ def test_minigraph_neighbor_interfaces(self): "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'server1:port1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000', 'autoneg': 'on', 'mux_cable': 'true'}, " "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '40000', 'autoneg': 'on', 'mux_cable': 'true'}, " "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '10000', 'autoneg': 'on'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100'}}" + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}}" ) ) @@ -575,34 +581,34 @@ def test_minigraph_neighbor_interfaces_config_db(self): "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'server1:port1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000', 'autoneg': 'on', 'mux_cable': 'true'}, " "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '40000', 'autoneg': 'on', 'mux_cable': 'true'}, " "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '10000', 'autoneg': 'on'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100'}}" + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}}" ) ) @@ -619,33 +625,33 @@ def test_minigraph_extra_ethernet_interfaces(self, **kwargs): "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " "'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '100000', 'description': 'Interface description'}, " "'Ethernet16': {'lanes': '41,42,43,44', 'pfc_asym': 'off', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'speed': '1000'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100'}}" + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}}" ) ) @@ -702,7 +708,10 @@ def test_minigraph_bgp_voq_chassis_peer(self): self.assertEqual(output.strip(), "") def test_minigraph_sub_port_intf_hwsku(self, check_stderr=True): - self.verify_sub_intf(graph_file=self.sample_backend_graph, check_stderr=check_stderr) + self.verify_sub_intf(graph_file=self.sample_resource_graph, check_stderr=check_stderr) + + def test_minigraph_sub_port_intf_resource_type_non_backend_tor(self, check_stderr=True): + self.verify_sub_intf_non_backend_tor(graph_file=self.sample_resource_graph, check_stderr=check_stderr) def test_minigraph_sub_port_intf_sub(self, check_stderr=True): self.verify_sub_intf(graph_file=self.sample_subintf_graph, check_stderr=check_stderr) @@ -734,6 +743,14 @@ def verify_no_vlan_member(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{}") + def verify_sub_intf_non_backend_tor(self, **kwargs): + graph_file = kwargs.get('graph_file', self.sample_graph_simple) + + # All the other tables stay unchanged + self.test_var_json_data(graph_file=graph_file) + self.test_minigraph_vlans(graph_file=graph_file) + self.test_minigraph_vlan_members(graph_file=graph_file) + def verify_sub_intf(self, **kwargs): graph_file = kwargs.get('graph_file', self.sample_graph_simple) check_stderr = kwargs.get('check_stderr', True) @@ -881,7 +898,9 @@ def test_minigraph_voq_inband_port(self): 'mtu': '9100', 'tpid': '0x8100', 'pfc_asym': 'off', - 'admin_status': 'up' + 'admin_status': 'up', + 'fec': 'rs', + 'speed': '100000' } ) diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index 773772df2bcd..1e0947671046 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -2,6 +2,7 @@ sai_trap_group_priority use_all_splithorizon_groups riot_enable sai_tunnel_support +sai_tunnel_underlay_route_mode riot_overlay_l3_intf_mem_size riot_overlay_l3_egress_mem_size l3_ecmp_levels diff --git a/src/sonic-host-services/scripts/hostcfgd b/src/sonic-host-services/scripts/hostcfgd index 5b6693fbcdf7..7f8f4be0b2e7 100755 --- a/src/sonic-host-services/scripts/hostcfgd +++ b/src/sonic-host-services/scripts/hostcfgd @@ -11,8 +11,7 @@ import signal import jinja2 from sonic_py_common import device_info -from swsscommon.swsscommon import SubscriberStateTable, DBConnector, Select -from swsscommon.swsscommon import ConfigDBConnector, TableConsumable, Table +from swsscommon.swsscommon import ConfigDBConnector, DBConnector, Table # FILE PAM_AUTH_CONF = "/etc/pam.d/common-auth-sonic" @@ -207,21 +206,23 @@ class FeatureHandler(object): else: self.resync_feature_state(self._cached_config[feature_name]) - def sync_state_field(self): + def sync_state_field(self, feature_table): """ Summary: Updates the state field in the FEATURE|* tables as the state field might have to be rendered based on DEVICE_METADATA table """ - feature_table = self._config_db.get_table('FEATURE') for feature_name in feature_table.keys(): if not feature_name: syslog.syslog(syslog.LOG_WARNING, "Feature is None") continue feature = Feature(feature_name, feature_table[feature_name], self._device_config) - if not feature.compare_state(feature_name, feature_table.get(feature_name, {})): - self.resync_feature_state(feature) + + self._cached_config.setdefault(feature_name, feature) + self.update_feature_auto_restart(feature, feature_name) + self.update_feature_state(feature) + self.resync_feature_state(feature) def update_feature_state(self, feature): cached_feature = self._cached_config[feature.name] @@ -406,6 +407,10 @@ class Iptables(object): ''' return (isinstance(key, tuple)) + def load(self, lpbk_table): + for row in lpbk_table: + self.iptables_handler(row, lpbk_table[row]) + def command(self, chain, ip, ver, op): cmd = 'iptables' if ver == '4' else 'ip6tables' cmd += ' -t mangle --{} {} -p tcp --tcp-flags SYN SYN'.format(op, chain) @@ -890,15 +895,13 @@ class KdumpCfg(object): memory = self.kdump_defaults["memory"] if data.get("memory") is not None: memory = data.get("memory") - if data.get("memory") is not None: - run_cmd("sonic-kdump-config --memory " + memory) + run_cmd("sonic-kdump-config --memory " + memory) # Num dumps num_dumps = self.kdump_defaults["num_dumps"] if data.get("num_dumps") is not None: num_dumps = data.get("num_dumps") - if data.get("num_dumps") is not None: - run_cmd("sonic-kdump-config --num_dumps " + num_dumps) + run_cmd("sonic-kdump-config --num_dumps " + num_dumps) class NtpCfg(object): """ @@ -912,6 +915,15 @@ class NtpCfg(object): self.ntp_global = {} self.ntp_servers = set() + def load(self, ntp_global_conf, ntp_server_conf): + syslog.syslog(syslog.LOG_INFO, "NtpCfg load ...") + + for row in ntp_global_conf: + self.ntp_global_update(row, ntp_global_conf[row], is_load=True) + + # Force reload on init + self.ntp_server_update(0, None, is_load=True) + def handle_ntp_source_intf_chg(self, intf_name): # if no ntp server configured, do nothing if not self.ntp_servers: @@ -925,7 +937,7 @@ class NtpCfg(object): cmd = 'systemctl restart ntp-config' run_cmd(cmd) - def ntp_global_update(self, key, data): + def ntp_global_update(self, key, data, is_load=False): syslog.syslog(syslog.LOG_INFO, 'NTP GLOBAL Update') orig_src = self.ntp_global.get('src_intf', '') orig_src_set = set(orig_src.split(";")) @@ -938,6 +950,9 @@ class NtpCfg(object): # Update the Local Cache self.ntp_global = data + # If initial load don't restart daemon + if is_load: return + # check if ntp server configured, if not, do nothing if not self.ntp_servers: syslog.syslog(syslog.LOG_INFO, "No ntp server when global config change, do nothing") @@ -954,16 +969,19 @@ class NtpCfg(object): cmd = 'service ntp restart' run_cmd(cmd) - def ntp_server_update(self, key, op): + def ntp_server_update(self, key, op, is_load=False): syslog.syslog(syslog.LOG_INFO, 'ntp server update key {}'.format(key)) restart_config = False - if op == "SET" and key not in self.ntp_servers: - restart_config = True - self.ntp_servers.add(key) - elif op == "DEL" and key in self.ntp_servers: + if not is_load: + if op == "SET" and key not in self.ntp_servers: + restart_config = True + self.ntp_servers.add(key) + elif op == "DEL" and key in self.ntp_servers: + restart_config = True + self.ntp_servers.remove(key) + else: restart_config = True - self.ntp_servers.remove(key) if restart_config: cmd = 'systemctl restart ntp-config' @@ -1034,31 +1052,24 @@ class HostConfigDaemon: # before moving forward self.config_db = ConfigDBConnector() self.config_db.connect(wait_for_init=True, retry_on=True) - self.dbconn = DBConnector(CFG_DB, 0) - self.state_db_conn = DBConnector(STATE_DB, 0) - self.selector = Select() syslog.syslog(syslog.LOG_INFO, 'ConfigDB connect success') - self.select = Select() - self.callbacks = dict() - self.subscriber_map = dict() - - feature_state_table = Table(self.state_db_conn, 'FEATURE') - # Load DEVICE metadata configurations self.device_config = {} self.device_config['DEVICE_METADATA'] = self.config_db.get_table('DEVICE_METADATA') + # Load feature state table + self.state_db_conn = DBConnector(STATE_DB, 0) + feature_state_table = Table(self.state_db_conn, 'FEATURE') + # Initialize KDump Config and set the config to default if nothing is provided self.kdumpCfg = KdumpCfg(self.config_db) - self.kdumpCfg.load(self.config_db.get_table('KDUMP')) # Initialize IpTables self.iptables = Iptables() # Intialize Feature Handler self.feature_handler = FeatureHandler(self.config_db, feature_state_table, self.device_config) - self.feature_handler.sync_state_field() # Initialize Ntp Config Handler self.ntpcfg = NtpCfg() @@ -1073,21 +1084,28 @@ class HostConfigDaemon: self.pamLimitsCfg = PamLimitsCfg(self.config_db) self.pamLimitsCfg.update_config_file() - def load(self): - aaa = self.config_db.get_table('AAA') - tacacs_global = self.config_db.get_table('TACPLUS') - tacacs_server = self.config_db.get_table('TACPLUS_SERVER') - radius_global = self.config_db.get_table('RADIUS') - radius_server = self.config_db.get_table('RADIUS_SERVER') + def load(self, init_data): + features = init_data['FEATURE'] + aaa = init_data['AAA'] + tacacs_global = init_data['TACPLUS'] + tacacs_server = init_data['TACPLUS_SERVER'] + radius_global = init_data['RADIUS'] + radius_server = init_data['RADIUS_SERVER'] + lpbk_table = init_data['LOOPBACK_INTERFACE'] + ntp_server = init_data['NTP_SERVER'] + ntp_global = init_data['NTP'] + kdump = init_data['KDUMP'] + + self.feature_handler.sync_state_field(features) self.aaacfg.load(aaa, tacacs_global, tacacs_server, radius_global, radius_server) + self.iptables.load(lpbk_table) + self.ntpcfg.load(ntp_global, ntp_server) + self.kdumpCfg.load(kdump) - try: - dev_meta = self.config_db.get_table('DEVICE_METADATA') - if 'localhost' in dev_meta: - if 'hostname' in dev_meta['localhost']: - self.hostname_cache = dev_meta['localhost']['hostname'] - except Exception as e: - pass + dev_meta = self.config_db.get_table('DEVICE_METADATA') + if 'localhost' in dev_meta: + if 'hostname' in dev_meta['localhost']: + self.hostname_cache = dev_meta['localhost']['hostname'] # Update AAA with the hostname self.aaacfg.hostname_update(self.hostname_cache) @@ -1181,40 +1199,38 @@ class HostConfigDaemon: systemctl_cmd = "sudo systemctl is-system-running --wait --quiet" subprocess.call(systemctl_cmd, shell=True) - def subscribe(self, table, callback, pri): - try: - if table not in self.callbacks: - self.callbacks[table] = [] - subscriber = SubscriberStateTable(self.dbconn, table, TableConsumable.DEFAULT_POP_BATCH_SIZE, pri) - self.selector.addSelectable(subscriber) # Add to the Selector - self.subscriber_map[subscriber.getFd()] = (subscriber, table) # Maintain a mapping b/w subscriber & fd + def register_callbacks(self): - self.callbacks[table].append(callback) - except Exception as err: - syslog.syslog(syslog.LOG_ERR, "Subscribe to table {} failed with error {}".format(table, err)) + def make_callback(func): + def callback(table, key, data): + if data is None: + op = "DEL" + else: + op = "SET" + return func(key, op, data) + return callback - def register_callbacks(self): - self.subscribe('KDUMP', lambda table, key, op, data: self.kdump_handler(key, op, data), HOSTCFGD_MAX_PRI) + self.config_db.subscribe('KDUMP', make_callback(self.kdump_handler)) # Handle FEATURE updates before other tables - self.subscribe('FEATURE', lambda table, key, op, data: self.feature_handler.handle(key, op, data), HOSTCFGD_MAX_PRI-1) + self.config_db.subscribe('FEATURE', make_callback(self.feature_handler.handle)) # Handle AAA, TACACS and RADIUS related tables - self.subscribe('AAA', lambda table, key, op, data: self.aaa_handler(key, op, data), HOSTCFGD_MAX_PRI-2) - self.subscribe('TACPLUS', lambda table, key, op, data: self.tacacs_global_handler(key, op, data), HOSTCFGD_MAX_PRI-2) - self.subscribe('TACPLUS_SERVER', lambda table, key, op, data: self.tacacs_server_handler(key, op, data), HOSTCFGD_MAX_PRI-2) - self.subscribe('RADIUS', lambda table, key, op, data: self.radius_global_handler(key, op, data), HOSTCFGD_MAX_PRI-2) - self.subscribe('RADIUS_SERVER', lambda table, key, op, data: self.radius_server_handler(key, op, data), HOSTCFGD_MAX_PRI-2) + self.config_db.subscribe('AAA', make_callback(self.aaa_handler)) + self.config_db.subscribe('TACPLUS', make_callback(self.tacacs_global_handler)) + self.config_db.subscribe('TACPLUS_SERVER', make_callback(self.tacacs_server_handler)) + self.config_db.subscribe('RADIUS', make_callback(self.radius_global_handler)) + self.config_db.subscribe('RADIUS_SERVER', make_callback(self.radius_server_handler)) # Handle IPTables configuration - self.subscribe('LOOPBACK_INTERFACE', lambda table, key, op, data: self.lpbk_handler(key, op, data), HOSTCFGD_MAX_PRI-3) + self.config_db.subscribe('LOOPBACK_INTERFACE', make_callback(self.lpbk_handler)) # Handle NTP & NTP_SERVER updates - self.subscribe('NTP', lambda table, key, op, data: self.ntp_global_handler(key, op, data), HOSTCFGD_MAX_PRI-4) - self.subscribe('NTP_SERVER', lambda table, key, op, data: self.ntp_server_handler(key, op, data), HOSTCFGD_MAX_PRI-4) + self.config_db.subscribe('NTP', make_callback(self.ntp_global_handler)) + self.config_db.subscribe('NTP_SERVER', make_callback(self.ntp_server_handler)) # Handle updates to src intf changes in radius - self.subscribe('MGMT_INTERFACE', lambda table, key, op, data: self.mgmt_intf_handler(key, op, data), HOSTCFGD_MAX_PRI-5) - self.subscribe('VLAN_INTERFACE', lambda table, key, op, data: self.vlan_intf_handler(key, op, data), HOSTCFGD_MAX_PRI-5) - self.subscribe('VLAN_SUB_INTERFACE', lambda table, key, op, data: self.vlan_sub_intf_handler(key, op, data), HOSTCFGD_MAX_PRI-5) - self.subscribe('PORTCHANNEL_INTERFACE', lambda table, key, op, data: self.portchannel_intf_handler(key, op, data), HOSTCFGD_MAX_PRI-5) - self.subscribe('INTERFACE', lambda table, key, op, data: self.phy_intf_handler(key, op, data), HOSTCFGD_MAX_PRI-5) - + self.config_db.subscribe('MGMT_INTERFACE', make_callback(self.mgmt_intf_handler)) + self.config_db.subscribe('VLAN_INTERFACE', make_callback(self.vlan_intf_handler)) + self.config_db.subscribe('VLAN_SUB_INTERFACE', make_callback(self.vlan_sub_intf_handler)) + self.config_db.subscribe('PORTCHANNEL_INTERFACE', make_callback(self.portchannel_intf_handler)) + self.config_db.subscribe('INTERFACE', make_callback(self.phy_intf_handler)) + syslog.syslog(syslog.LOG_INFO, "Waiting for systemctl to finish initialization") self.wait_till_system_init_done() @@ -1222,27 +1238,7 @@ class HostConfigDaemon: "systemctl has finished initialization -- proceeding ...") def start(self): - while True: - state, selectable_ = self.selector.select(DEFAULT_SELECT_TIMEOUT) - if state == self.selector.TIMEOUT: - continue - elif state == self.selector.ERROR: - syslog.syslog(syslog.LOG_ERR, - "error returned by select") - continue - - fd = selectable_.getFd() - # Get the Corresponding subscriber & table - subscriber, table = self.subscriber_map.get(fd, (None, "")) - if not subscriber: - syslog.syslog(syslog.LOG_ERR, - "No Subscriber object found for fd: {}, subscriber map: {}".format(fd, subscriber_map)) - continue - key, op, fvs = subscriber.pop() - # Get the registered callback - cbs = self.callbacks.get(table, None) - for callback in cbs: - callback(table, key, op, dict(fvs)) + self.config_db.listen(init_data_handler=self.load) def main(): @@ -1251,7 +1247,6 @@ def main(): signal.signal(signal.SIGHUP, signal_handler) daemon = HostConfigDaemon() daemon.register_callbacks() - daemon.load() daemon.start() if __name__ == "__main__": diff --git a/src/sonic-host-services/scripts/sonic-host-server b/src/sonic-host-services/scripts/sonic-host-server index a9fdc2eb25fd..bf4449e34eda 100755 --- a/src/sonic-host-services/scripts/sonic-host-server +++ b/src/sonic-host-services/scripts/sonic-host-server @@ -13,9 +13,16 @@ import dbus.mainloop.glib from gi.repository import GObject -def register_modules(): +def find_module_path(): + """Find path for host_moduels""" + try: + from host_modules import host_service + return os.path.dirname(host_service.__file__) + except ImportError as e: + return None + +def register_modules(mod_path): """Register all host modules""" - mod_path = '/usr/local/lib/python3.7/dist-packages/host_modules' sys.path.append(mod_path) for mod_file in glob.glob(os.path.join(mod_path, '*.py')): if os.path.isfile(mod_file) and not mod_file.endswith('__init__.py'): @@ -62,7 +69,9 @@ class SignalManager(object): loop.quit() sigmgr = SignalManager() -register_modules() +mod_path = find_module_path() +if mod_path is not None: + register_modules(mod_path) # Only run if we actually have some handlers if handlers: diff --git a/src/sonic-host-services/setup.py b/src/sonic-host-services/setup.py index 8926e960e311..9ed9e1082a0c 100644 --- a/src/sonic-host-services/setup.py +++ b/src/sonic-host-services/setup.py @@ -24,6 +24,7 @@ ], install_requires = [ 'dbus-python', + 'systemd-python', 'Jinja2>=2.10', 'PyGObject', 'sonic-py-common' diff --git a/src/sonic-host-services/tests/common/mock_configdb.py b/src/sonic-host-services/tests/common/mock_configdb.py index 138869dc3bee..f0b12b11abf9 100644 --- a/src/sonic-host-services/tests/common/mock_configdb.py +++ b/src/sonic-host-services/tests/common/mock_configdb.py @@ -4,9 +4,10 @@ class MockConfigDb(object): """ STATE_DB = None CONFIG_DB = None + event_queue = [] def __init__(self, **kwargs): - pass + self.handlers = {} @staticmethod def set_config_db(test_config_db): @@ -44,73 +45,12 @@ def set_entry(self, key, field, data): def get_table(self, table_name): return MockConfigDb.CONFIG_DB[table_name] + def subscribe(self, table_name, callback): + self.handlers[table_name] = callback -class MockSelect(): - - event_queue = [] - - @staticmethod - def set_event_queue(Q): - MockSelect.event_queue = Q - - @staticmethod - def get_event_queue(): - return MockSelect.event_queue - - @staticmethod - def reset_event_queue(): - MockSelect.event_queue = [] - - def __init__(self): - self.sub_map = {} - self.TIMEOUT = "TIMEOUT" - self.ERROR = "ERROR" - - def addSelectable(self, subscriber): - self.sub_map[subscriber.table] = subscriber - - def select(self, TIMEOUT): - if not MockSelect.get_event_queue(): - raise TimeoutError - table, key = MockSelect.get_event_queue().pop(0) - self.sub_map[table].nextKey(key) - return "OBJECT", self.sub_map[table] - - -class MockSubscriberStateTable(): - - FD_INIT = 0 - - @staticmethod - def generate_fd(): - curr = MockSubscriberStateTable.FD_INIT - MockSubscriberStateTable.FD_INIT = curr + 1 - return curr - - @staticmethod - def reset_fd(): - MockSubscriberStateTable.FD_INIT = 0 - - def __init__(self, conn, table, pop, pri): - self.fd = MockSubscriberStateTable.generate_fd() - self.next_key = '' - self.table = table - - def getFd(self): - return self.fd - - def nextKey(self, key): - self.next_key = key - - def pop(self): - table = MockConfigDb.CONFIG_DB.get(self.table, {}) - if self.next_key not in table: - op = "DEL" - fvs = {} - else: - op = "SET" - fvs = table.get(self.next_key, {}) - return self.next_key, op, fvs + def listen(self, init_data_handler=None): + for e in MockConfigDb.event_queue: + self.handlers[e[0]](e[0], e[1], self.get_entry(e[0], e[1])) class MockDBConnector(): diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py index 9738f16852e5..c08cd1829add 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py @@ -10,8 +10,7 @@ from parameterized import parameterized from unittest import TestCase, mock from tests.hostcfgd.test_radius_vectors import HOSTCFGD_TEST_RADIUS_VECTOR -from tests.common.mock_configdb import MockConfigDb, MockSubscriberStateTable -from tests.common.mock_configdb import MockSelect, MockDBConnector +from tests.common.mock_configdb import MockConfigDb, MockDBConnector test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -33,12 +32,9 @@ # Mock swsscommon classes hostcfgd.ConfigDBConnector = MockConfigDb -hostcfgd.SubscriberStateTable = MockSubscriberStateTable -hostcfgd.Select = MockSelect hostcfgd.DBConnector = MockDBConnector hostcfgd.Table = mock.Mock() - class TestHostcfgdRADIUS(TestCase): """ Test hostcfd daemon - RADIUS diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py index 18bf5c17e6c2..a6478c08dc0d 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py @@ -10,8 +10,7 @@ from parameterized import parameterized from unittest import TestCase, mock from tests.hostcfgd.test_tacacs_vectors import HOSTCFGD_TEST_TACACS_VECTOR -from tests.common.mock_configdb import MockConfigDb, MockSubscriberStateTable -from tests.common.mock_configdb import MockSelect, MockDBConnector +from tests.common.mock_configdb import MockConfigDb, MockDBConnector test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) modules_path = os.path.dirname(test_path) @@ -32,8 +31,6 @@ # Mock swsscommon classes hostcfgd.ConfigDBConnector = MockConfigDb -hostcfgd.SubscriberStateTable = MockSubscriberStateTable -hostcfgd.Select = MockSelect hostcfgd.DBConnector = MockDBConnector hostcfgd.Table = mock.Mock() diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py index db9a35075a02..28d4f6f8a724 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py @@ -8,8 +8,7 @@ from unittest import TestCase, mock from .test_vectors import HOSTCFGD_TEST_VECTOR, HOSTCFG_DAEMON_CFG_DB -from tests.common.mock_configdb import MockConfigDb, MockSubscriberStateTable -from tests.common.mock_configdb import MockSelect, MockDBConnector +from tests.common.mock_configdb import MockConfigDb, MockDBConnector from pyfakefs.fake_filesystem_unittest import patchfs from deepdiff import DeepDiff @@ -24,8 +23,6 @@ hostcfgd_path = os.path.join(scripts_path, 'hostcfgd') hostcfgd = load_module_from_source('hostcfgd', hostcfgd_path) hostcfgd.ConfigDBConnector = MockConfigDb -hostcfgd.SubscriberStateTable = MockSubscriberStateTable -hostcfgd.Select = MockSelect hostcfgd.DBConnector = MockDBConnector hostcfgd.Table = mock.Mock() @@ -122,8 +119,8 @@ def test_hostcfgd_feature_handler(self, test_name, test_data, fs): feature_handler = hostcfgd.FeatureHandler(MockConfigDb(), feature_state_table_mock, device_config) # sync the state field and Handle Feature Updates - feature_handler.sync_state_field() features = MockConfigDb.CONFIG_DB['FEATURE'] + feature_handler.sync_state_field(features) for key, fvs in features.items(): feature_handler.handle(key, 'SET', fvs) @@ -227,7 +224,7 @@ def tearDown(self): @patchfs def test_feature_events(self, fs): fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR) - MockSelect.event_queue = [('FEATURE', 'dhcp_relay'), + MockConfigDb.event_queue = [('FEATURE', 'dhcp_relay'), ('FEATURE', 'mux'), ('FEATURE', 'telemetry')] daemon = hostcfgd.HostConfigDaemon() @@ -258,7 +255,7 @@ def test_feature_events(self, fs): # Change the state to disabled MockConfigDb.CONFIG_DB['FEATURE']['telemetry']['state'] = 'disabled' - MockSelect.event_queue = [('FEATURE', 'telemetry')] + MockConfigDb.event_queue = [('FEATURE', 'telemetry')] try: daemon.start() except TimeoutError: @@ -273,7 +270,7 @@ def test_feature_events(self, fs): def test_loopback_events(self): MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB) - MockSelect.event_queue = [('NTP', 'global'), + MockConfigDb.event_queue = [('NTP', 'global'), ('NTP_SERVER', '0.debian.pool.ntp.org'), ('LOOPBACK_INTERFACE', 'Loopback0|10.184.8.233/32')] daemon = hostcfgd.HostConfigDaemon() @@ -296,8 +293,7 @@ def test_kdump_event(self): MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB) daemon = hostcfgd.HostConfigDaemon() daemon.register_callbacks() - assert MockConfigDb.CONFIG_DB['KDUMP']['config'] - MockSelect.event_queue = [('KDUMP', 'config')] + MockConfigDb.event_queue = [('KDUMP', 'config')] with mock.patch('hostcfgd.subprocess') as mocked_subprocess: popen_mock = mock.Mock() attrs = {'communicate.return_value': ('output', 'error')} diff --git a/src/sonic-mgmt-common b/src/sonic-mgmt-common index d43a607d759d..ec326905356c 160000 --- a/src/sonic-mgmt-common +++ b/src/sonic-mgmt-common @@ -1 +1 @@ -Subproject commit d43a607d759d23f64d681e38d015ce0be886d440 +Subproject commit ec326905356c59aed51c6f6516db5a1b5d8516d6 diff --git a/src/sonic-platform-common b/src/sonic-platform-common index ee122155e0f6..b70e75979f70 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit ee122155e0f6e40b483d24737c5f1b729bdbf111 +Subproject commit b70e75979f704e980a3fb20732642ec99f32b0ee diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 94fa239a7bcf..9ac12bfb4064 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 94fa239a7bcfcab008e94fb5c118b628e4256561 +Subproject commit 9ac12bfb406416b0fb3b03a084d8179bdc53f3a6 diff --git a/src/sonic-restapi b/src/sonic-restapi index bd97dfeb4b45..e83e0e862cc4 160000 --- a/src/sonic-restapi +++ b/src/sonic-restapi @@ -1 +1 @@ -Subproject commit bd97dfeb4b4564defbc10e521ee05bbfe0638315 +Subproject commit e83e0e862cc4e8a2627eaf79f1461e7d7d9a4e75 diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 473c99067c81..c7cbfe80dfcb 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 473c99067c8132f8e5b3f8f2abd672b474b42b5a +Subproject commit c7cbfe80dfcb61deef483f6c99b1c21763134ab1 diff --git a/src/sonic-swss b/src/sonic-swss index d80094b248e7..1fd1dbfe7eaa 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit d80094b248e7df5ac9df309d785ddf21e0ab92d7 +Subproject commit 1fd1dbfe7eaaa52f1d7edbdd2bb88483f031fd5e diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 36e1f61691df..c34a4e1cc733 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 36e1f61691df7aa44782a377e4082cc4380f1018 +Subproject commit c34a4e1cc7332fd7368239206a097478fa1dcc90 diff --git a/src/sonic-yang-mgmt/sonic_yang_ext.py b/src/sonic-yang-mgmt/sonic_yang_ext.py index aa36ee0a1951..d43e52970302 100644 --- a/src/sonic-yang-mgmt/sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/sonic_yang_ext.py @@ -591,18 +591,23 @@ def _xlateListInContainer(self, model, yang, configC, table, exceptionList): """ def _xlateContainerInContainer(self, model, yang, configC, table): ccontainer = model - #print(ccontainer['@name']) - yang[ccontainer['@name']] = dict() - if not configC.get(ccontainer['@name']): + ccName = ccontainer['@name'] + yang[ccName] = dict() + if ccName not in configC: + # Inner container doesn't exist in config return - self.sysLog(msg="xlateProcessListOfContainer: {}".format(ccontainer['@name'])) - self._xlateContainer(ccontainer, yang[ccontainer['@name']], \ - configC[ccontainer['@name']], table) + if len(configC[ccName]) == 0: + # Empty container, clean config and return + del configC[ccName] + return + self.sysLog(msg="xlateProcessListOfContainer: {}".format(ccName)) + self._xlateContainer(ccontainer, yang[ccName], \ + configC[ccName], table) # clean empty container - if len(yang[ccontainer['@name']]) == 0: - del yang[ccontainer['@name']] + if len(yang[ccName]) == 0: + del yang[ccName] # remove copy after processing - del configC[ccontainer['@name']] + del configC[ccName] return 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 3eb396594e80..a13d4c02e9a0 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 @@ -364,5 +364,20 @@ def test_table_with_no_yang(self, sonic_yang_data): return + def test_special_json_with_yang(self, sonic_yang_data): + # in this test, we validate unusual json config and check if + # loadData works successfully + test_file = sonic_yang_data['test_file'] + syc = sonic_yang_data['syc'] + + # read config + jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_SPECIAL_CASE') + jIn = json.loads(jIn) + + # load config and create Data tree + syc.loadData(jIn) + + return + def teardown_class(self): pass diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 429549255824..4ca8d065c6ec 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -143,7 +143,8 @@ def run(self): './yang-models/sonic-tc-queue-map.yang', './yang-models/sonic-pfc-priority-queue-map.yang', './yang-models/sonic-pfc-priority-priority-group-map.yang', - './yang-models/sonic-port-qos-map.yang']), + './yang-models/sonic-port-qos-map.yang', + './yang-models/sonic-macsec.yang']), ('cvlyang-models', ['./cvlyang-models/sonic-acl.yang', './cvlyang-models/sonic-bgp-common.yang', './cvlyang-models/sonic-bgp-global.yang', @@ -194,7 +195,8 @@ 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-port-qos-map.yang']), + './cvlyang-models/sonic-port-qos-map.yang', + './cvlyang-models/sonic-macsec.yang']), ], zip_safe=False, ) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index ff99fc7335df..8c5a8c0af909 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -304,7 +304,7 @@ "switch_id": "2", "switch_type": "voq", "max_cores": "8", - "sub_role": "FrondEnd", + "sub_role": "FrontEnd", "dhcp_server": "disabled" } }, @@ -426,7 +426,8 @@ "admin_status": "up", "index": "0", "asic_port_name": "Eth0-ASIC1", - "role": "Ext" + "role": "Ext", + "macsec": "test" }, "Ethernet1": { "alias": "Eth1/2", @@ -1686,13 +1687,35 @@ "vlan_id": "111", "vsid": "5000" } - } + }, + + "MACSEC_PROFILE": { + "test": { + "priority": "64", + "cipher_suite": "GCM-AES-128", + "primary_cak": "0123456789ABCDEF0123456789ABCDEF", + "primary_ckn": "6162636465666768696A6B6C6D6E6F70", + "fallback_cak": "00000000000000000000000000000000", + "fallback_ckn": "11111111111111111111111111111111", + "policy": "security", + "enable_replay_protect": "true", + "replay_window": "64", + "send_sci": "true", + "rekey_period": "3600" + } + } }, "SAMPLE_CONFIG_DB_UNKNOWN": { "UNKNOWN_TABLE": { "Error": "This Table is for testing, This Table does not have YANG models." } + }, + "SAMPLE_CONFIG_DB_SPECIAL_CASE": { + "TACPLUS": { + "global": { + } + } } } 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 7f0ddd38496f..1c39661d056e 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 @@ -36,6 +36,9 @@ "DEVICE_METADATA_TYPE_CORRECT_PATTERN": { "desc": "DEVICE_METADATA correct value for Type field" }, + "DEVICE_METADATA_TYPE_BMC_MGMT_TOR_PATTERN": { + "desc": "DEVICE_METADATA value as BmcMgmtToRRouter for Type field" + }, "DEVICE_METADATA_TYPE_NOT_PROVISIONED_PATTERN": { "desc": "DEVICE_METADATA value as not-provisioned for Type field" }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/macsec.json b/src/sonic-yang-models/tests/yang_model_tests/tests/macsec.json new file mode 100644 index 000000000000..9d4329e8d7f2 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/macsec.json @@ -0,0 +1,29 @@ +{ + "VALID_PROFILE": { + "desc": "Valid MACsec profile test" + }, + "DUPLICATE_CKN": { + "desc": "Primary CKN equals than fallback CKN", + "eStrKey": "Must" + }, + "INVALID_CAK_LENGTH": { + "desc": "Invalid CAK length", + "eStrKey": "Pattern" + }, + "INVALID_CAK_CHARACTER": { + "desc": "Invalid CAK character", + "eStrKey": "Pattern" + }, + "INVALID_CIPHER_LOWERCASE": { + "desc": "Invalid cipher with lowercase", + "eStrKey": "Pattern" + }, + "MISMATCH_LENGTH_PRIMARY_FALLBACK": { + "desc": "Mismatch length of primary and fallback", + "eStrKey": "Must" + }, + "SET_REPLAY_WINDOW_WHEN_DISABLE_REPLAY_PROTECT": { + "desc": "Set replay window when disable replay protect", + "eStrKey": "When" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json b/src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json index 5236aab596fe..6888a4e3f326 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json @@ -4,7 +4,7 @@ }, "TACPLUS_INVALID_TIMEOUT_TEST": { "desc": "Tacplus global configuration with invalid timeout value in TACPLUS table.", - "eStr": "TACACS timeout must be 1..60" + "eStr": "TACACS timeout must be 1..60" }, "TACPLUS_NOT_PRESENT_SRC_INTF_TEST": { "desc": "Tacplus global configuration with a non existent port in TACPLUS table.", @@ -15,7 +15,7 @@ }, "TACPLUS_SERVER_INVALID_PRIORITY_TEST": { "desc": "Tacplus server configuration with invalid priority value in TACPLUS_SERVER table.", - "eStr": "TACACS server priority must be 1..64" + "eStr": "TACACS server priority must be 1..64" }, "TACPLUS_SERVER_INVALID_TIMEOUT_TEST" : { "desc": "Tacplus server configuration with invalid timeout value in TACPLUS_SERVER table.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json index e3ffa9dc44b6..d112587307e4 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json @@ -9,6 +9,10 @@ "desc": "Configure vlan sub interface must condition false.", "eStrKey": "Must" }, + "VLAN_SUB_INTERFACE_NAME_LENGTH_LIMIT_MUST_CONDITION_FALSE_TEST": { + "desc": "Configure vlan sub interface name length must condition false.", + "eStrKey": "Must" + }, "VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": { "desc": "Configure short name format vlan sub interface must condition false.", "eStrKey": "Must" @@ -16,6 +20,9 @@ "VLAN_SUB_INTERFACE_PO_SHORT_NAME_FORMAT_MUST_CONDITION_TRUE_TEST": { "desc": "Configure valid portchannel short name format vlan sub interface must condition true." }, + "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_TRUE_TEST": { + "desc": "Configure portchannel long name format vlan sub interface must condition true." + }, "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_FALSE_TEST": { "desc": "Configure portchannel long name format vlan sub interface must condition false.", "eStrKey": "Must" 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 a921e9ef41b2..687a745a24c6 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 @@ -54,6 +54,16 @@ } } }, + "DEVICE_METADATA_TYPE_BMC_MGMT_TOR_PATTERN": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65002", + "type": "BmcMgmtToRRouter" + } + } + } + }, "DEVICE_METADATA_TYPE_NOT_PROVISIONED_PATTERN": { "sonic-device_metadata:sonic-device_metadata": { "sonic-device_metadata:DEVICE_METADATA": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/macsec.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/macsec.json new file mode 100644 index 000000000000..cfd7c512a67a --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/macsec.json @@ -0,0 +1,141 @@ +{ + "VALID_PROFILE": { + "sonic-macsec:sonic-macsec": { + "sonic-macsec:MACSEC_PROFILE": { + "MACSEC_PROFILE_LIST": [ + { + "name": "test32", + "priority": 64, + "cipher_suite": "GCM-AES-128", + "primary_cak": "0123456789ABCDEF0123456789ABCDEF", + "primary_ckn": "6162636465666768696A6B6C6D6E6F70", + "fallback_cak": "00000000000000000000000000000000", + "fallback_ckn": "11111111111111111111111111111111", + "policy": "security", + "enable_replay_protect": "true", + "replay_window": 64, + "send_sci": "true", + "rekey_period": 3600 + }, + { + "name": "test64", + "priority": 64, + "cipher_suite": "GCM-AES-XPN-256", + "primary_cak": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", + "primary_ckn": "6162636465666768696A6B6C6D6E6F706162636465666768696A6B6C6D6E6F70", + "fallback_cak": "0000000000000000000000000000000000000000000000000000000000000000", + "fallback_ckn": "1111111111111111111111111111111111111111111111111111111111111111", + "policy": "security", + "enable_replay_protect": "true", + "replay_window": 64, + "send_sci": "true", + "rekey_period": 3600 + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "fec": "rs", + "lanes": "65", + "mtu": 9000, + "pfc_asym": "on", + "name": "Ethernet8", + "tpid": "0x8100", + "speed": 25000, + "macsec": "test32" + } + ] + } + } + }, + "INVALID_CIPHER_LOWERCASE": { + "sonic-macsec:sonic-macsec": { + "sonic-macsec:MACSEC_PROFILE": { + "MACSEC_PROFILE_LIST": [ + { + "name": "test", + "cipher_suite": "gcm-aes-128", + "primary_cak": "0123456789ABCDEF0123456789ABCDEF", + "primary_ckn": "6162636465666768696A6B6C6D6E6F70" + } + ] + } + } + }, + "DUPLICATE_CKN": { + "sonic-macsec:sonic-macsec": { + "sonic-macsec:MACSEC_PROFILE": { + "MACSEC_PROFILE_LIST": [ + { + "name": "test", + "primary_cak": "0123456789ABCDEF0123456789ABCDEF", + "primary_ckn": "6162636465666768696A6B6C6D6E6F70", + "fallback_cak": "0123456789ABCDEF0123456789ABCDEF", + "fallback_ckn": "6162636465666768696A6B6C6D6E6F70" + } + ] + } + } + }, + "INVALID_CAK_LENGTH": { + "sonic-macsec:sonic-macsec": { + "sonic-macsec:MACSEC_PROFILE": { + "MACSEC_PROFILE_LIST": [ + { + "name": "test", + "primary_cak": "0123456789ABCDEF0123456789ABCDEFA", + "primary_ckn": "6162636465666768696A6B6C6D6E6F70A" + } + ] + } + } + }, + "INVALID_CAK_CHARACTER": { + "sonic-macsec:sonic-macsec": { + "sonic-macsec:MACSEC_PROFILE": { + "MACSEC_PROFILE_LIST": [ + { + "name": "test", + "primary_cak": "X123456789ABCDEF0123456789ABCDEF", + "primary_ckn": "X162636465666768696A6B6C6D6E6F70" + } + ] + } + } + }, + "MISMATCH_LENGTH_PRIMARY_FALLBACK": { + "sonic-macsec:sonic-macsec": { + "sonic-macsec:MACSEC_PROFILE": { + "MACSEC_PROFILE_LIST": [ + { + "name": "test", + "primary_cak": "0123456789ABCDEF0123456789ABCDEF", + "primary_ckn": "6162636465666768696A6B6C6D6E6F70", + "fallback_cak": "0000000000000000000000000000000000000000000000000000000000000000", + "fallback_ckn": "1111111111111111111111111111111111111111111111111111111111111111" + } + ] + } + } + }, + "SET_REPLAY_WINDOW_WHEN_DISABLE_REPLAY_PROTECT": { + "sonic-macsec:sonic-macsec": { + "sonic-macsec:MACSEC_PROFILE": { + "MACSEC_PROFILE_LIST": [ + { + "name": "test", + "primary_cak": "0123456789ABCDEF0123456789ABCDEF", + "primary_ckn": "6162636465666768696A6B6C6D6E6F70", + "replay_window": 64 + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json index 8adff73e497c..860de64ba663 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json @@ -95,6 +95,38 @@ } } }, + "VLAN_SUB_INTERFACE_NAME_LENGTH_LIMIT_MUST_CONDITION_FALSE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet12000.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet12000.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet12000", + "admin_status": "up", + "alias": "Ethernet12000/1", + "description": "Ethernet12000", + "lanes": "49,50,51,52", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, "VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": { "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { @@ -177,6 +209,56 @@ } } }, + "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_TRUE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "PortChannel01.8" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "PortChannel01.8", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "tpid": "0x8100", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "members": [ + "Ethernet0" + ], + "min_links": "1", + "mtu": "9100", + "tpid": "0x8100", + "lacp_key": "auto", + "name": "PortChannel01" + } + ] + } + } + }, "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_FALSE_TEST": { "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { 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 618ed19cd81f..17241005861e 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -88,7 +88,7 @@ module sonic-device_metadata { leaf type { type string { length 1..255; - pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|MgmtToRRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR|not-provisioned"; + pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|MgmtToRRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR|BmcMgmtToRRouter|not-provisioned"; } } @@ -129,7 +129,7 @@ module sonic-device_metadata { leaf sub_role { type string; - description "sub_role indicates if ASIC is FrondEnd or BackEnd."; + description "sub_role indicates if ASIC is FrontEnd or BackEnd."; } leaf downstream_subrole { diff --git a/src/sonic-yang-models/yang-models/sonic-macsec.yang b/src/sonic-yang-models/yang-models/sonic-macsec.yang new file mode 100644 index 000000000000..4e3412f86a3d --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-macsec.yang @@ -0,0 +1,116 @@ +module sonic-macsec { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-macsec"; + + prefix macsec; + + import sonic-types { + prefix stypes; + } + + description "MACsec yang Module for SONiC OS"; + + revision 2022-04-12 { + description "First Revision"; + } + + container sonic-macsec { + + container MACSEC_PROFILE { + + description "MACsec profile of config_db.json"; + + list MACSEC_PROFILE_LIST { + + key "name"; + + leaf name { + type string { + length 1..128; + } + } + + leaf priority { + type uint8; + default 255; + } + + leaf cipher_suite { + type string { + pattern "GCM-AES-128|GCM-AES-256|GCM-AES-XPN-128|GCM-AES-XPN-256"; + } + default "GCM-AES-128"; + } + + leaf primary_cak { + type string { + pattern "[0-9a-fA-F]{32}|[0-9a-fA-F]{64}"; + } + mandatory true; + } + + leaf primary_ckn { + type string { + pattern "[0-9a-fA-F]{32}|[0-9a-fA-F]{64}"; + } + mandatory true; + } + + leaf fallback_cak { + type string { + pattern "[0-9a-fA-F]{32}|[0-9a-fA-F]{64}"; + } + } + + leaf fallback_ckn { + type string { + pattern "[0-9a-fA-F]{32}|[0-9a-fA-F]{64}"; + } + } + + must "string-length(primary_cak) = string-length(primary_ckn)"; + + must "string-length(fallback_cak) = string-length(fallback_ckn)"; + + must "string-length(fallback_cak) = string-length(primary_cak)"; + + must "primary_ckn != fallback_ckn"; + + leaf policy { + type string { + pattern "integrity_only|security"; + } + default "security"; + } + + leaf enable_replay_protect { + type stypes:boolean_type; + default "false"; + } + + leaf replay_window { + when "current()/../enable_replay_protect = 'true'"; + type uint32; + } + + leaf send_sci { + type stypes:boolean_type; + default "true"; + } + + leaf rekey_period { + description "The period of proactively refresh (Unit second). + If the value is 0, which means never proactive refresh SAK."; + type uint32; + default 0; + } + + } /* end of list MACSEC_PROFILE_LIST */ + + } /* end of container MACSEC_PROFILE */ + + } /* end of container sonic-macsec */ + +} /* end of module sonic-macsec */ diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index d296eaa05c39..add4de25ce0a 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -13,6 +13,10 @@ module sonic-port{ prefix ext; } + import sonic-macsec { + prefix macsec; + } + description "PORT yang Module for SONiC OS"; revision 2019-07-01 { @@ -153,6 +157,12 @@ module sonic-port{ type boolean; } + leaf macsec { + type leafref { + path "/macsec:sonic-macsec/macsec:MACSEC_PROFILE/macsec:MACSEC_PROFILE_LIST/macsec:name"; + } + } + } /* end of list PORT_LIST */ } /* end of container PORT */ 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 953aa7e14c80..212fb5533c3b 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 @@ -40,11 +40,11 @@ module sonic-vlan-sub-interface { key "name"; leaf name { - must "(substring-before(current(), '.') = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + - "(starts-with(substring-before(current(), '.'), 'Eth') and " + - "concat('Ethernet', substring-after(substring-before(current(), '.'), 'Eth')) = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + - "(starts-with(substring-before(current(), '.'), 'Po') and " + - "concat('PortChannel', substring-after(substring-before(current(), '.'), 'Po')) = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name)" + must "(string-length(current()) <= 15) and " + + "((substring-before(current(), '.') = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + + "(starts-with(substring-before(current(), '.'), 'Eth') and concat('Ethernet', substring-after(substring-before(current(), '.'), 'Eth')) = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + + "(substring-before(current(), '.') = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name) or " + + "(starts-with(substring-before(current(), '.'), 'Po') and concat('PortChannel', substring-after(substring-before(current(), '.'), 'Po')) = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name))" { error-message "Must condition not satisfied, please follow vlan sub interface naming convention"; } diff --git a/src/thrift_0_14_1/Makefile b/src/thrift_0_14_1/Makefile new file mode 100644 index 000000000000..081aff3f34bd --- /dev/null +++ b/src/thrift_0_14_1/Makefile @@ -0,0 +1,28 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e -x + +THRIFT_VERSION = 0.14.1 + +MAIN_TARGET = libthrift0_$(THRIFT_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = libthrift-dev_$(THRIFT_VERSION)_$(CONFIGURED_ARCH).deb \ + python3-thrift_$(THRIFT_VERSION)_$(CONFIGURED_ARCH).deb \ + thrift-compiler_$(THRIFT_VERSION)_$(CONFIGURED_ARCH).deb + +THRIFT_LINK_PRE = https://archive.apache.org/dist/thrift + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf thrift-$(THRIFT_VERSION) + + wget -O "thrift_$(THRIFT_VERSION).tar.gz" "$(THRIFT_LINK_PRE)/$(THRIFT_VERSION)/thrift-$(THRIFT_VERSION).tar.gz" + + tar -xvzf ./thrift_$(THRIFT_VERSION).tar.gz + if [ -f thrift.patch/series ]; then pushd thrift-$(THRIFT_VERSION) && QUILT_PATCHES=../thrift.patch quilt push -a; [ -d .pc ] && rm -rf .pc; popd; fi + + pushd thrift-$(THRIFT_VERSION) + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -d -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/thrift_0_14_1/thrift b/src/thrift_0_14_1/thrift deleted file mode 160000 index f6fa1794539e..000000000000 --- a/src/thrift_0_14_1/thrift +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f6fa1794539e68ac294038ac388d6bde40a6c237 diff --git a/src/thrift_0_14_1/thrift.patch/0003-Remove-minimist-packages.patch b/src/thrift_0_14_1/thrift.patch/0003-Remove-minimist-packages.patch new file mode 100644 index 000000000000..e94b1dfdd38a --- /dev/null +++ b/src/thrift_0_14_1/thrift.patch/0003-Remove-minimist-packages.patch @@ -0,0 +1,268 @@ +From f6fa1794539e68ac294038ac388d6bde40a6c237 Mar 2, 2021 00:00:00 +From: richardyu-ms +Date: Tue, 12 Apr 2022 15:46:16 +0000 +Subject: [PATCH] Fix security issue for package minimist + +--- +3 files changed, 9 insertions(+), 120 deletions(-) + +Index: thrift-0.14.1/lib/js/package-lock.json +=================================================================== +--- thrift-0.14.1.orig/lib/js/package-lock.json ++++ thrift-0.14.1/lib/js/package-lock.json +@@ -1037,16 +1037,7 @@ + "dev": true, + "requires": { + "acorn-node": "^1.6.1", +- "defined": "^1.0.0", +- "minimist": "^1.1.1" +- }, +- "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- } ++ "defined": "^1.0.0" + } + }, + "diffie-hellman": { +@@ -2616,20 +2607,11 @@ + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", +- "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" +- }, +- "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- } + } + }, + "micromatch": { +@@ -2690,12 +2672,6 @@ + "brace-expansion": "^1.1.7" + } + }, +- "minimist": { +- "version": "0.0.8", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", +- "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", +- "dev": true +- }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", +@@ -2721,10 +2697,7 @@ + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", +- "dev": true, +- "requires": { +- "minimist": "0.0.8" +- } ++ "dev": true + }, + "module-deps": { + "version": "6.2.2", +@@ -3971,18 +3944,7 @@ + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", +- "dev": true, +- "requires": { +- "minimist": "^1.1.0" +- }, +- "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- } +- } ++ "dev": true + }, + "supports-color": { + "version": "5.5.0", +Index: thrift-0.14.1/lib/ts/package-lock.json +=================================================================== +--- thrift-0.14.1.orig/lib/ts/package-lock.json ++++ thrift-0.14.1/lib/ts/package-lock.json +@@ -1139,16 +1139,7 @@ + "dev": true, + "requires": { + "acorn-node": "^1.3.0", +- "defined": "^1.0.0", +- "minimist": "^1.1.1" +- }, +- "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- } ++ "defined": "^1.0.0" + } + }, + "diagnostics": { +@@ -3032,20 +3023,11 @@ + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", +- "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" +- }, +- "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- } + } + }, + "micromatch": { +@@ -3121,11 +3103,6 @@ + "brace-expansion": "^1.1.7" + } + }, +- "minimist": { +- "version": "0.0.8", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", +- "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" +- }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", +@@ -3150,10 +3127,7 @@ + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", +- "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", +- "requires": { +- "minimist": "0.0.8" +- } ++ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=" + }, + "module-deps": { + "version": "6.2.0", +@@ -4396,18 +4370,7 @@ + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", +- "dev": true, +- "requires": { +- "minimist": "^1.1.0" +- }, +- "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- } +- } ++ "dev": true + }, + "supports-color": { + "version": "5.5.0", +Index: thrift-0.14.1/package-lock.json +=================================================================== +--- thrift-0.14.1.orig/package-lock.json ++++ thrift-0.14.1/package-lock.json +@@ -1427,16 +1427,7 @@ + "integrity": "sha512-4vGP107UDhhNHeWA5N8j/nUPlQbtB/W/K2x/P7aElbWMWrOkJA0MRSVFsMFrTPSAAjZWCG9uki2+1cQDzFtVcQ==", + "dev": true, + "requires": { +- "html-validator": "3.1.3", +- "minimist": "1.2.0" +- }, +- "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- } ++ "html-validator": "3.1.3" + } + }, + "http-signature": { +@@ -1920,18 +1911,7 @@ + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", + "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", +- "dev": true, +- "requires": { +- "minimist": "^1.2.0" +- }, +- "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- } +- } ++ "dev": true + }, + "jsprim": { + "version": "1.4.1", +@@ -2072,20 +2052,11 @@ + "brace-expansion": "^1.1.7" + } + }, +- "minimist": { +- "version": "0.0.8", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", +- "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", +- "dev": true +- }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", +- "dev": true, +- "requires": { +- "minimist": "0.0.8" +- } ++ "dev": true + }, + "ms": { + "version": "2.0.0", +@@ -2790,7 +2761,6 @@ + "glob": "~7.1.2", + "has": "~1.0.3", + "inherits": "~2.0.3", +- "minimist": "~1.2.0", + "object-inspect": "~1.6.0", + "resolve": "~1.7.1", + "resumer": "~0.0.0", +@@ -2798,12 +2768,6 @@ + "through": "~2.3.8" + }, + "dependencies": { +- "minimist": { +- "version": "1.2.0", +- "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", +- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", +- "dev": true +- }, + "resolve": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", diff --git a/src/thrift_0_14_1/thrift.patch/series b/src/thrift_0_14_1/thrift.patch/series index b95ae481e048..9fe00d007f63 100644 --- a/src/thrift_0_14_1/thrift.patch/series +++ b/src/thrift_0_14_1/thrift.patch/series @@ -1,2 +1,3 @@ 0001-Remove-unneeded-packages.patch 0002-Fix-build-rules.patch +0003-Remove-minimist-packages.patch diff --git a/src/wpasupplicant/sonic-wpa-supplicant b/src/wpasupplicant/sonic-wpa-supplicant index 43611ef88ea5..f36c8c87702f 160000 --- a/src/wpasupplicant/sonic-wpa-supplicant +++ b/src/wpasupplicant/sonic-wpa-supplicant @@ -1 +1 @@ -Subproject commit 43611ef88ea5c87f675cab55e3208c9f16bdd583 +Subproject commit f36c8c87702fa1bc6d1f9b7193872285a41bd630