diff --git a/.azure-pipelines/azure-pipelines-repd-build-variables.yml b/.azure-pipelines/azure-pipelines-repd-build-variables.yml index 7e831109e2ad..d86ef1eaf8a0 100644 --- a/.azure-pipelines/azure-pipelines-repd-build-variables.yml +++ b/.azure-pipelines/azure-pipelines-repd-build-variables.yml @@ -1,5 +1,7 @@ variables: - ${{ if and(ge(variables['Build.SourceBranchName'], '202012'), le(variables['Build.SourceBranchName'], '299999')) }}: + ${{ if eq(variables['Build.Reason'],'PullRequest') }}: + VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=$([ "$(System.PullRequest.TargetBranch)" != "master" ] && echo deb,py2,py3,web,git,docker)' + ${{ elseif ne(variables['Build.SourceBranch'],'master') }}: VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker' - ${{ if or(lt(variables['Build.SourceBranchName'], '202012'), gt(variables['Build.SourceBranchName'], '299999')) }}: + ${{ else }}: VERSION_CONTROL_OPTIONS: '' diff --git a/.gitmodules b/.gitmodules index 3d1a042fb025..c8bbca863dce 100644 --- a/.gitmodules +++ b/.gitmodules @@ -106,3 +106,9 @@ [submodule "src/ptf-py3"] path = src/ptf-py3 url = https://github.com/p4lang/ptf.git +[submodule "src/dhcprelay"] + path = src/dhcprelay + url = https://github.com/sonic-net/sonic-dhcp-relay.git +[submodule "src/sonic-host-services"] + path = src/sonic-host-services + url = https://github.com/sonic-net/sonic-host-services diff --git a/Makefile.work b/Makefile.work index 0428c3cbc553..c9db8b00f81a 100644 --- a/Makefile.work +++ b/Makefile.work @@ -43,6 +43,12 @@ # * ENABLE_AUTO_TECH_SUPPORT: Enable the configuration for event-driven techsupport & coredump mgmt feature # * Default: y # * Values: y,n +# * INCLUDE_BOOTCHART: Install SONiC bootchart +# * Default: y +# * Values: y,n +# * ENABLE_BOOTCHART: Enable SONiC bootchart +# * Default: n +# * Values: y,n # ############################################################################### @@ -98,6 +104,12 @@ ifeq ($(PLATFORM_ARCH),) override PLATFORM_ARCH = $(CONFIGURED_ARCH) endif +ifeq ($(CONFIGURED_ARCH),amd64) +TARGET_BOOTLOADER = grub +else +TARGET_BOOTLOADER = uboot +endif + ifeq ($(BLDENV), bullseye) SLAVE_DIR = sonic-slave-bullseye else ifeq ($(BLDENV), buster) @@ -381,6 +393,8 @@ SONIC_BUILD_INSTRUCTION := make \ ENABLE_AUTO_TECH_SUPPORT=$(ENABLE_AUTO_TECH_SUPPORT) \ BUILD_MULTIASIC_KVM=$(BUILD_MULTIASIC_KVM) \ ENABLE_ASAN=$(ENABLE_ASAN) \ + SONIC_INCLUDE_BOOTCHART=$(INCLUDE_BOOTCHART) \ + SONIC_ENABLE_BOOTCHART=$(ENABLE_BOOTCHART) \ ENABLE_FIPS_FEATURE=$(ENABLE_FIPS_FEATURE) \ ENABLE_FIPS=$(ENABLE_FIPS) \ SONIC_SLAVE_DOCKER_DRIVER=$(SONIC_SLAVE_DOCKER_DRIVER) \ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 345fb9b57a5f..1ea865d09d78 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,7 +37,7 @@ resources: ref: master variables: -- template: .azure-pipelines/azure-pipelines-repd-build-variables.yml +- template: .azure-pipelines/azure-pipelines-repd-build-variables.yml@buildimage - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: - template: .azure-pipelines/template-variables.yml - ${{ else }}: @@ -77,7 +77,7 @@ stages: - stage: Test dependsOn: BuildVS - condition: and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), succeeded()) + condition: and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), in(dependencies.BuildVS.result, 'Succeeded', 'SucceededWithIssues')) variables: - name: inventory value: veos_vtb diff --git a/build_debian.sh b/build_debian.sh index a4c1fddca1b8..92ecb7ac1653 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -65,7 +65,7 @@ if [[ -d $FILESYSTEM_ROOT ]]; then fi mkdir -p $FILESYSTEM_ROOT mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR -mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub +mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/grub touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime ## ensure proc is mounted @@ -162,7 +162,7 @@ if [ "$SONIC_ENABLE_SECUREBOOT_SIGNATURE" = "y" ]; then fi echo '[INFO] Signing SONiC linux kernel image' - K=$FILESYSTEM_ROOT/boot/vmlinuz-${LINUX_KERNEL_VERSION}-amd64 + K=$FILESYSTEM_ROOT/boot/vmlinuz-${LINUX_KERNEL_VERSION}-${CONFIGURED_ARCH} sbsign --key $SIGNING_KEY --cert $SIGNING_CERT --output /tmp/${K##*/} ${K} sudo cp -f /tmp/${K##*/} ${K} fi @@ -392,11 +392,17 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in systemd-sysv \ ntp -if [[ $CONFIGURED_ARCH == amd64 ]]; then +if [[ $TARGET_BOOTLOADER == grub ]]; then + if [[ $CONFIGURED_ARCH == amd64 ]]; then + GRUB_PKG=grub-pc-bin + elif [[ $CONFIGURED_ARCH == arm64 ]]; then + GRUB_PKG=grub-efi-arm64-bin + fi + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ - grub-pc-bin + $GRUB_PKG - sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub + sudo mv $FILESYSTEM_ROOT/grub*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/grub fi ## Disable kexec supported reboot which was installed by default @@ -572,7 +578,7 @@ fi ## Update initramfs sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Convert initrd image to u-boot format -if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then +if [[ $TARGET_BOOTLOADER == uboot ]]; then INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-${CONFIGURED_ARCH} if [[ $CONFIGURED_ARCH == armhf ]]; then INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-armmp diff --git a/build_image.sh b/build_image.sh index 69ea4ddf56ca..ddf134e845ce 100755 --- a/build_image.sh +++ b/build_image.sh @@ -84,7 +84,7 @@ generate_onie_installer_image() ## Generate an ONIE installer image ## Note: Don't leave blank between lines. It is single line command. - ./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ + ./onie-mk-demo.sh $CONFIGURED_ARCH $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ installer platform/$TARGET_MACHINE/platform.conf $output_file OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \ $ONIE_INSTALLER_PAYLOAD } @@ -111,7 +111,7 @@ if [ "$IMAGE_TYPE" = "onie" ]; then mkdir -p `dirname $OUTPUT_ONIE_IMAGE` sudo rm -f $OUTPUT_ONIE_IMAGE - generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic" + generate_device_list "./installer/platforms_asic" generate_onie_installer_image @@ -125,7 +125,7 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then mkdir -p `dirname $OUTPUT_RAW_IMAGE` sudo rm -f $OUTPUT_RAW_IMAGE - generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic" + generate_device_list "./installer/platforms_asic" generate_onie_installer_image "$tmp_output_onie_image" @@ -159,7 +159,7 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then elif [ "$IMAGE_TYPE" = "kvm" ]; then - generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic" + generate_device_list "./installer/platforms_asic" generate_onie_installer_image # Generate single asic KVM image diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/config.bcm.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/config.bcm.j2 index 3f81bfcc9951..6cc4540921e4 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/config.bcm.j2 +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/config.bcm.j2 @@ -9,6 +9,7 @@ sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ l3_alpm_hit_skip=1 sai_adjust_acl_drop_in_rx_drop=1 +sai_verify_incoming_chksum=0 {{ map_prio }} host_as_route_disable=1 use_all_splithorizon_groups=1 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/config.bcm.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/config.bcm.j2 index da09c09b167e..a68ff78bab3c 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/config.bcm.j2 +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/config.bcm.j2 @@ -9,6 +9,7 @@ sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ l3_alpm_hit_skip=1 sai_adjust_acl_drop_in_rx_drop=1 +sai_verify_incoming_chksum=0 {{ map_prio }} host_as_route_disable=1 use_all_splithorizon_groups=1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/BALANCED b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/BALANCED new file mode 120000 index 000000000000..87afd08ffcd8 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th/gen/BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/RDMA-CENTRIC b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/RDMA-CENTRIC new file mode 120000 index 000000000000..a05581efb9ff --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/RDMA-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/TCP-CENTRIC b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/TCP-CENTRIC new file mode 120000 index 000000000000..dd9cf046c0f9 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/TCP-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffer_ports_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffer_ports_t0.j2 new file mode 100644 index 000000000000..2f41924b4fcf --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffer_ports_t0.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,128,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffer_ports_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffer_ports_t1.j2 new file mode 100644 index 000000000000..2f41924b4fcf --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffer_ports_t1.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,128,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 deleted file mode 100644 index 1876253b33c2..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 +++ /dev/null @@ -1,47 +0,0 @@ - -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,128,4) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 deleted file mode 100644 index e1a7200cc57f..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 +++ /dev/null @@ -1,47 +0,0 @@ - -{%- set default_cable = '40m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,128,4) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..c25cc95d6d57 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini deleted file mode 100644 index 673df369a9bb..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 0 2288 - 25000 5m 1248 2288 53248 0 2288 - 40000 5m 1248 2288 66560 0 2288 - 50000 5m 1248 2288 90272 0 2288 - 100000 5m 1248 2288 165568 0 2288 - 10000 40m 1248 2288 37024 0 2288 - 25000 40m 1248 2288 53248 0 2288 - 40000 40m 1248 2288 71552 0 2288 - 50000 40m 1248 2288 96096 0 2288 - 100000 40m 1248 2288 177632 0 2288 - 10000 300m 1248 2288 46176 0 2288 - 25000 300m 1248 2288 79040 0 2288 - 40000 300m 1248 2288 108160 0 2288 - 50000 300m 1248 2288 141856 0 2288 - 100000 300m 1248 2288 268736 0 2288 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 deleted file mode 100644 index 34002048afdb..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{%- macro generate_wred_profiles() %} - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable" : "true", - "wred_yellow_enable" : "true", - "wred_red_enable" : "true", - "ecn" : "ecn_all", - "green_max_threshold" : "2097152", - "green_min_threshold" : "250000", - "yellow_max_threshold" : "2097152", - "yellow_min_threshold" : "1048576", - "red_max_threshold" : "2097152", - "red_min_threshold" : "1048576", - "green_drop_probability" : "5", - "yellow_drop_probability": "5", - "red_drop_probability" : "5" - } - }, -{%- endmacro %} - -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 new file mode 120000 index 000000000000..aef6b6765cf2 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/BALANCED b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/BALANCED new file mode 120000 index 000000000000..87afd08ffcd8 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th/gen/BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/RDMA-CENTRIC b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/RDMA-CENTRIC new file mode 120000 index 000000000000..a05581efb9ff --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/RDMA-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/TCP-CENTRIC b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/TCP-CENTRIC new file mode 120000 index 000000000000..dd9cf046c0f9 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/TCP-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffer_ports_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffer_ports_t0.j2 new file mode 100644 index 000000000000..a3c33da63990 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffer_ports_t0.j2 @@ -0,0 +1,21 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,6) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(10,22) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(26,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(6,10) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(22,26) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 deleted file mode 100644 index f7d50aa4f35e..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 +++ /dev/null @@ -1,61 +0,0 @@ -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,6) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(10,22) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(26,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(6,10) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(22,26) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini deleted file mode 100644 index 0b5d680edda7..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 0 2288 - 25000 5m 1248 2288 53248 0 2288 - 40000 5m 1248 2288 66560 0 2288 - 50000 5m 1248 2288 79872 0 2288 - 100000 5m 1248 2288 165568 0 2288 - 10000 40m 1248 2288 37024 0 2288 - 25000 40m 1248 2288 56160 0 2288 - 40000 40m 1248 2288 71552 0 2288 - 50000 40m 1248 2288 85696 0 2288 - 100000 40m 1248 2288 177632 0 2288 - 10000 300m 1248 2288 46176 0 2288 - 25000 300m 1248 2288 79040 0 2288 - 40000 300m 1248 2288 108160 0 2288 - 50000 300m 1248 2288 141856 0 2288 - 100000 300m 1248 2288 268736 0 2288 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 deleted file mode 100644 index 34002048afdb..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{%- macro generate_wred_profiles() %} - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable" : "true", - "wred_yellow_enable" : "true", - "wred_red_enable" : "true", - "ecn" : "ecn_all", - "green_max_threshold" : "2097152", - "green_min_threshold" : "250000", - "yellow_max_threshold" : "2097152", - "yellow_min_threshold" : "1048576", - "red_max_threshold" : "2097152", - "red_min_threshold" : "1048576", - "green_drop_probability" : "5", - "yellow_drop_probability": "5", - "red_drop_probability" : "5" - } - }, -{%- endmacro %} - -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 new file mode 120000 index 000000000000..aef6b6765cf2 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/BALANCED b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/BALANCED new file mode 120000 index 000000000000..87afd08ffcd8 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th/gen/BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/RDMA-CENTRIC b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/RDMA-CENTRIC new file mode 120000 index 000000000000..0c839e1e907b --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/RDMA-CENTRIC/ \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/TCP-CENTRIC b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/TCP-CENTRIC new file mode 120000 index 000000000000..dd9cf046c0f9 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/TCP-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffer_ports_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffer_ports_t0.j2 new file mode 100644 index 000000000000..599db74c1da5 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffer_ports_t0.j2 @@ -0,0 +1,7 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffers_defaults_t0.j2 deleted file mode 100644 index 2b6f72b6dc93..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffers_defaults_t0.j2 +++ /dev/null @@ -1,46 +0,0 @@ -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "11213696", - "type": "ingress", - "mode": "dynamic", - "xoff": "3855488" - }, - "egress_lossy_pool": { - "size": "9532224", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/pg_profile_lookup.ini deleted file mode 100644 index 7222f8014925..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 -4 2288 - 25000 5m 1248 2288 53248 -4 2288 - 40000 5m 1248 2288 66560 -4 2288 - 50000 5m 1248 2288 79872 -4 2288 - 100000 5m 1248 2288 165568 -4 2288 - 10000 40m 1248 2288 37024 -4 2288 - 25000 40m 1248 2288 56160 -4 2288 - 40000 40m 1248 2288 71552 -4 2288 - 50000 40m 1248 2288 85696 -4 2288 - 100000 40m 1248 2288 177632 -4 2288 - 10000 300m 1248 2288 46176 -4 2288 - 25000 300m 1248 2288 79040 -4 2288 - 40000 300m 1248 2288 108160 -4 2288 - 50000 300m 1248 2288 131456 -4 2288 - 100000 300m 1248 2288 268736 -4 2288 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/qos.json.j2 deleted file mode 100644 index 3e548325ea30..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/qos.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/qos.json.j2 new file mode 120000 index 000000000000..aef6b6765cf2 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/BALANCED b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/BALANCED new file mode 120000 index 000000000000..87afd08ffcd8 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th/gen/BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/RDMA-CENTRIC b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/RDMA-CENTRIC new file mode 120000 index 000000000000..a05581efb9ff --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/RDMA-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/TCP-CENTRIC b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/TCP-CENTRIC new file mode 120000 index 000000000000..dd9cf046c0f9 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/TCP-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffer_ports_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffer_ports_t0.j2 new file mode 100644 index 000000000000..2f41924b4fcf --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffer_ports_t0.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,128,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffer_ports_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffer_ports_t1.j2 new file mode 100644 index 000000000000..2f41924b4fcf --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffer_ports_t1.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,128,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 deleted file mode 100644 index 1876253b33c2..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 +++ /dev/null @@ -1,47 +0,0 @@ - -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,128,4) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 deleted file mode 100644 index e1a7200cc57f..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 +++ /dev/null @@ -1,47 +0,0 @@ - -{%- set default_cable = '40m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,128,4) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..c25cc95d6d57 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini deleted file mode 100644 index 673df369a9bb..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 0 2288 - 25000 5m 1248 2288 53248 0 2288 - 40000 5m 1248 2288 66560 0 2288 - 50000 5m 1248 2288 90272 0 2288 - 100000 5m 1248 2288 165568 0 2288 - 10000 40m 1248 2288 37024 0 2288 - 25000 40m 1248 2288 53248 0 2288 - 40000 40m 1248 2288 71552 0 2288 - 50000 40m 1248 2288 96096 0 2288 - 100000 40m 1248 2288 177632 0 2288 - 10000 300m 1248 2288 46176 0 2288 - 25000 300m 1248 2288 79040 0 2288 - 40000 300m 1248 2288 108160 0 2288 - 50000 300m 1248 2288 141856 0 2288 - 100000 300m 1248 2288 268736 0 2288 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 deleted file mode 100644 index 34002048afdb..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{%- macro generate_wred_profiles() %} - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable" : "true", - "wred_yellow_enable" : "true", - "wred_red_enable" : "true", - "ecn" : "ecn_all", - "green_max_threshold" : "2097152", - "green_min_threshold" : "250000", - "yellow_max_threshold" : "2097152", - "yellow_min_threshold" : "1048576", - "red_max_threshold" : "2097152", - "red_min_threshold" : "1048576", - "green_drop_probability" : "5", - "yellow_drop_probability": "5", - "red_drop_probability" : "5" - } - }, -{%- endmacro %} - -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 new file mode 120000 index 000000000000..aef6b6765cf2 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/BALANCED b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/BALANCED new file mode 120000 index 000000000000..a270c70ffc36 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/RDMA-CENTRIC b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/RDMA-CENTRIC new file mode 120000 index 000000000000..8d1ec6d277a8 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/RDMA-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/TCP-CENTRIC b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/TCP-CENTRIC new file mode 120000 index 000000000000..7ee783aac6a4 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/TCP-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffer_ports_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffer_ports_t0.j2 new file mode 100644 index 000000000000..2d56c4b38f9e --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffer_ports_t0.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffer_ports_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffer_ports_t1.j2 new file mode 100644 index 000000000000..2d56c4b38f9e --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffer_ports_t1.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t0.j2 deleted file mode 100644 index bee86a9b3a85..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t0.j2 +++ /dev/null @@ -1,56 +0,0 @@ -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- import 'buffers_pool_sizes_t0.j2' as defs with context %} -{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} -{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic", - "xoff": "7827456" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "42349632", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "static_th":"44302336" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "static_th":"42349632" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1664", - "dynamic_th":"-1" - } - }, -{%- endmacro %} - -{% import 'buffers_extra_queues.j2' as defs with context %} - -{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} -{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 deleted file mode 100644 index 469f5fc4001a..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 +++ /dev/null @@ -1,66 +0,0 @@ -{%- set default_cable = '300m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- import 'buffers_pool_sizes_t1.j2' as defs with context %} -{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} -{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {# SS Tab2 Row 71 #} - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic", - {# SS Tab2 Row 68 #} - "xoff": "8965632" - }, - "egress_lossy_pool": { - {# SS Tab2 Row 60 #} - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - {# SS Tab2 Row 56 #} - "size": "43481152", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - {# SS Tab1 Row 9 #} - "static_th":"44302336" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - {# SS Tab2 Row 56 #} - "static_th":"43481152" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1664", - "dynamic_th":"-1" - } - }, -{%- endmacro %} - -{% import 'buffers_extra_queues.j2' as defs1 with context %} -{% import 'buffers_extra_pgs.j2' as defs2 with context %} - -{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} -{{ defs1.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} -{%- endmacro %} -{%- macro generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) %} -{{ defs2.generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) }} -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..c25cc95d6d57 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini deleted file mode 100644 index 0e71479fc2c2..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini +++ /dev/null @@ -1,8 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 100000 5m 1248 1248 54080 -3 2496 - 100000 40m 1248 1248 59696 -3 2496 - 100000 300m 1248 1248 101088 -3 2496 - 40000 5m 1248 1248 29536 -3 2496 - 40000 40m 1248 1248 31616 -3 2496 - 40000 300m 1248 1248 48256 -3 2496 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 deleted file mode 100644 index cb3ad17faa39..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 +++ /dev/null @@ -1,292 +0,0 @@ -{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %} -{%- macro generate_dscp_to_tc_map() %} - "DSCP_TO_TC_MAP": { - "AZURE": { - "0" : "1", - "1" : "1", - "2" : "2", - "3" : "3", - "4" : "4", - "5" : "1", - "6" : "6", - "7" : "1", - "8" : "0", - "9" : "1", - "10": "1", - "11": "1", - "12": "1", - "13": "1", - "14": "1", - "15": "1", - "16": "1", - "17": "1", - "18": "1", - "19": "1", - "20": "1", - "21": "1", - "22": "1", - "23": "1", - "24": "1", - "25": "1", - "26": "1", - "27": "1", - "28": "1", - "29": "1", - "30": "1", - "31": "1", - "32": "1", - "33": "1", - "34": "1", - "35": "1", - "36": "1", - "37": "1", - "38": "1", - "39": "1", - "40": "1", - "41": "1", - "42": "1", - "43": "1", - "44": "1", - "45": "1", - "46": "5", - "47": "1", - "48": "7", - "49": "1", - "50": "1", - "51": "1", - "52": "1", - "53": "1", - "54": "1", - "55": "1", - "56": "1", - "57": "1", - "58": "1", - "59": "1", - "60": "1", - "61": "1", - "62": "1", - "63": "1" - } - }, -{%- endmacro %} -{%- macro generate_tc_to_pg_map() %} - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "0", - "2": "2", - "3": "3", - "4": "4", - "5": "0", - "6": "6", - "7": "0" - } - }, -{%- endmacro %} -{% elif ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR') %} -{%- macro generate_dscp_to_tc_map() %} - "DSCP_TO_TC_MAP": { - "AZURE": { - "0" : "1", - "1" : "1", - "2" : "1", - "3" : "3", - "4" : "4", - "5" : "1", - "6" : "1", - "7" : "1", - "8" : "0", - "9" : "1", - "10": "1", - "11": "1", - "12": "1", - "13": "1", - "14": "1", - "15": "1", - "16": "1", - "17": "1", - "18": "1", - "19": "1", - "20": "1", - "21": "1", - "22": "1", - "23": "1", - "24": "1", - "25": "1", - "26": "1", - "27": "1", - "28": "1", - "29": "1", - "30": "1", - "31": "1", - "32": "1", - "33": "8", - "34": "1", - "35": "1", - "36": "1", - "37": "1", - "38": "1", - "39": "1", - "40": "1", - "41": "1", - "42": "1", - "43": "1", - "44": "1", - "45": "1", - "46": "5", - "47": "1", - "48": "7", - "49": "1", - "50": "1", - "51": "1", - "52": "1", - "53": "1", - "54": "1", - "55": "1", - "56": "1", - "57": "1", - "58": "1", - "59": "1", - "60": "1", - "61": "1", - "62": "1", - "63": "1" - }, - "AZURE_TUNNEL": { - "0" : "1", - "1" : "1", - "2" : "1", - "3" : "3", - "4" : "4", - "5" : "1", - "6" : "1", - "7" : "1", - "8" : "0", - "9" : "1", - "10": "1", - "11": "1", - "12": "1", - "13": "1", - "14": "1", - "15": "1", - "16": "1", - "17": "1", - "18": "1", - "19": "1", - "20": "1", - "21": "1", - "22": "1", - "23": "1", - "24": "1", - "25": "1", - "26": "1", - "27": "1", - "28": "1", - "29": "1", - "30": "1", - "31": "1", - "32": "1", - "33": "8", - "34": "1", - "35": "1", - "36": "1", - "37": "1", - "38": "1", - "39": "1", - "40": "1", - "41": "1", - "42": "1", - "43": "1", - "44": "1", - "45": "1", - "46": "5", - "47": "1", - "48": "7", - "49": "1", - "50": "1", - "51": "1", - "52": "1", - "53": "1", - "54": "1", - "55": "1", - "56": "1", - "57": "1", - "58": "1", - "59": "1", - "60": "1", - "61": "1", - "62": "1", - "63": "1" - } - }, -{%- endmacro %} -{%- macro generate_tc_to_pg_map() %} - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "0", - "2": "2", - "3": "3", - "4": "4", - "5": "0", - "6": "6", - "7": "0", - "8": "0" - }, - "AZURE_TUNNEL": { - "0": "0", - "1": "0", - "2": "0", - "3": "2", - "4": "6", - "5": "0", - "6": "0", - "7": "0", - "8": "0" - } - }, -{%- endmacro %} -{%- macro generate_tc_to_queue_map() %} - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "1", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "1" - }, - "AZURE_TUNNEL": { - "0": "0", - "1": "1", - "2": "1", - "3": "2", - "4": "6", - "5": "5", - "6": "1", - "7": "7", - "8": "1" - } - }, -{%- endmacro %} -{%- macro generate_tc_to_dscp_map() %} - "TC_TO_DSCP_MAP": { - "AZURE_TUNNEL": { - "0": "8", - "1": "0", - "2": "0", - "3": "2", - "4": "6", - "5": "46", - "6": "0", - "7": "48", - "8": "33" - } - }, -{%- endmacro %} -{% endif %} - -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 new file mode 120000 index 000000000000..aef6b6765cf2 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/BALANCED b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/BALANCED new file mode 120000 index 000000000000..a270c70ffc36 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/RDMA-CENTRIC b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/RDMA-CENTRIC new file mode 120000 index 000000000000..8d1ec6d277a8 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/RDMA-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/TCP-CENTRIC b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/TCP-CENTRIC new file mode 120000 index 000000000000..7ee783aac6a4 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/TCP-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffer_ports_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffer_ports_t0.j2 new file mode 100644 index 000000000000..3e209865c308 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffer_ports_t0.j2 @@ -0,0 +1,14 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,12) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(20,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(12,20) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 deleted file mode 100644 index 5ac1d2d2aef9..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 +++ /dev/null @@ -1,64 +0,0 @@ -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,12) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(20,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(12,20) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- import 'buffers_pool_sizes_t0.j2' as defs with context %} -{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} -{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic", - "xoff": "7827456" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "42349632", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "static_th":"44302336" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "static_th":"42349632" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1664", - "dynamic_th":"-1" - } - }, -{%- endmacro %} - -{% import 'buffers_extra_queues.j2' as defs with context %} - -{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} -{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/pg_profile_lookup.ini deleted file mode 100644 index ed0005610b71..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/pg_profile_lookup.ini +++ /dev/null @@ -1,8 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 50000 5m 1248 1248 56160 -3 2496 - 100000 5m 1248 1248 96928 -3 2496 - 50000 40m 1248 1248 96096 -3 2496 - 100000 40m 1248 1248 177632 -3 2496 - 50000 300m 1248 1248 141856 -3 2496 - 100000 300m 1248 1248 268736 -3 2496 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 index f0ee02749724..aef6b6765cf2 120000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 @@ -1 +1 @@ -../Arista-7260CX3-C64/qos.json.j2 \ No newline at end of file +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/buffers.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/buffers.json.j2 new file mode 100644 index 000000000000..e6e9e844469b --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..178502e287ae --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/buffers_defaults_t0.j2 @@ -0,0 +1,61 @@ +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,12) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(12,20) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(20,44) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(44,52) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(52,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "33329088", + "type": "ingress", + "mode": "dynamic", + "xoff": "7827456" + }, + "egress_lossy_pool": { + "size": "26663272", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "42349632", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"44302336" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"42349632" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1664", + "dynamic_th":"-1" + } + }, +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/pg_profile_lookup.ini new file mode 100644 index 000000000000..ed0005610b71 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/pg_profile_lookup.ini @@ -0,0 +1,8 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 50000 5m 1248 1248 56160 -3 2496 + 100000 5m 1248 1248 96928 -3 2496 + 50000 40m 1248 1248 96096 -3 2496 + 100000 40m 1248 1248 177632 -3 2496 + 50000 300m 1248 1248 141856 -3 2496 + 100000 300m 1248 1248 268736 -3 2496 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/port_config.ini new file mode 100644 index 000000000000..49bd6fd68856 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/port_config.ini @@ -0,0 +1,115 @@ +# name lanes alias index speed +Ethernet0 77,78 Ethernet1/1 1 50000 +Ethernet2 79,80 Ethernet1/3 1 50000 +Ethernet4 65,66 Ethernet2/1 2 50000 +Ethernet6 67,68 Ethernet2/3 2 50000 +Ethernet8 85,86 Ethernet3/1 3 50000 +Ethernet10 87,88 Ethernet3/3 3 50000 +Ethernet12 89,90 Ethernet4/1 4 50000 +Ethernet14 91,92 Ethernet4/3 4 50000 +Ethernet16 109,110 Ethernet5/1 5 50000 +Ethernet18 111,112 Ethernet5/3 5 50000 +Ethernet20 97,98 Ethernet6/1 6 50000 +Ethernet22 99,100 Ethernet6/3 6 50000 +Ethernet24 5,6 Ethernet7/1 7 50000 +Ethernet26 7,8 Ethernet7/3 7 50000 +Ethernet28 13,14 Ethernet8/1 8 50000 +Ethernet30 15,16 Ethernet8/3 8 50000 +Ethernet32 25,26 Ethernet9/1 9 50000 +Ethernet34 27,28 Ethernet9/3 9 50000 +Ethernet36 21,22 Ethernet10/1 10 50000 +Ethernet38 23,24 Ethernet10/3 10 50000 +Ethernet40 37,38 Ethernet11/1 11 50000 +Ethernet42 39,40 Ethernet11/3 11 50000 +Ethernet44 45,46 Ethernet12/1 12 50000 +Ethernet46 47,48 Ethernet12/3 12 50000 +Ethernet48 57,58,59,60 Ethernet13/1 13 100000 +Ethernet52 53,54,55,56 Ethernet14/1 14 100000 +Ethernet56 117,118,119,120 Ethernet15/1 15 100000 +Ethernet60 121,122,123,124 Ethernet16/1 16 100000 +Ethernet64 141,142,143,144 Ethernet17/1 17 100000 +Ethernet68 133,134,135,136 Ethernet18/1 18 100000 +Ethernet72 197,198,199,200 Ethernet19/1 19 100000 +Ethernet76 205,206,207,208 Ethernet20/1 20 100000 +Ethernet80 217,218 Ethernet21/1 21 50000 +Ethernet82 219,220 Ethernet21/3 21 50000 +Ethernet84 213,214 Ethernet22/1 22 50000 +Ethernet86 215,216 Ethernet22/3 22 50000 +Ethernet88 229,230 Ethernet23/1 23 50000 +Ethernet90 231,232 Ethernet23/3 23 50000 +Ethernet92 237,238 Ethernet24/1 24 50000 +Ethernet94 239,240 Ethernet24/3 24 50000 +Ethernet96 249,250 Ethernet25/1 25 50000 +Ethernet98 251,252 Ethernet25/3 25 50000 +Ethernet100 245,246 Ethernet26/1 26 50000 +Ethernet102 247,248 Ethernet26/3 26 50000 +Ethernet104 149,150 Ethernet27/1 27 50000 +Ethernet106 151,152 Ethernet27/3 27 50000 +Ethernet108 153,154 Ethernet28/1 28 50000 +Ethernet110 155,156 Ethernet28/3 28 50000 +Ethernet112 173,174 Ethernet29/1 29 50000 +Ethernet114 175,176 Ethernet29/3 29 50000 +Ethernet116 161,162 Ethernet30/1 30 50000 +Ethernet118 163,164 Ethernet30/3 30 50000 +Ethernet120 181,182 Ethernet31/1 31 50000 +Ethernet122 183,184 Ethernet31/3 31 50000 +Ethernet124 185,186 Ethernet32/1 32 50000 +Ethernet126 187,188 Ethernet32/3 32 50000 +Ethernet128 69,70 Ethernet33/1 33 50000 +Ethernet130 71,72 Ethernet33/3 33 50000 +Ethernet132 73,74 Ethernet34/1 34 50000 +Ethernet134 75,76 Ethernet34/3 34 50000 +Ethernet136 93,94 Ethernet35/1 35 50000 +Ethernet138 95,96 Ethernet35/3 35 50000 +Ethernet140 81,82 Ethernet36/1 36 50000 +Ethernet142 83,84 Ethernet36/3 36 50000 +Ethernet144 101,102 Ethernet37/1 37 50000 +Ethernet146 103,104 Ethernet37/3 37 50000 +Ethernet148 105,106 Ethernet38/1 38 50000 +Ethernet150 107,108 Ethernet38/3 38 50000 +Ethernet152 9,10 Ethernet39/1 39 50000 +Ethernet154 11,12 Ethernet39/3 39 50000 +Ethernet156 1,2 Ethernet40/1 40 50000 +Ethernet158 3,4 Ethernet40/3 40 50000 +Ethernet160 17,18 Ethernet41/1 41 50000 +Ethernet162 19,20 Ethernet41/3 41 50000 +Ethernet164 29,30 Ethernet42/1 42 50000 +Ethernet166 31,32 Ethernet42/3 42 50000 +Ethernet168 41,42 Ethernet43/1 43 50000 +Ethernet170 43,44 Ethernet43/3 43 50000 +Ethernet172 33,34 Ethernet44/1 44 50000 +Ethernet174 35,36 Ethernet44/3 44 50000 +Ethernet176 49,50,51,52 Ethernet45/1 45 100000 +Ethernet180 61,62,63,64 Ethernet46/1 46 100000 +Ethernet184 125,126,127,128 Ethernet47/1 47 100000 +Ethernet188 113,114,115,116 Ethernet48/1 48 100000 +Ethernet192 129,130,131,132 Ethernet49/1 49 100000 +Ethernet196 137,138,139,140 Ethernet50/1 50 100000 +Ethernet200 201,202,203,204 Ethernet51/1 51 100000 +Ethernet204 193,194,195,196 Ethernet52/1 52 100000 +Ethernet208 209,210 Ethernet53/1 53 50000 +Ethernet210 211,212 Ethernet53/3 53 50000 +Ethernet212 221,222 Ethernet54/1 54 50000 +Ethernet214 223,224 Ethernet54/3 54 50000 +Ethernet216 233,234 Ethernet55/1 55 50000 +Ethernet218 235,236 Ethernet55/3 55 50000 +Ethernet220 225,226 Ethernet56/1 56 50000 +Ethernet222 227,228 Ethernet56/3 56 50000 +Ethernet224 241,242 Ethernet57/1 57 50000 +Ethernet226 243,244 Ethernet57/3 57 50000 +Ethernet228 253,254 Ethernet58/1 58 50000 +Ethernet230 255,256 Ethernet58/3 58 50000 +Ethernet232 157,158 Ethernet59/1 59 50000 +Ethernet234 159,160 Ethernet59/3 59 50000 +Ethernet236 145,146 Ethernet60/1 60 50000 +Ethernet238 147,148 Ethernet60/3 60 50000 +Ethernet240 165,166 Ethernet61/1 61 50000 +Ethernet242 167,168 Ethernet61/3 61 50000 +Ethernet244 169,170 Ethernet62/1 62 50000 +Ethernet246 171,172 Ethernet62/3 62 50000 +Ethernet248 189,190 Ethernet63/1 63 50000 +Ethernet250 191,192 Ethernet63/3 63 50000 +Ethernet252 177,178 Ethernet64/1 64 50000 +Ethernet254 179,180 Ethernet64/3 64 50000 +Ethernet256 257 Ethernet65 65 10000 +Ethernet260 259 Ethernet66 66 10000 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/sai.profile b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/sai.profile new file mode 100644 index 000000000000..d18e31d2c2a4 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-a7260cx3-64-96x50G+16x100G.config.bcm diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/th2-a7260cx3-64-96x50G+16x100G.config.bcm b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/th2-a7260cx3-64-96x50G+16x100G.config.bcm new file mode 100644 index 000000000000..91f61f4b24d6 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D96C16/th2-a7260cx3-64-96x50G+16x100G.config.bcm @@ -0,0 +1,922 @@ +PHY_AN_ALLOW_PLL_CHANGE=1 +arl_clean_timeout_usec=15000000 +asf_mem_profile=2 +bcm_num_cos=8 +bcm_stat_flags=1 +bcm_stat_jumbo=9236 +cdma_timeout_usec=15000000 +core_clock_frequency=1700 +dma_desc_timeout_usec=15000000 +dpp_clock_ratio=2:3 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +mem_scan_enable=1 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +pbmp_xport_xe=0xfffffffd3fffffff4fffffffc7ffffffe +#pbmp_xport_xe=0x47fffffff1fffffffcfffffffe7ffffffe +phy_an_allow_pll_change_hg=0 +phy_an_c73=1 +phy_chain_rx_lane_map_physical{1.0}=0x3210 +phy_chain_rx_lane_map_physical{101.0}=0x0123 +phy_chain_rx_lane_map_physical{105.0}=0x0123 +phy_chain_rx_lane_map_physical{109.0}=0x0123 +phy_chain_rx_lane_map_physical{113.0}=0x2301 +phy_chain_rx_lane_map_physical{117.0}=0x3210 +phy_chain_rx_lane_map_physical{121.0}=0x3210 +phy_chain_rx_lane_map_physical{125.0}=0x1203 +phy_chain_rx_lane_map_physical{129.0}=0x3210 +phy_chain_rx_lane_map_physical{13.0}=0x0321 +phy_chain_rx_lane_map_physical{133.0}=0x1032 +phy_chain_rx_lane_map_physical{137.0}=0x3210 +phy_chain_rx_lane_map_physical{141.0}=0x0123 +phy_chain_rx_lane_map_physical{145.0}=0x3210 +phy_chain_rx_lane_map_physical{149.0}=0x2310 +phy_chain_rx_lane_map_physical{153.0}=0x0132 +phy_chain_rx_lane_map_physical{157.0}=0x1302 +phy_chain_rx_lane_map_physical{161.0}=0x3021 +phy_chain_rx_lane_map_physical{165.0}=0x2031 +phy_chain_rx_lane_map_physical{169.0}=0x2031 +phy_chain_rx_lane_map_physical{17.0}=0x3210 +phy_chain_rx_lane_map_physical{173.0}=0x1302 +phy_chain_rx_lane_map_physical{177.0}=0x2031 +phy_chain_rx_lane_map_physical{181.0}=0x0213 +phy_chain_rx_lane_map_physical{185.0}=0x0213 +phy_chain_rx_lane_map_physical{189.0}=0x1302 +phy_chain_rx_lane_map_physical{193.0}=0x3120 +phy_chain_rx_lane_map_physical{197.0}=0x0231 +phy_chain_rx_lane_map_physical{201.0}=0x2031 +phy_chain_rx_lane_map_physical{205.0}=0x0213 +phy_chain_rx_lane_map_physical{209.0}=0x2013 +phy_chain_rx_lane_map_physical{21.0}=0x3021 +phy_chain_rx_lane_map_physical{213.0}=0x3021 +phy_chain_rx_lane_map_physical{217.0}=0x0231 +phy_chain_rx_lane_map_physical{221.0}=0x2031 +phy_chain_rx_lane_map_physical{225.0}=0x1203 +phy_chain_rx_lane_map_physical{229.0}=0x1230 +phy_chain_rx_lane_map_physical{233.0}=0x3021 +phy_chain_rx_lane_map_physical{237.0}=0x1032 +phy_chain_rx_lane_map_physical{241.0}=0x2301 +phy_chain_rx_lane_map_physical{245.0}=0x0321 +phy_chain_rx_lane_map_physical{249.0}=0x2301 +phy_chain_rx_lane_map_physical{25.0}=0x2301 +phy_chain_rx_lane_map_physical{253.0}=0x2301 +phy_chain_rx_lane_map_physical{257.0}=0x3210 +phy_chain_rx_lane_map_physical{29.0}=0x3021 +phy_chain_rx_lane_map_physical{33.0}=0x1302 +phy_chain_rx_lane_map_physical{37.0}=0x2031 +phy_chain_rx_lane_map_physical{41.0}=0x3021 +phy_chain_rx_lane_map_physical{45.0}=0x1023 +phy_chain_rx_lane_map_physical{49.0}=0x0213 +phy_chain_rx_lane_map_physical{5.0}=0x3201 +phy_chain_rx_lane_map_physical{53.0}=0x3201 +phy_chain_rx_lane_map_physical{57.0}=0x2013 +phy_chain_rx_lane_map_physical{61.0}=0x0213 +phy_chain_rx_lane_map_physical{65.0}=0x1203 +phy_chain_rx_lane_map_physical{69.0}=0x0213 +phy_chain_rx_lane_map_physical{73.0}=0x0213 +phy_chain_rx_lane_map_physical{77.0}=0x3120 +phy_chain_rx_lane_map_physical{81.0}=0x0213 +phy_chain_rx_lane_map_physical{85.0}=0x2031 +phy_chain_rx_lane_map_physical{89.0}=0x2031 +phy_chain_rx_lane_map_physical{9.0}=0x0321 +phy_chain_rx_lane_map_physical{93.0}=0x3120 +phy_chain_rx_lane_map_physical{97.0}=0x1203 +phy_chain_rx_polarity_flip_physical{1.0}=0x1 +phy_chain_rx_polarity_flip_physical{10.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x1 +phy_chain_rx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{102.0}=0x0 +phy_chain_rx_polarity_flip_physical{103.0}=0x1 +phy_chain_rx_polarity_flip_physical{104.0}=0x0 +phy_chain_rx_polarity_flip_physical{105.0}=0x1 +phy_chain_rx_polarity_flip_physical{106.0}=0x0 +phy_chain_rx_polarity_flip_physical{107.0}=0x1 +phy_chain_rx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_polarity_flip_physical{109.0}=0x0 +phy_chain_rx_polarity_flip_physical{11.0}=0x1 +phy_chain_rx_polarity_flip_physical{110.0}=0x1 +phy_chain_rx_polarity_flip_physical{111.0}=0x0 +phy_chain_rx_polarity_flip_physical{112.0}=0x1 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{114.0}=0x0 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_polarity_flip_physical{117.0}=0x0 +phy_chain_rx_polarity_flip_physical{118.0}=0x0 +phy_chain_rx_polarity_flip_physical{119.0}=0x1 +phy_chain_rx_polarity_flip_physical{12.0}=0x1 +phy_chain_rx_polarity_flip_physical{120.0}=0x0 +phy_chain_rx_polarity_flip_physical{121.0}=0x1 +phy_chain_rx_polarity_flip_physical{122.0}=0x0 +phy_chain_rx_polarity_flip_physical{123.0}=0x1 +phy_chain_rx_polarity_flip_physical{124.0}=0x0 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x1 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{128.0}=0x1 +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_rx_polarity_flip_physical{130.0}=0x1 +phy_chain_rx_polarity_flip_physical{131.0}=0x1 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 +phy_chain_rx_polarity_flip_physical{133.0}=0x1 +phy_chain_rx_polarity_flip_physical{134.0}=0x1 +phy_chain_rx_polarity_flip_physical{135.0}=0x1 +phy_chain_rx_polarity_flip_physical{136.0}=0x0 +phy_chain_rx_polarity_flip_physical{137.0}=0x0 +phy_chain_rx_polarity_flip_physical{138.0}=0x0 +phy_chain_rx_polarity_flip_physical{139.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{140.0}=0x0 +phy_chain_rx_polarity_flip_physical{141.0}=0x1 +phy_chain_rx_polarity_flip_physical{142.0}=0x0 +phy_chain_rx_polarity_flip_physical{143.0}=0x1 +phy_chain_rx_polarity_flip_physical{144.0}=0x0 +phy_chain_rx_polarity_flip_physical{145.0}=0x1 +phy_chain_rx_polarity_flip_physical{146.0}=0x0 +phy_chain_rx_polarity_flip_physical{147.0}=0x1 +phy_chain_rx_polarity_flip_physical{148.0}=0x0 +phy_chain_rx_polarity_flip_physical{149.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{150.0}=0x1 +phy_chain_rx_polarity_flip_physical{151.0}=0x1 +phy_chain_rx_polarity_flip_physical{152.0}=0x0 +phy_chain_rx_polarity_flip_physical{153.0}=0x0 +phy_chain_rx_polarity_flip_physical{154.0}=0x1 +phy_chain_rx_polarity_flip_physical{155.0}=0x1 +phy_chain_rx_polarity_flip_physical{156.0}=0x0 +phy_chain_rx_polarity_flip_physical{157.0}=0x0 +phy_chain_rx_polarity_flip_physical{158.0}=0x0 +phy_chain_rx_polarity_flip_physical{159.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{160.0}=0x0 +phy_chain_rx_polarity_flip_physical{161.0}=0x1 +phy_chain_rx_polarity_flip_physical{162.0}=0x1 +phy_chain_rx_polarity_flip_physical{163.0}=0x0 +phy_chain_rx_polarity_flip_physical{164.0}=0x1 +phy_chain_rx_polarity_flip_physical{165.0}=0x0 +phy_chain_rx_polarity_flip_physical{166.0}=0x0 +phy_chain_rx_polarity_flip_physical{167.0}=0x1 +phy_chain_rx_polarity_flip_physical{168.0}=0x1 +phy_chain_rx_polarity_flip_physical{169.0}=0x1 +phy_chain_rx_polarity_flip_physical{17.0}=0x1 +phy_chain_rx_polarity_flip_physical{170.0}=0x1 +phy_chain_rx_polarity_flip_physical{171.0}=0x0 +phy_chain_rx_polarity_flip_physical{172.0}=0x0 +phy_chain_rx_polarity_flip_physical{173.0}=0x0 +phy_chain_rx_polarity_flip_physical{174.0}=0x0 +phy_chain_rx_polarity_flip_physical{175.0}=0x1 +phy_chain_rx_polarity_flip_physical{176.0}=0x1 +phy_chain_rx_polarity_flip_physical{177.0}=0x1 +phy_chain_rx_polarity_flip_physical{178.0}=0x1 +phy_chain_rx_polarity_flip_physical{179.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x0 +phy_chain_rx_polarity_flip_physical{180.0}=0x0 +phy_chain_rx_polarity_flip_physical{181.0}=0x1 +phy_chain_rx_polarity_flip_physical{182.0}=0x1 +phy_chain_rx_polarity_flip_physical{183.0}=0x0 +phy_chain_rx_polarity_flip_physical{184.0}=0x0 +phy_chain_rx_polarity_flip_physical{185.0}=0x0 +phy_chain_rx_polarity_flip_physical{186.0}=0x0 +phy_chain_rx_polarity_flip_physical{187.0}=0x1 +phy_chain_rx_polarity_flip_physical{188.0}=0x1 +phy_chain_rx_polarity_flip_physical{189.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x1 +phy_chain_rx_polarity_flip_physical{190.0}=0x0 +phy_chain_rx_polarity_flip_physical{191.0}=0x1 +phy_chain_rx_polarity_flip_physical{192.0}=0x0 +phy_chain_rx_polarity_flip_physical{193.0}=0x0 +phy_chain_rx_polarity_flip_physical{194.0}=0x0 +phy_chain_rx_polarity_flip_physical{195.0}=0x1 +phy_chain_rx_polarity_flip_physical{196.0}=0x1 +phy_chain_rx_polarity_flip_physical{197.0}=0x1 +phy_chain_rx_polarity_flip_physical{198.0}=0x1 +phy_chain_rx_polarity_flip_physical{199.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{20.0}=0x0 +phy_chain_rx_polarity_flip_physical{200.0}=0x0 +phy_chain_rx_polarity_flip_physical{201.0}=0x0 +phy_chain_rx_polarity_flip_physical{202.0}=0x0 +phy_chain_rx_polarity_flip_physical{203.0}=0x1 +phy_chain_rx_polarity_flip_physical{204.0}=0x0 +phy_chain_rx_polarity_flip_physical{205.0}=0x1 +phy_chain_rx_polarity_flip_physical{206.0}=0x1 +phy_chain_rx_polarity_flip_physical{207.0}=0x0 +phy_chain_rx_polarity_flip_physical{208.0}=0x0 +phy_chain_rx_polarity_flip_physical{209.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{210.0}=0x1 +phy_chain_rx_polarity_flip_physical{211.0}=0x0 +phy_chain_rx_polarity_flip_physical{212.0}=0x0 +phy_chain_rx_polarity_flip_physical{213.0}=0x0 +phy_chain_rx_polarity_flip_physical{214.0}=0x0 +phy_chain_rx_polarity_flip_physical{215.0}=0x1 +phy_chain_rx_polarity_flip_physical{216.0}=0x0 +phy_chain_rx_polarity_flip_physical{217.0}=0x0 +phy_chain_rx_polarity_flip_physical{218.0}=0x0 +phy_chain_rx_polarity_flip_physical{219.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{220.0}=0x1 +phy_chain_rx_polarity_flip_physical{221.0}=0x0 +phy_chain_rx_polarity_flip_physical{222.0}=0x0 +phy_chain_rx_polarity_flip_physical{223.0}=0x1 +phy_chain_rx_polarity_flip_physical{224.0}=0x1 +phy_chain_rx_polarity_flip_physical{225.0}=0x1 +phy_chain_rx_polarity_flip_physical{226.0}=0x0 +phy_chain_rx_polarity_flip_physical{227.0}=0x0 +phy_chain_rx_polarity_flip_physical{228.0}=0x1 +phy_chain_rx_polarity_flip_physical{229.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{230.0}=0x0 +phy_chain_rx_polarity_flip_physical{231.0}=0x1 +phy_chain_rx_polarity_flip_physical{232.0}=0x1 +phy_chain_rx_polarity_flip_physical{233.0}=0x1 +phy_chain_rx_polarity_flip_physical{234.0}=0x0 +phy_chain_rx_polarity_flip_physical{235.0}=0x0 +phy_chain_rx_polarity_flip_physical{236.0}=0x0 +phy_chain_rx_polarity_flip_physical{237.0}=0x1 +phy_chain_rx_polarity_flip_physical{238.0}=0x0 +phy_chain_rx_polarity_flip_physical{239.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_polarity_flip_physical{240.0}=0x0 +phy_chain_rx_polarity_flip_physical{241.0}=0x1 +phy_chain_rx_polarity_flip_physical{242.0}=0x0 +phy_chain_rx_polarity_flip_physical{243.0}=0x1 +phy_chain_rx_polarity_flip_physical{244.0}=0x0 +phy_chain_rx_polarity_flip_physical{245.0}=0x1 +phy_chain_rx_polarity_flip_physical{246.0}=0x1 +phy_chain_rx_polarity_flip_physical{247.0}=0x1 +phy_chain_rx_polarity_flip_physical{248.0}=0x0 +phy_chain_rx_polarity_flip_physical{249.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x1 +phy_chain_rx_polarity_flip_physical{250.0}=0x1 +phy_chain_rx_polarity_flip_physical{251.0}=0x0 +phy_chain_rx_polarity_flip_physical{252.0}=0x1 +phy_chain_rx_polarity_flip_physical{253.0}=0x1 +phy_chain_rx_polarity_flip_physical{254.0}=0x0 +phy_chain_rx_polarity_flip_physical{255.0}=0x1 +phy_chain_rx_polarity_flip_physical{256.0}=0x0 +phy_chain_rx_polarity_flip_physical{257.0}=0x0 +phy_chain_rx_polarity_flip_physical{259.0}=0x0 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x1 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 +phy_chain_rx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x0 +phy_chain_rx_polarity_flip_physical{35.0}=0x1 +phy_chain_rx_polarity_flip_physical{36.0}=0x1 +phy_chain_rx_polarity_flip_physical{37.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x1 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x1 +phy_chain_rx_polarity_flip_physical{44.0}=0x1 +phy_chain_rx_polarity_flip_physical{45.0}=0x1 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x1 +phy_chain_rx_polarity_flip_physical{49.0}=0x1 +phy_chain_rx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_rx_polarity_flip_physical{53.0}=0x0 +phy_chain_rx_polarity_flip_physical{54.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x1 +phy_chain_rx_polarity_flip_physical{56.0}=0x0 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x0 +phy_chain_rx_polarity_flip_physical{59.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x1 +phy_chain_rx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_rx_polarity_flip_physical{64.0}=0x1 +phy_chain_rx_polarity_flip_physical{65.0}=0x1 +phy_chain_rx_polarity_flip_physical{66.0}=0x1 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x1 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_rx_polarity_flip_physical{73.0}=0x1 +phy_chain_rx_polarity_flip_physical{74.0}=0x1 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x0 +phy_chain_rx_polarity_flip_physical{77.0}=0x0 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{79.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_polarity_flip_physical{81.0}=0x1 +phy_chain_rx_polarity_flip_physical{82.0}=0x1 +phy_chain_rx_polarity_flip_physical{83.0}=0x0 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 +phy_chain_rx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{86.0}=0x1 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{89.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x1 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x1 +phy_chain_rx_polarity_flip_physical{92.0}=0x1 +phy_chain_rx_polarity_flip_physical{93.0}=0x0 +phy_chain_rx_polarity_flip_physical{94.0}=0x0 +phy_chain_rx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{96.0}=0x0 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{98.0}=0x1 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_lane_map_physical{1.0}=0x2031 +phy_chain_tx_lane_map_physical{101.0}=0x1023 +phy_chain_tx_lane_map_physical{105.0}=0x1302 +phy_chain_tx_lane_map_physical{109.0}=0x0321 +phy_chain_tx_lane_map_physical{113.0}=0x2301 +phy_chain_tx_lane_map_physical{117.0}=0x3120 +phy_chain_tx_lane_map_physical{121.0}=0x3102 +phy_chain_tx_lane_map_physical{125.0}=0x3210 +phy_chain_tx_lane_map_physical{129.0}=0x1023 +phy_chain_tx_lane_map_physical{13.0}=0x3021 +phy_chain_tx_lane_map_physical{133.0}=0x3210 +phy_chain_tx_lane_map_physical{137.0}=0x2031 +phy_chain_tx_lane_map_physical{141.0}=0x1302 +phy_chain_tx_lane_map_physical{145.0}=0x3210 +phy_chain_tx_lane_map_physical{149.0}=0x0213 +phy_chain_tx_lane_map_physical{153.0}=0x3210 +phy_chain_tx_lane_map_physical{157.0}=0x1320 +phy_chain_tx_lane_map_physical{161.0}=0x3210 +phy_chain_tx_lane_map_physical{165.0}=0x0231 +phy_chain_tx_lane_map_physical{169.0}=0x3120 +phy_chain_tx_lane_map_physical{17.0}=0x1032 +phy_chain_tx_lane_map_physical{173.0}=0x0312 +phy_chain_tx_lane_map_physical{177.0}=0x0231 +phy_chain_tx_lane_map_physical{181.0}=0x3210 +phy_chain_tx_lane_map_physical{185.0}=0x3210 +phy_chain_tx_lane_map_physical{189.0}=0x1320 +phy_chain_tx_lane_map_physical{193.0}=0x0321 +phy_chain_tx_lane_map_physical{197.0}=0x3120 +phy_chain_tx_lane_map_physical{201.0}=0x3120 +phy_chain_tx_lane_map_physical{205.0}=0x0123 +phy_chain_tx_lane_map_physical{209.0}=0x3120 +phy_chain_tx_lane_map_physical{21.0}=0x0213 +phy_chain_tx_lane_map_physical{213.0}=0x3021 +phy_chain_tx_lane_map_physical{217.0}=0x0312 +phy_chain_tx_lane_map_physical{221.0}=0x2301 +phy_chain_tx_lane_map_physical{225.0}=0x0123 +phy_chain_tx_lane_map_physical{229.0}=0x2031 +phy_chain_tx_lane_map_physical{233.0}=0x0231 +phy_chain_tx_lane_map_physical{237.0}=0x0213 +phy_chain_tx_lane_map_physical{241.0}=0x1320 +phy_chain_tx_lane_map_physical{245.0}=0x2031 +phy_chain_tx_lane_map_physical{249.0}=0x3120 +phy_chain_tx_lane_map_physical{25.0}=0x0231 +phy_chain_tx_lane_map_physical{253.0}=0x0321 +phy_chain_tx_lane_map_physical{257.0}=0x3210 +phy_chain_tx_lane_map_physical{29.0}=0x1230 +phy_chain_tx_lane_map_physical{33.0}=0x1032 +phy_chain_tx_lane_map_physical{37.0}=0x0123 +phy_chain_tx_lane_map_physical{41.0}=0x0213 +phy_chain_tx_lane_map_physical{45.0}=0x0132 +phy_chain_tx_lane_map_physical{49.0}=0x2031 +phy_chain_tx_lane_map_physical{5.0}=0x2301 +phy_chain_tx_lane_map_physical{53.0}=0x2301 +phy_chain_tx_lane_map_physical{57.0}=0x2031 +phy_chain_tx_lane_map_physical{61.0}=0x2031 +phy_chain_tx_lane_map_physical{65.0}=0x1230 +phy_chain_tx_lane_map_physical{69.0}=0x2013 +phy_chain_tx_lane_map_physical{73.0}=0x0213 +phy_chain_tx_lane_map_physical{77.0}=0x2310 +phy_chain_tx_lane_map_physical{81.0}=0x0321 +phy_chain_tx_lane_map_physical{85.0}=0x2013 +phy_chain_tx_lane_map_physical{89.0}=0x0213 +phy_chain_tx_lane_map_physical{9.0}=0x3012 +phy_chain_tx_lane_map_physical{93.0}=0x3102 +phy_chain_tx_lane_map_physical{97.0}=0x3210 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x1 +phy_chain_tx_polarity_flip_physical{103.0}=0x0 +phy_chain_tx_polarity_flip_physical{104.0}=0x0 +phy_chain_tx_polarity_flip_physical{105.0}=0x0 +phy_chain_tx_polarity_flip_physical{106.0}=0x1 +phy_chain_tx_polarity_flip_physical{107.0}=0x1 +phy_chain_tx_polarity_flip_physical{108.0}=0x1 +phy_chain_tx_polarity_flip_physical{109.0}=0x0 +phy_chain_tx_polarity_flip_physical{11.0}=0x1 +phy_chain_tx_polarity_flip_physical{110.0}=0x0 +phy_chain_tx_polarity_flip_physical{111.0}=0x0 +phy_chain_tx_polarity_flip_physical{112.0}=0x1 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x1 +phy_chain_tx_polarity_flip_physical{115.0}=0x1 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_tx_polarity_flip_physical{117.0}=0x1 +phy_chain_tx_polarity_flip_physical{118.0}=0x0 +phy_chain_tx_polarity_flip_physical{119.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{120.0}=0x0 +phy_chain_tx_polarity_flip_physical{121.0}=0x0 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x1 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x1 +phy_chain_tx_polarity_flip_physical{127.0}=0x1 +phy_chain_tx_polarity_flip_physical{128.0}=0x1 +phy_chain_tx_polarity_flip_physical{129.0}=0x1 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{130.0}=0x0 +phy_chain_tx_polarity_flip_physical{131.0}=0x1 +phy_chain_tx_polarity_flip_physical{132.0}=0x0 +phy_chain_tx_polarity_flip_physical{133.0}=0x1 +phy_chain_tx_polarity_flip_physical{134.0}=0x1 +phy_chain_tx_polarity_flip_physical{135.0}=0x1 +phy_chain_tx_polarity_flip_physical{136.0}=0x1 +phy_chain_tx_polarity_flip_physical{137.0}=0x1 +phy_chain_tx_polarity_flip_physical{138.0}=0x1 +phy_chain_tx_polarity_flip_physical{139.0}=0x1 +phy_chain_tx_polarity_flip_physical{14.0}=0x1 +phy_chain_tx_polarity_flip_physical{140.0}=0x1 +phy_chain_tx_polarity_flip_physical{141.0}=0x0 +phy_chain_tx_polarity_flip_physical{142.0}=0x1 +phy_chain_tx_polarity_flip_physical{143.0}=0x1 +phy_chain_tx_polarity_flip_physical{144.0}=0x1 +phy_chain_tx_polarity_flip_physical{145.0}=0x1 +phy_chain_tx_polarity_flip_physical{146.0}=0x1 +phy_chain_tx_polarity_flip_physical{147.0}=0x1 +phy_chain_tx_polarity_flip_physical{148.0}=0x0 +phy_chain_tx_polarity_flip_physical{149.0}=0x1 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{150.0}=0x0 +phy_chain_tx_polarity_flip_physical{151.0}=0x0 +phy_chain_tx_polarity_flip_physical{152.0}=0x0 +phy_chain_tx_polarity_flip_physical{153.0}=0x1 +phy_chain_tx_polarity_flip_physical{154.0}=0x0 +phy_chain_tx_polarity_flip_physical{155.0}=0x0 +phy_chain_tx_polarity_flip_physical{156.0}=0x0 +phy_chain_tx_polarity_flip_physical{157.0}=0x0 +phy_chain_tx_polarity_flip_physical{158.0}=0x0 +phy_chain_tx_polarity_flip_physical{159.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{160.0}=0x0 +phy_chain_tx_polarity_flip_physical{161.0}=0x0 +phy_chain_tx_polarity_flip_physical{162.0}=0x1 +phy_chain_tx_polarity_flip_physical{163.0}=0x1 +phy_chain_tx_polarity_flip_physical{164.0}=0x0 +phy_chain_tx_polarity_flip_physical{165.0}=0x1 +phy_chain_tx_polarity_flip_physical{166.0}=0x1 +phy_chain_tx_polarity_flip_physical{167.0}=0x1 +phy_chain_tx_polarity_flip_physical{168.0}=0x0 +phy_chain_tx_polarity_flip_physical{169.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{170.0}=0x1 +phy_chain_tx_polarity_flip_physical{171.0}=0x1 +phy_chain_tx_polarity_flip_physical{172.0}=0x1 +phy_chain_tx_polarity_flip_physical{173.0}=0x0 +phy_chain_tx_polarity_flip_physical{174.0}=0x0 +phy_chain_tx_polarity_flip_physical{175.0}=0x1 +phy_chain_tx_polarity_flip_physical{176.0}=0x0 +phy_chain_tx_polarity_flip_physical{177.0}=0x1 +phy_chain_tx_polarity_flip_physical{178.0}=0x0 +phy_chain_tx_polarity_flip_physical{179.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x1 +phy_chain_tx_polarity_flip_physical{180.0}=0x0 +phy_chain_tx_polarity_flip_physical{181.0}=0x0 +phy_chain_tx_polarity_flip_physical{182.0}=0x0 +phy_chain_tx_polarity_flip_physical{183.0}=0x0 +phy_chain_tx_polarity_flip_physical{184.0}=0x1 +phy_chain_tx_polarity_flip_physical{185.0}=0x0 +phy_chain_tx_polarity_flip_physical{186.0}=0x1 +phy_chain_tx_polarity_flip_physical{187.0}=0x1 +phy_chain_tx_polarity_flip_physical{188.0}=0x1 +phy_chain_tx_polarity_flip_physical{189.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{190.0}=0x0 +phy_chain_tx_polarity_flip_physical{191.0}=0x0 +phy_chain_tx_polarity_flip_physical{192.0}=0x0 +phy_chain_tx_polarity_flip_physical{193.0}=0x1 +phy_chain_tx_polarity_flip_physical{194.0}=0x1 +phy_chain_tx_polarity_flip_physical{195.0}=0x1 +phy_chain_tx_polarity_flip_physical{196.0}=0x0 +phy_chain_tx_polarity_flip_physical{197.0}=0x0 +phy_chain_tx_polarity_flip_physical{198.0}=0x1 +phy_chain_tx_polarity_flip_physical{199.0}=0x1 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x1 +phy_chain_tx_polarity_flip_physical{200.0}=0x1 +phy_chain_tx_polarity_flip_physical{201.0}=0x1 +phy_chain_tx_polarity_flip_physical{202.0}=0x1 +phy_chain_tx_polarity_flip_physical{203.0}=0x1 +phy_chain_tx_polarity_flip_physical{204.0}=0x1 +phy_chain_tx_polarity_flip_physical{205.0}=0x0 +phy_chain_tx_polarity_flip_physical{206.0}=0x1 +phy_chain_tx_polarity_flip_physical{207.0}=0x1 +phy_chain_tx_polarity_flip_physical{208.0}=0x1 +phy_chain_tx_polarity_flip_physical{209.0}=0x1 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{210.0}=0x1 +phy_chain_tx_polarity_flip_physical{211.0}=0x1 +phy_chain_tx_polarity_flip_physical{212.0}=0x0 +phy_chain_tx_polarity_flip_physical{213.0}=0x0 +phy_chain_tx_polarity_flip_physical{214.0}=0x1 +phy_chain_tx_polarity_flip_physical{215.0}=0x0 +phy_chain_tx_polarity_flip_physical{216.0}=0x1 +phy_chain_tx_polarity_flip_physical{217.0}=0x1 +phy_chain_tx_polarity_flip_physical{218.0}=0x1 +phy_chain_tx_polarity_flip_physical{219.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{220.0}=0x1 +phy_chain_tx_polarity_flip_physical{221.0}=0x0 +phy_chain_tx_polarity_flip_physical{222.0}=0x0 +phy_chain_tx_polarity_flip_physical{223.0}=0x0 +phy_chain_tx_polarity_flip_physical{224.0}=0x1 +phy_chain_tx_polarity_flip_physical{225.0}=0x1 +phy_chain_tx_polarity_flip_physical{226.0}=0x1 +phy_chain_tx_polarity_flip_physical{227.0}=0x1 +phy_chain_tx_polarity_flip_physical{228.0}=0x0 +phy_chain_tx_polarity_flip_physical{229.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{230.0}=0x1 +phy_chain_tx_polarity_flip_physical{231.0}=0x1 +phy_chain_tx_polarity_flip_physical{232.0}=0x1 +phy_chain_tx_polarity_flip_physical{233.0}=0x0 +phy_chain_tx_polarity_flip_physical{234.0}=0x0 +phy_chain_tx_polarity_flip_physical{235.0}=0x0 +phy_chain_tx_polarity_flip_physical{236.0}=0x0 +phy_chain_tx_polarity_flip_physical{237.0}=0x1 +phy_chain_tx_polarity_flip_physical{238.0}=0x1 +phy_chain_tx_polarity_flip_physical{239.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{240.0}=0x0 +phy_chain_tx_polarity_flip_physical{241.0}=0x1 +phy_chain_tx_polarity_flip_physical{242.0}=0x1 +phy_chain_tx_polarity_flip_physical{243.0}=0x1 +phy_chain_tx_polarity_flip_physical{244.0}=0x0 +phy_chain_tx_polarity_flip_physical{245.0}=0x1 +phy_chain_tx_polarity_flip_physical{246.0}=0x1 +phy_chain_tx_polarity_flip_physical{247.0}=0x1 +phy_chain_tx_polarity_flip_physical{248.0}=0x1 +phy_chain_tx_polarity_flip_physical{249.0}=0x1 +phy_chain_tx_polarity_flip_physical{25.0}=0x1 +phy_chain_tx_polarity_flip_physical{250.0}=0x0 +phy_chain_tx_polarity_flip_physical{251.0}=0x0 +phy_chain_tx_polarity_flip_physical{252.0}=0x0 +phy_chain_tx_polarity_flip_physical{253.0}=0x1 +phy_chain_tx_polarity_flip_physical{254.0}=0x1 +phy_chain_tx_polarity_flip_physical{255.0}=0x1 +phy_chain_tx_polarity_flip_physical{256.0}=0x0 +phy_chain_tx_polarity_flip_physical{257.0}=0x0 +phy_chain_tx_polarity_flip_physical{259.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x0 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_tx_polarity_flip_physical{28.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x1 +phy_chain_tx_polarity_flip_physical{31.0}=0x1 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x1 +phy_chain_tx_polarity_flip_physical{37.0}=0x1 +phy_chain_tx_polarity_flip_physical{38.0}=0x1 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +phy_chain_tx_polarity_flip_physical{40.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{45.0}=0x1 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x1 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x1 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x1 +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x1 +phy_chain_tx_polarity_flip_physical{55.0}=0x1 +phy_chain_tx_polarity_flip_physical{56.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +phy_chain_tx_polarity_flip_physical{61.0}=0x0 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x1 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +phy_chain_tx_polarity_flip_physical{66.0}=0x1 +phy_chain_tx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_tx_polarity_flip_physical{69.0}=0x1 +phy_chain_tx_polarity_flip_physical{7.0}=0x1 +phy_chain_tx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_tx_polarity_flip_physical{73.0}=0x1 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_tx_polarity_flip_physical{76.0}=0x0 +phy_chain_tx_polarity_flip_physical{77.0}=0x0 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x1 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_polarity_flip_physical{81.0}=0x1 +phy_chain_tx_polarity_flip_physical{82.0}=0x1 +phy_chain_tx_polarity_flip_physical{83.0}=0x1 +phy_chain_tx_polarity_flip_physical{84.0}=0x0 +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_tx_polarity_flip_physical{86.0}=0x0 +phy_chain_tx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{90.0}=0x1 +phy_chain_tx_polarity_flip_physical{91.0}=0x1 +phy_chain_tx_polarity_flip_physical{92.0}=0x0 +phy_chain_tx_polarity_flip_physical{93.0}=0x0 +phy_chain_tx_polarity_flip_physical{94.0}=0x0 +phy_chain_tx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x0 +phy_chain_tx_polarity_flip_physical{97.0}=0x0 +phy_chain_tx_polarity_flip_physical{98.0}=0x1 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 + +port_init_cl72_hg=1 + + + + + + + +robust_hash_disable_egress_vlan=1 +robust_hash_disable_mpls=1 +robust_hash_disable_vlan=1 +stable_size=0x5500000 +stable_size=0x5500000 +tdma_timeout_usec=15000000 +tslam_timeout_usec=15000000 +dport_map_direct=1 +portmap_1=5:50 +portmap_2=7:50 +portmap_3=13:50 +portmap_4=15:50 +portmap_5=25:50 +portmap_6=27:50 +portmap_7=21:50 +portmap_8=23:50 +portmap_9=37:50 +portmap_10=39:50 +portmap_11=45:50 +portmap_12=47:50 +portmap_13=57:100 +portmap_14=53:100 +portmap_15=9:50 +portmap_16=11:50 +portmap_17=1:50 +portmap_18=3:50 +portmap_19=17:50 +portmap_20=19:50 +portmap_21=29:50 +portmap_22=31:50 +portmap_23=41:50 +portmap_24=43:50 +portmap_25=33:50 +portmap_26=35:50 +portmap_27=49:100 +portmap_28=61:100 +portmap_34=77:50 +portmap_35=79:50 +portmap_36=65:50 +portmap_37=67:50 +portmap_38=85:50 +portmap_39=87:50 +portmap_40=89:50 +portmap_41=91:50 +portmap_42=109:50 +portmap_43=111:50 +portmap_44=97:50 +portmap_45=99:50 +portmap_46=117:100 +portmap_47=121:100 +portmap_48=69:50 +portmap_49=71:50 +portmap_50=73:50 +portmap_51=75:50 +portmap_52=93:50 +portmap_53=95:50 +portmap_54=81:50 +portmap_55=83:50 +portmap_56=101:50 +portmap_57=103:50 +portmap_58=105:50 +portmap_59=107:50 +portmap_60=125:100 +portmap_61=113:100 +portmap_66=257:10 +portmap_68=141:100 +portmap_69=133:100 +portmap_70=149:50 +portmap_71=151:50 +portmap_72=153:50 +portmap_73=155:50 +portmap_74=173:50 +portmap_75=175:50 +portmap_76=161:50 +portmap_77=163:50 +portmap_78=181:50 +portmap_79=183:50 +portmap_80=185:50 +portmap_81=187:50 +portmap_82=129:100 +portmap_83=137:100 +portmap_84=157:50 +portmap_85=159:50 +portmap_86=145:50 +portmap_87=147:50 +portmap_88=165:50 +portmap_89=167:50 +portmap_90=169:50 +portmap_91=171:50 +portmap_92=189:50 +portmap_93=191:50 +portmap_94=177:50 +portmap_95=179:50 +portmap_100=259:10 +portmap_102=197:100 +portmap_103=205:100 +portmap_104=217:50 +portmap_105=219:50 +portmap_106=213:50 +portmap_107=215:50 +portmap_108=229:50 +portmap_109=231:50 +portmap_110=237:50 +portmap_111=239:50 +portmap_112=249:50 +portmap_113=251:50 +portmap_114=245:50 +portmap_115=247:50 +portmap_116=201:100 +portmap_117=193:100 +portmap_118=209:50 +portmap_119=211:50 +portmap_120=221:50 +portmap_121=223:50 +portmap_122=233:50 +portmap_123=235:50 +portmap_124=225:50 +portmap_125=227:50 +portmap_126=241:50 +portmap_127=243:50 +portmap_128=253:50 +portmap_129=255:50 + +# tuning parameters +serdes_preemphasis_1=0x580c +serdes_preemphasis_2=0x580c +serdes_preemphasis_3=0x580c +serdes_preemphasis_4=0x580c +serdes_preemphasis_5=0x580c +serdes_preemphasis_6=0x580c +serdes_preemphasis_7=0x580c +serdes_preemphasis_8=0x580c +serdes_preemphasis_9=0x580c +serdes_preemphasis_10=0x580c +serdes_preemphasis_11=0x580c +serdes_preemphasis_12=0x580c +serdes_preemphasis_13=0x83404 +serdes_preemphasis_14=0x83404 +serdes_preemphasis_15=0x580c +serdes_preemphasis_16=0x580c +serdes_preemphasis_17=0x580c +serdes_preemphasis_18=0x580c +serdes_preemphasis_19=0x580c +serdes_preemphasis_20=0x580c +serdes_preemphasis_21=0x580c +serdes_preemphasis_22=0x580c +serdes_preemphasis_23=0x580c +serdes_preemphasis_24=0x580c +serdes_preemphasis_25=0x580c +serdes_preemphasis_26=0x580c +serdes_preemphasis_27=0xf3c05 +serdes_preemphasis_28=0xf3d05 +serdes_preemphasis_34=0x580c +serdes_preemphasis_35=0x580c +serdes_preemphasis_36=0x580c +serdes_preemphasis_37=0x580c +serdes_preemphasis_38=0x580c +serdes_preemphasis_39=0x580c +serdes_preemphasis_40=0x580c +serdes_preemphasis_41=0x580c +serdes_preemphasis_42=0x580c +serdes_preemphasis_43=0x580c +serdes_preemphasis_44=0x580c +serdes_preemphasis_45=0x580c +serdes_preemphasis_46=0xb3604 +serdes_preemphasis_47=0x72b03 +serdes_preemphasis_48=0x580c +serdes_preemphasis_49=0x580c +serdes_preemphasis_50=0x580c +serdes_preemphasis_51=0x580c +serdes_preemphasis_52=0x580c +serdes_preemphasis_53=0x580c +serdes_preemphasis_54=0x580c +serdes_preemphasis_55=0x580c +serdes_preemphasis_56=0x580c +serdes_preemphasis_57=0x580c +serdes_preemphasis_58=0x580c +serdes_preemphasis_59=0x580c +serdes_preemphasis_60=0xf3c05 +serdes_preemphasis_61=0x103f06 +serdes_preemphasis_66=0x43004 +serdes_preemphasis_68=0xf4006 +serdes_preemphasis_69=0xf4006 +serdes_preemphasis_70=0x580c +serdes_preemphasis_71=0x580c +serdes_preemphasis_72=0x580c +serdes_preemphasis_73=0x580c +serdes_preemphasis_74=0x580c +serdes_preemphasis_75=0x580c +serdes_preemphasis_76=0x580c +serdes_preemphasis_77=0x580c +serdes_preemphasis_78=0x580c +serdes_preemphasis_79=0x580c +serdes_preemphasis_80=0x580c +serdes_preemphasis_81=0x580c +serdes_preemphasis_82=0x73103 +serdes_preemphasis_83=0x73103 +serdes_preemphasis_84=0x580c +serdes_preemphasis_85=0x580c +serdes_preemphasis_86=0x580c +serdes_preemphasis_87=0x580c +serdes_preemphasis_88=0x580c +serdes_preemphasis_89=0x580c +serdes_preemphasis_90=0x580c +serdes_preemphasis_91=0x580c +serdes_preemphasis_92=0x580c +serdes_preemphasis_93=0x580c +serdes_preemphasis_94=0x580c +serdes_preemphasis_95=0x580c +serdes_preemphasis_100=0x43004 +serdes_preemphasis_102=0xf3c05 +serdes_preemphasis_103=0xf3c05 +serdes_preemphasis_104=0x580c +serdes_preemphasis_105=0x580c +serdes_preemphasis_106=0x580c +serdes_preemphasis_107=0x580c +serdes_preemphasis_108=0x580c +serdes_preemphasis_109=0x580c +serdes_preemphasis_110=0x580c +serdes_preemphasis_111=0x580c +serdes_preemphasis_112=0x580c +serdes_preemphasis_113=0x580c +serdes_preemphasis_114=0x580c +serdes_preemphasis_115=0x580c +serdes_preemphasis_116=0x83404 +serdes_preemphasis_117=0x83404 +serdes_preemphasis_118=0x580c +serdes_preemphasis_119=0x580c +serdes_preemphasis_120=0x580c +serdes_preemphasis_121=0x580c +serdes_preemphasis_122=0x580c +serdes_preemphasis_123=0x580c +serdes_preemphasis_124=0x580c +serdes_preemphasis_125=0x580c +serdes_preemphasis_126=0x580c +serdes_preemphasis_127=0x580c +serdes_preemphasis_128=0x580c +serdes_preemphasis_129=0x580c + +mmu_init_config="MSFT-TH2-Tier0" + +phy_an_lt_msft=1 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/BALANCED b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/BALANCED new file mode 120000 index 000000000000..a270c70ffc36 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/BALANCED \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/RDMA-CENTRIC b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/RDMA-CENTRIC new file mode 120000 index 000000000000..8d1ec6d277a8 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/RDMA-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/TCP-CENTRIC b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/TCP-CENTRIC new file mode 120000 index 000000000000..7ee783aac6a4 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th2/7260/TCP-CENTRIC \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffer_ports_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffer_ports_t0.j2 new file mode 100644 index 000000000000..2d56c4b38f9e --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffer_ports_t0.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffer_ports_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffer_ports_t1.j2 new file mode 100644 index 000000000000..2d56c4b38f9e --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffer_ports_t1.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 deleted file mode 100644 index bee86a9b3a85..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 +++ /dev/null @@ -1,56 +0,0 @@ -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- import 'buffers_pool_sizes_t0.j2' as defs with context %} -{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} -{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic", - "xoff": "7827456" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "42349632", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "static_th":"44302336" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "static_th":"42349632" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1664", - "dynamic_th":"-1" - } - }, -{%- endmacro %} - -{% import 'buffers_extra_queues.j2' as defs with context %} - -{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} -{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 deleted file mode 100644 index c73fde73562b..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 +++ /dev/null @@ -1,60 +0,0 @@ -{%- set default_cable = '300m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- import 'buffers_pool_sizes_t0.j2' as defs with context %} -{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} -{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic", - "xoff": "7827456" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "42349632", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "static_th":"44302336" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "static_th":"42349632" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1664", - "dynamic_th":"-1" - } - }, -{%- endmacro %} - -{% import 'buffers_extra_queues.j2' as defs1 with context %} -{% import 'buffers_extra_pgs.j2' as defs2 with context %} - -{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} -{{ defs1.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} -{%- endmacro %} -{%- macro generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) %} -{{ defs2.generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) }} -{%- endmacro %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..c25cc95d6d57 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_pool_sizes_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_pool_sizes_t1.j2 new file mode 120000 index 000000000000..138e7f373e74 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_pool_sizes_t1.j2 @@ -0,0 +1 @@ +../Arista-7260CX3-C64/buffers_pool_sizes_t1.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini deleted file mode 100644 index ac33b4f961fb..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini +++ /dev/null @@ -1,11 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 40000 5m 1248 1248 56160 -3 2496 - 50000 5m 1248 1248 56160 -3 2496 - 100000 5m 1248 1248 96928 -3 2496 - 40000 40m 1248 1248 71552 -3 2496 - 50000 40m 1248 1248 96096 -3 2496 - 100000 40m 1248 1248 177632 -3 2496 - 40000 300m 1248 1248 108160 -3 2496 - 50000 300m 1248 1248 141856 -3 2496 - 100000 300m 1248 1248 268736 -3 2496 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 index f0ee02749724..aef6b6765cf2 120000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 @@ -1 +1 @@ -../Arista-7260CX3-C64/qos.json.j2 \ No newline at end of file +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_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 f995ec79c769..f20ea81049fb 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 @@ -7,7 +7,7 @@ system_headers_mode=1 suppress_unknown_prop_warnings=1 l4_protocols_load_balancing_enable=1 fabric_logical_port_base=512 -trunk_group_max_members=128 +trunk_group_max_members=16 num_olp_tm_ports.BCM8869X=1 # nif diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm index 652815971716..e32603e1da0c 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/0/j2p-a7800r3a-36d-36x400G.config.bcm @@ -22,6 +22,9 @@ pmf_sexem3_stage=IPMF2 # Jericho2-mode (description 0x1 used for Jericho 2 mode) system_headers_mode=1 +# HW mode to support 1024 16-member system wide LAGs +trunk_group_max_members=16 + # Disable link-training port_init_cl72=0 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm index fe67582df2f5..c2a1d4229f24 100644 --- a/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/Arista-7800R3A-36D2-C72/1/j2p-a7800r3a-36d-36x400G.config.bcm @@ -21,6 +21,9 @@ pmf_sexem3_stage=IPMF2 # Jericho2-mode (description 0x1 used for Jericho 2 mode) system_headers_mode=1 +# HW mode to support 1024 16-member system wide LAGs +trunk_group_max_members=16 + # Disable link-training port_init_cl72=0 diff --git a/device/arista/x86_64-arista_7800r3a_36d2_lc/default_sku b/device/arista/x86_64-arista_7800r3a_36d2_lc/default_sku new file mode 100644 index 000000000000..2aa543267cef --- /dev/null +++ b/device/arista/x86_64-arista_7800r3a_36d2_lc/default_sku @@ -0,0 +1 @@ +Arista-7800R3A-36D2-C72 t1 diff --git a/src/sonic-host-services/__init__.py b/device/arista/x86_64-arista_7800r3a_36d2_lc/use_pci_id_chassis similarity index 100% rename from src/sonic-host-services/__init__.py rename to device/arista/x86_64-arista_7800r3a_36d2_lc/use_pci_id_chassis diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/BALANCED b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/BALANCED new file mode 120000 index 000000000000..87afd08ffcd8 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th/gen/BALANCED \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/RDMA-CENTRIC b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/RDMA-CENTRIC new file mode 120000 index 000000000000..a05581efb9ff --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/RDMA-CENTRIC \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/TCP-CENTRIC b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/TCP-CENTRIC new file mode 120000 index 000000000000..dd9cf046c0f9 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/TCP-CENTRIC \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffer_ports_t0.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffer_ports_t0.j2 new file mode 100644 index 000000000000..c33d873068a4 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffer_ports_t0.j2 @@ -0,0 +1,13 @@ +{%- set ports2cable = { + 'torrouter_server' : '300m', + 'leafrouter_torrouter' : '300m', + 'spinerouter_leafrouter' : '300m' + } +-%} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffer_ports_t1.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffer_ports_t1.j2 new file mode 100644 index 000000000000..c33d873068a4 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffer_ports_t1.j2 @@ -0,0 +1,13 @@ +{%- set ports2cable = { + 'torrouter_server' : '300m', + 'leafrouter_torrouter' : '300m', + 'spinerouter_leafrouter' : '300m' + } +-%} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t0.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t0.j2 deleted file mode 100644 index c90327229bbe..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t0.j2 +++ /dev/null @@ -1,54 +0,0 @@ - -{%- set default_cable = '5m' %} - -{%- set ports2cable = { - 'torrouter_server' : '300m', - 'leafrouter_torrouter' : '300m', - 'spinerouter_leafrouter' : '300m' - } --%} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t0.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t1.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t1.j2 deleted file mode 100644 index c79f848645cc..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t1.j2 +++ /dev/null @@ -1,54 +0,0 @@ - -{%- set default_cable = '40m' %} - -{%- set ports2cable = { - 'torrouter_server' : '300m', - 'leafrouter_torrouter' : '300m', - 'spinerouter_leafrouter' : '300m' - } --%} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t1.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..c25cc95d6d57 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/pg_profile_lookup.ini b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/pg_profile_lookup.ini deleted file mode 100644 index 673df369a9bb..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 0 2288 - 25000 5m 1248 2288 53248 0 2288 - 40000 5m 1248 2288 66560 0 2288 - 50000 5m 1248 2288 90272 0 2288 - 100000 5m 1248 2288 165568 0 2288 - 10000 40m 1248 2288 37024 0 2288 - 25000 40m 1248 2288 53248 0 2288 - 40000 40m 1248 2288 71552 0 2288 - 50000 40m 1248 2288 96096 0 2288 - 100000 40m 1248 2288 177632 0 2288 - 10000 300m 1248 2288 46176 0 2288 - 25000 300m 1248 2288 79040 0 2288 - 40000 300m 1248 2288 108160 0 2288 - 50000 300m 1248 2288 141856 0 2288 - 100000 300m 1248 2288 268736 0 2288 diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/pg_profile_lookup.ini b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/qos.json.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/qos.json.j2 deleted file mode 100644 index 34002048afdb..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/qos.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{%- macro generate_wred_profiles() %} - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable" : "true", - "wred_yellow_enable" : "true", - "wred_red_enable" : "true", - "ecn" : "ecn_all", - "green_max_threshold" : "2097152", - "green_min_threshold" : "250000", - "yellow_max_threshold" : "2097152", - "yellow_min_threshold" : "1048576", - "red_max_threshold" : "2097152", - "red_min_threshold" : "1048576", - "green_drop_probability" : "5", - "yellow_drop_probability": "5", - "red_drop_probability" : "5" - } - }, -{%- endmacro %} - -{%- include 'qos_config.j2' %} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/qos.json.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/qos.json.j2 new file mode 120000 index 000000000000..aef6b6765cf2 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/BALANCED b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/BALANCED new file mode 120000 index 000000000000..87afd08ffcd8 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th/gen/BALANCED \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/RDMA-CENTRIC b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/RDMA-CENTRIC new file mode 120000 index 000000000000..a05581efb9ff --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/RDMA-CENTRIC \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/TCP-CENTRIC b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/TCP-CENTRIC new file mode 120000 index 000000000000..dd9cf046c0f9 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/gen/TCP-CENTRIC \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffer_ports_t0.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffer_ports_t0.j2 new file mode 100644 index 000000000000..b4f4f7bab3f3 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffer_ports_t0.j2 @@ -0,0 +1,28 @@ +{%- set ports2cable = { + 'torrouter_server' : '300m', + 'leafrouter_torrouter' : '300m', + 'spinerouter_leafrouter' : '300m' + } +-%} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,9) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(14,17) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(22,31) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(10,13) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(18,21) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffers_defaults_t0.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffers_defaults_t0.j2 deleted file mode 100644 index 046ec1e65450..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffers_defaults_t0.j2 +++ /dev/null @@ -1,69 +0,0 @@ - -{%- set default_cable = '5m' %} - -{%- set ports2cable = { - 'torrouter_server' : '300m', - 'leafrouter_torrouter' : '300m', - 'spinerouter_leafrouter' : '300m' - } --%} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,9) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(14,17) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(22,31) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(10,13) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} - {%- for port_idx in range(18,21) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffers_defaults_t0.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/pg_profile_lookup.ini b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/pg_profile_lookup.ini deleted file mode 100644 index 673df369a9bb..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 0 2288 - 25000 5m 1248 2288 53248 0 2288 - 40000 5m 1248 2288 66560 0 2288 - 50000 5m 1248 2288 90272 0 2288 - 100000 5m 1248 2288 165568 0 2288 - 10000 40m 1248 2288 37024 0 2288 - 25000 40m 1248 2288 53248 0 2288 - 40000 40m 1248 2288 71552 0 2288 - 50000 40m 1248 2288 96096 0 2288 - 100000 40m 1248 2288 177632 0 2288 - 10000 300m 1248 2288 46176 0 2288 - 25000 300m 1248 2288 79040 0 2288 - 40000 300m 1248 2288 108160 0 2288 - 50000 300m 1248 2288 141856 0 2288 - 100000 300m 1248 2288 268736 0 2288 diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/pg_profile_lookup.ini b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/qos.json.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/qos.json.j2 deleted file mode 100644 index 34002048afdb..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/qos.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{%- macro generate_wred_profiles() %} - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable" : "true", - "wred_yellow_enable" : "true", - "wred_red_enable" : "true", - "ecn" : "ecn_all", - "green_max_threshold" : "2097152", - "green_min_threshold" : "250000", - "yellow_max_threshold" : "2097152", - "yellow_min_threshold" : "1048576", - "red_max_threshold" : "2097152", - "red_min_threshold" : "1048576", - "green_drop_probability" : "5", - "yellow_drop_probability": "5", - "red_drop_probability" : "5" - } - }, -{%- endmacro %} - -{%- include 'qos_config.j2' %} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/qos.json.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/qos.json.j2 new file mode 120000 index 000000000000..aef6b6765cf2 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/common/profiles/th/6100/BALANCED/buffers_defaults_t0.j2 b/device/common/profiles/th/6100/BALANCED/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..ec7e2a23b566 --- /dev/null +++ b/device/common/profiles/th/6100/BALANCED/buffers_defaults_t0.j2 @@ -0,0 +1,42 @@ + +{%- set default_cable = '5m' %} + +{%- include 'buffer_ports_t0.j2' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/common/profiles/th/6100/BALANCED/buffers_defaults_t1.j2 b/device/common/profiles/th/6100/BALANCED/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..e408a5c92cf6 --- /dev/null +++ b/device/common/profiles/th/6100/BALANCED/buffers_defaults_t1.j2 @@ -0,0 +1,42 @@ + +{%- set default_cable = '40m' %} + +{%- include 'buffer_ports_t1.j2' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/common/profiles/th/6100/BALANCED/pg_profile_lookup.ini b/device/common/profiles/th/6100/BALANCED/pg_profile_lookup.ini new file mode 100644 index 000000000000..0b5d680edda7 --- /dev/null +++ b/device/common/profiles/th/6100/BALANCED/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 0 2288 + 25000 5m 1248 2288 53248 0 2288 + 40000 5m 1248 2288 66560 0 2288 + 50000 5m 1248 2288 79872 0 2288 + 100000 5m 1248 2288 165568 0 2288 + 10000 40m 1248 2288 37024 0 2288 + 25000 40m 1248 2288 56160 0 2288 + 40000 40m 1248 2288 71552 0 2288 + 50000 40m 1248 2288 85696 0 2288 + 100000 40m 1248 2288 177632 0 2288 + 10000 300m 1248 2288 46176 0 2288 + 25000 300m 1248 2288 79040 0 2288 + 40000 300m 1248 2288 108160 0 2288 + 50000 300m 1248 2288 141856 0 2288 + 100000 300m 1248 2288 268736 0 2288 diff --git a/device/common/profiles/th/6100/BALANCED/qos.json.j2 b/device/common/profiles/th/6100/BALANCED/qos.json.j2 new file mode 100644 index 000000000000..34002048afdb --- /dev/null +++ b/device/common/profiles/th/6100/BALANCED/qos.json.j2 @@ -0,0 +1,21 @@ +{%- macro generate_wred_profiles() %} + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, +{%- endmacro %} + +{%- include 'qos_config.j2' %} diff --git a/device/common/profiles/th/6100/RDMA-CENTRIC/buffers_defaults_t0.j2 b/device/common/profiles/th/6100/RDMA-CENTRIC/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..ec7e2a23b566 --- /dev/null +++ b/device/common/profiles/th/6100/RDMA-CENTRIC/buffers_defaults_t0.j2 @@ -0,0 +1,42 @@ + +{%- set default_cable = '5m' %} + +{%- include 'buffer_ports_t0.j2' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/common/profiles/th/6100/RDMA-CENTRIC/buffers_defaults_t1.j2 b/device/common/profiles/th/6100/RDMA-CENTRIC/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..e408a5c92cf6 --- /dev/null +++ b/device/common/profiles/th/6100/RDMA-CENTRIC/buffers_defaults_t1.j2 @@ -0,0 +1,42 @@ + +{%- set default_cable = '40m' %} + +{%- include 'buffer_ports_t1.j2' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/common/profiles/th/6100/RDMA-CENTRIC/pg_profile_lookup.ini b/device/common/profiles/th/6100/RDMA-CENTRIC/pg_profile_lookup.ini new file mode 100644 index 000000000000..0b5d680edda7 --- /dev/null +++ b/device/common/profiles/th/6100/RDMA-CENTRIC/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 0 2288 + 25000 5m 1248 2288 53248 0 2288 + 40000 5m 1248 2288 66560 0 2288 + 50000 5m 1248 2288 79872 0 2288 + 100000 5m 1248 2288 165568 0 2288 + 10000 40m 1248 2288 37024 0 2288 + 25000 40m 1248 2288 56160 0 2288 + 40000 40m 1248 2288 71552 0 2288 + 50000 40m 1248 2288 85696 0 2288 + 100000 40m 1248 2288 177632 0 2288 + 10000 300m 1248 2288 46176 0 2288 + 25000 300m 1248 2288 79040 0 2288 + 40000 300m 1248 2288 108160 0 2288 + 50000 300m 1248 2288 141856 0 2288 + 100000 300m 1248 2288 268736 0 2288 diff --git a/device/common/profiles/th/6100/RDMA-CENTRIC/qos.json.j2 b/device/common/profiles/th/6100/RDMA-CENTRIC/qos.json.j2 new file mode 100644 index 000000000000..34002048afdb --- /dev/null +++ b/device/common/profiles/th/6100/RDMA-CENTRIC/qos.json.j2 @@ -0,0 +1,21 @@ +{%- macro generate_wred_profiles() %} + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, +{%- endmacro %} + +{%- include 'qos_config.j2' %} diff --git a/device/common/profiles/th/6100/TCP-CENTRIC b/device/common/profiles/th/6100/TCP-CENTRIC new file mode 120000 index 000000000000..d6f7127aa748 --- /dev/null +++ b/device/common/profiles/th/6100/TCP-CENTRIC @@ -0,0 +1 @@ +BALANCED \ No newline at end of file diff --git a/device/common/profiles/th/gen/BALANCED/buffers_defaults_t0.j2 b/device/common/profiles/th/gen/BALANCED/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..b96563b0a796 --- /dev/null +++ b/device/common/profiles/th/gen/BALANCED/buffers_defaults_t0.j2 @@ -0,0 +1,41 @@ +{%- set default_cable = '5m' %} + +{%- include 'buffer_ports_t0.j2' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/common/profiles/th/gen/BALANCED/buffers_defaults_t1.j2 b/device/common/profiles/th/gen/BALANCED/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..56df5787c56a --- /dev/null +++ b/device/common/profiles/th/gen/BALANCED/buffers_defaults_t1.j2 @@ -0,0 +1,41 @@ +{%- set default_cable = '40m' %} + +{%- include 'buffer_ports_t1.j2' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/common/profiles/th/gen/BALANCED/pg_profile_lookup.ini b/device/common/profiles/th/gen/BALANCED/pg_profile_lookup.ini new file mode 100644 index 000000000000..673df369a9bb --- /dev/null +++ b/device/common/profiles/th/gen/BALANCED/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 0 2288 + 25000 5m 1248 2288 53248 0 2288 + 40000 5m 1248 2288 66560 0 2288 + 50000 5m 1248 2288 90272 0 2288 + 100000 5m 1248 2288 165568 0 2288 + 10000 40m 1248 2288 37024 0 2288 + 25000 40m 1248 2288 53248 0 2288 + 40000 40m 1248 2288 71552 0 2288 + 50000 40m 1248 2288 96096 0 2288 + 100000 40m 1248 2288 177632 0 2288 + 10000 300m 1248 2288 46176 0 2288 + 25000 300m 1248 2288 79040 0 2288 + 40000 300m 1248 2288 108160 0 2288 + 50000 300m 1248 2288 141856 0 2288 + 100000 300m 1248 2288 268736 0 2288 diff --git a/device/common/profiles/th/gen/BALANCED/qos.json.j2 b/device/common/profiles/th/gen/BALANCED/qos.json.j2 new file mode 100644 index 000000000000..34002048afdb --- /dev/null +++ b/device/common/profiles/th/gen/BALANCED/qos.json.j2 @@ -0,0 +1,21 @@ +{%- macro generate_wred_profiles() %} + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, +{%- endmacro %} + +{%- include 'qos_config.j2' %} diff --git a/device/common/profiles/th/gen/RDMA-CENTRIC/buffers_defaults_t0.j2 b/device/common/profiles/th/gen/RDMA-CENTRIC/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..b96563b0a796 --- /dev/null +++ b/device/common/profiles/th/gen/RDMA-CENTRIC/buffers_defaults_t0.j2 @@ -0,0 +1,41 @@ +{%- set default_cable = '5m' %} + +{%- include 'buffer_ports_t0.j2' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/common/profiles/th/gen/RDMA-CENTRIC/buffers_defaults_t1.j2 b/device/common/profiles/th/gen/RDMA-CENTRIC/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..56df5787c56a --- /dev/null +++ b/device/common/profiles/th/gen/RDMA-CENTRIC/buffers_defaults_t1.j2 @@ -0,0 +1,41 @@ +{%- set default_cable = '40m' %} + +{%- include 'buffer_ports_t1.j2' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "10875072", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_lossy_pool": { + "size": "9243812", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "static_th":"15982720" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/common/profiles/th/gen/RDMA-CENTRIC/pg_profile_lookup.ini b/device/common/profiles/th/gen/RDMA-CENTRIC/pg_profile_lookup.ini new file mode 100644 index 000000000000..673df369a9bb --- /dev/null +++ b/device/common/profiles/th/gen/RDMA-CENTRIC/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 0 2288 + 25000 5m 1248 2288 53248 0 2288 + 40000 5m 1248 2288 66560 0 2288 + 50000 5m 1248 2288 90272 0 2288 + 100000 5m 1248 2288 165568 0 2288 + 10000 40m 1248 2288 37024 0 2288 + 25000 40m 1248 2288 53248 0 2288 + 40000 40m 1248 2288 71552 0 2288 + 50000 40m 1248 2288 96096 0 2288 + 100000 40m 1248 2288 177632 0 2288 + 10000 300m 1248 2288 46176 0 2288 + 25000 300m 1248 2288 79040 0 2288 + 40000 300m 1248 2288 108160 0 2288 + 50000 300m 1248 2288 141856 0 2288 + 100000 300m 1248 2288 268736 0 2288 diff --git a/device/common/profiles/th/gen/RDMA-CENTRIC/qos.json.j2 b/device/common/profiles/th/gen/RDMA-CENTRIC/qos.json.j2 new file mode 100644 index 000000000000..34002048afdb --- /dev/null +++ b/device/common/profiles/th/gen/RDMA-CENTRIC/qos.json.j2 @@ -0,0 +1,21 @@ +{%- macro generate_wred_profiles() %} + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, +{%- endmacro %} + +{%- include 'qos_config.j2' %} diff --git a/device/common/profiles/th/gen/TCP-CENTRIC b/device/common/profiles/th/gen/TCP-CENTRIC new file mode 120000 index 000000000000..d6f7127aa748 --- /dev/null +++ b/device/common/profiles/th/gen/TCP-CENTRIC @@ -0,0 +1 @@ +BALANCED \ No newline at end of file diff --git a/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t0.j2 b/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..2d8e7cafe17e --- /dev/null +++ b/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t0.j2 @@ -0,0 +1,51 @@ +{%- set default_cable = '5m' %} + +{%- include 'buffer_ports_t0.j2' %} + +{%- import 'buffers_pool_sizes_t0.j2' as defs with context %} +{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} +{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic", + "xoff": "7827456" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "42349632", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"44302336" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "static_th":"42349632" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1664", + "dynamic_th":"-1" + } + }, +{%- endmacro %} + +{% import 'buffers_extra_queues.j2' as defs with context %} + +{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} +{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} +{%- endmacro %} diff --git a/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t1.j2 b/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..118dba43177a --- /dev/null +++ b/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t1.j2 @@ -0,0 +1,61 @@ +{%- set default_cable = '300m' %} + +{%- include 'buffer_ports_t1.j2' %} + +{%- import 'buffers_pool_sizes_t1.j2' as defs with context %} +{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} +{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + {# SS Tab2 Row 71 #} + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic", + {# SS Tab2 Row 68 #} + "xoff": "8965632" + }, + "egress_lossy_pool": { + {# SS Tab2 Row 60 #} + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + {# SS Tab2 Row 56 #} + "size": "43481152", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + {# SS Tab1 Row 9 #} + "static_th":"44302336" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + {# SS Tab2 Row 56 #} + "static_th":"43481152" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1664", + "dynamic_th":"-1" + } + }, +{%- endmacro %} + +{% import 'buffers_extra_queues.j2' as defs1 with context %} +{% import 'buffers_extra_pgs.j2' as defs2 with context %} + +{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} +{{ defs1.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} +{%- endmacro %} +{%- macro generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) %} +{{ defs2.generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) }} +{%- endmacro %} diff --git a/device/common/profiles/th2/7260/BALANCED/pg_profile_lookup.ini b/device/common/profiles/th2/7260/BALANCED/pg_profile_lookup.ini new file mode 100644 index 000000000000..9d94e3fc1e52 --- /dev/null +++ b/device/common/profiles/th2/7260/BALANCED/pg_profile_lookup.ini @@ -0,0 +1,11 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 100000 5m 1248 1248 54080 -3 2496 + 100000 40m 1248 1248 59696 -3 2496 + 100000 300m 1248 1248 101088 -3 2496 + 50000 5m 1248 1248 54080 -3 2496 + 50000 40m 1248 1248 59696 -3 2496 + 50000 300m 1248 1248 101088 -3 2496 + 40000 5m 1248 1248 29536 -3 2496 + 40000 40m 1248 1248 31616 -3 2496 + 40000 300m 1248 1248 48256 -3 2496 diff --git a/device/common/profiles/th2/7260/BALANCED/qos.json.j2 b/device/common/profiles/th2/7260/BALANCED/qos.json.j2 new file mode 100644 index 000000000000..cb3ad17faa39 --- /dev/null +++ b/device/common/profiles/th2/7260/BALANCED/qos.json.j2 @@ -0,0 +1,292 @@ +{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "2", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "6", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "0" + } + }, +{%- endmacro %} +{% elif ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR') %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + }, + "AZURE_TUNNEL": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "0", + "8": "0" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0", + "8": "0" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_queue_map() %} + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "1" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7", + "8": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48", + "8": "33" + } + }, +{%- endmacro %} +{% endif %} + +{%- include 'qos_config.j2' %} diff --git a/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t0.j2 b/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..2d8e7cafe17e --- /dev/null +++ b/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t0.j2 @@ -0,0 +1,51 @@ +{%- set default_cable = '5m' %} + +{%- include 'buffer_ports_t0.j2' %} + +{%- import 'buffers_pool_sizes_t0.j2' as defs with context %} +{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} +{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic", + "xoff": "7827456" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "42349632", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"44302336" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "static_th":"42349632" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1664", + "dynamic_th":"-1" + } + }, +{%- endmacro %} + +{% import 'buffers_extra_queues.j2' as defs with context %} + +{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} +{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} +{%- endmacro %} diff --git a/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t1.j2 b/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..118dba43177a --- /dev/null +++ b/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t1.j2 @@ -0,0 +1,61 @@ +{%- set default_cable = '300m' %} + +{%- include 'buffer_ports_t1.j2' %} + +{%- import 'buffers_pool_sizes_t1.j2' as defs with context %} +{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %} +{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + {# SS Tab2 Row 71 #} + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic", + {# SS Tab2 Row 68 #} + "xoff": "8965632" + }, + "egress_lossy_pool": { + {# SS Tab2 Row 60 #} + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + {# SS Tab2 Row 56 #} + "size": "43481152", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + {# SS Tab1 Row 9 #} + "static_th":"44302336" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + {# SS Tab2 Row 56 #} + "static_th":"43481152" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1664", + "dynamic_th":"-1" + } + }, +{%- endmacro %} + +{% import 'buffers_extra_queues.j2' as defs1 with context %} +{% import 'buffers_extra_pgs.j2' as defs2 with context %} + +{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} +{{ defs1.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} +{%- endmacro %} +{%- macro generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) %} +{{ defs2.generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) }} +{%- endmacro %} diff --git a/device/common/profiles/th2/7260/RDMA-CENTRIC/pg_profile_lookup.ini b/device/common/profiles/th2/7260/RDMA-CENTRIC/pg_profile_lookup.ini new file mode 100644 index 000000000000..9d94e3fc1e52 --- /dev/null +++ b/device/common/profiles/th2/7260/RDMA-CENTRIC/pg_profile_lookup.ini @@ -0,0 +1,11 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 100000 5m 1248 1248 54080 -3 2496 + 100000 40m 1248 1248 59696 -3 2496 + 100000 300m 1248 1248 101088 -3 2496 + 50000 5m 1248 1248 54080 -3 2496 + 50000 40m 1248 1248 59696 -3 2496 + 50000 300m 1248 1248 101088 -3 2496 + 40000 5m 1248 1248 29536 -3 2496 + 40000 40m 1248 1248 31616 -3 2496 + 40000 300m 1248 1248 48256 -3 2496 diff --git a/device/common/profiles/th2/7260/RDMA-CENTRIC/qos.json.j2 b/device/common/profiles/th2/7260/RDMA-CENTRIC/qos.json.j2 new file mode 100644 index 000000000000..cb3ad17faa39 --- /dev/null +++ b/device/common/profiles/th2/7260/RDMA-CENTRIC/qos.json.j2 @@ -0,0 +1,292 @@ +{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "2", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "6", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "0" + } + }, +{%- endmacro %} +{% elif ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR') %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + }, + "AZURE_TUNNEL": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "8", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "0", + "8": "0" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "0", + "6": "0", + "7": "0", + "8": "0" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_queue_map() %} + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "1" + }, + "AZURE_TUNNEL": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "6", + "5": "5", + "6": "1", + "7": "7", + "8": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_dscp_map() %} + "TC_TO_DSCP_MAP": { + "AZURE_TUNNEL": { + "0": "8", + "1": "0", + "2": "0", + "3": "2", + "4": "6", + "5": "46", + "6": "0", + "7": "48", + "8": "33" + } + }, +{%- endmacro %} +{% endif %} + +{%- include 'qos_config.j2' %} diff --git a/device/common/profiles/th2/7260/TCP-CENTRIC b/device/common/profiles/th2/7260/TCP-CENTRIC new file mode 120000 index 000000000000..d6f7127aa748 --- /dev/null +++ b/device/common/profiles/th2/7260/TCP-CENTRIC @@ -0,0 +1 @@ +BALANCED \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/BALANCED b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/BALANCED new file mode 120000 index 000000000000..6f064064664a --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/BALANCED @@ -0,0 +1 @@ +../../../common/profiles/th/6100/BALANCED \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/RDMA-CENTRIC b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/RDMA-CENTRIC new file mode 120000 index 000000000000..4ab30f5ff42f --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/RDMA-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/6100/RDMA-CENTRIC \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/TCP-CENTRIC b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/TCP-CENTRIC new file mode 120000 index 000000000000..d5d3a5b671b5 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/TCP-CENTRIC @@ -0,0 +1 @@ +../../../common/profiles/th/6100/TCP-CENTRIC \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffer_ports_t0.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffer_ports_t0.j2 new file mode 100644 index 000000000000..ae201eb2593a --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffer_ports_t0.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffer_ports_t1.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffer_ports_t1.j2 new file mode 100644 index 000000000000..ae201eb2593a --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffer_ports_t1.j2 @@ -0,0 +1,6 @@ +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 deleted file mode 100644 index 048188a39e95..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 +++ /dev/null @@ -1,47 +0,0 @@ - -{%- set default_cable = '5m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..9524e6a476ac --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 deleted file mode 100644 index 1c825b21640c..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 +++ /dev/null @@ -1,47 +0,0 @@ - -{%- set default_cable = '40m' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "10875072", - "type": "ingress", - "mode": "dynamic", - "xoff": "4194112" - }, - "egress_lossy_pool": { - "size": "9243812", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982720", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"1518", - "static_th":"15982720" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"1518", - "dynamic_th":"3" - } - }, -{%- endmacro %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..c25cc95d6d57 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +BALANCED/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini deleted file mode 100644 index 0b5d680edda7..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 0 2288 - 25000 5m 1248 2288 53248 0 2288 - 40000 5m 1248 2288 66560 0 2288 - 50000 5m 1248 2288 79872 0 2288 - 100000 5m 1248 2288 165568 0 2288 - 10000 40m 1248 2288 37024 0 2288 - 25000 40m 1248 2288 56160 0 2288 - 40000 40m 1248 2288 71552 0 2288 - 50000 40m 1248 2288 85696 0 2288 - 100000 40m 1248 2288 177632 0 2288 - 10000 300m 1248 2288 46176 0 2288 - 25000 300m 1248 2288 79040 0 2288 - 40000 300m 1248 2288 108160 0 2288 - 50000 300m 1248 2288 141856 0 2288 - 100000 300m 1248 2288 268736 0 2288 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini new file mode 120000 index 000000000000..297cddb2d223 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini @@ -0,0 +1 @@ +BALANCED/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 deleted file mode 100644 index 34002048afdb..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{%- macro generate_wred_profiles() %} - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable" : "true", - "wred_yellow_enable" : "true", - "wred_red_enable" : "true", - "ecn" : "ecn_all", - "green_max_threshold" : "2097152", - "green_min_threshold" : "250000", - "yellow_max_threshold" : "2097152", - "yellow_min_threshold" : "1048576", - "red_max_threshold" : "2097152", - "red_min_threshold" : "1048576", - "green_drop_probability" : "5", - "yellow_drop_probability": "5", - "red_drop_probability" : "5" - } - }, -{%- endmacro %} - -{%- include 'qos_config.j2' %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 new file mode 120000 index 000000000000..aef6b6765cf2 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 @@ -0,0 +1 @@ +BALANCED/qos.json.j2 \ No newline at end of file diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/buffers.json.j2 b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/buffers.json.j2 new file mode 100644 index 000000000000..f34a844f4a87 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't2' %} +{%- include 'buffers_config.j2' %} diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/buffers_defaults_t2.j2 b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/buffers_defaults_t2.j2 new file mode 100644 index 000000000000..9aa3e46bcae6 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/buffers_defaults_t2.j2 @@ -0,0 +1,37 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,36) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "6441610000", + "type": "both", + "mode": "dynamic", + "xoff": "24979046" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"1280", + "xon_offset": "2560", + "dynamic_th":"0" + }, + "egress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-1" + } + }, +{%- endmacro %} diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/context_config.json b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/context_config.json new file mode 100644 index 000000000000..5a8e83c7c92e --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/context_config.json @@ -0,0 +1,21 @@ +{ + "CONTEXTS": [ + { + "guid" : 0, + "name" : "syncd0", + "dbAsic" : "ASIC_DB", + "dbCounters" : "COUNTERS_DB", + "dbFlex": "FLEX_COUNTER_DB", + "dbState" : "STATE_DB", + "zmq_enable": false, + "zmq_endpoint": "tcp://127.0.0.1:5555", + "zmq_ntf_endpoint": "tcp://127.0.0.1:5556", + "switches": [ + { + "index" : 0, + "hwinfo" : "06:00.0" + } + ] + } + ] +} diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/jr2cp-nokia-18x100g-4x25g-config.bcm b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/jr2cp-nokia-18x100g-4x25g-config.bcm new file mode 100644 index 000000000000..0fae0269330b --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/jr2cp-nokia-18x100g-4x25g-config.bcm @@ -0,0 +1,2056 @@ +appl_enable_intr_init.BCM8885X=1 +appl_enable_learn_and_limit_init.BCM8885X=0 +appl_enable_oam.BCM8885X=0 +appl_enable_oam_fwd_idx_wa_init.BCM8885X=0 +appl_enable_oam_stat_wa_init.BCM8885X=0 +dma_desc_aggregator_buff_size_kb.BCM8885X=100 +dma_desc_aggregator_chain_length_max.BCM8885X=1000 +dma_desc_aggregator_enable_specific_MDB_LPM.BCM8885X=1 +dma_desc_aggregator_timeout_usec.BCM8885X=1000 +dport_map_direct.BCM8885X=1 + +dtm_flow_mapping_mode_region_64.BCM8885X=3 +dtm_flow_mapping_mode_region_65.BCM8885X=3 +dtm_flow_mapping_mode_region_66.BCM8885X=3 +dtm_flow_mapping_mode_region_67.BCM8885X=3 +dtm_flow_mapping_mode_region_68.BCM8885X=3 +dtm_flow_mapping_mode_region_69.BCM8885X=3 +dtm_flow_mapping_mode_region_70.BCM8885X=3 +dtm_flow_mapping_mode_region_71.BCM8885X=3 +dtm_flow_mapping_mode_region_72.BCM8885X=3 +dtm_flow_mapping_mode_region_73.BCM8885X=3 +dtm_flow_mapping_mode_region_74.BCM8885X=3 +dtm_flow_mapping_mode_region_75.BCM8885X=3 +dtm_flow_mapping_mode_region_76.BCM8885X=3 +dtm_flow_mapping_mode_region_77.BCM8885X=3 +dtm_flow_mapping_mode_region_78.BCM8885X=3 +dtm_flow_mapping_mode_region_79.BCM8885X=7 +dtm_flow_mapping_mode_region_80.BCM8885X=3 +dtm_flow_mapping_mode_region_81.BCM8885X=1 +dtm_flow_mapping_mode_region_82.BCM8885X=3 +dtm_flow_mapping_mode_region_83.BCM8885X=3 +dtm_flow_mapping_mode_region_84.BCM8885X=3 +dtm_flow_mapping_mode_region_85.BCM8885X=3 +dtm_flow_mapping_mode_region_86.BCM8885X=3 +dtm_flow_mapping_mode_region_87.BCM8885X=3 +dtm_flow_mapping_mode_region_88.BCM8885X=3 +dtm_flow_mapping_mode_region_89.BCM8885X=3 +dtm_flow_mapping_mode_region_90.BCM8885X=3 +dtm_flow_mapping_mode_region_91.BCM8885X=3 +dtm_flow_mapping_mode_region_92.BCM8885X=3 +dtm_flow_mapping_mode_region_93.BCM8885X=3 +dtm_flow_mapping_mode_region_94.BCM8885X=3 +dtm_flow_nof_remote_cores_region_1.BCM8885X=2 +dtm_flow_nof_remote_cores_region_10.BCM8885X=2 +dtm_flow_nof_remote_cores_region_11.BCM8885X=2 +dtm_flow_nof_remote_cores_region_12.BCM8885X=2 +dtm_flow_nof_remote_cores_region_13.BCM8885X=2 +dtm_flow_nof_remote_cores_region_14.BCM8885X=2 +dtm_flow_nof_remote_cores_region_15.BCM8885X=2 +dtm_flow_nof_remote_cores_region_16.BCM8885X=2 +dtm_flow_nof_remote_cores_region_17.BCM8885X=2 +dtm_flow_nof_remote_cores_region_18.BCM8885X=2 +dtm_flow_nof_remote_cores_region_19.BCM8885X=2 +dtm_flow_nof_remote_cores_region_2.BCM8885X=2 +dtm_flow_nof_remote_cores_region_20.BCM8885X=2 +dtm_flow_nof_remote_cores_region_21.BCM8885X=2 +dtm_flow_nof_remote_cores_region_22.BCM8885X=2 +dtm_flow_nof_remote_cores_region_23.BCM8885X=2 +dtm_flow_nof_remote_cores_region_24.BCM8885X=2 +dtm_flow_nof_remote_cores_region_25.BCM8885X=2 +dtm_flow_nof_remote_cores_region_26.BCM8885X=2 +dtm_flow_nof_remote_cores_region_27.BCM8885X=2 +dtm_flow_nof_remote_cores_region_28.BCM8885X=2 +dtm_flow_nof_remote_cores_region_29.BCM8885X=2 +dtm_flow_nof_remote_cores_region_3.BCM8885X=2 +dtm_flow_nof_remote_cores_region_30.BCM8885X=2 +dtm_flow_nof_remote_cores_region_31.BCM8885X=2 +dtm_flow_nof_remote_cores_region_32.BCM8885X=2 +dtm_flow_nof_remote_cores_region_33.BCM8885X=2 +dtm_flow_nof_remote_cores_region_34.BCM8885X=2 +dtm_flow_nof_remote_cores_region_35.BCM8885X=2 +dtm_flow_nof_remote_cores_region_36.BCM8885X=2 +dtm_flow_nof_remote_cores_region_37.BCM8885X=2 +dtm_flow_nof_remote_cores_region_38.BCM8885X=2 +dtm_flow_nof_remote_cores_region_39.BCM8885X=2 +dtm_flow_nof_remote_cores_region_4.BCM8885X=2 +dtm_flow_nof_remote_cores_region_40.BCM8885X=2 +dtm_flow_nof_remote_cores_region_41.BCM8885X=2 +dtm_flow_nof_remote_cores_region_42.BCM8885X=2 +dtm_flow_nof_remote_cores_region_43.BCM8885X=2 +dtm_flow_nof_remote_cores_region_44.BCM8885X=2 +dtm_flow_nof_remote_cores_region_45.BCM8885X=2 +dtm_flow_nof_remote_cores_region_46.BCM8885X=2 +dtm_flow_nof_remote_cores_region_47.BCM8885X=2 +dtm_flow_nof_remote_cores_region_48.BCM8885X=2 +dtm_flow_nof_remote_cores_region_49.BCM8885X=2 +dtm_flow_nof_remote_cores_region_5.BCM8885X=2 +dtm_flow_nof_remote_cores_region_50.BCM8885X=2 +dtm_flow_nof_remote_cores_region_51.BCM8885X=2 +dtm_flow_nof_remote_cores_region_52.BCM8885X=2 +dtm_flow_nof_remote_cores_region_53.BCM8885X=2 +dtm_flow_nof_remote_cores_region_54.BCM8885X=2 +dtm_flow_nof_remote_cores_region_55.BCM8885X=2 +dtm_flow_nof_remote_cores_region_56.BCM8885X=2 +dtm_flow_nof_remote_cores_region_57.BCM8885X=2 +dtm_flow_nof_remote_cores_region_58.BCM8885X=2 +dtm_flow_nof_remote_cores_region_59.BCM8885X=2 +dtm_flow_nof_remote_cores_region_6.BCM8885X=2 +dtm_flow_nof_remote_cores_region_60.BCM8885X=2 +dtm_flow_nof_remote_cores_region_7.BCM8885X=2 +dtm_flow_nof_remote_cores_region_8.BCM8885X=2 +dtm_flow_nof_remote_cores_region_9.BCM8885X=2 +dtm_flow_nof_remote_cores_region_73.BCM8869X=2 +dtm_flow_mapping_mode_region_73.BCM8869X=0 +dtm_flow_nof_remote_cores_region_74.BCM8869X=2 +dtm_flow_mapping_mode_region_74.BCM8869X=0 +dtm_flow_nof_remote_cores_region_75.BCM8869X=2 +dtm_flow_mapping_mode_region_75.BCM8869X=0 +ext_ram_enabled_bitmap.BCM8885X=3 +ext_ram_freq.BCM8885X=1200 +dram_temperature_threshold_restore_traffic.BCM8885X=89 +dram_temperature_threshold_power_down.BCM8885X=102 +dram_temperature_threshold_stop_traffic.BCM8885X=94 +dram_temperature_monitor_enable.BCM8885X=1 +fabric_connect_mode.BCM8885X=FE +ftmh_stacking_extension_size=0 +j2_ftmh_lb_key_extension_size=3 +j_ftmh_lb_key_extension_size=0 + + +lane_to_serdes_map_fabric_lane0.BCM8885X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8885X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8885X=rx2:tx3 +lane_to_serdes_map_fabric_lane3.BCM8885X=rx3:tx2 + +lane_to_serdes_map_fabric_lane4.BCM8885X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8885X=rx5:tx7 +lane_to_serdes_map_fabric_lane6.BCM8885X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8885X=rx7:tx5 + +lane_to_serdes_map_fabric_lane8.BCM8885X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8885X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8885X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8885X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8885X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8885X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8885X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8885X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8885X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8885X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8885X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8885X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8885X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8885X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8885X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8885X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8885X=rx24:tx26 +lane_to_serdes_map_fabric_lane25.BCM8885X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8885X=rx26:tx24 +lane_to_serdes_map_fabric_lane27.BCM8885X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8885X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8885X=rx29:tx31 +lane_to_serdes_map_fabric_lane30.BCM8885X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8885X=rx31:tx29 + +lane_to_serdes_map_fabric_lane32.BCM8885X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8885X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8885X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8885X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8885X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8885X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8885X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8885X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8885X=rx40:tx43 +lane_to_serdes_map_fabric_lane41.BCM8885X=rx41:tx42 +lane_to_serdes_map_fabric_lane42.BCM8885X=rx42:tx41 +lane_to_serdes_map_fabric_lane43.BCM8885X=rx43:tx40 + +lane_to_serdes_map_fabric_lane44.BCM8885X=rx44:tx47 +lane_to_serdes_map_fabric_lane45.BCM8885X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8885X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8885X=rx47:tx44 + +lane_to_serdes_map_fabric_lane48.BCM8885X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8885X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8885X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8885X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8885X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8885X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8885X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8885X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8885X=rx56:tx59 +lane_to_serdes_map_fabric_lane57.BCM8885X=rx57:tx58 +lane_to_serdes_map_fabric_lane58.BCM8885X=rx58:tx57 +lane_to_serdes_map_fabric_lane59.BCM8885X=rx59:tx56 + +lane_to_serdes_map_fabric_lane60.BCM8885X=rx60:tx63 +lane_to_serdes_map_fabric_lane61.BCM8885X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8885X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8885X=rx63:tx60 + +lane_to_serdes_map_fabric_lane64.BCM8885X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8885X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8885X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8885X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8885X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8885X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8885X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8885X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8885X=rx72:tx75 +lane_to_serdes_map_fabric_lane73.BCM8885X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8885X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8885X=rx75:tx72 + +lane_to_serdes_map_fabric_lane76.BCM8885X=rx76:tx79 +lane_to_serdes_map_fabric_lane77.BCM8885X=rx77:tx78 +lane_to_serdes_map_fabric_lane78.BCM8885X=rx78:tx77 +lane_to_serdes_map_fabric_lane79.BCM8885X=rx79:tx76 + +lane_to_serdes_map_fabric_lane80.BCM8885X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8885X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8885X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8885X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8885X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8885X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8885X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8885X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8885X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8885X=rx89:tx90 +lane_to_serdes_map_fabric_lane90.BCM8885X=rx90:tx89 +lane_to_serdes_map_fabric_lane91.BCM8885X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8885X=rx92:tx94 +lane_to_serdes_map_fabric_lane93.BCM8885X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8885X=rx94:tx92 +lane_to_serdes_map_fabric_lane95.BCM8885X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8885X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8885X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8885X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8885X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8885X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8885X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8885X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8885X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8885X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8885X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8885X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8885X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8885X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8885X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8885X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8885X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8885X=rx112:tx114 +lane_to_serdes_map_fabric_lane113.BCM8885X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8885X=rx114:tx112 +lane_to_serdes_map_fabric_lane115.BCM8885X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8885X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8885X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8885X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8885X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8885X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8885X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8885X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8885X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8885X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8885X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8885X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8885X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8885X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8885X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8885X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8885X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8885X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8885X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8885X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8885X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8885X=rx136:tx139 +lane_to_serdes_map_fabric_lane137.BCM8885X=rx137:tx138 +lane_to_serdes_map_fabric_lane138.BCM8885X=rx138:tx137 +lane_to_serdes_map_fabric_lane139.BCM8885X=rx139:tx136 + +lane_to_serdes_map_fabric_lane140.BCM8885X=rx140:tx143 +lane_to_serdes_map_fabric_lane141.BCM8885X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8885X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8885X=rx143:tx140 + +lane_to_serdes_map_fabric_lane144.BCM8885X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8885X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8885X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8885X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8885X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8885X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8885X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8885X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8885X=rx152:tx155 +lane_to_serdes_map_fabric_lane153.BCM8885X=rx153:tx154 +lane_to_serdes_map_fabric_lane154.BCM8885X=rx154:tx153 +lane_to_serdes_map_fabric_lane155.BCM8885X=rx155:tx152 + +lane_to_serdes_map_fabric_lane156.BCM8885X=rx156:tx159 +lane_to_serdes_map_fabric_lane157.BCM8885X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8885X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8885X=rx159:tx156 + +lane_to_serdes_map_fabric_lane160.BCM8885X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8885X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8885X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8885X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8885X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8885X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8885X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8885X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8885X=rx168:tx171 +lane_to_serdes_map_fabric_lane169.BCM8885X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8885X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8885X=rx171:tx168 + +lane_to_serdes_map_fabric_lane172.BCM8885X=rx172:tx175 +lane_to_serdes_map_fabric_lane173.BCM8885X=rx173:tx174 +lane_to_serdes_map_fabric_lane174.BCM8885X=rx174:tx173 +lane_to_serdes_map_fabric_lane175.BCM8885X=rx175:tx172 + +lane_to_serdes_map_fabric_lane176.BCM8885X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8885X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8885X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8885X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8885X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8885X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8885X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8885X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8885X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8885X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8885X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8885X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8885X=rx188:tx190 +lane_to_serdes_map_fabric_lane189.BCM8885X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8885X=rx190:tx188 +lane_to_serdes_map_fabric_lane191.BCM8885X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8885X=0 +phy_rx_polarity_flip_fabric1.BCM8885X=1 +phy_rx_polarity_flip_fabric2.BCM8885X=0 +phy_rx_polarity_flip_fabric3.BCM8885X=0 +phy_rx_polarity_flip_fabric4.BCM8885X=0 +phy_rx_polarity_flip_fabric5.BCM8885X=0 +phy_rx_polarity_flip_fabric6.BCM8885X=0 +phy_rx_polarity_flip_fabric7.BCM8885X=0 +phy_rx_polarity_flip_fabric8.BCM8885X=1 +phy_rx_polarity_flip_fabric9.BCM8885X=1 +phy_rx_polarity_flip_fabric10.BCM8885X=0 +phy_rx_polarity_flip_fabric11.BCM8885X=0 +phy_rx_polarity_flip_fabric12.BCM8885X=1 +phy_rx_polarity_flip_fabric13.BCM8885X=0 +phy_rx_polarity_flip_fabric14.BCM8885X=0 +phy_rx_polarity_flip_fabric15.BCM8885X=1 +phy_rx_polarity_flip_fabric16.BCM8885X=1 +phy_rx_polarity_flip_fabric17.BCM8885X=1 +phy_rx_polarity_flip_fabric18.BCM8885X=0 +phy_rx_polarity_flip_fabric19.BCM8885X=0 +phy_rx_polarity_flip_fabric20.BCM8885X=0 +phy_rx_polarity_flip_fabric21.BCM8885X=0 +phy_rx_polarity_flip_fabric22.BCM8885X=1 +phy_rx_polarity_flip_fabric23.BCM8885X=0 +phy_rx_polarity_flip_fabric24.BCM8885X=1 +phy_rx_polarity_flip_fabric25.BCM8885X=0 +phy_rx_polarity_flip_fabric26.BCM8885X=1 +phy_rx_polarity_flip_fabric27.BCM8885X=1 +phy_rx_polarity_flip_fabric28.BCM8885X=1 +phy_rx_polarity_flip_fabric29.BCM8885X=1 +phy_rx_polarity_flip_fabric30.BCM8885X=0 +phy_rx_polarity_flip_fabric31.BCM8885X=1 +phy_rx_polarity_flip_fabric32.BCM8885X=0 +phy_rx_polarity_flip_fabric33.BCM8885X=1 +phy_rx_polarity_flip_fabric34.BCM8885X=0 +phy_rx_polarity_flip_fabric35.BCM8885X=0 +phy_rx_polarity_flip_fabric36.BCM8885X=0 +phy_rx_polarity_flip_fabric37.BCM8885X=1 +phy_rx_polarity_flip_fabric38.BCM8885X=1 +phy_rx_polarity_flip_fabric39.BCM8885X=0 +phy_rx_polarity_flip_fabric40.BCM8885X=1 +phy_rx_polarity_flip_fabric41.BCM8885X=0 +phy_rx_polarity_flip_fabric42.BCM8885X=0 +phy_rx_polarity_flip_fabric43.BCM8885X=0 +phy_rx_polarity_flip_fabric44.BCM8885X=1 +phy_rx_polarity_flip_fabric45.BCM8885X=0 +phy_rx_polarity_flip_fabric46.BCM8885X=0 +phy_rx_polarity_flip_fabric47.BCM8885X=1 +phy_rx_polarity_flip_fabric48.BCM8885X=1 +phy_rx_polarity_flip_fabric49.BCM8885X=1 +phy_rx_polarity_flip_fabric50.BCM8885X=1 +phy_rx_polarity_flip_fabric51.BCM8885X=1 +phy_rx_polarity_flip_fabric52.BCM8885X=1 +phy_rx_polarity_flip_fabric53.BCM8885X=1 +phy_rx_polarity_flip_fabric54.BCM8885X=1 +phy_rx_polarity_flip_fabric55.BCM8885X=1 +phy_rx_polarity_flip_fabric56.BCM8885X=0 +phy_rx_polarity_flip_fabric57.BCM8885X=0 +phy_rx_polarity_flip_fabric58.BCM8885X=0 +phy_rx_polarity_flip_fabric59.BCM8885X=0 +phy_rx_polarity_flip_fabric60.BCM8885X=0 +phy_rx_polarity_flip_fabric61.BCM8885X=0 +phy_rx_polarity_flip_fabric62.BCM8885X=1 +phy_rx_polarity_flip_fabric63.BCM8885X=0 +phy_rx_polarity_flip_fabric64.BCM8885X=1 +phy_rx_polarity_flip_fabric65.BCM8885X=1 +phy_rx_polarity_flip_fabric66.BCM8885X=0 +phy_rx_polarity_flip_fabric67.BCM8885X=0 +phy_rx_polarity_flip_fabric68.BCM8885X=1 +phy_rx_polarity_flip_fabric69.BCM8885X=1 +phy_rx_polarity_flip_fabric70.BCM8885X=1 +phy_rx_polarity_flip_fabric71.BCM8885X=0 +phy_rx_polarity_flip_fabric72.BCM8885X=0 +phy_rx_polarity_flip_fabric73.BCM8885X=1 +phy_rx_polarity_flip_fabric74.BCM8885X=0 +phy_rx_polarity_flip_fabric75.BCM8885X=1 +phy_rx_polarity_flip_fabric76.BCM8885X=1 +phy_rx_polarity_flip_fabric77.BCM8885X=1 +phy_rx_polarity_flip_fabric78.BCM8885X=1 +phy_rx_polarity_flip_fabric79.BCM8885X=0 +phy_rx_polarity_flip_fabric80.BCM8885X=1 +phy_rx_polarity_flip_fabric81.BCM8885X=0 +phy_rx_polarity_flip_fabric82.BCM8885X=0 +phy_rx_polarity_flip_fabric83.BCM8885X=0 +phy_rx_polarity_flip_fabric84.BCM8885X=1 +phy_rx_polarity_flip_fabric85.BCM8885X=0 +phy_rx_polarity_flip_fabric86.BCM8885X=1 +phy_rx_polarity_flip_fabric87.BCM8885X=0 +phy_rx_polarity_flip_fabric88.BCM8885X=1 +phy_rx_polarity_flip_fabric89.BCM8885X=1 +phy_rx_polarity_flip_fabric90.BCM8885X=1 +phy_rx_polarity_flip_fabric91.BCM8885X=1 +phy_rx_polarity_flip_fabric92.BCM8885X=1 +phy_rx_polarity_flip_fabric93.BCM8885X=1 +phy_rx_polarity_flip_fabric94.BCM8885X=1 +phy_rx_polarity_flip_fabric95.BCM8885X=1 +phy_rx_polarity_flip_fabric96.BCM8885X=0 +phy_rx_polarity_flip_fabric97.BCM8885X=1 +phy_rx_polarity_flip_fabric98.BCM8885X=0 +phy_rx_polarity_flip_fabric99.BCM8885X=0 +phy_rx_polarity_flip_fabric100.BCM8885X=0 +phy_rx_polarity_flip_fabric101.BCM8885X=1 +phy_rx_polarity_flip_fabric102.BCM8885X=1 +phy_rx_polarity_flip_fabric103.BCM8885X=0 +phy_rx_polarity_flip_fabric104.BCM8885X=1 +phy_rx_polarity_flip_fabric105.BCM8885X=0 +phy_rx_polarity_flip_fabric106.BCM8885X=0 +phy_rx_polarity_flip_fabric107.BCM8885X=0 +phy_rx_polarity_flip_fabric108.BCM8885X=1 +phy_rx_polarity_flip_fabric109.BCM8885X=1 +phy_rx_polarity_flip_fabric110.BCM8885X=0 +phy_rx_polarity_flip_fabric111.BCM8885X=1 +phy_rx_polarity_flip_fabric112.BCM8885X=0 +phy_rx_polarity_flip_fabric113.BCM8885X=0 +phy_rx_polarity_flip_fabric114.BCM8885X=1 +phy_rx_polarity_flip_fabric115.BCM8885X=1 +phy_rx_polarity_flip_fabric116.BCM8885X=0 +phy_rx_polarity_flip_fabric117.BCM8885X=1 +phy_rx_polarity_flip_fabric118.BCM8885X=1 +phy_rx_polarity_flip_fabric119.BCM8885X=1 +phy_rx_polarity_flip_fabric120.BCM8885X=1 +phy_rx_polarity_flip_fabric121.BCM8885X=1 +phy_rx_polarity_flip_fabric122.BCM8885X=1 +phy_rx_polarity_flip_fabric123.BCM8885X=0 +phy_rx_polarity_flip_fabric124.BCM8885X=0 +phy_rx_polarity_flip_fabric125.BCM8885X=0 +phy_rx_polarity_flip_fabric126.BCM8885X=0 +phy_rx_polarity_flip_fabric127.BCM8885X=1 +phy_rx_polarity_flip_fabric128.BCM8885X=0 +phy_rx_polarity_flip_fabric129.BCM8885X=0 +phy_rx_polarity_flip_fabric130.BCM8885X=1 +phy_rx_polarity_flip_fabric131.BCM8885X=0 +phy_rx_polarity_flip_fabric132.BCM8885X=0 +phy_rx_polarity_flip_fabric133.BCM8885X=1 +phy_rx_polarity_flip_fabric134.BCM8885X=1 +phy_rx_polarity_flip_fabric135.BCM8885X=0 +phy_rx_polarity_flip_fabric136.BCM8885X=0 +phy_rx_polarity_flip_fabric137.BCM8885X=1 +phy_rx_polarity_flip_fabric138.BCM8885X=1 +phy_rx_polarity_flip_fabric139.BCM8885X=0 +phy_rx_polarity_flip_fabric140.BCM8885X=1 +phy_rx_polarity_flip_fabric141.BCM8885X=0 +phy_rx_polarity_flip_fabric142.BCM8885X=1 +phy_rx_polarity_flip_fabric143.BCM8885X=1 +phy_rx_polarity_flip_fabric144.BCM8885X=1 +phy_rx_polarity_flip_fabric145.BCM8885X=1 +phy_rx_polarity_flip_fabric146.BCM8885X=1 +phy_rx_polarity_flip_fabric147.BCM8885X=0 +phy_rx_polarity_flip_fabric148.BCM8885X=1 +phy_rx_polarity_flip_fabric149.BCM8885X=1 +phy_rx_polarity_flip_fabric150.BCM8885X=0 +phy_rx_polarity_flip_fabric151.BCM8885X=0 +phy_rx_polarity_flip_fabric152.BCM8885X=0 +phy_rx_polarity_flip_fabric153.BCM8885X=0 +phy_rx_polarity_flip_fabric154.BCM8885X=0 +phy_rx_polarity_flip_fabric155.BCM8885X=1 +phy_rx_polarity_flip_fabric156.BCM8885X=0 +phy_rx_polarity_flip_fabric157.BCM8885X=0 +phy_rx_polarity_flip_fabric158.BCM8885X=0 +phy_rx_polarity_flip_fabric159.BCM8885X=1 +phy_rx_polarity_flip_fabric160.BCM8885X=0 +phy_rx_polarity_flip_fabric161.BCM8885X=1 +phy_rx_polarity_flip_fabric162.BCM8885X=1 +phy_rx_polarity_flip_fabric163.BCM8885X=1 +phy_rx_polarity_flip_fabric164.BCM8885X=1 +phy_rx_polarity_flip_fabric165.BCM8885X=0 +phy_rx_polarity_flip_fabric166.BCM8885X=0 +phy_rx_polarity_flip_fabric167.BCM8885X=1 +phy_rx_polarity_flip_fabric168.BCM8885X=0 +phy_rx_polarity_flip_fabric169.BCM8885X=1 +phy_rx_polarity_flip_fabric170.BCM8885X=0 +phy_rx_polarity_flip_fabric171.BCM8885X=0 +phy_rx_polarity_flip_fabric172.BCM8885X=0 +phy_rx_polarity_flip_fabric173.BCM8885X=1 +phy_rx_polarity_flip_fabric174.BCM8885X=1 +phy_rx_polarity_flip_fabric175.BCM8885X=1 +phy_rx_polarity_flip_fabric176.BCM8885X=0 +phy_rx_polarity_flip_fabric177.BCM8885X=1 +phy_rx_polarity_flip_fabric178.BCM8885X=0 +phy_rx_polarity_flip_fabric179.BCM8885X=1 +phy_rx_polarity_flip_fabric180.BCM8885X=1 +phy_rx_polarity_flip_fabric181.BCM8885X=0 +phy_rx_polarity_flip_fabric182.BCM8885X=0 +phy_rx_polarity_flip_fabric183.BCM8885X=0 +phy_rx_polarity_flip_fabric184.BCM8885X=0 +phy_rx_polarity_flip_fabric185.BCM8885X=0 +phy_rx_polarity_flip_fabric186.BCM8885X=1 +phy_rx_polarity_flip_fabric187.BCM8885X=0 +phy_rx_polarity_flip_fabric188.BCM8885X=0 +phy_rx_polarity_flip_fabric189.BCM8885X=0 +phy_rx_polarity_flip_fabric190.BCM8885X=0 +phy_rx_polarity_flip_fabric191.BCM8885X=1 + + +phy_tx_polarity_flip_fabric0.BCM8885X=0 +phy_tx_polarity_flip_fabric1.BCM8885X=0 +phy_tx_polarity_flip_fabric2.BCM8885X=0 +phy_tx_polarity_flip_fabric3.BCM8885X=1 +phy_tx_polarity_flip_fabric4.BCM8885X=1 +phy_tx_polarity_flip_fabric5.BCM8885X=0 +phy_tx_polarity_flip_fabric6.BCM8885X=1 +phy_tx_polarity_flip_fabric7.BCM8885X=1 +phy_tx_polarity_flip_fabric8.BCM8885X=0 +phy_tx_polarity_flip_fabric9.BCM8885X=1 +phy_tx_polarity_flip_fabric10.BCM8885X=1 +phy_tx_polarity_flip_fabric11.BCM8885X=1 +phy_tx_polarity_flip_fabric12.BCM8885X=1 +phy_tx_polarity_flip_fabric13.BCM8885X=0 +phy_tx_polarity_flip_fabric14.BCM8885X=1 +phy_tx_polarity_flip_fabric15.BCM8885X=1 +phy_tx_polarity_flip_fabric16.BCM8885X=1 +phy_tx_polarity_flip_fabric17.BCM8885X=1 +phy_tx_polarity_flip_fabric18.BCM8885X=0 +phy_tx_polarity_flip_fabric19.BCM8885X=0 +phy_tx_polarity_flip_fabric20.BCM8885X=0 +phy_tx_polarity_flip_fabric21.BCM8885X=1 +phy_tx_polarity_flip_fabric22.BCM8885X=1 +phy_tx_polarity_flip_fabric23.BCM8885X=0 +phy_tx_polarity_flip_fabric24.BCM8885X=0 +phy_tx_polarity_flip_fabric25.BCM8885X=1 +phy_tx_polarity_flip_fabric26.BCM8885X=1 +phy_tx_polarity_flip_fabric27.BCM8885X=0 +phy_tx_polarity_flip_fabric28.BCM8885X=1 +phy_tx_polarity_flip_fabric29.BCM8885X=0 +phy_tx_polarity_flip_fabric30.BCM8885X=1 +phy_tx_polarity_flip_fabric31.BCM8885X=0 +phy_tx_polarity_flip_fabric32.BCM8885X=0 +phy_tx_polarity_flip_fabric33.BCM8885X=0 +phy_tx_polarity_flip_fabric34.BCM8885X=0 +phy_tx_polarity_flip_fabric35.BCM8885X=0 +phy_tx_polarity_flip_fabric36.BCM8885X=1 +phy_tx_polarity_flip_fabric37.BCM8885X=1 +phy_tx_polarity_flip_fabric38.BCM8885X=0 +phy_tx_polarity_flip_fabric39.BCM8885X=0 +phy_tx_polarity_flip_fabric40.BCM8885X=1 +phy_tx_polarity_flip_fabric41.BCM8885X=0 +phy_tx_polarity_flip_fabric42.BCM8885X=0 +phy_tx_polarity_flip_fabric43.BCM8885X=1 +phy_tx_polarity_flip_fabric44.BCM8885X=0 +phy_tx_polarity_flip_fabric45.BCM8885X=0 +phy_tx_polarity_flip_fabric46.BCM8885X=1 +phy_tx_polarity_flip_fabric47.BCM8885X=0 +phy_tx_polarity_flip_fabric48.BCM8885X=1 +phy_tx_polarity_flip_fabric49.BCM8885X=1 +phy_tx_polarity_flip_fabric50.BCM8885X=0 +phy_tx_polarity_flip_fabric51.BCM8885X=0 +phy_tx_polarity_flip_fabric52.BCM8885X=1 +phy_tx_polarity_flip_fabric53.BCM8885X=0 +phy_tx_polarity_flip_fabric54.BCM8885X=0 +phy_tx_polarity_flip_fabric55.BCM8885X=1 +phy_tx_polarity_flip_fabric56.BCM8885X=0 +phy_tx_polarity_flip_fabric57.BCM8885X=0 +phy_tx_polarity_flip_fabric58.BCM8885X=1 +phy_tx_polarity_flip_fabric59.BCM8885X=0 +phy_tx_polarity_flip_fabric60.BCM8885X=1 +phy_tx_polarity_flip_fabric61.BCM8885X=1 +phy_tx_polarity_flip_fabric62.BCM8885X=1 +phy_tx_polarity_flip_fabric63.BCM8885X=1 +phy_tx_polarity_flip_fabric64.BCM8885X=1 +phy_tx_polarity_flip_fabric65.BCM8885X=0 +phy_tx_polarity_flip_fabric66.BCM8885X=1 +phy_tx_polarity_flip_fabric67.BCM8885X=0 +phy_tx_polarity_flip_fabric68.BCM8885X=0 +phy_tx_polarity_flip_fabric69.BCM8885X=0 +phy_tx_polarity_flip_fabric70.BCM8885X=0 +phy_tx_polarity_flip_fabric71.BCM8885X=1 +phy_tx_polarity_flip_fabric72.BCM8885X=0 +phy_tx_polarity_flip_fabric73.BCM8885X=1 +phy_tx_polarity_flip_fabric74.BCM8885X=0 +phy_tx_polarity_flip_fabric75.BCM8885X=1 +phy_tx_polarity_flip_fabric76.BCM8885X=0 +phy_tx_polarity_flip_fabric77.BCM8885X=0 +phy_tx_polarity_flip_fabric78.BCM8885X=0 +phy_tx_polarity_flip_fabric79.BCM8885X=1 +phy_tx_polarity_flip_fabric80.BCM8885X=1 +phy_tx_polarity_flip_fabric81.BCM8885X=0 +phy_tx_polarity_flip_fabric82.BCM8885X=0 +phy_tx_polarity_flip_fabric83.BCM8885X=0 +phy_tx_polarity_flip_fabric84.BCM8885X=1 +phy_tx_polarity_flip_fabric85.BCM8885X=0 +phy_tx_polarity_flip_fabric86.BCM8885X=1 +phy_tx_polarity_flip_fabric87.BCM8885X=0 +phy_tx_polarity_flip_fabric88.BCM8885X=1 +phy_tx_polarity_flip_fabric89.BCM8885X=1 +phy_tx_polarity_flip_fabric90.BCM8885X=1 +phy_tx_polarity_flip_fabric91.BCM8885X=1 +phy_tx_polarity_flip_fabric92.BCM8885X=1 +phy_tx_polarity_flip_fabric93.BCM8885X=1 +phy_tx_polarity_flip_fabric94.BCM8885X=0 +phy_tx_polarity_flip_fabric95.BCM8885X=0 +phy_tx_polarity_flip_fabric96.BCM8885X=1 +phy_tx_polarity_flip_fabric97.BCM8885X=1 +phy_tx_polarity_flip_fabric98.BCM8885X=1 +phy_tx_polarity_flip_fabric99.BCM8885X=0 +phy_tx_polarity_flip_fabric100.BCM8885X=0 +phy_tx_polarity_flip_fabric101.BCM8885X=0 +phy_tx_polarity_flip_fabric102.BCM8885X=1 +phy_tx_polarity_flip_fabric103.BCM8885X=1 +phy_tx_polarity_flip_fabric104.BCM8885X=1 +phy_tx_polarity_flip_fabric105.BCM8885X=0 +phy_tx_polarity_flip_fabric106.BCM8885X=1 +phy_tx_polarity_flip_fabric107.BCM8885X=0 +phy_tx_polarity_flip_fabric108.BCM8885X=0 +phy_tx_polarity_flip_fabric109.BCM8885X=1 +phy_tx_polarity_flip_fabric110.BCM8885X=0 +phy_tx_polarity_flip_fabric111.BCM8885X=0 +phy_tx_polarity_flip_fabric112.BCM8885X=1 +phy_tx_polarity_flip_fabric113.BCM8885X=0 +phy_tx_polarity_flip_fabric114.BCM8885X=0 +phy_tx_polarity_flip_fabric115.BCM8885X=1 +phy_tx_polarity_flip_fabric116.BCM8885X=1 +phy_tx_polarity_flip_fabric117.BCM8885X=1 +phy_tx_polarity_flip_fabric118.BCM8885X=0 +phy_tx_polarity_flip_fabric119.BCM8885X=0 +phy_tx_polarity_flip_fabric120.BCM8885X=0 +phy_tx_polarity_flip_fabric121.BCM8885X=0 +phy_tx_polarity_flip_fabric122.BCM8885X=1 +phy_tx_polarity_flip_fabric123.BCM8885X=1 +phy_tx_polarity_flip_fabric124.BCM8885X=0 +phy_tx_polarity_flip_fabric125.BCM8885X=0 +phy_tx_polarity_flip_fabric126.BCM8885X=0 +phy_tx_polarity_flip_fabric127.BCM8885X=1 +phy_tx_polarity_flip_fabric128.BCM8885X=0 +phy_tx_polarity_flip_fabric129.BCM8885X=0 +phy_tx_polarity_flip_fabric130.BCM8885X=0 +phy_tx_polarity_flip_fabric131.BCM8885X=1 +phy_tx_polarity_flip_fabric132.BCM8885X=0 +phy_tx_polarity_flip_fabric133.BCM8885X=0 +phy_tx_polarity_flip_fabric134.BCM8885X=1 +phy_tx_polarity_flip_fabric135.BCM8885X=1 +phy_tx_polarity_flip_fabric136.BCM8885X=1 +phy_tx_polarity_flip_fabric137.BCM8885X=1 +phy_tx_polarity_flip_fabric138.BCM8885X=1 +phy_tx_polarity_flip_fabric139.BCM8885X=1 +phy_tx_polarity_flip_fabric140.BCM8885X=0 +phy_tx_polarity_flip_fabric141.BCM8885X=0 +phy_tx_polarity_flip_fabric142.BCM8885X=0 +phy_tx_polarity_flip_fabric143.BCM8885X=0 +phy_tx_polarity_flip_fabric144.BCM8885X=1 +phy_tx_polarity_flip_fabric145.BCM8885X=1 +phy_tx_polarity_flip_fabric146.BCM8885X=1 +phy_tx_polarity_flip_fabric147.BCM8885X=1 +phy_tx_polarity_flip_fabric148.BCM8885X=1 +phy_tx_polarity_flip_fabric149.BCM8885X=1 +phy_tx_polarity_flip_fabric150.BCM8885X=1 +phy_tx_polarity_flip_fabric151.BCM8885X=1 +phy_tx_polarity_flip_fabric152.BCM8885X=1 +phy_tx_polarity_flip_fabric153.BCM8885X=1 +phy_tx_polarity_flip_fabric154.BCM8885X=1 +phy_tx_polarity_flip_fabric155.BCM8885X=0 +phy_tx_polarity_flip_fabric156.BCM8885X=1 +phy_tx_polarity_flip_fabric157.BCM8885X=0 +phy_tx_polarity_flip_fabric158.BCM8885X=0 +phy_tx_polarity_flip_fabric159.BCM8885X=0 +phy_tx_polarity_flip_fabric160.BCM8885X=0 +phy_tx_polarity_flip_fabric161.BCM8885X=1 +phy_tx_polarity_flip_fabric162.BCM8885X=0 +phy_tx_polarity_flip_fabric163.BCM8885X=1 +phy_tx_polarity_flip_fabric164.BCM8885X=1 +phy_tx_polarity_flip_fabric165.BCM8885X=1 +phy_tx_polarity_flip_fabric166.BCM8885X=0 +phy_tx_polarity_flip_fabric167.BCM8885X=0 +phy_tx_polarity_flip_fabric168.BCM8885X=0 +phy_tx_polarity_flip_fabric169.BCM8885X=0 +phy_tx_polarity_flip_fabric170.BCM8885X=1 +phy_tx_polarity_flip_fabric171.BCM8885X=0 +phy_tx_polarity_flip_fabric172.BCM8885X=0 +phy_tx_polarity_flip_fabric173.BCM8885X=0 +phy_tx_polarity_flip_fabric174.BCM8885X=0 +phy_tx_polarity_flip_fabric175.BCM8885X=1 +phy_tx_polarity_flip_fabric176.BCM8885X=0 +phy_tx_polarity_flip_fabric177.BCM8885X=0 +phy_tx_polarity_flip_fabric178.BCM8885X=0 +phy_tx_polarity_flip_fabric179.BCM8885X=1 +phy_tx_polarity_flip_fabric180.BCM8885X=1 +phy_tx_polarity_flip_fabric181.BCM8885X=0 +phy_tx_polarity_flip_fabric182.BCM8885X=0 +phy_tx_polarity_flip_fabric183.BCM8885X=0 +phy_tx_polarity_flip_fabric184.BCM8885X=0 +phy_tx_polarity_flip_fabric185.BCM8885X=1 +phy_tx_polarity_flip_fabric186.BCM8885X=1 +phy_tx_polarity_flip_fabric187.BCM8885X=0 +phy_tx_polarity_flip_fabric188.BCM8885X=1 +phy_tx_polarity_flip_fabric189.BCM8885X=0 +phy_tx_polarity_flip_fabric190.BCM8885X=0 +phy_tx_polarity_flip_fabric191.BCM8885X=1 + + +lane_to_serdes_map_nif_lane0.BCM8885X=rx0:tx0 +lane_to_serdes_map_nif_lane1.BCM8885X=rx1:tx1 +lane_to_serdes_map_nif_lane2.BCM8885X=rx2:tx2 +lane_to_serdes_map_nif_lane3.BCM8885X=rx3:tx3 +lane_to_serdes_map_nif_lane4.BCM8885X=rx4:tx4 +lane_to_serdes_map_nif_lane5.BCM8885X=rx5:tx5 +lane_to_serdes_map_nif_lane6.BCM8885X=rx6:tx6 +lane_to_serdes_map_nif_lane7.BCM8885X=rx7:tx7 + +lane_to_serdes_map_nif_lane8.BCM8885X=rx8:tx8 +lane_to_serdes_map_nif_lane9.BCM8885X=rx9:tx9 +lane_to_serdes_map_nif_lane10.BCM8885X=rx10:tx10 +lane_to_serdes_map_nif_lane11.BCM8885X=rx11:tx11 +lane_to_serdes_map_nif_lane12.BCM8885X=rx12:tx12 +lane_to_serdes_map_nif_lane13.BCM8885X=rx13:tx13 +lane_to_serdes_map_nif_lane14.BCM8885X=rx14:tx14 +lane_to_serdes_map_nif_lane15.BCM8885X=rx15:tx15 + +lane_to_serdes_map_nif_lane16.BCM8885X=rx16:tx16 +lane_to_serdes_map_nif_lane17.BCM8885X=rx17:tx17 +lane_to_serdes_map_nif_lane18.BCM8885X=rx18:tx18 +lane_to_serdes_map_nif_lane19.BCM8885X=rx19:tx19 +lane_to_serdes_map_nif_lane20.BCM8885X=rx20:tx20 +lane_to_serdes_map_nif_lane21.BCM8885X=rx21:tx21 +lane_to_serdes_map_nif_lane22.BCM8885X=rx22:tx22 +lane_to_serdes_map_nif_lane23.BCM8885X=rx23:tx23 + +lane_to_serdes_map_nif_lane24.BCM8885X=rx24:tx24 +lane_to_serdes_map_nif_lane25.BCM8885X=rx25:tx25 +lane_to_serdes_map_nif_lane26.BCM8885X=rx26:tx26 +lane_to_serdes_map_nif_lane27.BCM8885X=rx27:tx27 +lane_to_serdes_map_nif_lane28.BCM8885X=rx28:tx28 +lane_to_serdes_map_nif_lane29.BCM8885X=rx29:tx29 +lane_to_serdes_map_nif_lane30.BCM8885X=rx30:tx30 +lane_to_serdes_map_nif_lane31.BCM8885X=rx31:tx31 + +lane_to_serdes_map_nif_lane32.BCM8885X=rx32:tx32 +lane_to_serdes_map_nif_lane33.BCM8885X=rx33:tx33 +lane_to_serdes_map_nif_lane34.BCM8885X=rx34:tx34 +lane_to_serdes_map_nif_lane35.BCM8885X=rx35:tx35 +lane_to_serdes_map_nif_lane36.BCM8885X=rx36:tx36 +lane_to_serdes_map_nif_lane37.BCM8885X=rx37:tx37 +lane_to_serdes_map_nif_lane38.BCM8885X=rx38:tx38 +lane_to_serdes_map_nif_lane39.BCM8885X=rx39:tx39 + +lane_to_serdes_map_nif_lane40.BCM8885X=rx40:tx40 +lane_to_serdes_map_nif_lane41.BCM8885X=rx41:tx41 +lane_to_serdes_map_nif_lane42.BCM8885X=rx42:tx42 +lane_to_serdes_map_nif_lane43.BCM8885X=rx43:tx43 +lane_to_serdes_map_nif_lane44.BCM8885X=rx44:tx44 +lane_to_serdes_map_nif_lane45.BCM8885X=rx45:tx45 +lane_to_serdes_map_nif_lane46.BCM8885X=rx46:tx46 +lane_to_serdes_map_nif_lane47.BCM8885X=rx47:tx47 + +lane_to_serdes_map_nif_lane48.BCM8885X=rx48:tx48 +lane_to_serdes_map_nif_lane49.BCM8885X=rx49:tx49 +lane_to_serdes_map_nif_lane50.BCM8885X=rx50:tx50 +lane_to_serdes_map_nif_lane51.BCM8885X=rx51:tx51 +lane_to_serdes_map_nif_lane52.BCM8885X=rx52:tx52 +lane_to_serdes_map_nif_lane53.BCM8885X=rx53:tx53 +lane_to_serdes_map_nif_lane54.BCM8885X=rx54:tx54 +lane_to_serdes_map_nif_lane55.BCM8885X=rx55:tx55 + +lane_to_serdes_map_nif_lane56.BCM8885X=rx56:tx56 +lane_to_serdes_map_nif_lane57.BCM8885X=rx57:tx57 +lane_to_serdes_map_nif_lane58.BCM8885X=rx58:tx58 +lane_to_serdes_map_nif_lane59.BCM8885X=rx59:tx59 +lane_to_serdes_map_nif_lane60.BCM8885X=rx60:tx60 +lane_to_serdes_map_nif_lane61.BCM8885X=rx61:tx61 +lane_to_serdes_map_nif_lane62.BCM8885X=rx62:tx62 +lane_to_serdes_map_nif_lane63.BCM8885X=rx63:tx63 + +lane_to_serdes_map_nif_lane64.BCM8885X=rx64:tx64 +lane_to_serdes_map_nif_lane65.BCM8885X=rx65:tx65 +lane_to_serdes_map_nif_lane66.BCM8885X=rx66:tx66 +lane_to_serdes_map_nif_lane67.BCM8885X=rx67:tx67 +lane_to_serdes_map_nif_lane68.BCM8885X=rx68:tx68 +lane_to_serdes_map_nif_lane69.BCM8885X=rx69:tx69 +lane_to_serdes_map_nif_lane70.BCM8885X=rx70:tx70 +lane_to_serdes_map_nif_lane71.BCM8885X=rx71:tx71 + +lane_to_serdes_map_nif_lane72.BCM8885X=rx72:tx72 +lane_to_serdes_map_nif_lane73.BCM8885X=rx73:tx73 +lane_to_serdes_map_nif_lane74.BCM8885X=rx74:tx74 +lane_to_serdes_map_nif_lane75.BCM8885X=rx75:tx75 +lane_to_serdes_map_nif_lane76.BCM8885X=rx76:tx76 +lane_to_serdes_map_nif_lane77.BCM8885X=rx77:tx77 +lane_to_serdes_map_nif_lane78.BCM8885X=rx78:tx78 +lane_to_serdes_map_nif_lane79.BCM8885X=rx79:tx79 + +lane_to_serdes_map_nif_lane80.BCM8885X=rx80:tx80 +lane_to_serdes_map_nif_lane81.BCM8885X=rx81:tx81 +lane_to_serdes_map_nif_lane82.BCM8885X=rx82:tx82 +lane_to_serdes_map_nif_lane83.BCM8885X=rx83:tx83 +lane_to_serdes_map_nif_lane84.BCM8885X=rx84:tx84 +lane_to_serdes_map_nif_lane85.BCM8885X=rx85:tx85 +lane_to_serdes_map_nif_lane86.BCM8885X=rx86:tx86 +lane_to_serdes_map_nif_lane87.BCM8885X=rx87:tx87 + +lane_to_serdes_map_nif_lane88.BCM8885X=rx88:tx88 +lane_to_serdes_map_nif_lane89.BCM8885X=rx89:tx89 +lane_to_serdes_map_nif_lane90.BCM8885X=rx90:tx90 +lane_to_serdes_map_nif_lane91.BCM8885X=rx91:tx91 +lane_to_serdes_map_nif_lane92.BCM8885X=rx92:tx92 +lane_to_serdes_map_nif_lane93.BCM8885X=rx93:tx93 +lane_to_serdes_map_nif_lane94.BCM8885X=rx94:tx94 +lane_to_serdes_map_nif_lane95.BCM8885X=rx95:tx95 + +lane_to_serdes_map_nif_lane96.BCM8885X=rx96:tx96 +lane_to_serdes_map_nif_lane97.BCM8885X=rx97:tx97 +lane_to_serdes_map_nif_lane98.BCM8885X=rx98:tx98 +lane_to_serdes_map_nif_lane99.BCM8885X=rx99:tx99 +lane_to_serdes_map_nif_lane100.BCM8885X=rx100:tx100 +lane_to_serdes_map_nif_lane101.BCM8885X=rx101:tx101 +lane_to_serdes_map_nif_lane102.BCM8885X=rx102:tx102 +lane_to_serdes_map_nif_lane103.BCM8885X=rx103:tx103 + +lane_to_serdes_map_nif_lane104.BCM8885X=rx104:tx104 +lane_to_serdes_map_nif_lane105.BCM8885X=rx105:tx105 +lane_to_serdes_map_nif_lane106.BCM8885X=rx106:tx106 +lane_to_serdes_map_nif_lane107.BCM8885X=rx107:tx107 +lane_to_serdes_map_nif_lane108.BCM8885X=rx108:tx108 +lane_to_serdes_map_nif_lane109.BCM8885X=rx109:tx109 +lane_to_serdes_map_nif_lane110.BCM8885X=rx110:tx110 +lane_to_serdes_map_nif_lane111.BCM8885X=rx111:tx111 + +lane_to_serdes_map_nif_lane112.BCM8885X=rx112:tx112 +lane_to_serdes_map_nif_lane113.BCM8885X=rx113:tx113 +lane_to_serdes_map_nif_lane114.BCM8885X=rx114:tx114 +lane_to_serdes_map_nif_lane115.BCM8885X=rx115:tx115 +lane_to_serdes_map_nif_lane116.BCM8885X=rx116:tx116 +lane_to_serdes_map_nif_lane117.BCM8885X=rx117:tx117 +lane_to_serdes_map_nif_lane118.BCM8885X=rx118:tx118 +lane_to_serdes_map_nif_lane119.BCM8885X=rx119:tx119 + +lane_to_serdes_map_nif_lane120.BCM8885X=rx120:tx120 +lane_to_serdes_map_nif_lane121.BCM8885X=rx121:tx121 +lane_to_serdes_map_nif_lane122.BCM8885X=rx122:tx122 +lane_to_serdes_map_nif_lane123.BCM8885X=rx123:tx123 +lane_to_serdes_map_nif_lane124.BCM8885X=rx124:tx124 +lane_to_serdes_map_nif_lane125.BCM8885X=rx125:tx125 +lane_to_serdes_map_nif_lane126.BCM8885X=rx126:tx126 +lane_to_serdes_map_nif_lane127.BCM8885X=rx127:tx127 + +lane_to_serdes_map_nif_lane128.BCM8885X=rx128:tx128 +lane_to_serdes_map_nif_lane129.BCM8885X=rx129:tx129 +lane_to_serdes_map_nif_lane130.BCM8885X=rx130:tx130 +lane_to_serdes_map_nif_lane131.BCM8885X=rx131:tx131 +lane_to_serdes_map_nif_lane132.BCM8885X=rx132:tx132 +lane_to_serdes_map_nif_lane133.BCM8885X=rx133:tx133 +lane_to_serdes_map_nif_lane134.BCM8885X=rx134:tx134 +lane_to_serdes_map_nif_lane135.BCM8885X=rx135:tx135 + +lane_to_serdes_map_nif_lane136.BCM8885X=rx136:tx136 +lane_to_serdes_map_nif_lane137.BCM8885X=rx137:tx137 +lane_to_serdes_map_nif_lane138.BCM8885X=rx138:tx138 +lane_to_serdes_map_nif_lane139.BCM8885X=rx139:tx139 +lane_to_serdes_map_nif_lane140.BCM8885X=rx140:tx140 +lane_to_serdes_map_nif_lane141.BCM8885X=rx141:tx141 +lane_to_serdes_map_nif_lane142.BCM8885X=rx142:tx142 +lane_to_serdes_map_nif_lane143.BCM8885X=rx143:tx143 + + +mdb_profile=Balanced-Exem +mdb_profile_kaps_cfg.BCM8885X=2 +mdio_output_delay=16 +mem_cache_enable_ecc.BCM8885X=1 +mem_cache_enable_parity.BCM8885X=1 +miim_intr_enable.BCM8885X=0 +os=unix +outlif_logical_to_physical_phase_map_1=S1 +outlif_logical_to_physical_phase_map_2=L1 +outlif_logical_to_physical_phase_map_3=XL +outlif_logical_to_physical_phase_map_4=L2 +outlif_logical_to_physical_phase_map_5=M1 +outlif_logical_to_physical_phase_map_6=M2 +outlif_logical_to_physical_phase_map_7=M3 +outlif_logical_to_physical_phase_map_8=S2 +outlif_physical_phase_data_granularity_L1=60 +outlif_physical_phase_data_granularity_L2=60 +outlif_physical_phase_data_granularity_M1=60 +outlif_physical_phase_data_granularity_M2=60 +outlif_physical_phase_data_granularity_M3=60 +outlif_physical_phase_data_granularity_S1=60 +outlif_physical_phase_data_granularity_S2=60 +outlif_physical_phase_data_granularity_XL=60 +pdma_continuous_mode_enable.BCM8885X=1 + + +phy_rx_polarity_flip_phy0.BCM8885X=1 +phy_rx_polarity_flip_phy1.BCM8885X=0 +phy_rx_polarity_flip_phy2.BCM8885X=1 +phy_rx_polarity_flip_phy3.BCM8885X=0 +phy_rx_polarity_flip_phy4.BCM8885X=1 +phy_rx_polarity_flip_phy5.BCM8885X=1 +phy_rx_polarity_flip_phy6.BCM8885X=1 +phy_rx_polarity_flip_phy7.BCM8885X=0 + +phy_rx_polarity_flip_phy8.BCM8885X=0 +phy_rx_polarity_flip_phy9.BCM8885X=0 +phy_rx_polarity_flip_phy10.BCM8885X=1 +phy_rx_polarity_flip_phy11.BCM8885X=0 +phy_rx_polarity_flip_phy12.BCM8885X=1 +phy_rx_polarity_flip_phy13.BCM8885X=0 +phy_rx_polarity_flip_phy14.BCM8885X=0 +phy_rx_polarity_flip_phy15.BCM8885X=0 + +phy_rx_polarity_flip_phy16.BCM8885X=1 +phy_rx_polarity_flip_phy17.BCM8885X=0 +phy_rx_polarity_flip_phy18.BCM8885X=1 +phy_rx_polarity_flip_phy19.BCM8885X=0 +phy_rx_polarity_flip_phy20.BCM8885X=1 +phy_rx_polarity_flip_phy21.BCM8885X=1 +phy_rx_polarity_flip_phy22.BCM8885X=1 +phy_rx_polarity_flip_phy23.BCM8885X=1 + +phy_rx_polarity_flip_phy24.BCM8885X=0 +phy_rx_polarity_flip_phy25.BCM8885X=1 +phy_rx_polarity_flip_phy26.BCM8885X=0 +phy_rx_polarity_flip_phy27.BCM8885X=1 +phy_rx_polarity_flip_phy28.BCM8885X=1 +phy_rx_polarity_flip_phy29.BCM8885X=1 +phy_rx_polarity_flip_phy30.BCM8885X=0 +phy_rx_polarity_flip_phy31.BCM8885X=1 + +phy_rx_polarity_flip_phy32.BCM8885X=1 +phy_rx_polarity_flip_phy33.BCM8885X=0 +phy_rx_polarity_flip_phy34.BCM8885X=1 +phy_rx_polarity_flip_phy35.BCM8885X=0 +phy_rx_polarity_flip_phy36.BCM8885X=0 +phy_rx_polarity_flip_phy37.BCM8885X=0 +phy_rx_polarity_flip_phy38.BCM8885X=0 +phy_rx_polarity_flip_phy39.BCM8885X=1 + +phy_rx_polarity_flip_phy40.BCM8885X=1 +phy_rx_polarity_flip_phy41.BCM8885X=1 +phy_rx_polarity_flip_phy42.BCM8885X=0 +phy_rx_polarity_flip_phy43.BCM8885X=1 +phy_rx_polarity_flip_phy44.BCM8885X=1 +phy_rx_polarity_flip_phy45.BCM8885X=0 +phy_rx_polarity_flip_phy46.BCM8885X=0 +phy_rx_polarity_flip_phy47.BCM8885X=1 + +phy_rx_polarity_flip_phy48.BCM8885X=0 +phy_rx_polarity_flip_phy49.BCM8885X=1 +phy_rx_polarity_flip_phy50.BCM8885X=0 +phy_rx_polarity_flip_phy51.BCM8885X=0 +phy_rx_polarity_flip_phy52.BCM8885X=0 +phy_rx_polarity_flip_phy53.BCM8885X=1 +phy_rx_polarity_flip_phy54.BCM8885X=0 +phy_rx_polarity_flip_phy55.BCM8885X=0 + +phy_rx_polarity_flip_phy56.BCM8885X=0 +phy_rx_polarity_flip_phy57.BCM8885X=0 +phy_rx_polarity_flip_phy58.BCM8885X=0 +phy_rx_polarity_flip_phy59.BCM8885X=0 +phy_rx_polarity_flip_phy60.BCM8885X=0 +phy_rx_polarity_flip_phy61.BCM8885X=0 +phy_rx_polarity_flip_phy62.BCM8885X=1 +phy_rx_polarity_flip_phy63.BCM8885X=1 + +phy_rx_polarity_flip_phy64.BCM8885X=0 +phy_rx_polarity_flip_phy65.BCM8885X=0 +phy_rx_polarity_flip_phy66.BCM8885X=0 +phy_rx_polarity_flip_phy67.BCM8885X=0 +phy_rx_polarity_flip_phy68.BCM8885X=0 +phy_rx_polarity_flip_phy69.BCM8885X=0 +phy_rx_polarity_flip_phy70.BCM8885X=0 +phy_rx_polarity_flip_phy71.BCM8885X=0 + +phy_rx_polarity_flip_phy72.BCM8885X=0 +phy_rx_polarity_flip_phy73.BCM8885X=0 +phy_rx_polarity_flip_phy74.BCM8885X=0 +phy_rx_polarity_flip_phy75.BCM8885X=1 +phy_rx_polarity_flip_phy76.BCM8885X=0 +phy_rx_polarity_flip_phy77.BCM8885X=1 +phy_rx_polarity_flip_phy78.BCM8885X=0 +phy_rx_polarity_flip_phy79.BCM8885X=0 + +phy_rx_polarity_flip_phy80.BCM8885X=1 +phy_rx_polarity_flip_phy81.BCM8885X=0 +phy_rx_polarity_flip_phy82.BCM8885X=1 +phy_rx_polarity_flip_phy83.BCM8885X=1 +phy_rx_polarity_flip_phy84.BCM8885X=0 +phy_rx_polarity_flip_phy85.BCM8885X=0 +phy_rx_polarity_flip_phy86.BCM8885X=1 +phy_rx_polarity_flip_phy87.BCM8885X=1 + +phy_rx_polarity_flip_phy88.BCM8885X=0 +phy_rx_polarity_flip_phy89.BCM8885X=1 +phy_rx_polarity_flip_phy90.BCM8885X=0 +phy_rx_polarity_flip_phy91.BCM8885X=0 +phy_rx_polarity_flip_phy92.BCM8885X=0 +phy_rx_polarity_flip_phy93.BCM8885X=0 +phy_rx_polarity_flip_phy94.BCM8885X=0 +phy_rx_polarity_flip_phy95.BCM8885X=1 + +phy_rx_polarity_flip_phy96.BCM8885X=0 +phy_rx_polarity_flip_phy97.BCM8885X=0 +phy_rx_polarity_flip_phy98.BCM8885X=0 +phy_rx_polarity_flip_phy99.BCM8885X=0 +phy_rx_polarity_flip_phy100.BCM8885X=0 +phy_rx_polarity_flip_phy101.BCM8885X=1 +phy_rx_polarity_flip_phy102.BCM8885X=1 +phy_rx_polarity_flip_phy103.BCM8885X=0 + +phy_rx_polarity_flip_phy104.BCM8885X=1 +phy_rx_polarity_flip_phy105.BCM8885X=1 +phy_rx_polarity_flip_phy106.BCM8885X=1 +phy_rx_polarity_flip_phy107.BCM8885X=1 +phy_rx_polarity_flip_phy108.BCM8885X=0 +phy_rx_polarity_flip_phy109.BCM8885X=1 +phy_rx_polarity_flip_phy110.BCM8885X=1 +phy_rx_polarity_flip_phy111.BCM8885X=1 + +phy_rx_polarity_flip_phy112.BCM8885X=0 +phy_rx_polarity_flip_phy113.BCM8885X=1 +phy_rx_polarity_flip_phy114.BCM8885X=1 +phy_rx_polarity_flip_phy115.BCM8885X=1 +phy_rx_polarity_flip_phy116.BCM8885X=1 +phy_rx_polarity_flip_phy117.BCM8885X=1 +phy_rx_polarity_flip_phy118.BCM8885X=0 +phy_rx_polarity_flip_phy119.BCM8885X=0 + +phy_rx_polarity_flip_phy120.BCM8885X=1 +phy_rx_polarity_flip_phy121.BCM8885X=0 +phy_rx_polarity_flip_phy122.BCM8885X=0 +phy_rx_polarity_flip_phy123.BCM8885X=1 +phy_rx_polarity_flip_phy124.BCM8885X=0 +phy_rx_polarity_flip_phy125.BCM8885X=1 +phy_rx_polarity_flip_phy126.BCM8885X=1 +phy_rx_polarity_flip_phy127.BCM8885X=0 + +phy_rx_polarity_flip_phy128.BCM8885X=0 +phy_rx_polarity_flip_phy129.BCM8885X=0 +phy_rx_polarity_flip_phy130.BCM8885X=1 +phy_rx_polarity_flip_phy131.BCM8885X=0 +phy_rx_polarity_flip_phy132.BCM8885X=0 +phy_rx_polarity_flip_phy133.BCM8885X=1 +phy_rx_polarity_flip_phy134.BCM8885X=1 +phy_rx_polarity_flip_phy135.BCM8885X=0 + +phy_rx_polarity_flip_phy136.BCM8885X=1 +phy_rx_polarity_flip_phy137.BCM8885X=0 +phy_rx_polarity_flip_phy138.BCM8885X=0 +phy_rx_polarity_flip_phy139.BCM8885X=1 +phy_rx_polarity_flip_phy140.BCM8885X=1 +phy_rx_polarity_flip_phy141.BCM8885X=1 +phy_rx_polarity_flip_phy142.BCM8885X=0 +phy_rx_polarity_flip_phy143.BCM8885X=1 + + +phy_tx_polarity_flip_phy0.BCM8885X=1 +phy_tx_polarity_flip_phy1.BCM8885X=0 +phy_tx_polarity_flip_phy2.BCM8885X=0 +phy_tx_polarity_flip_phy3.BCM8885X=0 +phy_tx_polarity_flip_phy4.BCM8885X=1 +phy_tx_polarity_flip_phy5.BCM8885X=0 +phy_tx_polarity_flip_phy6.BCM8885X=0 +phy_tx_polarity_flip_phy7.BCM8885X=1 + +phy_tx_polarity_flip_phy8.BCM8885X=0 +phy_tx_polarity_flip_phy9.BCM8885X=1 +phy_tx_polarity_flip_phy10.BCM8885X=0 +phy_tx_polarity_flip_phy11.BCM8885X=1 +phy_tx_polarity_flip_phy12.BCM8885X=1 +phy_tx_polarity_flip_phy13.BCM8885X=1 +phy_tx_polarity_flip_phy14.BCM8885X=0 +phy_tx_polarity_flip_phy15.BCM8885X=1 + +phy_tx_polarity_flip_phy16.BCM8885X=1 +phy_tx_polarity_flip_phy17.BCM8885X=1 +phy_tx_polarity_flip_phy18.BCM8885X=0 +phy_tx_polarity_flip_phy19.BCM8885X=0 +phy_tx_polarity_flip_phy20.BCM8885X=1 +phy_tx_polarity_flip_phy21.BCM8885X=1 +phy_tx_polarity_flip_phy22.BCM8885X=0 +phy_tx_polarity_flip_phy23.BCM8885X=0 + +phy_tx_polarity_flip_phy24.BCM8885X=0 +phy_tx_polarity_flip_phy25.BCM8885X=0 +phy_tx_polarity_flip_phy26.BCM8885X=0 +phy_tx_polarity_flip_phy27.BCM8885X=1 +phy_tx_polarity_flip_phy28.BCM8885X=0 +phy_tx_polarity_flip_phy29.BCM8885X=0 +phy_tx_polarity_flip_phy30.BCM8885X=0 +phy_tx_polarity_flip_phy31.BCM8885X=0 + +phy_tx_polarity_flip_phy32.BCM8885X=1 +phy_tx_polarity_flip_phy33.BCM8885X=1 +phy_tx_polarity_flip_phy34.BCM8885X=1 +phy_tx_polarity_flip_phy35.BCM8885X=0 +phy_tx_polarity_flip_phy36.BCM8885X=1 +phy_tx_polarity_flip_phy37.BCM8885X=1 +phy_tx_polarity_flip_phy38.BCM8885X=1 +phy_tx_polarity_flip_phy39.BCM8885X=0 + +phy_tx_polarity_flip_phy40.BCM8885X=0 +phy_tx_polarity_flip_phy41.BCM8885X=0 +phy_tx_polarity_flip_phy42.BCM8885X=1 +phy_tx_polarity_flip_phy43.BCM8885X=1 +phy_tx_polarity_flip_phy44.BCM8885X=0 +phy_tx_polarity_flip_phy45.BCM8885X=0 +phy_tx_polarity_flip_phy46.BCM8885X=1 +phy_tx_polarity_flip_phy47.BCM8885X=0 + +phy_tx_polarity_flip_phy48.BCM8885X=1 +phy_tx_polarity_flip_phy49.BCM8885X=1 +phy_tx_polarity_flip_phy50.BCM8885X=1 +phy_tx_polarity_flip_phy51.BCM8885X=0 +phy_tx_polarity_flip_phy52.BCM8885X=1 +phy_tx_polarity_flip_phy53.BCM8885X=0 +phy_tx_polarity_flip_phy54.BCM8885X=0 +phy_tx_polarity_flip_phy55.BCM8885X=0 + +phy_tx_polarity_flip_phy56.BCM8885X=0 +phy_tx_polarity_flip_phy57.BCM8885X=1 +phy_tx_polarity_flip_phy58.BCM8885X=0 +phy_tx_polarity_flip_phy59.BCM8885X=0 +phy_tx_polarity_flip_phy60.BCM8885X=0 +phy_tx_polarity_flip_phy61.BCM8885X=0 +phy_tx_polarity_flip_phy62.BCM8885X=0 +phy_tx_polarity_flip_phy63.BCM8885X=0 + +phy_tx_polarity_flip_phy64.BCM8885X=0 +phy_tx_polarity_flip_phy65.BCM8885X=1 +phy_tx_polarity_flip_phy66.BCM8885X=1 +phy_tx_polarity_flip_phy67.BCM8885X=0 +phy_tx_polarity_flip_phy68.BCM8885X=1 +phy_tx_polarity_flip_phy69.BCM8885X=0 +phy_tx_polarity_flip_phy70.BCM8885X=0 +phy_tx_polarity_flip_phy71.BCM8885X=1 + +phy_tx_polarity_flip_phy72.BCM8885X=1 +phy_tx_polarity_flip_phy73.BCM8885X=1 +phy_tx_polarity_flip_phy74.BCM8885X=0 +phy_tx_polarity_flip_phy75.BCM8885X=1 +phy_tx_polarity_flip_phy76.BCM8885X=1 +phy_tx_polarity_flip_phy77.BCM8885X=0 +phy_tx_polarity_flip_phy78.BCM8885X=0 +phy_tx_polarity_flip_phy79.BCM8885X=1 + +phy_tx_polarity_flip_phy80.BCM8885X=1 +phy_tx_polarity_flip_phy81.BCM8885X=0 +phy_tx_polarity_flip_phy82.BCM8885X=0 +phy_tx_polarity_flip_phy83.BCM8885X=0 +phy_tx_polarity_flip_phy84.BCM8885X=0 +phy_tx_polarity_flip_phy85.BCM8885X=0 +phy_tx_polarity_flip_phy86.BCM8885X=1 +phy_tx_polarity_flip_phy87.BCM8885X=0 + +phy_tx_polarity_flip_phy88.BCM8885X=1 +phy_tx_polarity_flip_phy89.BCM8885X=0 +phy_tx_polarity_flip_phy90.BCM8885X=1 +phy_tx_polarity_flip_phy91.BCM8885X=1 +phy_tx_polarity_flip_phy92.BCM8885X=1 +phy_tx_polarity_flip_phy93.BCM8885X=0 +phy_tx_polarity_flip_phy94.BCM8885X=1 +phy_tx_polarity_flip_phy95.BCM8885X=1 + +phy_tx_polarity_flip_phy96.BCM8885X=1 +phy_tx_polarity_flip_phy97.BCM8885X=1 +phy_tx_polarity_flip_phy98.BCM8885X=1 +phy_tx_polarity_flip_phy99.BCM8885X=0 +phy_tx_polarity_flip_phy100.BCM8885X=1 +phy_tx_polarity_flip_phy101.BCM8885X=1 +phy_tx_polarity_flip_phy102.BCM8885X=1 +phy_tx_polarity_flip_phy103.BCM8885X=0 + +phy_tx_polarity_flip_phy104.BCM8885X=0 +phy_tx_polarity_flip_phy105.BCM8885X=0 +phy_tx_polarity_flip_phy106.BCM8885X=0 +phy_tx_polarity_flip_phy107.BCM8885X=1 +phy_tx_polarity_flip_phy108.BCM8885X=1 +phy_tx_polarity_flip_phy109.BCM8885X=0 +phy_tx_polarity_flip_phy110.BCM8885X=1 +phy_tx_polarity_flip_phy111.BCM8885X=0 + +phy_tx_polarity_flip_phy112.BCM8885X=0 +phy_tx_polarity_flip_phy113.BCM8885X=1 +phy_tx_polarity_flip_phy114.BCM8885X=1 +phy_tx_polarity_flip_phy115.BCM8885X=0 +phy_tx_polarity_flip_phy116.BCM8885X=0 +phy_tx_polarity_flip_phy117.BCM8885X=1 +phy_tx_polarity_flip_phy118.BCM8885X=0 +phy_tx_polarity_flip_phy119.BCM8885X=0 + +phy_tx_polarity_flip_phy120.BCM8885X=0 +phy_tx_polarity_flip_phy121.BCM8885X=1 +phy_tx_polarity_flip_phy122.BCM8885X=1 +phy_tx_polarity_flip_phy123.BCM8885X=0 +phy_tx_polarity_flip_phy124.BCM8885X=0 +phy_tx_polarity_flip_phy125.BCM8885X=0 +phy_tx_polarity_flip_phy126.BCM8885X=1 +phy_tx_polarity_flip_phy127.BCM8885X=0 + +phy_tx_polarity_flip_phy128.BCM8885X=1 +phy_tx_polarity_flip_phy129.BCM8885X=1 +phy_tx_polarity_flip_phy130.BCM8885X=0 +phy_tx_polarity_flip_phy131.BCM8885X=0 +phy_tx_polarity_flip_phy132.BCM8885X=0 +phy_tx_polarity_flip_phy133.BCM8885X=1 +phy_tx_polarity_flip_phy134.BCM8885X=0 +phy_tx_polarity_flip_phy135.BCM8885X=0 + +phy_tx_polarity_flip_phy136.BCM8885X=0 +phy_tx_polarity_flip_phy137.BCM8885X=0 +phy_tx_polarity_flip_phy138.BCM8885X=0 +phy_tx_polarity_flip_phy139.BCM8885X=0 +phy_tx_polarity_flip_phy140.BCM8885X=0 +phy_tx_polarity_flip_phy141.BCM8885X=0 +phy_tx_polarity_flip_phy142.BCM8885X=0 +phy_tx_polarity_flip_phy143.BCM8885X=0 + + +polled_irq_delay.BCM8885X=5 +polled_irq_mode.BCM8885X=0 +port_fec_fabric.BCM8885X=7 +bcm_stat_interval.BCM8885X=1000000 + + +port_init_cl72_256=0 +port_init_cl72_257=0 +port_init_cl72_258=0 +port_init_cl72_259=0 +port_init_cl72_260=0 +port_init_cl72_261=0 +port_init_cl72_262=0 +port_init_cl72_263=0 +port_init_cl72_264=0 +port_init_cl72_265=0 +port_init_cl72_266=0 +port_init_cl72_267=0 +port_init_cl72_268=0 +port_init_cl72_269=0 +port_init_cl72_270=0 +port_init_cl72_271=0 +port_init_cl72_272=0 +port_init_cl72_273=0 +port_init_cl72_274=0 +port_init_cl72_275=0 +port_init_cl72_276=0 +port_init_cl72_277=0 +port_init_cl72_278=0 +port_init_cl72_279=0 +port_init_cl72_280=0 +port_init_cl72_281=0 +port_init_cl72_282=0 +port_init_cl72_283=0 +port_init_cl72_284=0 +port_init_cl72_285=0 +port_init_cl72_286=0 +port_init_cl72_287=0 +port_init_cl72_288=0 +port_init_cl72_289=0 +port_init_cl72_290=0 +port_init_cl72_291=0 +port_init_cl72_292=0 +port_init_cl72_293=0 +port_init_cl72_294=0 +port_init_cl72_295=0 +port_init_cl72_296=0 +port_init_cl72_297=0 +port_init_cl72_298=0 +port_init_cl72_299=0 +port_init_cl72_300=0 +port_init_cl72_301=0 +port_init_cl72_302=0 +port_init_cl72_303=0 +port_init_cl72_304=0 +port_init_cl72_305=0 +port_init_cl72_306=0 +port_init_cl72_307=0 +port_init_cl72_308=0 +port_init_cl72_309=0 +port_init_cl72_310=0 +port_init_cl72_311=0 +port_init_cl72_312=0 +port_init_cl72_313=0 +port_init_cl72_314=0 +port_init_cl72_315=0 +port_init_cl72_316=0 +port_init_cl72_317=0 +port_init_cl72_318=0 +port_init_cl72_319=0 +port_init_cl72_320=0 +port_init_cl72_321=0 +port_init_cl72_322=0 +port_init_cl72_323=0 +port_init_cl72_324=0 +port_init_cl72_325=0 +port_init_cl72_326=0 +port_init_cl72_327=0 +port_init_cl72_328=0 +port_init_cl72_329=0 +port_init_cl72_330=0 +port_init_cl72_331=0 +port_init_cl72_332=0 +port_init_cl72_333=0 +port_init_cl72_334=0 +port_init_cl72_335=0 +port_init_cl72_336=0 +port_init_cl72_337=0 +port_init_cl72_338=0 +port_init_cl72_339=0 +port_init_cl72_340=0 +port_init_cl72_341=0 +port_init_cl72_342=0 +port_init_cl72_343=0 +port_init_cl72_344=0 +port_init_cl72_345=0 +port_init_cl72_346=0 +port_init_cl72_347=0 +port_init_cl72_348=0 +port_init_cl72_349=0 +port_init_cl72_350=0 +port_init_cl72_351=0 +port_init_cl72_352=0 +port_init_cl72_353=0 +port_init_cl72_354=0 +port_init_cl72_355=0 +port_init_cl72_356=0 +port_init_cl72_357=0 +port_init_cl72_358=0 +port_init_cl72_359=0 +port_init_cl72_360=0 +port_init_cl72_361=0 +port_init_cl72_362=0 +port_init_cl72_363=0 +port_init_cl72_364=0 +port_init_cl72_365=0 +port_init_cl72_366=0 +port_init_cl72_367=0 +port_init_cl72_368=0 +port_init_cl72_369=0 +port_init_cl72_370=0 +port_init_cl72_371=0 +port_init_cl72_372=0 +port_init_cl72_373=0 +port_init_cl72_374=0 +port_init_cl72_375=0 +port_init_cl72_376=0 +port_init_cl72_377=0 +port_init_cl72_378=0 +port_init_cl72_379=0 +port_init_cl72_380=0 +port_init_cl72_381=0 +port_init_cl72_382=0 +port_init_cl72_383=0 +port_init_cl72_384=0 +port_init_cl72_385=0 +port_init_cl72_386=0 +port_init_cl72_387=0 +port_init_cl72_388=0 +port_init_cl72_389=0 +port_init_cl72_390=0 +port_init_cl72_391=0 +port_init_cl72_392=0 +port_init_cl72_393=0 +port_init_cl72_394=0 +port_init_cl72_395=0 +port_init_cl72_396=0 +port_init_cl72_397=0 +port_init_cl72_398=0 +port_init_cl72_399=0 +port_init_cl72_400=0 +port_init_cl72_401=0 +port_init_cl72_402=0 +port_init_cl72_403=0 +port_init_cl72_404=0 +port_init_cl72_405=0 +port_init_cl72_406=0 +port_init_cl72_407=0 +port_init_cl72_408=0 +port_init_cl72_409=0 +port_init_cl72_410=0 +port_init_cl72_411=0 +port_init_cl72_412=0 +port_init_cl72_413=0 +port_init_cl72_414=0 +port_init_cl72_415=0 +port_init_cl72_416=0 +port_init_cl72_417=0 +port_init_cl72_418=0 +port_init_cl72_419=0 +port_init_cl72_420=0 +port_init_cl72_421=0 +port_init_cl72_422=0 +port_init_cl72_423=0 +port_init_cl72_424=0 +port_init_cl72_425=0 +port_init_cl72_426=0 +port_init_cl72_427=0 +port_init_cl72_428=0 +port_init_cl72_429=0 +port_init_cl72_430=0 +port_init_cl72_431=0 +port_init_cl72_432=0 +port_init_cl72_433=0 +port_init_cl72_434=0 +port_init_cl72_435=0 +port_init_cl72_436=0 +port_init_cl72_437=0 +port_init_cl72_438=0 +port_init_cl72_439=0 +port_init_cl72_440=0 +port_init_cl72_441=0 +port_init_cl72_442=0 +port_init_cl72_443=0 +port_init_cl72_444=0 +port_init_cl72_445=0 +port_init_cl72_446=0 +port_init_cl72_447=0 + + +port_init_speed_cc.BCM8885X=200000 +port_init_speed_cd.BCM8885X=400000 +port_init_speed_ce.BCM8885X=100000 +port_init_speed_fabric.BCM8885X=53125 +port_init_speed_il.BCM8885X=10312 +port_init_speed_le.BCM8885X=50000 +port_init_speed_xe.BCM8885X=10000 +port_init_speed_xl.BCM8885X=40000 +port_priorities.BCM8885X=8 +protocol_traps_mode.BCM8885X=IN_LIF +rate_ext_mdio_divisor=16 +schan_intr_enable.BCM8885X=0 +schan_timeout_usec.BCM8885X=900000 +serdes_fabric_clk_freq_in.BCM8885X=1 +serdes_fabric_clk_freq_out.BCM8885X=bypass +serdes_nif_clk_freq_in0.BCM8885X=1 +serdes_nif_clk_freq_in1.BCM8885X=1 +serdes_nif_clk_freq_out0.BCM8885X=bypass +serdes_nif_clk_freq_out1.BCM8885X=bypass +soc_family.BCM8885X=BCM8885X +stable_filename.BCM8885X=/tmp/warmboot_data +stable_location.BCM8885X=3 +stable_size.BCM8885X=800000000 +sw_state_max_size.BCM8885X=750000000 +system_headers_mode=1 +tdma_intr_enable.BCM8885X=0 +tdma_timeout_usec.BCM8885X=1000000 +tm_port_header_type_in_0.BCM8885X=INJECTED_2 +tm_port_header_type_in_200.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_201.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_202.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_203.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_232.BCM8885X=INJECTED_2 +tm_port_header_type_in_19.BCM8885X=ETH +tm_port_header_type_in_20.BCM8885X=INJECTED_2 +tm_port_header_type_out_0.BCM8885X=CPU +tm_port_header_type_out_200.BCM8885X=ETH +tm_port_header_type_out_201.BCM8885X=ETH +tm_port_header_type_out_202.BCM8885X=ETH +tm_port_header_type_out_203.BCM8885X=ETH +tm_port_header_type_out_232.BCM8885X=CPU +tm_port_header_type_out_19.BCM8885X=ETH +tm_port_header_type_out_20.BCM8885X=RAW +tslam_intr_enable.BCM8885X=0 +tslam_timeout_usec.BCM8885X=1000000 +ucode_port_0.BCM8885X=CPU.0:core_0.0 +ucode_port_200.BCM8885X=CPU.8:core_1.200 +ucode_port_201.BCM8885X=CPU.16:core_1.201 +ucode_port_202.BCM8885X=CPU.24:core_1.202 +ucode_port_203.BCM8885X=CPU.32:core_1.203 + + +ucode_port_1.BCM8885X=CGE18:core_1.1 +ucode_port_2.BCM8885X=CGE20:core_1.2 +ucode_port_3.BCM8885X=CGE22:core_1.3 +ucode_port_4.BCM8885X=CGE24:core_1.4 +ucode_port_5.BCM8885X=CGE26:core_1.5 +ucode_port_6.BCM8885X=CGE28:core_1.6 +ucode_port_7.BCM8885X=CGE30:core_1.7 +ucode_port_8.BCM8885X=CGE32:core_1.8 +ucode_port_9.BCM8885X=CGE34:core_1.9 +ucode_port_10.BCM8885X=CGE16:core_0.10 +ucode_port_11.BCM8885X=CGE14:core_0.11 +ucode_port_12.BCM8885X=CGE12:core_0.12 +ucode_port_13.BCM8885X=CGE10:core_0.13 +ucode_port_14.BCM8885X=CGE8:core_0.14 +ucode_port_15.BCM8885X=CGE6:core_0.15 +ucode_port_16.BCM8885X=CGE4:core_0.16 +ucode_port_17.BCM8885X=CGE2:core_0.17 +ucode_port_18.BCM8885X=CGE0:core_0.18 + + +ucode_port_19.BCM8885X=RCY0:core_0.19 +ucode_port_20.BCM8885X=RCY1:core_1.20 +ucode_port_21.BCM8885X=OLP:core_1.21 + + +port_init_speed_1.BCM8885X=100000 +port_init_speed_2.BCM8885X=100000 +port_init_speed_3.BCM8885X=100000 +port_init_speed_4.BCM8885X=100000 +port_init_speed_5.BCM8885X=100000 +port_init_speed_6.BCM8885X=100000 +port_init_speed_7.BCM8885X=100000 +port_init_speed_8.BCM8885X=100000 +port_init_speed_9.BCM8885X=100000 +port_init_speed_10.BCM8885X=100000 +port_init_speed_11.BCM8885X=100000 +port_init_speed_12.BCM8885X=100000 +port_init_speed_13.BCM8885X=100000 +port_init_speed_14.BCM8885X=100000 +port_init_speed_15.BCM8885X=100000 +port_init_speed_16.BCM8885X=100000 +port_init_speed_17.BCM8885X=100000 +port_init_speed_18.BCM8885X=100000 + + +port_fec_1.BCM8885X=0 +port_fec_2.BCM8885X=0 +port_fec_3.BCM8885X=0 +port_fec_4.BCM8885X=0 +port_fec_5.BCM8885x=0 +port_fec_6.BCM8885x=0 +port_fec_7.BCM8885x=0 +port_fec_8.BCM8885x=0 +port_fec_9.BCM8885x=0 +port_fec_10.BCM8885x=0 +port_fec_11.BCM8885x=0 +port_fec_12.BCM8885x=0 +port_fec_13.BCM8885x=0 +port_fec_14.BCM8885x=0 +port_fec_15.BCM8885x=0 +port_fec_16.BCM8885x=0 +port_fec_17.BCM8885x=0 +port_fec_18.BCM8885x=0 + +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 + +serdes_lane_config_dfe_1.BCM8885X=lp +serdes_lane_config_dfe_2.BCM8885X=lp +serdes_lane_config_dfe_3.BCM8885X=lp +serdes_lane_config_dfe_4.BCM8885X=lp +serdes_lane_config_dfe_5.BCM8885X=lp +serdes_lane_config_dfe_6.BCM8885X=lp +serdes_lane_config_dfe_7.BCM8885X=lp +serdes_lane_config_dfe_8.BCM8885X=lp +serdes_lane_config_dfe_9.BCM8885X=lp +serdes_lane_config_dfe_10.BCM8885X=lp +serdes_lane_config_dfe_11.BCM8885X=lp +serdes_lane_config_dfe_12.BCM8885X=lp +serdes_lane_config_dfe_13.BCM8885X=lp +serdes_lane_config_dfe_14.BCM8885X=lp +serdes_lane_config_dfe_15.BCM8885X=lp +serdes_lane_config_dfe_16.BCM8885X=lp +serdes_lane_config_dfe_17.BCM8885X=lp +serdes_lane_config_dfe_18.BCM8885X=lp + + +serdes_lane_config_media_type_1.BCM8885X=backplane +serdes_lane_config_media_type_2.BCM8885X=backplane +serdes_lane_config_media_type_3.BCM8885X=backplane +serdes_lane_config_media_type_4.BCM8885X=backplane +serdes_lane_config_media_type_5.BCM8885X=backplane +serdes_lane_config_media_type_6.BCM8885X=backplane +serdes_lane_config_media_type_7.BCM8885X=backplane +serdes_lane_config_media_type_8.BCM8885X=backplane +serdes_lane_config_media_type_9.BCM8885X=backplane +serdes_lane_config_media_type_10.BCM8885X=backplane +serdes_lane_config_media_type_11.BCM8885X=backplane +serdes_lane_config_media_type_12.BCM8885X=backplane +serdes_lane_config_media_type_13.BCM8885X=backplane +serdes_lane_config_media_type_14.BCM8885X=backplane +serdes_lane_config_media_type_15.BCM8885X=backplane +serdes_lane_config_media_type_16.BCM8885X=backplane +serdes_lane_config_media_type_17.BCM8885X=backplane +serdes_lane_config_media_type_18.BCM8885X=backplane + + +serdes_tx_taps_1.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_2.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_3.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_4.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_5.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_6.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_7.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_8.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_9.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_10.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_11.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_12.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_13.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_14.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_15.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_16.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_17.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_18.BCM8885X=nrz:-6:87:-4 + + +serdes_tx_taps_256.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_257.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_258.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_259.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_260.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_261.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_262.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_263.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_264.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_265.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_266.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_267.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_268.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_269.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_270.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_271.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_272.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_273.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_274.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_275.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_276.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_277.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_278.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_279.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_280.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_281.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_282.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_283.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_284.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_285.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_286.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_287.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_288.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_289.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_290.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_291.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_292.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_293.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_294.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_295.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_296.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_297.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_298.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_299.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_300.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_301.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_302.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_303.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_304.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_305.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_306.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_307.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_308.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_309.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_310.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_311.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_312.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_313.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_314.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_315.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_316.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_317.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_318.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_319.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_320.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_321.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_322.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_323.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_324.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_325.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_326.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_327.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_328.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_329.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_330.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_331.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_332.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_333.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_334.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_335.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_336.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_337.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_338.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_339.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_340.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_341.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_342.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_343.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_344.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_345.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_346.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_347.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_348.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_349.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_350.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_351.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_352.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_353.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_354.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_355.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_356.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_357.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_358.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_359.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_360.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_361.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_362.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_363.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_364.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_365.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_366.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_367.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_368.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_369.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_370.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_371.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_372.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_373.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_374.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_375.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_376.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_377.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_378.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_379.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_380.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_381.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_382.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_383.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_384.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_385.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_386.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_387.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_388.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_389.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_390.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_391.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_392.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_393.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_394.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_395.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_396.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_397.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_398.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_399.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_400.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_401.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_402.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_403.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_404.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_405.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_406.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_407.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_408.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_409.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_410.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_411.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_412.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_413.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_414.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_415.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_416.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_417.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_418.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_419.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_420.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_421.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_422.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_423.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_424.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_425.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_426.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_427.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_428.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_429.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_430.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_431.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_432.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_433.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_434.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_435.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_436.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_437.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_438.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_439.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_440.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_441.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_442.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_443.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_444.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_445.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_446.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_447.BCM8885X=pam4:-20:148:0:0:0:0 + + +serdes_lane_config_channel_mode_256=force_nr +serdes_lane_config_channel_mode_257=force_nr +serdes_lane_config_channel_mode_258=force_nr +serdes_lane_config_channel_mode_259=force_nr +serdes_lane_config_channel_mode_260=force_nr +serdes_lane_config_channel_mode_261=force_nr +serdes_lane_config_channel_mode_262=force_nr +serdes_lane_config_channel_mode_263=force_nr +serdes_lane_config_channel_mode_264=force_nr +serdes_lane_config_channel_mode_265=force_nr +serdes_lane_config_channel_mode_266=force_nr +serdes_lane_config_channel_mode_267=force_nr +serdes_lane_config_channel_mode_268=force_nr +serdes_lane_config_channel_mode_269=force_nr +serdes_lane_config_channel_mode_270=force_nr +serdes_lane_config_channel_mode_271=force_nr +serdes_lane_config_channel_mode_272=force_nr +serdes_lane_config_channel_mode_273=force_nr +serdes_lane_config_channel_mode_274=force_nr +serdes_lane_config_channel_mode_275=force_nr +serdes_lane_config_channel_mode_276=force_nr +serdes_lane_config_channel_mode_277=force_nr +serdes_lane_config_channel_mode_278=force_nr +serdes_lane_config_channel_mode_279=force_nr +serdes_lane_config_channel_mode_280=force_nr +serdes_lane_config_channel_mode_281=force_nr +serdes_lane_config_channel_mode_282=force_nr +serdes_lane_config_channel_mode_283=force_nr +serdes_lane_config_channel_mode_284=force_nr +serdes_lane_config_channel_mode_285=force_nr +serdes_lane_config_channel_mode_286=force_nr +serdes_lane_config_channel_mode_287=force_nr +serdes_lane_config_channel_mode_288=force_nr +serdes_lane_config_channel_mode_289=force_nr +serdes_lane_config_channel_mode_290=force_nr +serdes_lane_config_channel_mode_291=force_nr +serdes_lane_config_channel_mode_292=force_nr +serdes_lane_config_channel_mode_293=force_nr +serdes_lane_config_channel_mode_294=force_nr +serdes_lane_config_channel_mode_295=force_nr +serdes_lane_config_channel_mode_296=force_nr +serdes_lane_config_channel_mode_297=force_nr +serdes_lane_config_channel_mode_298=force_nr +serdes_lane_config_channel_mode_299=force_nr +serdes_lane_config_channel_mode_300=force_nr +serdes_lane_config_channel_mode_301=force_nr +serdes_lane_config_channel_mode_302=force_nr +serdes_lane_config_channel_mode_303=force_nr +serdes_lane_config_channel_mode_304=force_nr +serdes_lane_config_channel_mode_305=force_nr +serdes_lane_config_channel_mode_306=force_nr +serdes_lane_config_channel_mode_307=force_nr +serdes_lane_config_channel_mode_308=force_nr +serdes_lane_config_channel_mode_309=force_nr +serdes_lane_config_channel_mode_310=force_nr +serdes_lane_config_channel_mode_311=force_nr +serdes_lane_config_channel_mode_312=force_nr +serdes_lane_config_channel_mode_313=force_nr +serdes_lane_config_channel_mode_314=force_nr +serdes_lane_config_channel_mode_315=force_nr +serdes_lane_config_channel_mode_316=force_nr +serdes_lane_config_channel_mode_317=force_nr +serdes_lane_config_channel_mode_318=force_nr +serdes_lane_config_channel_mode_319=force_nr +serdes_lane_config_channel_mode_320=force_nr +serdes_lane_config_channel_mode_321=force_nr +serdes_lane_config_channel_mode_322=force_nr +serdes_lane_config_channel_mode_323=force_nr +serdes_lane_config_channel_mode_324=force_nr +serdes_lane_config_channel_mode_325=force_nr +serdes_lane_config_channel_mode_326=force_nr +serdes_lane_config_channel_mode_327=force_nr +serdes_lane_config_channel_mode_328=force_nr +serdes_lane_config_channel_mode_329=force_nr +serdes_lane_config_channel_mode_330=force_nr +serdes_lane_config_channel_mode_331=force_nr +serdes_lane_config_channel_mode_332=force_nr +serdes_lane_config_channel_mode_333=force_nr +serdes_lane_config_channel_mode_334=force_nr +serdes_lane_config_channel_mode_335=force_nr +serdes_lane_config_channel_mode_336=force_nr +serdes_lane_config_channel_mode_337=force_nr +serdes_lane_config_channel_mode_338=force_nr +serdes_lane_config_channel_mode_339=force_nr +serdes_lane_config_channel_mode_340=force_nr +serdes_lane_config_channel_mode_341=force_nr +serdes_lane_config_channel_mode_342=force_nr +serdes_lane_config_channel_mode_343=force_nr +serdes_lane_config_channel_mode_344=force_nr +serdes_lane_config_channel_mode_345=force_nr +serdes_lane_config_channel_mode_346=force_nr +serdes_lane_config_channel_mode_347=force_nr +serdes_lane_config_channel_mode_348=force_nr +serdes_lane_config_channel_mode_349=force_nr +serdes_lane_config_channel_mode_350=force_nr +serdes_lane_config_channel_mode_351=force_nr +serdes_lane_config_channel_mode_352=force_nr +serdes_lane_config_channel_mode_353=force_nr +serdes_lane_config_channel_mode_354=force_nr +serdes_lane_config_channel_mode_355=force_nr +serdes_lane_config_channel_mode_356=force_nr +serdes_lane_config_channel_mode_357=force_nr +serdes_lane_config_channel_mode_358=force_nr +serdes_lane_config_channel_mode_359=force_nr +serdes_lane_config_channel_mode_360=force_nr +serdes_lane_config_channel_mode_361=force_nr +serdes_lane_config_channel_mode_362=force_nr +serdes_lane_config_channel_mode_363=force_nr +serdes_lane_config_channel_mode_364=force_nr +serdes_lane_config_channel_mode_365=force_nr +serdes_lane_config_channel_mode_366=force_nr +serdes_lane_config_channel_mode_367=force_nr +serdes_lane_config_channel_mode_368=force_nr +serdes_lane_config_channel_mode_369=force_nr +serdes_lane_config_channel_mode_370=force_nr +serdes_lane_config_channel_mode_371=force_nr +serdes_lane_config_channel_mode_372=force_nr +serdes_lane_config_channel_mode_373=force_nr +serdes_lane_config_channel_mode_374=force_nr +serdes_lane_config_channel_mode_375=force_nr +serdes_lane_config_channel_mode_376=force_nr +serdes_lane_config_channel_mode_377=force_nr +serdes_lane_config_channel_mode_378=force_nr +serdes_lane_config_channel_mode_379=force_nr +serdes_lane_config_channel_mode_380=force_nr +serdes_lane_config_channel_mode_381=force_nr +serdes_lane_config_channel_mode_382=force_nr +serdes_lane_config_channel_mode_383=force_nr +serdes_lane_config_channel_mode_384=force_nr +serdes_lane_config_channel_mode_385=force_nr +serdes_lane_config_channel_mode_386=force_nr +serdes_lane_config_channel_mode_387=force_nr +serdes_lane_config_channel_mode_388=force_nr +serdes_lane_config_channel_mode_389=force_nr +serdes_lane_config_channel_mode_390=force_nr +serdes_lane_config_channel_mode_391=force_nr +serdes_lane_config_channel_mode_392=force_nr +serdes_lane_config_channel_mode_393=force_nr +serdes_lane_config_channel_mode_394=force_nr +serdes_lane_config_channel_mode_395=force_nr +serdes_lane_config_channel_mode_396=force_nr +serdes_lane_config_channel_mode_397=force_nr +serdes_lane_config_channel_mode_398=force_nr +serdes_lane_config_channel_mode_399=force_nr +serdes_lane_config_channel_mode_400=force_nr +serdes_lane_config_channel_mode_401=force_nr +serdes_lane_config_channel_mode_402=force_nr +serdes_lane_config_channel_mode_403=force_nr +serdes_lane_config_channel_mode_404=force_nr +serdes_lane_config_channel_mode_405=force_nr +serdes_lane_config_channel_mode_406=force_nr +serdes_lane_config_channel_mode_407=force_nr +serdes_lane_config_channel_mode_408=force_nr +serdes_lane_config_channel_mode_409=force_nr +serdes_lane_config_channel_mode_410=force_nr +serdes_lane_config_channel_mode_411=force_nr +serdes_lane_config_channel_mode_412=force_nr +serdes_lane_config_channel_mode_413=force_nr +serdes_lane_config_channel_mode_414=force_nr +serdes_lane_config_channel_mode_415=force_nr +serdes_lane_config_channel_mode_416=force_nr +serdes_lane_config_channel_mode_417=force_nr +serdes_lane_config_channel_mode_418=force_nr +serdes_lane_config_channel_mode_419=force_nr +serdes_lane_config_channel_mode_420=force_nr +serdes_lane_config_channel_mode_421=force_nr +serdes_lane_config_channel_mode_422=force_nr +serdes_lane_config_channel_mode_423=force_nr +serdes_lane_config_channel_mode_424=force_nr +serdes_lane_config_channel_mode_425=force_nr +serdes_lane_config_channel_mode_426=force_nr +serdes_lane_config_channel_mode_427=force_nr +serdes_lane_config_channel_mode_428=force_nr +serdes_lane_config_channel_mode_429=force_nr +serdes_lane_config_channel_mode_430=force_nr +serdes_lane_config_channel_mode_431=force_nr +serdes_lane_config_channel_mode_432=force_nr +serdes_lane_config_channel_mode_433=force_nr +serdes_lane_config_channel_mode_434=force_nr +serdes_lane_config_channel_mode_435=force_nr +serdes_lane_config_channel_mode_436=force_nr +serdes_lane_config_channel_mode_437=force_nr +serdes_lane_config_channel_mode_438=force_nr +serdes_lane_config_channel_mode_439=force_nr +serdes_lane_config_channel_mode_440=force_nr +serdes_lane_config_channel_mode_441=force_nr +serdes_lane_config_channel_mode_442=force_nr +serdes_lane_config_channel_mode_443=force_nr +serdes_lane_config_channel_mode_444=force_nr +serdes_lane_config_channel_mode_445=force_nr +serdes_lane_config_channel_mode_446=force_nr +serdes_lane_config_channel_mode_447=force_nr + + +rif_id_max=24576 +dpp_db_path=/usr/share/bcm/db +sai_recycle_port_lane_base=96 +appl_param_nof_ports_per_modid=64 +udh_exists=1 +modreg IPS_FORCE_LOCAL_OR_FABRIC FORCE_FABRIC=1 +xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 +xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 +cmic_dma_abort_in_cold_boot=0 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/pg_profile_lookup.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/pg_profile_lookup.ini new file mode 100644 index 000000000000..7eb58931c209 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/pg_profile_lookup.ini @@ -0,0 +1,12 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 100000 300m 1280 2560 110592 0 1280 + 400000 300m 1280 2560 315392 0 1280 + 100000 1000m 1280 2560 225280 0 1280 + 400000 1000m 1280 2560 778240 0 1280 + 100000 2000m 1280 2560 393216 0 1280 + 400000 2000m 1280 2560 1445888 0 1280 + 100000 80000m 1280 2560 1388544 0 1280 + 400000 80000m 1280 2560 5435392 0 1280 + 100000 120000m 1280 2560 2056192 0 1280 + 400000 120000m 1280 2560 8093696 0 1280 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/port_config.ini new file mode 100644 index 000000000000..96710e7e0fb5 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/port_config.ini @@ -0,0 +1,21 @@ +# name lanes alias index asic_port_name role speed coreid coreportid numvoq +Ethernet0 72,73,74,75 Ethernet0 1 Eth0-ASIC0 Ext 100000 1 1 8 +Ethernet1 80,81,82,83 Ethernet1 2 Eth1-ASIC0 Ext 100000 1 2 8 +Ethernet2 88,89,90,91 Ethernet2 3 Eth2-ASIC0 Ext 100000 1 3 8 +Ethernet3 96,97,98,99 Ethernet3 4 Eth3-ASIC0 Ext 100000 1 4 8 +Ethernet4 104,105,106,107 Ethernet4 5 Eth4-ASIC0 Ext 100000 1 5 8 +Ethernet5 112,113,114,115 Ethernet5 6 Eth5-ASIC0 Ext 100000 1 6 8 +Ethernet6 120,121,122,123 Ethernet6 7 Eth6-ASIC0 Ext 100000 1 7 8 +Ethernet7 128,129,130,131 Ethernet7 8 Eth7-ASIC0 Ext 100000 1 8 8 +Ethernet8 136,137,138,139 Ethernet8 9 Eth8-ASIC0 Ext 100000 1 9 8 +Ethernet9 64,65,66,67 Ethernet9 10 Eth9-ASIC0 Ext 100000 0 10 8 +Ethernet10 56,57,58,59 Ethernet10 11 Eth10-ASIC0 Ext 100000 0 11 8 +Ethernet11 48,49,50,51 Ethernet11 12 Eth11-ASIC0 Ext 100000 0 12 8 +Ethernet12 40,41,42,43 Ethernet12 13 Eth12-ASIC0 Ext 100000 0 13 8 +Ethernet13 32,33,34,35 Ethernet13 14 Eth13-ASIC0 Ext 100000 0 14 8 +Ethernet14 24,25,26,27 Ethernet14 15 Eth14-ASIC0 Ext 100000 0 15 8 +Ethernet15 16,17,18,19 Ethernet15 16 Eth15-ASIC0 Ext 100000 0 16 8 +Ethernet16 8,9,10,11 Ethernet16 17 Eth16-ASIC0 Ext 100000 0 17 8 +Ethernet17 0,1,2,3 Ethernet17 18 Eth17-ASIC0 Ext 100000 0 18 8 +Ethernet-IB0 115 Ethernet-IB0 37 Rcy1-ASIC0 Inb 10000 0 19 8 +Ethernet-Rec0 116 Ethernet-Rec0 39 Rcy2-ASIC0 Rec 10000 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/qos.json.j2 b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai.profile b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai.profile new file mode 100644 index 000000000000..cebcc2d6ee48 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/jr2cp-nokia-18x100g-4x25g-config.bcm diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai_postinit_cmd.soc b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai_postinit_cmd.soc new file mode 100644 index 000000000000..26466f89ae44 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/0/sai_postinit_cmd.soc @@ -0,0 +1,36 @@ +phy set 3 reg=0xd134 data=-8 lane=0 +phy set 3 reg=0xd135 data=132 lane=0 +phy set 3 reg=0xd136 data=-8 lane=0 +phy set 3 reg=0xd137 data=0 lane=0 +phy set 3 reg=0xd138 data=0 lane=0 +phy set 3 reg=0xd133 data=0x1802 lane=0 + +phy set 3 reg=0xd134 data=-8 lane=1 +phy set 3 reg=0xd135 data=132 lane=1 +phy set 3 reg=0xd136 data=-12 lane=1 +phy set 3 reg=0xd137 data=0 lane=1 +phy set 3 reg=0xd138 data=0 lane=1 +phy set 3 reg=0xd133 data=0x1800 lane=1 + +phy set 3 reg=0xd134 data=-8 lane=7 +phy set 3 reg=0xd135 data=132 lane=7 +phy set 3 reg=0xd136 data=-8 lane=7 +phy set 3 reg=0xd137 data=0 lane=7 +phy set 3 reg=0xd138 data=0 lane=7 +phy set 3 reg=0xd133 data=0x1804 lane=7 + + +phy set 6 reg=0xd134 data=-8 lane=1 +phy set 6 reg=0xd135 data=132 lane=1 +phy set 6 reg=0xd136 data=-8 lane=1 +phy set 6 reg=0xd137 data=0 lane=1 +phy set 6 reg=0xd138 data=0 lane=1 +phy set 6 reg=0xd133 data=0x1802 lane=1 + + +phy set 8 reg=0xd134 data=-8 lane=1 +phy set 8 reg=0xd135 data=132 lane=1 +phy set 8 reg=0xd136 data=-8 lane=1 +phy set 8 reg=0xd137 data=0 lane=1 +phy set 8 reg=0xd138 data=0 lane=1 +phy set 8 reg=0xd133 data=0x1802 lane=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/buffers.json.j2 b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/buffers.json.j2 new file mode 100644 index 000000000000..f34a844f4a87 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't2' %} +{%- include 'buffers_config.j2' %} diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/buffers_defaults_t2.j2 b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/buffers_defaults_t2.j2 new file mode 100644 index 000000000000..9aa3e46bcae6 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/buffers_defaults_t2.j2 @@ -0,0 +1,37 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,36) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "6441610000", + "type": "both", + "mode": "dynamic", + "xoff": "24979046" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"1280", + "xon_offset": "2560", + "dynamic_th":"0" + }, + "egress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-1" + } + }, +{%- endmacro %} diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/context_config.json b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/context_config.json new file mode 100644 index 000000000000..5caa2e8eef88 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/context_config.json @@ -0,0 +1,21 @@ +{ + "CONTEXTS": [ + { + "guid" : 0, + "name" : "syncd1", + "dbAsic" : "ASIC_DB", + "dbCounters" : "COUNTERS_DB", + "dbFlex": "FLEX_COUNTER_DB", + "dbState" : "STATE_DB", + "zmq_enable": false, + "zmq_endpoint": "tcp://127.0.0.1:5555", + "zmq_ntf_endpoint": "tcp://127.0.0.1:5556", + "switches": [ + { + "index" : 1, + "hwinfo" : "07:00.0" + } + ] + } + ] +} diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/jr2cp-nokia-18x100g-4x25g-config.bcm b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/jr2cp-nokia-18x100g-4x25g-config.bcm new file mode 100644 index 000000000000..33af71fd8abf --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/jr2cp-nokia-18x100g-4x25g-config.bcm @@ -0,0 +1,2057 @@ +appl_enable_intr_init.BCM8885X=1 +appl_enable_learn_and_limit_init.BCM8885X=0 +appl_enable_oam.BCM8885X=0 +appl_enable_oam_fwd_idx_wa_init.BCM8885X=0 +appl_enable_oam_stat_wa_init.BCM8885X=0 +dma_desc_aggregator_buff_size_kb.BCM8885X=100 +dma_desc_aggregator_chain_length_max.BCM8885X=1000 +dma_desc_aggregator_enable_specific_MDB_LPM.BCM8885X=1 +dma_desc_aggregator_timeout_usec.BCM8885X=1000 +dport_map_direct.BCM8885X=1 + +dtm_flow_mapping_mode_region_64.BCM8885X=3 +dtm_flow_mapping_mode_region_65.BCM8885X=3 +dtm_flow_mapping_mode_region_66.BCM8885X=3 +dtm_flow_mapping_mode_region_67.BCM8885X=3 +dtm_flow_mapping_mode_region_68.BCM8885X=3 +dtm_flow_mapping_mode_region_69.BCM8885X=3 +dtm_flow_mapping_mode_region_70.BCM8885X=3 +dtm_flow_mapping_mode_region_71.BCM8885X=3 +dtm_flow_mapping_mode_region_72.BCM8885X=3 +dtm_flow_mapping_mode_region_73.BCM8885X=3 +dtm_flow_mapping_mode_region_74.BCM8885X=3 +dtm_flow_mapping_mode_region_75.BCM8885X=3 +dtm_flow_mapping_mode_region_76.BCM8885X=3 +dtm_flow_mapping_mode_region_77.BCM8885X=3 +dtm_flow_mapping_mode_region_78.BCM8885X=3 +dtm_flow_mapping_mode_region_79.BCM8885X=7 +dtm_flow_mapping_mode_region_80.BCM8885X=3 +dtm_flow_mapping_mode_region_81.BCM8885X=1 +dtm_flow_mapping_mode_region_82.BCM8885X=3 +dtm_flow_mapping_mode_region_83.BCM8885X=3 +dtm_flow_mapping_mode_region_84.BCM8885X=3 +dtm_flow_mapping_mode_region_85.BCM8885X=3 +dtm_flow_mapping_mode_region_86.BCM8885X=3 +dtm_flow_mapping_mode_region_87.BCM8885X=3 +dtm_flow_mapping_mode_region_88.BCM8885X=3 +dtm_flow_mapping_mode_region_89.BCM8885X=3 +dtm_flow_mapping_mode_region_90.BCM8885X=3 +dtm_flow_mapping_mode_region_91.BCM8885X=3 +dtm_flow_mapping_mode_region_92.BCM8885X=3 +dtm_flow_mapping_mode_region_93.BCM8885X=3 +dtm_flow_mapping_mode_region_94.BCM8885X=3 +dtm_flow_nof_remote_cores_region_1.BCM8885X=2 +dtm_flow_nof_remote_cores_region_10.BCM8885X=2 +dtm_flow_nof_remote_cores_region_11.BCM8885X=2 +dtm_flow_nof_remote_cores_region_12.BCM8885X=2 +dtm_flow_nof_remote_cores_region_13.BCM8885X=2 +dtm_flow_nof_remote_cores_region_14.BCM8885X=2 +dtm_flow_nof_remote_cores_region_15.BCM8885X=2 +dtm_flow_nof_remote_cores_region_16.BCM8885X=2 +dtm_flow_nof_remote_cores_region_17.BCM8885X=2 +dtm_flow_nof_remote_cores_region_18.BCM8885X=2 +dtm_flow_nof_remote_cores_region_19.BCM8885X=2 +dtm_flow_nof_remote_cores_region_2.BCM8885X=2 +dtm_flow_nof_remote_cores_region_20.BCM8885X=2 +dtm_flow_nof_remote_cores_region_21.BCM8885X=2 +dtm_flow_nof_remote_cores_region_22.BCM8885X=2 +dtm_flow_nof_remote_cores_region_23.BCM8885X=2 +dtm_flow_nof_remote_cores_region_24.BCM8885X=2 +dtm_flow_nof_remote_cores_region_25.BCM8885X=2 +dtm_flow_nof_remote_cores_region_26.BCM8885X=2 +dtm_flow_nof_remote_cores_region_27.BCM8885X=2 +dtm_flow_nof_remote_cores_region_28.BCM8885X=2 +dtm_flow_nof_remote_cores_region_29.BCM8885X=2 +dtm_flow_nof_remote_cores_region_3.BCM8885X=2 +dtm_flow_nof_remote_cores_region_30.BCM8885X=2 +dtm_flow_nof_remote_cores_region_31.BCM8885X=2 +dtm_flow_nof_remote_cores_region_32.BCM8885X=2 +dtm_flow_nof_remote_cores_region_33.BCM8885X=2 +dtm_flow_nof_remote_cores_region_34.BCM8885X=2 +dtm_flow_nof_remote_cores_region_35.BCM8885X=2 +dtm_flow_nof_remote_cores_region_36.BCM8885X=2 +dtm_flow_nof_remote_cores_region_37.BCM8885X=2 +dtm_flow_nof_remote_cores_region_38.BCM8885X=2 +dtm_flow_nof_remote_cores_region_39.BCM8885X=2 +dtm_flow_nof_remote_cores_region_4.BCM8885X=2 +dtm_flow_nof_remote_cores_region_40.BCM8885X=2 +dtm_flow_nof_remote_cores_region_41.BCM8885X=2 +dtm_flow_nof_remote_cores_region_42.BCM8885X=2 +dtm_flow_nof_remote_cores_region_43.BCM8885X=2 +dtm_flow_nof_remote_cores_region_44.BCM8885X=2 +dtm_flow_nof_remote_cores_region_45.BCM8885X=2 +dtm_flow_nof_remote_cores_region_46.BCM8885X=2 +dtm_flow_nof_remote_cores_region_47.BCM8885X=2 +dtm_flow_nof_remote_cores_region_48.BCM8885X=2 +dtm_flow_nof_remote_cores_region_49.BCM8885X=2 +dtm_flow_nof_remote_cores_region_5.BCM8885X=2 +dtm_flow_nof_remote_cores_region_50.BCM8885X=2 +dtm_flow_nof_remote_cores_region_51.BCM8885X=2 +dtm_flow_nof_remote_cores_region_52.BCM8885X=2 +dtm_flow_nof_remote_cores_region_53.BCM8885X=2 +dtm_flow_nof_remote_cores_region_54.BCM8885X=2 +dtm_flow_nof_remote_cores_region_55.BCM8885X=2 +dtm_flow_nof_remote_cores_region_56.BCM8885X=2 +dtm_flow_nof_remote_cores_region_57.BCM8885X=2 +dtm_flow_nof_remote_cores_region_58.BCM8885X=2 +dtm_flow_nof_remote_cores_region_59.BCM8885X=2 +dtm_flow_nof_remote_cores_region_6.BCM8885X=2 +dtm_flow_nof_remote_cores_region_60.BCM8885X=2 +dtm_flow_nof_remote_cores_region_7.BCM8885X=2 +dtm_flow_nof_remote_cores_region_8.BCM8885X=2 +dtm_flow_nof_remote_cores_region_9.BCM8885X=2 +dtm_flow_nof_remote_cores_region_73.BCM8869X=2 +dtm_flow_mapping_mode_region_73.BCM8869X=0 +dtm_flow_nof_remote_cores_region_74.BCM8869X=2 +dtm_flow_mapping_mode_region_74.BCM8869X=0 +dtm_flow_nof_remote_cores_region_75.BCM8869X=2 +dtm_flow_mapping_mode_region_75.BCM8869X=0 +ext_ram_enabled_bitmap.BCM8885X=3 +ext_ram_freq.BCM8885X=1200 +dram_temperature_threshold_restore_traffic.BCM8885X=89 +dram_temperature_threshold_power_down.BCM8885X=102 +dram_temperature_threshold_stop_traffic.BCM8885X=94 +dram_temperature_monitor_enable.BCM8885X=1 +fabric_connect_mode.BCM8885X=FE +ftmh_stacking_extension_size=0 +j2_ftmh_lb_key_extension_size=3 +j_ftmh_lb_key_extension_size=0 + + +lane_to_serdes_map_fabric_lane0.BCM8885X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8885X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8885X=rx2:tx3 +lane_to_serdes_map_fabric_lane3.BCM8885X=rx3:tx2 + +lane_to_serdes_map_fabric_lane4.BCM8885X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8885X=rx5:tx7 +lane_to_serdes_map_fabric_lane6.BCM8885X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8885X=rx7:tx5 + +lane_to_serdes_map_fabric_lane8.BCM8885X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8885X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8885X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8885X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8885X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8885X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8885X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8885X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8885X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8885X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8885X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8885X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8885X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8885X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8885X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8885X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8885X=rx24:tx26 +lane_to_serdes_map_fabric_lane25.BCM8885X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8885X=rx26:tx24 +lane_to_serdes_map_fabric_lane27.BCM8885X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8885X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8885X=rx29:tx31 +lane_to_serdes_map_fabric_lane30.BCM8885X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8885X=rx31:tx29 + +lane_to_serdes_map_fabric_lane32.BCM8885X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8885X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8885X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8885X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8885X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8885X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8885X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8885X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8885X=rx40:tx43 +lane_to_serdes_map_fabric_lane41.BCM8885X=rx41:tx42 +lane_to_serdes_map_fabric_lane42.BCM8885X=rx42:tx41 +lane_to_serdes_map_fabric_lane43.BCM8885X=rx43:tx40 + +lane_to_serdes_map_fabric_lane44.BCM8885X=rx44:tx47 +lane_to_serdes_map_fabric_lane45.BCM8885X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8885X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8885X=rx47:tx44 + +lane_to_serdes_map_fabric_lane48.BCM8885X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8885X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8885X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8885X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8885X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8885X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8885X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8885X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8885X=rx56:tx59 +lane_to_serdes_map_fabric_lane57.BCM8885X=rx57:tx58 +lane_to_serdes_map_fabric_lane58.BCM8885X=rx58:tx57 +lane_to_serdes_map_fabric_lane59.BCM8885X=rx59:tx56 + +lane_to_serdes_map_fabric_lane60.BCM8885X=rx60:tx63 +lane_to_serdes_map_fabric_lane61.BCM8885X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8885X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8885X=rx63:tx60 + +lane_to_serdes_map_fabric_lane64.BCM8885X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8885X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8885X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8885X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8885X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8885X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8885X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8885X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8885X=rx72:tx75 +lane_to_serdes_map_fabric_lane73.BCM8885X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8885X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8885X=rx75:tx72 + +lane_to_serdes_map_fabric_lane76.BCM8885X=rx76:tx79 +lane_to_serdes_map_fabric_lane77.BCM8885X=rx77:tx78 +lane_to_serdes_map_fabric_lane78.BCM8885X=rx78:tx77 +lane_to_serdes_map_fabric_lane79.BCM8885X=rx79:tx76 + +lane_to_serdes_map_fabric_lane80.BCM8885X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8885X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8885X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8885X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8885X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8885X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8885X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8885X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8885X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8885X=rx89:tx90 +lane_to_serdes_map_fabric_lane90.BCM8885X=rx90:tx89 +lane_to_serdes_map_fabric_lane91.BCM8885X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8885X=rx92:tx94 +lane_to_serdes_map_fabric_lane93.BCM8885X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8885X=rx94:tx92 +lane_to_serdes_map_fabric_lane95.BCM8885X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8885X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8885X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8885X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8885X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8885X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8885X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8885X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8885X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8885X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8885X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8885X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8885X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8885X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8885X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8885X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8885X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8885X=rx112:tx114 +lane_to_serdes_map_fabric_lane113.BCM8885X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8885X=rx114:tx112 +lane_to_serdes_map_fabric_lane115.BCM8885X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8885X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8885X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8885X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8885X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8885X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8885X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8885X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8885X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8885X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8885X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8885X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8885X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8885X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8885X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8885X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8885X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8885X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8885X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8885X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8885X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8885X=rx136:tx139 +lane_to_serdes_map_fabric_lane137.BCM8885X=rx137:tx138 +lane_to_serdes_map_fabric_lane138.BCM8885X=rx138:tx137 +lane_to_serdes_map_fabric_lane139.BCM8885X=rx139:tx136 + +lane_to_serdes_map_fabric_lane140.BCM8885X=rx140:tx143 +lane_to_serdes_map_fabric_lane141.BCM8885X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8885X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8885X=rx143:tx140 + +lane_to_serdes_map_fabric_lane144.BCM8885X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8885X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8885X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8885X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8885X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8885X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8885X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8885X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8885X=rx152:tx155 +lane_to_serdes_map_fabric_lane153.BCM8885X=rx153:tx154 +lane_to_serdes_map_fabric_lane154.BCM8885X=rx154:tx153 +lane_to_serdes_map_fabric_lane155.BCM8885X=rx155:tx152 + +lane_to_serdes_map_fabric_lane156.BCM8885X=rx156:tx159 +lane_to_serdes_map_fabric_lane157.BCM8885X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8885X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8885X=rx159:tx156 + +lane_to_serdes_map_fabric_lane160.BCM8885X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8885X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8885X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8885X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8885X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8885X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8885X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8885X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8885X=rx168:tx171 +lane_to_serdes_map_fabric_lane169.BCM8885X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8885X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8885X=rx171:tx168 + +lane_to_serdes_map_fabric_lane172.BCM8885X=rx172:tx175 +lane_to_serdes_map_fabric_lane173.BCM8885X=rx173:tx174 +lane_to_serdes_map_fabric_lane174.BCM8885X=rx174:tx173 +lane_to_serdes_map_fabric_lane175.BCM8885X=rx175:tx172 + +lane_to_serdes_map_fabric_lane176.BCM8885X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8885X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8885X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8885X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8885X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8885X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8885X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8885X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8885X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8885X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8885X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8885X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8885X=rx188:tx190 +lane_to_serdes_map_fabric_lane189.BCM8885X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8885X=rx190:tx188 +lane_to_serdes_map_fabric_lane191.BCM8885X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8885X=0 +phy_rx_polarity_flip_fabric1.BCM8885X=1 +phy_rx_polarity_flip_fabric2.BCM8885X=0 +phy_rx_polarity_flip_fabric3.BCM8885X=0 +phy_rx_polarity_flip_fabric4.BCM8885X=0 +phy_rx_polarity_flip_fabric5.BCM8885X=0 +phy_rx_polarity_flip_fabric6.BCM8885X=0 +phy_rx_polarity_flip_fabric7.BCM8885X=0 +phy_rx_polarity_flip_fabric8.BCM8885X=1 +phy_rx_polarity_flip_fabric9.BCM8885X=1 +phy_rx_polarity_flip_fabric10.BCM8885X=0 +phy_rx_polarity_flip_fabric11.BCM8885X=0 +phy_rx_polarity_flip_fabric12.BCM8885X=1 +phy_rx_polarity_flip_fabric13.BCM8885X=0 +phy_rx_polarity_flip_fabric14.BCM8885X=0 +phy_rx_polarity_flip_fabric15.BCM8885X=1 +phy_rx_polarity_flip_fabric16.BCM8885X=1 +phy_rx_polarity_flip_fabric17.BCM8885X=1 +phy_rx_polarity_flip_fabric18.BCM8885X=0 +phy_rx_polarity_flip_fabric19.BCM8885X=0 +phy_rx_polarity_flip_fabric20.BCM8885X=0 +phy_rx_polarity_flip_fabric21.BCM8885X=0 +phy_rx_polarity_flip_fabric22.BCM8885X=1 +phy_rx_polarity_flip_fabric23.BCM8885X=0 +phy_rx_polarity_flip_fabric24.BCM8885X=1 +phy_rx_polarity_flip_fabric25.BCM8885X=0 +phy_rx_polarity_flip_fabric26.BCM8885X=1 +phy_rx_polarity_flip_fabric27.BCM8885X=1 +phy_rx_polarity_flip_fabric28.BCM8885X=1 +phy_rx_polarity_flip_fabric29.BCM8885X=1 +phy_rx_polarity_flip_fabric30.BCM8885X=0 +phy_rx_polarity_flip_fabric31.BCM8885X=1 +phy_rx_polarity_flip_fabric32.BCM8885X=0 +phy_rx_polarity_flip_fabric33.BCM8885X=1 +phy_rx_polarity_flip_fabric34.BCM8885X=0 +phy_rx_polarity_flip_fabric35.BCM8885X=0 +phy_rx_polarity_flip_fabric36.BCM8885X=0 +phy_rx_polarity_flip_fabric37.BCM8885X=1 +phy_rx_polarity_flip_fabric38.BCM8885X=1 +phy_rx_polarity_flip_fabric39.BCM8885X=0 +phy_rx_polarity_flip_fabric40.BCM8885X=1 +phy_rx_polarity_flip_fabric41.BCM8885X=0 +phy_rx_polarity_flip_fabric42.BCM8885X=0 +phy_rx_polarity_flip_fabric43.BCM8885X=0 +phy_rx_polarity_flip_fabric44.BCM8885X=1 +phy_rx_polarity_flip_fabric45.BCM8885X=0 +phy_rx_polarity_flip_fabric46.BCM8885X=0 +phy_rx_polarity_flip_fabric47.BCM8885X=1 +phy_rx_polarity_flip_fabric48.BCM8885X=1 +phy_rx_polarity_flip_fabric49.BCM8885X=1 +phy_rx_polarity_flip_fabric50.BCM8885X=1 +phy_rx_polarity_flip_fabric51.BCM8885X=1 +phy_rx_polarity_flip_fabric52.BCM8885X=1 +phy_rx_polarity_flip_fabric53.BCM8885X=1 +phy_rx_polarity_flip_fabric54.BCM8885X=1 +phy_rx_polarity_flip_fabric55.BCM8885X=1 +phy_rx_polarity_flip_fabric56.BCM8885X=0 +phy_rx_polarity_flip_fabric57.BCM8885X=0 +phy_rx_polarity_flip_fabric58.BCM8885X=0 +phy_rx_polarity_flip_fabric59.BCM8885X=0 +phy_rx_polarity_flip_fabric60.BCM8885X=0 +phy_rx_polarity_flip_fabric61.BCM8885X=0 +phy_rx_polarity_flip_fabric62.BCM8885X=1 +phy_rx_polarity_flip_fabric63.BCM8885X=0 +phy_rx_polarity_flip_fabric64.BCM8885X=1 +phy_rx_polarity_flip_fabric65.BCM8885X=1 +phy_rx_polarity_flip_fabric66.BCM8885X=0 +phy_rx_polarity_flip_fabric67.BCM8885X=0 +phy_rx_polarity_flip_fabric68.BCM8885X=1 +phy_rx_polarity_flip_fabric69.BCM8885X=1 +phy_rx_polarity_flip_fabric70.BCM8885X=1 +phy_rx_polarity_flip_fabric71.BCM8885X=0 +phy_rx_polarity_flip_fabric72.BCM8885X=0 +phy_rx_polarity_flip_fabric73.BCM8885X=1 +phy_rx_polarity_flip_fabric74.BCM8885X=0 +phy_rx_polarity_flip_fabric75.BCM8885X=1 +phy_rx_polarity_flip_fabric76.BCM8885X=1 +phy_rx_polarity_flip_fabric77.BCM8885X=1 +phy_rx_polarity_flip_fabric78.BCM8885X=1 +phy_rx_polarity_flip_fabric79.BCM8885X=0 +phy_rx_polarity_flip_fabric80.BCM8885X=1 +phy_rx_polarity_flip_fabric81.BCM8885X=0 +phy_rx_polarity_flip_fabric82.BCM8885X=0 +phy_rx_polarity_flip_fabric83.BCM8885X=0 +phy_rx_polarity_flip_fabric84.BCM8885X=1 +phy_rx_polarity_flip_fabric85.BCM8885X=0 +phy_rx_polarity_flip_fabric86.BCM8885X=1 +phy_rx_polarity_flip_fabric87.BCM8885X=0 +phy_rx_polarity_flip_fabric88.BCM8885X=1 +phy_rx_polarity_flip_fabric89.BCM8885X=1 +phy_rx_polarity_flip_fabric90.BCM8885X=1 +phy_rx_polarity_flip_fabric91.BCM8885X=1 +phy_rx_polarity_flip_fabric92.BCM8885X=1 +phy_rx_polarity_flip_fabric93.BCM8885X=1 +phy_rx_polarity_flip_fabric94.BCM8885X=1 +phy_rx_polarity_flip_fabric95.BCM8885X=1 +phy_rx_polarity_flip_fabric96.BCM8885X=0 +phy_rx_polarity_flip_fabric97.BCM8885X=1 +phy_rx_polarity_flip_fabric98.BCM8885X=0 +phy_rx_polarity_flip_fabric99.BCM8885X=0 +phy_rx_polarity_flip_fabric100.BCM8885X=0 +phy_rx_polarity_flip_fabric101.BCM8885X=1 +phy_rx_polarity_flip_fabric102.BCM8885X=1 +phy_rx_polarity_flip_fabric103.BCM8885X=0 +phy_rx_polarity_flip_fabric104.BCM8885X=1 +phy_rx_polarity_flip_fabric105.BCM8885X=0 +phy_rx_polarity_flip_fabric106.BCM8885X=0 +phy_rx_polarity_flip_fabric107.BCM8885X=0 +phy_rx_polarity_flip_fabric108.BCM8885X=1 +phy_rx_polarity_flip_fabric109.BCM8885X=1 +phy_rx_polarity_flip_fabric110.BCM8885X=0 +phy_rx_polarity_flip_fabric111.BCM8885X=1 +phy_rx_polarity_flip_fabric112.BCM8885X=0 +phy_rx_polarity_flip_fabric113.BCM8885X=0 +phy_rx_polarity_flip_fabric114.BCM8885X=1 +phy_rx_polarity_flip_fabric115.BCM8885X=1 +phy_rx_polarity_flip_fabric116.BCM8885X=0 +phy_rx_polarity_flip_fabric117.BCM8885X=1 +phy_rx_polarity_flip_fabric118.BCM8885X=1 +phy_rx_polarity_flip_fabric119.BCM8885X=1 +phy_rx_polarity_flip_fabric120.BCM8885X=1 +phy_rx_polarity_flip_fabric121.BCM8885X=1 +phy_rx_polarity_flip_fabric122.BCM8885X=1 +phy_rx_polarity_flip_fabric123.BCM8885X=0 +phy_rx_polarity_flip_fabric124.BCM8885X=0 +phy_rx_polarity_flip_fabric125.BCM8885X=0 +phy_rx_polarity_flip_fabric126.BCM8885X=0 +phy_rx_polarity_flip_fabric127.BCM8885X=1 +phy_rx_polarity_flip_fabric128.BCM8885X=0 +phy_rx_polarity_flip_fabric129.BCM8885X=0 +phy_rx_polarity_flip_fabric130.BCM8885X=1 +phy_rx_polarity_flip_fabric131.BCM8885X=0 +phy_rx_polarity_flip_fabric132.BCM8885X=0 +phy_rx_polarity_flip_fabric133.BCM8885X=1 +phy_rx_polarity_flip_fabric134.BCM8885X=1 +phy_rx_polarity_flip_fabric135.BCM8885X=0 +phy_rx_polarity_flip_fabric136.BCM8885X=0 +phy_rx_polarity_flip_fabric137.BCM8885X=1 +phy_rx_polarity_flip_fabric138.BCM8885X=1 +phy_rx_polarity_flip_fabric139.BCM8885X=0 +phy_rx_polarity_flip_fabric140.BCM8885X=1 +phy_rx_polarity_flip_fabric141.BCM8885X=0 +phy_rx_polarity_flip_fabric142.BCM8885X=1 +phy_rx_polarity_flip_fabric143.BCM8885X=1 +phy_rx_polarity_flip_fabric144.BCM8885X=1 +phy_rx_polarity_flip_fabric145.BCM8885X=1 +phy_rx_polarity_flip_fabric146.BCM8885X=1 +phy_rx_polarity_flip_fabric147.BCM8885X=0 +phy_rx_polarity_flip_fabric148.BCM8885X=1 +phy_rx_polarity_flip_fabric149.BCM8885X=1 +phy_rx_polarity_flip_fabric150.BCM8885X=0 +phy_rx_polarity_flip_fabric151.BCM8885X=0 +phy_rx_polarity_flip_fabric152.BCM8885X=0 +phy_rx_polarity_flip_fabric153.BCM8885X=0 +phy_rx_polarity_flip_fabric154.BCM8885X=0 +phy_rx_polarity_flip_fabric155.BCM8885X=1 +phy_rx_polarity_flip_fabric156.BCM8885X=0 +phy_rx_polarity_flip_fabric157.BCM8885X=0 +phy_rx_polarity_flip_fabric158.BCM8885X=0 +phy_rx_polarity_flip_fabric159.BCM8885X=1 +phy_rx_polarity_flip_fabric160.BCM8885X=0 +phy_rx_polarity_flip_fabric161.BCM8885X=1 +phy_rx_polarity_flip_fabric162.BCM8885X=1 +phy_rx_polarity_flip_fabric163.BCM8885X=1 +phy_rx_polarity_flip_fabric164.BCM8885X=1 +phy_rx_polarity_flip_fabric165.BCM8885X=0 +phy_rx_polarity_flip_fabric166.BCM8885X=0 +phy_rx_polarity_flip_fabric167.BCM8885X=1 +phy_rx_polarity_flip_fabric168.BCM8885X=0 +phy_rx_polarity_flip_fabric169.BCM8885X=1 +phy_rx_polarity_flip_fabric170.BCM8885X=0 +phy_rx_polarity_flip_fabric171.BCM8885X=0 +phy_rx_polarity_flip_fabric172.BCM8885X=0 +phy_rx_polarity_flip_fabric173.BCM8885X=1 +phy_rx_polarity_flip_fabric174.BCM8885X=1 +phy_rx_polarity_flip_fabric175.BCM8885X=1 +phy_rx_polarity_flip_fabric176.BCM8885X=0 +phy_rx_polarity_flip_fabric177.BCM8885X=1 +phy_rx_polarity_flip_fabric178.BCM8885X=0 +phy_rx_polarity_flip_fabric179.BCM8885X=1 +phy_rx_polarity_flip_fabric180.BCM8885X=1 +phy_rx_polarity_flip_fabric181.BCM8885X=0 +phy_rx_polarity_flip_fabric182.BCM8885X=0 +phy_rx_polarity_flip_fabric183.BCM8885X=0 +phy_rx_polarity_flip_fabric184.BCM8885X=0 +phy_rx_polarity_flip_fabric185.BCM8885X=0 +phy_rx_polarity_flip_fabric186.BCM8885X=1 +phy_rx_polarity_flip_fabric187.BCM8885X=0 +phy_rx_polarity_flip_fabric188.BCM8885X=0 +phy_rx_polarity_flip_fabric189.BCM8885X=0 +phy_rx_polarity_flip_fabric190.BCM8885X=0 +phy_rx_polarity_flip_fabric191.BCM8885X=1 + + +phy_tx_polarity_flip_fabric0.BCM8885X=0 +phy_tx_polarity_flip_fabric1.BCM8885X=0 +phy_tx_polarity_flip_fabric2.BCM8885X=0 +phy_tx_polarity_flip_fabric3.BCM8885X=1 +phy_tx_polarity_flip_fabric4.BCM8885X=1 +phy_tx_polarity_flip_fabric5.BCM8885X=0 +phy_tx_polarity_flip_fabric6.BCM8885X=1 +phy_tx_polarity_flip_fabric7.BCM8885X=1 +phy_tx_polarity_flip_fabric8.BCM8885X=0 +phy_tx_polarity_flip_fabric9.BCM8885X=1 +phy_tx_polarity_flip_fabric10.BCM8885X=1 +phy_tx_polarity_flip_fabric11.BCM8885X=1 +phy_tx_polarity_flip_fabric12.BCM8885X=1 +phy_tx_polarity_flip_fabric13.BCM8885X=0 +phy_tx_polarity_flip_fabric14.BCM8885X=1 +phy_tx_polarity_flip_fabric15.BCM8885X=1 +phy_tx_polarity_flip_fabric16.BCM8885X=1 +phy_tx_polarity_flip_fabric17.BCM8885X=1 +phy_tx_polarity_flip_fabric18.BCM8885X=0 +phy_tx_polarity_flip_fabric19.BCM8885X=0 +phy_tx_polarity_flip_fabric20.BCM8885X=0 +phy_tx_polarity_flip_fabric21.BCM8885X=1 +phy_tx_polarity_flip_fabric22.BCM8885X=1 +phy_tx_polarity_flip_fabric23.BCM8885X=0 +phy_tx_polarity_flip_fabric24.BCM8885X=0 +phy_tx_polarity_flip_fabric25.BCM8885X=1 +phy_tx_polarity_flip_fabric26.BCM8885X=1 +phy_tx_polarity_flip_fabric27.BCM8885X=0 +phy_tx_polarity_flip_fabric28.BCM8885X=1 +phy_tx_polarity_flip_fabric29.BCM8885X=0 +phy_tx_polarity_flip_fabric30.BCM8885X=1 +phy_tx_polarity_flip_fabric31.BCM8885X=0 +phy_tx_polarity_flip_fabric32.BCM8885X=0 +phy_tx_polarity_flip_fabric33.BCM8885X=0 +phy_tx_polarity_flip_fabric34.BCM8885X=0 +phy_tx_polarity_flip_fabric35.BCM8885X=0 +phy_tx_polarity_flip_fabric36.BCM8885X=1 +phy_tx_polarity_flip_fabric37.BCM8885X=1 +phy_tx_polarity_flip_fabric38.BCM8885X=0 +phy_tx_polarity_flip_fabric39.BCM8885X=0 +phy_tx_polarity_flip_fabric40.BCM8885X=1 +phy_tx_polarity_flip_fabric41.BCM8885X=0 +phy_tx_polarity_flip_fabric42.BCM8885X=0 +phy_tx_polarity_flip_fabric43.BCM8885X=1 +phy_tx_polarity_flip_fabric44.BCM8885X=0 +phy_tx_polarity_flip_fabric45.BCM8885X=0 +phy_tx_polarity_flip_fabric46.BCM8885X=1 +phy_tx_polarity_flip_fabric47.BCM8885X=0 +phy_tx_polarity_flip_fabric48.BCM8885X=1 +phy_tx_polarity_flip_fabric49.BCM8885X=1 +phy_tx_polarity_flip_fabric50.BCM8885X=0 +phy_tx_polarity_flip_fabric51.BCM8885X=0 +phy_tx_polarity_flip_fabric52.BCM8885X=1 +phy_tx_polarity_flip_fabric53.BCM8885X=0 +phy_tx_polarity_flip_fabric54.BCM8885X=0 +phy_tx_polarity_flip_fabric55.BCM8885X=1 +phy_tx_polarity_flip_fabric56.BCM8885X=0 +phy_tx_polarity_flip_fabric57.BCM8885X=0 +phy_tx_polarity_flip_fabric58.BCM8885X=1 +phy_tx_polarity_flip_fabric59.BCM8885X=0 +phy_tx_polarity_flip_fabric60.BCM8885X=1 +phy_tx_polarity_flip_fabric61.BCM8885X=1 +phy_tx_polarity_flip_fabric62.BCM8885X=1 +phy_tx_polarity_flip_fabric63.BCM8885X=1 +phy_tx_polarity_flip_fabric64.BCM8885X=1 +phy_tx_polarity_flip_fabric65.BCM8885X=0 +phy_tx_polarity_flip_fabric66.BCM8885X=1 +phy_tx_polarity_flip_fabric67.BCM8885X=0 +phy_tx_polarity_flip_fabric68.BCM8885X=0 +phy_tx_polarity_flip_fabric69.BCM8885X=0 +phy_tx_polarity_flip_fabric70.BCM8885X=0 +phy_tx_polarity_flip_fabric71.BCM8885X=1 +phy_tx_polarity_flip_fabric72.BCM8885X=0 +phy_tx_polarity_flip_fabric73.BCM8885X=1 +phy_tx_polarity_flip_fabric74.BCM8885X=0 +phy_tx_polarity_flip_fabric75.BCM8885X=1 +phy_tx_polarity_flip_fabric76.BCM8885X=0 +phy_tx_polarity_flip_fabric77.BCM8885X=0 +phy_tx_polarity_flip_fabric78.BCM8885X=0 +phy_tx_polarity_flip_fabric79.BCM8885X=1 +phy_tx_polarity_flip_fabric80.BCM8885X=1 +phy_tx_polarity_flip_fabric81.BCM8885X=0 +phy_tx_polarity_flip_fabric82.BCM8885X=0 +phy_tx_polarity_flip_fabric83.BCM8885X=0 +phy_tx_polarity_flip_fabric84.BCM8885X=1 +phy_tx_polarity_flip_fabric85.BCM8885X=0 +phy_tx_polarity_flip_fabric86.BCM8885X=1 +phy_tx_polarity_flip_fabric87.BCM8885X=0 +phy_tx_polarity_flip_fabric88.BCM8885X=1 +phy_tx_polarity_flip_fabric89.BCM8885X=1 +phy_tx_polarity_flip_fabric90.BCM8885X=1 +phy_tx_polarity_flip_fabric91.BCM8885X=1 +phy_tx_polarity_flip_fabric92.BCM8885X=1 +phy_tx_polarity_flip_fabric93.BCM8885X=1 +phy_tx_polarity_flip_fabric94.BCM8885X=0 +phy_tx_polarity_flip_fabric95.BCM8885X=0 +phy_tx_polarity_flip_fabric96.BCM8885X=1 +phy_tx_polarity_flip_fabric97.BCM8885X=1 +phy_tx_polarity_flip_fabric98.BCM8885X=1 +phy_tx_polarity_flip_fabric99.BCM8885X=0 +phy_tx_polarity_flip_fabric100.BCM8885X=0 +phy_tx_polarity_flip_fabric101.BCM8885X=0 +phy_tx_polarity_flip_fabric102.BCM8885X=1 +phy_tx_polarity_flip_fabric103.BCM8885X=1 +phy_tx_polarity_flip_fabric104.BCM8885X=1 +phy_tx_polarity_flip_fabric105.BCM8885X=0 +phy_tx_polarity_flip_fabric106.BCM8885X=1 +phy_tx_polarity_flip_fabric107.BCM8885X=0 +phy_tx_polarity_flip_fabric108.BCM8885X=0 +phy_tx_polarity_flip_fabric109.BCM8885X=1 +phy_tx_polarity_flip_fabric110.BCM8885X=0 +phy_tx_polarity_flip_fabric111.BCM8885X=0 +phy_tx_polarity_flip_fabric112.BCM8885X=1 +phy_tx_polarity_flip_fabric113.BCM8885X=0 +phy_tx_polarity_flip_fabric114.BCM8885X=0 +phy_tx_polarity_flip_fabric115.BCM8885X=1 +phy_tx_polarity_flip_fabric116.BCM8885X=1 +phy_tx_polarity_flip_fabric117.BCM8885X=1 +phy_tx_polarity_flip_fabric118.BCM8885X=0 +phy_tx_polarity_flip_fabric119.BCM8885X=0 +phy_tx_polarity_flip_fabric120.BCM8885X=0 +phy_tx_polarity_flip_fabric121.BCM8885X=0 +phy_tx_polarity_flip_fabric122.BCM8885X=1 +phy_tx_polarity_flip_fabric123.BCM8885X=1 +phy_tx_polarity_flip_fabric124.BCM8885X=0 +phy_tx_polarity_flip_fabric125.BCM8885X=0 +phy_tx_polarity_flip_fabric126.BCM8885X=0 +phy_tx_polarity_flip_fabric127.BCM8885X=1 +phy_tx_polarity_flip_fabric128.BCM8885X=0 +phy_tx_polarity_flip_fabric129.BCM8885X=0 +phy_tx_polarity_flip_fabric130.BCM8885X=0 +phy_tx_polarity_flip_fabric131.BCM8885X=1 +phy_tx_polarity_flip_fabric132.BCM8885X=0 +phy_tx_polarity_flip_fabric133.BCM8885X=0 +phy_tx_polarity_flip_fabric134.BCM8885X=1 +phy_tx_polarity_flip_fabric135.BCM8885X=1 +phy_tx_polarity_flip_fabric136.BCM8885X=1 +phy_tx_polarity_flip_fabric137.BCM8885X=1 +phy_tx_polarity_flip_fabric138.BCM8885X=1 +phy_tx_polarity_flip_fabric139.BCM8885X=1 +phy_tx_polarity_flip_fabric140.BCM8885X=0 +phy_tx_polarity_flip_fabric141.BCM8885X=0 +phy_tx_polarity_flip_fabric142.BCM8885X=0 +phy_tx_polarity_flip_fabric143.BCM8885X=0 +phy_tx_polarity_flip_fabric144.BCM8885X=1 +phy_tx_polarity_flip_fabric145.BCM8885X=1 +phy_tx_polarity_flip_fabric146.BCM8885X=1 +phy_tx_polarity_flip_fabric147.BCM8885X=1 +phy_tx_polarity_flip_fabric148.BCM8885X=1 +phy_tx_polarity_flip_fabric149.BCM8885X=1 +phy_tx_polarity_flip_fabric150.BCM8885X=1 +phy_tx_polarity_flip_fabric151.BCM8885X=1 +phy_tx_polarity_flip_fabric152.BCM8885X=1 +phy_tx_polarity_flip_fabric153.BCM8885X=1 +phy_tx_polarity_flip_fabric154.BCM8885X=1 +phy_tx_polarity_flip_fabric155.BCM8885X=0 +phy_tx_polarity_flip_fabric156.BCM8885X=1 +phy_tx_polarity_flip_fabric157.BCM8885X=0 +phy_tx_polarity_flip_fabric158.BCM8885X=0 +phy_tx_polarity_flip_fabric159.BCM8885X=0 +phy_tx_polarity_flip_fabric160.BCM8885X=0 +phy_tx_polarity_flip_fabric161.BCM8885X=1 +phy_tx_polarity_flip_fabric162.BCM8885X=0 +phy_tx_polarity_flip_fabric163.BCM8885X=1 +phy_tx_polarity_flip_fabric164.BCM8885X=1 +phy_tx_polarity_flip_fabric165.BCM8885X=1 +phy_tx_polarity_flip_fabric166.BCM8885X=0 +phy_tx_polarity_flip_fabric167.BCM8885X=0 +phy_tx_polarity_flip_fabric168.BCM8885X=0 +phy_tx_polarity_flip_fabric169.BCM8885X=0 +phy_tx_polarity_flip_fabric170.BCM8885X=1 +phy_tx_polarity_flip_fabric171.BCM8885X=0 +phy_tx_polarity_flip_fabric172.BCM8885X=0 +phy_tx_polarity_flip_fabric173.BCM8885X=0 +phy_tx_polarity_flip_fabric174.BCM8885X=0 +phy_tx_polarity_flip_fabric175.BCM8885X=1 +phy_tx_polarity_flip_fabric176.BCM8885X=0 +phy_tx_polarity_flip_fabric177.BCM8885X=0 +phy_tx_polarity_flip_fabric178.BCM8885X=0 +phy_tx_polarity_flip_fabric179.BCM8885X=1 +phy_tx_polarity_flip_fabric180.BCM8885X=1 +phy_tx_polarity_flip_fabric181.BCM8885X=0 +phy_tx_polarity_flip_fabric182.BCM8885X=0 +phy_tx_polarity_flip_fabric183.BCM8885X=0 +phy_tx_polarity_flip_fabric184.BCM8885X=0 +phy_tx_polarity_flip_fabric185.BCM8885X=1 +phy_tx_polarity_flip_fabric186.BCM8885X=1 +phy_tx_polarity_flip_fabric187.BCM8885X=0 +phy_tx_polarity_flip_fabric188.BCM8885X=1 +phy_tx_polarity_flip_fabric189.BCM8885X=0 +phy_tx_polarity_flip_fabric190.BCM8885X=0 +phy_tx_polarity_flip_fabric191.BCM8885X=1 + + +lane_to_serdes_map_nif_lane0.BCM8885X=rx0:tx0 +lane_to_serdes_map_nif_lane1.BCM8885X=rx1:tx1 +lane_to_serdes_map_nif_lane2.BCM8885X=rx2:tx2 +lane_to_serdes_map_nif_lane3.BCM8885X=rx3:tx3 +lane_to_serdes_map_nif_lane4.BCM8885X=rx4:tx4 +lane_to_serdes_map_nif_lane5.BCM8885X=rx5:tx5 +lane_to_serdes_map_nif_lane6.BCM8885X=rx6:tx6 +lane_to_serdes_map_nif_lane7.BCM8885X=rx7:tx7 + +lane_to_serdes_map_nif_lane8.BCM8885X=rx8:tx8 +lane_to_serdes_map_nif_lane9.BCM8885X=rx9:tx9 +lane_to_serdes_map_nif_lane10.BCM8885X=rx10:tx10 +lane_to_serdes_map_nif_lane11.BCM8885X=rx11:tx11 +lane_to_serdes_map_nif_lane12.BCM8885X=rx12:tx12 +lane_to_serdes_map_nif_lane13.BCM8885X=rx13:tx13 +lane_to_serdes_map_nif_lane14.BCM8885X=rx14:tx14 +lane_to_serdes_map_nif_lane15.BCM8885X=rx15:tx15 + +lane_to_serdes_map_nif_lane16.BCM8885X=rx16:tx16 +lane_to_serdes_map_nif_lane17.BCM8885X=rx17:tx17 +lane_to_serdes_map_nif_lane18.BCM8885X=rx18:tx18 +lane_to_serdes_map_nif_lane19.BCM8885X=rx19:tx19 +lane_to_serdes_map_nif_lane20.BCM8885X=rx20:tx20 +lane_to_serdes_map_nif_lane21.BCM8885X=rx21:tx21 +lane_to_serdes_map_nif_lane22.BCM8885X=rx22:tx22 +lane_to_serdes_map_nif_lane23.BCM8885X=rx23:tx23 + +lane_to_serdes_map_nif_lane24.BCM8885X=rx24:tx24 +lane_to_serdes_map_nif_lane25.BCM8885X=rx25:tx25 +lane_to_serdes_map_nif_lane26.BCM8885X=rx26:tx26 +lane_to_serdes_map_nif_lane27.BCM8885X=rx27:tx27 +lane_to_serdes_map_nif_lane28.BCM8885X=rx28:tx28 +lane_to_serdes_map_nif_lane29.BCM8885X=rx29:tx29 +lane_to_serdes_map_nif_lane30.BCM8885X=rx30:tx30 +lane_to_serdes_map_nif_lane31.BCM8885X=rx31:tx31 + +lane_to_serdes_map_nif_lane32.BCM8885X=rx32:tx32 +lane_to_serdes_map_nif_lane33.BCM8885X=rx33:tx33 +lane_to_serdes_map_nif_lane34.BCM8885X=rx34:tx34 +lane_to_serdes_map_nif_lane35.BCM8885X=rx35:tx35 +lane_to_serdes_map_nif_lane36.BCM8885X=rx36:tx36 +lane_to_serdes_map_nif_lane37.BCM8885X=rx37:tx37 +lane_to_serdes_map_nif_lane38.BCM8885X=rx38:tx38 +lane_to_serdes_map_nif_lane39.BCM8885X=rx39:tx39 + +lane_to_serdes_map_nif_lane40.BCM8885X=rx40:tx40 +lane_to_serdes_map_nif_lane41.BCM8885X=rx41:tx41 +lane_to_serdes_map_nif_lane42.BCM8885X=rx42:tx42 +lane_to_serdes_map_nif_lane43.BCM8885X=rx43:tx43 +lane_to_serdes_map_nif_lane44.BCM8885X=rx44:tx44 +lane_to_serdes_map_nif_lane45.BCM8885X=rx45:tx45 +lane_to_serdes_map_nif_lane46.BCM8885X=rx46:tx46 +lane_to_serdes_map_nif_lane47.BCM8885X=rx47:tx47 + +lane_to_serdes_map_nif_lane48.BCM8885X=rx48:tx48 +lane_to_serdes_map_nif_lane49.BCM8885X=rx49:tx49 +lane_to_serdes_map_nif_lane50.BCM8885X=rx50:tx50 +lane_to_serdes_map_nif_lane51.BCM8885X=rx51:tx51 +lane_to_serdes_map_nif_lane52.BCM8885X=rx52:tx52 +lane_to_serdes_map_nif_lane53.BCM8885X=rx53:tx53 +lane_to_serdes_map_nif_lane54.BCM8885X=rx54:tx54 +lane_to_serdes_map_nif_lane55.BCM8885X=rx55:tx55 + +lane_to_serdes_map_nif_lane56.BCM8885X=rx56:tx56 +lane_to_serdes_map_nif_lane57.BCM8885X=rx57:tx57 +lane_to_serdes_map_nif_lane58.BCM8885X=rx58:tx58 +lane_to_serdes_map_nif_lane59.BCM8885X=rx59:tx59 +lane_to_serdes_map_nif_lane60.BCM8885X=rx60:tx60 +lane_to_serdes_map_nif_lane61.BCM8885X=rx61:tx61 +lane_to_serdes_map_nif_lane62.BCM8885X=rx62:tx62 +lane_to_serdes_map_nif_lane63.BCM8885X=rx63:tx63 + +lane_to_serdes_map_nif_lane64.BCM8885X=rx64:tx64 +lane_to_serdes_map_nif_lane65.BCM8885X=rx65:tx65 +lane_to_serdes_map_nif_lane66.BCM8885X=rx66:tx66 +lane_to_serdes_map_nif_lane67.BCM8885X=rx67:tx67 +lane_to_serdes_map_nif_lane68.BCM8885X=rx68:tx68 +lane_to_serdes_map_nif_lane69.BCM8885X=rx69:tx69 +lane_to_serdes_map_nif_lane70.BCM8885X=rx70:tx70 +lane_to_serdes_map_nif_lane71.BCM8885X=rx71:tx71 + +lane_to_serdes_map_nif_lane72.BCM8885X=rx72:tx72 +lane_to_serdes_map_nif_lane73.BCM8885X=rx73:tx73 +lane_to_serdes_map_nif_lane74.BCM8885X=rx74:tx74 +lane_to_serdes_map_nif_lane75.BCM8885X=rx75:tx75 +lane_to_serdes_map_nif_lane76.BCM8885X=rx76:tx76 +lane_to_serdes_map_nif_lane77.BCM8885X=rx77:tx77 +lane_to_serdes_map_nif_lane78.BCM8885X=rx78:tx78 +lane_to_serdes_map_nif_lane79.BCM8885X=rx79:tx79 + +lane_to_serdes_map_nif_lane80.BCM8885X=rx80:tx80 +lane_to_serdes_map_nif_lane81.BCM8885X=rx81:tx81 +lane_to_serdes_map_nif_lane82.BCM8885X=rx82:tx82 +lane_to_serdes_map_nif_lane83.BCM8885X=rx83:tx83 +lane_to_serdes_map_nif_lane84.BCM8885X=rx84:tx84 +lane_to_serdes_map_nif_lane85.BCM8885X=rx85:tx85 +lane_to_serdes_map_nif_lane86.BCM8885X=rx86:tx86 +lane_to_serdes_map_nif_lane87.BCM8885X=rx87:tx87 + +lane_to_serdes_map_nif_lane88.BCM8885X=rx88:tx88 +lane_to_serdes_map_nif_lane89.BCM8885X=rx89:tx89 +lane_to_serdes_map_nif_lane90.BCM8885X=rx90:tx90 +lane_to_serdes_map_nif_lane91.BCM8885X=rx91:tx91 +lane_to_serdes_map_nif_lane92.BCM8885X=rx92:tx92 +lane_to_serdes_map_nif_lane93.BCM8885X=rx93:tx93 +lane_to_serdes_map_nif_lane94.BCM8885X=rx94:tx94 +lane_to_serdes_map_nif_lane95.BCM8885X=rx95:tx95 + +lane_to_serdes_map_nif_lane96.BCM8885X=rx96:tx96 +lane_to_serdes_map_nif_lane97.BCM8885X=rx97:tx97 +lane_to_serdes_map_nif_lane98.BCM8885X=rx98:tx98 +lane_to_serdes_map_nif_lane99.BCM8885X=rx99:tx99 +lane_to_serdes_map_nif_lane100.BCM8885X=rx100:tx100 +lane_to_serdes_map_nif_lane101.BCM8885X=rx101:tx101 +lane_to_serdes_map_nif_lane102.BCM8885X=rx102:tx102 +lane_to_serdes_map_nif_lane103.BCM8885X=rx103:tx103 + +lane_to_serdes_map_nif_lane104.BCM8885X=rx104:tx104 +lane_to_serdes_map_nif_lane105.BCM8885X=rx105:tx105 +lane_to_serdes_map_nif_lane106.BCM8885X=rx106:tx106 +lane_to_serdes_map_nif_lane107.BCM8885X=rx107:tx107 +lane_to_serdes_map_nif_lane108.BCM8885X=rx108:tx108 +lane_to_serdes_map_nif_lane109.BCM8885X=rx109:tx109 +lane_to_serdes_map_nif_lane110.BCM8885X=rx110:tx110 +lane_to_serdes_map_nif_lane111.BCM8885X=rx111:tx111 + +lane_to_serdes_map_nif_lane112.BCM8885X=rx112:tx112 +lane_to_serdes_map_nif_lane113.BCM8885X=rx113:tx113 +lane_to_serdes_map_nif_lane114.BCM8885X=rx114:tx114 +lane_to_serdes_map_nif_lane115.BCM8885X=rx115:tx115 +lane_to_serdes_map_nif_lane116.BCM8885X=rx116:tx116 +lane_to_serdes_map_nif_lane117.BCM8885X=rx117:tx117 +lane_to_serdes_map_nif_lane118.BCM8885X=rx118:tx118 +lane_to_serdes_map_nif_lane119.BCM8885X=rx119:tx119 + +lane_to_serdes_map_nif_lane120.BCM8885X=rx120:tx120 +lane_to_serdes_map_nif_lane121.BCM8885X=rx121:tx121 +lane_to_serdes_map_nif_lane122.BCM8885X=rx122:tx122 +lane_to_serdes_map_nif_lane123.BCM8885X=rx123:tx123 +lane_to_serdes_map_nif_lane124.BCM8885X=rx124:tx124 +lane_to_serdes_map_nif_lane125.BCM8885X=rx125:tx125 +lane_to_serdes_map_nif_lane126.BCM8885X=rx126:tx126 +lane_to_serdes_map_nif_lane127.BCM8885X=rx127:tx127 + +lane_to_serdes_map_nif_lane128.BCM8885X=rx128:tx128 +lane_to_serdes_map_nif_lane129.BCM8885X=rx129:tx129 +lane_to_serdes_map_nif_lane130.BCM8885X=rx130:tx130 +lane_to_serdes_map_nif_lane131.BCM8885X=rx131:tx131 +lane_to_serdes_map_nif_lane132.BCM8885X=rx132:tx132 +lane_to_serdes_map_nif_lane133.BCM8885X=rx133:tx133 +lane_to_serdes_map_nif_lane134.BCM8885X=rx134:tx134 +lane_to_serdes_map_nif_lane135.BCM8885X=rx135:tx135 + +lane_to_serdes_map_nif_lane136.BCM8885X=rx136:tx136 +lane_to_serdes_map_nif_lane137.BCM8885X=rx137:tx137 +lane_to_serdes_map_nif_lane138.BCM8885X=rx138:tx138 +lane_to_serdes_map_nif_lane139.BCM8885X=rx139:tx139 +lane_to_serdes_map_nif_lane140.BCM8885X=rx140:tx140 +lane_to_serdes_map_nif_lane141.BCM8885X=rx141:tx141 +lane_to_serdes_map_nif_lane142.BCM8885X=rx142:tx142 +lane_to_serdes_map_nif_lane143.BCM8885X=rx143:tx143 + + +mdb_profile=Balanced-Exem +mdb_profile_kaps_cfg.BCM8885X=2 +mdio_output_delay=16 +mem_cache_enable_ecc.BCM8885X=1 +mem_cache_enable_parity.BCM8885X=1 +miim_intr_enable.BCM8885X=0 +os=unix +outlif_logical_to_physical_phase_map_1=S1 +outlif_logical_to_physical_phase_map_2=L1 +outlif_logical_to_physical_phase_map_3=XL +outlif_logical_to_physical_phase_map_4=L2 +outlif_logical_to_physical_phase_map_5=M1 +outlif_logical_to_physical_phase_map_6=M2 +outlif_logical_to_physical_phase_map_7=M3 +outlif_logical_to_physical_phase_map_8=S2 +outlif_physical_phase_data_granularity_L1=60 +outlif_physical_phase_data_granularity_L2=60 +outlif_physical_phase_data_granularity_M1=60 +outlif_physical_phase_data_granularity_M2=60 +outlif_physical_phase_data_granularity_M3=60 +outlif_physical_phase_data_granularity_S1=60 +outlif_physical_phase_data_granularity_S2=60 +outlif_physical_phase_data_granularity_XL=60 +pdma_continuous_mode_enable.BCM8885X=1 + + +phy_rx_polarity_flip_phy0.BCM8885X=0 +phy_rx_polarity_flip_phy1.BCM8885X=0 +phy_rx_polarity_flip_phy2.BCM8885X=1 +phy_rx_polarity_flip_phy3.BCM8885X=0 +phy_rx_polarity_flip_phy4.BCM8885X=0 +phy_rx_polarity_flip_phy5.BCM8885X=0 +phy_rx_polarity_flip_phy6.BCM8885X=1 +phy_rx_polarity_flip_phy7.BCM8885X=0 + +phy_rx_polarity_flip_phy8.BCM8885X=0 +phy_rx_polarity_flip_phy9.BCM8885X=1 +phy_rx_polarity_flip_phy10.BCM8885X=1 +phy_rx_polarity_flip_phy11.BCM8885X=1 +phy_rx_polarity_flip_phy12.BCM8885X=1 +phy_rx_polarity_flip_phy13.BCM8885X=0 +phy_rx_polarity_flip_phy14.BCM8885X=0 +phy_rx_polarity_flip_phy15.BCM8885X=1 + +phy_rx_polarity_flip_phy16.BCM8885X=1 +phy_rx_polarity_flip_phy17.BCM8885X=0 +phy_rx_polarity_flip_phy18.BCM8885X=1 +phy_rx_polarity_flip_phy19.BCM8885X=0 +phy_rx_polarity_flip_phy20.BCM8885X=1 +phy_rx_polarity_flip_phy21.BCM8885X=1 +phy_rx_polarity_flip_phy22.BCM8885X=1 +phy_rx_polarity_flip_phy23.BCM8885X=1 + +phy_rx_polarity_flip_phy24.BCM8885X=0 +phy_rx_polarity_flip_phy25.BCM8885X=1 +phy_rx_polarity_flip_phy26.BCM8885X=0 +phy_rx_polarity_flip_phy27.BCM8885X=1 +phy_rx_polarity_flip_phy28.BCM8885X=1 +phy_rx_polarity_flip_phy29.BCM8885X=1 +phy_rx_polarity_flip_phy30.BCM8885X=0 +phy_rx_polarity_flip_phy31.BCM8885X=1 + +phy_rx_polarity_flip_phy32.BCM8885X=1 +phy_rx_polarity_flip_phy33.BCM8885X=0 +phy_rx_polarity_flip_phy34.BCM8885X=1 +phy_rx_polarity_flip_phy35.BCM8885X=0 +phy_rx_polarity_flip_phy36.BCM8885X=0 +phy_rx_polarity_flip_phy37.BCM8885X=0 +phy_rx_polarity_flip_phy38.BCM8885X=0 +phy_rx_polarity_flip_phy39.BCM8885X=1 + +phy_rx_polarity_flip_phy40.BCM8885X=1 +phy_rx_polarity_flip_phy41.BCM8885X=1 +phy_rx_polarity_flip_phy42.BCM8885X=0 +phy_rx_polarity_flip_phy43.BCM8885X=1 +phy_rx_polarity_flip_phy44.BCM8885X=1 +phy_rx_polarity_flip_phy45.BCM8885X=0 +phy_rx_polarity_flip_phy46.BCM8885X=0 +phy_rx_polarity_flip_phy47.BCM8885X=1 + +phy_rx_polarity_flip_phy48.BCM8885X=0 +phy_rx_polarity_flip_phy49.BCM8885X=1 +phy_rx_polarity_flip_phy50.BCM8885X=0 +phy_rx_polarity_flip_phy51.BCM8885X=0 +phy_rx_polarity_flip_phy52.BCM8885X=0 +phy_rx_polarity_flip_phy53.BCM8885X=1 +phy_rx_polarity_flip_phy54.BCM8885X=0 +phy_rx_polarity_flip_phy55.BCM8885X=0 + +phy_rx_polarity_flip_phy56.BCM8885X=0 +phy_rx_polarity_flip_phy57.BCM8885X=0 +phy_rx_polarity_flip_phy58.BCM8885X=0 +phy_rx_polarity_flip_phy59.BCM8885X=0 +phy_rx_polarity_flip_phy60.BCM8885X=0 +phy_rx_polarity_flip_phy61.BCM8885X=0 +phy_rx_polarity_flip_phy62.BCM8885X=1 +phy_rx_polarity_flip_phy63.BCM8885X=1 + +phy_rx_polarity_flip_phy64.BCM8885X=0 +phy_rx_polarity_flip_phy65.BCM8885X=0 +phy_rx_polarity_flip_phy66.BCM8885X=0 +phy_rx_polarity_flip_phy67.BCM8885X=0 +phy_rx_polarity_flip_phy68.BCM8885X=0 +phy_rx_polarity_flip_phy69.BCM8885X=0 +phy_rx_polarity_flip_phy70.BCM8885X=0 +phy_rx_polarity_flip_phy71.BCM8885X=0 + +phy_rx_polarity_flip_phy72.BCM8885X=1 +phy_rx_polarity_flip_phy73.BCM8885X=0 +phy_rx_polarity_flip_phy74.BCM8885X=0 +phy_rx_polarity_flip_phy75.BCM8885X=1 +phy_rx_polarity_flip_phy76.BCM8885X=1 +phy_rx_polarity_flip_phy77.BCM8885X=1 +phy_rx_polarity_flip_phy78.BCM8885X=0 +phy_rx_polarity_flip_phy79.BCM8885X=1 + +phy_rx_polarity_flip_phy80.BCM8885X=1 +phy_rx_polarity_flip_phy81.BCM8885X=0 +phy_rx_polarity_flip_phy82.BCM8885X=1 +phy_rx_polarity_flip_phy83.BCM8885X=1 +phy_rx_polarity_flip_phy84.BCM8885X=0 +phy_rx_polarity_flip_phy85.BCM8885X=0 +phy_rx_polarity_flip_phy86.BCM8885X=1 +phy_rx_polarity_flip_phy87.BCM8885X=1 + +phy_rx_polarity_flip_phy88.BCM8885X=0 +phy_rx_polarity_flip_phy89.BCM8885X=1 +phy_rx_polarity_flip_phy90.BCM8885X=0 +phy_rx_polarity_flip_phy91.BCM8885X=0 +phy_rx_polarity_flip_phy92.BCM8885X=0 +phy_rx_polarity_flip_phy93.BCM8885X=0 +phy_rx_polarity_flip_phy94.BCM8885X=0 +phy_rx_polarity_flip_phy95.BCM8885X=1 + +phy_rx_polarity_flip_phy96.BCM8885X=0 +phy_rx_polarity_flip_phy97.BCM8885X=0 +phy_rx_polarity_flip_phy98.BCM8885X=0 +phy_rx_polarity_flip_phy99.BCM8885X=0 +phy_rx_polarity_flip_phy100.BCM8885X=0 +phy_rx_polarity_flip_phy101.BCM8885X=1 +phy_rx_polarity_flip_phy102.BCM8885X=1 +phy_rx_polarity_flip_phy103.BCM8885X=0 + +phy_rx_polarity_flip_phy104.BCM8885X=1 +phy_rx_polarity_flip_phy105.BCM8885X=1 +phy_rx_polarity_flip_phy106.BCM8885X=1 +phy_rx_polarity_flip_phy107.BCM8885X=1 +phy_rx_polarity_flip_phy108.BCM8885X=0 +phy_rx_polarity_flip_phy109.BCM8885X=1 +phy_rx_polarity_flip_phy110.BCM8885X=1 +phy_rx_polarity_flip_phy111.BCM8885X=1 + +phy_rx_polarity_flip_phy112.BCM8885X=0 +phy_rx_polarity_flip_phy113.BCM8885X=1 +phy_rx_polarity_flip_phy114.BCM8885X=1 +phy_rx_polarity_flip_phy115.BCM8885X=1 +phy_rx_polarity_flip_phy116.BCM8885X=1 +phy_rx_polarity_flip_phy117.BCM8885X=1 +phy_rx_polarity_flip_phy118.BCM8885X=0 +phy_rx_polarity_flip_phy119.BCM8885X=0 + +phy_rx_polarity_flip_phy120.BCM8885X=1 +phy_rx_polarity_flip_phy121.BCM8885X=0 +phy_rx_polarity_flip_phy122.BCM8885X=0 +phy_rx_polarity_flip_phy123.BCM8885X=1 +phy_rx_polarity_flip_phy124.BCM8885X=0 +phy_rx_polarity_flip_phy125.BCM8885X=1 +phy_rx_polarity_flip_phy126.BCM8885X=1 +phy_rx_polarity_flip_phy127.BCM8885X=0 + +phy_rx_polarity_flip_phy128.BCM8885X=0 +phy_rx_polarity_flip_phy129.BCM8885X=0 +phy_rx_polarity_flip_phy130.BCM8885X=1 +phy_rx_polarity_flip_phy131.BCM8885X=0 +phy_rx_polarity_flip_phy132.BCM8885X=0 +phy_rx_polarity_flip_phy133.BCM8885X=1 +phy_rx_polarity_flip_phy134.BCM8885X=1 +phy_rx_polarity_flip_phy135.BCM8885X=0 + +phy_rx_polarity_flip_phy136.BCM8885X=1 +phy_rx_polarity_flip_phy137.BCM8885X=0 +phy_rx_polarity_flip_phy138.BCM8885X=0 +phy_rx_polarity_flip_phy139.BCM8885X=1 +phy_rx_polarity_flip_phy140.BCM8885X=1 +phy_rx_polarity_flip_phy141.BCM8885X=1 +phy_rx_polarity_flip_phy142.BCM8885X=0 +phy_rx_polarity_flip_phy143.BCM8885X=1 + + +phy_tx_polarity_flip_phy0.BCM8885X=1 +phy_tx_polarity_flip_phy1.BCM8885X=1 +phy_tx_polarity_flip_phy2.BCM8885X=0 +phy_tx_polarity_flip_phy3.BCM8885X=1 +phy_tx_polarity_flip_phy4.BCM8885X=1 +phy_tx_polarity_flip_phy5.BCM8885X=0 +phy_tx_polarity_flip_phy6.BCM8885X=0 +phy_tx_polarity_flip_phy7.BCM8885X=1 + +phy_tx_polarity_flip_phy8.BCM8885X=0 +phy_tx_polarity_flip_phy9.BCM8885X=1 +phy_tx_polarity_flip_phy10.BCM8885X=0 +phy_tx_polarity_flip_phy11.BCM8885X=1 +phy_tx_polarity_flip_phy12.BCM8885X=1 +phy_tx_polarity_flip_phy13.BCM8885X=1 +phy_tx_polarity_flip_phy14.BCM8885X=0 +phy_tx_polarity_flip_phy15.BCM8885X=1 + +phy_tx_polarity_flip_phy16.BCM8885X=1 +phy_tx_polarity_flip_phy17.BCM8885X=1 +phy_tx_polarity_flip_phy18.BCM8885X=0 +phy_tx_polarity_flip_phy19.BCM8885X=0 +phy_tx_polarity_flip_phy20.BCM8885X=1 +phy_tx_polarity_flip_phy21.BCM8885X=1 +phy_tx_polarity_flip_phy22.BCM8885X=0 +phy_tx_polarity_flip_phy23.BCM8885X=0 + +phy_tx_polarity_flip_phy24.BCM8885X=0 +phy_tx_polarity_flip_phy25.BCM8885X=0 +phy_tx_polarity_flip_phy26.BCM8885X=0 +phy_tx_polarity_flip_phy27.BCM8885X=1 +phy_tx_polarity_flip_phy28.BCM8885X=0 +phy_tx_polarity_flip_phy29.BCM8885X=0 +phy_tx_polarity_flip_phy30.BCM8885X=0 +phy_tx_polarity_flip_phy31.BCM8885X=0 + +phy_tx_polarity_flip_phy32.BCM8885X=1 +phy_tx_polarity_flip_phy33.BCM8885X=1 +phy_tx_polarity_flip_phy34.BCM8885X=1 +phy_tx_polarity_flip_phy35.BCM8885X=0 +phy_tx_polarity_flip_phy36.BCM8885X=1 +phy_tx_polarity_flip_phy37.BCM8885X=1 +phy_tx_polarity_flip_phy38.BCM8885X=1 +phy_tx_polarity_flip_phy39.BCM8885X=0 + +phy_tx_polarity_flip_phy40.BCM8885X=0 +phy_tx_polarity_flip_phy41.BCM8885X=0 +phy_tx_polarity_flip_phy42.BCM8885X=1 +phy_tx_polarity_flip_phy43.BCM8885X=1 +phy_tx_polarity_flip_phy44.BCM8885X=0 +phy_tx_polarity_flip_phy45.BCM8885X=0 +phy_tx_polarity_flip_phy46.BCM8885X=1 +phy_tx_polarity_flip_phy47.BCM8885X=0 + +phy_tx_polarity_flip_phy48.BCM8885X=1 +phy_tx_polarity_flip_phy49.BCM8885X=1 +phy_tx_polarity_flip_phy50.BCM8885X=1 +phy_tx_polarity_flip_phy51.BCM8885X=0 +phy_tx_polarity_flip_phy52.BCM8885X=1 +phy_tx_polarity_flip_phy53.BCM8885X=0 +phy_tx_polarity_flip_phy54.BCM8885X=0 +phy_tx_polarity_flip_phy55.BCM8885X=0 + +phy_tx_polarity_flip_phy56.BCM8885X=0 +phy_tx_polarity_flip_phy57.BCM8885X=1 +phy_tx_polarity_flip_phy58.BCM8885X=0 +phy_tx_polarity_flip_phy59.BCM8885X=0 +phy_tx_polarity_flip_phy60.BCM8885X=0 +phy_tx_polarity_flip_phy61.BCM8885X=0 +phy_tx_polarity_flip_phy62.BCM8885X=0 +phy_tx_polarity_flip_phy63.BCM8885X=0 + +phy_tx_polarity_flip_phy64.BCM8885X=0 +phy_tx_polarity_flip_phy65.BCM8885X=1 +phy_tx_polarity_flip_phy66.BCM8885X=1 +phy_tx_polarity_flip_phy67.BCM8885X=0 +phy_tx_polarity_flip_phy68.BCM8885X=1 +phy_tx_polarity_flip_phy69.BCM8885X=0 +phy_tx_polarity_flip_phy70.BCM8885X=0 +phy_tx_polarity_flip_phy71.BCM8885X=1 + +phy_tx_polarity_flip_phy72.BCM8885X=1 +phy_tx_polarity_flip_phy73.BCM8885X=1 +phy_tx_polarity_flip_phy74.BCM8885X=0 +phy_tx_polarity_flip_phy75.BCM8885X=1 +phy_tx_polarity_flip_phy76.BCM8885X=1 +phy_tx_polarity_flip_phy77.BCM8885X=1 +phy_tx_polarity_flip_phy78.BCM8885X=0 +phy_tx_polarity_flip_phy79.BCM8885X=1 + +phy_tx_polarity_flip_phy80.BCM8885X=1 +phy_tx_polarity_flip_phy81.BCM8885X=0 +phy_tx_polarity_flip_phy82.BCM8885X=0 +phy_tx_polarity_flip_phy83.BCM8885X=0 +phy_tx_polarity_flip_phy84.BCM8885X=0 +phy_tx_polarity_flip_phy85.BCM8885X=0 +phy_tx_polarity_flip_phy86.BCM8885X=1 +phy_tx_polarity_flip_phy87.BCM8885X=0 + +phy_tx_polarity_flip_phy88.BCM8885X=1 +phy_tx_polarity_flip_phy89.BCM8885X=0 +phy_tx_polarity_flip_phy90.BCM8885X=1 +phy_tx_polarity_flip_phy91.BCM8885X=1 +phy_tx_polarity_flip_phy92.BCM8885X=1 +phy_tx_polarity_flip_phy93.BCM8885X=0 +phy_tx_polarity_flip_phy94.BCM8885X=1 +phy_tx_polarity_flip_phy95.BCM8885X=1 + +phy_tx_polarity_flip_phy96.BCM8885X=1 +phy_tx_polarity_flip_phy97.BCM8885X=1 +phy_tx_polarity_flip_phy98.BCM8885X=1 +phy_tx_polarity_flip_phy99.BCM8885X=0 +phy_tx_polarity_flip_phy100.BCM8885X=1 +phy_tx_polarity_flip_phy101.BCM8885X=1 +phy_tx_polarity_flip_phy102.BCM8885X=1 +phy_tx_polarity_flip_phy103.BCM8885X=0 + +phy_tx_polarity_flip_phy104.BCM8885X=0 +phy_tx_polarity_flip_phy105.BCM8885X=0 +phy_tx_polarity_flip_phy106.BCM8885X=0 +phy_tx_polarity_flip_phy107.BCM8885X=1 +phy_tx_polarity_flip_phy108.BCM8885X=1 +phy_tx_polarity_flip_phy109.BCM8885X=0 +phy_tx_polarity_flip_phy110.BCM8885X=1 +phy_tx_polarity_flip_phy111.BCM8885X=0 + +phy_tx_polarity_flip_phy112.BCM8885X=0 +phy_tx_polarity_flip_phy113.BCM8885X=1 +phy_tx_polarity_flip_phy114.BCM8885X=1 +phy_tx_polarity_flip_phy115.BCM8885X=0 +phy_tx_polarity_flip_phy116.BCM8885X=0 +phy_tx_polarity_flip_phy117.BCM8885X=1 +phy_tx_polarity_flip_phy118.BCM8885X=0 +phy_tx_polarity_flip_phy119.BCM8885X=0 + +phy_tx_polarity_flip_phy120.BCM8885X=0 +phy_tx_polarity_flip_phy121.BCM8885X=1 +phy_tx_polarity_flip_phy122.BCM8885X=1 +phy_tx_polarity_flip_phy123.BCM8885X=0 +phy_tx_polarity_flip_phy124.BCM8885X=0 +phy_tx_polarity_flip_phy125.BCM8885X=0 +phy_tx_polarity_flip_phy126.BCM8885X=1 +phy_tx_polarity_flip_phy127.BCM8885X=0 + +phy_tx_polarity_flip_phy128.BCM8885X=1 +phy_tx_polarity_flip_phy129.BCM8885X=1 +phy_tx_polarity_flip_phy130.BCM8885X=0 +phy_tx_polarity_flip_phy131.BCM8885X=0 +phy_tx_polarity_flip_phy132.BCM8885X=0 +phy_tx_polarity_flip_phy133.BCM8885X=1 +phy_tx_polarity_flip_phy134.BCM8885X=0 +phy_tx_polarity_flip_phy135.BCM8885X=0 + +phy_tx_polarity_flip_phy136.BCM8885X=0 +phy_tx_polarity_flip_phy137.BCM8885X=0 +phy_tx_polarity_flip_phy138.BCM8885X=0 +phy_tx_polarity_flip_phy139.BCM8885X=0 +phy_tx_polarity_flip_phy140.BCM8885X=0 +phy_tx_polarity_flip_phy141.BCM8885X=0 +phy_tx_polarity_flip_phy142.BCM8885X=0 +phy_tx_polarity_flip_phy143.BCM8885X=0 + + +polled_irq_delay.BCM8885X=5 +polled_irq_mode.BCM8885X=0 +port_fec_fabric.BCM8885X=7 +bcm_stat_interval.BCM8885X=1000000 + + +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 + +port_init_cl72_256=0 +port_init_cl72_257=0 +port_init_cl72_258=0 +port_init_cl72_259=0 +port_init_cl72_260=0 +port_init_cl72_261=0 +port_init_cl72_262=0 +port_init_cl72_263=0 +port_init_cl72_264=0 +port_init_cl72_265=0 +port_init_cl72_266=0 +port_init_cl72_267=0 +port_init_cl72_268=0 +port_init_cl72_269=0 +port_init_cl72_270=0 +port_init_cl72_271=0 +port_init_cl72_272=0 +port_init_cl72_273=0 +port_init_cl72_274=0 +port_init_cl72_275=0 +port_init_cl72_276=0 +port_init_cl72_277=0 +port_init_cl72_278=0 +port_init_cl72_279=0 +port_init_cl72_280=0 +port_init_cl72_281=0 +port_init_cl72_282=0 +port_init_cl72_283=0 +port_init_cl72_284=0 +port_init_cl72_285=0 +port_init_cl72_286=0 +port_init_cl72_287=0 +port_init_cl72_288=0 +port_init_cl72_289=0 +port_init_cl72_290=0 +port_init_cl72_291=0 +port_init_cl72_292=0 +port_init_cl72_293=0 +port_init_cl72_294=0 +port_init_cl72_295=0 +port_init_cl72_296=0 +port_init_cl72_297=0 +port_init_cl72_298=0 +port_init_cl72_299=0 +port_init_cl72_300=0 +port_init_cl72_301=0 +port_init_cl72_302=0 +port_init_cl72_303=0 +port_init_cl72_304=0 +port_init_cl72_305=0 +port_init_cl72_306=0 +port_init_cl72_307=0 +port_init_cl72_308=0 +port_init_cl72_309=0 +port_init_cl72_310=0 +port_init_cl72_311=0 +port_init_cl72_312=0 +port_init_cl72_313=0 +port_init_cl72_314=0 +port_init_cl72_315=0 +port_init_cl72_316=0 +port_init_cl72_317=0 +port_init_cl72_318=0 +port_init_cl72_319=0 +port_init_cl72_320=0 +port_init_cl72_321=0 +port_init_cl72_322=0 +port_init_cl72_323=0 +port_init_cl72_324=0 +port_init_cl72_325=0 +port_init_cl72_326=0 +port_init_cl72_327=0 +port_init_cl72_328=0 +port_init_cl72_329=0 +port_init_cl72_330=0 +port_init_cl72_331=0 +port_init_cl72_332=0 +port_init_cl72_333=0 +port_init_cl72_334=0 +port_init_cl72_335=0 +port_init_cl72_336=0 +port_init_cl72_337=0 +port_init_cl72_338=0 +port_init_cl72_339=0 +port_init_cl72_340=0 +port_init_cl72_341=0 +port_init_cl72_342=0 +port_init_cl72_343=0 +port_init_cl72_344=0 +port_init_cl72_345=0 +port_init_cl72_346=0 +port_init_cl72_347=0 +port_init_cl72_348=0 +port_init_cl72_349=0 +port_init_cl72_350=0 +port_init_cl72_351=0 +port_init_cl72_352=0 +port_init_cl72_353=0 +port_init_cl72_354=0 +port_init_cl72_355=0 +port_init_cl72_356=0 +port_init_cl72_357=0 +port_init_cl72_358=0 +port_init_cl72_359=0 +port_init_cl72_360=0 +port_init_cl72_361=0 +port_init_cl72_362=0 +port_init_cl72_363=0 +port_init_cl72_364=0 +port_init_cl72_365=0 +port_init_cl72_366=0 +port_init_cl72_367=0 +port_init_cl72_368=0 +port_init_cl72_369=0 +port_init_cl72_370=0 +port_init_cl72_371=0 +port_init_cl72_372=0 +port_init_cl72_373=0 +port_init_cl72_374=0 +port_init_cl72_375=0 +port_init_cl72_376=0 +port_init_cl72_377=0 +port_init_cl72_378=0 +port_init_cl72_379=0 +port_init_cl72_380=0 +port_init_cl72_381=0 +port_init_cl72_382=0 +port_init_cl72_383=0 +port_init_cl72_384=0 +port_init_cl72_385=0 +port_init_cl72_386=0 +port_init_cl72_387=0 +port_init_cl72_388=0 +port_init_cl72_389=0 +port_init_cl72_390=0 +port_init_cl72_391=0 +port_init_cl72_392=0 +port_init_cl72_393=0 +port_init_cl72_394=0 +port_init_cl72_395=0 +port_init_cl72_396=0 +port_init_cl72_397=0 +port_init_cl72_398=0 +port_init_cl72_399=0 +port_init_cl72_400=0 +port_init_cl72_401=0 +port_init_cl72_402=0 +port_init_cl72_403=0 +port_init_cl72_404=0 +port_init_cl72_405=0 +port_init_cl72_406=0 +port_init_cl72_407=0 +port_init_cl72_408=0 +port_init_cl72_409=0 +port_init_cl72_410=0 +port_init_cl72_411=0 +port_init_cl72_412=0 +port_init_cl72_413=0 +port_init_cl72_414=0 +port_init_cl72_415=0 +port_init_cl72_416=0 +port_init_cl72_417=0 +port_init_cl72_418=0 +port_init_cl72_419=0 +port_init_cl72_420=0 +port_init_cl72_421=0 +port_init_cl72_422=0 +port_init_cl72_423=0 +port_init_cl72_424=0 +port_init_cl72_425=0 +port_init_cl72_426=0 +port_init_cl72_427=0 +port_init_cl72_428=0 +port_init_cl72_429=0 +port_init_cl72_430=0 +port_init_cl72_431=0 +port_init_cl72_432=0 +port_init_cl72_433=0 +port_init_cl72_434=0 +port_init_cl72_435=0 +port_init_cl72_436=0 +port_init_cl72_437=0 +port_init_cl72_438=0 +port_init_cl72_439=0 +port_init_cl72_440=0 +port_init_cl72_441=0 +port_init_cl72_442=0 +port_init_cl72_443=0 +port_init_cl72_444=0 +port_init_cl72_445=0 +port_init_cl72_446=0 +port_init_cl72_447=0 + + +port_init_speed_cc.BCM8885X=200000 +port_init_speed_cd.BCM8885X=400000 +port_init_speed_ce.BCM8885X=100000 +port_init_speed_fabric.BCM8885X=53125 +port_init_speed_il.BCM8885X=10312 +port_init_speed_le.BCM8885X=50000 +port_init_speed_xe.BCM8885X=10000 +port_init_speed_xl.BCM8885X=40000 +port_priorities.BCM8885X=8 +protocol_traps_mode.BCM8885X=IN_LIF +rate_ext_mdio_divisor=16 +schan_intr_enable.BCM8885X=0 +schan_timeout_usec.BCM8885X=900000 +serdes_fabric_clk_freq_in.BCM8885X=1 +serdes_fabric_clk_freq_out.BCM8885X=bypass +serdes_nif_clk_freq_in0.BCM8885X=1 +serdes_nif_clk_freq_in1.BCM8885X=1 +serdes_nif_clk_freq_out0.BCM8885X=bypass +serdes_nif_clk_freq_out1.BCM8885X=bypass +soc_family.BCM8885X=BCM8885X +stable_filename.BCM8885X=/tmp/warmboot_data +stable_location.BCM8885X=3 +stable_size.BCM8885X=800000000 +sw_state_max_size.BCM8885X=750000000 +system_headers_mode=1 +tdma_intr_enable.BCM8885X=0 +tdma_timeout_usec.BCM8885X=1000000 +tm_port_header_type_in_0.BCM8885X=INJECTED_2 +tm_port_header_type_in_200.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_201.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_202.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_203.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_232.BCM8885X=INJECTED_2 +tm_port_header_type_in_19.BCM8885X=ETH +tm_port_header_type_in_20.BCM8885X=INJECTED_2 +tm_port_header_type_out_0.BCM8885X=CPU +tm_port_header_type_out_200.BCM8885X=ETH +tm_port_header_type_out_201.BCM8885X=ETH +tm_port_header_type_out_202.BCM8885X=ETH +tm_port_header_type_out_203.BCM8885X=ETH +tm_port_header_type_out_232.BCM8885X=CPU +tm_port_header_type_out_19.BCM8885X=ETH +tm_port_header_type_out_20.BCM8885X=RAW +tslam_intr_enable.BCM8885X=0 +tslam_timeout_usec.BCM8885X=1000000 +ucode_port_0.BCM8885X=CPU.0:core_0.0 +ucode_port_200.BCM8885X=CPU.8:core_1.200 +ucode_port_201.BCM8885X=CPU.16:core_1.201 +ucode_port_202.BCM8885X=CPU.24:core_1.202 +ucode_port_203.BCM8885X=CPU.32:core_1.203 + + +ucode_port_1.BCM8885X=CGE18:core_1.1 +ucode_port_2.BCM8885X=CGE20:core_1.2 +ucode_port_3.BCM8885X=CGE22:core_1.3 +ucode_port_4.BCM8885X=CGE24:core_1.4 +ucode_port_5.BCM8885X=CGE26:core_1.5 +ucode_port_6.BCM8885X=CGE28:core_1.6 +ucode_port_7.BCM8885X=CGE30:core_1.7 +ucode_port_8.BCM8885X=CGE32:core_1.8 +ucode_port_9.BCM8885X=CGE34:core_1.9 +ucode_port_10.BCM8885X=CGE16:core_0.10 +ucode_port_11.BCM8885X=CGE14:core_0.11 +ucode_port_12.BCM8885X=CGE12:core_0.12 +ucode_port_13.BCM8885X=CGE10:core_0.13 +ucode_port_14.BCM8885X=CGE8:core_0.14 +ucode_port_15.BCM8885X=CGE6:core_0.15 +ucode_port_16.BCM8885X=CGE4:core_0.16 +ucode_port_17.BCM8885X=CGE2:core_0.17 +ucode_port_18.BCM8885X=CGE0:core_0.18 + + +ucode_port_19.BCM8885X=RCY0:core_0.19 +ucode_port_20.BCM8885X=RCY1:core_1.20 +ucode_port_21.BCM8885X=OLP:core_1.21 + + +port_init_speed_1.BCM8885X=100000 +port_init_speed_2.BCM8885X=100000 +port_init_speed_3.BCM8885X=100000 +port_init_speed_4.BCM8885X=100000 +port_init_speed_5.BCM8885X=100000 +port_init_speed_6.BCM8885X=100000 +port_init_speed_7.BCM8885X=100000 +port_init_speed_8.BCM8885X=100000 +port_init_speed_9.BCM8885X=100000 +port_init_speed_10.BCM8885X=100000 +port_init_speed_11.BCM8885X=100000 +port_init_speed_12.BCM8885X=100000 +port_init_speed_13.BCM8885X=100000 +port_init_speed_14.BCM8885X=100000 +port_init_speed_15.BCM8885X=100000 +port_init_speed_16.BCM8885X=100000 +port_init_speed_17.BCM8885X=100000 +port_init_speed_18.BCM8885X=100000 + + +port_fec_1.BCM8885X=0 +port_fec_2.BCM8885X=0 +port_fec_3.BCM8885X=0 +port_fec_4.BCM8885X=0 +port_fec_5.BCM8885x=0 +port_fec_6.BCM8885x=0 +port_fec_7.BCM8885x=0 +port_fec_8.BCM8885x=0 +port_fec_9.BCM8885x=0 +port_fec_10.BCM8885x=0 +port_fec_11.BCM8885x=0 +port_fec_12.BCM8885x=0 +port_fec_13.BCM8885x=0 +port_fec_14.BCM8885x=0 +port_fec_15.BCM8885x=0 +port_fec_16.BCM8885x=0 +port_fec_17.BCM8885x=0 +port_fec_18.BCM8885x=0 + + +serdes_lane_config_dfe_1.BCM8885X=lp +serdes_lane_config_dfe_2.BCM8885X=lp +serdes_lane_config_dfe_3.BCM8885X=lp +serdes_lane_config_dfe_4.BCM8885X=lp +serdes_lane_config_dfe_5.BCM8885X=lp +serdes_lane_config_dfe_6.BCM8885X=lp +serdes_lane_config_dfe_7.BCM8885X=lp +serdes_lane_config_dfe_8.BCM8885X=lp +serdes_lane_config_dfe_9.BCM8885X=lp +serdes_lane_config_dfe_10.BCM8885X=lp +serdes_lane_config_dfe_11.BCM8885X=lp +serdes_lane_config_dfe_12.BCM8885X=lp +serdes_lane_config_dfe_13.BCM8885X=lp +serdes_lane_config_dfe_14.BCM8885X=lp +serdes_lane_config_dfe_15.BCM8885X=lp +serdes_lane_config_dfe_16.BCM8885X=lp +serdes_lane_config_dfe_17.BCM8885X=lp +serdes_lane_config_dfe_18.BCM8885X=lp + + +serdes_lane_config_media_type_1.BCM8885X=backplane +serdes_lane_config_media_type_2.BCM8885X=backplane +serdes_lane_config_media_type_3.BCM8885X=backplane +serdes_lane_config_media_type_4.BCM8885X=backplane +serdes_lane_config_media_type_5.BCM8885X=backplane +serdes_lane_config_media_type_6.BCM8885X=backplane +serdes_lane_config_media_type_7.BCM8885X=backplane +serdes_lane_config_media_type_8.BCM8885X=backplane +serdes_lane_config_media_type_9.BCM8885X=backplane +serdes_lane_config_media_type_10.BCM8885X=backplane +serdes_lane_config_media_type_11.BCM8885X=backplane +serdes_lane_config_media_type_12.BCM8885X=backplane +serdes_lane_config_media_type_13.BCM8885X=backplane +serdes_lane_config_media_type_14.BCM8885X=backplane +serdes_lane_config_media_type_15.BCM8885X=backplane +serdes_lane_config_media_type_16.BCM8885X=backplane +serdes_lane_config_media_type_17.BCM8885X=backplane +serdes_lane_config_media_type_18.BCM8885X=backplane + + +serdes_tx_taps_1.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_2.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_3.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_4.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_5.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_6.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_7.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_8.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_9.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_10.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_11.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_12.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_13.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_14.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_15.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_16.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_17.BCM8885X=nrz:-6:87:-4 +serdes_tx_taps_18.BCM8885X=nrz:-6:87:-4 + + +serdes_tx_taps_256.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_257.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_258.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_259.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_260.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_261.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_262.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_263.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_264.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_265.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_266.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_267.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_268.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_269.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_270.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_271.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_272.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_273.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_274.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_275.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_276.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_277.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_278.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_279.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_280.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_281.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_282.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_283.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_284.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_285.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_286.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_287.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_288.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_289.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_290.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_291.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_292.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_293.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_294.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_295.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_296.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_297.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_298.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_299.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_300.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_301.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_302.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_303.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_304.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_305.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_306.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_307.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_308.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_309.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_310.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_311.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_312.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_313.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_314.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_315.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_316.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_317.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_318.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_319.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_320.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_321.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_322.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_323.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_324.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_325.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_326.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_327.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_328.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_329.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_330.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_331.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_332.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_333.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_334.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_335.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_336.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_337.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_338.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_339.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_340.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_341.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_342.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_343.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_344.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_345.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_346.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_347.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_348.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_349.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_350.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_351.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_352.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_353.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_354.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_355.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_356.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_357.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_358.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_359.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_360.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_361.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_362.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_363.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_364.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_365.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_366.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_367.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_368.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_369.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_370.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_371.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_372.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_373.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_374.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_375.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_376.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_377.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_378.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_379.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_380.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_381.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_382.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_383.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_384.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_385.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_386.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_387.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_388.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_389.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_390.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_391.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_392.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_393.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_394.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_395.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_396.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_397.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_398.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_399.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_400.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_401.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_402.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_403.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_404.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_405.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_406.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_407.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_408.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_409.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_410.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_411.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_412.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_413.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_414.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_415.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_416.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_417.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_418.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_419.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_420.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_421.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_422.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_423.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_424.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_425.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_426.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_427.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_428.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_429.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_430.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_431.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_432.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_433.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_434.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_435.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_436.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_437.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_438.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_439.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_440.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_441.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_442.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_443.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_444.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_445.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_446.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_447.BCM8885X=pam4:-20:148:0:0:0:0 + + +serdes_lane_config_channel_mode_256=force_nr +serdes_lane_config_channel_mode_257=force_nr +serdes_lane_config_channel_mode_258=force_nr +serdes_lane_config_channel_mode_259=force_nr +serdes_lane_config_channel_mode_260=force_nr +serdes_lane_config_channel_mode_261=force_nr +serdes_lane_config_channel_mode_262=force_nr +serdes_lane_config_channel_mode_263=force_nr +serdes_lane_config_channel_mode_264=force_nr +serdes_lane_config_channel_mode_265=force_nr +serdes_lane_config_channel_mode_266=force_nr +serdes_lane_config_channel_mode_267=force_nr +serdes_lane_config_channel_mode_268=force_nr +serdes_lane_config_channel_mode_269=force_nr +serdes_lane_config_channel_mode_270=force_nr +serdes_lane_config_channel_mode_271=force_nr +serdes_lane_config_channel_mode_272=force_nr +serdes_lane_config_channel_mode_273=force_nr +serdes_lane_config_channel_mode_274=force_nr +serdes_lane_config_channel_mode_275=force_nr +serdes_lane_config_channel_mode_276=force_nr +serdes_lane_config_channel_mode_277=force_nr +serdes_lane_config_channel_mode_278=force_nr +serdes_lane_config_channel_mode_279=force_nr +serdes_lane_config_channel_mode_280=force_nr +serdes_lane_config_channel_mode_281=force_nr +serdes_lane_config_channel_mode_282=force_nr +serdes_lane_config_channel_mode_283=force_nr +serdes_lane_config_channel_mode_284=force_nr +serdes_lane_config_channel_mode_285=force_nr +serdes_lane_config_channel_mode_286=force_nr +serdes_lane_config_channel_mode_287=force_nr +serdes_lane_config_channel_mode_288=force_nr +serdes_lane_config_channel_mode_289=force_nr +serdes_lane_config_channel_mode_290=force_nr +serdes_lane_config_channel_mode_291=force_nr +serdes_lane_config_channel_mode_292=force_nr +serdes_lane_config_channel_mode_293=force_nr +serdes_lane_config_channel_mode_294=force_nr +serdes_lane_config_channel_mode_295=force_nr +serdes_lane_config_channel_mode_296=force_nr +serdes_lane_config_channel_mode_297=force_nr +serdes_lane_config_channel_mode_298=force_nr +serdes_lane_config_channel_mode_299=force_nr +serdes_lane_config_channel_mode_300=force_nr +serdes_lane_config_channel_mode_301=force_nr +serdes_lane_config_channel_mode_302=force_nr +serdes_lane_config_channel_mode_303=force_nr +serdes_lane_config_channel_mode_304=force_nr +serdes_lane_config_channel_mode_305=force_nr +serdes_lane_config_channel_mode_306=force_nr +serdes_lane_config_channel_mode_307=force_nr +serdes_lane_config_channel_mode_308=force_nr +serdes_lane_config_channel_mode_309=force_nr +serdes_lane_config_channel_mode_310=force_nr +serdes_lane_config_channel_mode_311=force_nr +serdes_lane_config_channel_mode_312=force_nr +serdes_lane_config_channel_mode_313=force_nr +serdes_lane_config_channel_mode_314=force_nr +serdes_lane_config_channel_mode_315=force_nr +serdes_lane_config_channel_mode_316=force_nr +serdes_lane_config_channel_mode_317=force_nr +serdes_lane_config_channel_mode_318=force_nr +serdes_lane_config_channel_mode_319=force_nr +serdes_lane_config_channel_mode_320=force_nr +serdes_lane_config_channel_mode_321=force_nr +serdes_lane_config_channel_mode_322=force_nr +serdes_lane_config_channel_mode_323=force_nr +serdes_lane_config_channel_mode_324=force_nr +serdes_lane_config_channel_mode_325=force_nr +serdes_lane_config_channel_mode_326=force_nr +serdes_lane_config_channel_mode_327=force_nr +serdes_lane_config_channel_mode_328=force_nr +serdes_lane_config_channel_mode_329=force_nr +serdes_lane_config_channel_mode_330=force_nr +serdes_lane_config_channel_mode_331=force_nr +serdes_lane_config_channel_mode_332=force_nr +serdes_lane_config_channel_mode_333=force_nr +serdes_lane_config_channel_mode_334=force_nr +serdes_lane_config_channel_mode_335=force_nr +serdes_lane_config_channel_mode_336=force_nr +serdes_lane_config_channel_mode_337=force_nr +serdes_lane_config_channel_mode_338=force_nr +serdes_lane_config_channel_mode_339=force_nr +serdes_lane_config_channel_mode_340=force_nr +serdes_lane_config_channel_mode_341=force_nr +serdes_lane_config_channel_mode_342=force_nr +serdes_lane_config_channel_mode_343=force_nr +serdes_lane_config_channel_mode_344=force_nr +serdes_lane_config_channel_mode_345=force_nr +serdes_lane_config_channel_mode_346=force_nr +serdes_lane_config_channel_mode_347=force_nr +serdes_lane_config_channel_mode_348=force_nr +serdes_lane_config_channel_mode_349=force_nr +serdes_lane_config_channel_mode_350=force_nr +serdes_lane_config_channel_mode_351=force_nr +serdes_lane_config_channel_mode_352=force_nr +serdes_lane_config_channel_mode_353=force_nr +serdes_lane_config_channel_mode_354=force_nr +serdes_lane_config_channel_mode_355=force_nr +serdes_lane_config_channel_mode_356=force_nr +serdes_lane_config_channel_mode_357=force_nr +serdes_lane_config_channel_mode_358=force_nr +serdes_lane_config_channel_mode_359=force_nr +serdes_lane_config_channel_mode_360=force_nr +serdes_lane_config_channel_mode_361=force_nr +serdes_lane_config_channel_mode_362=force_nr +serdes_lane_config_channel_mode_363=force_nr +serdes_lane_config_channel_mode_364=force_nr +serdes_lane_config_channel_mode_365=force_nr +serdes_lane_config_channel_mode_366=force_nr +serdes_lane_config_channel_mode_367=force_nr +serdes_lane_config_channel_mode_368=force_nr +serdes_lane_config_channel_mode_369=force_nr +serdes_lane_config_channel_mode_370=force_nr +serdes_lane_config_channel_mode_371=force_nr +serdes_lane_config_channel_mode_372=force_nr +serdes_lane_config_channel_mode_373=force_nr +serdes_lane_config_channel_mode_374=force_nr +serdes_lane_config_channel_mode_375=force_nr +serdes_lane_config_channel_mode_376=force_nr +serdes_lane_config_channel_mode_377=force_nr +serdes_lane_config_channel_mode_378=force_nr +serdes_lane_config_channel_mode_379=force_nr +serdes_lane_config_channel_mode_380=force_nr +serdes_lane_config_channel_mode_381=force_nr +serdes_lane_config_channel_mode_382=force_nr +serdes_lane_config_channel_mode_383=force_nr +serdes_lane_config_channel_mode_384=force_nr +serdes_lane_config_channel_mode_385=force_nr +serdes_lane_config_channel_mode_386=force_nr +serdes_lane_config_channel_mode_387=force_nr +serdes_lane_config_channel_mode_388=force_nr +serdes_lane_config_channel_mode_389=force_nr +serdes_lane_config_channel_mode_390=force_nr +serdes_lane_config_channel_mode_391=force_nr +serdes_lane_config_channel_mode_392=force_nr +serdes_lane_config_channel_mode_393=force_nr +serdes_lane_config_channel_mode_394=force_nr +serdes_lane_config_channel_mode_395=force_nr +serdes_lane_config_channel_mode_396=force_nr +serdes_lane_config_channel_mode_397=force_nr +serdes_lane_config_channel_mode_398=force_nr +serdes_lane_config_channel_mode_399=force_nr +serdes_lane_config_channel_mode_400=force_nr +serdes_lane_config_channel_mode_401=force_nr +serdes_lane_config_channel_mode_402=force_nr +serdes_lane_config_channel_mode_403=force_nr +serdes_lane_config_channel_mode_404=force_nr +serdes_lane_config_channel_mode_405=force_nr +serdes_lane_config_channel_mode_406=force_nr +serdes_lane_config_channel_mode_407=force_nr +serdes_lane_config_channel_mode_408=force_nr +serdes_lane_config_channel_mode_409=force_nr +serdes_lane_config_channel_mode_410=force_nr +serdes_lane_config_channel_mode_411=force_nr +serdes_lane_config_channel_mode_412=force_nr +serdes_lane_config_channel_mode_413=force_nr +serdes_lane_config_channel_mode_414=force_nr +serdes_lane_config_channel_mode_415=force_nr +serdes_lane_config_channel_mode_416=force_nr +serdes_lane_config_channel_mode_417=force_nr +serdes_lane_config_channel_mode_418=force_nr +serdes_lane_config_channel_mode_419=force_nr +serdes_lane_config_channel_mode_420=force_nr +serdes_lane_config_channel_mode_421=force_nr +serdes_lane_config_channel_mode_422=force_nr +serdes_lane_config_channel_mode_423=force_nr +serdes_lane_config_channel_mode_424=force_nr +serdes_lane_config_channel_mode_425=force_nr +serdes_lane_config_channel_mode_426=force_nr +serdes_lane_config_channel_mode_427=force_nr +serdes_lane_config_channel_mode_428=force_nr +serdes_lane_config_channel_mode_429=force_nr +serdes_lane_config_channel_mode_430=force_nr +serdes_lane_config_channel_mode_431=force_nr +serdes_lane_config_channel_mode_432=force_nr +serdes_lane_config_channel_mode_433=force_nr +serdes_lane_config_channel_mode_434=force_nr +serdes_lane_config_channel_mode_435=force_nr +serdes_lane_config_channel_mode_436=force_nr +serdes_lane_config_channel_mode_437=force_nr +serdes_lane_config_channel_mode_438=force_nr +serdes_lane_config_channel_mode_439=force_nr +serdes_lane_config_channel_mode_440=force_nr +serdes_lane_config_channel_mode_441=force_nr +serdes_lane_config_channel_mode_442=force_nr +serdes_lane_config_channel_mode_443=force_nr +serdes_lane_config_channel_mode_444=force_nr +serdes_lane_config_channel_mode_445=force_nr +serdes_lane_config_channel_mode_446=force_nr +serdes_lane_config_channel_mode_447=force_nr + + +rif_id_max=24576 +dpp_db_path=/usr/share/bcm/db +sai_recycle_port_lane_base=96 +appl_param_nof_ports_per_modid=64 +udh_exists=1 +modreg IPS_FORCE_LOCAL_OR_FABRIC FORCE_FABRIC=1 +xflow_macsec_secure_chan_to_num_secure_assoc_encrypt=2 +xflow_macsec_secure_chan_to_num_secure_assoc_decrypt=4 +cmic_dma_abort_in_cold_boot=0 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/pg_profile_lookup.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/pg_profile_lookup.ini new file mode 100644 index 000000000000..7eb58931c209 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/pg_profile_lookup.ini @@ -0,0 +1,12 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 100000 300m 1280 2560 110592 0 1280 + 400000 300m 1280 2560 315392 0 1280 + 100000 1000m 1280 2560 225280 0 1280 + 400000 1000m 1280 2560 778240 0 1280 + 100000 2000m 1280 2560 393216 0 1280 + 400000 2000m 1280 2560 1445888 0 1280 + 100000 80000m 1280 2560 1388544 0 1280 + 400000 80000m 1280 2560 5435392 0 1280 + 100000 120000m 1280 2560 2056192 0 1280 + 400000 120000m 1280 2560 8093696 0 1280 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/port_config.ini new file mode 100644 index 000000000000..f1a7fee5ad1f --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/port_config.ini @@ -0,0 +1,21 @@ +# name lanes alias index asic_port_name role speed coreid coreportid numvoq +Ethernet18 72,73,74,75 Ethernet18 19 Eth0-ASIC1 Ext 100000 1 1 8 +Ethernet19 80,81,82,83 Ethernet19 20 Eth1-ASIC1 Ext 100000 1 2 8 +Ethernet20 88,89,90,91 Ethernet20 21 Eth2-ASIC1 Ext 100000 1 3 8 +Ethernet21 96,97,98,99 Ethernet21 22 Eth3-ASIC1 Ext 100000 1 4 8 +Ethernet22 104,105,106,107 Ethernet22 23 Eth4-ASIC1 Ext 100000 1 5 8 +Ethernet23 112,113,114,115 Ethernet23 24 Eth5-ASIC1 Ext 100000 1 6 8 +Ethernet24 120,121,122,123 Ethernet24 25 Eth6-ASIC1 Ext 100000 1 7 8 +Ethernet25 128,129,130,131 Ethernet25 26 Eth7-ASIC1 Ext 100000 1 8 8 +Ethernet26 136,137,138,139 Ethernet26 27 Eth8-ASIC1 Ext 100000 1 9 8 +Ethernet27 64,65,66,67 Ethernet27 28 Eth9-ASIC1 Ext 100000 0 10 8 +Ethernet28 56,57,58,59 Ethernet28 29 Eth10-ASIC1 Ext 100000 0 11 8 +Ethernet29 48,49,50,51 Ethernet29 30 Eth11-ASIC1 Ext 100000 0 12 8 +Ethernet30 40,41,42,43 Ethernet30 31 Eth12-ASIC1 Ext 100000 0 13 8 +Ethernet31 32,33,34,35 Ethernet31 32 Eth13-ASIC1 Ext 100000 0 14 8 +Ethernet32 24,25,26,27 Ethernet32 33 Eth14-ASIC1 Ext 100000 0 15 8 +Ethernet33 16,17,18,19 Ethernet33 34 Eth15-ASIC1 Ext 100000 0 16 8 +Ethernet34 8,9,10,11 Ethernet34 35 Eth16-ASIC1 Ext 100000 0 17 8 +Ethernet35 0,1,2,3 Ethernet35 36 Eth17-ASIC1 Ext 100000 0 18 8 +Ethernet-IB1 115 Ethernet-IB1 38 Rcy1-ASIC1 Inb 10000 0 19 8 +Ethernet-Rec1 116 Ethernet-Rec1 40 Rcy2-ASIC1 Rec 10000 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/qos.json.j2 b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai.profile b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai.profile new file mode 100644 index 000000000000..cebcc2d6ee48 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/jr2cp-nokia-18x100g-4x25g-config.bcm diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai_postinit_cmd.soc b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai_postinit_cmd.soc new file mode 100644 index 000000000000..db5ad5ebb264 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x100G/1/sai_postinit_cmd.soc @@ -0,0 +1,6 @@ +phy set 8 reg=0xd134 data=-8 lane=1 +phy set 8 reg=0xd135 data=132 lane=1 +phy set 8 reg=0xd136 data=-8 lane=1 +phy set 8 reg=0xd137 data=0 lane=1 +phy set 8 reg=0xd138 data=0 lane=1 +phy set 8 reg=0xd133 data=0x1802 lane=1 diff --git a/dockers/docker-database/flush_unused_database b/dockers/docker-database/flush_unused_database index e1f7394d9776..82a87392fdb3 100755 --- a/dockers/docker-database/flush_unused_database +++ b/dockers/docker-database/flush_unused_database @@ -1,5 +1,5 @@ #!/usr/bin/python3 -import swsssdk +from swsscommon import swsscommon import redis import subprocess import time @@ -11,15 +11,15 @@ while(True): break time.sleep(1) -instlists = swsssdk.SonicDBConfig.get_instancelist() +instlists = swsscommon.SonicDBConfig.get_instancelist() for instname, v in instlists.items(): insthost = v['hostname'] instsocket = v['unix_socket_path'] - dblists = swsssdk.SonicDBConfig.get_dblist() + dblists = swsscommon.SonicDBConfig.get_dblist() for dbname in dblists: - dbid = swsssdk.SonicDBConfig.get_dbid(dbname) - dbinst = swsssdk.SonicDBConfig.get_instancename(dbname) + dbid = swsscommon.SonicDBConfig.get_dbid(dbname) + dbinst = swsscommon.SonicDBConfig.get_instancename(dbname) # this DB is on current instance, skip flush if dbinst == instname: diff --git a/dockers/docker-fpm-frr/base_image_files/TS b/dockers/docker-fpm-frr/base_image_files/TS index de1e50b7a306..4ee085282be8 100755 --- a/dockers/docker-fpm-frr/base_image_files/TS +++ b/dockers/docker-fpm-frr/base_image_files/TS @@ -5,6 +5,12 @@ PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`} +if [[ $1 == "TSA" ]]; then + TSA_STATE_UPDATE='{"BGP_DEVICE_GLOBAL":{"STATE":{"tsa_enabled": "true"}}}' +elif [[ $1 == "TSB" ]]; then + TSA_STATE_UPDATE='{"BGP_DEVICE_GLOBAL":{"STATE":{"tsa_enabled": "false"}}}' +fi + # Parse the device specific asic conf file, if it exists ASIC_CONF=/usr/share/sonic/device/$PLATFORM/asic.conf [ -f $ASIC_CONF ] && . $ASIC_CONF @@ -20,10 +26,25 @@ if [[ ($NUM_ASIC -gt 1) ]]; then if [ $sub_role == 'FrontEnd' ] then echo -e "BGP"$asic" : \c" - docker exec -i bgp$asic /usr/bin/$1 + if [[ -n "$TSA_STATE_UPDATE" ]]; then + sonic-cfggen -a "$TSA_STATE_UPDATE" -w -n $NAMESPACE_PREFIX$asic + logger -t $1 -p user.info "BGP$asic: System Mode: Normal -> Maintenance" + echo "BGP$asic: System Mode: Normal -> Maintenance" + else + # If TSC is executed, invoke FRR script to check installed route-maps + docker exec -i bgp$asic /usr/bin/$1 + fi fi asic=$[$asic+1] done else - docker exec -i bgp /usr/bin/$1 + if [[ -n "$TSA_STATE_UPDATE" ]]; then + sonic-cfggen -a "$TSA_STATE_UPDATE" -w + logger -t $1 -p user.info "System Mode: Normal -> Maintenance" + echo "System Mode: Normal -> Maintenance" + else + # If TSC is executed, invoke FRR script to check installed route-maps + docker exec -i bgp /usr/bin/$1 + fi fi + diff --git a/dockers/docker-fpm-frr/base_image_files/TSA b/dockers/docker-fpm-frr/base_image_files/TSA index 6b2ddb264834..8c37525ef0a9 100755 --- a/dockers/docker-fpm-frr/base_image_files/TSA +++ b/dockers/docker-fpm-frr/base_image_files/TSA @@ -1,12 +1,20 @@ #!/bin/bash -# toggle the mux to standby if dualtor and any mux active -if -[[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]] && -[[ $(show mux status | grep active | wc -l) > 0 ]]; -then - logger -t TSA -p user.info "Toggle all mux mode to standby" - sudo config mux mode standby all + +if [[ "$(sonic-cfggen -d -v BGP_DEVICE_GLOBAL.STATE.tsa_enabled)" == "true" ]]; then + echo "System is already in Maintenance" + logger -t TSA -p user.info "System is already in Maintenance" +else + # toggle the mux to standby if dualtor and any mux active + if + [[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]] && + [[ $(show mux status | grep active | wc -l) > 0 ]]; + then + logger -t TSA -p user.info "Toggle all mux mode to standby" + sudo config mux mode standby all + fi + + /usr/bin/TS TSA + echo "Please execute 'config save' to preserve System mode in Maintenance after reboot or config reload" fi -/usr/bin/TS TSA diff --git a/dockers/docker-fpm-frr/base_image_files/TSB b/dockers/docker-fpm-frr/base_image_files/TSB index 3fed7bb644f5..5f8d90160fcb 100755 --- a/dockers/docker-fpm-frr/base_image_files/TSB +++ b/dockers/docker-fpm-frr/base_image_files/TSB @@ -1,10 +1,17 @@ #!/bin/bash -# toggle the mux to auto if dualtor -if [[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]]; -then - logger -t TSB -p user.info "Toggle all mux mode to auto" - sudo config mux mode auto all +if [[ "$(sonic-cfggen -d -v BGP_DEVICE_GLOBAL.STATE.tsa_enabled)" == "false" ]]; then + echo "System is already in Normal mode" + logger -t TSB -p user.info "System is already in Normal mode" +else + # toggle the mux to auto if dualtor + if [[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]]; + then + logger -t TSB -p user.info "Toggle all mux mode to auto" + sudo config mux mode auto all + fi + + /usr/bin/TS TSB + echo "Please execute 'config save' to preserve System mode in Normal state after reboot or config reload" fi -/usr/bin/TS TSB diff --git a/dockers/docker-orchagent/enable_counters.py b/dockers/docker-orchagent/enable_counters.py index c45a931e0553..6054503892d0 100755 --- a/dockers/docker-orchagent/enable_counters.py +++ b/dockers/docker-orchagent/enable_counters.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import time -import swsssdk +from swsscommon import swsscommon # ALPHA defines the size of the window over which we calculate the average value. ALPHA is 2/(N+1) where N is the interval(window size) # In this case we configure the window to be 10s. This way if we have a huge 1s spike in traffic, @@ -23,7 +23,7 @@ def enable_counter_group(db, name): def enable_rates(): # set the default interval for rates - counters_db = swsssdk.SonicV2Connector() + counters_db = swsscommon.SonicV2Connector() counters_db.connect('COUNTERS_DB') counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_SMOOTH_INTERVAL', DEFAULT_SMOOTH_INTERVAL) counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_ALPHA', DEFAULT_ALPHA) @@ -36,7 +36,7 @@ def enable_rates(): def enable_counters(): - db = swsssdk.ConfigDBConnector() + db = swsscommon.ConfigDBConnector() db.connect() default_enabled_counters = ['PORT', 'RIF', 'QUEUE', 'PFCWD', 'PG_WATERMARK', 'PG_DROP', 'QUEUE_WATERMARK', 'BUFFER_POOL_WATERMARK', 'PORT_BUFFER_DROP', 'ACL'] diff --git a/dockers/docker-orchagent/tunnel_packet_handler.py b/dockers/docker-orchagent/tunnel_packet_handler.py index 3d75fdd94a0c..1ba29a542148 100755 --- a/dockers/docker-orchagent/tunnel_packet_handler.py +++ b/dockers/docker-orchagent/tunnel_packet_handler.py @@ -12,7 +12,7 @@ from datetime import datetime from ipaddress import ip_interface -from swsssdk import ConfigDBConnector, SonicV2Connector +from swsscommon.swsscommon import ConfigDBConnector, SonicV2Connector from sonic_py_common import logger as log from pyroute2 import IPRoute diff --git a/dockers/docker-pde/Dockerfile.j2 b/dockers/docker-pde/Dockerfile.j2 index a6e7e62c8647..0ddbfd59ce1e 100644 --- a/dockers/docker-pde/Dockerfile.j2 +++ b/dockers/docker-pde/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ENV PYTHONPATH=/usr/share/sonic/platform @@ -20,8 +20,7 @@ RUN apt-get update && apt-get install -y ipmitool telnet busybox kmod libpcap-de RUN apt-get install -y bzip2 curl ioping openssl bc sysstat # Packages for PDDF - -RUN apt-get install -y python-jsonschema +RUN apt-get install -y python3-jsonschema i2c-tools RUN pip3 install pytest pexpect @@ -89,7 +88,7 @@ COPY ["stress-sfp-i2c.py", "/home/pde"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["syseeprom.py", "/usr/bin/"] COPY ["docker_init.sh", "/usr/bin/"] -COPY ["cancun_files/cancun_4.5.0/*", "cancun_files/cancun_6.6.1/*", "cancun_files/cancun_4.3.0/*", "/usr/lib/cancun/"] +COPY ["cancun_files/cancun_4.6.0/*", "cancun_files/cancun_6.9.1/*", "cancun_files/cancun_4.8.0/*", "/usr/lib/cancun/"] COPY ["syncd_init_common.sh", "/usr/bin/"] ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cch.pkg b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cch.pkg new file mode 100644 index 000000000000..b2813d85f3c2 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cch.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_ceh.pkg b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_ceh.pkg new file mode 100644 index 000000000000..7879d9872192 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_ceh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cfh.pkg b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cfh.pkg new file mode 100644 index 000000000000..4ad399986afe Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cfh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cih.pkg b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cih.pkg new file mode 100644 index 000000000000..5a6f16323fd0 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cih.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cmh.pkg b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cmh.pkg new file mode 100644 index 000000000000..750b92b6355c Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.5.0/bcm56370_a0_cmh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cch.pkg b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cch.pkg new file mode 100644 index 000000000000..f53b5f989962 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cch.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_ceh.pkg b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_ceh.pkg new file mode 100644 index 000000000000..1a2311c0e3fb Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_ceh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cfh.pkg b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cfh.pkg new file mode 100644 index 000000000000..edf124b0a6d0 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cfh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cih.pkg b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cih.pkg new file mode 100644 index 000000000000..6733261fb613 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cih.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cmh.pkg b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cmh.pkg new file mode 100644 index 000000000000..ec6be5d84409 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.6.0/bcm56370_a0_cmh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cch.pkg b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cch.pkg new file mode 100644 index 000000000000..34691d28dc6d Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cch.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_ceh.pkg b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_ceh.pkg new file mode 100644 index 000000000000..4e1c0cf9a7ef Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_ceh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cfh.pkg b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cfh.pkg new file mode 100644 index 000000000000..89b8c64a16ee Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cfh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cih.pkg b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cih.pkg new file mode 100644 index 000000000000..781da77bc063 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cih.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cmh.pkg b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cmh.pkg new file mode 100644 index 000000000000..b625ff1b0506 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.7.0/bcm56770_a0_cmh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cch.pkg b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cch.pkg new file mode 100644 index 000000000000..2be24cc0b502 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cch.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_ceh.pkg b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_ceh.pkg new file mode 100644 index 000000000000..46d16192f19f Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_ceh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cfh.pkg b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cfh.pkg new file mode 100644 index 000000000000..5febf2f7f2a9 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cfh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cih.pkg b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cih.pkg new file mode 100644 index 000000000000..09b9577fe4ee Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cih.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cmh.pkg b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cmh.pkg new file mode 100644 index 000000000000..b037e12f3cba Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_4.8.0/bcm56770_a0_cmh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cch.pkg b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cch.pkg new file mode 100644 index 000000000000..159cfbad5856 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cch.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_ceh.pkg b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_ceh.pkg new file mode 100644 index 000000000000..0f10291d3890 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_ceh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cfh.pkg b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cfh.pkg new file mode 100644 index 000000000000..7f8ac294e5b7 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cfh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cih.pkg b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cih.pkg new file mode 100644 index 000000000000..3361d235bb05 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cih.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cmh.pkg b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cmh.pkg new file mode 100644 index 000000000000..91f36a397224 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.8.0/bcm56870_a0_cmh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cch.pkg b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cch.pkg new file mode 100644 index 000000000000..ac08abeeecf2 Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cch.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_ceh.pkg b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_ceh.pkg new file mode 100644 index 000000000000..a5469025cfad Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_ceh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cfh.pkg b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cfh.pkg new file mode 100644 index 000000000000..9c664c35334e Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cfh.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cih.pkg b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cih.pkg new file mode 100644 index 000000000000..eddb5cc6f64f Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cih.pkg differ diff --git a/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cmh.pkg b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cmh.pkg new file mode 100644 index 000000000000..57f1c5ae40bc Binary files /dev/null and b/dockers/docker-pde/cancun_files/cancun_6.9.1/bcm56870_a0_cmh.pkg differ diff --git a/dockers/docker-pde/docker_init.sh b/dockers/docker-pde/docker_init.sh old mode 100644 new mode 100755 index f8e45e99d98d..4404095ded33 --- a/dockers/docker-pde/docker_init.sh +++ b/dockers/docker-pde/docker_init.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash + set -x start_bcm() @@ -10,6 +11,8 @@ start_bcm() PLATFORM_DIR=/usr/share/sonic/platform HWSKU_DIR=/usr/share/sonic/hwsku +# Default use python3 version +SONIC_PLATFORM_API_PYTHON_VERSION=3 mkdir -p /etc/sai.d/ @@ -20,23 +23,28 @@ fi . /usr/bin/syncd_init_common.sh config_syncd -# If the sonic-platform package is not installed, try to install it -pip show sonic-platform > /dev/null 2>&1 +# If the Python 3 sonic-platform package is not installed, try to install it +python3 -c "import sonic_platform" > /dev/null 2>&1 || pip3 show sonic-platform > /dev/null 2>&1 if [ $? -ne 0 ]; then - SONIC_PLATFORM_WHEEL="/usr/share/sonic/platform/sonic_platform-1.0-py2-none-any.whl" + SONIC_PLATFORM_WHEEL="/usr/share/sonic/platform/sonic_platform-1.0-py3-none-any.whl" echo "sonic-platform package not installed, attempting to install..." if [ -e ${SONIC_PLATFORM_WHEEL} ]; then - pip install ${SONIC_PLATFORM_WHEEL} + pip3 install ${SONIC_PLATFORM_WHEEL} if [ $? -eq 0 ]; then echo "Successfully installed ${SONIC_PLATFORM_WHEEL}" + SONIC_PLATFORM_API_PYTHON_VERSION=3 else echo "Error: Failed to install ${SONIC_PLATFORM_WHEEL}" fi else echo "Error: Unable to locate ${SONIC_PLATFORM_WHEEL}" fi +else + SONIC_PLATFORM_API_PYTHON_VERSION=3 fi start_bcm -exec /usr/bin/supervisord +exec /usr/local/bin/supervisord + + diff --git a/dockers/docker-pde/syncd_init_common.sh b/dockers/docker-pde/syncd_init_common.sh new file mode 100755 index 000000000000..0212f842329a --- /dev/null +++ b/dockers/docker-pde/syncd_init_common.sh @@ -0,0 +1,254 @@ +#!/usr/bin/env bash + +CMD_SYNCD=/usr/bin/syncd + +# dsserve: domain socket server for stdio +CMD_DSSERVE=/usr/bin/dsserve +CMD_DSSERVE_ARGS="$CMD_SYNCD --diag" + +ENABLE_SAITHRIFT=0 + +PLATFORM_DIR=/usr/share/sonic/platform +HWSKU_DIR=/usr/share/sonic/hwsku + +SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) + +if [ -x $CMD_DSSERVE ]; then + CMD=$CMD_DSSERVE + CMD_ARGS=$CMD_DSSERVE_ARGS +else + CMD=$CMD_SYNCD + CMD_ARGS= +fi + +# Use temporary view between init and apply +CMD_ARGS+=" -u" + +case "$(cat /proc/cmdline)" in + *SONIC_BOOT_TYPE=fastfast*) + if [ -e /var/warmboot/warm-starting ]; then + FASTFAST_REBOOT='yes' + fi + ;; + *SONIC_BOOT_TYPE=fast*|*fast-reboot*) + FAST_REBOOT='yes' + ;; + *) + FAST_REBOOT='no' + FASTFAST_REBOOT='no' + ;; +esac + + +function check_warm_boot() +{ + # FIXME: if we want to continue start option approach, then we need to add + # code here to support redis database query. + # SYSTEM_WARM_START=`sonic-db-cli STATE_DB hget "WARM_RESTART_ENABLE_TABLE|system" enable` + # SERVICE_WARM_START=`sonic-db-cli STATE_DB hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` + # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. + # if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then + # WARM_BOOT="true" + # else + WARM_BOOT="false" + # fi +} + + +function set_start_type() +{ + if [ x"$WARM_BOOT" == x"true" ]; then + CMD_ARGS+=" -t warm" + elif [ x"$FAST_REBOOT" == x"yes" ]; then + CMD_ARGS+=" -t fast" + elif [ x"$FASTFAST_REBOOT" == x"yes" ]; then + CMD_ARGS+=" -t fastfast" + fi +} + + +config_syncd_bcm() +{ + PLATFORM_COMMON_DIR=/usr/share/sonic/device/x86_64-broadcom_common + PLT_CONFIG_BCM=$(find $HWSKU_DIR -name '*.bcm') + + if [ ! -z "$PLT_CONFIG_BCM" ]; then + cp -f $HWSKU_DIR/*.config.bcm /tmp + cp -f /etc/sai.d/sai.profile /tmp + CONFIG_BCM=$(find /tmp -name '*.bcm') + SAI_PROFILE=$(find /tmp -name 'sai.profile') + sed -i 's+/usr/share/sonic/hwsku+/tmp+g' $SAI_PROFILE + + #Get first three characters of chip id + readline=$(grep '0x14e4' /proc/linux-kernel-bde) + chip_id=${readline#*0x14e4:0x} + chip_id=${chip_id::3} + COMMON_CONFIG_BCM=$(find $PLATFORM_COMMON_DIR/x86_64-broadcom_${chip_id} -name '*.bcm') + + if [ -f $PLATFORM_COMMON_DIR/x86_64-broadcom_${chip_id}/*.bcm ]; then + for file in $CONFIG_BCM; do + echo "" >> $file + echo "# Start of chip common properties" >> $file + while read line + do + line=$( echo $line | xargs ) + if [ ! -z "$line" ];then + if [ "${line::1}" == '#' ];then + echo $line >> $file + else + sedline=${line%=*} + if grep -q $sedline $file ;then + echo "Keep the config $(grep $sedline $file) in $file" + else + echo $line >> $file + fi + fi + fi + done < $COMMON_CONFIG_BCM + echo "# End of chip common properties" >> $file + done + echo "Merging $PLT_CONFIG_BCM with $COMMON_CONFIG_BCM, merge files stored in $CONFIG_BCM" + fi + #sync the file system + sync + + # copy the final config.bcm and sai.profile to the shared folder for 'show tech' + cp -f /tmp/sai.profile /var/run/sswsyncd/ + cp -f /tmp/*.bcm /var/run/sswsyncd/ + fi + + if [ -f "/tmp/sai.profile" ]; then + CMD_ARGS+=" -p /tmp/sai.profile" + elif [ -f "/etc/sai.d/sai.profile" ]; then + CMD_ARGS+=" -p /etc/sai.d/sai.profile" + else + CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" + fi + + [ -e /dev/linux-bcm-knet ] || mknod /dev/linux-bcm-knet c 122 0 + [ -e /dev/linux-user-bde ] || mknod /dev/linux-user-bde c 126 0 + [ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0 +} + +config_syncd_mlnx() +{ + CMD_ARGS+=" -p /tmp/sai.profile" + + [ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 ) + + # Read MAC address + MAC_ADDRESS="$(sonic-cfggen -d -v DEVICE_METADATA.localhost.mac)" + + # Write MAC address into /tmp/profile file. + cat $HWSKU_DIR/sai.profile > /tmp/sai.profile + echo "DEVICE_MAC_ADDRESS=$MAC_ADDRESS" >> /tmp/sai.profile + echo "SAI_WARM_BOOT_WRITE_FILE=/var/warmboot/" >> /tmp/sai.profile +} + +config_syncd_centec() +{ + CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" + + [ -e /dev/linux_dal ] || mknod /dev/linux_dal c 198 0 + [ -e /dev/net/tun ] || ( mkdir -p /dev/net && mknod /dev/net/tun c 10 200 ) +} + +config_syncd_cavium() +{ + CMD_ARGS+=" -p $HWSKU_DIR/sai.profile -d" + + export XP_ROOT=/usr/bin/ + + # Wait until redis-server starts + until [ $(sonic-db-cli PING | grep -c PONG) -gt 0 ]; do + sleep 1 + done +} + +config_syncd_marvell() +{ + CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" + + [ -e /dev/net/tun ] || ( mkdir -p /dev/net && mknod /dev/net/tun c 10 200 ) +} + +config_syncd_barefoot() +{ + PROFILE_FILE="$HWSKU_DIR/sai.profile" + if [ ! -f $PROFILE_FILE ]; then + # default profile file + PROFILE_FILE="/tmp/sai.profile" + echo "SAI_KEY_WARM_BOOT_WRITE_FILE=/var/warmboot/sai-warmboot.bin" > $PROFILE_FILE + echo "SAI_KEY_WARM_BOOT_READ_FILE=/var/warmboot/sai-warmboot.bin" >> $PROFILE_FILE + fi + CMD_ARGS+=" -p $PROFILE_FILE" + + # Check and load SDE profile + P4_PROFILE=$(sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["p4_profile"]') + if [[ -n "$P4_PROFILE" ]]; then + if [[ ( -d /opt/bfn/install_${P4_PROFILE} ) && ( -L /opt/bfn/install || ! -e /opt/bfn/install ) ]]; then + ln -srfn /opt/bfn/install_${P4_PROFILE} /opt/bfn/install + fi + fi + export PYTHONHOME=/opt/bfn/install/ + export PYTHONPATH=/opt/bfn/install/ + export ONIE_PLATFORM=`grep onie_platform /etc/machine.conf | awk 'BEGIN { FS = "=" } ; { print $2 }'` + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/bfn/install/lib/platform/$ONIE_PLATFORM:/opt/bfn/install/lib:/opt/bfn/install/lib/tofinopd/switch + ./opt/bfn/install/bin/dma_setup.sh +} + +config_syncd_nephos() +{ + CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" +} + +config_syncd_vs() +{ + CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" +} + +config_syncd_innovium() +{ + CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" + ulimit -s 65536 + export II_ROOT="/var/log/invm" + export II_APPEND_LOG=1 + mkdir -p $II_ROOT +} + +config_syncd() +{ + check_warm_boot + + if [ "$SONIC_ASIC_TYPE" == "broadcom" ]; then + config_syncd_bcm + elif [ "$SONIC_ASIC_TYPE" == "mellanox" ]; then + config_syncd_mlnx + elif [ "$SONIC_ASIC_TYPE" == "cavium" ]; then + config_syncd_cavium + elif [ "$SONIC_ASIC_TYPE" == "centec" ]; then + config_syncd_centec + elif [ "$SONIC_ASIC_TYPE" == "marvell" ]; then + config_syncd_marvell + elif [ "$SONIC_ASIC_TYPE" == "barefoot" ]; then + config_syncd_barefoot + elif [ "$SONIC_ASIC_TYPE" == "nephos" ]; then + config_syncd_nephos + elif [ "$SONIC_ASIC_TYPE" == "vs" ]; then + config_syncd_vs + elif [ "$SONIC_ASIC_TYPE" == "innovium" ]; then + config_syncd_innovium + else + echo "Unknown ASIC type $SONIC_ASIC_TYPE" + exit 1 + fi + + set_start_type + + if [ ${ENABLE_SAITHRIFT} == 1 ]; then + CMD_ARGS+=" -r -m $HWSKU_DIR/port_config.ini" + fi + + [ -r $PLATFORM_DIR/syncd.conf ] && . $PLATFORM_DIR/syncd.conf +} + diff --git a/dockers/docker-sflow/port_index_mapper.py b/dockers/docker-sflow/port_index_mapper.py index 3ee73181a5b4..ee9dba15a407 100755 --- a/dockers/docker-sflow/port_index_mapper.py +++ b/dockers/docker-sflow/port_index_mapper.py @@ -5,7 +5,7 @@ import traceback from sonic_py_common.logger import Logger from socket import if_nametoindex -from swsssdk import SonicV2Connector, port_util +from sonic_py_common import port_util from swsscommon import swsscommon SYSLOG_IDENTIFIER = 'port_index_mapper' @@ -26,7 +26,7 @@ def __init__(self): REDIS_TIMEOUT_MS, True) - self.state_db = SonicV2Connector(host='127.0.0.1', decode_responses=True) + self.state_db = swsscommon.SonicV2Connector(host='127.0.0.1', decode_responses=True) self.state_db.connect(self.state_db.STATE_DB, False) self.sel = swsscommon.Select() self.tbls = [swsscommon.SubscriberStateTable(self.appl_db, t) diff --git a/dockers/docker-snmp/snmp_yml_to_configdb.py b/dockers/docker-snmp/snmp_yml_to_configdb.py index 7d4289926240..3b031d4a27f0 100755 --- a/dockers/docker-snmp/snmp_yml_to_configdb.py +++ b/dockers/docker-snmp/snmp_yml_to_configdb.py @@ -5,7 +5,7 @@ import yaml from sonic_py_common.logger import Logger -from swsssdk import ConfigDBConnector +from swsscommon.swsscommon import ConfigDBConnector db = ConfigDBConnector() db.connect() diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 99ad9fa8fb80..06267ccaf6a3 100755 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -43,7 +43,7 @@ RUN pip install cffi==1.10.0 \ ipython==5.4.1 \ ixnetwork-restpy==1.0.64 \ ixnetwork-open-traffic-generator==0.0.79 \ - snappi[ixnetwork,convergence]==0.5.11 \ + snappi[ixnetwork,convergence]==0.7.44 \ jinja2==2.7.2 \ jsonpatch \ lxml \ @@ -71,7 +71,7 @@ RUN pip install cffi==1.10.0 \ six \ tabulate \ statistics \ - textfsm \ + textfsm==1.1.2 \ virtualenv \ retry \ thrift==0.11.0 \ @@ -207,7 +207,7 @@ RUN python3 -m pip install setuptools-rust \ ipython==5.4.1 \ ixnetwork-restpy==1.0.64 \ ixnetwork-open-traffic-generator==0.0.79 \ - snappi[ixnetwork,convergence]==0.5.11 \ + snappi[ixnetwork,convergence]==0.7.44 \ jinja2==2.7.2 \ jsonpatch \ lxml \ @@ -233,7 +233,7 @@ RUN python3 -m pip install setuptools-rust \ rpyc \ six \ tabulate \ - textfsm \ + textfsm==1.1.2 \ virtualenv \ wheel==0.33.6 \ pysubnettree \ diff --git a/files/build_templates/backend_acl.j2 b/files/build_templates/backend_acl.j2 new file mode 100644 index 000000000000..f5468e6c12cb --- /dev/null +++ b/files/build_templates/backend_acl.j2 @@ -0,0 +1,51 @@ +{%- set vlan2ports = {} %} +{%- for vlan in VLAN %} + {% set portlist = [] %} + {%- for vlan_name, port in VLAN_MEMBER %} + {%- if vlan_name == vlan %} + {%- if portlist.append(port) %}{%- endif %} + {%- endif %} + {%- endfor %} + {%- set _ = vlan2ports.update({vlan: portlist| sort | join(',')}) %} +{%- endfor %} + + +{ + "acl": { + "acl-sets": { + "acl-set": { + "DATAACL": { + "acl-entries": { + "acl-entry": { + {% for vlan, vlan_entries in VLAN.items() %} + "{{ loop.index }}": { + "config": { + "sequence-id": {{ loop.index }} + }, + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "l2": { + "config": { + "vlan_id": "{{ vlan_entries['vlanid'] }}" + } + }, + "input_interface": { + "interface_ref": { + "config": { + "interface": "{{ vlan2ports[vlan] }}" + } + } + } + + }{% if not loop.last %},{% endif %} + {% endfor -%} + } + } + } + } + } + } +} diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index e752c4721abe..8e92807f4e2c 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -27,6 +27,11 @@ "POLL_INTERVAL": "10000" } }, + "BGP_DEVICE_GLOBAL": { + "STATE": { + "tsa_enabled": "false" + } + }, {%- set features = [("bgp", "enabled", false, "enabled"), ("database", "always_enabled", false, "always_enabled"), ("lldp", "enabled", true, "enabled"), diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 46cebb6e32d1..b2a7b9c63f51 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -47,6 +47,7 @@ {%- set backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter'] -%} {%- set apollo_resource_types = ['DL-NPU-Apollo'] -%} +{%- set require_global_dscp_to_tc_map = true -%} { {% if (generate_tc_to_pg_map is defined) and tunnel_qos_remap_enable %} @@ -94,6 +95,7 @@ }, {% endif %} {% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types and 'storage_device' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['storage_device'] == 'true' %} +{%- set require_global_dscp_to_tc_map = false %} "DOT1P_TO_TC_MAP": { "AZURE": { "0": "1", @@ -219,7 +221,7 @@ "PORT_QOS_MAP": { {% if generate_global_dscp_to_tc_map is defined %} {{- generate_global_dscp_to_tc_map() }} -{% else %} +{% elif require_global_dscp_to_tc_map %} "global": { "dscp_to_tc_map" : "AZURE" }{% if PORT_ACTIVE %},{% endif %} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 35187312b79d..fb417c29dc66 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -297,7 +297,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libnss-radius_*.deb || \ sudo sed -i -e '/^passwd/s/ radius//' $FILESYSTEM_ROOT/etc/nsswitch.conf # Install a custom version of kdump-tools (and its dependencies via 'apt-get -y install -f') -if [[ $CONFIGURED_ARCH == amd64 ]]; then +if [[ $TARGET_BOOTLOADER == grub ]]; then sudo DEBIAN_FRONTEND=noninteractive dpkg --root=$FILESYSTEM_ROOT -i $debs_path/kdump-tools_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true chroot $FILESYSTEM_ROOT apt-get -q --no-install-suggests --no-install-recommends install cat $IMAGE_CONFIGS/kdump/kdump-tools | sudo tee -a $FILESYSTEM_ROOT/etc/default/kdump-tools > /dev/null @@ -427,6 +427,18 @@ sudo chmod og-rw $FILESYSTEM_ROOT_ETC_SONIC/core_analyzer.rc.json sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libffi-dev libssl-dev +{% if include_bootchart == 'y' %} +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install systemd-bootchart +sudo tee $FILESYSTEM_ROOT_ETC/systemd/bootchart.conf > /dev/null < /dev/null) + grub_bin=$(ls /host/image-$SONIC_VERSION/platform/grub/grub*.deb 2> /dev/null) if [ -z "$grub_bin" ]; then log_migration "Unable to locate grub package !" firsttime_exit diff --git a/installer/armhf/install.sh b/installer/armhf/install.sh deleted file mode 100755 index 4ced27f48fa6..000000000000 --- a/installer/armhf/install.sh +++ /dev/null @@ -1,197 +0,0 @@ -#!/bin/sh - -# Copyright (C) Marvell Inc -# - -_trap_push() { - local next="$1" - eval "trap_push() { - local oldcmd='$(echo "$next" | sed -e s/\'/\'\\\\\'\'/g)' - local newcmd=\"\$1; \$oldcmd\" - trap -- \"\$newcmd\" EXIT INT TERM HUP - _trap_push \"\$newcmd\" - }" -} -_trap_push true - -set -e - -if [ -d "/etc/sonic" ]; then - echo "Installing SONiC in SONiC" - install_env="sonic" -elif grep -Fxqs "DISTRIB_ID=onie" /etc/lsb-release > /dev/null -then - echo "Installing SONiC in ONIE" - install_env="onie" -else - echo "Installing SONiC in BUILD" - install_env="build" -fi - -cd $(dirname $0) -if [ -r ./machine.conf ]; then - . ./machine.conf -fi - -if [ -r ./onie-image-armhf.conf ]; then - . ./onie-image-armhf.conf -fi - -echo "ONIE Installer: platform: $platform" - -# Make sure run as root or under 'sudo' -if [ $(id -u) -ne 0 ] - then echo "Please run as root" - exit 1 -fi - -if [ -r /etc/machine.conf ]; then - . /etc/machine.conf -elif [ -r /host/machine.conf ]; then - . /host/machine.conf -elif [ "$install_env" != "build" ]; then - echo "cannot find machine.conf" - exit 1 -fi - -echo "onie_platform: $onie_platform" - -# Get platform specific linux kernel command line arguments -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" - -# Default var/log device size in MB -VAR_LOG_SIZE=4096 - -[ -r platforms/$onie_platform ] && . platforms/$onie_platform - -# Verify image platform is inside devices list -if [ "$install_env" = "onie" ]; then - if ! grep -Fxq "$onie_platform" platforms_asic; then - echo "The image you're trying to install is of a different ASIC type as the running platform's ASIC" - while true; do - read -r -p "Do you still wish to install this image? [y/n]: " input - case $input in - [Yy]) - echo "Force installing..." - break - ;; - [Nn]) - echo "Exited installation!" - exit 1 - ;; - *) - echo "Error: Invalid input" - ;; - esac - done - fi -fi - -# If running in ONIE -if [ "$install_env" = "onie" ]; then - # The onie bin tool prefix - onie_bin= - # The persistent ONIE directory location - onie_root_dir=/mnt/onie-boot/onie - # The onie file system root - onie_initrd_tmp=/ -fi - -# The build system prepares this script by replacing %%DEMO-TYPE%% -# with "OS" or "DIAG". -demo_type="%%DEMO_TYPE%%" - -# The build system prepares this script by replacing %%IMAGE_VERSION%% -# with git revision hash as a version identifier -image_version="%%IMAGE_VERSION%%" -timestamp="$(date -u +%Y%m%d)" - -demo_volume_label="SONiC-${demo_type}" -demo_volume_revision_label="SONiC-${demo_type}-${image_version}" - - -. ./platform.conf - -image_dir="image-$image_version" - -if [ "$install_env" = "onie" ]; then - # Create/format the flash - create_partition - mount_partition -elif [ "$install_env" = "sonic" ]; then - demo_mnt="/host" - # Get current SONiC image (grub/aboot/uboot) - eval running_sonic_revision="$(cat /proc/cmdline | sed -n 's/^.*loop=\/*image-\(\S\+\)\/.*$/\1/p')" - # Verify SONiC image exists - if [ ! -d "$demo_mnt/image-$running_sonic_revision" ]; then - echo "ERROR: SONiC installation is corrupted: path $demo_mnt/image-$running_sonic_revision doesn't exist" - exit 1 - fi - # Prevent installing existing SONiC if it is running - if [ "$image_dir" = "image-$running_sonic_revision" ]; then - echo "Not installing SONiC version $running_sonic_revision, as current running SONiC has the same version" - exit 0 - fi - # Remove extra SONiC images if any - for f in $demo_mnt/image-* ; do - if [ -d $f ] && [ "$f" != "$demo_mnt/image-$running_sonic_revision" ] && [ "$f" != "$demo_mnt/$image_dir" ]; then - echo "Removing old SONiC installation $f" - rm -rf $f - fi - done -fi - -# Create target directory or clean it up if exists -if [ -d $demo_mnt/$image_dir ]; then - echo "Directory $demo_mnt/$image_dir/ already exists. Cleaning up..." - rm -rf $demo_mnt/$image_dir/* -else - mkdir $demo_mnt/$image_dir || { - echo "Error: Unable to create SONiC directory" - exit 1 - } -fi - -# Decompress the file for the file system directly to the partition -if [ x"$docker_inram" = x"on" ]; then - # when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd - unzip -o $ONIE_INSTALLER_PAYLOAD -x "platform.tar.gz" -d $demo_mnt/$image_dir -else - unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" "platform.tar.gz" -d $demo_mnt/$image_dir - - if [ "$install_env" = "onie" ]; then - TAR_EXTRA_OPTION="--numeric-owner" - else - TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" - fi - mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR - unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR -fi - -mkdir -p $demo_mnt/$image_dir/platform -unzip -op $ONIE_INSTALLER_PAYLOAD "platform.tar.gz" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/platform - -if [ "$install_env" = "onie" ]; then - # Store machine description in target file system - if [ -f /etc/machine-build.conf ]; then - # onie_ variable are generate at runtime. - # they are no longer hardcoded in /etc/machine.conf - # also remove single quotes around the value - set | grep ^onie | sed -e "s/='/=/" -e "s/'$//" > $demo_mnt/machine.conf - else - cp /etc/machine.conf $demo_mnt - fi -fi - -extra_cmdline_linux=%%EXTRA_CMDLINE_LINUX%% -echo "EXTRA_CMDLINE_LINUX=$extra_cmdline_linux" - -# Update Bootloader Menu with installed image -bootloader_menu_config - -# Set NOS mode if available. For manufacturing diag installers, you -# probably want to skip this step so that the system remains in ONIE -# "installer" mode for installing a true NOS later. -if [ -x /bin/onie-nos-mode ] ; then - /bin/onie-nos-mode -s -fi diff --git a/installer/x86_64/install.sh b/installer/default_platform.conf similarity index 54% rename from installer/x86_64/install.sh rename to installer/default_platform.conf index 926c54683a9e..af3fa8fc2235 100755 --- a/installer/x86_64/install.sh +++ b/installer/default_platform.conf @@ -1,119 +1,5 @@ #!/bin/sh -# Copyright (C) 2014-2015 Curt Brune -# Copyright (C) 2014-2015 david_yang -# -# SPDX-License-Identifier: GPL-2.0 - -# Appends a command to a trap, which is needed because default trap behavior is to replace -# previous trap for the same signal -# - 1st arg: code to add -# - ref: http://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal -_trap_push() { - local next="$1" - eval "trap_push() { - local oldcmd='$(echo "$next" | sed -e s/\'/\'\\\\\'\'/g)' - local newcmd=\"\$1; \$oldcmd\" - trap -- \"\$newcmd\" EXIT INT TERM HUP - _trap_push \"\$newcmd\" - }" -} -_trap_push true - -read_conf_file() { - local conf_file=$1 - while IFS='=' read -r var value || [ -n "$var" ] - do - # remove newline character - var=$(echo $var | tr -d '\r\n') - value=$(echo $value | tr -d '\r\n') - # remove comment string - var=${var%#*} - value=${value%#*} - # skip blank line - [ -z "$var" ] && continue - # remove double quote in the beginning - tmp_val=${value#\"} - # remove double quote in the end - value=${tmp_val%\"} - eval "$var=\"$value\"" - done < "$conf_file" -} - -# Main -set -e -cd $(dirname $0) - -if [ -d "/etc/sonic" ]; then - echo "Installing SONiC in SONiC" - install_env="sonic" -elif grep -Fxqs "DISTRIB_ID=onie" /etc/lsb-release > /dev/null -then - echo "Installing SONiC in ONIE" - install_env="onie" -else - echo "Installing SONiC in BUILD" - install_env="build" -fi - -if [ -r ./machine.conf ]; then - read_conf_file "./machine.conf" -fi - -if [ -r ./onie-image.conf ]; then -. ./onie-image.conf -fi - -echo "ONIE Installer: platform: $platform" - -# Make sure run as root or under 'sudo' -if [ $(id -u) -ne 0 ] - then echo "Please run as root" - exit 1 -fi - -# get running machine from conf file -if [ -r /etc/machine.conf ]; then - read_conf_file "/etc/machine.conf" -elif [ -r /host/machine.conf ]; then - read_conf_file "/host/machine.conf" -elif [ "$install_env" != "build" ]; then - echo "cannot find machine.conf" - exit 1 -fi - -echo "onie_platform: $onie_platform" - -# Get platform specific linux kernel command line arguments -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" - -# Default var/log device size in MB -VAR_LOG_SIZE=4096 - -[ -r platforms/$onie_platform ] && . platforms/$onie_platform - -# Verify image platform is inside devices list -if [ "$install_env" = "onie" ]; then - if ! grep -Fxq "$onie_platform" platforms_asic; then - echo "The image you're trying to install is of a different ASIC type as the running platform's ASIC" - while true; do - read -r -p "Do you still wish to install this image? [y/n]: " input - case $input in - [Yy]) - echo "Force installing..." - break - ;; - [Nn]) - echo "Exited installation!" - exit 1 - ;; - *) - echo "Error: Invalid input" - ;; - esac - done - fi -fi # Pick up console port and speed from install enviroment if not defined yet. # Console port and speed setting in cmdline is like "console=ttyS0,9600n", @@ -145,69 +31,75 @@ if [ -z "$CONSOLE_SPEED" ]; then fi fi -# Install demo on same block device as ONIE -if [ "$install_env" != "build" ]; then - onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') - blk_dev=$(echo $onie_dev | sed -e 's/[1-9][0-9]*$//' | sed -e 's/\([0-9]\)\(p\)/\1/') +create_partition() +{ - # check if we have an nvme device - blk_suffix= - echo $blk_dev | grep -q nvme0 && blk_suffix="p" + # Install demo on same block device as ONIE + if [ "$install_env" != "build" ]; then + onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') + blk_dev=$(echo $onie_dev | sed -e 's/[1-9][0-9]*$//' | sed -e 's/\([0-9]\)\(p\)/\1/') - # Note: ONIE has no mount setting for / with device node, so below will be empty string - cur_part=$(cat /proc/mounts | awk "{ if(\$2==\"/\") print \$1 }" | grep $blk_dev || true) + # check if we have an nvme device + blk_suffix= + echo $blk_dev | grep -q nvme0 && blk_suffix="p" - [ -b "$blk_dev" ] || { - echo "Error: Unable to determine block device of ONIE install" - exit 1 - } -fi + # Note: ONIE has no mount setting for / with device node, so below will be empty string -# If running in ONIE -if [ "$install_env" = "onie" ]; then - # The onie bin tool prefix - onie_bin= - # The persistent ONIE directory location - onie_root_dir=/mnt/onie-boot/onie - # The onie file system root - onie_initrd_tmp=/ -fi + cur_part=$(cat /proc/mounts | awk "{ if(\$2==\"/\") print \$1 }" | grep $blk_dev || true) + + [ -b "$blk_dev" ] || { + echo "Error: Unable to determine block device of ONIE install" + exit 1 + } + fi + + # auto-detect whether BIOS or UEFI + if [ -d "/sys/firmware/efi/efivars" ] ; then + firmware="uefi" + else + firmware="bios" + fi + + if [ "$install_env" = "onie" ]; then + # determine ONIE partition type + onie_partition_type=$(${onie_bin} onie-sysinfo -t) + # demo partition size in MB + demo_part_size="%%ONIE_IMAGE_PART_SIZE%%" + if [ "$firmware" = "uefi" ] ; then + create_demo_uefi_partition $blk_dev + elif [ "$onie_partition_type" = "gpt" ] ; then + create_demo_gpt_partition $blk_dev + elif [ "$onie_partition_type" = "msdos" ] ; then + create_demo_msdos_partition $blk_dev + else + echo "ERROR: Unsupported partition type: $onie_partition_type" + exit 1 + fi + fi -# The build system prepares this script by replacing %%DEMO-TYPE%% -# with "OS" or "DIAG". -demo_type="%%DEMO_TYPE%%" +} -# The build system prepares this script by replacing %%IMAGE_VERSION%% -# with git revision hash as a version identifier -image_version="%%IMAGE_VERSION%%" -timestamp="$(date -u +%Y%m%d)" +mount_partition() +{ -demo_volume_label="SONiC-${demo_type}" -demo_volume_revision_label="SONiC-${demo_type}-${image_version}" + demo_dev=$(echo $blk_dev | sed -e 's/\(mmcblk[0-9]\)/\1p/')$demo_part + echo $blk_dev | grep -q nvme0 && demo_dev=$(echo $blk_dev | sed -e 's/\(nvme[0-9]n[0-9]\)/\1p/')$demo_part -# auto-detect whether BIOS or UEFI -if [ -d "/sys/firmware/efi/efivars" ] ; then - firmware="uefi" -else - firmware="bios" -fi + # Make filesystem + mkfs.ext4 -L $demo_volume_label $demo_dev -if [ "$install_env" = "onie" ]; then - # determine ONIE partition type - onie_partition_type=$(${onie_bin} onie-sysinfo -t) - # demo partition size in MB - demo_part_size="%%ONIE_IMAGE_PART_SIZE%%" - if [ "$firmware" = "uefi" ] ; then - create_demo_partition="create_demo_uefi_partition" - elif [ "$onie_partition_type" = "gpt" ] ; then - create_demo_partition="create_demo_gpt_partition" - elif [ "$onie_partition_type" = "msdos" ] ; then - create_demo_partition="create_demo_msdos_partition" - else - echo "ERROR: Unsupported partition type: $onie_partition_type" + # Mount demo filesystem + demo_mnt=$(${onie_bin} mktemp -d) || { + echo "Error: Unable to create file system mount point" exit 1 - fi -fi + } + trap_push "${onie_bin} fuser -km $demo_mnt || ${onie_bin} umount $demo_mnt || ${onie_bin} rmdir $demo_mnt || true" + ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || { + echo "Error: Unable to mount $demo_dev on $demo_mnt" + exit 1 + } + +} # Creates a new partition for the DEMO OS. # @@ -457,161 +349,71 @@ demo_install_uefi_grub() # Configure EFI NVRAM Boot variables. --create also sets the # new boot number as active. + grub=$(find /boot/efi/EFI/$demo_volume_label/ -name grub*.efi -exec basename {} \;) efibootmgr --quiet --create \ --label "$demo_volume_label" \ --disk $blk_dev --part $uefi_part \ - --loader "/EFI/$demo_volume_label/grubx64.efi" || { + --loader "/EFI/$demo_volume_label/$grub" || { echo "ERROR: efibootmgr failed to create new boot variable on: $blk_dev" exit 1 } } -image_dir="image-$image_version" -if [ "$install_env" = "onie" ]; then - eval $create_demo_partition $blk_dev - demo_dev=$(echo $blk_dev | sed -e 's/\(mmcblk[0-9]\)/\1p/')$demo_part - echo $blk_dev | grep -q nvme0 && demo_dev=$(echo $blk_dev | sed -e 's/\(nvme[0-9]n[0-9]\)/\1p/')$demo_part - - # Make filesystem - mkfs.ext4 -L $demo_volume_label $demo_dev - - # Mount demo filesystem - demo_mnt=$(${onie_bin} mktemp -d) || { - echo "Error: Unable to create file system mount point" - exit 1 - } - trap_push "${onie_bin} fuser -km $demo_mnt || ${onie_bin} umount $demo_mnt || ${onie_bin} rmdir $demo_mnt || true" - ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || { - echo "Error: Unable to mount $demo_dev on $demo_mnt" - exit 1 - } - -elif [ "$install_env" = "sonic" ]; then - demo_mnt="/host" - # Get current SONiC image (grub/aboot/uboot) - eval running_sonic_revision="$(cat /proc/cmdline | sed -n 's/^.*loop=\/*image-\(\S\+\)\/.*$/\1/p')" - # Verify SONiC image exists - if [ ! -d "$demo_mnt/image-$running_sonic_revision" ]; then - echo "ERROR: SONiC installation is corrupted: path $demo_mnt/image-$running_sonic_revision doesn't exist" - exit 1 - fi - # Prevent installing existing SONiC if it is running - if [ "$image_dir" = "image-$running_sonic_revision" ]; then - echo "Not installing SONiC version $running_sonic_revision, as current running SONiC has the same version" - exit 0 - fi - # Remove extra SONiC images if any - for f in $demo_mnt/image-* ; do - if [ -d $f ] && [ "$f" != "$demo_mnt/image-$running_sonic_revision" ] && [ "$f" != "$demo_mnt/$image_dir" ]; then - echo "Removing old SONiC installation $f" - rm -rf $f - fi - done -else - demo_mnt="build_raw_image_mnt" - demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" - - mkfs.ext4 -L $demo_volume_label $demo_dev - - echo "Mounting $demo_dev on $demo_mnt..." - mkdir $demo_mnt - mount -t auto -o loop $demo_dev $demo_mnt -fi - -echo "Installing SONiC to $demo_mnt/$image_dir" - -# Create target directory or clean it up if exists -if [ -d $demo_mnt/$image_dir ]; then - echo "Directory $demo_mnt/$image_dir/ already exists. Cleaning up..." - rm -rf $demo_mnt/$image_dir/* -else - mkdir $demo_mnt/$image_dir || { - echo "Error: Unable to create SONiC directory" - exit 1 - } -fi - -# Decompress the file for the file system directly to the partition -if [ x"$docker_inram" = x"on" ]; then - # when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd - unzip -o $ONIE_INSTALLER_PAYLOAD -x "platform.tar.gz" -d $demo_mnt/$image_dir -else - unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" "platform.tar.gz" -d $demo_mnt/$image_dir +bootloader_menu_config() +{ if [ "$install_env" = "onie" ]; then - TAR_EXTRA_OPTION="--numeric-owner" - else - TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" - fi - mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR - unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR -fi - -mkdir -p $demo_mnt/$image_dir/platform -unzip -op $ONIE_INSTALLER_PAYLOAD "platform.tar.gz" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/platform - -if [ "$install_env" = "onie" ]; then - # Store machine description in target file system - if [ -f /etc/machine-build.conf ]; then - # onie_ variable are generate at runtime. - # they are no longer hardcoded in /etc/machine.conf - # also remove single quotes around the value - set | grep ^onie | sed -e "s/='/=/" -e "s/'$//" > $demo_mnt/machine.conf - else - cp /etc/machine.conf $demo_mnt - fi + # Store installation log in target file system + rm -f $onie_initrd_tmp/tmp/onie-support*.tar.bz2 + ${onie_bin} onie-support /tmp + mv $onie_initrd_tmp/tmp/onie-support*.tar.bz2 $demo_mnt/$image_dir/ - # Store installation log in target file system - rm -f $onie_initrd_tmp/tmp/onie-support*.tar.bz2 - ${onie_bin} onie-support /tmp - mv $onie_initrd_tmp/tmp/onie-support*.tar.bz2 $demo_mnt/$image_dir/ - - if [ "$firmware" = "uefi" ] ; then + if [ "$firmware" = "uefi" ] ; then demo_install_uefi_grub "$demo_mnt" "$blk_dev" - else + else demo_install_grub "$demo_mnt" "$blk_dev" + fi fi -fi -# Create a minimal grub.cfg that allows for: -# - configure the serial console -# - allows for grub-reboot to work -# - a menu entry for the DEMO OS -# - menu entries for ONIE - -grub_cfg=$(mktemp) -trap_push "rm $grub_cfg || true" - -# Set a few GRUB_xxx environment variables that will be picked up and -# used by the 50_onie_grub script. This is similiar to what an OS -# would specify in /etc/default/grub. -# -# GRUB_SERIAL_COMMAND -# GRUB_CMDLINE_LINUX - -[ -r ./platform.conf ] && . ./platform.conf - -# Check if the CPU vendor is 'Intel' and disable c-states if True -CPUVENDOR="$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}')" -echo "Switch CPU vendor is: $CPUVENDOR" -if echo "$CPUVENDOR" | grep -i 'Intel' >/dev/null 2>&1; then - echo "Switch CPU cstates are: disabled" - CSTATES="intel_idle.max_cstate=0" -else - CSTATES="" -fi + # Create a minimal grub.cfg that allows for: + # - configure the serial console + # - allows for grub-reboot to work + # - a menu entry for the DEMO OS + # - menu entries for ONIE + + grub_cfg=$(mktemp) + trap_push "rm $grub_cfg || true" + + # Set a few GRUB_xxx environment variables that will be picked up and + # used by the 50_onie_grub script. This is similiar to what an OS + # would specify in /etc/default/grub. + # + # GRUB_SERIAL_COMMAND + # GRUB_CMDLINE_LINUX + + [ -r ./platform.conf ] && . ./platform.conf + + # Check if the CPU vendor is 'Intel' and disable c-states if True + CPUVENDOR="$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}')" + echo "Switch CPU vendor is: $CPUVENDOR" + if echo "$CPUVENDOR" | grep -i 'Intel' >/dev/null 2>&1; then + echo "Switch CPU cstates are: disabled" + CSTATES="intel_idle.max_cstate=0" + else + CSTATES="" + fi -DEFAULT_GRUB_SERIAL_COMMAND="serial --port=${CONSOLE_PORT} --speed=${CONSOLE_SPEED} --word=8 --parity=no --stop=1" -DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS${CONSOLE_DEV},${CONSOLE_SPEED}n8 quiet $CSTATES" -GRUB_SERIAL_COMMAND=${GRUB_SERIAL_COMMAND:-"$DEFAULT_GRUB_SERIAL_COMMAND"} -GRUB_CMDLINE_LINUX=${GRUB_CMDLINE_LINUX:-"$DEFAULT_GRUB_CMDLINE_LINUX"} -export GRUB_SERIAL_COMMAND -export GRUB_CMDLINE_LINUX + DEFAULT_GRUB_SERIAL_COMMAND="serial --port=${CONSOLE_PORT} --speed=${CONSOLE_SPEED} --word=8 --parity=no --stop=1" + DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS${CONSOLE_DEV},${CONSOLE_SPEED}n8 quiet $CSTATES" + GRUB_SERIAL_COMMAND=${GRUB_SERIAL_COMMAND:-"$DEFAULT_GRUB_SERIAL_COMMAND"} + GRUB_CMDLINE_LINUX=${GRUB_CMDLINE_LINUX:-"$DEFAULT_GRUB_CMDLINE_LINUX"} + export GRUB_SERIAL_COMMAND + export GRUB_CMDLINE_LINUX -# Add common configuration, like the timeout and serial console. -cat < $grub_cfg + # Add common configuration, like the timeout and serial console. + cat < $grub_cfg $GRUB_SERIAL_COMMAND terminal_input console serial terminal_output console serial @@ -620,8 +422,8 @@ set timeout=5 EOF -# Add the logic to support grub-reboot and grub-set-default -cat <> $grub_cfg + # Add the logic to support grub-reboot and grub-set-default + cat <> $grub_cfg if [ -s \$prefix/grubenv ]; then load_env fi @@ -639,35 +441,34 @@ if [ "\${onie_entry}" ]; then unset onie_entry save_env onie_entry next_entry fi - EOF -if [ "$demo_type" = "DIAG" ] ; then - # Make sure ONIE install mode is the default boot mode for the - # diag partition. - cat <> $grub_cfg + if [ "$demo_type" = "DIAG" ] ; then + # Make sure ONIE install mode is the default boot mode for the + # diag partition. + cat <> $grub_cfg set default=ONIE EOF - $onie_root_dir/tools/bin/onie-boot-mode -q -o install -fi + $onie_root_dir/tools/bin/onie-boot-mode -q -o install + fi -# Add a menu entry for the SONiC OS -# Note: assume that apparmor is supported in the kernel -demo_grub_entry="$demo_volume_revision_label" -if [ "$install_env" = "sonic" ]; then - old_sonic_menuentry=$(cat /host/grub/grub.cfg | sed "/^menuentry '${demo_volume_label}-${running_sonic_revision}'/,/}/!d") - grub_cfg_root=$(echo $old_sonic_menuentry | sed -e "s/.*root\=\(.*\)rw.*/\1/") - onie_menuentry=$(cat /host/grub/grub.cfg | sed "/menuentry ONIE/,/}/!d") -elif [ "$install_env" = "build" ]; then - grub_cfg_root=%%SONIC_ROOT%% -else # install_env = "onie" - uuid=$(blkid "$demo_dev" | sed -ne 's/.* UUID=\"\([^"]*\)\".*/\1/p') - if [ -z "$uuid" ]; then + # Add a menu entry for the SONiC OS + # Note: assume that apparmor is supported in the kernel + demo_grub_entry="$demo_volume_revision_label" + if [ "$install_env" = "sonic" ]; then + old_sonic_menuentry=$(cat /host/grub/grub.cfg | sed "/^menuentry '${demo_volume_label}-${running_sonic_revision}'/,/}/!d") + grub_cfg_root=$(echo $old_sonic_menuentry | sed -e "s/.*root\=\(.*\)rw.*/\1/") + onie_menuentry=$(cat /host/grub/grub.cfg | sed "/menuentry ONIE/,/}/!d") + elif [ "$install_env" = "build" ]; then + grub_cfg_root=%%SONIC_ROOT%% + else # install_env = "onie" + uuid=$(blkid "$demo_dev" | sed -ne 's/.* UUID=\"\([^"]*\)\".*/\1/p') + if [ -z "$uuid" ]; then grub_cfg_root=$demo_dev - else + else grub_cfg_root=UUID=$uuid + fi fi -fi # Add extra linux command line extra_cmdline_linux=%%EXTRA_CMDLINE_LINUX%% @@ -692,25 +493,27 @@ menuentry '$demo_grub_entry' { } EOF -if [ "$install_env" = "onie" ]; then - # Add menu entries for ONIE -- use the grub fragment provided by the - # ONIE distribution. - $onie_root_dir/grub.d/50_onie_grub >> $grub_cfg - mkdir -p $onie_initrd_tmp/$demo_mnt/grub -else -cat <> $grub_cfg + if [ "$install_env" = "onie" ]; then + # Add menu entries for ONIE -- use the grub fragment provided by the + # ONIE distribution. + $onie_root_dir/grub.d/50_onie_grub >> $grub_cfg + mkdir -p $onie_initrd_tmp/$demo_mnt/grub + else + cat <> $grub_cfg $old_sonic_menuentry $onie_menuentry EOF -fi + fi -if [ "$install_env" = "build" ]; then - cp $grub_cfg $demo_mnt/grub.cfg - umount $demo_mnt -else - cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg -fi + if [ "$install_env" = "build" ]; then + cp $grub_cfg $demo_mnt/grub.cfg + umount $demo_mnt + else + cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg + fi + + cd / -cd / + echo "Installed SONiC base image $demo_volume_label successfully" -echo "Installed SONiC base image $demo_volume_label successfully" +} diff --git a/installer/arm64/install.sh b/installer/install.sh similarity index 76% rename from installer/arm64/install.sh rename to installer/install.sh index 54ce1dda934e..8f4a515579b0 100755 --- a/installer/arm64/install.sh +++ b/installer/install.sh @@ -1,7 +1,16 @@ #!/bin/sh -# Copyright (C) Marvell Inc +# Copyright (C) 2020 Marvell Inc +# Copyright (C) 2014-2015 Curt Brune +# Copyright (C) 2014-2015 david_yang # +# SPDX-License-Identifier: GPL-2.0 + +# Appends a command to a trap, which is needed because default trap behavior is to replace +# previous trap for the same signal +# - 1st arg: code to add +# - ref: http://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal + _trap_push() { local next="$1" @@ -14,6 +23,26 @@ _trap_push() { } _trap_push true +read_conf_file() { + local conf_file=$1 + while IFS='=' read -r var value || [ -n "$var" ] + do + # remove newline character + var=$(echo $var | tr -d '\r\n') + value=$(echo $value | tr -d '\r\n') + # remove comment string + var=${var%#*} + value=${value%#*} + # skip blank line + [ -z "$var" ] && continue + # remove double quote in the beginning + tmp_val=${value#\"} + # remove double quote in the end + value=${tmp_val%\"} + eval "$var=\"$value\"" + done < "$conf_file" +} + set -e if [ -d "/etc/sonic" ]; then @@ -30,11 +59,17 @@ fi cd $(dirname $0) if [ -r ./machine.conf ]; then - . ./machine.conf + read_conf_file "./machine.conf" fi -if [ -r ./onie-image-arm64.conf ]; then - . ./onie-image-arm64.conf +# Load generic onie-image.conf +if [ -r ./onie-image.conf ]; then +. ./onie-image.conf +fi + +# Load arch-specific onie-image-[arch].conf if exists +if [ -r ./onie-image-*.conf ]; then +. ./onie-image-*.conf fi echo "ONIE Installer: platform: $platform" @@ -45,15 +80,17 @@ if [ $(id -u) -ne 0 ] exit 1 fi +# get running machine from conf file if [ -r /etc/machine.conf ]; then - . /etc/machine.conf + read_conf_file "/etc/machine.conf" elif [ -r /host/machine.conf ]; then - . /host/machine.conf + read_conf_file "/host/machine.conf" elif [ "$install_env" != "build" ]; then echo "cannot find machine.conf" exit 1 fi + echo "onie_platform: $onie_platform" # Get platform specific linux kernel command line arguments @@ -110,7 +147,12 @@ demo_volume_label="SONiC-${demo_type}" demo_volume_revision_label="SONiC-${demo_type}-${image_version}" -. ./platform.conf +. ./default_platform.conf + +if [ -r ./platform.conf ]; then + . ./platform.conf +fi + image_dir="image-$image_version" @@ -139,8 +181,19 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done +else + demo_mnt="build_raw_image_mnt" + demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" + + mkfs.ext4 -L $demo_volume_label $demo_dev + + echo "Mounting $demo_dev on $demo_mnt..." + mkdir $demo_mnt + mount -t auto -o loop $demo_dev $demo_mnt fi +echo "Installing SONiC to $demo_mnt/$image_dir" + # Create target directory or clean it up if exists if [ -d $demo_mnt/$image_dir ]; then echo "Directory $demo_mnt/$image_dir/ already exists. Cleaning up..." diff --git a/installer/x86_64/tests/sample_machine.conf b/installer/tests/sample_machine.conf similarity index 100% rename from installer/x86_64/tests/sample_machine.conf rename to installer/tests/sample_machine.conf diff --git a/installer/x86_64/tests/test_read_conf.sh b/installer/tests/test_read_conf.sh similarity index 99% rename from installer/x86_64/tests/test_read_conf.sh rename to installer/tests/test_read_conf.sh index 06b7fc145eab..a293058b0147 100644 --- a/installer/x86_64/tests/test_read_conf.sh +++ b/installer/tests/test_read_conf.sh @@ -58,4 +58,4 @@ TEST_CONF "$onie_skip_ethmgmt_macs" "$exp_onie_skip_ethmgmt_macs" TEST_CONF "$onie_grub_image_name" "$exp_onie_grub_image_name" echo "PASS!!" -exit 0 \ No newline at end of file +exit 0 diff --git a/onie-mk-demo.sh b/onie-mk-demo.sh index 55d0404a1468..0905673d42cb 100755 --- a/onie-mk-demo.sh +++ b/onie-mk-demo.sh @@ -23,9 +23,9 @@ if [ ! -d $installer_dir ] || \ exit 1 fi -if [ ! -d $installer_dir/$arch ] || \ - [ ! -r $installer_dir/$arch/install.sh ] ; then - echo "Error: Invalid arch installer directory: $installer_dir/$arch" +if [ ! -d $installer_dir ] || \ + [ ! -r $installer_dir/install.sh ] ; then + echo "Error: Invalid arch installer directory: $installer_dir" exit 1 fi @@ -75,9 +75,9 @@ tmp_dir=$(mktemp --directory) tmp_installdir="$tmp_dir/installer" mkdir $tmp_installdir || clean_up 1 -cp -r $installer_dir/$arch/* $tmp_installdir || clean_up 1 +cp -r $installer_dir/* $tmp_installdir || clean_up 1 cp onie-image.conf $tmp_installdir -cp onie-image-*.conf $tmp_installdir +cp onie-image-$arch.conf $tmp_installdir # Set sonic fips config for the installer script if [ "$ENABLE_FIPS" = "y" ]; then diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index e4940f0937c1..5624b588caf8 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit e4940f0937c1425c5ba8248e524a5d753c223aca +Subproject commit 5624b588caf88641c04eaf79821a29138b7adf88 diff --git a/platform/broadcom/docker-pde.mk b/platform/broadcom/docker-pde.mk index d433160e2a7d..a16c0c1f16e8 100644 --- a/platform/broadcom/docker-pde.mk +++ b/platform/broadcom/docker-pde.mk @@ -16,17 +16,20 @@ ifeq ($(PDDF_SUPPORT), y) $(DOCKER_PDE)_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3) endif $(DOCKER_PDE)_PYTHON_WHEELS += $(SONIC_DAEMON_BASE_PY3) -$(DOCKER_PDE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) -$(DOCKER_PDE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) -$(DOCKER_PDE)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_PDE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_PDE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) +$(DOCKER_PDE)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BULLSEYE) SONIC_DOCKER_IMAGES += $(DOCKER_PDE) -SONIC_BUSTER_DOCKERS += $(DOCKER_PDE) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_PDE) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PDE) -SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_PDE_DBG) +SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_PDE_DBG) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_PDE_DBG) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_PDE_DBG) +$(DOCKER_PDE)_VERSION = 1.0.0 +$(DOCKER_PDE)_PACKAGE_NAME = pde + $(DOCKER_PDE)_CONTAINER_NAME = pde $(DOCKER_PDE)_RUN_OPT += --privileged -t $(DOCKER_PDE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro @@ -35,12 +38,13 @@ $(DOCKER_PDE)_RUN_OPT += -v /usr/lib/python2.7/dist-packages:/usr/share/sonic/cl $(DOCKER_PDE)_RUN_OPT += -v /usr/local/lib/python3.7/dist-packages/utilities_common:/usr/local/lib/python3.7/dist-packages/utilities_common:ro $(DOCKER_PDE)_RUN_OPT += -v /var/log/syslog:/var/log/syslog:ro +$(DOCKER_PDE)_RUN_OPT += -v /var/log/ramfs:/var/log/ramfs:ro $(DOCKER_PDE)_RUN_OPT += -v /lib/modules:/lib/modules:ro $(DOCKER_PDE)_RUN_OPT += -v /boot:/boot:ro $(DOCKER_PDE)_RUN_OPT += -v /var/log/ramfs:/var/log/ramfs:ro $(DOCKER_PDE)_RUN_OPT += -v /usr/share/sonic/device/x86_64-broadcom_common:/usr/share/sonic/device/x86_64-broadcom_common:ro $(DOCKER_PDE)_RUN_OPT += -v /usr/share/sonic/device/pddf:/usr/share/sonic/device/pddf:ro - +$(DOCKER_PDE)_RUN_OPT += -v /usr/share/sonic/device/x86_64-broadcom_common:/usr/share/sonic/device/x86_64-broadcom_common:ro $(DOCKER_PDE)_BASE_IMAGE_FILES += pde-test:/usr/local/bin/pde-test $(DOCKER_PDE)_BASE_IMAGE_FILES += pde-bench:/usr/local/bin/pde-bench $(DOCKER_PDE)_BASE_IMAGE_FILES += pde-stress:/usr/local/bin/pde-stress diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index e4940f0937c1..5624b588caf8 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit e4940f0937c1425c5ba8248e524a5d753c223aca +Subproject commit 5624b588caf88641c04eaf79821a29138b7adf88 diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc-phy/mars.c b/platform/centec-arm64/tsingma-bsp/src/ctc-phy/mars.c index 675ba528fe68..7f1cdafe2254 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ctc-phy/mars.c +++ b/platform/centec-arm64/tsingma-bsp/src/ctc-phy/mars.c @@ -314,3 +314,6 @@ static struct mdio_device_id __maybe_unused mars_tbl[] = { }; MODULE_DEVICE_TABLE(mdio, mars_tbl); + +MODULE_AUTHOR("Centec, Inc."); +MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.c b/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.c index 0d6b97f2b378..d6b95aec3066 100755 --- a/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.c +++ b/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.c @@ -789,6 +789,11 @@ static int ctc_i2c_plat_probe(struct platform_device *pdev) of_property_read_u32(pdev->dev.of_node, "clock-frequency", &clk_freq); dev->clk_freq = clk_freq; + + dev->functionality = I2C_FUNC_10BIT_ADDR | CTC_IC_DEFAULT_FUNCTIONALITY; + dev->master_cfg = CTC_IC_CON_MASTER | CTC_IC_CON_SLAVE_DISABLE | + CTC_IC_CON_RESTART_EN; + if (dev->clk_freq <= 100000) dev->master_cfg |= CTC_IC_CON_SPEED_STD; else if (dev->clk_freq <= 400000) diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/sfp.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/sfp.py index 1d4154ff8384..c2e238a4e306 100644 --- a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/sfp.py +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/sfp.py @@ -383,7 +383,7 @@ def get_presence(self): try: with open(self.port_to_eeprom_mapping[self.port_num], mode='rb', buffering=0) as fd: - fd.read() + fd.read(256) except IOError: return False diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/sfp.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/sfp.py index 3475753cd49d..952b64b521ba 100644 --- a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/sfp.py +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/sfp.py @@ -383,7 +383,7 @@ def get_presence(self): try: with open(self.port_to_eeprom_mapping[self.port_num], mode='rb', buffering=0) as fd: - fd.read() + fd.read(256) except IOError: return False diff --git a/platform/marvell-armhf/platform.conf b/platform/marvell-armhf/platform.conf index 2f2a22cd8640..bab1b62f745e 100644 --- a/platform/marvell-armhf/platform.conf +++ b/platform/marvell-armhf/platform.conf @@ -6,9 +6,9 @@ echo "Preparing for installation ... " # global defines kernel_addr=0x1100000 -fdt_addr=0x1000000 -fdt_high=0x10fffff -initrd_addr=0x2000000 +fdt_addr=0x2800000 +fdt_high=0x28fffff +initrd_addr=0x2900000 kernel_fname="/boot/vmlinuz-5.10.0-12-2-armmp" initrd_fname="/boot/initrd.img-5.10.0-12-2-armmp" diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index fac7bddc2c24..6144ce67a746 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -20,7 +20,7 @@ MLNX_HW_MANAGEMENT_VERSION = 7.0020.2004 export MLNX_HW_MANAGEMENT_VERSION -MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb +MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_$(CONFIGURED_ARCH).deb $(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management $(MLNX_HW_MANAGEMENT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/hw-management/Makefile b/platform/mellanox/hw-management/Makefile index 9c62312d18c5..3ada49920413 100644 --- a/platform/mellanox/hw-management/Makefile +++ b/platform/mellanox/hw-management/Makefile @@ -1,7 +1,7 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb +MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_$(CONFIGURED_ARCH).deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index 4ee241eab4c7..1ae8453d4eff 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -18,7 +18,7 @@ SAI_VER = 0.9.4 -LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_amd64.deb +LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) @@ -28,13 +28,13 @@ $(LIBSAITHRIFT_DEV)_RDEPENDS += $(MLNX_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) -PYTHON_SAITHRIFT = python-saithrift$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb +PYTHON_SAITHRIFT = python-saithrift$(SAITHRIFT_VER)_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) -SAISERVER = saiserver$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb +SAISERVER = saiserver$(SAITHRIFT_VER)_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(SAISERVER)_RDEPENDS += $(LIBSAITHRIFT_DEV) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) -SAISERVER_DBG = saiserver$(SAITHRIFT_VER)-dbg_$(SAI_VER)_amd64.deb +SAISERVER_DBG = saiserver$(SAITHRIFT_VER)-dbg_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index c3ebdac356e7..eb702a85a1d1 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -21,14 +21,14 @@ MFT_REVISION = 34 export MFT_VERSION MFT_REVISION -MFT = mft_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb +MFT = mft_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft SONIC_MAKE_DEBS += $(MFT) $(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -KERNEL_MFT = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_amd64.deb +KERNEL_MFT = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) -MFT_OEM = mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb +MFT_OEM = mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(MFT),$(MFT_OEM))) diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile index 755ef4afc220..4c454028b0e0 100644 --- a/platform/mellanox/mft/Makefile +++ b/platform/mellanox/mft/Makefile @@ -18,14 +18,20 @@ SHELL = /bin/bash .SHELLFLAGS += -e -MFT_NAME = mft-$(MFT_VERSION)-$(MFT_REVISION)-x86_64-deb +ifeq ($(CONFIGURED_ARCH), amd64) +MFT_ARCH = x86_64 +else +MFT_ARCH = $(CONFIGURED_ARCH) +endif + +MFT_NAME = mft-$(MFT_VERSION)-$(MFT_REVISION)-$(MFT_ARCH)-deb MFT_TGZ = $(MFT_NAME).tgz SRC_DEB = kernel-mft-dkms_$(MFT_VERSION)-$(MFT_REVISION)_all.deb -MOD_DEB = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_amd64.deb +MOD_DEB = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_$(CONFIGURED_ARCH).deb -MAIN_TARGET = mft_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb -DERIVED_TARGETS = $(MOD_DEB) mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb +MAIN_TARGET = mft_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = $(MOD_DEB) mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb DKMS_BMDEB = /var/lib/dkms/kernel-mft-dkms/$(MFT_VERSION)/bmdeb DKMS_TMP := $(shell mktemp -u -d -t dkms.XXXXXXXXXX) @@ -46,8 +52,8 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : popd - sudo dkms build kernel-mft-dkms/$(MFT_VERSION) -k $(KVERSION) -a amd64 - sudo dkms mkbmdeb kernel-mft-dkms/$(MFT_VERSION) -k $(KVERSION) -a amd64 + sudo dkms build kernel-mft-dkms/$(MFT_VERSION) -k $(KVERSION) -a $(CONFIGURED_ARCH) + sudo dkms mkbmdeb kernel-mft-dkms/$(MFT_VERSION) -k $(KVERSION) -a $(CONFIGURED_ARCH) # w/a: remove dependencies mkdir -p $(DKMS_TMP)/DEBIAN diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index ea4d7df30f9a..b9fa2593174c 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -30,7 +30,6 @@ from .utils import extract_RJ45_ports_index from . import utils from .device_data import DeviceDataManager - from .sfp import SFP, RJ45Port, deinitialize_sdk_handle except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -110,8 +109,11 @@ def __init__(self): self.sfp_event = None self.reboot_cause_initialized = False + self.sfp_module = None + # Build the RJ45 port list from platform.json and hwsku.json - self.RJ45_port_list = extract_RJ45_ports_index() + self._RJ45_port_inited = False + self._RJ45_port_list = None logger.log_info("Chassis loaded successfully") @@ -120,9 +122,15 @@ def __del__(self): self.sfp_event.deinitialize() if self._sfp_list: - from .sfp import SFP, deinitialize_sdk_handle - if SFP.shared_sdk_handle: - deinitialize_sdk_handle(SFP.shared_sdk_handle) + if self.sfp_module.SFP.shared_sdk_handle: + self.sfp_module.deinitialize_sdk_handle(sfp_module.SFP.shared_sdk_handle) + + @property + def RJ45_port_list(self): + if not self._RJ45_port_inited: + self._RJ45_port_list = extract_RJ45_ports_index() + self._RJ45_port_inited = True + return self._RJ45_port_list ############################################## # PSU methods @@ -241,6 +249,12 @@ def get_fan_drawer(self, index): # SFP methods ############################################## + def _import_sfp_module(self): + if not self.sfp_module: + from . import sfp as sfp_module + self.sfp_module = sfp_module + return self.sfp_module + def initialize_single_sfp(self, index): sfp_count = self.get_num_sfps() if index < sfp_count: @@ -248,32 +262,32 @@ def initialize_single_sfp(self, index): self._sfp_list = [None] * sfp_count if not self._sfp_list[index]: - from .sfp import SFP + sfp_module = self._import_sfp_module() if self.RJ45_port_list and index in self.RJ45_port_list: - self._sfp_list[index] = RJ45Port(index) + self._sfp_list[index] = sfp_module.RJ45Port(index) else: - self._sfp_list[index] = SFP(index) + self._sfp_list[index] = sfp_module.SFP(index) self.sfp_initialized_count += 1 def initialize_sfp(self): if not self._sfp_list: - from .sfp import SFP + sfp_module = self._import_sfp_module() sfp_count = self.get_num_sfps() for index in range(sfp_count): if self.RJ45_port_list and index in self.RJ45_port_list: - sfp_module = RJ45Port(index) + sfp_object = sfp_module.RJ45Port(index) else: - sfp_module = SFP(index) - self._sfp_list.append(sfp_module) + sfp_object = sfp_module.SFP(index) + self._sfp_list.append(sfp_object) self.sfp_initialized_count = sfp_count elif self.sfp_initialized_count != len(self._sfp_list): - from .sfp import SFP + sfp_module = self._import_sfp_module() for index in range(len(self._sfp_list)): if self._sfp_list[index] is None: if self.RJ45_port_list and index in self.RJ45_port_list: - self._sfp_list[index] = RJ45Port(index) + self._sfp_list[index] = sfp_module.RJ45Port(index) else: - self._sfp_list[index] = SFP(index) + self._sfp_list[index] = sfp_module.SFP(index) self.sfp_initialized_count = len(self._sfp_list) def get_num_sfps(self): @@ -313,6 +327,30 @@ def get_sfp(self, index): self.initialize_single_sfp(index) return super(Chassis, self).get_sfp(index) + def get_port_or_cage_type(self, index): + """ + Retrieves sfp port or cage type corresponding to physical port + + Args: + index: An integer (>=0), the index of the sfp to retrieve. + The index should correspond to the physical port in a chassis. + For example:- + 1 for Ethernet0, 2 for Ethernet4 and so on for one platform. + 0 for Ethernet0, 1 for Ethernet4 and so on for another platform. + + Returns: + The masks of all types of port or cage that can be supported on the port + Types are defined in sfp_base.py + Eg. + Both SFP and SFP+ are supported on the port, the return value should be 0x0a + which is 0x02 | 0x08 + """ + index = index - 1 + if self.RJ45_port_list and index in self.RJ45_port_list: + from sonic_platform_base.sfp_base import SfpBase + return SfpBase.SFP_PORT_TYPE_BIT_RJ45 + raise NotImplementedError + def get_change_event(self, timeout=0): """ Returns a nested dictionary containing all devices which have diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py index b35ef313dfcd..adf931d37e90 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py @@ -177,12 +177,12 @@ def is_host(): """ Test whether current process is running on the host or an docker return True for host and False for docker - """ + """ try: - proc = subprocess.Popen("docker --version 2>/dev/null", - stdout=subprocess.PIPE, - shell=True, - stderr=subprocess.STDOUT, + proc = subprocess.Popen("docker --version 2>/dev/null", + stdout=subprocess.PIPE, + shell=True, + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] proc.wait() @@ -239,9 +239,13 @@ def load_json_file(filename, log_func=logger.log_error): def extract_RJ45_ports_index(): # Cross check 'platform.json' and 'hwsku.json' to extract the RJ45 port index if exists. hwsku_path = device_info.get_path_to_hwsku_dir() + hwsku_file = os.path.join(hwsku_path, HWSKU_JSON) + if not os.path.exists(hwsku_file): + # Platforms having no hwsku.json do not have RJ45 port + return None + platform_file = device_info.get_path_to_port_config_file() platform_dict = load_json_file(platform_file)['interfaces'] - hwsku_file = os.path.join(hwsku_path, HWSKU_JSON) hwsku_dict = load_json_file(hwsku_file)['interfaces'] port_name_to_index_map_dict = {} RJ45_port_index_list = [] diff --git a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py index c6235b195a02..38b6bd6cfffd 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py @@ -29,6 +29,7 @@ sys.path.insert(0, modules_path) import sonic_platform.chassis +from sonic_platform_base.sfp_base import SfpBase from sonic_platform.chassis import Chassis from sonic_platform.device_data import DeviceDataManager @@ -282,3 +283,16 @@ def test_revision_permission(self): sonic_platform.chassis.DMI_FILE = old_dmi_file os.system("rm -f " + new_dmi_file) assert rev == "N/A" + + def test_get_port_or_cage_type(self): + chassis = Chassis() + chassis.RJ45_port_list = [0] + assert SfpBase.SFP_PORT_TYPE_BIT_RJ45 == chassis.get_port_or_cage_type(1) + + exceptionRaised = False + try: + chassis.get_port_or_cage_type(2) + except NotImplementedError: + exceptionRaised = True + + assert exceptionRaised diff --git a/platform/mellanox/mlnx-platform-api/tests/test_utils.py b/platform/mellanox/mlnx-platform-api/tests/test_utils.py index bbc3ab28e58c..e1052202d416 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_utils.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_utils.py @@ -113,10 +113,15 @@ def test_default_return(self, mock_log): @utils.default_return(100, log_func=mock_log) def func(): raise RuntimeError('') - + assert func() == 100 assert mock_log.call_count == 1 def test_run_command(self): output = utils.run_command('ls') assert output + + @mock.patch('sonic_py_common.device_info.get_path_to_hwsku_dir', mock.MagicMock(return_value='/tmp')) + def test_extract_RJ45_ports_index(self): + rj45_list = utils.extract_RJ45_ports_index() + assert rj45_list is None diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 69279d0844d5..6eaa1dcf80b4 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,14 +1,14 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.21.1.0 +MLNX_SAI_VERSION = SAIRel1.21.2.0 export MLNX_SAI_VERSION -MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb +MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb $(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai $(MLNX_SAI)_DEPENDS += $(MLNX_SDK_DEBS) $(MLNX_SAI)_RDEPENDS += $(MLNX_SDK_RDEBS) $(MLNX_SDK_DEBS) $(eval $(call add_conflict_package,$(MLNX_SAI),$(LIBSAIVS_DEV))) -MLNX_SAI_DBGSYM = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb +MLNX_SAI_DBGSYM = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(MLNX_SAI),$(MLNX_SAI_DBGSYM))) SONIC_MAKE_DEBS += $(MLNX_SAI) diff --git a/platform/mellanox/mlnx-sai/Makefile b/platform/mellanox/mlnx-sai/Makefile index 715f43ef0355..55c453e77e6d 100644 --- a/platform/mellanox/mlnx-sai/Makefile +++ b/platform/mellanox/mlnx-sai/Makefile @@ -2,8 +2,8 @@ SHELL = /bin/bash .SHELLFLAGS += -e -MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb -DERIVED_TARGETS = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb +MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : pushd SAI-Implementation diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation index d6eb22a12cc0..f9a21df71363 160000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ b/platform/mellanox/mlnx-sai/SAI-Implementation @@ -1 +1 @@ -Subproject commit d6eb22a12cc0f01e84a71d367f7c4ebe19f58a40 +Subproject commit f9a21df713636fe648b8bb190698e4494a0f5239 diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index a6fc81b3beb4..5b5e55cdf494 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -48,4 +48,7 @@ $(SYNCD)_RDEPENDS += $(MLNX_SAI) # Inject mlnx sdk libs to platform monitor $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(APPLIBS) $(SX_COMPLIB) $(SXD_LIBS) $(SX_GEN_UTILS) $(PYTHON_SDK_API) $(APPLIBS_DEV) $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(SX_GEN_UTILS_DEV) +# Force the target bootloader for mellanox platforms to grub regardless of arch +TARGET_BOOTLOADER = grub + export SONIC_BUFFER_MODEL=dynamic diff --git a/platform/mellanox/sdk-src/applibs/Makefile b/platform/mellanox/sdk-src/applibs/Makefile index 1068da0c5c16..47e4f5388dbe 100644 --- a/platform/mellanox/sdk-src/applibs/Makefile +++ b/platform/mellanox/sdk-src/applibs/Makefile @@ -1,8 +1,8 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = applibs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb applibs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = applibs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb applibs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = applibs $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/iproute2/Makefile b/platform/mellanox/sdk-src/iproute2/Makefile index 0e32fe1426c4..9735706dd343 100644 --- a/platform/mellanox/sdk-src/iproute2/Makefile +++ b/platform/mellanox/sdk-src/iproute2/Makefile @@ -1,8 +1,8 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb iproute2-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb iproute2-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = iproute2-3.19.0 $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/python-sdk-api/Makefile b/platform/mellanox/sdk-src/python-sdk-api/Makefile index 47f0ad5a01ff..5ac3e8504968 100644 --- a/platform/mellanox/sdk-src/python-sdk-api/Makefile +++ b/platform/mellanox/sdk-src/python-sdk-api/Makefile @@ -1,8 +1,8 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = python-sdk-api_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = python-sdk-api-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = python-sdk-api_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = python-sdk-api-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = python_sdk_api $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-acl-helper/Makefile b/platform/mellanox/sdk-src/sx-acl-helper/Makefile index d9d0aef8775b..42109c74e0bb 100644 --- a/platform/mellanox/sdk-src/sx-acl-helper/Makefile +++ b/platform/mellanox/sdk-src/sx-acl-helper/Makefile @@ -1,10 +1,10 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = sx-acl-helper_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sx-acl-helper-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sx-acl-helper-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sx-acl-helper-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = sx-acl-helper_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = sx-acl-helper-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + sx-acl-helper-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + sx-acl-helper-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = sx_acl_helper $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-complib/Makefile b/platform/mellanox/sdk-src/sx-complib/Makefile index 6e51b779ef23..c717ffda93c0 100644 --- a/platform/mellanox/sdk-src/sx-complib/Makefile +++ b/platform/mellanox/sdk-src/sx-complib/Makefile @@ -1,10 +1,10 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = sx-complib_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sx-complib-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sx-complib-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sx-complib-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = sx-complib_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = sx-complib-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + sx-complib-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + sx-complib-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = sx_complib $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-examples/Makefile b/platform/mellanox/sdk-src/sx-examples/Makefile index 06de0f475062..2084e397f981 100644 --- a/platform/mellanox/sdk-src/sx-examples/Makefile +++ b/platform/mellanox/sdk-src/sx-examples/Makefile @@ -1,8 +1,8 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = sx-examples_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sx-examples-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb sx-examples-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = sx-examples_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = sx-examples-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb sx-examples-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = sx_examples $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-gen-utils/Makefile b/platform/mellanox/sdk-src/sx-gen-utils/Makefile index 1f6f31d9acd4..66d2fb6b453e 100644 --- a/platform/mellanox/sdk-src/sx-gen-utils/Makefile +++ b/platform/mellanox/sdk-src/sx-gen-utils/Makefile @@ -1,8 +1,8 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = sx-gen-utils_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb sx-gen-utils-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = sx-gen-utils_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb sx-gen-utils-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = sx_gen_utils $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-kernel/Makefile b/platform/mellanox/sdk-src/sx-kernel/Makefile index 422f2ae95aae..26ccbd02516a 100644 --- a/platform/mellanox/sdk-src/sx-kernel/Makefile +++ b/platform/mellanox/sdk-src/sx-kernel/Makefile @@ -1,8 +1,8 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = sx_kernel $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-scew/Makefile b/platform/mellanox/sdk-src/sx-scew/Makefile index 9b8c5bd56c39..8bb61fcda67c 100644 --- a/platform/mellanox/sdk-src/sx-scew/Makefile +++ b/platform/mellanox/sdk-src/sx-scew/Makefile @@ -1,10 +1,10 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = sx-scew_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sx-scew-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sx-scew-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sx-scew-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = sx-scew_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = sx-scew-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + sx-scew-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + sx-scew-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = sx_scew $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sxd-libs/Makefile b/platform/mellanox/sdk-src/sxd-libs/Makefile index 892974e75e5f..0472056c9874 100644 --- a/platform/mellanox/sdk-src/sxd-libs/Makefile +++ b/platform/mellanox/sdk-src/sxd-libs/Makefile @@ -1,10 +1,10 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = sxd-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sxd-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sxd-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = sxd-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = sxd-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + sxd-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = sxd_libs $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/wjh-libs/Makefile b/platform/mellanox/sdk-src/wjh-libs/Makefile index ecc437258ec2..d5af48b7c559 100644 --- a/platform/mellanox/sdk-src/wjh-libs/Makefile +++ b/platform/mellanox/sdk-src/wjh-libs/Makefile @@ -1,10 +1,10 @@ .ONESHELL: SHELL = /bin/bash -MAIN_TARGET = wjh-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = wjh-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - wjh-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - wjh-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +MAIN_TARGET = wjh-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = wjh-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + wjh-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb \ + wjh-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb PACKAGE_NAME = wjh_libs $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 2412cf0ca705..e0861ddc93f8 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -44,112 +44,112 @@ MLNX_SDK_DBG_DEBS += $(APPLIBS_DBGSYM) $(IPROUTE2_MLNX_DBGSYM) $(SX_COMPLIB_DBGS $(SX_EXAMPLES_DBGSYM) $(SX_GEN_UTILS_DBGSYM) $(SX_SCEW_DBGSYM) \ $(SXD_LIBS_DBGSYM) $(WJH_LIBS_DBGSYM) $(SX_ACL_HELPER_DBGSYM) -APPLIBS = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +APPLIBS = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(APPLIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/applibs $(APPLIBS)_DEPENDS += $(SX_COMPLIB_DEV) $(SX_GEN_UTILS_DEV) $(SXD_LIBS_DEV) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) $(APPLIBS)_RDEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3) -APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV))) -APPLIBS_DBGSYM = applibs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +APPLIBS_DBGSYM = applibs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DBGSYM))) endif -IPROUTE2_MLNX = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +IPROUTE2_MLNX = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(IPROUTE2_MLNX)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/iproute2 -IPROUTE2_MLNX_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +IPROUTE2_MLNX_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_DEV))) -IPROUTE2_MLNX_DBGSYM = iproute2-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +IPROUTE2_MLNX_DBGSYM = iproute2-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_DBGSYM))) endif -SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(SX_COMPLIB)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-complib -SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV))) -SX_COMPLIB_DBGSYM = sx-complib-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_COMPLIB_DBGSYM = sx-complib-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DBGSYM))) endif -SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(SX_EXAMPLES)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-examples $(SX_EXAMPLES)_DEPENDS += $(APPLIBS_DEV) $(SX_SCEW_DEV) $(SXD_LIBS_DEV) $(SX_EXAMPLES)_RDEPENDS += $(APPLIBS) $(SX_SCEW) $(SXD_LIBS) -SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(SX_EXAMPLES),$(SX_EXAMPLES_DEV))) -SX_EXAMPLES_DBGSYM = sx-examples-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_EXAMPLES_DBGSYM = sx-examples-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(SX_EXAMPLES),$(SX_EXAMPLES_DBGSYM))) endif -SX_GEN_UTILS = sx-gen-utils_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_GEN_UTILS = sx-gen-utils_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(SX_GEN_UTILS)_SRC_PATH += $(PLATFORM_PATH)/sdk-src/sx-gen-utils $(SX_GEN_UTILS)_DEPENDS += $(SX_COMPLIB_DEV) $(SX_GEN_UTILS)_RDEPENDS += $(SX_COMPLIB) -SX_GEN_UTILS_DEV = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_GEN_UTILS_DEV = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DEV))) -SX_GEN_UTILS_DBGSYM = sx-gen-utils-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_GEN_UTILS_DBGSYM = sx-gen-utils-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DBGSYM))) endif -SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(SX_SCEW)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-scew -SX_SCEW_DEV = sx-scew-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_SCEW_DEV = sx-scew-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV))) -SX_SCEW_DBGSYM = sx-scew-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_SCEW_DBGSYM = sx-scew-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DBGSYM))) endif -SXD_LIBS = sxd-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SXD_LIBS = sxd-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(SXD_LIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sxd-libs $(SXD_LIBS)_DEPENDS += $(SX_COMPLIB_DEV) $(SX_GEN_UTILS_DEV) -SXD_LIBS_DEV = sxd-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SXD_LIBS_DEV = sxd-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV))) -SXD_LIBS_DBGSYM = sxd-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SXD_LIBS_DBGSYM = sxd-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DBGSYM))) endif #packages that are required for runtime only -PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(PYTHON_SDK_API)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/python-sdk-api $(PYTHON_SDK_API)_DEPENDS += $(APPLIBS_DEV) $(SXD_LIBS_DEV) $(SWIG) $(PYTHON_SDK_API)_RDEPENDS += $(APPLIBS) $(SXD_LIBS) -PYTHON_SDK_API_DBGSYM = python-sdk-api-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +PYTHON_SDK_API_DBGSYM = python-sdk-api-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(PYTHON_SDK_API),$(PYTHON_SDK_API_DBGSYM))) endif -SX_ACL_HELPER = sx-acl-helper_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_ACL_HELPER = sx-acl-helper_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(SX_ACL_HELPER)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-acl-helper $(SX_ACL_HELPER)_DEPENDS += $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(APPLIBS_DEV) $(SX_ACL_HELPER)_RDEPENDS += $(SX_COMPLIB) $(PYTHON_SDK_API) -SX_ACL_HELPER_DEV = sx-acl-helper-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_ACL_HELPER_DEV = sx-acl-helper-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(SX_ACL_HELPER),$(SX_ACL_HELPER_DEV))) -SX_ACL_HELPER_DBGSYM = sx-acl-helper-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_ACL_HELPER_DBGSYM = sx-acl-helper-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(SX_ACL_HELPER),$(SX_ACL_HELPER_DBGSYM))) endif -WJH_LIBS = wjh-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +WJH_LIBS = wjh-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(WJH_LIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/wjh-libs $(WJH_LIBS)_DEPENDS += $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(APPLIBS_DEV) $(SX_ACL_HELPER_DEV) $(SX_SCEW_DEV) $(WJH_LIBS)_RDEPENDS += $(SX_COMPLIB) $(PYTHON_SDK_API) $(SX_ACL_HELPER) -WJH_LIBS_DEV = wjh-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +WJH_LIBS_DEV = wjh-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(WJH_LIBS),$(WJH_LIBS_DEV))) -WJH_LIBS_DBGSYM = wjh-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +WJH_LIBS_DBGSYM = wjh-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(WJH_LIBS),$(WJH_LIBS_DBGSYM))) endif -SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(SX_KERNEL)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(SX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel -SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV))) define make_path diff --git a/rules/config b/rules/config index dc973cbd12da..23622bcc8740 100644 --- a/rules/config +++ b/rules/config @@ -228,6 +228,12 @@ ENABLE_ASAN ?= n # reset default container registry from dockerhub to other DEFAULT_CONTAINER_REGISTRY ?= +# INCLUDE_BOOTCHART - install systemd-bootchart +INCLUDE_BOOTCHART = y + +# ENABLE_BOOTCHART - whether to enable systemd-bootchart on boot +ENABLE_BOOTCHART = n + # ENABLE_FIPS_FEATURE - support FIPS feature, only for amd64 or arm64, armhf not supported yet # ENABLE_FIPS - support FIPS flag, if enabled, no additional config requred for the image to support FIPS ENABLE_FIPS_FEATURE ?= y diff --git a/rules/dhcp6relay.dep b/rules/dhcp6relay.dep deleted file mode 100644 index be82d326fe21..000000000000 --- a/rules/dhcp6relay.dep +++ /dev/null @@ -1,9 +0,0 @@ - -SPATH := $($(SONIC_DHCP6RELAY)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/dhcp6relay.mk rules/dhcp6relay.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(shell git ls-files $(SPATH)) - -$(SONIC_DHCP6RELAY)_CACHE_MODE := GIT_CONTENT_SHA -$(SONIC_DHCP6RELAY)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_DHCP6RELAY)_DEP_FILES := $(DEP_FILES) diff --git a/rules/dhcp6relay.mk b/rules/dhcp6relay.mk deleted file mode 100644 index 204bf6fa34dd..000000000000 --- a/rules/dhcp6relay.mk +++ /dev/null @@ -1,12 +0,0 @@ -# SONiC DHCPV6 RELAY Package - -SONIC_DHCP6RELAY_VERSION = 1.0.0-0 -SONIC_DHCP6RELAY_PKG_NAME = dhcp6relay - -SONIC_DHCP6RELAY = sonic-$(SONIC_DHCP6RELAY_PKG_NAME)_$(SONIC_DHCP6RELAY_VERSION)_$(CONFIGURED_ARCH).deb -$(SONIC_DHCP6RELAY)_DEPENDS = $(LIBSWSSCOMMON) $(LIBHIREDIS) $(LIBSWSSCOMMON_DEV) $(LIBHIREDIS_DEV) -$(SONIC_DHCP6RELAY)_SRC_PATH = $(SRC_PATH)/$(SONIC_DHCP6RELAY_PKG_NAME) -SONIC_DPKG_DEBS += $(SONIC_DHCP6RELAY) - -SONIC_DHCP6RELAY_DBG = sonic-$(SONIC_DHCP6RELAY_PKG_NAME)-dbgsym_$(SONIC_DHCP6RELAY_VERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(SONIC_DHCP6RELAY),$(SONIC_DHCP6RELAY_DBG))) diff --git a/rules/dhcprelay.dep b/rules/dhcprelay.dep new file mode 100644 index 000000000000..5f6d77a84fc3 --- /dev/null +++ b/rules/dhcprelay.dep @@ -0,0 +1,11 @@ + +SPATH := $($(SONIC_DHCPRELAY)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/dhcprelay.mk rules/dhcprelay.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) + +$(SONIC_DHCPRELAY)_CACHE_MODE := GIT_CONTENT_SHA +$(SONIC_DHCPRELAY)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SONIC_DHCPRELAY)_DEP_FILES := $(DEP_FILES) +$(SONIC_DHCPRELAY)_SMDEP_FILES := $(SMDEP_FILES) +$(SONIC_DHCPRELAY)_SMDEP_PATHS := $(SPATH) diff --git a/rules/dhcprelay.mk b/rules/dhcprelay.mk new file mode 100644 index 000000000000..0a32d7d54297 --- /dev/null +++ b/rules/dhcprelay.mk @@ -0,0 +1,12 @@ +# SONiC DHCPV6 RELAY Package + +SONIC_DHCPRELAY_VERSION = 1.0.0-0 +SONIC_DHCPRELAY_PKG_NAME = dhcp6relay + +SONIC_DHCPRELAY = sonic-$(SONIC_DHCPRELAY_PKG_NAME)_$(SONIC_DHCPRELAY_VERSION)_$(CONFIGURED_ARCH).deb +$(SONIC_DHCPRELAY)_DEPENDS = $(LIBSWSSCOMMON) $(LIBHIREDIS) $(LIBSWSSCOMMON_DEV) $(LIBHIREDIS_DEV) +$(SONIC_DHCPRELAY)_SRC_PATH = $(SRC_PATH)/dhcprelay +SONIC_DPKG_DEBS += $(SONIC_DHCPRELAY) + +SONIC_DHCPRELAY_DBG = sonic-$(SONIC_DHCPRELAY_PKG_NAME)-dbgsym_$(SONIC_DHCPRELAY_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(SONIC_DHCPRELAY),$(SONIC_DHCPRELAY_DBG))) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index b742bff43b0d..c2db8d7ba538 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -6,10 +6,10 @@ DOCKER_DHCP_RELAY_DBG = $(DOCKER_DHCP_RELAY_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/$(DOCKER_DHCP_RELAY_STEM) -$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_RELAY) $(SONIC_DHCPMON) $(SONIC_DHCP6RELAY) $(LIBSWSSCOMMON) +$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_RELAY) $(SONIC_DHCPMON) $(SONIC_DHCPRELAY) $(LIBSWSSCOMMON) $(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) -$(DOCKER_DHCP_RELAY)_DBG_DEPENDS += $(ISC_DHCP_RELAY_DBG) $(SONIC_DHCP6RELAY_DBG) $(SONIC_DHCPMON_DBG) +$(DOCKER_DHCP_RELAY)_DBG_DEPENDS += $(ISC_DHCP_RELAY_DBG) $(SONIC_DHCPRELAY_DBG) $(SONIC_DHCPMON_DBG) $(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 8d978ae66515..d376daa2100f 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -19,7 +19,8 @@ $(DOCKER_TEAMD)_VERSION = 1.0.0 $(DOCKER_TEAMD)_PACKAGE_NAME = teamd $(DOCKER_TEAMD)_WARM_SHUTDOWN_BEFORE = syncd $(DOCKER_TEAMD)_WARM_SHUTDOWN_AFTER = swss -$(DOCKER_TEAMD)_FAST_SHUTDOWN_BEFORE = swss +$(DOCKER_TEAMD)_FAST_SHUTDOWN_BEFORE = syncd +$(DOCKER_TEAMD)_FAST_SHUTDOWN_AFTER = swss SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) diff --git a/rules/openssh.mk b/rules/openssh.mk index 0e4696ed9d27..53438b76ab73 100644 --- a/rules/openssh.mk +++ b/rules/openssh.mk @@ -1,6 +1,6 @@ # openssh package -OPENSSH_VERSION = 8.4p1-5 +OPENSSH_VERSION = 8.4p1-5+deb11u1 export OPENSSH_VERSION diff --git a/rules/phy-credo.mk b/rules/phy-credo.mk index 0218fdf6f691..197888e518bf 100644 --- a/rules/phy-credo.mk +++ b/rules/phy-credo.mk @@ -1,3 +1,3 @@ PHY_CREDO = phy-credo_1.0_amd64.deb -$(PHY_CREDO)_URL = "https://github.com/aristanetworks/sonic-firmware/raw/d227160f981f27df020ab50b9e0f16b1bd9166ea/phy/phy-credo_1.0_amd64.deb" +$(PHY_CREDO)_URL = "https://github.com/aristanetworks/sonic-firmware/raw/e89a1696954fd381e1e95edf208cffc97caf15d4/phy/phy-credo_1.0_amd64.deb" SONIC_ONLINE_DEBS += $(PHY_CREDO) diff --git a/slave.mk b/slave.mk index 76274b21b39e..8a400a8c88c4 100644 --- a/slave.mk +++ b/slave.mk @@ -75,6 +75,7 @@ export BUILD_TIMESTAMP export SONIC_IMAGE_VERSION export CONFIGURED_PLATFORM export CONFIGURED_ARCH +export TARGET_BOOTLOADER export PYTHON_WHEELS_PATH export IMAGE_DISTRO export IMAGE_DISTRO_DEBS_PATH @@ -191,6 +192,15 @@ ifeq ($(SONIC_INCLUDE_MUX),y) INCLUDE_MUX = y endif +ifeq ($(SONIC_INCLUDE_BOOTCHART),y) +INCLUDE_BOOTCHART = y +endif + +ifeq ($(SONIC_ENABLE_BOOTCHART),y) +ENABLE_BOOTCHART = y +endif + + ifeq ($(ENABLE_ASAN),y) ifneq ($(CONFIGURED_ARCH),amd64) @echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)" @@ -243,7 +253,7 @@ endif DOCKER_IMAGE_REF = $*-$(DOCKER_USERNAME):$(DOCKER_USERTAG) DOCKER_DBG_IMAGE_REF = $*-$(DBG_IMAGE_MARK)-$(DOCKER_USERNAME):$(DOCKER_USERTAG) -export DOCKER_USERNAME DOCKER_USERTAG +export DOCKER_USERNAME DOCKER_USERTAG ifeq ($(VS_PREPARE_MEM),) override VS_PREPARE_MEM := $(DEFAULT_VS_PREPARE_MEM) @@ -335,6 +345,8 @@ $(info "INCLUDE_P4RT" : "$(INCLUDE_P4RT)") $(info "INCLUDE_KUBERNETES" : "$(INCLUDE_KUBERNETES)") $(info "INCLUDE_MACSEC" : "$(INCLUDE_MACSEC)") $(info "INCLUDE_MUX" : "$(INCLUDE_MUX)") +$(info "INCLUDE_BOOTCHART : "$(INCLUDE_BOOTCHART)") +$(info "ENABLE_BOOTCHART : "$(ENABLE_BOOTCHART)") $(info "ENABLE_FIPS_FEATURE" : "$(ENABLE_FIPS_FEATURE)") $(info "TELEMETRY_WRITABLE" : "$(TELEMETRY_WRITABLE)") $(info "ENABLE_AUTO_TECH_SUPPORT" : "$(ENABLE_AUTO_TECH_SUPPORT)") @@ -380,7 +392,7 @@ export vs_build_prepare_mem=$(VS_PREPARE_MEM) ## docker-swss:latest <=SAVE/LOAD=> docker-swss-: # $(call docker-image-save,from,to) -# Sonic docker images are always created with username as extension. During the save operation, +# Sonic docker images are always created with username as extension. During the save operation, # it removes the username extension from docker image and saved them as compressed tar file for SONiC image generation. # The save operation is protected with lock for parallel build. # @@ -404,7 +416,7 @@ define docker-image-save endef # $(call docker-image-load,from) -# Sonic docker images are always created with username as extension. During the load operation, +# Sonic docker images are always created with username as extension. During the load operation, # it loads the docker image from compressed tar file and tag them with username as extension. # The load operation is protected with lock for parallel build. # @@ -1152,6 +1164,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(shell [[ ! -z '$($(component)_VERSION)' && ! -z '$($(component)_NAME)' ]] && \ echo $($(component)_NAME)==$($(component)_VERSION)))" export include_mux="$(INCLUDE_MUX)" + export include_bootchart="$(INCLUDE_BOOTCHART)" + export enable_bootchart="$(ENABLE_BOOTCHART)" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" export docker_image_name="$(basename $(docker))" diff --git a/src/dhcp6relay/.gitignore b/src/dhcp6relay/.gitignore deleted file mode 100644 index 9d09ae6b3f1a..000000000000 --- a/src/dhcp6relay/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -debian/* -!debian/changelog -!debian/compat -!debian/control -!debian/rules diff --git a/src/dhcp6relay/Makefile b/src/dhcp6relay/Makefile deleted file mode 100644 index dd384452a5fc..000000000000 --- a/src/dhcp6relay/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -RM := rm -rf -DHCP6RELAY_TARGET := dhcp6relay -CP := cp -MKDIR := mkdir -CC := g++ -MV := mv -LIBS := -levent -lhiredis -lswsscommon -pthread -lboost_thread -lboost_system -CFLAGS += -Wall -std=c++17 -fPIE -I$(PWD)/../sonic-swss-common/common -PWD := $(shell pwd) - -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(strip $(C_DEPS)),) --include $(C_DEPS) $(OBJS) -endif -endif - --include src/subdir.mk - -all: sonic-dhcp6relay - -sonic-dhcp6relay: $(OBJS) - @echo 'Building target: $@' - @echo 'Invoking: G++ Linker' - $(CC) $(LDFLAGS) -o $(DHCP6RELAY_TARGET) $(OBJS) $(LIBS) - @echo 'Finished building target: $@' - @echo ' ' - -install: - $(MKDIR) -p $(DESTDIR)/usr/sbin - $(MV) $(DHCP6RELAY_TARGET) $(DESTDIR)/usr/sbin - -deinstall: - $(RM) $(DESTDIR)/usr/sbin/$(DHCP6RELAY_TARGET) - $(RM) -rf $(DESTDIR)/usr/sbin - -clean: - -$(RM) $(EXECUTABLES) $(C_DEPS) $(OBJS) $(DHCP6RELAY_TARGET) - -@echo ' ' - -.PHONY: all clean dependents - - diff --git a/src/dhcp6relay/debian/changelog b/src/dhcp6relay/debian/changelog deleted file mode 100644 index 67ed277049e5..000000000000 --- a/src/dhcp6relay/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -sonic-dhcp6relay (1.0.0-0) UNRELEASED; urgency=medium - - * Initial release. - --- Kelly Yeh diff --git a/src/dhcp6relay/debian/compat b/src/dhcp6relay/debian/compat deleted file mode 100644 index 48082f72f087..000000000000 --- a/src/dhcp6relay/debian/compat +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/src/dhcp6relay/debian/control b/src/dhcp6relay/debian/control deleted file mode 100644 index af7877fef9a8..000000000000 --- a/src/dhcp6relay/debian/control +++ /dev/null @@ -1,14 +0,0 @@ -Source: sonic-dhcp6relay -Section: devel -Priority: optional -Maintainer: Kelly Yeh -Build-Depends: debhelper (>= 12.0.0), libevent-dev, libboost-thread-dev, libboost-system-dev, libswsscommon-dev -Standards-Version: 3.9.3 -Homepage: https://github.com/Azure/sonic-buildimage -XS-Go-Import-Path: github.com/Azure/sonic-buildimage - -Package: sonic-dhcp6relay -Architecture: any -Built-Using: ${misc:Built-Using} -Depends: ${shlibs:Depends} -Description: SONiC DHCPv6 Relay diff --git a/src/dhcp6relay/debian/rules b/src/dhcp6relay/debian/rules deleted file mode 100755 index ac2cd63889ef..000000000000 --- a/src/dhcp6relay/debian/rules +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/make -f - -export DEB_BUILD_MAINT_OPTIONS=hardening=+all - -%: - dh $@ --parallel diff --git a/src/dhcp6relay/src/configInterface.cpp b/src/dhcp6relay/src/configInterface.cpp deleted file mode 100644 index ca78d80e63da..000000000000 --- a/src/dhcp6relay/src/configInterface.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include -#include -#include -#include "configInterface.h" - -constexpr auto DEFAULT_TIMEOUT_MSEC = 1000; - -bool pollSwssNotifcation = true; -std::shared_ptr mSwssThreadPtr; - -std::shared_ptr configDbPtr = std::make_shared ("CONFIG_DB", 0); -swss::SubscriberStateTable ipHelpersTable(configDbPtr.get(), "DHCP_RELAY"); -swss::Select swssSelect; - -/** - * @code void initialize_swss() - * - * @brief initialize DB tables and start SWSS listening thread - * - * @return none - */ -void initialize_swss(std::vector *vlans) -{ - try { - swssSelect.addSelectable(&ipHelpersTable); - get_dhcp(vlans); - mSwssThreadPtr = std::make_shared (&handleSwssNotification, vlans); - } - catch (const std::bad_alloc &e) { - syslog(LOG_ERR, "Failed allocate memory. Exception details: %s", e.what()); - } -} - -/** - * @code void deinitialize_swss() - * - * @brief deinitialize DB interface and join SWSS listening thread - * - * @return none - */ -void deinitialize_swss() -{ - stopSwssNotificationPoll(); - mSwssThreadPtr->interrupt(); -} - - -/** - * @code void get_dhcp(std::vector *vlans) - * - * @brief initialize and get vlan table information from DHCP_RELAY - * - * @return none - */ -void get_dhcp(std::vector *vlans) { - swss::Selectable *selectable; - int ret = swssSelect.select(&selectable, DEFAULT_TIMEOUT_MSEC); - if (ret == swss::Select::ERROR) { - syslog(LOG_WARNING, "Select: returned ERROR"); - } else if (ret == swss::Select::TIMEOUT) { - } - if (selectable == static_cast (&ipHelpersTable)) { - handleRelayNotification(ipHelpersTable, vlans); - } -} -/** - * @code void handleSwssNotification(std::vector *vlans) - * - * @brief main thread for handling SWSS notification - * - * @param context list of vlans/argument config that contains strings of server and option - * - * @return none - */ -void handleSwssNotification(std::vector *vlans) -{ - while (pollSwssNotifcation) { - get_dhcp(vlans); - } -} - -/** - * @code void handleRelayNotification(swss::SubscriberStateTable &ipHelpersTable, std::vector *vlans) - * - * @brief handles DHCPv6 relay configuration change notification - * - * @param ipHelpersTable DHCP table - * @param vlans list of vlans/argument config that contains strings of server and option - * - * @return none - */ -void handleRelayNotification(swss::SubscriberStateTable &ipHelpersTable, std::vector *vlans) -{ - std::deque entries; - - ipHelpersTable.pops(entries); - processRelayNotification(entries, vlans); -} - -/** - * @code void processRelayNotification(std::deque &entries, std::vector *vlans) - * - * @brief process DHCPv6 relay servers and options configuration change notification - * - * @param entries queue of std::tuple> entries in DHCP table - * @param vlans list of vlans/argument config that contains strings of server and option - * - * @return none - */ -void processRelayNotification(std::deque &entries, std::vector *vlans) -{ - std::vector servers; - - for (auto &entry: entries) { - std::string vlan = kfvKey(entry); - std::string operation = kfvOp(entry); - std::vector fieldValues = kfvFieldsValues(entry); - - relay_config intf; - intf.is_option_79 = true; - intf.interface = vlan; - intf.db = nullptr; - for (auto &fieldValue: fieldValues) { - std::string f = fvField(fieldValue); - std::string v = fvValue(fieldValue); - if(f == "dhcpv6_servers") { - std::stringstream ss(v); - while (ss.good()) { - std::string substr; - getline(ss, substr, ','); - intf.servers.push_back(substr); - } - syslog(LOG_DEBUG, "key: %s, Operation: %s, f: %s, v: %s", vlan.c_str(), operation.c_str(), f.c_str(), v.c_str()); - } - if(f == "dhcpv6_option|rfc6939_support" && v == "false") { - intf.is_option_79 = false; - } - } - vlans->push_back(intf); - } -} - -/** -*@code stopSwssNotificationPoll -* -*@brief stop SWSS listening thread -* -*@return none -*/ -void stopSwssNotificationPoll() { - pollSwssNotifcation = false; -}; diff --git a/src/dhcp6relay/src/configInterface.h b/src/dhcp6relay/src/configInterface.h deleted file mode 100644 index 20b0912c5cef..000000000000 --- a/src/dhcp6relay/src/configInterface.h +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include "subscriberstatetable.h" -#include "select.h" -#include "relay.h" - -/** - * @code void initialize_swss() - * - * @brief initialize DB tables and start SWSS listening thread - * - * @return none - */ -void initialize_swss(std::vector *vlans); - -/** - * @code void deinitialize_swss() - * - * @brief deinitialize DB interface and join SWSS listening thread - * - * @return none - */ -void deinitialize_swss(); - -/** - * @code void get_dhcp(std::vector *vlans) - * - * @brief initialize and get vlan information from DHCP_RELAY - * - * @return none - */ -void get_dhcp(std::vector *vlans); - -/** - * @code void handleSwssNotification(std::vector *vlans) - * - * @brief main thread for handling SWSS notification - * - * @param vlans list of vlans/argument config that contains strings of server and option - * - * @return none - */ -void handleSwssNotification(std::vector *vlans); - -/** - * @code void handleRelayNotification(swss::SubscriberStateTable &ipHelpersTable, std::vector *vlans) - * - * @brief handles DHCPv6 relay configuration change notification - * - * @param ipHelpersTable DHCP table - * @param vlans list of vlans/argument config that contains strings of server and option - * - * @return none - */ -void handleRelayNotification(swss::SubscriberStateTable &configMuxTable, std::vector *vlans); - -/** - * @code void processRelayNotification(std::deque &entries, std::vector *vlans) - * - * @brief process DHCPv6 relay servers and options configuration change notification - * - * @param entries queue of std::tuple> entries in DHCP table - * @param context list of vlans/argument config that contains strings of server and option - * - * @return none - */ -void processRelayNotification(std::deque &entries, std::vector *vlans); - -/** -*@code stopSwssNotificationPoll -* -*@brief stop SWSS listening thread -* -*@return none -*/ -void stopSwssNotificationPoll(); diff --git a/src/dhcp6relay/src/main.cpp b/src/dhcp6relay/src/main.cpp deleted file mode 100644 index 9f5bc74bcfa0..000000000000 --- a/src/dhcp6relay/src/main.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include "configInterface.h" - -int main(int argc, char *argv[]) { - try { - std::vector vlans; - swss::DBConnector state_db("STATE_DB", 0); - initialize_swss(&vlans); - loop_relay(&vlans, &state_db); - } - catch (std::exception &e) - { - syslog(LOG_ERR, "An exception occurred.\n"); - return 1; - } - return 0; -} diff --git a/src/dhcp6relay/src/relay.cpp b/src/dhcp6relay/src/relay.cpp deleted file mode 100644 index 4b3b4d4010bf..000000000000 --- a/src/dhcp6relay/src/relay.cpp +++ /dev/null @@ -1,861 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "configdb.h" -#include "sonicv2connector.h" -#include "dbconnector.h" -#include "configInterface.h" - - -struct event *listen_event; -struct event *server_listen_event; -struct event_base *base; -struct event *ev_sigint; -struct event *ev_sigterm; -static std::string counter_table = "DHCPv6_COUNTER_TABLE|"; - -/* DHCPv6 filter */ -/* sudo tcpdump -dd "ip6 dst ff02::1:2 && udp dst port 547" */ - -static struct sock_filter ether_relay_filter[] = { - - { 0x28, 0, 0, 0x0000000c }, - { 0x15, 0, 13, 0x000086dd }, - { 0x20, 0, 0, 0x00000026 }, - { 0x15, 0, 11, 0xff020000 }, - { 0x20, 0, 0, 0x0000002a }, - { 0x15, 0, 9, 0x00000000 }, - { 0x20, 0, 0, 0x0000002e }, - { 0x15, 0, 7, 0x00000000 }, - { 0x20, 0, 0, 0x00000032 }, - { 0x15, 0, 5, 0x00010002 }, - { 0x30, 0, 0, 0x00000014 }, - { 0x15, 0, 3, 0x00000011 }, - { 0x28, 0, 0, 0x00000038 }, - { 0x15, 0, 1, 0x00000223 }, - { 0x6, 0, 0, 0x00040000 }, - { 0x6, 0, 0, 0x00000000 }, -}; -const struct sock_fprog ether_relay_fprog = { - lengthof(ether_relay_filter), - ether_relay_filter -}; - -/* DHCPv6 Counter */ -uint64_t counters[DHCPv6_MESSAGE_TYPE_COUNT]; -std::map counterMap = {{DHCPv6_MESSAGE_TYPE_UNKNOWN, "Unknown"}, - {DHCPv6_MESSAGE_TYPE_SOLICIT, "Solicit"}, - {DHCPv6_MESSAGE_TYPE_ADVERTISE, "Advertise"}, - {DHCPv6_MESSAGE_TYPE_REQUEST, "Request"}, - {DHCPv6_MESSAGE_TYPE_CONFIRM, "Confirm"}, - {DHCPv6_MESSAGE_TYPE_RENEW, "Renew"}, - {DHCPv6_MESSAGE_TYPE_REBIND, "Rebind"}, - {DHCPv6_MESSAGE_TYPE_REPLY, "Reply"}, - {DHCPv6_MESSAGE_TYPE_RELEASE, "Release"}, - {DHCPv6_MESSAGE_TYPE_DECLINE, "Decline"}, - {DHCPv6_MESSAGE_TYPE_RECONFIGURE, "Reconfigure"}, - {DHCPv6_MESSAGE_TYPE_INFORMATION_REQUEST, "Information-Request"}, - {DHCPv6_MESSAGE_TYPE_RELAY_FORW, "Relay-Forward"}, - {DHCPv6_MESSAGE_TYPE_RELAY_REPL, "Relay-Reply"}, - {DHCPv6_MESSAGE_TYPE_MALFORMED, "Malformed"}}; - -/** - * @code void initialize_counter(swss::DBConnector *db, std::string counterVlan); - * - * @brief initialize the counter by each Vlan - * - * @param swss::DBConnector *db state_db connector - * @param counterVlan counter table with interface name - * - * @return none - */ -void initialize_counter(swss::DBConnector *db, std::string counterVlan) { - db->hset(counterVlan, "Unknown", toString(counters[DHCPv6_MESSAGE_TYPE_UNKNOWN])); - db->hset(counterVlan, "Solicit", toString(counters[DHCPv6_MESSAGE_TYPE_SOLICIT])); - db->hset(counterVlan, "Advertise", toString(counters[DHCPv6_MESSAGE_TYPE_ADVERTISE])); - db->hset(counterVlan, "Request", toString(counters[DHCPv6_MESSAGE_TYPE_REQUEST])); - db->hset(counterVlan, "Confirm", toString(counters[DHCPv6_MESSAGE_TYPE_CONFIRM])); - db->hset(counterVlan, "Renew", toString(counters[DHCPv6_MESSAGE_TYPE_RENEW])); - db->hset(counterVlan, "Rebind", toString(counters[DHCPv6_MESSAGE_TYPE_REBIND])); - db->hset(counterVlan, "Reply", toString(counters[DHCPv6_MESSAGE_TYPE_REPLY])); - db->hset(counterVlan, "Release", toString(counters[DHCPv6_MESSAGE_TYPE_RELEASE])); - db->hset(counterVlan, "Decline", toString(counters[DHCPv6_MESSAGE_TYPE_DECLINE])); - db->hset(counterVlan, "Reconfigure", toString(counters[DHCPv6_MESSAGE_TYPE_RECONFIGURE])); - db->hset(counterVlan, "Information-Request", toString(counters[DHCPv6_MESSAGE_TYPE_INFORMATION_REQUEST])); - db->hset(counterVlan, "Relay-Forward", toString(counters[DHCPv6_MESSAGE_TYPE_RELAY_FORW])); - db->hset(counterVlan, "Relay-Reply", toString(counters[DHCPv6_MESSAGE_TYPE_RELAY_REPL])); - db->hset(counterVlan, "Malformed", toString(counters[DHCPv6_MESSAGE_TYPE_MALFORMED])); -} - -/** - * @code void update_counter(swss::DBConnector *db, std::string CounterVlan, uint8_t msg_type); - * - * @brief update the counter in state_db with count of each DHCPv6 message type - * - * @param swss::DBConnector *db state_db connector - * @param counterVlan counter table with interface name - * @param msg_type dhcpv6 message type to be updated in counter - * - * @return none - */ -void update_counter(swss::DBConnector *db, std::string counterVlan, uint8_t msg_type) { - db->hset(counterVlan, counterMap.find(msg_type)->second, toString(counters[msg_type])); -} - -/** - * @code std::string toString(uint16_t count); - * - * @brief convert uint16_t to string - * - * @param count count of messages in counter - * - * @return count in string - */ -std::string toString(uint16_t count) { - std::stringstream ss; - ss << count; - std::string countValue = ss.str(); - return countValue; -} - -/** - * @code const struct ether_header *parse_ether_frame(const uint8_t *buffer, const uint8_t **out_end); - * - * @brief parse through ethernet frame - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return ether_header end of ethernet header position - */ -const struct ether_header *parse_ether_frame(const uint8_t *buffer, const uint8_t **out_end) { - (*out_end) = buffer + sizeof(struct ether_header); - return (const struct ether_header *)buffer; -} - -/** - * @code const struct ip6_hdr *parse_ip6_hdr(const uint8_t *buffer, const uint8_t **out_end); - * - * @brief parse through ipv6 header - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return ip6_hdr end of ipv6 header position - */ -const struct ip6_hdr *parse_ip6_hdr(const uint8_t *buffer, const uint8_t **out_end) { - (*out_end) = buffer + sizeof(struct ip6_hdr); - return (struct ip6_hdr *)buffer; -} - -/** - * @code const struct udphdr *parse_udp(const uint8_t *buffer, const uint8_t **out_end); - * - * @brief parse through udp header - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return udphdr end of udp header position - */ -const struct udphdr *parse_udp(const uint8_t *buffer, const uint8_t **out_end) { - (*out_end) = buffer + sizeof(struct udphdr); - return (const struct udphdr *)buffer; -} - -/** - * @code const struct dhcpv6_msg *parse_dhcpv6_hdr(const uint8_t *buffer); - * - * @brief parse through dhcpv6 header - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return dhcpv6_msg end of dhcpv6 header position - */ -const struct dhcpv6_msg *parse_dhcpv6_hdr(const uint8_t *buffer) { - return (const struct dhcpv6_msg *)buffer; -} - -/** - * @code const struct dhcpv6_relay_msg *parse_dhcpv6_relay(const uint8_t *buffer); - * - * @brief parse through dhcpv6 relay message - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return dhcpv6_relay_msg start of dhcpv6 relay message or end of dhcpv6 message type position - */ -const struct dhcpv6_relay_msg *parse_dhcpv6_relay(const uint8_t *buffer) { - return (const struct dhcpv6_relay_msg *)buffer; -} - -/** - * @code const struct dhcpv6_option *parse_dhcpv6_opt(const uint8_t *buffer, const uint8_t **out_end); - * - * @brief parse through dhcpv6 option - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return dhcpv6_option end of dhcpv6 message option - */ -const struct dhcpv6_option *parse_dhcpv6_opt(const uint8_t *buffer, const uint8_t **out_end) { - auto option = (const struct dhcpv6_option *)buffer; - uint8_t size = 4; // option-code + option-len - size += *(uint16_t *)(buffer); - (*out_end) = buffer + size + ntohs(option->option_length); - - return option; -} - -/** - * @code void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n, relay_config *config, uint8_t msg_type); - * - * @brief send udp packet - * - * @param *buffer message buffer - * @param sockaddr_in6 target target socket - * @param n length of message - * @param relay_config *config pointer to relay_config - * @param uint8_t msg_type message type of dhcpv6 option of relayed message - * - * @return dhcpv6_option end of dhcpv6 message option - */ -void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n, relay_config *config, uint8_t msg_type) { - std::string counterVlan = counter_table; - if(sendto(sock, buffer, n, 0, (const struct sockaddr *)&target, sizeof(target)) == -1) - syslog(LOG_ERR, "sendto: Failed to send to target address\n"); - else if (counterMap.find(msg_type) != counterMap.end()) { - counters[msg_type]++; - update_counter(config->db, counterVlan.append(config->interface), msg_type); - } else { - syslog(LOG_WARNING, "unexpected message type %d(0x%x)\n", msg_type, msg_type); - } -} - -/** - * @code relay_forward(uint8_t *buffer, const struct dhcpv6_msg *msg, uint16_t msg_length); - * - * @brief embed the DHCPv6 message received into DHCPv6 relay forward message - * - * @param buffer pointer to buffer - * @param msg pointer to parsed DHCPv6 message - * @param msg_length length of DHCPv6 message - * - * @return none - */ -void relay_forward(uint8_t *buffer, const struct dhcpv6_msg *msg, uint16_t msg_length) { - struct dhcpv6_option option; - option.option_code = htons(OPTION_RELAY_MSG); - option.option_length = htons(msg_length); - memcpy(buffer, &option, sizeof(struct dhcpv6_option)); - memcpy(buffer + sizeof(struct dhcpv6_option), msg, msg_length); -} - -/** - * @code sock_open(int ifindex, const struct sock_fprog *fprog); - * - * @brief prepare L2 socket to attach to "udp and port 547" filter - * - * @param ifindex interface index - * @param fprog bpf filter "udp and port 547" - * - * @return socket descriptor - */ -int sock_open(int ifindex, const struct sock_fprog *fprog) -{ - if (!ifindex) { - errno = EINVAL; - return -1; - } - - int s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); - if (s == -1) { - syslog(LOG_ERR, "socket: Failed to create socket\n"); - return -1; - } - - struct sockaddr_ll sll = { - .sll_family = AF_PACKET, - .sll_protocol = htons(ETH_P_ALL), - .sll_ifindex = ifindex - }; - - if (bind(s, (struct sockaddr *)&sll, sizeof sll) == -1) { - syslog(LOG_ERR, "bind: Failed to bind to specified interface\n"); - (void) close(s); - return -1; - } - - if (fprog && setsockopt(s, SOL_SOCKET, SO_ATTACH_FILTER, fprog, sizeof *fprog) == -1) - { - syslog(LOG_ERR, "setsockopt: Failed to attach filter\n"); - (void) close(s); - return -1; - } - - return s; -} - -/** - * @code prepare_relay_config(relay_config *interface_config, int local_sock, int filter); - * - * @brief prepare for specified relay interface config: server and link address - * - * @param interface_config pointer to relay config to be prepared - * @param local_sock L3 socket used for relaying messages - * @param filter socket attached with filter - * - * @return none - */ -void prepare_relay_config(relay_config *interface_config, int *local_sock, int filter) { - struct ifaddrs *ifa, *ifa_tmp; - sockaddr_in6 non_link_local; - sockaddr_in6 link_local; - - interface_config->local_sock = *local_sock; - interface_config->filter = filter; - - for(auto server: interface_config->servers) { - sockaddr_in6 tmp; - if(inet_pton(AF_INET6, server.c_str(), &tmp.sin6_addr) != 1) - { - syslog(LOG_WARNING, "inet_pton: Failed to convert IPv6 address\n"); - } - tmp.sin6_family = AF_INET6; - tmp.sin6_flowinfo = 0; - tmp.sin6_port = htons(RELAY_PORT); - tmp.sin6_scope_id = 0; - interface_config->servers_sock.push_back(tmp); - } - - if (getifaddrs(&ifa) == -1) { - syslog(LOG_WARNING, "getifaddrs: Unable to get network interfaces\n"); - exit(1); - } - - ifa_tmp = ifa; - while (ifa_tmp) { - if (ifa_tmp->ifa_addr->sa_family == AF_INET6) { - struct sockaddr_in6 *in6 = (struct sockaddr_in6*) ifa_tmp->ifa_addr; - if((strcmp(ifa_tmp->ifa_name, interface_config->interface.c_str()) == 0) && !IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { - non_link_local = *in6; - break; - } - if((strcmp(ifa_tmp->ifa_name, interface_config->interface.c_str()) == 0) && IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { - link_local = *in6; - } - } - ifa_tmp = ifa_tmp->ifa_next; - } - freeifaddrs(ifa); - - if(!IN6_IS_ADDR_LINKLOCAL(&non_link_local.sin6_addr)) { - interface_config->link_address = non_link_local; - } - else { - interface_config->link_address = link_local; - } -} - -/** - * @code prepare_socket(int *local_sock, int *server_sock, relay_config *config, int index); - * - * @brief prepare L3 socket for sending - * - * @param local_sock pointer to socket binded to global address for relaying client message to server and listening for server message - * @param server_sock pointer to socket binded to link_local address for relaying server message to client - * @param index scope id of interface - * - * @return none - */ -void prepare_socket(int *local_sock, int *server_sock, relay_config *config, int index) { - struct ifaddrs *ifa, *ifa_tmp; - sockaddr_in6 addr; - sockaddr_in6 ll_addr; - memset(&addr, 0, sizeof(addr)); - memset(&ll_addr, 0, sizeof(ll_addr)); - - if ((*local_sock = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) { - syslog(LOG_ERR, "socket: Failed to create socket on interface %s\n", config->interface.c_str()); - } - - if ((*server_sock= socket(AF_INET6, SOCK_DGRAM, 0)) == -1) { - syslog(LOG_ERR, "socket: Failed to create socket on interface %s\n", config->interface.c_str()); - } - - int retry = 0; - bool bind_addr = false; - bool bind_ll_addr = false; - do { - if (getifaddrs(&ifa) == -1) { - syslog(LOG_WARNING, "getifaddrs: Unable to get network interfaces with %s\n", strerror(errno)); - } - else { - ifa_tmp = ifa; - while (ifa_tmp) { - if ((ifa_tmp->ifa_addr->sa_family == AF_INET6) && (strcmp(ifa_tmp->ifa_name, config->interface.c_str()) == 0)) { - struct sockaddr_in6 *in6 = (struct sockaddr_in6*) ifa_tmp->ifa_addr; - if(!IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { - bind_addr = true; - in6->sin6_family = AF_INET6; - in6->sin6_port = htons(RELAY_PORT); - addr = *in6; - } - if(IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { - bind_ll_addr = true; - in6->sin6_family = AF_INET6; - in6->sin6_port = htons(RELAY_PORT); - ll_addr = *in6; - } - } - ifa_tmp = ifa_tmp->ifa_next; - } - freeifaddrs(ifa); - } - - if (bind_addr && bind_ll_addr) { - break; - } - - syslog(LOG_WARNING, "Retry #%d to bind to sockets on interface %s\n", ++retry, config->interface.c_str()); - sleep(5); - } while (retry < 6); - - if ((!bind_addr) || (bind(*local_sock, (sockaddr *)&addr, sizeof(addr)) == -1)) { - syslog(LOG_ERR, "bind: Failed to bind socket to global ipv6 address on interface %s after %d retries with %s\n", config->interface.c_str(), retry, strerror(errno)); - } - - if ((!bind_ll_addr) || (bind(*server_sock, (sockaddr *)&ll_addr, sizeof(addr)) == -1)) { - syslog(LOG_ERR, "bind: Failed to bind socket to link local ipv6 address on interface %s after %d retries with %s\n", config->interface.c_str(), retry, strerror(errno)); - } -} - - -/** - * @code relay_client(int sock, const uint8_t *msg, int32_t len, ip6_hdr *ip_hdr, const ether_header *ether_hdr, relay_config *config); - * - * @brief construct relay-forward message - * - * @param sock L3 socket for sending data to servers - * @param msg pointer to dhcpv6 message header position - * @param len size of data received - * @param ip_hdr pointer to IPv6 header - * @param ether_hdr pointer to Ethernet header - * @param config pointer to the relay interface config - * - * @return none - */ -void relay_client(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, const ether_header *ether_hdr, relay_config *config) { - static uint8_t buffer[4096]; - auto current_buffer_position = buffer; - dhcpv6_relay_msg new_message; - new_message.msg_type = DHCPv6_MESSAGE_TYPE_RELAY_FORW; - memcpy(&new_message.peer_address, &ip_hdr->ip6_src, sizeof(in6_addr)); - new_message.hop_count = 0; - - memcpy(&new_message.link_address, &config->link_address.sin6_addr, sizeof(in6_addr)); - memcpy(current_buffer_position, &new_message, sizeof(dhcpv6_relay_msg)); - current_buffer_position += sizeof(dhcpv6_relay_msg); - - if(config->is_option_79) { - linklayer_addr_option option79; - option79.link_layer_type = htons(1); - option79.option_code = htons(OPTION_CLIENT_LINKLAYER_ADDR); - option79.option_length = htons(2 + 6); // link_layer_type field + address - - memcpy(current_buffer_position, &option79, sizeof(linklayer_addr_option)); - current_buffer_position += sizeof(linklayer_addr_option); - - memcpy(current_buffer_position, ðer_hdr->ether_shost, sizeof(ether_hdr->ether_shost)); - current_buffer_position += sizeof(ether_hdr->ether_shost); - } - - auto dhcp_message_length = len; - relay_forward(current_buffer_position, parse_dhcpv6_hdr(msg), dhcp_message_length); - current_buffer_position += dhcp_message_length + sizeof(dhcpv6_option); - - for(auto server: config->servers_sock) { - send_udp(sock, buffer, server, current_buffer_position - buffer, config, new_message.msg_type); - } -} - -/** - * @code relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, relay_config *config) - * - * @brief construct a relay-forward message encapsulated relay-forward message - * - * @param sock L3 socket for sending data to servers - * @param msg pointer to dhcpv6 message header position - * @param len size of data received - * @param ip_hdr pointer to IPv6 header - * @param config pointer to the relay interface config - * - * @return none - */ -void relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, relay_config *config) { - static uint8_t buffer[4096]; - dhcpv6_relay_msg new_message; - auto current_buffer_position = buffer; - auto dhcp_relay_header = parse_dhcpv6_relay(msg); - - if (dhcp_relay_header->hop_count >= HOP_LIMIT) - return; - - new_message.msg_type = DHCPv6_MESSAGE_TYPE_RELAY_FORW; - memcpy(&new_message.peer_address, &ip_hdr->ip6_src, sizeof(in6_addr)); - new_message.hop_count = dhcp_relay_header->hop_count + 1; - - memset(&new_message.link_address, 0, sizeof(in6_addr)); - - memcpy(current_buffer_position, &new_message, sizeof(dhcpv6_relay_msg)); - current_buffer_position += sizeof(dhcpv6_relay_msg); - - auto dhcp_message_length = len; - relay_forward(current_buffer_position, parse_dhcpv6_hdr(msg), dhcp_message_length); - current_buffer_position += dhcp_message_length + sizeof(dhcpv6_option); - - for(auto server: config->servers_sock) { - send_udp(sock, buffer, server, current_buffer_position - buffer, config, new_message.msg_type); - } -} - -/** - * @code relay_relay_reply(int sock, const uint8_t *msg, int32_t len, relay_config *configs); - * - * @brief relay and unwrap a relay-reply message - * - * @param sock L3 socket for sending data to servers - * @param msg pointer to dhcpv6 message header position - * @param len size of data received - * @param config relay interface config - * - * @return none - */ - void relay_relay_reply(int sock, const uint8_t *msg, int32_t len, relay_config *config) { - static uint8_t buffer[4096]; - uint8_t type = 0; - struct sockaddr_in6 target_addr; - auto current_buffer_position = buffer; - auto current_position = msg; - const uint8_t *tmp = NULL; - auto dhcp_relay_header = parse_dhcpv6_relay(msg); - current_position += sizeof(struct dhcpv6_relay_msg); - - auto position = current_position + sizeof(struct dhcpv6_option); - auto dhcpv6msg = parse_dhcpv6_hdr(position); - - while ((current_position - msg) < len) { - auto option = parse_dhcpv6_opt(current_position, &tmp); - current_position = tmp; - if (current_position - msg > len || ntohs(option->option_length) > sizeof(buffer) - (current_buffer_position - buffer)) { - break; - } - switch (ntohs(option->option_code)) { - case OPTION_RELAY_MSG: - memcpy(current_buffer_position, ((uint8_t *)option) + sizeof(struct dhcpv6_option), ntohs(option->option_length)); - current_buffer_position += ntohs(option->option_length); - type = dhcpv6msg->msg_type; - break; - default: - break; - } - } - - memcpy(&target_addr.sin6_addr, &dhcp_relay_header->peer_address, sizeof(struct in6_addr)); - target_addr.sin6_family = AF_INET6; - target_addr.sin6_flowinfo = 0; - target_addr.sin6_port = htons(CLIENT_PORT); - target_addr.sin6_scope_id = if_nametoindex(config->interface.c_str()); - - send_udp(sock, buffer, target_addr, current_buffer_position - buffer, config, type); -} - - -/** - * @code callback(evutil_socket_t fd, short event, void *arg); - * - * @brief callback for libevent that is called everytime data is received at the filter socket - * - * @param fd filter socket - * @param event libevent triggered event - * @param arg callback argument provided by user - * - * @return none - */ -void callback(evutil_socket_t fd, short event, void *arg) { - struct relay_config *config = (struct relay_config *)arg; - static uint8_t message_buffer[4096]; - std::string counterVlan = counter_table; - int32_t len = recv(config->filter, message_buffer, 4096, 0); - if (len <= 0) { - syslog(LOG_WARNING, "recv: Failed to receive data at filter socket: %s\n", strerror(errno)); - return; - } - - char* ptr = (char *)message_buffer; - const uint8_t *current_position = (uint8_t *)ptr; - const uint8_t *tmp = NULL; - const uint8_t *prev = NULL; - - auto ether_header = parse_ether_frame(current_position, &tmp); - current_position = tmp; - - auto ip_header = parse_ip6_hdr(current_position, &tmp); - current_position = tmp; - - prev = current_position; - if (ip_header->ip6_ctlun.ip6_un1.ip6_un1_nxt != IPPROTO_UDP) { - const struct ip6_ext *ext_header; - do { - ext_header = (const struct ip6_ext *)current_position; - current_position += ext_header->ip6e_len; - if((current_position == prev) || (current_position >= (uint8_t *)ptr + sizeof(message_buffer))) { - return; - } - prev = current_position; - } - while (ext_header->ip6e_nxt != IPPROTO_UDP); - } - - auto udp_header = parse_udp(current_position, &tmp); - current_position = tmp; - - auto msg = parse_dhcpv6_hdr(current_position); - auto option_position = current_position + sizeof(struct dhcpv6_msg); - - switch (msg->msg_type) { - case DHCPv6_MESSAGE_TYPE_RELAY_FORW: - { - relay_relay_forw(config->local_sock, current_position, ntohs(udp_header->len) - sizeof(udphdr), ip_header, config); - break; - } - 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_INFORMATION_REQUEST: - { - while (option_position - message_buffer < len) { - auto option = parse_dhcpv6_opt(option_position, &tmp); - option_position = tmp; - if (ntohs(option->option_code) > DHCPv6_OPTION_LIMIT) { - counters[DHCPv6_MESSAGE_TYPE_MALFORMED]++; - update_counter(config->db, counterVlan.append(config->interface), DHCPv6_MESSAGE_TYPE_MALFORMED); - syslog(LOG_WARNING, "DHCPv6 option is invalid or contains malformed payload\n"); - return; - } - } - counters[msg->msg_type]++; - update_counter(config->db, counterVlan.append(config->interface), msg->msg_type); - relay_client(config->local_sock, current_position, ntohs(udp_header->len) - sizeof(udphdr), ip_header, ether_header, config); - break; - } - default: - { - syslog(LOG_WARNING, "DHCPv6 client message received was not relayed\n"); - break; - } - } -} - -/** - * @code void server_callback(evutil_socket_t fd, short event, void *arg); - * - * @brief callback for libevent that is called everytime data is received at the server socket - * - * @param fd filter socket - * @param event libevent triggered event - * @param arg callback argument provided by user - * - * @return none - */ -void server_callback(evutil_socket_t fd, short event, void *arg) { - struct relay_config *config = (struct relay_config *)arg; - sockaddr_in6 from; - socklen_t len = sizeof(from); - int32_t data = 0; - static uint8_t message_buffer[4096]; - - if ((data = recvfrom(config->local_sock, message_buffer, 4096, 0, (sockaddr *)&from, &len)) == -1) { - syslog(LOG_WARNING, "recv: Failed to receive data from server\n"); - } - - auto msg = parse_dhcpv6_hdr(message_buffer); - counters[msg->msg_type]++; - std::string counterVlan = counter_table; - update_counter(config->db, counterVlan.append(config->interface), msg->msg_type); - if (msg->msg_type == DHCPv6_MESSAGE_TYPE_RELAY_REPL) { - relay_relay_reply(config->server_sock, message_buffer, data, config); - } -} - -/** - * @code signal_init(); - * - * @brief initialize DHCPv6 Relay libevent signals - */ -int signal_init() { - int rv = -1; - do { - ev_sigint = evsignal_new(base, SIGINT, signal_callback, base); - if (ev_sigint == NULL) { - syslog(LOG_ERR, "Could not create SIGINT libevent signal\n"); - break; - } - - ev_sigterm = evsignal_new(base, SIGTERM, signal_callback, base); - if (ev_sigterm == NULL) { - syslog(LOG_ERR, "Could not create SIGTERM libevent signal\n"); - break; - } - rv = 0; - } while(0); - return rv; -} - -/** - * @code signal_start(); - * - * @brief start DHCPv6 Relay libevent base and add signals - */ -int signal_start() -{ - int rv = -1; - do - { - if (evsignal_add(ev_sigint, NULL) != 0) { - syslog(LOG_ERR, "Could not add SIGINT libevent signal\n"); - break; - } - - if (evsignal_add(ev_sigterm, NULL) != 0) { - syslog(LOG_ERR, "Could not add SIGTERM libevent signal\n"); - break; - } - - if (event_base_dispatch(base) != 0) { - syslog(LOG_ERR, "Could not start libevent dispatching loop\n"); - } - - rv = 0; - } while (0); - - return rv; -} - -/** - * @code signal_callback(fd, event, arg); - * - * @brief signal handler for dhcp6relay. Initiate shutdown when signal is caught - * - * @param fd libevent socket - * @param event event triggered - * @param arg pointer to libevent base - * - * @return none - */ -void signal_callback(evutil_socket_t fd, short event, void *arg) -{ - syslog(LOG_ALERT, "Received signal: '%s'\n", strsignal(fd)); - if ((fd == SIGTERM) || (fd == SIGINT)) { - dhcp6relay_stop(); - } -} - -/** - * @code dhcp6relay_stop(); - * - * @brief stop DHCPv6 Relay libevent loop upon signal - */ -void dhcp6relay_stop() -{ - event_base_loopexit(base, NULL); -} - -/** - * @code loop_relay(std::vector *vlans, swss::DBConnector *db); - * - * @brief main loop: configure sockets, create libevent base, start server listener thread - * - * @param vlans list of vlans retrieved from config_db - * @param db state_db connector - */ -void loop_relay(std::vector *vlans, swss::DBConnector *db) { - std::vector sockets; - base = event_base_new(); - if(base == NULL) { - syslog(LOG_ERR, "libevent: Failed to create base\n"); - } - - for(relay_config &vlan : *vlans) { - relay_config *config = &vlan; - int filter = 0; - int local_sock = 0; - int server_sock = 0; - int index = if_nametoindex(config->interface.c_str()); - config->db = db; - - std::string counterVlan = counter_table; - initialize_counter(config->db, counterVlan.append(config->interface)); - - filter = sock_open(index, ðer_relay_fprog); - prepare_socket(&local_sock, &server_sock, config, index); - - config->local_sock = local_sock; - config->server_sock = server_sock; - - sockets.push_back(filter); - sockets.push_back(local_sock); - sockets.push_back(server_sock); - - prepare_relay_config(config, &local_sock, filter); - - evutil_make_listen_socket_reuseable(filter); - evutil_make_socket_nonblocking(filter); - - evutil_make_listen_socket_reuseable(local_sock); - evutil_make_socket_nonblocking(local_sock); - - listen_event = event_new(base, filter, EV_READ|EV_PERSIST, callback, config); - server_listen_event = event_new(base, local_sock, EV_READ|EV_PERSIST, server_callback, config); - if (listen_event == NULL || server_listen_event == NULL) { - syslog(LOG_ERR, "libevent: Failed to create libevent\n"); - } - - event_add(listen_event, NULL); - event_add(server_listen_event, NULL); - } - - if((signal_init() == 0) && signal_start() == 0) { - shutdown(); - for(std::size_t i = 0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define PACKED __attribute__ ((packed)) - -#define RELAY_PORT 547 -#define CLIENT_PORT 546 -#define HOP_LIMIT 8 //HOP_LIMIT reduced from 32 to 8 as stated in RFC8415 -#define DHCPv6_OPTION_LIMIT 56 // DHCPv6 option code greater than 56 are currently unassigned - -#define lengthof(A) (sizeof (A) / sizeof (A)[0]) - -#define OPTION_RELAY_MSG 9 -#define OPTION_CLIENT_LINKLAYER_ADDR 79 - -/* DHCPv6 message types */ -typedef enum -{ - DHCPv6_MESSAGE_TYPE_UNKNOWN = 0, - 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_FORW = 12, - DHCPv6_MESSAGE_TYPE_RELAY_REPL = 13, - DHCPv6_MESSAGE_TYPE_MALFORMED = 14, - - DHCPv6_MESSAGE_TYPE_COUNT -} dhcp_message_type_t; - -struct relay_config { - int local_sock; - int server_sock; - int filter; - sockaddr_in6 link_address; - swss::DBConnector *db; - std::string interface; - std::vector servers; - std::vector servers_sock; - bool is_option_79; -}; - - -/* DHCPv6 messages and options */ - -struct dhcpv6_msg { - uint8_t msg_type; - uint8_t xid[3]; -}; - -struct PACKED dhcpv6_relay_msg { - uint8_t msg_type; - uint8_t hop_count; - struct in6_addr link_address; - struct in6_addr peer_address; -}; - - -struct dhcpv6_option { - uint16_t option_code; - uint16_t option_length; -}; - -struct linklayer_addr_option { - uint16_t option_code; - uint16_t option_length; - uint16_t link_layer_type; -}; - -/** - * @code sock_open(int ifindex, const struct sock_fprog *fprog); - * - * @brief prepare L2 socket to attach to "udp and port 547" filter - * - * @param ifindex interface index - * @param fprog bpf filter "udp and port 547" - * - * @return socket descriptor - */ -int sock_open(int ifindex, const struct sock_fprog *fprog); - -/** - * @code prepare_socket(int *local_sock, int *server_sock, relay_config *config, int index); - * - * @brief prepare L3 socket for sending - * - * @param local_sock pointer to socket binded to global address for relaying client message to server and listening for server message - * @param server_sock pointer to socket binded to link_local address for relaying server message to client - * @param index scope id of interface - * - * @return none - */ -void prepare_socket(int *local_sock, int *server_sock, relay_config *config, int index); - -/** - * @code prepare_relay_config(relay_config *interface_config, int local_sock, int filter); - * - * @brief prepare for specified relay interface config: server and link address - * - * @param interface_config pointer to relay config to be prepared - * @param local_sock L3 socket used for relaying messages - * @param filter socket attached with filter - * - * @return none - */ -void prepare_relay_config(relay_config *interface_config, int *local_sock, int filter); - -/** - * @code relay_forward(uint8_t *buffer, const struct dhcpv6_msg *msg, uint16_t msg_length); - * - * @brief embed the DHCPv6 message received into DHCPv6 relay forward message - * - * @param buffer pointer to buffer - * @param msg pointer to parsed DHCPv6 message - * @param msg_length length of DHCPv6 message - * - * @return none - */ -void relay_forward(uint8_t *buffer, const struct dhcpv6_msg *msg, uint16_t msg_length); - -/** - * @code relay_client(int sock, const uint8_t *msg, int32_t len, ip6_hdr *ip_hdr, const ether_header *ether_hdr, relay_config *config); - * - * @brief construct relay-forward message - * - * @param sock L3 socket for sending data to servers - * @param msg pointer to dhcpv6 message header position - * @param len size of data received - * @param ip_hdr pointer to IPv6 header - * @param ether_hdr pointer to Ethernet header - * @param config pointer to the relay interface config - * - * @return none - */ -void relay_client(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, const ether_header *ether_hdr, relay_config *config); - -/** - * @code relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, relay_config *config) - * - * @brief construct a relay-forward message encapsulated relay-forward message - * - * @param sock L3 socket for sending data to servers - * @param msg pointer to dhcpv6 message header position - * @param len size of data received - * @param ip_hdr pointer to IPv6 header - * @param config pointer to the relay interface config - * - * @return none - */ -void relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, relay_config *config); - -/** - * @code relay_relay_reply(int sock, const uint8_t *msg, int32_t len, relay_config *configs); - * - * @brief relay and unwrap a relay-reply message - * - * @param sock L3 socket for sending data to servers - * @param msg pointer to dhcpv6 message header position - * @param len size of data received - * @param config relay interface config - * - * @return none - */ -void relay_relay_reply(int sock, const uint8_t *msg, int32_t len, relay_config *configs); - -/** - * @code loop_relay(std::vector *vlans, swss::DBConnector *db); - * - * @brief main loop: configure sockets, create libevent base, start server listener thread - * - * @param vlans list of vlans retrieved from config_db - * @param db state_db connector - */ -void loop_relay(std::vector *vlans, swss::DBConnector *db); - -/** - * @code signal_init(); - * - * @brief initialize DHCPv6 Relay libevent signals - */ -int signal_init(); - -/** - * @code signal_start(); - * - * @brief start DHCPv6 Relay libevent base and add signals - */ -int signal_start(); - -/** - * @code dhcp6relay_stop(); - * - * @brief stop DHCPv6 Relay libevent loop upon signal - */ -void dhcp6relay_stop(); - -/** - * @code signal_callback(fd, event, arg); - * - * @brief signal handler for dhcp6relay. Initiate shutdown when signal is caught - * - * @param fd libevent socket - * @param event event triggered - * @param arg pointer to libevent base - * - * @return none - */ -void signal_callback(evutil_socket_t fd, short event, void *arg); - -/** - * @code shutdown(); - * - * @brief free signals and terminate threads - */ -void shutdown(); - -/** - * @code void initialize_counter(swss::DBConnector *db, std::string counterVlan); - * - * @brief initialize the counter by each Vlan - * - * @param swss::DBConnector *db state_db connector - * @param counterVlan counter table with interface name - * - * @return none - */ -void initialize_counter(swss::DBConnector *db, std::string counterVlan); - -/** - * @code void update_counter(swss::DBConnector *db, std::string CounterVlan, uint8_t msg_type); - * - * @brief update the counter in state_db with count of each DHCPv6 message type - * - * @param swss::DBConnector *db state_db connector - * @param counterVlan counter table with interface name - * @param msg_type dhcpv6 message type to be updated in counter - * - * @return none - */ -void update_counter(swss::DBConnector *db, std::string counterVlan, uint8_t msg_type); - -/* Helper functions */ - -/** - * @code std::string toString(uint16_t count); - * - * @brief convert uint16_t to string - * - * @param count count of messages in counter - * - * @return count in string - */ -std::string toString(uint16_t count); - -/** - * @code const struct ether_header *parse_ether_frame(const uint8_t *buffer, const uint8_t **out_end); - * - * @brief parse through ethernet frame - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return ether_header end of ethernet header position - */ -const struct ether_header *parse_ether_frame(const uint8_t *buffer, const uint8_t **out_end); - -/** - * @code const struct ip6_hdr *parse_ip6_hdr(const uint8_t *buffer, const uint8_t **out_end); - * - * @brief parse through ipv6 header - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return ip6_hdr end of ipv6 header position - */ -const struct ip6_hdr *parse_ip6_hdr(const uint8_t *buffer, const uint8_t **out_end); - -/** - * @code const struct udphdr *parse_udp(const uint8_t *buffer, const uint8_t **out_end); - * - * @brief parse through udp header - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return udphdr end of udp header position - */ -const struct udphdr *parse_udp(const uint8_t *buffer, const uint8_t **out_end); - -/** - * @code const struct dhcpv6_msg *parse_dhcpv6_hdr(const uint8_t *buffer); - * - * @brief parse through dhcpv6 header - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return dhcpv6_msg end of dhcpv6 header position - */ -const struct dhcpv6_msg *parse_dhcpv6_hdr(const uint8_t *buffer); - -/** - * @code const struct dhcpv6_relay_msg *parse_dhcpv6_relay(const uint8_t *buffer); - * - * @brief parse through dhcpv6 relay message - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return dhcpv6_relay_msg start of dhcpv6 relay message or end of dhcpv6 message type position - */ -const struct dhcpv6_relay_msg *parse_dhcpv6_relay(const uint8_t *buffer); - -/** - * @code const struct dhcpv6_option *parse_dhcpv6_opt(const uint8_t *buffer, const uint8_t **out_end); - * - * @brief parse through dhcpv6 option - * - * @param *buffer message buffer - * @param **out_end pointer - * - * @return dhcpv6_option end of dhcpv6 message option - */ -const struct dhcpv6_option *parse_dhcpv6_opt(const uint8_t *buffer, const uint8_t **out_end); - -/** - * @code void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n, relay_config *config, uint8_t msg_type); - * - * @brief send udp packet - * - * @param *buffer message buffer - * @param sockaddr_in6 target target socket - * @param n length of message - * @param relay_config *config pointer to relay_config - * @param uint8_t msg_type message type of dhcpv6 option of relayed message - * - * @return dhcpv6_option end of dhcpv6 message option - */ -void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n, relay_config *config, uint8_t msg_type); - diff --git a/src/dhcp6relay/src/subdir.mk b/src/dhcp6relay/src/subdir.mk deleted file mode 100644 index 1c93d490ec63..000000000000 --- a/src/dhcp6relay/src/subdir.mk +++ /dev/null @@ -1,23 +0,0 @@ -CC := g++ - -C_SRCS += \ -../src/relay.c \ -../src/configInterface.c \ -../src/main.c - -OBJS += \ -./src/relay.o \ -./src/configInterface.o \ -./src/main.o - -C_DEPS += \ -./src/relay.d \ -./src/configInterface.d \ -./src/main.d - -src/%.o: src/%.cpp - @echo 'Building file: $<' - @echo 'Invoking: GCC C++ Compiler' - $(CC) -D__FILENAME__="$(subst src/,,$<)" $(CFLAGS) -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" - @echo 'Finished building: $<' - @echo ' ' diff --git a/src/dhcprelay b/src/dhcprelay new file mode 160000 index 000000000000..6f94c2ededb3 --- /dev/null +++ b/src/dhcprelay @@ -0,0 +1 @@ +Subproject commit 6f94c2ededb39ef4cdab788e295a041b2aec12b4 diff --git a/src/linkmgrd b/src/linkmgrd index e7e00f2aac1e..58d8aae2db7e 160000 --- a/src/linkmgrd +++ b/src/linkmgrd @@ -1 +1 @@ -Subproject commit e7e00f2aac1e93e5bfe6a5e8edd415e343d2b442 +Subproject commit 58d8aae2db7ede644f6b0b48c8b6188c22d9028b diff --git a/src/sonic-bgpcfgd/bgpcfgd/main.py b/src/sonic-bgpcfgd/bgpcfgd/main.py index 7b4291b4d4a3..f777867eaacc 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/main.py +++ b/src/sonic-bgpcfgd/bgpcfgd/main.py @@ -18,6 +18,7 @@ from .managers_setsrc import ZebraSetSrc from .managers_static_rt import StaticRouteMgr from .managers_rm import RouteMapMgr +from .managers_device_global import DeviceGlobalCfgMgr from .runner import Runner, signal_handler from .template import TemplateFabric from .utils import read_constants @@ -64,6 +65,8 @@ def do_work(): # Route Advertisement Managers AdvertiseRouteMgr(common_objs, "STATE_DB", swsscommon.STATE_ADVERTISE_NETWORK_TABLE_NAME), RouteMapMgr(common_objs, "APPL_DB", swsscommon.APP_BGP_PROFILE_TABLE_NAME), + # Device Global Manager + DeviceGlobalCfgMgr(common_objs, "CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME), ] runner = Runner(common_objs['cfg_mgr']) for mgr in managers: @@ -96,3 +99,4 @@ def main(): sys.exit(rc) except SystemExit: os._exit(rc) + diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py index c787ae2abe69..55a16a273993 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py @@ -8,6 +8,7 @@ from .manager import Manager from .template import TemplateFabric from .utils import run_command +from .managers_device_global import DeviceGlobalCfgMgr class BGPPeerGroupMgr(object): @@ -23,6 +24,7 @@ def __init__(self, common_objs, base_template): tf = common_objs['tf'] self.policy_template = tf.from_file(base_template + "policies.conf.j2") self.peergroup_template = tf.from_file(base_template + "peer-group.conf.j2") + self.device_global_cfgmgr = DeviceGlobalCfgMgr(common_objs, "CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME) def update(self, name, **kwargs): """ @@ -56,14 +58,15 @@ def update_pg(self, name, **kwargs): """ try: pg = self.peergroup_template.render(**kwargs) + tsa_rm = self.device_global_cfgmgr.check_state_and_get_tsa_routemaps(pg) except jinja2.TemplateError as e: log_err("Can't render peer-group template: '%s': %s" % (name, str(e))) return False if kwargs['vrf'] == 'default': - cmd = ('router bgp %s\n' % kwargs['bgp_asn']) + pg + cmd = ('router bgp %s\n' % kwargs['bgp_asn']) + pg + tsa_rm else: - cmd = ('router bgp %s vrf %s\n' % (kwargs['bgp_asn'], kwargs['vrf'])) + pg + cmd = ('router bgp %s vrf %s\n' % (kwargs['bgp_asn'], kwargs['vrf'])) + pg + tsa_rm self.update_entity(cmd, "Peer-group for peer '%s'" % name) return True diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py b/src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py new file mode 100644 index 000000000000..1d30a5b94a64 --- /dev/null +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py @@ -0,0 +1,101 @@ +from .manager import Manager +from .log import log_err, log_debug, log_notice +import re +from swsscommon import swsscommon + +class DeviceGlobalCfgMgr(Manager): + """This class responds to change in device-specific state""" + + def __init__(self, common_objs, db, table): + """ + Initialize the object + :param common_objs: common object dictionary + :param db: name of the db + :param table: name of the table in the db + """ + self.directory = common_objs['directory'] + self.cfg_mgr = common_objs['cfg_mgr'] + self.constants = common_objs['constants'] + self.tsa_template = common_objs['tf'].from_file("bgpd/tsa/bgpd.tsa.isolate.conf.j2") + self.tsb_template = common_objs['tf'].from_file("bgpd/tsa/bgpd.tsa.unisolate.conf.j2") + super(DeviceGlobalCfgMgr, self).__init__( + common_objs, + [], + db, + table, + ) + + def set_handler(self, key, data): + log_debug("DeviceGlobalCfgMgr:: set handler") + """ Handle device tsa_enabled state change """ + if not data: + log_err("DeviceGlobalCfgMgr:: data is None") + return False + + if "tsa_enabled" in data: + self.cfg_mgr.commit() + self.cfg_mgr.update() + self.isolate_unisolate_device(data["tsa_enabled"]) + self.directory.put(self.db_name, self.table_name, "tsa_enabled", data["tsa_enabled"]) + return True + return False + + def del_handler(self, key): + log_debug("DeviceGlobalCfgMgr:: del handler") + return True + + def check_state_and_get_tsa_routemaps(self, cfg): + """ API to get TSA route-maps if device is isolated""" + cmd = "" + if self.directory.path_exist("CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME, "tsa_enabled"): + tsa_status = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME)["tsa_enabled"] + if tsa_status == "true": + cmds = cfg.replace("#012", "\n").split("\n") + log_notice("DeviceGlobalCfgMgr:: Device is isolated. Applying TSA route-maps") + cmd = self.get_ts_routemaps(cmds, self.tsa_template) + return cmd + + def isolate_unisolate_device(self, tsa_status): + """ API to get TSA/TSB route-maps and apply configuration""" + cmd = "\n" + if tsa_status == "true": + log_notice("DeviceGlobalCfgMgr:: Device isolated. Executing TSA") + cmd += self.get_ts_routemaps(self.cfg_mgr.get_text(), self.tsa_template) + else: + log_notice("DeviceGlobalCfgMgr:: Device un-isolated. Executing TSB") + cmd += self.get_ts_routemaps(self.cfg_mgr.get_text(), self.tsb_template) + + self.cfg_mgr.push(cmd) + log_debug("DeviceGlobalCfgMgr::Done") + + def get_ts_routemaps(self, cmds, ts_template): + if not cmds: + return "" + + route_map_names = self.__extract_out_route_map_names(cmds) + return self.__generate_routemaps_from_template(route_map_names, ts_template) + + def __generate_routemaps_from_template(self, route_map_names, template): + cmd = "\n" + for rm in sorted(route_map_names): + if "_INTERNAL_" in rm: + continue + if "V4" in rm: + ipv="V4" ; ipp="ip" + elif "V6" in rm: + ipv="V6" ; ipp="ipv6" + else: + continue + cmd += template.render(route_map_name=rm,ip_version=ipv,ip_protocol=ipp, constants=self.constants) + cmd += "\n" + return cmd + + def __extract_out_route_map_names(self, cmds): + route_map_names = set() + out_route_map = re.compile(r'^\s*neighbor \S+ route-map (\S+) out$') + for line in cmds: + result = out_route_map.match(line) + if result: + route_map_names.add(result.group(1)) + return route_map_names + diff --git a/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_all_isolate.conf b/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_all_isolate.conf new file mode 100644 index 000000000000..a078dadd6f04 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_all_isolate.conf @@ -0,0 +1,33 @@ +! +! template: bgpd/templates/general/peer-group.conf.j2 +! + neighbor PEER_V4 peer-group + neighbor PEER_V6 peer-group + address-family ipv4 + neighbor PEER_V4 allowas-in 1 + neighbor PEER_V4 soft-reconfiguration inbound + neighbor PEER_V4 route-map FROM_BGP_PEER_V4 in + neighbor PEER_V4 route-map TO_BGP_PEER_V4 out + exit-address-family + address-family ipv6 + neighbor PEER_V6 allowas-in 1 + neighbor PEER_V6 soft-reconfiguration inbound + neighbor PEER_V6 route-map FROM_BGP_PEER_V6 in + neighbor PEER_V6 route-map TO_BGP_PEER_V6 out + exit-address-family +! +! end of template: bgpd/templates/general/peer-group.conf.j2 +! + + +route-map TO_BGP_PEER_V4 permit 20 + match ip address prefix-list PL_LoopbackV4 + set community 12345:12345 +route-map TO_BGP_PEER_V4 deny 30 +! +route-map TO_BGP_PEER_V6 permit 20 + match ipv6 address prefix-list PL_LoopbackV6 + set community 12345:12345 +route-map TO_BGP_PEER_V6 deny 30 +! + diff --git a/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_all_unisolate.conf b/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_all_unisolate.conf new file mode 100644 index 000000000000..1cd4442f4f3d --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_all_unisolate.conf @@ -0,0 +1,29 @@ +! +! template: bgpd/templates/general/peer-group.conf.j2 +! + neighbor PEER_V4 peer-group + neighbor PEER_V6 peer-group + address-family ipv4 + neighbor PEER_V4 allowas-in 1 + neighbor PEER_V4 soft-reconfiguration inbound + neighbor PEER_V4 route-map FROM_BGP_PEER_V4 in + neighbor PEER_V4 route-map TO_BGP_PEER_V4 out + exit-address-family + address-family ipv6 + neighbor PEER_V6 allowas-in 1 + neighbor PEER_V6 soft-reconfiguration inbound + neighbor PEER_V6 route-map FROM_BGP_PEER_V6 in + neighbor PEER_V6 route-map TO_BGP_PEER_V6 out + exit-address-family +! +! end of template: bgpd/templates/general/peer-group.conf.j2 +! + + +no route-map TO_BGP_PEER_V4 permit 20 +no route-map TO_BGP_PEER_V4 deny 30 +! +no route-map TO_BGP_PEER_V6 permit 20 +no route-map TO_BGP_PEER_V6 deny 30 +! + diff --git a/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_isolate.conf b/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_isolate.conf new file mode 100644 index 000000000000..902b8cfcdab9 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_isolate.conf @@ -0,0 +1,11 @@ + +route-map TO_BGP_PEER_V4 permit 20 + match ip address prefix-list PL_LoopbackV4 + set community 12345:12345 +route-map TO_BGP_PEER_V4 deny 30 +! +route-map TO_BGP_PEER_V6 permit 20 + match ipv6 address prefix-list PL_LoopbackV6 + set community 12345:12345 +route-map TO_BGP_PEER_V6 deny 30 +! diff --git a/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_unisolate.conf b/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_unisolate.conf new file mode 100644 index 000000000000..8fd9fde7f759 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/general/peer-group.conf/result_unisolate.conf @@ -0,0 +1,7 @@ + +no route-map TO_BGP_PEER_V4 permit 20 +no route-map TO_BGP_PEER_V4 deny 30 +! +no route-map TO_BGP_PEER_V6 permit 20 +no route-map TO_BGP_PEER_V6 deny 30 +! diff --git a/src/sonic-bgpcfgd/tests/test_device_global.py b/src/sonic-bgpcfgd/tests/test_device_global.py new file mode 100644 index 000000000000..eae1ff424e1f --- /dev/null +++ b/src/sonic-bgpcfgd/tests/test_device_global.py @@ -0,0 +1,107 @@ +from unittest.mock import MagicMock, patch + +import os +from bgpcfgd.directory import Directory +from bgpcfgd.template import TemplateFabric +from . import swsscommon_test +from .util import load_constants +import bgpcfgd.managers_device_global +from swsscommon import swsscommon + +TEMPLATE_PATH = os.path.abspath('../../dockers/docker-fpm-frr/frr') +BASE_PATH = os.path.abspath('../sonic-bgpcfgd/tests/data/general/peer-group.conf/') + +def constructor(): + cfg_mgr = MagicMock() + def get_text(): + text = [] + for line in cfg_mgr.changes.split('\n'): + if line.lstrip().startswith('!'): + continue + text.append(line) + text += [" "] + return text + def update(): + cfg_mgr.changes = get_string_from_file("/result_all.conf") + def push(cfg): + cfg_mgr.changes += cfg + "\n" + def get_config(): + return cfg_mgr.changes + cfg_mgr.get_text = get_text + cfg_mgr.update = update + cfg_mgr.push = push + cfg_mgr.get_config = get_config + + constants = load_constants()['constants'] + common_objs = { + 'directory': Directory(), + 'cfg_mgr': cfg_mgr, + 'tf': TemplateFabric(TEMPLATE_PATH), + 'constants': constants + } + mgr = bgpcfgd.managers_device_global.DeviceGlobalCfgMgr(common_objs, "CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME) + cfg_mgr.update() + return mgr + + +@patch('bgpcfgd.managers_device_global.log_debug') +def test_isolate_device(mocked_log_info): + m = constructor() + res = m.set_handler("STATE", {"tsa_enabled": "true"}) + assert res, "Expect True return value for set_handler" + mocked_log_info.assert_called_with("DeviceGlobalCfgMgr::Done") + assert m.cfg_mgr.get_config() == get_string_from_file("/result_all_isolate.conf") + +@patch('bgpcfgd.managers_device_global.log_debug') +def test_unisolate_device(mocked_log_info): + m = constructor() + res = m.set_handler("STATE", {"tsa_enabled": "false"}) + assert res, "Expect True return value for set_handler" + mocked_log_info.assert_called_with("DeviceGlobalCfgMgr::Done") + assert m.cfg_mgr.get_config() == get_string_from_file("/result_all_unisolate.conf") + +def test_check_state_and_get_tsa_routemaps(): + m = constructor() + m.set_handler("STATE", {"tsa_enabled": "true"}) + res = m.check_state_and_get_tsa_routemaps(m.cfg_mgr.get_config()) + assert res == get_string_from_file("/result_isolate.conf") + + m.set_handler("STATE", {"tsa_enabled": "false"}) + res = m.check_state_and_get_tsa_routemaps(m.cfg_mgr.get_config()) + assert res == "" + +def test_get_tsa_routemaps(): + m = constructor() + assert m.get_ts_routemaps([], m.tsa_template) == "" + + res = m.get_ts_routemaps(m.cfg_mgr.get_text(), m.tsa_template) + expected_res = get_string_from_file("/result_isolate.conf") + assert res == expected_res + +def test_get_tsb_routemaps(): + m = constructor() + assert m.get_ts_routemaps([], m.tsb_template) == "" + + res = m.get_ts_routemaps(m.cfg_mgr.get_text(), m.tsb_template) + expected_res = get_string_from_file("/result_unisolate.conf") + assert res == expected_res + +def get_string_from_file(filename): + fp = open(BASE_PATH + filename, "r") + cfg = fp.read() + fp.close() + + return cfg + +@patch('bgpcfgd.managers_device_global.log_err') +def test_set_handler_failure_case(mocked_log_info): + m = constructor() + res = m.set_handler("STATE", {}) + assert res == False, "Expect False return value for invalid data passed to set_handler" + mocked_log_info.assert_called_with("DeviceGlobalCfgMgr:: data is None") + +def test_del_handler(): + m = constructor() + res = m.del_handler("STATE") + assert res, "Expect True return value for del_handler" + diff --git a/src/sonic-build-hooks/hooks/apt-get b/src/sonic-build-hooks/hooks/apt-get index bdff703d01d7..068293a3e352 100755 --- a/src/sonic-build-hooks/hooks/apt-get +++ b/src/sonic-build-hooks/hooks/apt-get @@ -20,7 +20,7 @@ if [ "$INSTALL" == y ]; then [ "$lock_result" == y ] && release_apt_installation_lock exit $command_result else - if [[ "$1" == "purge" || "$@" == *" purge "* ]]; then + if [[ "$1" == "purge" || "$@" == *" purge "* || "$@" == *" remove "* ]]; then # When running the purge command, collect the debian versions dpkg-query -W -f '${Package}==${Version}\n' >> $POST_VERSION_PATH/purge-versions-deb chmod a+wr $POST_VERSION_PATH/purge-versions-deb diff --git a/src/sonic-build-hooks/scripts/post_run_buildinfo b/src/sonic-build-hooks/scripts/post_run_buildinfo index e0d84d35bb08..97f47f7efcf1 100755 --- a/src/sonic-build-hooks/scripts/post_run_buildinfo +++ b/src/sonic-build-hooks/scripts/post_run_buildinfo @@ -11,3 +11,6 @@ rm -rf $BUILD_VERSION_PATH/* # Disable the build hooks symlink_build_hooks -d set_reproducible_mirrors -d + +# Remove the version deb preference +rm -f $VERSION_DEB_PREFERENCE diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2bcef2232aef..a05880e5225e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -10,6 +10,7 @@ from lxml import etree as ET from lxml.etree import QName +from natsort import natsorted, ns as natsortns from portconfig import get_port_config from sonic_py_common.interface import backplane_prefix @@ -185,6 +186,7 @@ def formulate_fine_grained_ecmp(version, dpg_ecmp_content, port_device_map, port fine_grained_content = {"FG_NHG_MEMBER": FG_NHG_MEMBER, "FG_NHG": FG_NHG, "NEIGH": NEIGH} return fine_grained_content + def parse_png(png, hname, dpg_ecmp_content = None): neighbors = {} devices = {} @@ -400,9 +402,9 @@ def parse_asic_png(png, asic_name, hostname): device_data['lo_addr_v6']= lo_prefix_v6 devices[name] = device_data - return (neighbors, devices, port_speeds) + def parse_loopback_intf(child): lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) lo_intfs = {} @@ -412,6 +414,7 @@ def parse_loopback_intf(child): lo_intfs[(intfname, ipprefix)] = {} return lo_intfs + def parse_dpg(dpg, hname): aclintfs = None mgmtintfs = None @@ -455,7 +458,7 @@ def parse_dpg(dpg, hname): ipprefix = ipintf.find(str(QName(ns, "Prefix"))).text intfs[(intfname, ipprefix)] = {} ip_intfs_map[ipprefix] = intfalias - lo_intfs = parse_loopback_intf(child) + lo_intfs = parse_loopback_intf(child) subintfs = child.find(str(QName(ns, "SubInterfaces"))) if subintfs is not None: @@ -757,7 +760,6 @@ def parse_dpg(dpg, hname): return None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None - def parse_host_loopback(dpg, hname): for child in dpg: hostname = child.find(str(QName(ns, "Hostname"))) @@ -766,6 +768,7 @@ def parse_host_loopback(dpg, hname): lo_intfs = parse_loopback_intf(child) return lo_intfs + def parse_cpg(cpg, hname, local_devices=[]): bgp_sessions = {} bgp_internal_sessions = {} @@ -891,6 +894,9 @@ def parse_meta(meta, hname): max_cores = None kube_data = {} macsec_profile = {} + redundancy_type = None + qos_profile = None + device_metas = meta.find(str(QName(ns, "Devices"))) for device in device_metas.findall(str(QName(ns1, "DeviceMetadata"))): if device.find(str(QName(ns1, "Name"))).text.lower() == hname.lower(): @@ -933,7 +939,11 @@ def parse_meta(meta, hname): kube_data["ip"] = value elif name == 'MacSecProfile': macsec_profile = parse_macsec_profile(value) - return syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile + elif name == "RedundancyType": + redundancy_type = value + elif name == "SonicQosProfile": + qos_profile = value + return syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile, redundancy_type, qos_profile def parse_system_defaults(meta): @@ -958,7 +968,6 @@ def parse_system_defaults(meta): return system_default_values - def parse_linkmeta(meta, hname): link = meta.find(str(QName(ns, "Link"))) linkmetas = {} @@ -1167,7 +1176,26 @@ def parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_m # ############################################################################### -def filter_acl_table_bindings(acls, neighbors, port_channels, sub_role): +def filter_acl_table_for_backend(acls, vlan_members): + filter_acls = {} + for acl_name, value in acls.items(): + if 'everflow' not in acl_name.lower(): + filter_acls[acl_name] = value + + ports = set() + for vlan, member in vlan_members: + ports.add(member) + filter_acls['DATAACL'] = { 'policy_desc': 'DATAACL', + 'stage': 'ingress', + 'type': 'L3', + 'ports': list(ports) + } + return filter_acls + +def filter_acl_table_bindings(acls, neighbors, port_channels, sub_role, device_type, is_storage_device, vlan_members): + if device_type == 'BackEndToRRouter' and is_storage_device: + return filter_acl_table_for_backend(acls, vlan_members) + filter_acls = {} # If the asic role is BackEnd no ACL Table (Ctrl/Data/Everflow) is binded. @@ -1240,6 +1268,31 @@ def enable_internal_bgp_session(bgp_sessions, filename, asic_name): (local_sub_role == BACKEND_ASIC_SUB_ROLE and peer_sub_role == FRONTEND_ASIC_SUB_ROLE)): bgp_sessions[peer_ip].update({'admin_status': 'up'}) +def select_mmu_profiles(profile, platform, hwsku): + """ + Select MMU files based on the device metadata attribute - SonicQosProfile + if no QosProfile exists in the minigraph, then no action is needed. + if a profile exists in the minigraph, + - create a dir path to search 1 level down from the base path. + - if no such dir path exists, no action is needed. + - if a dir path exists, check for the presence of each file from + the copy list in the dir path and copy it over to the base path. + """ + if not profile: + return + + files_to_copy = ['pg_profile_lookup.ini', 'qos.json.j2', 'buffers_defaults_t0.j2', 'buffers_defaults_t1.j2'] + + path = os.path.join('/usr/share/sonic/device', platform, hwsku) + + dir_path = os.path.join(path, profile) + if os.path.exists(dir_path): + for file_item in files_to_copy: + file_in_dir = os.path.join(dir_path, file_item) + if os.path.isfile(file_in_dir): + base_file = os.path.join(path, file_item) + exec_cmd("sudo cp {} {}".format(file_in_dir, base_file)) + ############################################################################### # # Main functions @@ -1313,6 +1366,8 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw static_routes = {} system_defaults = {} macsec_profile = {} + redundancy_type = None + qos_profile = None hwsku_qn = QName(ns, "HwSku") hostname_qn = QName(ns, "Hostname") @@ -1343,7 +1398,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _, _, _) = parse_png(child, hostname, None) elif child.tag == str(QName(ns, "MetadataDeclaration")): - (syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile) = parse_meta(child, hostname) + (syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile, redundancy_type, qos_profile) = parse_meta(child, hostname) elif child.tag == str(QName(ns, "LinkMetadataDeclaration")): linkmetas = parse_linkmeta(child, hostname) elif child.tag == str(QName(ns, "DeviceInfos")): @@ -1367,6 +1422,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw elif child.tag == str(QName(ns, "SystemDefaultsDeclaration")): system_defaults = parse_system_defaults(child) + select_mmu_profiles(qos_profile, platform, hwsku) # set the host device type in asic metadata also device_type = [devices[key]['type'] for key in devices if key.lower() == hostname.lower()][0] if asic_name is None: @@ -1459,7 +1515,8 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results['MGMT_INTERFACE'] = {} mgmt_intf_count = 0 mgmt_alias_reverse_mapping = {} - for key in mgmt_intf: + sorted_keys = natsorted(mgmt_intf.keys(), alg=natsortns.IGNORECASE, key=lambda x : "|".join(x)) + for key in sorted_keys: alias = key[0] if alias in mgmt_alias_reverse_mapping: name = mgmt_alias_reverse_mapping[alias] @@ -1567,11 +1624,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw if macsec_enabled and 'PrimaryKey' in macsec_profile: port['macsec'] = macsec_profile['PrimaryKey'] - # If connected to a smart cable, get the connection position - for port_name, port in ports.items(): - if port_name in mux_cable_ports: - port['mux_cable'] = "true" - # set port description if parsed from deviceinfo for port_name in port_descriptions: # ignore port not in port_config.ini @@ -1713,7 +1765,13 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw # Add src_ip and qos remapping config into TUNNEL table if tunnel_qos_remap is enabled results['TUNNEL'] = get_tunnel_entries(tunnel_intfs, tunnel_intfs_qos_remap_config, lo_intfs, system_defaults.get('tunnel_qos_remap', {}), mux_tunnel_name, peer_switch_ip) - results['MUX_CABLE'] = get_mux_cable_entries(mux_cable_ports, neighbors, devices) + active_active_ports = get_ports_in_active_active(root, devices, neighbors) + results['MUX_CABLE'] = get_mux_cable_entries(ports, mux_cable_ports, active_active_ports, neighbors, devices, redundancy_type) + + # If connected to a smart cable, get the connection position + for port_name, port in results['PORT'].items(): + if port_name in results['MUX_CABLE']: + port['mux_cable'] = "true" if static_routes: results['STATIC_ROUTE'] = static_routes @@ -1734,7 +1792,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results['DHCP_RELAY'] = dhcp_relay_table results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers) results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers) - results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role) + results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role, current_device['type'], is_storage_device, vlan_members) results['FEATURE'] = { 'telemetry': { 'state': 'enabled' @@ -1826,46 +1884,76 @@ def get_tunnel_entries(tunnel_intfs, tunnel_intfs_qos_remap_config, lo_intfs, tu return tunnels -def get_mux_cable_entries(mux_cable_ports, neighbors, devices): + +def get_ports_in_active_active(root, devices, neighbors): + """Parse out ports in active-active cable type.""" + servers = {hostname.lower(): device_data for hostname, device_data in devices.items() if device_data["type"] == "Server"} + ports_in_active_active = {} + dpg_section = root.find(str(QName(ns, "DpgDec"))) + neighbor_to_port_mapping = {neighbor["name"].lower(): port for port, neighbor in neighbors.items()} + if dpg_section is not None: + for child in dpg_section: + hostname = child.find(str(QName(ns, "Hostname"))) + if hostname is None: + continue + hostname = hostname.text.lower() + if hostname not in servers: + continue + lo_intfs = parse_loopback_intf(child) + soc_intfs = {} + for intfname, ipprefix in lo_intfs.keys(): + intfname_lower = intfname.lower() + if hostname + "soc" == intfname_lower: + ipprefix = str(ipaddress.ip_network(UNICODE_TYPE(ipprefix.split("/")[0]))) + if "." in ipprefix: + soc_intfs["soc_ipv4"] = ipprefix + elif ":" in ipprefix: + soc_intfs["soc_ipv6"] = ipprefix + if hostname in neighbor_to_port_mapping and soc_intfs: + ports_in_active_active[neighbor_to_port_mapping[hostname]] = soc_intfs + return ports_in_active_active + + +def get_mux_cable_entries(ports, mux_cable_ports, active_active_ports, neighbors, devices, redundancy_type): mux_cable_table = {} + if redundancy_type: + redundancy_type = redundancy_type.lower() + + for port in ports: + is_active_active = redundancy_type in ("libra", "mixed") and port in active_active_ports + is_active_standby = port in mux_cable_ports + if is_active_active and is_active_standby: + print("Warning: skip %s as it is defined as active-standby and actie-active" % port, file=sys.stderr) + continue + if not (is_active_active or is_active_standby): + continue - for intf, cable_name in mux_cable_ports.items(): - if intf in neighbors: - entry = {} - neighbor = neighbors[intf]['name'] - entry['state'] = 'auto' - - if devices[neighbor]['lo_addr'] is not None: - # Always force a /32 prefix for server IPv4 loopbacks - server_ipv4_lo_addr = devices[neighbor]['lo_addr'].split("/")[0] - server_ipv4_lo_prefix = ipaddress.ip_network(UNICODE_TYPE(server_ipv4_lo_addr)) - entry['server_ipv4'] = str(server_ipv4_lo_prefix) - - if 'lo_addr_v6' in devices[neighbor] and devices[neighbor]['lo_addr_v6'] is not None: - server_ipv6_lo_addr = devices[neighbor]['lo_addr_v6'].split('/')[0] - server_ipv6_lo_prefix = ipaddress.ip_network(UNICODE_TYPE(server_ipv6_lo_addr)) - entry['server_ipv6'] = str(server_ipv6_lo_prefix) - mux_cable_table[intf] = entry - else: - print("Warning: no server IPv4 loopback found for {}, skipping mux cable table entry".format(neighbor), file=sys.stderr) + entry = {} + neighbor = neighbors[port]['name'] + entry['state'] = 'auto' - if cable_name in devices: - cable_type = devices[cable_name].get('subtype') - if cable_type is None: - continue - if cable_type in dualtor_cable_types: - mux_cable_table[intf]['cable_type'] = cable_type - if cable_type == 'active-active': - soc_ipv4 = devices[cable_name]['lo_addr'].split('/')[0] - soc_ipv4_prefix = ipaddress.ip_network(UNICODE_TYPE(soc_ipv4)) - mux_cable_table[intf]['soc_ipv4'] = str(soc_ipv4_prefix) - else: - print("Warning: skip parsing device %s for mux cable entry, cable type %s not supported" % (cable_name, cable_type), file=sys.stderr) + if devices[neighbor]['lo_addr'] is not None: + # Always force a /32 prefix for server IPv4 loopbacks + server_ipv4_lo_addr = devices[neighbor]['lo_addr'].split("/")[0] + server_ipv4_lo_prefix = ipaddress.ip_network(UNICODE_TYPE(server_ipv4_lo_addr)) + entry['server_ipv4'] = str(server_ipv4_lo_prefix) + + if 'lo_addr_v6' in devices[neighbor] and devices[neighbor]['lo_addr_v6'] is not None: + server_ipv6_lo_addr = devices[neighbor]['lo_addr_v6'].split('/')[0] + server_ipv6_lo_prefix = ipaddress.ip_network(UNICODE_TYPE(server_ipv6_lo_addr)) + entry['server_ipv6'] = str(server_ipv6_lo_prefix) + + if is_active_active: + entry['cable_type'] = 'active-active' + entry.update(active_active_ports[port]) + + mux_cable_table[port] = entry else: - print("Warning: skip parsing device %s for mux cable entry, device definition not found" % cable_name, file=sys.stderr) + print("Warning: no server IPv4 loopback found for {}, skipping mux cable table entry".format(neighbor), file=sys.stderr) return mux_cable_table + def parse_device_desc_xml(filename): root = ET.parse(filename).getroot() (lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, hostname, hwsku, d_type, _, _, _) = parse_device(root) diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 50cd296dccd1..aa340995b60b 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -7,7 +7,7 @@ dependencies = [ 'bitarray==1.5.3', 'ipaddress==1.0.23', - 'lxml==4.6.5', + 'lxml==4.9.1', 'netaddr==0.8.0', 'pyyaml==5.4.1', 'sonic-py-common', diff --git a/src/sonic-config-engine/tests/data/backend_acl/acl_multi_vlan.json b/src/sonic-config-engine/tests/data/backend_acl/acl_multi_vlan.json new file mode 100644 index 000000000000..53cd50d0f2d1 --- /dev/null +++ b/src/sonic-config-engine/tests/data/backend_acl/acl_multi_vlan.json @@ -0,0 +1,59 @@ + +{ + "acl": { + "acl-sets": { + "acl-set": { + "DATAACL": { + "acl-entries": { + "acl-entry": { + "1": { + "config": { + "sequence-id": 1 + }, + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "l2": { + "config": { + "vlan_id": "1000" + } + }, + "input_interface": { + "interface_ref": { + "config": { + "interface": "Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76" + } + } + } + + }, "2": { + "config": { + "sequence-id": 2 + }, + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "l2": { + "config": { + "vlan_id": "2000" + } + }, + "input_interface": { + "interface_ref": { + "config": { + "interface": "Ethernet4,Ethernet8" + } + } + } + + } } + } + } + } + } + } +} diff --git a/src/sonic-config-engine/tests/data/backend_acl/acl_single_vlan.json b/src/sonic-config-engine/tests/data/backend_acl/acl_single_vlan.json new file mode 100644 index 000000000000..86dcc80d08d1 --- /dev/null +++ b/src/sonic-config-engine/tests/data/backend_acl/acl_single_vlan.json @@ -0,0 +1,38 @@ + +{ + "acl": { + "acl-sets": { + "acl-set": { + "DATAACL": { + "acl-entries": { + "acl-entry": { + "1": { + "config": { + "sequence-id": 1 + }, + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "l2": { + "config": { + "vlan_id": "1000" + } + }, + "input_interface": { + "interface_ref": { + "config": { + "interface": "Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet4,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet8" + } + } + } + + } + } + } + } + } + } + } +} diff --git a/src/sonic-config-engine/tests/data/backend_acl/multi_vlan.json b/src/sonic-config-engine/tests/data/backend_acl/multi_vlan.json new file mode 100644 index 000000000000..13acff414a1f --- /dev/null +++ b/src/sonic-config-engine/tests/data/backend_acl/multi_vlan.json @@ -0,0 +1,69 @@ +{ + "VLAN": { + "Vlan1000": { + "vlanid": "1000" + }, + "Vlan2000": { + "vlanid": "2000" + } + }, + "VLAN_MEMBER": { + "Vlan1000|Ethernet12": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet16": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet20": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet24": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet28": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet32": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet36": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet40": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet44": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet48": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet52": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet56": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet60": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet64": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet68": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet72": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet76": { + "tagging_mode": "tagged" + }, + "Vlan2000|Ethernet4": { + "tagging_mode": "tagged" + }, + "Vlan2000|Ethernet8": { + "tagging_mode": "tagged" + } + } +} diff --git a/src/sonic-config-engine/tests/data/backend_acl/single_vlan.json b/src/sonic-config-engine/tests/data/backend_acl/single_vlan.json new file mode 100644 index 000000000000..1023e990a72f --- /dev/null +++ b/src/sonic-config-engine/tests/data/backend_acl/single_vlan.json @@ -0,0 +1,66 @@ +{ + "VLAN": { + "Vlan1000": { + "vlanid": "1000" + } + }, + "VLAN_MEMBER": { + "Vlan1000|Ethernet4": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet8": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet12": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet16": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet20": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet24": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet28": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet32": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet36": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet40": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet44": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet48": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet52": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet56": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet60": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet64": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet68": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet72": { + "tagging_mode": "tagged" + }, + "Vlan1000|Ethernet76": { + "tagging_mode": "tagged" + } + } +} diff --git a/src/sonic-config-engine/tests/sample-arista-7050-t0-storage-backend-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7050-t0-storage-backend-minigraph.xml new file mode 100644 index 000000000000..cadd47217a71 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-arista-7050-t0-storage-backend-minigraph.xml @@ -0,0 +1,781 @@ + + + + + + switch-t0 + 10.1.0.32 + BGPMonitor + 10.20.30.40 + 30 + 10 + 3 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.2.0.20 + CHASSIS_PEER + 10.2.0.21 + 1 + 180 + 60 + voq + + + + + 1 + + BGPMonitor + + + BGPPeer +
10.1.0.32
+ + + +
+
+ +
+ + 65100 + switch-t0 + + +
10.0.0.59
+ + + +
+ +
10.2.0.21
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + + + 65100 + CHASSIS_PEER + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel1 + fortyGigE0/4 + + + + + + ab1 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1000 + 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 + 192.0.0.1;192.0.0.2 + 2020 + 2020 + Tagged + 192.168.0.0/28 + + + ab2 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2000 + 2000 + Tagged + 192.168.0.240/27 + + + ab3 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2001 + 2001 + 192.168.0.240/27 + + + + + + PortChannel1 + 10.0.0.56/31 + + + + PortChannel1 + FC00::71/126 + + + + fortyGigE0/0 + 10.0.0.58/31 + + + + fortyGigE0/0 + FC00::75/126 + + + + ab1 + 192.168.0.1/27 + + + + + + DataAcl + + ERSPAN + everflow + Everflow + 0 + everflow.xml + + + DataAcl + + ERSPANv6 + everflowV6 + Everflow + 0 + everflow.xml + + + DataAcl + + Loopback0 + ipv6-mgmt-only + Management + 0 + + + + DataAcl + + Loopback0 + mgmt-only + Management + 0 + + + + DataAcl + + StaticERSPAN + everflowStatic + Everflow + 0 + everflow.xml + + + + + + + + + + DeviceInterfaceLink + 1000 + ARISTA01T1 + et1 + true + switch-t0 + fortyGigE0/8 + true + + + DeviceMgmtLink + 1000 + switch-t0 + fortyGigE0/16 + true + ChassisMTS1 + mgmt0 + true + + + + + switch-t0 + Arista-7050-QX-32S + AAA00PrdStr00 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + + 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 + + + true + 0 + Arista-7050-QX-32S + + + DeviceInterface + + 1 + Management1 + false + mgmt1 + 1000 + + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + ResourceType + + Storage + + + + + + + switch-t0 + Arista-7050-QX-32S +
diff --git a/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml b/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml index 7cea7decfcc0..cb84ce744ed1 100644 --- a/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml +++ b/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml @@ -731,6 +731,11 @@ True + + SonicQosProfile + + RDMA-CENTRIC + ARISTA01T1:Ethernet1;s6100-dev-1:fortyGigE1/1/1 diff --git a/src/sonic-config-engine/tests/sample-graph-storage-backend.xml b/src/sonic-config-engine/tests/sample-graph-storage-backend.xml new file mode 100644 index 000000000000..837400b2d5e4 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-graph-storage-backend.xml @@ -0,0 +1,781 @@ + + + + + + switch-t0 + 10.1.0.32 + BGPMonitor + 10.20.30.40 + 30 + 10 + 3 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.2.0.20 + CHASSIS_PEER + 10.2.0.21 + 1 + 180 + 60 + voq + + + + + 1 + + BGPMonitor + + + BGPPeer +
10.1.0.32
+ + + +
+
+ +
+ + 65100 + switch-t0 + + +
10.0.0.59
+ + + +
+ +
10.2.0.21
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + + + 65100 + CHASSIS_PEER + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel1 + fortyGigE0/4 + + + + + + ab1 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1000 + 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 + 192.0.0.1;192.0.0.2 + 2020 + 2020 + Tagged + 192.168.0.0/28 + + + ab2 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2000 + 2000 + Tagged + 192.168.0.240/27 + + + ab3 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2001 + 2001 + 192.168.0.240/27 + + + + + + PortChannel1 + 10.0.0.56/31 + + + + PortChannel1 + FC00::71/126 + + + + fortyGigE0/0 + 10.0.0.58/31 + + + + fortyGigE0/0 + FC00::75/126 + + + + ab1 + 192.168.0.1/27 + + + + + + DataAcl + + ERSPAN + everflow + Everflow + 0 + everflow.xml + + + DataAcl + + ERSPANv6 + everflowV6 + Everflow + 0 + everflow.xml + + + DataAcl + + Loopback0 + ipv6-mgmt-only + Management + 0 + + + + DataAcl + + Loopback0 + mgmt-only + Management + 0 + + + + DataAcl + + StaticERSPAN + everflowStatic + Everflow + 0 + everflow.xml + + + + + + + + + + DeviceInterfaceLink + 1000 + ARISTA01T1 + et1 + true + switch-t0 + fortyGigE0/8 + true + + + DeviceMgmtLink + 1000 + switch-t0 + fortyGigE0/16 + true + ChassisMTS1 + mgmt0 + true + + + + + switch-t0 + Arista-7050-QX-32S + AAA00PrdStr00 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + + 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 + + + true + 0 + Arista-7050-QX-32S + + + DeviceInterface + + 1 + Management1 + false + mgmt1 + 1000 + + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + ResourceType + + Storage + + + + + + + switch-t0 + 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 7fa35c44cbe4..6dab0ecd4e14 100644 --- a/src/sonic-config-engine/tests/sample-graph-subintf.xml +++ b/src/sonic-config-engine/tests/sample-graph-subintf.xml @@ -11,25 +11,6 @@ 10 3 - - false - switch-t0 - 10.0.0.56 - ARISTA01T1 - 10.0.0.57 - 1 - 180 - 60 - - - switch-t0 - FC00::71 - ARISTA01T1 - FC00::72 - 1 - 180 - 60 - false switch-t0 @@ -90,12 +71,6 @@ 65100 switch-t0 - -
10.0.0.57
- - - -
10.0.0.59
@@ -253,16 +228,6 @@ PortChannel1 FC00::71/126 - - - PortChannel1001 - 10.0.0.57/31 - - - - PortChannel1001 - FC00::72/126 - ab1 @@ -308,15 +273,6 @@ mgmt0 true - - DeviceMgmtLink - 1000 - switch-t0 - Management1 - switch-m0 - Management1 - true - diff --git a/src/sonic-config-engine/tests/sample_output/py2/two_mgmt_interfaces b/src/sonic-config-engine/tests/sample_output/py2/two_mgmt_interfaces new file mode 100644 index 000000000000..12136a316acb --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/two_mgmt_interfaces @@ -0,0 +1,76 @@ +# +# =============== Managed by SONiC Config Engine DO NOT EDIT! =============== +# generated from /usr/share/sonic/templates/interfaces.j2 using sonic-cfggen +# file: /etc/network/interfaces +# +# The loopback network interface +auto lo +iface lo inet loopback + address 127.0.0.1 + netmask 255.255.0.0 + scope host + post-up ip addr del 127.0.0.1/8 dev lo + +# The management network interface +auto eth1 +auto eth0 +iface eth1 inet static + address 10.0.10.100 + netmask 255.255.255.0 + network 10.0.10.0 + broadcast 10.0.10.255 + ########## management network policy routing rules + # management port up rules + up ip -4 route add default via 10.0.10.1 dev eth1 table default metric 201 + up ip -4 route add 10.0.10.0/24 dev eth1 table default + up ip -4 rule add pref 32765 from 10.0.10.100/32 table default + # management port down rules + pre-down ip -4 route delete default via 10.0.10.1 dev eth1 table default + pre-down ip -4 route delete 10.0.10.0/24 dev eth1 table default + pre-down ip -4 rule delete pref 32765 from 10.0.10.100/32 table default +iface eth0 inet static + address 10.0.0.100 + netmask 255.255.255.0 + network 10.0.0.0 + broadcast 10.0.0.255 + ########## management network policy routing rules + # management port up rules + up ip -4 route add default via 10.0.0.1 dev eth0 table default metric 201 + up ip -4 route add 10.0.0.0/24 dev eth0 table default + up ip -4 rule add pref 32765 from 10.0.0.100/32 table default + # management port down rules + pre-down ip -4 route delete default via 10.0.0.1 dev eth0 table default + pre-down ip -4 route delete 10.0.0.0/24 dev eth0 table default + pre-down ip -4 rule delete pref 32765 from 10.0.0.100/32 table default +iface eth1 inet6 static + address 2603:10e2:0:abcd::8 + netmask 64 + network 2603:10e2:0:abcd:: + broadcast 2603:10e2:0:abcd:ffff:ffff:ffff:ffff + ########## management network policy routing rules + # management port up rules + up ip -6 route add default via 2603:10e2:0:abcd::1 dev eth1 table default metric 201 + up ip -6 route add 2603:10e2:0:abcd::/64 dev eth1 table default + up ip -6 rule add pref 32765 from 2603:10e2:0:abcd::8/128 table default + # management port down rules + pre-down ip -6 route delete default via 2603:10e2:0:abcd::1 dev eth1 table default + pre-down ip -6 route delete 2603:10e2:0:abcd::/64 dev eth1 table default + pre-down ip -6 rule delete pref 32765 from 2603:10e2:0:abcd::8/128 table default +iface eth0 inet6 static + address 2603:10e2:0:2902::8 + netmask 64 + network 2603:10e2:0:2902:: + broadcast 2603:10e2:0:2902:ffff:ffff:ffff:ffff + ########## management network policy routing rules + # management port up rules + up ip -6 route add default via 2603:10e2:0:2902::1 dev eth0 table default metric 201 + up ip -6 route add 2603:10e2:0:2902::/64 dev eth0 table default + up ip -6 rule add pref 32765 from 2603:10e2:0:2902::8/128 table default + # management port down rules + pre-down ip -6 route delete default via 2603:10e2:0:2902::1 dev eth0 table default + pre-down ip -6 route delete 2603:10e2:0:2902::/64 dev eth0 table default + pre-down ip -6 rule delete pref 32765 from 2603:10e2:0:2902::8/128 table default +# +source /etc/network/interfaces.d/* +# + diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050-t0-storage-backend.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050-t0-storage-backend.json new file mode 100644 index 000000000000..94aa8d8a7d1d --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050-t0-storage-backend.json @@ -0,0 +1,81 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DOT1P_TO_TC_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/two_mgmt_interfaces b/src/sonic-config-engine/tests/sample_output/py3/two_mgmt_interfaces new file mode 100644 index 000000000000..7fa99896e8c2 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/two_mgmt_interfaces @@ -0,0 +1,76 @@ +# +# =============== Managed by SONiC Config Engine DO NOT EDIT! =============== +# generated from /usr/share/sonic/templates/interfaces.j2 using sonic-cfggen +# file: /etc/network/interfaces +# +# The loopback network interface +auto lo +iface lo inet loopback + address 127.0.0.1 + netmask 255.255.0.0 + scope host + post-up ip addr del 127.0.0.1/8 dev lo + +# The management network interface +auto eth0 +auto eth1 +iface eth0 inet static + address 10.0.0.100 + netmask 255.255.255.0 + network 10.0.0.0 + broadcast 10.0.0.255 + ########## management network policy routing rules + # management port up rules + up ip -4 route add default via 10.0.0.1 dev eth0 table default metric 201 + up ip -4 route add 10.0.0.0/24 dev eth0 table default + up ip -4 rule add pref 32765 from 10.0.0.100/32 table default + # management port down rules + pre-down ip -4 route delete default via 10.0.0.1 dev eth0 table default + pre-down ip -4 route delete 10.0.0.0/24 dev eth0 table default + pre-down ip -4 rule delete pref 32765 from 10.0.0.100/32 table default +iface eth0 inet6 static + address 2603:10e2:0:2902::8 + netmask 64 + network 2603:10e2:0:2902:: + broadcast 2603:10e2:0:2902:ffff:ffff:ffff:ffff + ########## management network policy routing rules + # management port up rules + up ip -6 route add default via 2603:10e2:0:2902::1 dev eth0 table default metric 201 + up ip -6 route add 2603:10e2:0:2902::/64 dev eth0 table default + up ip -6 rule add pref 32765 from 2603:10e2:0:2902::8/128 table default + # management port down rules + pre-down ip -6 route delete default via 2603:10e2:0:2902::1 dev eth0 table default + pre-down ip -6 route delete 2603:10e2:0:2902::/64 dev eth0 table default + pre-down ip -6 rule delete pref 32765 from 2603:10e2:0:2902::8/128 table default +iface eth1 inet static + address 10.0.10.100 + netmask 255.255.255.0 + network 10.0.10.0 + broadcast 10.0.10.255 + ########## management network policy routing rules + # management port up rules + up ip -4 route add default via 10.0.10.1 dev eth1 table default metric 201 + up ip -4 route add 10.0.10.0/24 dev eth1 table default + up ip -4 rule add pref 32765 from 10.0.10.100/32 table default + # management port down rules + pre-down ip -4 route delete default via 10.0.10.1 dev eth1 table default + pre-down ip -4 route delete 10.0.10.0/24 dev eth1 table default + pre-down ip -4 rule delete pref 32765 from 10.0.10.100/32 table default +iface eth1 inet6 static + address 2603:10e2:0:abcd::8 + netmask 64 + network 2603:10e2:0:abcd:: + broadcast 2603:10e2:0:abcd:ffff:ffff:ffff:ffff + ########## management network policy routing rules + # management port up rules + up ip -6 route add default via 2603:10e2:0:abcd::1 dev eth1 table default metric 201 + up ip -6 route add 2603:10e2:0:abcd::/64 dev eth1 table default + up ip -6 rule add pref 32765 from 2603:10e2:0:abcd::8/128 table default + # management port down rules + pre-down ip -6 route delete default via 2603:10e2:0:abcd::1 dev eth1 table default + pre-down ip -6 route delete 2603:10e2:0:abcd::/64 dev eth1 table default + pre-down ip -6 rule delete pref 32765 from 2603:10e2:0:abcd::8/128 table default +# +source /etc/network/interfaces.d/* +# + 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 7bbef28aaa38..4165647a9aa3 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -198,6 +198,62 @@ + + + + + LoopbackInterface + HostIP + Loopback0 + + 10.10.10.2/32 + + 10.10.10.2/32 + + + LoopbackInterface + HostIP1 + Loopback0 + + fe80::0002/128 + + fe80::0002/128 + + + LoopbackInterface + SoCHostIP0 + server2SOC + + 10.10.10.3/32 + + 10.10.10.3/32 + + + LoopbackInterface + SoCHostIP1 + server2SOC + + fe80::0003/128 + + fe80::0003/128 + + + + + + + + server2 + + + + + + + + + + @@ -262,17 +318,6 @@ L true - - LogicalLink - 10000 - false - switch-t0 - fortyGigE0/8 - true - server2-SC - U - true - LogicalLink 0 @@ -349,25 +394,6 @@ server1 server-sku - - SmartCable - active-active -
- 10.10.10.3/32 -
- - ::/0 - - - 0.0.0.0/0 - - - ::/0 - - - server2-SC - smartcable-sku -
Server
@@ -506,6 +532,11 @@ Storage + + RedundancyType + + Mixed + diff --git a/src/sonic-config-engine/tests/t0-sample-graph-two-mgmt.xml b/src/sonic-config-engine/tests/t0-sample-graph-two-mgmt.xml new file mode 100644 index 000000000000..da1b56fe1309 --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-graph-two-mgmt.xml @@ -0,0 +1,953 @@ + + + + + + switch-t0 + 10.1.0.32 + BGPMonitor + 10.20.30.40 + 30 + 10 + 3 + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 180 + 60 + + + switch-t0 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 180 + 60 + + + switch-t0 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 180 + 60 + + + + + 1 + + BGPMonitor + + + BGPPeer +
10.1.0.32
+ + + +
+
+ +
+ + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + LoopbackIP1 + Loopback1 + + 10.10.0.99/32 + + 10.10.0.99/32 + + + LoopbackIP2 + Loopback2 + + 10.21.0.64/32 + + 10.21.0.64/32 + + + LoopbackIP3 + Loopback3 + + 10.21.64.2/32 + + 10.21.64.2/32 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + HostIP + eth0 + + 2603:10e2:0:2902::8/64 + + 2603:10e2:0:2902::8/64 + + + HostIP1 + eth1 + + 10.0.10.100/24 + + 10.0.10.100/24 + + + HostIP1 + eth1 + + 2603:10e2:0:abcd::8/64 + + 2603:10e2:0:abcd::8/64 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/112 + + + + PortChannel02 + fortyGigE0/116 + + + + PortChannel03 + fortyGigE0/120 + + + + PortChannel04 + fortyGigE0/124 + + + + + + Vlan1000 + fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96 + False + 0.0.0.0/0 + + + 192.0.0.1;192.0.0.2 + fc02:2000::1;fc02:2000::2 + 1000 + 1000 + 192.168.0.0/27 + + + + + Vlan2000 + fortyGigE0/112;fortyGigE0/116;fortyGigE0/120 + False + 0.0.0.0/0 + + + + 2000 + 2000 + 192.168.200.0/27 + + + + + Vlan99 + fortyGigE0/100 + False + 0.0.0.0/0 + + UserDefinedL2Vlan + 192.0.0.1;192.0.0.2 + 99 + 99 + + + + + + Vlan98 + fortyGigE0/100;PortChannel01;PortChannel03 + False + 0.0.0.0/0 + + UserDefinedL2Vlan + 192.0.0.1;192.0.0.2 + 98 + 98 + + + + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + PortChannel02 + 10.0.0.58/31 + + + + PortChannel02 + FC00::75/126 + + + + PortChannel03 + 10.0.0.60/31 + + + + PortChannel03 + FC00::79/126 + + + + PortChannel04 + 10.0.0.62/31 + + + + PortChannel04 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + Vlan2000 + 192.168.200.1/27 + + + + + + ERSPAN + everflow + Everflow + + + ERSPANv6 + everflowV6 + Everflow + + + EGRESS_ERSPAN + everflow_egress + Everflow + + + PortChannel01;PortChannel02;PortChannel03;PortChannel04 + DataAclIngress + DataPlane + + + PortChannel01;PortChannel02;Vlan98 + DataAclEgress + DataPlane + + + SNMP + SNMP_ACL + SNMP + + + NTP + NTP_ACL + NTP + + + SSH + SSH_ACL + SSH + + + SSH + ROUTER-PROTECT + SSH + + + SNMP + ROUTER-PROTECT + SNMP + + + NTP + NTP_ACL + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1/1 + switch-t0 + fortyGigE0/112 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1/1 + switch-t0 + fortyGigE0/116 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1/1 + switch-t0 + fortyGigE0/120 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1/1 + switch-t0 + fortyGigE0/124 + 100000 + + + DeviceInterfaceLink + 100000 + switch-t0 + fortyGigE0/4 + true + ARISTA05T1 + Ethernet1/33 + true + + + DeviceInterfaceLink + Servers0 + eth0 + switch-t0 + fortyGigE0/4 + + + DeviceInterfaceLink + Servers100 + eth0 + switch-t0 + fortyGigE0/100 + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + + 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 + + + + + + + switch-t0 + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + + + + + + + AutoNegotiation + + True + + + FECDisabled + + True + + + ARISTA05T1:Ethernet1/33;switch-t0:fortyGigE0/4 + + + + + + AutoNegotiation + + False + + + FECDisabled + + True + + + ARISTA06T1:Ethernet1/34;switch-t0:fortyGigE0/8 + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 0c3519068e90..232fded47eb5 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -39,6 +39,7 @@ def setUp(self): 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.macsec_profile = os.path.join(self.test_dir, 'macsec_profile.json') + self.sample_backend_graph = os.path.join(self.test_dir, 'sample-graph-storage-backend.xml') # To ensure that mock config_db data is used for unit-test cases os.environ["CFGGEN_UNIT_TESTING"] = "2" @@ -710,14 +711,11 @@ def test_minigraph_bgp_voq_chassis_peer(self): output = self.run_script(argument) self.assertEqual(output.strip(), "") - def test_minigraph_sub_port_interfaces(self, check_stderr=True): - self.verify_sub_intf(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_resource_type(self, check_stderr=True): - self.verify_sub_intf(graph_file=self.sample_resource_graph, check_stderr=check_stderr) + 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) 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) @@ -725,6 +723,32 @@ def test_minigraph_sub_port_intf_sub(self, check_stderr=True): def test_minigraph_no_vlan_member(self, check_stderr=True): self.verify_no_vlan_member() + def test_minigraph_backend_acl_leaf(self, check_stderr=True): + try: + print('\n Change device type to %s' % (BACKEND_LEAF_ROUTER)) + if check_stderr: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (TOR_ROUTER, BACKEND_LEAF_ROUTER, self.sample_backend_graph), stderr=subprocess.STDOUT, shell=True) + else: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (TOR_ROUTER, BACKEND_LEAF_ROUTER, self.sample_backend_graph), shell=True) + + self.test_jinja_expression(self.sample_backend_graph, self.port_config, BACKEND_LEAF_ROUTER) + + # ACL_TABLE should contain EVERFLOW related entries + argument = '-m "' + self.sample_backend_graph + '" -p "' + self.port_config + '" -v "ACL_TABLE"' + output = self.run_script(argument) + sample_output = utils.to_dict(output.strip()).keys() + assert 'DATAACL' not in sample_output, sample_output + assert 'EVERFLOW' in sample_output, sample_output + + finally: + print('\n Change device type back to %s' % (TOR_ROUTER)) + if check_stderr: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BACKEND_LEAF_ROUTER, TOR_ROUTER, self.sample_backend_graph), stderr=subprocess.STDOUT, shell=True) + else: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BACKEND_LEAF_ROUTER, TOR_ROUTER, self.sample_backend_graph), shell=True) + + self.test_jinja_expression(self.sample_backend_graph, self.port_config, TOR_ROUTER) + def test_minigraph_sub_port_no_vlan_member(self, check_stderr=True): try: print('\n Change device type to %s' % (BACKEND_LEAF_ROUTER)) @@ -780,6 +804,13 @@ def verify_sub_intf(self, **kwargs): output = self.run_script(argument) self.assertEqual(output.strip(), "") + # ACL_TABLE should not contain EVERFLOW related entries + argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "ACL_TABLE"' + output = self.run_script(argument) + sample_output = utils.to_dict(output.strip()).keys() + assert 'DATAACL' in sample_output, sample_output + assert 'EVERFLOW' not in sample_output, sample_output + # All the other tables stay unchanged self.test_minigraph_vlans(graph_file=graph_file) self.test_minigraph_vlan_interfaces(graph_file=graph_file) diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index b93d26ef368f..00d823a5c2de 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -20,6 +20,7 @@ def setUp(self): self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml') self.t0_mvrf_minigraph = os.path.join(self.test_dir, 't0-sample-graph-mvrf.xml') self.t0_minigraph_nomgmt = os.path.join(self.test_dir, 't0-sample-graph-nomgmt.xml') + self.t0_minigraph_two_mgmt = os.path.join(self.test_dir, 't0-sample-graph-two-mgmt.xml') self.t0_mvrf_minigraph_nomgmt = os.path.join(self.test_dir, 't0-sample-graph-mvrf-nomgmt.xml') self.pc_minigraph = os.path.join(self.test_dir, 'pc-test-graph.xml') self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') @@ -119,6 +120,10 @@ def test_interfaces(self): self.run_script(argument) self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'mvrf_interfaces'), self.output_file)) + argument = '-m ' + self.t0_minigraph_two_mgmt + ' -p ' + self.t0_port_config + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'two_mgmt_interfaces'), self.output_file), self.output_file) + # ZTP disabled, no MGMT_INTERFACE defined argument = '-m ' + self.t0_minigraph_nomgmt + ' -p ' + self.t0_port_config + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file self.run_script(argument) @@ -277,23 +282,7 @@ def test_l2switch_template_dualtor(self): self.assertEqual(sample_output_json, output_json) def test_qos_arista7050_render_template(self): - arista_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'arista', 'x86_64-arista_7050_qx32s', 'Arista-7050-QX-32S') - qos_file = os.path.join(arista_dir_path, 'qos.json.j2') - port_config_ini_file = os.path.join(arista_dir_path, 'port_config.ini') - - # copy qos_config.j2 to the Arista 7050 directory to have all templates in one directory - qos_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'qos_config.j2') - shutil.copy2(qos_config_file, arista_dir_path) - - argument = '-m ' + self.arista7050_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + self.output_file - self.run_script(argument) - - # cleanup - qos_config_file_new = os.path.join(arista_dir_path, 'qos_config.j2') - os.remove(qos_config_file_new) - - sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-arista7050.json') - assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + self._test_qos_render_template('arista', 'x86_64-arista_7050_qx32s', 'Arista-7050-QX-32S', 'sample-arista-7050-t0-minigraph.xml', 'qos-arista7050.json') def do_test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self, platform, hwsku): arista_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'arista', platform, hwsku) @@ -326,41 +315,32 @@ def test_qos_and_buffer_arista7800r3_48cqm2_lc_render_template(self): self.do_test_qos_and_buffer_arista7800r3_48cq2_lc_render_template('x86_64-arista_7800r3_48cqm2_lc', 'Arista-7800R3-48CQM2-C48') def test_qos_dell9332_render_template(self): - dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dellemc_z9332f_d1508-r0', 'DellEMC-Z9332f-O32') - qos_file = os.path.join(dell_dir_path, 'qos.json.j2') - port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') - - # copy qos_config.j2 to the Dell Z9332 directory to have all templates in one directory - qos_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'qos_config.j2') - shutil.copy2(qos_config_file, dell_dir_path) - - argument = '-m ' + self.dell9332_t1_minigraph + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + self.output_file - self.run_script(argument) - - # cleanup - qos_config_file_new = os.path.join(dell_dir_path, 'qos_config.j2') - os.remove(qos_config_file_new) + self._test_qos_render_template('dell', 'x86_64-dellemc_z9332f_d1508-r0', 'DellEMC-Z9332f-O32', 'sample-dell-9332-t1-minigraph.xml', 'qos-dell9332.json') - sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-dell9332.json') - assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) - def test_qos_dell6100_render_template(self): - dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') - qos_file = os.path.join(dell_dir_path, 'qos.json.j2') - port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') + self._test_qos_render_template('dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100', 'sample-dell-6100-t0-minigraph.xml', 'qos-dell6100.json') + + def _test_qos_render_template(self, vendor, platform, sku, minigraph, expected): + file_exist, dir_exist = self.create_machine_conf(platform, vendor) + dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', vendor, platform, sku) + qos_file = os.path.join(dir_path, 'qos.json.j2') + port_config_ini_file = os.path.join(dir_path, 'port_config.ini') - # copy qos_config.j2 to the Dell S6100 directory to have all templates in one directory + # copy qos_config.j2 to the SKU directory to have all templates in one directory qos_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'qos_config.j2') - shutil.copy2(qos_config_file, dell_dir_path) + shutil.copy2(qos_config_file, dir_path) - argument = '-m ' + self.dell6100_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + self.output_file + minigraph = os.path.join(self.test_dir, minigraph) + argument = '-m ' + minigraph + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + self.output_file self.run_script(argument) # cleanup - qos_config_file_new = os.path.join(dell_dir_path, 'qos_config.j2') + qos_config_file_new = os.path.join(dir_path, 'qos_config.j2') os.remove(qos_config_file_new) + + self.remove_machine_conf(file_exist, dir_exist) - sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-dell6100.json') + sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, expected) assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_qos_dscp_remapping_render_template(self): @@ -374,7 +354,8 @@ def test_qos_dscp_remapping_render_template(self): '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64', '../../../device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8', '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8', - '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64' + '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64', + '../../../device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S' ] sample_outputs = [ 'qos-arista7050cx3-dualtor.json', @@ -382,7 +363,8 @@ def test_qos_dscp_remapping_render_template(self): 'qos-arista7260-t1.json', 'qos-arista7050cx3-dualtor-remap-disabled.json', 'qos-arista7260-dualtor-remap-disabled.json', - 'qos-arista7260-t1-remap-disabled.json' + 'qos-arista7260-t1-remap-disabled.json', + 'qos-arista7050-t0-storage-backend.json' ] sample_minigraph_files = [ 'sample-arista-7050cx3-dualtor-minigraph.xml', @@ -390,7 +372,8 @@ def test_qos_dscp_remapping_render_template(self): 'sample-arista-7260-t1-minigraph.xml', 'sample-arista-7050cx3-dualtor-minigraph-remap-disabled.xml', 'sample-arista-7260-dualtor-minigraph-remap-disabled.xml', - 'sample-arista-7260-t1-minigraph-remap-disabled.xml' + 'sample-arista-7260-t1-minigraph-remap-disabled.xml', + 'sample-arista-7050-t0-storage-backend-minigraph.xml' ] for i, path in enumerate(dir_paths): device_template_path = os.path.join(self.test_dir, path) @@ -606,6 +589,34 @@ def test_ntp_conf(self): self.run_script(argument) assert utils.cmp(expected, self.output_file), self.run_diff(expected, self.output_file) + def test_backend_acl_template_render(self): + acl_template = os.path.join( + self.test_dir, '..', '..', '..', 'files', 'build_templates', + 'backend_acl.j2' + ) + test_list = { + 'single_vlan': { + 'input': 'single_vlan.json', + 'output': 'acl_single_vlan.json' + }, + 'multi_vlan': { + 'input': 'multi_vlan.json', + 'output': 'acl_multi_vlan.json' + }, + } + for _, v in test_list.items(): + input_file = os.path.join( + self.test_dir, 'data', 'backend_acl', v['input'] + ) + argument = " -j {} -t {} > {}".format( + input_file, acl_template, self.output_file + ) + sample_output_file = os.path.join( + self.test_dir, 'data', 'backend_acl', v['output'] + ) + self.run_script(argument) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + def tearDown(self): os.environ["CFGGEN_UNIT_TESTING"] = "" try: diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 16ad019032f2..bfee76c7546e 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -236,14 +236,6 @@ def test_minigraph_neighbor_metadata(self): 'lo_addr_v6': '::/0', 'mgmt_addr': '0.0.0.0/0', 'type': 'SmartCable' - }, - 'server2-SC': { - 'hwsku': 'smartcable-sku', - 'lo_addr': '10.10.10.3/32', - 'lo_addr_v6': '::/0', - 'mgmt_addr': '0.0.0.0/0', - 'type': 'SmartCable', - 'subtype': 'active-active' } } output = self.run_script(argument) @@ -421,6 +413,7 @@ def test_minigraph_mux_cable_table(self): 'server_ipv4': '10.10.10.2/32', 'server_ipv6': 'fe80::2/128', 'soc_ipv4': '10.10.10.3/32', + 'soc_ipv6': 'fe80::3/128', 'cable_type': 'active-active' } } diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index 0ef2b8a467e1..012e547f62ea 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -313,6 +313,7 @@ port_gmii_mode phy_force_firmware_load phy_pcs_repeater l3_alpm_hit_skip +sai_verify_incoming_chksum phy_an_lt_msft system_ref_core_clock_khz xflow_macsec_secure_chan_to_num_secure_assoc_encrypt diff --git a/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py b/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py index f189789914ed..bb6d7730f141 100755 --- a/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py +++ b/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py @@ -5,7 +5,7 @@ import time import syslog import os -from swsssdk import ConfigDBConnector +from swsscommon.swsscommon import ConfigDBConnector import socket import threading import queue diff --git a/src/sonic-frr-mgmt-framework/tests/test_config.py b/src/sonic-frr-mgmt-framework/tests/test_config.py index ed31c1e28ec8..02c5181c2ce5 100644 --- a/src/sonic-frr-mgmt-framework/tests/test_config.py +++ b/src/sonic-frr-mgmt-framework/tests/test_config.py @@ -2,9 +2,11 @@ import re from unittest.mock import MagicMock, NonCallableMagicMock, patch -swsssdk_module_mock = MagicMock(ConfigDBConnector = NonCallableMagicMock) +swsscommon_module_mock = MagicMock(ConfigDBConnector = NonCallableMagicMock) +# because can’t use dotted names directly in a call, have to create a dictionary and unpack it using **: +mockmapping = {'swsscommon.swsscommon': swsscommon_module_mock} -@patch.dict('sys.modules', swsssdk = swsssdk_module_mock) +@patch.dict('sys.modules', **mockmapping) def test_contructor(): from frrcfgd.frrcfgd import BGPConfigDaemon daemon = BGPConfigDaemon() @@ -147,7 +149,7 @@ def hdl_confed_peers_cmd(is_del, cmd_list, chk_data): conf_bgp_af_cmd('Vrf_red', 200, 'ipv6') + ['{}import vrf route-map test_map']), ] -@patch.dict('sys.modules', swsssdk = swsssdk_module_mock) +@patch.dict('sys.modules', **mockmapping) @patch('frrcfgd.frrcfgd.g_run_command') def data_set_del_test(test_data, run_cmd): from frrcfgd.frrcfgd import BGPConfigDaemon diff --git a/src/sonic-frr-mgmt-framework/tests/test_constructor.py b/src/sonic-frr-mgmt-framework/tests/test_constructor.py index 14faa36d2e66..93a09664c3c8 100644 --- a/src/sonic-frr-mgmt-framework/tests/test_constructor.py +++ b/src/sonic-frr-mgmt-framework/tests/test_constructor.py @@ -2,9 +2,11 @@ import pytest from unittest.mock import MagicMock, NonCallableMagicMock, patch -swsssdk_module_mock = MagicMock(ConfigDBConnector = NonCallableMagicMock) +swsscommon_module_mock = MagicMock(ConfigDBConnector = NonCallableMagicMock) +# because can’t use dotted names directly in a call, have to create a dictionary and unpack it using **: +mockmapping = {'swsscommon.swsscommon': swsscommon_module_mock} -with patch.dict('sys.modules', swsssdk = swsssdk_module_mock): +with patch.dict('sys.modules', **mockmapping): from frrcfgd.frrcfgd import CachedDataWithOp from frrcfgd.frrcfgd import BGPPeerGroup from frrcfgd.frrcfgd import BGPKeyMapInfo diff --git a/src/sonic-host-services b/src/sonic-host-services new file mode 160000 index 000000000000..709046bbec9d --- /dev/null +++ b/src/sonic-host-services @@ -0,0 +1 @@ +Subproject commit 709046bbec9d05c9bf06e7c54a23ae0f9c970281 diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.service b/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.service index 32c2d0bb927a..14af8868e164 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.service @@ -1,7 +1,7 @@ [Unit] Description=Retrieve the reboot cause from the history files and save them to StateDB -Requires=database.service -After=database.service +Requires=database.service determine-reboot-cause.service +After=database.service determine-reboot-cause.service [Service] Type=simple diff --git a/src/sonic-host-services/.gitignore b/src/sonic-host-services/.gitignore deleted file mode 100644 index e807a5b8f7ed..000000000000 --- a/src/sonic-host-services/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -# Compiled Python files -*.pyc -scripts/caclmgrdc -scripts/hostcfgdc -scripts/aaastatsdc -scripts/procdockerstatsdc - -# Generated by packaging -*.egg-info/ -.eggs/ -build/ -dist/ - -# Unit test coverage -.coverage -.pytest_cache/ -coverage.xml -htmlcov/ -test-results.xml - -# Unit test scratchpad -tests/hostcfgd/output/* diff --git a/src/sonic-host-services/host_modules/host_service.py b/src/sonic-host-services/host_modules/host_service.py deleted file mode 100644 index 48f55ae0623c..000000000000 --- a/src/sonic-host-services/host_modules/host_service.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Base class for host modules""" - -import dbus.service -import dbus - -BUS_NAME_BASE = 'org.SONiC.HostService' -BUS_PATH = '/org/SONiC/HostService' - -def bus_name(mod_name): - """Return the bus name for the service""" - return BUS_NAME_BASE + '.' + mod_name - -def bus_path(mod_name): - """Return the bus path for the service""" - return BUS_PATH + '/' + mod_name - -method = dbus.service.method - -class HostService(dbus.service.Object): - """Service class for top level DBus endpoint""" - def __init__(self, mod_name): - self.bus = dbus.SystemBus() - self.bus_name = dbus.service.BusName(BUS_NAME_BASE, self.bus) - super(HostService, self).__init__(self.bus_name, BUS_PATH) - -class HostModule(dbus.service.Object): - """Base class for all host modules""" - def __init__(self, mod_name): - self.bus = dbus.SystemBus() - self.bus_name = dbus.service.BusName(bus_name(mod_name), self.bus) - super(HostModule, self).__init__(self.bus_name, bus_path(mod_name)) - -def register(): - return HostService, "host_service" diff --git a/src/sonic-host-services/host_modules/showtech.py b/src/sonic-host-services/host_modules/showtech.py deleted file mode 100644 index 2b603d4f52d3..000000000000 --- a/src/sonic-host-services/host_modules/showtech.py +++ /dev/null @@ -1,50 +0,0 @@ -"""Show techsupport command handler""" - -import host_service -import subprocess -import re - -MOD_NAME = 'showtech' - -class Showtech(host_service.HostModule): - """DBus endpoint that executes the "show techsupport" command - """ - @host_service.method(host_service.bus_name(MOD_NAME), in_signature='s', out_signature='is') - def info(self, date): - - ERROR_TAR_FAILED = 5 - ERROR_PROCFS_SAVE_FAILED = 6 - ERROR_INVALID_ARGUMENT = 10 - - err_dict = {ERROR_INVALID_ARGUMENT: 'Invalid input: Incorrect DateTime format', - ERROR_TAR_FAILED: 'Failure saving information into compressed output file', - ERROR_PROCFS_SAVE_FAILED: 'Saving of process information failed'} - - cmd = ['/usr/local/bin/generate_dump'] - if date: - cmd.append("-s") - cmd.append(date) - - try: - result = subprocess.run(cmd, capture_output=True, text=True, - check=True) - - except subprocess.CalledProcessError as err: - errmsg = err_dict.get(err.returncode) - - if errmsg is None: - output = 'Error: Failure code {:-5}'.format(err.returncode) - else: - output = errmsg - - print("%Error: Host side: Failed: " + str(err.returncode)) - return err.returncode, output - - output_file_match = re.search('\/var\/.*dump.*\.gz', result.stdout) - output_filename = output_file_match.group() - return result.returncode, output_filename - -def register(): - """Return the class name""" - return Showtech, MOD_NAME - diff --git a/src/sonic-host-services/pytest.ini b/src/sonic-host-services/pytest.ini deleted file mode 100644 index c4b03d4c3455..000000000000 --- a/src/sonic-host-services/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --ignore=tests/*/test*_vectors.py diff --git a/src/sonic-host-services/scripts/aaastatsd b/src/sonic-host-services/scripts/aaastatsd deleted file mode 100755 index 2cc8f027e573..000000000000 --- a/src/sonic-host-services/scripts/aaastatsd +++ /dev/null @@ -1,222 +0,0 @@ -#!/usr/bin/env python3 -# - -import os -import syslog -import threading -from swsscommon.swsscommon import ConfigDBConnector -from watchdog.observers import Observer -from watchdog.events import FileSystemEventHandler - -# FILE -RADIUS_PAM_AUTH_CONF_DIR = "/etc/pam_radius_auth.d/" -RADIUS_PAM_AUTH_CONF_STATS_DIR = "/etc/pam_radius_auth.d/statistics/" - -class RadiusCountersDbMon (threading.Thread): - def __init__(self, ID, name, radiusStatsInstance): - threading.Thread.__init__(self) - self.ID = ID - self.name = name - self.radiusStatsInstance = radiusStatsInstance - - def handle_CountersDbRadiusClear(self, key, data): - # print("RadiusCountersDbMon.handle_CountersDbRadiusClear()") - if key == 'clear': - self.radiusStatsInstance.handle_clear() - - def run(self): - # print("RadiusCountersDbMon.run()") - self.radiusStatsInstance.counters_db.subscribe('RADIUS', lambda table, key, data: self.handle_CountersDbRadiusClear(key, data)) - self.radiusStatsInstance.counters_db.listen() - # print("RadiusCountersDbMon.run(): After listen()") - - -class RadiusStatsFileHandler(FileSystemEventHandler): - def __init__(self, radiusStatsInstance): - self.radiusStatsInstance = radiusStatsInstance - - def on_any_event(self, event): - # print("RadiusStatsFileHandler.on_any_event()") - if event.is_directory: - return None - - self.radiusStatsInstance.handle_update(os.path.basename(event.src_path)) - -class RadiusStatsFileMon (): - def __init__(self, radiusStatsInstance): - self.event_handler = RadiusStatsFileHandler(radiusStatsInstance) - self.observer = Observer() - self.observer.schedule(self.event_handler, RADIUS_PAM_AUTH_CONF_STATS_DIR, recursive=False) - self.observer.start() - # print("RadiusStatsFileMon.__init__(): After observer.start()") - - def stop(self): - # print("RadiusStatsFileMon.stop()") - self.observer.stop() - # print("RadiusStatsFileMon.stop(): After observer.stop()") - self.observer.join() - # print("RadiusStatsFileMon.stop(): After observer.join()") - - -class RadiusStatistics: - def __init__(self, cfg_db, rad_global_conf, radius_conf): - - self.radius_counter_names = [ - "counter_0", - "access_requests", - "access_accepts", - "access_rejects", - "accounting_requests", - "accounting_responses", - "counter_6", - "counter_7", - "counter_8", - "counter_9", - "counter_10", - "access_challenges", - "counter_12", - "counter_13", - "counter_14", - "counter_15", - "counter_16", - "retried_access_requests", - "counter_18", - "counter_19", - "retried_accounting_requests", - "counter_21", - "counter_22", - "counter_23", - "counter_24", - "counter_25", - "counter_26", - "retried_access_challenges", - "counter_28", - "counter_29", - "counter_30", - "counter_31", - "timeouts", - "bad_authenticators", - "invalid_packets", - "counter_35", - ] - - self.radius_global = { - 'statistics': 'False' - } - - self.radius_servers = {} - - self.config_db = cfg_db - - for row in rad_global_conf: - self.radius_global_update(row, rad_global_conf[row]) - - for row in radius_conf: - self.radius_server_update(row, radius_conf[row]) - - - self.counters_db = ConfigDBConnector() - self.counters_db.db_connect('COUNTERS_DB', wait_for_init=False, - retry_on=True) - syslog.syslog(syslog.LOG_INFO, 'CountersDB connect success') - self.dbmon_thread = RadiusCountersDbMon("RadiusCountersDbMon", - "RadiusCountersDbMon", self) - self.dbmon_thread.daemon = True - self.dbmon_thread.start() - - self.filemon = RadiusStatsFileMon(self) - syslog.syslog(syslog.LOG_INFO, 'RADIUS Stats File Monitor started') - - def radius_global_update(self, key, data): - if key == 'global': - self.radius_global.update(data) - - for addr in self.radius_servers: - self.create_file(addr) - - def radius_server_update(self, key, data): - if data == {}: - if key in self.radius_servers: - del self.radius_servers[key] - else: - self.radius_servers[key] = data - - self.create_file(key) - - def create_file(self, addr): - # print( "RadiusStatistics.create_file({})".format(addr)) - stats_file = RADIUS_PAM_AUTH_CONF_STATS_DIR + addr - if self.radius_global['statistics'] == 'False': - if os.path.exists(stats_file): - os.unlink(stats_file) - else: - open(stats_file, 'a').close() - os.chmod(stats_file, 0o666) - self.handle_update(addr) - - def handle_clear(self): - # print( "RadiusStatistics.handle_clear()") - for filename in os.listdir(RADIUS_PAM_AUTH_CONF_STATS_DIR): - stats_file = RADIUS_PAM_AUTH_CONF_STATS_DIR + filename - open(stats_file, 'w').close() - - def handle_update(self, srv): - # print( "RadiusStatistics.handle_update({})".format(srv)) - if self.radius_global['statistics'] == 'False': - return - - stats_file = RADIUS_PAM_AUTH_CONF_STATS_DIR + srv - entry = None - if os.path.exists(stats_file): - with open(stats_file, 'r') as f: - lines = f.readlines() - if len(lines) > 0: - radius_counters = lines[0].split(' ') - entry = dict(zip(self.radius_counter_names, radius_counters)) - - counters_db = ConfigDBConnector() - counters_db.db_connect('COUNTERS_DB', wait_for_init=False, - retry_on=False) - - counters_db.set_entry('RADIUS_SERVER_STATS', srv, entry) - - counters_db.close(counters_db.COUNTERS_DB) - -class AAAStatsDaemon: - def __init__(self): - self.config_db = ConfigDBConnector() - self.config_db.connect(wait_for_init=True, retry_on=True) - syslog.syslog(syslog.LOG_INFO, 'ConfigDB connect success') - - radius_global = self.config_db.get_table('RADIUS') - radius_server = self.config_db.get_table('RADIUS_SERVER') - - self.radiusstats = RadiusStatistics(self.config_db, radius_global, - radius_server) - - def radius_global_handler(self, key, data): - self.radiusstats.radius_global_update(key, data) - - def radius_server_handler(self, key, data): - self.radiusstats.radius_server_update(key, data) - - def start(self): - self.config_db.subscribe('RADIUS_SERVER', - lambda table, key, data: self.radius_server_handler(key, data)) - self.config_db.subscribe('RADIUS', - lambda table, key, data: self.radius_global_handler(key, data)) - self.config_db.listen() - # print( "After config_db.listen()") - syslog.syslog(syslog.LOG_INFO, 'Stopping FileMon') - self.radiusstats.filemon.stop() - # print( "Exiting") - syslog.syslog(syslog.LOG_INFO, 'Exiting') - -def main(): - daemon = AAAStatsDaemon() - daemon.start() - - -if __name__ == "__main__": - main() - diff --git a/src/sonic-host-services/scripts/caclmgrd b/src/sonic-host-services/scripts/caclmgrd deleted file mode 100755 index 914547ad53b2..000000000000 --- a/src/sonic-host-services/scripts/caclmgrd +++ /dev/null @@ -1,889 +0,0 @@ -#!/usr/bin/env python3 -# -# caclmgrd -# -# Control plane ACL manager daemon for SONiC -# -# Upon starting, this daemon reads control plane ACL tables and rules from -# Config DB, converts the rules into iptables rules and installs the iptables -# rules. The daemon then indefintely listens for notifications from Config DB -# and updates iptables rules if control plane ACL configuration has changed. -# - -try: - import ipaddress - import os - import subprocess - import sys - import threading - import time - - from sonic_py_common import daemon_base, device_info, multi_asic - from swsscommon import swsscommon -except ImportError as err: - raise ImportError("%s - required module not found" % str(err)) - -VERSION = "1.0" - -SYSLOG_IDENTIFIER = "caclmgrd" - -DEFAULT_NAMESPACE = '' - - -# ========================== Helper Functions ========================= - - -def _ip_prefix_in_key(key): - """ - Function to check if IP prefix is present in a Redis database key. - If it is present, then the key will be a tuple. Otherwise, the - key will be a string. - """ - return (isinstance(key, tuple)) - -# ============================== Classes ============================== - - -class ControlPlaneAclManager(daemon_base.DaemonBase): - """ - Class which reads control plane ACL tables and rules from Config DB, - translates them into equivalent iptables commands and runs those - commands in order to apply the control plane ACLs. - Attributes: - config_db: Handle to Config Redis database via SwSS SDK - """ - ACL_TABLE = "ACL_TABLE" - ACL_RULE = "ACL_RULE" - DEVICE_METADATA_TABLE = "DEVICE_METADATA" - MUX_CABLE_TABLE = "MUX_CABLE_TABLE" - - ACL_TABLE_TYPE_CTRLPLANE = "CTRLPLANE" - - BFD_SESSION_TABLE = "BFD_SESSION_TABLE" - - # To specify a port range instead of a single port, use iptables format: - # separate start and end ports with a colon, e.g., "1000:2000" - ACL_SERVICES = { - "NTP": { - "ip_protocols": ["udp"], - "dst_ports": ["123"], - "multi_asic_ns_to_host_fwd":False - }, - "SNMP": { - "ip_protocols": ["tcp", "udp"], - "dst_ports": ["161"], - "multi_asic_ns_to_host_fwd":True - }, - "SSH": { - "ip_protocols": ["tcp"], - "dst_ports": ["22"], - "multi_asic_ns_to_host_fwd":True - }, - "ANY": { - "ip_protocols": ["any"], - "dst_ports": ["0"], - "multi_asic_ns_to_host_fwd":False - } - } - - UPDATE_DELAY_SECS = 0.5 - - DualToR = False - bfdAllowed = False - - def __init__(self, log_identifier): - super(ControlPlaneAclManager, self).__init__(log_identifier) - - # Update-thread-specific data per namespace - self.update_thread = {} - self.lock = {} - self.num_changes = {} - - # Initialize update-thread-specific data for default namespace - self.update_thread[DEFAULT_NAMESPACE] = None - self.lock[DEFAULT_NAMESPACE] = threading.Lock() - self.num_changes[DEFAULT_NAMESPACE] = 0 - - if device_info.is_multi_npu(): - swsscommon.SonicDBConfig.load_sonic_global_db_config() - - self.config_db_map = {} - self.iptables_cmd_ns_prefix = {} - self.config_db_map[DEFAULT_NAMESPACE] = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=DEFAULT_NAMESPACE) - self.config_db_map[DEFAULT_NAMESPACE].connect() - self.iptables_cmd_ns_prefix[DEFAULT_NAMESPACE] = "" - self.namespace_mgmt_ip = self.get_namespace_mgmt_ip(self.iptables_cmd_ns_prefix[DEFAULT_NAMESPACE], DEFAULT_NAMESPACE) - self.namespace_mgmt_ipv6 = self.get_namespace_mgmt_ipv6(self.iptables_cmd_ns_prefix[DEFAULT_NAMESPACE], DEFAULT_NAMESPACE) - self.namespace_docker_mgmt_ip = {} - self.namespace_docker_mgmt_ipv6 = {} - - metadata = self.config_db_map[DEFAULT_NAMESPACE].get_table(self.DEVICE_METADATA_TABLE) - if 'subtype' in metadata['localhost'] and metadata['localhost']['subtype'] == 'DualToR': - self.DualToR = True - - namespaces = multi_asic.get_all_namespaces() - - for front_asic_namespace in namespaces['front_ns']: - self.update_thread[front_asic_namespace] = None - self.lock[front_asic_namespace] = threading.Lock() - self.num_changes[front_asic_namespace] = 0 - - self.config_db_map[front_asic_namespace] = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=front_asic_namespace) - self.config_db_map[front_asic_namespace].connect() - self.iptables_cmd_ns_prefix[front_asic_namespace] = "ip netns exec " + front_asic_namespace + " " - self.namespace_docker_mgmt_ip[front_asic_namespace] = self.get_namespace_mgmt_ip(self.iptables_cmd_ns_prefix[front_asic_namespace], - front_asic_namespace) - self.namespace_docker_mgmt_ipv6[front_asic_namespace] = self.get_namespace_mgmt_ipv6(self.iptables_cmd_ns_prefix[front_asic_namespace], - front_asic_namespace) - - for back_asic_namespace in namespaces['back_ns']: - self.update_thread[back_asic_namespace] = None - self.lock[back_asic_namespace] = threading.Lock() - self.num_changes[back_asic_namespace] = 0 - - self.iptables_cmd_ns_prefix[back_asic_namespace] = "ip netns exec " + back_asic_namespace + " " - self.namespace_docker_mgmt_ip[back_asic_namespace] = self.get_namespace_mgmt_ip(self.iptables_cmd_ns_prefix[back_asic_namespace], - back_asic_namespace) - self.namespace_docker_mgmt_ipv6[back_asic_namespace] = self.get_namespace_mgmt_ipv6(self.iptables_cmd_ns_prefix[back_asic_namespace], - back_asic_namespace) - - def get_namespace_mgmt_ip(self, iptable_ns_cmd_prefix, namespace): - ip_address_get_command = iptable_ns_cmd_prefix + "ip -4 -o addr show " + ("eth0" if namespace else "docker0") +\ - " | awk '{print $4}' | cut -d'/' -f1 | head -1" - - return self.run_commands([ip_address_get_command]) - - def get_namespace_mgmt_ipv6(self, iptable_ns_cmd_prefix, namespace): - ipv6_address_get_command = iptable_ns_cmd_prefix + "ip -6 -o addr show scope global " + ("eth0" if namespace else "docker0") +\ - " | awk '{print $4}' | cut -d'/' -f1 | head -1" - return self.run_commands([ipv6_address_get_command]) - - def run_commands(self, commands): - """ - Given a list of shell commands, run them in order - Args: - commands: List of strings, each string is a shell command - """ - for cmd in commands: - proc = subprocess.Popen(cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE) - - (stdout, stderr) = proc.communicate() - - if proc.returncode != 0: - self.log_error("Error running command '{}'".format(cmd)) - elif stdout: - return stdout.rstrip('\n') - return "" - - def parse_int_to_tcp_flags(self, hex_value): - tcp_flags_str = "" - if hex_value & 0x01: - tcp_flags_str += "FIN," - if hex_value & 0x02: - tcp_flags_str += "SYN," - if hex_value & 0x04: - tcp_flags_str += "RST," - if hex_value & 0x08: - tcp_flags_str += "PSH," - if hex_value & 0x10: - tcp_flags_str += "ACK," - if hex_value & 0x20: - tcp_flags_str += "URG," - # iptables doesn't handle the flags below now. It has some special keys for it: - # --ecn-tcp-cwr This matches if the TCP ECN CWR (Congestion Window Received) bit is set. - # --ecn-tcp-ece This matches if the TCP ECN ECE (ECN Echo) bit is set. - # if hex_value & 0x40: - # tcp_flags_str += "ECE," - # if hex_value & 0x80: - # tcp_flags_str += "CWR," - - # Delete the trailing comma - tcp_flags_str = tcp_flags_str[:-1] - return tcp_flags_str - - def generate_block_ip2me_traffic_iptables_commands(self, namespace): - INTERFACE_TABLE_NAME_LIST = [ - "LOOPBACK_INTERFACE", - "MGMT_INTERFACE", - "VLAN_INTERFACE", - "PORTCHANNEL_INTERFACE", - "INTERFACE" - ] - - block_ip2me_cmds = [] - - # Add iptables rules to drop all packets destined for peer-to-peer interface IP addresses - for iface_table_name in INTERFACE_TABLE_NAME_LIST: - iface_table = self.config_db_map[namespace].get_table(iface_table_name) - if iface_table: - for key, _ in iface_table.items(): - if not _ip_prefix_in_key(key): - continue - - iface_name, iface_cidr = key - ip_ntwrk = ipaddress.ip_network(iface_cidr, strict=False) - - # For VLAN interfaces, the IP address we want to block is the default gateway (i.e., - # the first available host IP address of the VLAN subnet) - ip_addr = next(ip_ntwrk.hosts()) if iface_table_name == "VLAN_INTERFACE" else ip_ntwrk.network_address - - if isinstance(ip_ntwrk, ipaddress.IPv4Network): - block_ip2me_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -d {}/{} -j DROP".format(ip_addr, ip_ntwrk.max_prefixlen)) - elif isinstance(ip_ntwrk, ipaddress.IPv6Network): - block_ip2me_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -d {}/{} -j DROP".format(ip_addr, ip_ntwrk.max_prefixlen)) - else: - self.log_warning("Unrecognized IP address type on interface '{}': {}".format(iface_name, ip_ntwrk)) - - return block_ip2me_cmds - - def generate_allow_internal_docker_ip_traffic_commands(self, namespace): - allow_internal_docker_ip_cmds = [] - - if namespace: - # For namespace docker allow local communication on docker management ip for all proto - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s {} -d {} -j ACCEPT".format - (self.namespace_docker_mgmt_ip[namespace], self.namespace_docker_mgmt_ip[namespace])) - - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s {} -d {} -j ACCEPT".format - (self.namespace_docker_mgmt_ipv6[namespace], self.namespace_docker_mgmt_ipv6[namespace])) - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s {} -d {} -j ACCEPT".format - (self.namespace_mgmt_ip, self.namespace_docker_mgmt_ip[namespace])) - - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s {} -d {} -j ACCEPT".format - (self.namespace_mgmt_ipv6, self.namespace_docker_mgmt_ipv6[namespace])) - - else: - - # Also host namespace communication on docker bridge on multi-asic. - if self.namespace_docker_mgmt_ip: - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s {} -d {} -j ACCEPT".format - (self.namespace_mgmt_ip, self.namespace_mgmt_ip)) - - if self.namespace_docker_mgmt_ipv6: - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s {} -d {} -j ACCEPT".format - (self.namespace_mgmt_ipv6, self.namespace_mgmt_ipv6)) - # In host allow all tcp/udp traffic from namespace docker eth0 management ip to host docker bridge - for docker_mgmt_ip in list(self.namespace_docker_mgmt_ip.values()): - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s {} -d {} -j ACCEPT".format - (docker_mgmt_ip, self.namespace_mgmt_ip)) - - for docker_mgmt_ipv6 in list(self.namespace_docker_mgmt_ipv6.values()): - allow_internal_docker_ip_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s {} -d {} -j ACCEPT".format - (docker_mgmt_ipv6, self.namespace_mgmt_ipv6)) - - return allow_internal_docker_ip_cmds - - def generate_fwd_traffic_from_namespace_to_host_commands(self, namespace, acl_source_ip_map): - """ - The below SNAT and DNAT rules are added in asic namespace in multi-ASIC platforms. It helps to forward request coming - in through the front panel interfaces created/present in the asic namespace for the servie running in linux host network namespace. - The external IP addresses are NATed to the internal docker IP addresses for the Host service to respond. - """ - - if not namespace: - return [] - - fwd_traffic_from_namespace_to_host_cmds = [] - fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -t nat -X") - fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -t nat -F") - fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -t nat -X") - fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -t nat -F") - - for acl_service in self.ACL_SERVICES: - if self.ACL_SERVICES[acl_service]["multi_asic_ns_to_host_fwd"]: - # Get the Source IP Set if exists else use default source ip prefix - nat_source_ipv4_set = acl_source_ip_map[acl_service]["ipv4"] if acl_source_ip_map and acl_source_ip_map[acl_service]["ipv4"] else { "0.0.0.0/0" } - nat_source_ipv6_set = acl_source_ip_map[acl_service]["ipv6"] if acl_source_ip_map and acl_source_ip_map[acl_service]["ipv6"] else { "::/0" } - - for ip_protocol in self.ACL_SERVICES[acl_service]["ip_protocols"]: - for dst_port in self.ACL_SERVICES[acl_service]["dst_ports"]: - for ipv4_src_ip in nat_source_ipv4_set: - # IPv4 rules - fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + - "iptables -t nat -A PREROUTING -p {} -s {} --dport {} -j DNAT --to-destination {}".format - (ip_protocol, ipv4_src_ip, dst_port, - self.namespace_mgmt_ip)) - fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + - "iptables -t nat -A POSTROUTING -p {} -s {} --dport {} -j SNAT --to-source {}".format - (ip_protocol, ipv4_src_ip, dst_port, - self.namespace_docker_mgmt_ip[namespace])) - for ipv6_src_ip in nat_source_ipv6_set: - # IPv6 rules - fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + - "ip6tables -t nat -A PREROUTING -p {} -s {} --dport {} -j DNAT --to-destination {}".format - (ip_protocol, ipv6_src_ip, dst_port, - self.namespace_mgmt_ipv6)) - fwd_traffic_from_namespace_to_host_cmds.append(self.iptables_cmd_ns_prefix[namespace] + - "ip6tables -t nat -A POSTROUTING -p {} -s {} --dport {} -j SNAT --to-source {}".format - (ip_protocol,ipv6_src_ip, dst_port, - self.namespace_docker_mgmt_ipv6[namespace])) - - return fwd_traffic_from_namespace_to_host_cmds - - def is_rule_ipv4(self, rule_props): - if (("SRC_IP" in rule_props and rule_props["SRC_IP"]) or - ("DST_IP" in rule_props and rule_props["DST_IP"])): - return True - else: - return False - - def is_rule_ipv6(self, rule_props): - if (("SRC_IPV6" in rule_props and rule_props["SRC_IPV6"]) or - ("DST_IPV6" in rule_props and rule_props["DST_IPV6"])): - return True - else: - return False - - def setup_dhcp_chain(self, namespace): - all_chains = self.get_chain_list(self.iptables_cmd_ns_prefix[namespace], [""]) - dhcp_chain_exist = "DHCP" in all_chains - - iptables_cmds = [] - if dhcp_chain_exist: - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -F DHCP") - self.log_info("DHCP chain exists, flush") - else: - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -N DHCP") - self.log_info("DHCP chain does not exist, create") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A DHCP -j RETURN") - - self.log_info("Issuing the following iptables commands for DHCP chain:") - for cmd in iptables_cmds: - self.log_info(" " + cmd) - - self.run_commands(iptables_cmds) - - def get_chain_list(self, iptable_ns_cmd_prefix, exclude_list): - command = iptable_ns_cmd_prefix + "iptables -L -v -n | grep Chain | awk '{print $2}'" - chain_list = self.run_commands([command]).splitlines() - - for chain in exclude_list: - if chain in chain_list: - chain_list.remove(chain) - - return chain_list - - def dhcp_acl_rule(self, iptable_ns_cmd_prefix, op, intf, mark): - ''' - sample: iptables --insert/delete/check DHCP -m physdev --physdev-in Ethernet4 -j DROP - sample: iptables --insert/delete/check DHCP -m mark --mark 0x67004 -j DROP - ''' - if mark is None: - return iptable_ns_cmd_prefix + 'iptables --{} DHCP -m physdev --physdev-in {} -j DROP'.format(op, intf) - else: - return iptable_ns_cmd_prefix + 'iptables --{} DHCP -m mark --mark {} -j DROP'.format(op, mark) - - def update_dhcp_chain(self, op, intf, mark): - for namespace in list(self.config_db_map.keys()): - check_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "check", intf, mark) - update_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], op, intf, mark) - - execute = 0 - ret = subprocess.call(check_cmd, shell=True) # ret==0 indicates the rule exists - - if op == "insert" and ret == 1: - execute = 1 - if op == "delete" and ret == 0: - execute = 1 - - if execute == 1: - subprocess.call(update_cmd, shell=True) - self.log_info("Update DHCP chain: {}".format(update_cmd)) - - def update_dhcp_acl(self, key, op, data, mark): - if "state" not in data: - self.log_warning("Unexpected update in MUX_CABLE_TABLE") - return - - intf = key - state = data["state"] - - if state == "active": - self.update_dhcp_chain("delete", intf, mark) - elif state == "standby": - self.update_dhcp_chain("insert", intf, mark) - elif state == "unknown": - self.update_dhcp_chain("delete", intf, mark) - elif state == "error": - self.log_warning("Cable state shows error") - else: - self.log_warning("Unexpected cable state") - - def update_dhcp_acl_for_mark_change(self, key, pre_mark, cur_mark): - for namespace in list(self.config_db_map.keys()): - check_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "check", key, pre_mark) - - ret = subprocess.call(check_cmd, shell=True) # ret==0 indicates the rule exists - - '''update only when the rule with pre_mark exists''' - if ret == 0: - delete_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "delete", key, pre_mark) - insert_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "insert", key, cur_mark) - - subprocess.call(delete_cmd, shell=True) - self.log_info("Update DHCP chain: {}".format(delete_cmd)) - subprocess.call(insert_cmd, shell=True) - self.log_info("Update DHCP chain: {}".format(insert_cmd)) - - def get_acl_rules_and_translate_to_iptables_commands(self, namespace): - """ - Retrieves current ACL tables and rules from Config DB, translates - control plane ACLs into a list of iptables commands that can be run - in order to install ACL rules. - Returns: - A list of strings, each string is an iptables shell command - """ - iptables_cmds = [] - service_to_source_ip_map = {} - - # First, add iptables commands to set default policies to accept all - # traffic. In case we are connected remotely, the connection will not - # drop when we flush the current rules - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -P INPUT ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -P FORWARD ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -P OUTPUT ACCEPT") - - # Add iptables command to flush the current rules and delete all non-default chains - chain_list = self.get_chain_list(self.iptables_cmd_ns_prefix[namespace], ["DHCP"] if self.DualToR else [""]) - for chain in chain_list: - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -F " + chain) - if chain not in ["INPUT", "FORWARD", "OUTPUT"]: - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -X " + chain) - - # Add same set of commands for ip6tables - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -P INPUT ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -P FORWARD ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -P OUTPUT ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -F") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -X") - - # Add iptables/ip6tables commands to allow all traffic from localhost - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -s 127.0.0.1 -i lo -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -s ::1 -i lo -j ACCEPT") - - # Add iptables commands to allow internal docker traffic - iptables_cmds += self.generate_allow_internal_docker_ip_traffic_commands(namespace) - - # Add iptables/ip6tables commands to allow all incoming packets from established - # connections or new connections which are related to established connections - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT") - - # Add iptables/ip6tables commands to allow bidirectional ICMPv4 ping and traceroute - # TODO: Support processing ICMPv4 service ACL rules, and remove this blanket acceptance - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p icmp --icmp-type destination-unreachable -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p icmp --icmp-type time-exceeded -j ACCEPT") - - # Add iptables/ip6tables commands to allow bidirectional ICMPv6 ping and traceroute - # TODO: Support processing ICMPv6 service ACL rules, and remove this blanket acceptance - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p icmpv6 --icmpv6-type echo-request -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p icmpv6 --icmpv6-type echo-reply -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p icmpv6 --icmpv6-type destination-unreachable -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p icmpv6 --icmpv6-type time-exceeded -j ACCEPT") - - # Add iptables/ip6tables commands to allow all incoming Neighbor Discovery Protocol (NDP) NS/NA/RS/RA messages - # TODO: Support processing NDP service ACL rules, and remove this blanket acceptance - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p icmpv6 --icmpv6-type neighbor-solicitation -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p icmpv6 --icmpv6-type neighbor-advertisement -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p icmpv6 --icmpv6-type router-solicitation -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p icmpv6 --icmpv6-type router-advertisement -j ACCEPT") - - # Add iptables commands to link the DCHP chain to block dhcp packets based on ingress interfaces - if self.DualToR: - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p udp --dport 67 -j DHCP") - - # Add iptables/ip6tables commands to allow all incoming IPv4 DHCP packets - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p udp --dport 67:68 -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p udp --dport 67:68 -j ACCEPT") - - # Add iptables/ip6tables commands to allow all incoming IPv6 DHCP packets - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p udp --dport 546:547 -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p udp --dport 546:547 -j ACCEPT") - - # Add iptables/ip6tables commands to allow all incoming BGP traffic - # TODO: Determine BGP ACLs based on configured device sessions, and remove this blanket acceptance - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p tcp --dport 179 -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p tcp --dport 179 -j ACCEPT") - - # Get current ACL tables and rules from Config DB - self._tables_db_info = self.config_db_map[namespace].get_table(self.ACL_TABLE) - self._rules_db_info = self.config_db_map[namespace].get_table(self.ACL_RULE) - - num_ctrl_plane_acl_rules = 0 - - # Walk the ACL tables - for (table_name, table_data) in self._tables_db_info.items(): - - table_ip_version = None - - # Ignore non-control-plane ACL tables - if table_data["type"] != self.ACL_TABLE_TYPE_CTRLPLANE: - continue - - acl_services = table_data["services"] - - for acl_service in acl_services: - if acl_service not in self.ACL_SERVICES: - self.log_warning("Ignoring control plane ACL '{}' with unrecognized service '{}'" - .format(table_name, acl_service)) - continue - - self.log_info("Translating ACL rules for control plane ACL '{}' (service: '{}')" - .format(table_name, acl_service)) - - # Obtain default IP protocol(s) and destination port(s) for this service - ip_protocols = self.ACL_SERVICES[acl_service]["ip_protocols"] - dst_ports = self.ACL_SERVICES[acl_service]["dst_ports"] - - acl_rules = {} - - for ((rule_table_name, rule_id), rule_props) in self._rules_db_info.items(): - rule_props = {k.upper(): v for k,v in rule_props.items()} - if rule_table_name == table_name: - if not rule_props: - self.log_warning("rule_props for rule_id {} empty or null!".format(rule_id)) - continue - - try: - acl_rules[rule_props["PRIORITY"]] = rule_props - except KeyError: - self.log_error("rule_props for rule_id {} does not have key 'PRIORITY'!".format(rule_id)) - continue - - # If we haven't determined the IP version for this ACL table yet, - # try to do it now. We attempt to determine heuristically based on - # whether the src or dst IP of this rule is an IPv4 or IPv6 address. - if not table_ip_version: - if self.is_rule_ipv6(rule_props): - table_ip_version = 6 - elif self.is_rule_ipv4(rule_props): - table_ip_version = 4 - - if (self.is_rule_ipv6(rule_props) and (table_ip_version == 4)): - self.log_error("CtrlPlane ACL table {} is a IPv4 based table and rule {} is a IPV6 rule! Ignoring rule." - .format(table_name, rule_id)) - acl_rules.pop(rule_props["PRIORITY"]) - elif (self.is_rule_ipv4(rule_props) and (table_ip_version == 6)): - self.log_error("CtrlPlane ACL table {} is a IPv6 based table and rule {} is a IPV4 rule! Ignroing rule." - .format(table_name, rule_id)) - acl_rules.pop(rule_props["PRIORITY"]) - - # If we were unable to determine whether this ACL table contains - # IPv4 or IPv6 rules, log a message and skip processing this table. - if not table_ip_version: - self.log_warning("Unable to determine if ACL table '{}' contains IPv4 or IPv6 rules. Skipping table..." - .format(table_name)) - continue - ipv4_src_ip_set = set() - ipv6_src_ip_set = set() - # For each ACL rule in this table (in descending order of priority) - for priority in sorted(iter(acl_rules.keys()), reverse=True): - rule_props = acl_rules[priority] - - if "PACKET_ACTION" not in rule_props: - self.log_error("ACL rule does not contain PACKET_ACTION property") - continue - - # Apply the rule to the default protocol(s) for this ACL service - for ip_protocol in ip_protocols: - for dst_port in dst_ports: - rule_cmd = "ip6tables" if table_ip_version == 6 else "iptables" - - rule_cmd += " -A INPUT" - if ip_protocol != "any": - rule_cmd += " -p {}".format(ip_protocol) - - if "SRC_IPV6" in rule_props and rule_props["SRC_IPV6"]: - rule_cmd += " -s {}".format(rule_props["SRC_IPV6"]) - if rule_props["PACKET_ACTION"] == "ACCEPT": - ipv6_src_ip_set.add(rule_props["SRC_IPV6"]) - elif "SRC_IP" in rule_props and rule_props["SRC_IP"]: - rule_cmd += " -s {}".format(rule_props["SRC_IP"]) - if rule_props["PACKET_ACTION"] == "ACCEPT": - ipv4_src_ip_set.add(rule_props["SRC_IP"]) - - # Destination port 0 is reserved/unused port, so, using it to apply the rule to all ports. - if dst_port != "0": - rule_cmd += " --dport {}".format(dst_port) - - # If there are TCP flags present and ip protocol is TCP, append them - if ip_protocol == "tcp" and "TCP_FLAGS" in rule_props and rule_props["TCP_FLAGS"]: - tcp_flags, tcp_flags_mask = rule_props["TCP_FLAGS"].split("/") - - tcp_flags = int(tcp_flags, 16) - tcp_flags_mask = int(tcp_flags_mask, 16) - - if tcp_flags_mask > 0: - rule_cmd += " --tcp-flags {mask} {flags}".format(mask=self.parse_int_to_tcp_flags(tcp_flags_mask), flags=self.parse_int_to_tcp_flags(tcp_flags)) - - # Append the packet action as the jump target - rule_cmd += " -j {}".format(rule_props["PACKET_ACTION"]) - - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + rule_cmd) - num_ctrl_plane_acl_rules += 1 - - - service_to_source_ip_map.update({ acl_service:{ "ipv4":ipv4_src_ip_set, "ipv6":ipv6_src_ip_set } }) - - # Add iptables commands to block ip2me traffic - iptables_cmds += self.generate_block_ip2me_traffic_iptables_commands(namespace) - - # Add iptables/ip6tables commands to allow all incoming packets with TTL of 0 or 1 - # This allows the device to respond to tools like tcptraceroute - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -m ttl --ttl-lt 2 -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p tcp -m hl --hl-lt 2 -j ACCEPT") - - # Finally, if the device has control plane ACLs configured, - # add iptables/ip6tables commands to drop all other incoming packets - if num_ctrl_plane_acl_rules > 0: - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -j DROP") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -j DROP") - - return iptables_cmds, service_to_source_ip_map - - def update_control_plane_acls(self, namespace): - """ - Convenience wrapper which retrieves current ACL tables and rules from - Config DB, translates control plane ACLs into a list of iptables - commands and runs them. - """ - iptables_cmds, service_to_source_ip_map = self.get_acl_rules_and_translate_to_iptables_commands(namespace) - self.log_info("Issuing the following iptables commands:") - for cmd in iptables_cmds: - self.log_info(" " + cmd) - - self.run_commands(iptables_cmds) - - self.update_control_plane_nat_acls(namespace, service_to_source_ip_map) - - def update_control_plane_nat_acls(self, namespace, service_to_source_ip_map): - """ - Convenience wrapper for multi-asic platforms - which programs the NAT rules for redirecting the - traffic coming on the front panel interface map to namespace - to the host. - """ - # Add iptables commands to allow front panel traffic - iptables_cmds = self.generate_fwd_traffic_from_namespace_to_host_commands(namespace, service_to_source_ip_map) - - self.log_info("Issuing the following iptables commands:") - for cmd in iptables_cmds: - self.log_info(" " + cmd) - - self.run_commands(iptables_cmds) - - def check_and_update_control_plane_acls(self, namespace, num_changes): - """ - This function is intended to be spawned in a separate thread. - Its purpose is to prevent unnecessary iptables updates if we receive - multiple rapid ACL table update notifications. It sleeps for UPDATE_DELAY_SECS - then checks if any more ACL table updates were received in that window. If new - updates were received, it will sleep again and repeat the process until no - updates were received during the delay window, at which point it will update - iptables using the current ACL rules. - """ - while True: - # Sleep for our delay interval - time.sleep(self.UPDATE_DELAY_SECS) - - with self.lock[namespace]: - if self.num_changes[namespace] > num_changes: - # More ACL table changes occurred since this thread was spawned - # spawn a new thread with the current number of changes - new_changes = self.num_changes[namespace] - num_changes - self.log_info("ACL config not stable for namespace '{}': {} changes detected in the past {} seconds. Skipping update ..." - .format(namespace, new_changes, self.UPDATE_DELAY_SECS)) - num_changes = self.num_changes[namespace] - else: - if num_changes == self.num_changes[namespace] and num_changes > 0: - self.log_info("ACL config for namespace '{}' has not changed for {} seconds. Applying updates ..." - .format(namespace, self.UPDATE_DELAY_SECS)) - self.update_control_plane_acls(namespace) - else: - self.log_error("Error updating ACLs for namespace '{}'".format(namespace)) - - # Re-initialize - self.num_changes[namespace] = 0 - self.update_thread[namespace] = None - return - - def allow_bfd_protocol(self, namespace): - iptables_cmds = [] - # Add iptables/ip6tables commands to allow all BFD singlehop and multihop sessions - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -I INPUT 2 -p udp -m multiport --dports 3784,4784 -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -I INPUT 2 -p udp -m multiport --dports 3784,4784 -j ACCEPT") - self.run_commands(iptables_cmds) - - def run(self): - # Set select timeout to 1 second - SELECT_TIMEOUT_MS = 1000 - - self.log_info("Starting up ...") - - if not os.geteuid() == 0: - self.log_error("Must be root to run this daemon") - print("Error: Must be root to run this daemon") - sys.exit(1) - - # Initlaize Global config that loads all database*.json - if device_info.is_multi_npu(): - swsscommon.SonicDBConfig.initializeGlobalConfig() - - # Create the Select object - sel = swsscommon.Select() - - # Set up STATE_DB connector to monitor the change in MUX_CABLE_TABLE - state_db_connector = None - subscribe_mux_cable = None - subscribe_dhcp_packet_mark = None - state_db_id = swsscommon.SonicDBConfig.getDbId("STATE_DB") - dhcp_packet_mark_tbl = {} - - # set up state_db connector - state_db_connector = swsscommon.DBConnector("STATE_DB", 0) - - if self.DualToR: - self.log_info("Dual ToR mode") - - subscribe_mux_cable = swsscommon.SubscriberStateTable(state_db_connector, self.MUX_CABLE_TABLE) - sel.addSelectable(subscribe_mux_cable) - - subscribe_dhcp_packet_mark = swsscommon.SubscriberStateTable(state_db_connector, "DHCP_PACKET_MARK") - sel.addSelectable(subscribe_dhcp_packet_mark) - - # create DHCP chain - for namespace in list(self.config_db_map.keys()): - self.setup_dhcp_chain(namespace) - - # This should be migrated from state_db BFD session table to feature_table in the future when feature table support gets added for BFD - subscribe_bfd_session = swsscommon.SubscriberStateTable(state_db_connector, self.BFD_SESSION_TABLE) - sel.addSelectable(subscribe_bfd_session) - - # Map of Namespace <--> susbcriber table's object - config_db_subscriber_table_map = {} - - # Loop through all asic namespaces (if present) and host namespace (DEFAULT_NAMESPACE) - for namespace in list(self.config_db_map.keys()): - # Unconditionally update control plane ACLs once at start on given namespace - self.update_control_plane_acls(namespace) - # Connect to Config DB of given namespace - acl_db_connector = swsscommon.DBConnector("CONFIG_DB", 0, False, namespace) - # Subscribe to notifications when ACL tables changes - subscribe_acl_table = swsscommon.SubscriberStateTable(acl_db_connector, swsscommon.CFG_ACL_TABLE_TABLE_NAME) - # Subscribe to notifications when ACL rule tables changes - subscribe_acl_rule_table = swsscommon.SubscriberStateTable(acl_db_connector, swsscommon.CFG_ACL_RULE_TABLE_NAME) - # Add both tables to the selectable object - sel.addSelectable(subscribe_acl_table) - sel.addSelectable(subscribe_acl_rule_table) - # Update the map - config_db_subscriber_table_map[namespace] = [] - config_db_subscriber_table_map[namespace].append(subscribe_acl_table) - config_db_subscriber_table_map[namespace].append(subscribe_acl_rule_table) - - # Get the ACL rule table seprator - acl_rule_table_seprator = subscribe_acl_rule_table.getTableNameSeparator() - - # Loop on select to see if any event happen on state db or config db of any namespace - while True: - (state, selectableObj) = sel.select(SELECT_TIMEOUT_MS) - # Continue if select is timeout or selectable object is not return - if state != swsscommon.Select.OBJECT: - continue - - # Get the redisselect object from selectable object - redisSelectObj = swsscommon.CastSelectableToRedisSelectObj(selectableObj) - - # Get the corresponding namespace and db_id from redisselect - namespace = redisSelectObj.getDbConnector().getNamespace() - db_id = redisSelectObj.getDbConnector().getDbId() - - if db_id == state_db_id: - while True: - key, op, fvs = subscribe_bfd_session.pop() - if not key: - break - - if op == 'SET' and not self.bfdAllowed: - self.allow_bfd_protocol(namespace) - self.bfdAllowed = True - sel.removeSelectable(subscribe_bfd_session) - - if self.DualToR: - '''dhcp packet mark update''' - while True: - key, op, fvs = subscribe_dhcp_packet_mark.pop() - if not key: - break - self.log_info("dhcp packet mark update : '%s'" % str((key, op, fvs))) - - '''initial value is None''' - pre_mark = None if key not in dhcp_packet_mark_tbl else dhcp_packet_mark_tbl[key] - cur_mark = None if op == 'DEL' else dict(fvs)['mark'] - dhcp_packet_mark_tbl[key] = cur_mark - self.update_dhcp_acl_for_mark_change(key, pre_mark, cur_mark) - - '''mux cable update''' - while True: - key, op, fvs = subscribe_mux_cable.pop() - if not key: - break - self.log_info("mux cable update : '%s'" % str((key, op, fvs))) - - mark = None if key not in dhcp_packet_mark_tbl else dhcp_packet_mark_tbl[key] - self.update_dhcp_acl(key, op, dict(fvs), mark) - continue - - ctrl_plane_acl_notification = set() - - # Pop data of both Subscriber Table object of namespace that got config db acl table event - for table in config_db_subscriber_table_map[namespace]: - while True: - (key, op, fvp) = table.pop() - # Pop of table that does not have data so break - if key == '': - break - # ACL Table notification. We will take Control Plane ACTION for any ACL Table Event - # This can be optimize further but we should not have many acl table set/del events in normal - # scenario - if acl_rule_table_seprator not in key: - ctrl_plane_acl_notification.add(namespace) - # Check ACL Rule notification and make sure Rule point to ACL Table which is Controlplane - else: - acl_table = key.split(acl_rule_table_seprator)[0] - if self.config_db_map[namespace].get_table(self.ACL_TABLE)[acl_table]["type"] == self.ACL_TABLE_TYPE_CTRLPLANE: - ctrl_plane_acl_notification.add(namespace) - - # Update the Control Plane ACL of the namespace that got config db acl table event - for namespace in ctrl_plane_acl_notification: - with self.lock[namespace]: - if self.num_changes[namespace] == 0: - self.log_info("ACL change detected for namespace '{}'".format(namespace)) - - # Increment the number of change events we've received for this namespace - self.num_changes[namespace] += 1 - - # If an update thread is not already spawned for the namespace which we received - # the ACL table update event, spawn one now - if not self.update_thread[namespace]: - self.log_info("Spawning ACL update thread for namepsace '{}' ...".format(namespace)) - self.update_thread[namespace] = threading.Thread(target=self.check_and_update_control_plane_acls, - args=(namespace, self.num_changes[namespace])) - self.update_thread[namespace].start() - -# ============================= Functions ============================= - - -def main(): - # Instantiate a ControlPlaneAclManager object - caclmgr = ControlPlaneAclManager(SYSLOG_IDENTIFIER) - - # Log all messages from INFO level and higher - caclmgr.set_min_log_priority_info() - - caclmgr.run() - - -if __name__ == "__main__": - main() diff --git a/src/sonic-host-services/scripts/determine-reboot-cause b/src/sonic-host-services/scripts/determine-reboot-cause deleted file mode 100755 index 1408ad0e2952..000000000000 --- a/src/sonic-host-services/scripts/determine-reboot-cause +++ /dev/null @@ -1,228 +0,0 @@ -#!/usr/bin/env python3 -# -# determine-reboot-cause -# -# Program designed to run once, soon after system boot which will -# determine the cause of the previous reboot and store it to the disk, -# - -try: - import datetime - import json - import os - import pwd - import re - import sys - - from sonic_py_common import device_info, logger - -except ImportError as err: - raise ImportError("%s - required module not found" % str(err)) - -VERSION = "1.0" - -SYSLOG_IDENTIFIER = "determine-reboot-cause" - -REBOOT_CAUSE_DIR = "/host/reboot-cause/" -REBOOT_CAUSE_HISTORY_DIR = "/host/reboot-cause/history/" -REBOOT_CAUSE_FILE = os.path.join(REBOOT_CAUSE_DIR, "reboot-cause.txt") -PREVIOUS_REBOOT_CAUSE_FILE = os.path.join(REBOOT_CAUSE_DIR, "previous-reboot-cause.json") -FIRST_BOOT_PLATFORM_FILE = "/tmp/notify_firstboot_to_platform" -REBOOT_TYPE_KEXEC_FILE = "/proc/cmdline" -# The following SONIC_BOOT_TYPEs come from the warm/fast reboot script which is in sonic-utilities -# Because the system can be rebooted from some old versions, we have to take all possible BOOT options into consideration. -# On 201803, 201807 we have -# BOOT_OPTIONS="$(echo $KERNEL_OPTIONS | sed -e 's/\s*linux\s*/BOOT_IMAGE=/') fast-reboot" -# On 201811 and later we have -# BOOT_OPTIONS="$(echo $KERNEL_OPTIONS | sed -e 's/\s*linux\s*/BOOT_IMAGE=/') SONIC_BOOT_TYPE=${BOOT_TYPE_ARG}" where BOOT_TYPE_ARG can be warm, fastfast or fast -# To extract the commom part of them, we should have the following PATTERN -REBOOT_TYPE_KEXEC_PATTERN_WARM = ".*SONIC_BOOT_TYPE=(warm|fastfast).*" -REBOOT_TYPE_KEXEC_PATTERN_FAST = ".*SONIC_BOOT_TYPE=(fast|fast-reboot).*" - -REBOOT_CAUSE_UNKNOWN = "Unknown" -REBOOT_CAUSE_NON_HARDWARE = "Non-Hardware" -REBOOT_CAUSE_HARDWARE_OTHER = "Hardware - Other" - -# Global logger class instance -sonic_logger = logger.Logger(SYSLOG_IDENTIFIER) - - -# ============================= Functions ============================= -def parse_warmfast_reboot_from_proc_cmdline(): - if os.path.isfile(REBOOT_TYPE_KEXEC_FILE): - with open(REBOOT_TYPE_KEXEC_FILE) as cause_file: - cause_file_kexec = cause_file.readline() - m = re.search(REBOOT_TYPE_KEXEC_PATTERN_WARM, cause_file_kexec) - if m and m.group(1): - return 'warm-reboot' - m = re.search(REBOOT_TYPE_KEXEC_PATTERN_FAST, cause_file_kexec) - if m and m.group(1): - return 'fast-reboot' - return None - - -def find_software_reboot_cause_from_reboot_cause_file(): - software_reboot_cause = REBOOT_CAUSE_UNKNOWN - if os.path.isfile(REBOOT_CAUSE_FILE): - with open(REBOOT_CAUSE_FILE) as cause_file: - software_reboot_cause = cause_file.readline().rstrip('\n') - sonic_logger.log_info("{} indicates the reboot cause: {}".format(REBOOT_CAUSE_FILE, software_reboot_cause)) - else: - sonic_logger.log_info("Reboot cause file {} not found".format(REBOOT_CAUSE_FILE)) - return software_reboot_cause - - -def find_first_boot_version(): - build_version = "unknown" - version_info = device_info.get_sonic_version_info() - if version_info: - build_version = version_info['build_version'] - return " (First boot of SONiC version {})".format(build_version) - - -def find_software_reboot_cause(): - software_reboot_cause = find_software_reboot_cause_from_reboot_cause_file() - if software_reboot_cause == REBOOT_CAUSE_UNKNOWN: - if os.path.isfile(FIRST_BOOT_PLATFORM_FILE): - software_reboot_cause += find_first_boot_version() - os.remove(FIRST_BOOT_PLATFORM_FILE) - return software_reboot_cause - - -def find_proc_cmdline_reboot_cause(): - proc_cmdline_reboot_cause = parse_warmfast_reboot_from_proc_cmdline() - - if proc_cmdline_reboot_cause: - sonic_logger.log_info("/proc/cmdline indicates reboot type: {}".format(proc_cmdline_reboot_cause)) - else: - sonic_logger.log_info("No reboot cause found from /proc/cmdline") - - return proc_cmdline_reboot_cause - - -def get_reboot_cause_from_platform(): - # Find hardware reboot cause using sonic_platform library - try: - import sonic_platform - platform = sonic_platform.platform.Platform() - chassis = platform.get_chassis() - hardware_reboot_cause_major, hardware_reboot_cause_minor = chassis.get_reboot_cause() - sonic_logger.log_info("Platform api returns reboot cause {}, {}".format(hardware_reboot_cause_major, hardware_reboot_cause_minor)) - except ImportError: - sonic_logger.log_warning("sonic_platform package not installed. Unable to detect hardware reboot causes.") - hardware_reboot_cause_major, hardware_reboot_cause_minor = REBOOT_CAUSE_NON_HARDWARE, "N/A" - - return hardware_reboot_cause_major, hardware_reboot_cause_minor - - -def find_hardware_reboot_cause(): - hardware_reboot_cause_major, hardware_reboot_cause_minor = get_reboot_cause_from_platform() - if hardware_reboot_cause_major: - sonic_logger.log_info("Platform api indicates reboot cause {}".format(hardware_reboot_cause_major)) - else: - sonic_logger.log_info("No reboot cause found from platform api") - - hardware_reboot_cause = "{} ({})".format(hardware_reboot_cause_major, hardware_reboot_cause_minor) - return hardware_reboot_cause - - -def get_reboot_cause_dict(previous_reboot_cause, comment, gen_time): - """Store the key infomation of device reboot into a dictionary by parsing the string in - previous_reboot_cause. - - If user issused a command to reboot device, then user, command and time will be - stored into a dictionary. - - If device was rebooted due to the kernel panic, then the string `Kernel Panic` - and time will be stored into a dictionary. - """ - reboot_cause_dict = {} - reboot_cause_dict['gen_time'] = gen_time - reboot_cause_dict['cause'] = previous_reboot_cause - reboot_cause_dict['user'] = "N/A" - reboot_cause_dict['time'] = "N/A" - reboot_cause_dict['comment'] = comment if comment is not None else "N/A" - - if re.search(r'User issued', previous_reboot_cause): - # Match with "User issued '{}' command [User: {}, Time: {}]" - match = re.search(r'User issued \'(.*)\' command \[User: (.*), Time: (.*)\]', previous_reboot_cause) - if match is not None: - reboot_cause_dict['cause'] = match.group(1) - reboot_cause_dict['user'] = match.group(2) - reboot_cause_dict['time'] = match.group(3) - elif re.search(r'Kernel Panic', previous_reboot_cause): - match = re.search(r'Kernel Panic \[Time: (.*)\]', previous_reboot_cause) - if match is not None: - reboot_cause_dict['cause'] = "Kernel Panic" - reboot_cause_dict['time'] = match.group(1) - - return reboot_cause_dict - - -def main(): - # Configure logger to log all messages INFO level and higher - sonic_logger.set_min_log_priority_info() - - sonic_logger.log_info("Starting up...") - - if not os.geteuid() == 0: - sonic_logger.log_error("User {} does not have permission to execute".format(pwd.getpwuid(os.getuid()).pw_name)) - sys.exit("This utility must be run as root") - - # Create REBOOT_CAUSE_DIR if it doesn't exist - if not os.path.exists(REBOOT_CAUSE_DIR): - os.makedirs(REBOOT_CAUSE_DIR) - - # Remove stale PREVIOUS_REBOOT_CAUSE_FILE if it exists - if os.path.exists(PREVIOUS_REBOOT_CAUSE_FILE): - os.remove(PREVIOUS_REBOOT_CAUSE_FILE) - - # This variable is kept for future-use purpose. When proc_cmd_line/vendor/software provides - # any additional_reboot_info it will be stored as a "comment" in REBOOT_CAUSE_HISTORY_FILE - additional_reboot_info = "N/A" - - # Check if the previous reboot was warm/fast reboot by testing whether there is "fast|fastfast|warm" in /proc/cmdline - proc_cmdline_reboot_cause = find_proc_cmdline_reboot_cause() - - # If /proc/cmdline does not indicate reboot cause, check if the previous reboot was caused by hardware - if proc_cmdline_reboot_cause is None: - previous_reboot_cause = find_hardware_reboot_cause() - if previous_reboot_cause.startswith(REBOOT_CAUSE_NON_HARDWARE): - # If the reboot cause is non-hardware, get the reboot cause from REBOOT_CAUSE_FILE - previous_reboot_cause = find_software_reboot_cause() - else: - # Get the reboot cause from REBOOT_CAUSE_FILE - previous_reboot_cause = find_software_reboot_cause() - - # Current time - reboot_cause_gen_time = str(datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%S')) - - # Save the previous cause info into its history file as json format - reboot_cause_dict = get_reboot_cause_dict(previous_reboot_cause, additional_reboot_info, reboot_cause_gen_time) - - # Create reboot-cause-#time#.json under history directory - REBOOT_CAUSE_HISTORY_FILE = os.path.join(REBOOT_CAUSE_HISTORY_DIR, "reboot-cause-{}.json".format(reboot_cause_gen_time)) - - # Create REBOOT_CAUSE_HISTORY_DIR if it doesn't exist - if not os.path.exists(REBOOT_CAUSE_HISTORY_DIR): - os.makedirs(REBOOT_CAUSE_HISTORY_DIR) - - # Write the previous reboot cause to REBOOT_CAUSE_HISTORY_FILE as a JSON format - with open(REBOOT_CAUSE_HISTORY_FILE, "w") as reboot_cause_history_file: - json.dump(reboot_cause_dict, reboot_cause_history_file) - - # Create a symbolic link to previous-reboot-cause.json file - os.symlink(REBOOT_CAUSE_HISTORY_FILE, PREVIOUS_REBOOT_CAUSE_FILE) - - - # Remove the old REBOOT_CAUSE_FILE - if os.path.exists(REBOOT_CAUSE_FILE): - os.remove(REBOOT_CAUSE_FILE) - - # Write a new default reboot cause file for the next reboot - with open(REBOOT_CAUSE_FILE, "w") as cause_file: - cause_file.write(REBOOT_CAUSE_UNKNOWN) - - -if __name__ == "__main__": - main() diff --git a/src/sonic-host-services/scripts/hostcfgd b/src/sonic-host-services/scripts/hostcfgd deleted file mode 100755 index a82a630bfc0a..000000000000 --- a/src/sonic-host-services/scripts/hostcfgd +++ /dev/null @@ -1,1471 +0,0 @@ -#!/usr/bin/env python3 - -import ast -import copy -import ipaddress -import os -import sys -import subprocess -import syslog -import signal -import re -import jinja2 -from sonic_py_common import device_info -from swsscommon.swsscommon import ConfigDBConnector, DBConnector, Table - -# FILE -PAM_AUTH_CONF = "/etc/pam.d/common-auth-sonic" -PAM_AUTH_CONF_TEMPLATE = "/usr/share/sonic/templates/common-auth-sonic.j2" -PAM_PASSWORD_CONF = "/etc/pam.d/common-password" -PAM_PASSWORD_CONF_TEMPLATE = "/usr/share/sonic/templates/common-password.j2" -NSS_TACPLUS_CONF = "/etc/tacplus_nss.conf" -NSS_TACPLUS_CONF_TEMPLATE = "/usr/share/sonic/templates/tacplus_nss.conf.j2" -NSS_RADIUS_CONF = "/etc/radius_nss.conf" -NSS_RADIUS_CONF_TEMPLATE = "/usr/share/sonic/templates/radius_nss.conf.j2" -PAM_RADIUS_AUTH_CONF_TEMPLATE = "/usr/share/sonic/templates/pam_radius_auth.conf.j2" -NSS_CONF = "/etc/nsswitch.conf" -ETC_PAMD_SSHD = "/etc/pam.d/sshd" -ETC_PAMD_LOGIN = "/etc/pam.d/login" -ETC_LOGIN_DEF = "/etc/login.defs" - -# Linux login.def default values (password hardening disable) -LINUX_DEFAULT_PASS_MAX_DAYS = 99999 -LINUX_DEFAULT_PASS_WARN_AGE = 7 - -ACCOUNT_NAME = 0 # index of account name -AGE_DICT = { 'MAX_DAYS': {'REGEX_DAYS': r'^PASS_MAX_DAYS[ \t]*(?P\d*)', 'DAYS': 'max_days', 'CHAGE_FLAG': '-M '}, - 'WARN_DAYS': {'REGEX_DAYS': r'^PASS_WARN_AGE[ \t]*(?P\d*)', 'DAYS': 'warn_days', 'CHAGE_FLAG': '-W '} - } -PAM_LIMITS_CONF_TEMPLATE = "/usr/share/sonic/templates/pam_limits.j2" -LIMITS_CONF_TEMPLATE = "/usr/share/sonic/templates/limits.conf.j2" -PAM_LIMITS_CONF = "/etc/pam.d/pam-limits-conf" -LIMITS_CONF = "/etc/security/limits.conf" - -# TACACS+ -TACPLUS_SERVER_PASSKEY_DEFAULT = "" -TACPLUS_SERVER_TIMEOUT_DEFAULT = "5" -TACPLUS_SERVER_AUTH_TYPE_DEFAULT = "pap" - -# RADIUS -RADIUS_SERVER_AUTH_PORT_DEFAULT = "1812" -RADIUS_SERVER_PASSKEY_DEFAULT = "" -RADIUS_SERVER_RETRANSMIT_DEFAULT = "3" -RADIUS_SERVER_TIMEOUT_DEFAULT = "5" -RADIUS_SERVER_AUTH_TYPE_DEFAULT = "pap" -RADIUS_PAM_AUTH_CONF_DIR = "/etc/pam_radius_auth.d/" - -# MISC Constants -CFG_DB = "CONFIG_DB" -STATE_DB = "STATE_DB" -HOSTCFGD_MAX_PRI = 10 # Used to enforce ordering b/w daemons under Hostcfgd -DEFAULT_SELECT_TIMEOUT = 1000 - - -def safe_eval(val, default_value=False): - """ Safely evaluate the expression, without raising an exception """ - try: - ret = ast.literal_eval(val) - except ValueError: - ret = default_value - return ret - - -def signal_handler(sig, frame): - if sig == signal.SIGHUP: - syslog.syslog(syslog.LOG_INFO, "HostCfgd: signal 'SIGHUP' is caught and ignoring..") - elif sig == signal.SIGINT: - syslog.syslog(syslog.LOG_INFO, "HostCfgd: signal 'SIGINT' is caught and exiting...") - sys.exit(128 + sig) - elif sig == signal.SIGTERM: - syslog.syslog(syslog.LOG_INFO, "HostCfgd: signal 'SIGTERM' is caught and exiting...") - sys.exit(128 + sig) - else: - syslog.syslog(syslog.LOG_INFO, "HostCfgd: invalid signal - ignoring..") - - -def run_cmd(cmd, log_err=True, raise_exception=False): - try: - subprocess.check_call(cmd, shell=True) - except Exception as err: - if log_err: - syslog.syslog(syslog.LOG_ERR, "{} - failed: return code - {}, output:\n{}" - .format(err.cmd, err.returncode, err.output)) - if raise_exception: - raise - - -def is_true(val): - if val == 'True' or val == 'true': - return True - elif val == 'False' or val == 'false': - return False - syslog.syslog(syslog.LOG_ERR, "Failed to get bool value, instead val= {}".format(val)) - return False - - -def is_vlan_sub_interface(ifname): - ifname_split = ifname.split(".") - return (len(ifname_split) == 2) - - -def sub(l, start, end): - return l[start:end] - - -def obfuscate(data): - if data: - return data[0] + '*****' - else: - return data - - -def get_pid(procname): - for dirname in os.listdir('/proc'): - if dirname == 'curproc': - continue - try: - with open('/proc/{}/cmdline'.format(dirname), mode='r') as fd: - content = fd.read() - except Exception as ex: - continue - if procname in content: - return dirname - return "" - - -class Feature(object): - """ Represents a feature configuration from CONFIG_DB data. """ - - def __init__(self, feature_name, feature_cfg, device_config=None): - """ Initialize Feature object based on CONFIG_DB data. - - Args: - feature_name (str): Feature name string - feature_cfg (dict): Feature CONFIG_DB configuration - deviec_config (dict): DEVICE_METADATA section of CONFIG_DB - """ - - self.name = feature_name - self.state = self._get_target_state(feature_cfg.get('state'), device_config or {}) - self.auto_restart = feature_cfg.get('auto_restart', 'disabled') - self.has_timer = safe_eval(feature_cfg.get('has_timer', 'False')) - self.has_global_scope = safe_eval(feature_cfg.get('has_global_scope', 'True')) - self.has_per_asic_scope = safe_eval(feature_cfg.get('has_per_asic_scope', 'False')) - - def _get_target_state(self, state_configuration, device_config): - """ Returns the target state for the feature by rendering the state field as J2 template. - - Args: - state_configuration (str): State configuration from CONFIG_DB - deviec_config (dict): DEVICE_METADATA section of CONFIG_DB - Returns: - (str): Target feature state - """ - - if state_configuration is None: - return None - - template = jinja2.Template(state_configuration) - target_state = template.render(device_config) - if target_state not in ('enabled', 'disabled', 'always_enabled', 'always_disabled'): - raise ValueError('Invalid state rendered for feature {}: {}'.format(self.name, target_state)) - return target_state - - def compare_state(self, feature_name, feature_cfg): - if self.name != feature_name or not isinstance(feature_cfg, dict): - return False - - if self.state != feature_cfg.get('state', ''): - return False - return True - - -class FeatureHandler(object): - """ Handles FEATURE table updates. """ - - SYSTEMD_SYSTEM_DIR = '/etc/systemd/system/' - SYSTEMD_SERVICE_CONF_DIR = os.path.join(SYSTEMD_SYSTEM_DIR, '{}.service.d/') - - # Feature state constants - FEATURE_STATE_ENABLED = "enabled" - FEATURE_STATE_DISABLED = "disabled" - FEATURE_STATE_FAILED = "failed" - - def __init__(self, config_db, feature_state_table, device_config): - self._config_db = config_db - self._feature_state_table = feature_state_table - self._device_config = device_config - self._cached_config = {} - self.is_multi_npu = device_info.is_multi_npu() - - def handler(self, feature_name, op, feature_cfg): - if not feature_cfg: - syslog.syslog(syslog.LOG_INFO, "Deregistering feature {}".format(feature_name)) - self._cached_config.pop(feature_name, None) - self._feature_state_table._del(feature_name) - return - - feature = Feature(feature_name, feature_cfg, self._device_config) - self._cached_config.setdefault(feature_name, Feature(feature_name, {})) - - # Change auto-restart configuration first. - # If service reached failed state before this configuration applies (e.g. on boot) - # the next called self.update_feature_state will start it again. If it will fail - # again the auto restart will kick-in. Another order may leave it in failed state - # and not auto restart. - if self._cached_config[feature_name].auto_restart != feature.auto_restart: - syslog.syslog(syslog.LOG_INFO, "Auto-restart status of feature '{}' is changed from '{}' to '{}' ..." - .format(feature_name, self._cached_config[feature_name].auto_restart, feature.auto_restart)) - self.update_systemd_config(feature) - self._cached_config[feature_name].auto_restart = feature.auto_restart - - # Enable/disable the container service if the feature state was changed from its previous state. - if self._cached_config[feature_name].state != feature.state: - if self.update_feature_state(feature): - self._cached_config[feature_name].state = feature.state - else: - self.resync_feature_state(self._cached_config[feature_name]) - - 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 - """ - 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) - - self._cached_config.setdefault(feature_name, feature) - self.update_systemd_config(feature) - self.update_feature_state(feature) - self.resync_feature_state(feature) - - def update_feature_state(self, feature): - cached_feature = self._cached_config[feature.name] - enable = False - disable = False - - # Allowed transitions: - # None -> always_enabled - # -> always_disabled - # -> enabled - # -> disabled - # always_enabled -> always_disabled - # enabled -> disabled - # disabled -> enabled - if cached_feature.state is None: - enable = feature.state in ("always_enabled", "enabled") - disable = feature.state in ("always_disabled", "disabled") - elif cached_feature.state in ("always_enabled", "always_disabled"): - disable = feature.state == "always_disabled" - enable = feature.state == "always_enabled" - elif cached_feature.state in ("enabled", "disabled"): - enable = feature.state == "enabled" - disable = feature.state == "disabled" - else: - syslog.syslog(syslog.LOG_INFO, "Feature {} service is {}".format(feature.name, cached_feature.state)) - return False - - if not enable and not disable: - syslog.syslog(syslog.LOG_ERR, "Unexpected state value '{}' for feature {}" - .format(feature.state, feature.name)) - return False - - if enable: - self.enable_feature(feature) - syslog.syslog(syslog.LOG_INFO, "Feature {} is enabled and started".format(feature.name)) - - if disable: - self.disable_feature(feature) - syslog.syslog(syslog.LOG_INFO, "Feature {} is stopped and disabled".format(feature.name)) - - return True - - def update_systemd_config(self, feature_config): - """Updates `Restart=` field in feature's systemd configuration file - according to the value of `auto_restart` field in `FEATURE` table of `CONFIG_DB`. - - Args: - feature: An object represents a feature's configuration in `FEATURE` - table of `CONFIG_DB`. - - Returns: - None. - """ - restart_field_str = "always" if "enabled" in feature_config.auto_restart else "no" - feature_systemd_config = "[Service]\nRestart={}\n".format(restart_field_str) - feature_names, feature_suffixes = self.get_multiasic_feature_instances(feature_config) - - # On multi-ASIC device, creates systemd configuration file for each feature instance - # residing in difference namespace. - for feature_name in feature_names: - syslog.syslog(syslog.LOG_INFO, "Updating feature '{}' systemd config file related to auto-restart ..." - .format(feature_name)) - feature_systemd_config_dir_path = self.SYSTEMD_SERVICE_CONF_DIR.format(feature_name) - feature_systemd_config_file_path = os.path.join(feature_systemd_config_dir_path, 'auto_restart.conf') - - if not os.path.exists(feature_systemd_config_dir_path): - os.mkdir(feature_systemd_config_dir_path) - with open(feature_systemd_config_file_path, 'w') as feature_systemd_config_file_handler: - feature_systemd_config_file_handler.write(feature_systemd_config) - - syslog.syslog(syslog.LOG_INFO, "Feautre '{}' systemd config file related to auto-restart is updated!" - .format(feature_name)) - - try: - syslog.syslog(syslog.LOG_INFO, "Reloading systemd configuration files ...") - run_cmd("sudo systemctl daemon-reload", raise_exception=True) - syslog.syslog(syslog.LOG_INFO, "Systemd configuration files are reloaded!") - except Exception as err: - syslog.syslog(syslog.LOG_ERR, "Failed to reload systemd configuration files!") - - def get_multiasic_feature_instances(self, feature): - # Create feature name suffix depending feature is running in host or namespace or in both - feature_names = ( - ([feature.name] if feature.has_global_scope or not self.is_multi_npu else []) + - ([(feature.name + '@' + str(asic_inst)) for asic_inst in range(device_info.get_num_npus()) - if feature.has_per_asic_scope and self.is_multi_npu]) - ) - - if not feature_names: - syslog.syslog(syslog.LOG_ERR, "Feature '{}' service not available" - .format(feature.name)) - - feature_suffixes = ["service"] + (["timer"] if feature.has_timer else []) - - return feature_names, feature_suffixes - - def get_systemd_unit_state(self, unit): - """ Returns service configuration """ - - cmd = "sudo systemctl show {} --property UnitFileState".format(unit) - proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = proc.communicate() - if proc.returncode != 0: - syslog.syslog(syslog.LOG_ERR, "Failed to get status of {}: rc={} stderr={}".format(unit, proc.returncode, stderr)) - return 'invalid' # same as systemd's "invalid indicates that it could not be determined whether the unit file is enabled". - - props = dict([line.split("=") for line in stdout.decode().strip().splitlines()]) - return props["UnitFileState"] - - def enable_feature(self, feature): - cmds = [] - feature_names, feature_suffixes = self.get_multiasic_feature_instances(feature) - for feature_name in feature_names: - # Check if it is already enabled, if yes skip the system call - unit_file_state = self.get_systemd_unit_state("{}.{}".format(feature_name, feature_suffixes[-1])) - if unit_file_state == "enabled": - continue - - for suffix in feature_suffixes: - cmds.append("sudo systemctl unmask {}.{}".format(feature_name, suffix)) - - # If feature has timer associated with it, start/enable corresponding systemd .timer unit - # otherwise, start/enable corresponding systemd .service unit - - cmds.append("sudo systemctl enable {}.{}".format(feature_name, feature_suffixes[-1])) - cmds.append("sudo systemctl start {}.{}".format(feature_name, feature_suffixes[-1])) - - for cmd in cmds: - syslog.syslog(syslog.LOG_INFO, "Running cmd: '{}'".format(cmd)) - try: - run_cmd(cmd, raise_exception=True) - except Exception as err: - syslog.syslog(syslog.LOG_ERR, "Feature '{}.{}' failed to be enabled and started" - .format(feature.name, feature_suffixes[-1])) - self.set_feature_state(feature, self.FEATURE_STATE_FAILED) - return - - self.set_feature_state(feature, self.FEATURE_STATE_ENABLED) - - def disable_feature(self, feature): - cmds = [] - feature_names, feature_suffixes = self.get_multiasic_feature_instances(feature) - for feature_name in feature_names: - # Check if it is already disabled, if yes skip the system call - unit_file_state = self.get_systemd_unit_state("{}.{}".format(feature_name, feature_suffixes[-1])) - if unit_file_state in ("disabled", "masked"): - continue - - for suffix in reversed(feature_suffixes): - cmds.append("sudo systemctl stop {}.{}".format(feature_name, suffix)) - cmds.append("sudo systemctl disable {}.{}".format(feature_name, feature_suffixes[-1])) - cmds.append("sudo systemctl mask {}.{}".format(feature_name, feature_suffixes[-1])) - for cmd in cmds: - syslog.syslog(syslog.LOG_INFO, "Running cmd: '{}'".format(cmd)) - try: - run_cmd(cmd, raise_exception=True) - except Exception as err: - syslog.syslog(syslog.LOG_ERR, "Feature '{}.{}' failed to be stopped and disabled" - .format(feature.name, feature_suffixes[-1])) - self.set_feature_state(feature, self.FEATURE_STATE_FAILED) - return - - self.set_feature_state(feature, self.FEATURE_STATE_DISABLED) - - def resync_feature_state(self, feature): - self._config_db.mod_entry('FEATURE', feature.name, {'state': feature.state}) - - def set_feature_state(self, feature, state): - self._feature_state_table.set(feature.name, [('state', state)]) - - -class Iptables(object): - def __init__(self): - ''' - Default MSS to 1460 - (MTU 1500 - 40 (TCP/IP Overhead)) - For IPv6, it would be 1440 - (MTU 1500 - 60 octects) - ''' - self.tcpmss = 1460 - self.tcp6mss = 1440 - - def is_ip_prefix_in_key(self, key): - ''' - Function to check if IP address is present in the key. If it - is present, then the key would be a tuple or else, it shall be - be string - ''' - 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) - cmd += ' -d' if chain == 'PREROUTING' else ' -s' - mss = self.tcpmss if ver == '4' else self.tcp6mss - cmd += ' {} -j TCPMSS --set-mss {}'.format(ip, mss) - - return cmd - - def iptables_handler(self, key, data, add=True): - if not self.is_ip_prefix_in_key(key): - return - - iface, ip = key - ip_str = ip.split("/")[0] - ip_addr = ipaddress.ip_address(ip_str) - if isinstance(ip_addr, ipaddress.IPv6Address): - ver = '6' - else: - ver = '4' - - self.mangle_handler(ip_str, ver, add) - - def mangle_handler(self, ip, ver, add): - if not add: - op = 'delete' - else: - op = 'check' - - iptables_cmds = [] - chains = ['PREROUTING', 'POSTROUTING'] - for chain in chains: - cmd = self.command(chain, ip, ver, op) - if not add: - iptables_cmds.append(cmd) - else: - ''' - For add case, first check if rule exists. Iptables just appends to the chain - as a new rule even if it is the same as an existing one. Check this and - do nothing if rule exists - ''' - ret = subprocess.call(cmd, shell=True) - if ret == 0: - syslog.syslog(syslog.LOG_INFO, "{} rule exists in {}".format(ip, chain)) - else: - # Modify command from Check to Append - iptables_cmds.append(cmd.replace("check", "append")) - - for cmd in iptables_cmds: - syslog.syslog(syslog.LOG_INFO, "Running cmd - {}".format(cmd)) - run_cmd(cmd) - - -class AaaCfg(object): - def __init__(self): - self.authentication_default = { - 'login': 'local', - } - self.authorization_default = { - 'login': 'local', - } - self.accounting_default = { - 'login': 'disable', - } - self.tacplus_global_default = { - 'auth_type': TACPLUS_SERVER_AUTH_TYPE_DEFAULT, - 'timeout': TACPLUS_SERVER_TIMEOUT_DEFAULT, - 'passkey': TACPLUS_SERVER_PASSKEY_DEFAULT - } - self.tacplus_global = {} - self.tacplus_servers = {} - - self.radius_global_default = { - 'priority': 0, - 'auth_port': RADIUS_SERVER_AUTH_PORT_DEFAULT, - 'auth_type': RADIUS_SERVER_AUTH_TYPE_DEFAULT, - 'retransmit': RADIUS_SERVER_RETRANSMIT_DEFAULT, - 'timeout': RADIUS_SERVER_TIMEOUT_DEFAULT, - 'passkey': RADIUS_SERVER_PASSKEY_DEFAULT - } - self.radius_global = {} - self.radius_servers = {} - - self.authentication = {} - self.authorization = {} - self.accounting = {} - self.debug = False - self.trace = False - - self.hostname = "" - - # Load conf from ConfigDb - def load(self, aaa_conf, tac_global_conf, tacplus_conf, rad_global_conf, radius_conf): - for row in aaa_conf: - self.aaa_update(row, aaa_conf[row], modify_conf=False) - for row in tac_global_conf: - self.tacacs_global_update(row, tac_global_conf[row], modify_conf=False) - for row in tacplus_conf: - self.tacacs_server_update(row, tacplus_conf[row], modify_conf=False) - - for row in rad_global_conf: - self.radius_global_update(row, rad_global_conf[row], modify_conf=False) - for row in radius_conf: - self.radius_server_update(row, radius_conf[row], modify_conf=False) - - self.modify_conf_file() - - def aaa_update(self, key, data, modify_conf=True): - if key == 'authentication': - self.authentication = data - if 'failthrough' in data: - self.authentication['failthrough'] = is_true(data['failthrough']) - if 'debug' in data: - self.debug = is_true(data['debug']) - if key == 'authorization': - self.authorization = data - if key == 'accounting': - self.accounting = data - if modify_conf: - self.modify_conf_file() - - def pick_src_intf_ipaddrs(self, keys, src_intf): - new_ipv4_addr = "" - new_ipv6_addr = "" - - for it in keys: - if src_intf != it[0] or (isinstance(it, tuple) == False): - continue - if new_ipv4_addr != "" and new_ipv6_addr != "": - break - ip_str = it[1].split("/")[0] - ip_addr = ipaddress.IPAddress(ip_str) - # Pick the first IP address from the table that matches the source interface - if isinstance(ip_addr, ipaddress.IPv6Address): - if new_ipv6_addr != "": - continue - new_ipv6_addr = ip_str - else: - if new_ipv4_addr != "": - continue - new_ipv4_addr = ip_str - - return(new_ipv4_addr, new_ipv6_addr) - - def tacacs_global_update(self, key, data, modify_conf=True): - if key == 'global': - self.tacplus_global = data - if modify_conf: - self.modify_conf_file() - - def tacacs_server_update(self, key, data, modify_conf=True): - if data == {}: - if key in self.tacplus_servers: - del self.tacplus_servers[key] - else: - self.tacplus_servers[key] = data - - if modify_conf: - self.modify_conf_file() - - def notify_audisp_tacplus_reload_config(self): - pid = get_pid("/sbin/audisp-tacplus") - syslog.syslog(syslog.LOG_INFO, "Found audisp-tacplus PID: {}".format(pid)) - if pid == "": - return - - # audisp-tacplus will reload TACACS+ config when receive SIGHUP - try: - os.kill(int(pid), signal.SIGHUP) - except Exception as ex: - syslog.syslog(syslog.LOG_WARNING, "Send SIGHUP to audisp-tacplus failed with exception: {}".format(ex)) - - def handle_radius_source_intf_ip_chg(self, key): - modify_conf=False - if 'src_intf' in self.radius_global: - if key[0] == self.radius_global['src_intf']: - modify_conf=True - for addr in self.radius_servers: - if ('src_intf' in self.radius_servers[addr]) and \ - (key[0] == self.radius_servers[addr]['src_intf']): - modify_conf=True - break - - if not modify_conf: - return - - syslog.syslog(syslog.LOG_INFO, 'RADIUS IP change - key:{}, current server info {}'.format(key, self.radius_servers)) - self.modify_conf_file() - - def handle_radius_nas_ip_chg(self, key): - modify_conf=False - # Mgmt IP configuration affects only the default nas_ip - if 'nas_ip' not in self.radius_global: - for addr in self.radius_servers: - if 'nas_ip' not in self.radius_servers[addr]: - modify_conf=True - break - - if not modify_conf: - return - - syslog.syslog(syslog.LOG_INFO, 'RADIUS (NAS) IP change - key:{}, current global info {}'.format(key, self.radius_global)) - self.modify_conf_file() - - def radius_global_update(self, key, data, modify_conf=True): - if key == 'global': - self.radius_global = data - if 'statistics' in data: - self.radius_global['statistics'] = is_true(data['statistics']) - if modify_conf: - self.modify_conf_file() - - def radius_server_update(self, key, data, modify_conf=True): - if data == {}: - if key in self.radius_servers: - del self.radius_servers[key] - else: - self.radius_servers[key] = data - - if modify_conf: - self.modify_conf_file() - - def hostname_update(self, hostname, modify_conf=True): - if self.hostname == hostname: - return - - self.hostname = hostname - - # Currently only used for RADIUS - if len(self.radius_servers) == 0: - return - - if modify_conf: - self.modify_conf_file() - - def get_hostname(self): - return self.hostname - - def get_interface_ip(self, source, addr=None): - keys = None - try: - if source.startswith("Eth"): - if is_vlan_sub_interface(source): - keys = self.config_db.get_keys('VLAN_SUB_INTERFACE') - else: - keys = self.config_db.get_keys('INTERFACE') - elif source.startswith("Po"): - if is_vlan_sub_interface(source): - keys = self.config_db.get_keys('VLAN_SUB_INTERFACE') - else: - keys = self.config_db.get_keys('PORTCHANNEL_INTERFACE') - elif source.startswith("Vlan"): - keys = self.config_db.get_keys('VLAN_INTERFACE') - elif source.startswith("Loopback"): - keys = self.config_db.get_keys('LOOPBACK_INTERFACE') - elif source == "eth0": - keys = self.config_db.get_keys('MGMT_INTERFACE') - except Exception as e: - pass - - interface_ip = "" - if keys != None: - ipv4_addr, ipv6_addr = self.pick_src_intf_ipaddrs(keys, source) - # Based on the type of addr, return v4 or v6 - if addr and isinstance(addr, ipaddress.IPv6Address): - interface_ip = ipv6_addr - else: - # This could be tuned, but that involves a DNS query, so - # offline configuration might trip (or cause delays). - interface_ip = ipv4_addr - return interface_ip - - def modify_single_file(self, filename, operations=None): - if operations: - cmd = "sed -e {0} {1} > {1}.new; mv -f {1} {1}.old; mv -f {1}.new {1}".format(' -e '.join(operations), filename) - os.system(cmd) - - def modify_conf_file(self): - authentication = self.authentication_default.copy() - authentication.update(self.authentication) - authorization = self.authorization_default.copy() - authorization.update(self.authorization) - accounting = self.accounting_default.copy() - accounting.update(self.accounting) - tacplus_global = self.tacplus_global_default.copy() - tacplus_global.update(self.tacplus_global) - if 'src_ip' in tacplus_global: - src_ip = tacplus_global['src_ip'] - else: - src_ip = None - - servers_conf = [] - if self.tacplus_servers: - for addr in self.tacplus_servers: - server = tacplus_global.copy() - server['ip'] = addr - server.update(self.tacplus_servers[addr]) - servers_conf.append(server) - servers_conf = sorted(servers_conf, key=lambda t: int(t['priority']), reverse=True) - - radius_global = self.radius_global_default.copy() - radius_global.update(self.radius_global) - - # RADIUS: Set the default nas_ip, and nas_id - if 'nas_ip' not in radius_global: - nas_ip = self.get_interface_ip("eth0") - if len(nas_ip) > 0: - radius_global['nas_ip'] = nas_ip - if 'nas_id' not in radius_global: - nas_id = self.get_hostname() - if len(nas_id) > 0: - radius_global['nas_id'] = nas_id - - radsrvs_conf = [] - if self.radius_servers: - for addr in self.radius_servers: - server = radius_global.copy() - server['ip'] = addr - server.update(self.radius_servers[addr]) - - if 'src_intf' in server: - # RADIUS: Log a message if src_ip is already defined. - if 'src_ip' in server: - syslog.syslog(syslog.LOG_INFO, \ - "RADIUS_SERVER|{}: src_intf found. Ignoring src_ip".format(addr)) - # RADIUS: If server.src_intf, then get the corresponding - # src_ip based on the server.ip, and set it. - src_ip = self.get_interface_ip(server['src_intf'], addr) - if len(src_ip) > 0: - server['src_ip'] = src_ip - elif 'src_ip' in server: - syslog.syslog(syslog.LOG_INFO, \ - "RADIUS_SERVER|{}: src_intf has no usable IP addr.".format(addr)) - del server['src_ip'] - - radsrvs_conf.append(server) - radsrvs_conf = sorted(radsrvs_conf, key=lambda t: int(t['priority']), reverse=True) - - template_file = os.path.abspath(PAM_AUTH_CONF_TEMPLATE) - env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) - env.filters['sub'] = sub - template = env.get_template(template_file) - if 'radius' in authentication['login']: - pam_conf = template.render(debug=self.debug, trace=self.trace, auth=authentication, servers=radsrvs_conf) - else: - pam_conf = template.render(auth=authentication, src_ip=src_ip, servers=servers_conf) - - # Use rename(), which is atomic (on the same fs) to avoid empty file - with open(PAM_AUTH_CONF + ".tmp", 'w') as f: - f.write(pam_conf) - os.chmod(PAM_AUTH_CONF + ".tmp", 0o644) - os.rename(PAM_AUTH_CONF + ".tmp", PAM_AUTH_CONF) - - # Modify common-auth include file in /etc/pam.d/login, sshd. - # /etc/pam.d/sudo is not handled, because it would change the existing - # behavior. It can be modified once a config knob is added for sudo. - if os.path.isfile(PAM_AUTH_CONF): - self.modify_single_file(ETC_PAMD_SSHD, [ "'/^@include/s/common-auth$/common-auth-sonic/'" ]) - self.modify_single_file(ETC_PAMD_LOGIN, [ "'/^@include/s/common-auth$/common-auth-sonic/'" ]) - else: - self.modify_single_file(ETC_PAMD_SSHD, [ "'/^@include/s/common-auth-sonic$/common-auth/'" ]) - self.modify_single_file(ETC_PAMD_LOGIN, [ "'/^@include/s/common-auth-sonic$/common-auth/'" ]) - - # Add tacplus/radius in nsswitch.conf if TACACS+/RADIUS enable - if 'tacacs+' in authentication['login']: - if os.path.isfile(NSS_CONF): - self.modify_single_file(NSS_CONF, [ "'/^passwd/s/ radius//'" ]) - self.modify_single_file(NSS_CONF, [ "'/tacplus/b'", "'/^passwd/s/compat/tacplus &/'", "'/^passwd/s/files/tacplus &/'" ]) - elif 'radius' in authentication['login']: - if os.path.isfile(NSS_CONF): - self.modify_single_file(NSS_CONF, [ "'/^passwd/s/tacplus //'" ]) - self.modify_single_file(NSS_CONF, [ "'/radius/b'", "'/^passwd/s/compat/& radius/'", "'/^passwd/s/files/& radius/'" ]) - else: - if os.path.isfile(NSS_CONF): - self.modify_single_file(NSS_CONF, [ "'/^passwd/s/tacplus //g'" ]) - self.modify_single_file(NSS_CONF, [ "'/^passwd/s/ radius//'" ]) - - # Add tacplus authorization configration in nsswitch.conf - tacacs_authorization_conf = None - local_authorization_conf = None - if 'tacacs+' in authorization['login']: - tacacs_authorization_conf = "on" - if 'local' in authorization['login']: - local_authorization_conf = "on" - - # Add tacplus accounting configration in nsswitch.conf - tacacs_accounting_conf = None - local_accounting_conf = None - if 'tacacs+' in accounting['login']: - tacacs_accounting_conf = "on" - if 'local' in accounting['login']: - local_accounting_conf = "on" - - # Set tacacs+ server in nss-tacplus conf - template_file = os.path.abspath(NSS_TACPLUS_CONF_TEMPLATE) - template = env.get_template(template_file) - nss_tacplus_conf = template.render( - debug=self.debug, - src_ip=src_ip, - servers=servers_conf, - local_accounting=local_accounting_conf, - tacacs_accounting=tacacs_accounting_conf, - local_authorization=local_authorization_conf, - tacacs_authorization=tacacs_authorization_conf) - with open(NSS_TACPLUS_CONF, 'w') as f: - f.write(nss_tacplus_conf) - - # Notify auditd plugin to reload tacacs config. - self.notify_audisp_tacplus_reload_config() - - # Set debug in nss-radius conf - template_file = os.path.abspath(NSS_RADIUS_CONF_TEMPLATE) - template = env.get_template(template_file) - nss_radius_conf = template.render(debug=self.debug, trace=self.trace, servers=radsrvs_conf) - with open(NSS_RADIUS_CONF, 'w') as f: - f.write(nss_radius_conf) - - # Create the per server pam_radius_auth.conf - if radsrvs_conf: - for srv in radsrvs_conf: - # Configuration File - pam_radius_auth_file = RADIUS_PAM_AUTH_CONF_DIR + srv['ip'] + "_" + srv['auth_port'] + ".conf" - template_file = os.path.abspath(PAM_RADIUS_AUTH_CONF_TEMPLATE) - template = env.get_template(template_file) - pam_radius_auth_conf = template.render(server=srv) - - open(pam_radius_auth_file, 'a').close() - os.chmod(pam_radius_auth_file, 0o600) - with open(pam_radius_auth_file, 'w+') as f: - f.write(pam_radius_auth_conf) - - # Start the statistics service. Only RADIUS implemented - if ('radius' in authentication['login']) and ('statistics' in radius_global) and \ - radius_global['statistics']: - cmd = 'service aaastatsd start' - else: - cmd = 'service aaastatsd stop' - syslog.syslog(syslog.LOG_INFO, "cmd - {}".format(cmd)) - try: - subprocess.check_call(cmd, shell=True) - except subprocess.CalledProcessError as err: - syslog.syslog(syslog.LOG_ERR, - "{} - failed: return code - {}, output:\n{}" - .format(err.cmd, err.returncode, err.output)) - - -class PasswHardening(object): - def __init__(self): - self.passw_policies_default = {} - self.passw_policies = {} - - self.debug = False - self.trace = False - - def load(self, policies_conf): - for row in policies_conf: - self.passw_policies_update(row, policies_conf[row], modify_conf=False) - - self.modify_passw_conf_file() - - def passw_policies_update(self, key, data, modify_conf=True): - syslog.syslog(syslog.LOG_DEBUG, "passw_policies_update - key: {}".format(key)) - syslog.syslog(syslog.LOG_DEBUG, "passw_policies_update - data: {}".format(data)) - - if data == {}: - self.passw_policies = {} - else: - if 'reject_user_passw_match' in data: - data['reject_user_passw_match'] = is_true(data['reject_user_passw_match']) - if 'lower_class' in data: - data['lower_class'] = is_true(data['lower_class']) - if 'upper_class' in data: - data['upper_class'] = is_true(data['upper_class']) - if 'digits_class' in data: - data['digits_class'] = is_true(data['digits_class']) - if 'special_class' in data: - data['special_class'] = is_true(data['special_class']) - - if key == 'POLICIES': - self.passw_policies = data - - if modify_conf: - self.modify_passw_conf_file() - - def modify_single_file_inplace(self, filename, operations=None): - if operations: - cmd = "sed -i {0} {1}".format(' -i '.join(operations), filename) - syslog.syslog(syslog.LOG_DEBUG, "modify_single_file_inplace: cmd - {}".format(cmd)) - os.system(cmd) - - def set_passw_hardening_policies(self, passw_policies): - # Password Hardening flow - # When feature is enabled, the passw_policies from CONFIG_DB will be set in the pam files /etc/pam.d/common-password and /etc/login.def. - # When the feature is disabled, the files above will be generate with the linux default (without secured passw_policies). - syslog.syslog(syslog.LOG_DEBUG, "modify_conf_file: passw_policies - {}".format(passw_policies)) - - template_passwh_file = os.path.abspath(PAM_PASSWORD_CONF_TEMPLATE) - env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) - env.filters['sub'] = sub - template_passwh = env.get_template(template_passwh_file) - - # Render common-password file with passw hardening policies if any. Other render without them. - pam_passwh_conf = template_passwh.render(debug=self.debug, passw_policies=passw_policies) - - # Use rename(), which is atomic (on the same fs) to avoid empty file - with open(PAM_PASSWORD_CONF + ".tmp", 'w') as f: - f.write(pam_passwh_conf) - os.chmod(PAM_PASSWORD_CONF + ".tmp", 0o644) - os.rename(PAM_PASSWORD_CONF + ".tmp", PAM_PASSWORD_CONF) - - # Age policy - # When feature disabled or age policy disabled, expiry days policy should be as linux default, other, accoriding CONFIG_DB. - curr_expiration = LINUX_DEFAULT_PASS_MAX_DAYS - curr_expiration_warning = LINUX_DEFAULT_PASS_WARN_AGE - - if passw_policies: - if 'state' in passw_policies: - if passw_policies['state'] == 'enabled': - if 'expiration' in passw_policies: - if int(self.passw_policies['expiration']) != 0: # value '0' meaning age policy is disabled - # the logic is to modify the expiration time according the last updated modificatiion - # - curr_expiration = int(passw_policies['expiration']) - - if 'expiration_warning' in passw_policies: - if int(self.passw_policies['expiration_warning']) != 0: # value '0' meaning age policy is disabled - curr_expiration_warning = int(passw_policies['expiration_warning']) - - if self.is_passwd_aging_expire_update(curr_expiration, 'MAX_DAYS'): - # Set aging policy for existing users - self.passwd_aging_expire_modify(curr_expiration, 'MAX_DAYS') - - # Aging policy for new users - self.modify_single_file_inplace(ETC_LOGIN_DEF, ["\'/^PASS_MAX_DAYS/c\PASS_MAX_DAYS " +str(curr_expiration)+"\'"]) - - if self.is_passwd_aging_expire_update(curr_expiration_warning, 'WARN_DAYS'): - # Aging policy for existing users - self.passwd_aging_expire_modify(curr_expiration_warning, 'WARN_DAYS') - - # Aging policy for new users - self.modify_single_file_inplace(ETC_LOGIN_DEF, ["\'/^PASS_WARN_AGE/c\PASS_WARN_AGE " +str(curr_expiration_warning)+"\'"]) - - def passwd_aging_expire_modify(self, curr_expiration, age_type): - normal_accounts = self.get_normal_accounts() - if not normal_accounts: - syslog.syslog(syslog.LOG_ERR,"failed, no normal users found in /etc/passwd") - return - chage_flag = AGE_DICT[age_type]['CHAGE_FLAG'] - for normal_account in normal_accounts: - try: - chage_p_m = subprocess.Popen(('chage', chage_flag + str(curr_expiration), normal_account), stdout=subprocess.PIPE) - return_code_chage_p_m = chage_p_m.poll() - if return_code_chage_p_m != 0: - syslog.syslog(syslog.LOG_ERR, "failed: return code - {}".format(return_code_chage_p_m)) - - except subprocess.CalledProcessError as e: - syslog.syslog(syslog.LOG_ERR, "{} - failed: return code - {}, output:\n{}".format(e.cmd, e.returncode, e.output)) - - def is_passwd_aging_expire_update(self, curr_expiration, age_type): - """ Function verify that the current age expiry policy values are equal from the old one - Return update_age_status 'True' value meaning that was a modification from the last time, and vice versa. - """ - update_age_status = False - days_num = None - regex_days = AGE_DICT[age_type]['REGEX_DAYS'] - days_type = AGE_DICT[age_type]['DAYS'] - if os.path.exists(ETC_LOGIN_DEF): - with open(ETC_LOGIN_DEF, 'r') as f: - login_def_data = f.readlines() - - for line in login_def_data: - m1 = re.match(regex_days, line) - if m1: - days_num = int(m1.group(days_type)) - break - - if curr_expiration != days_num: - update_age_status = True - - return update_age_status - - def get_normal_accounts(self): - # Get user list - try: - getent_out = subprocess.check_output(['getent', 'passwd']).decode('utf-8').split('\n') - except subprocess.CalledProcessError as err: - syslog.syslog(syslog.LOG_ERR, "{} - failed: return code - {}, output:\n{}".format(err.cmd, err.returncode, err.output)) - return False - - # Get range of normal users - REGEX_UID_MAX = r'^UID_MAX[ \t]*(?P\d*)' - REGEX_UID_MIN = r'^UID_MIN[ \t]*(?P\d*)' - uid_max = None - uid_min = None - if os.path.exists(ETC_LOGIN_DEF): - with open(ETC_LOGIN_DEF, 'r') as f: - login_def_data = f.readlines() - - for line in login_def_data: - m1 = re.match(REGEX_UID_MAX, line) - m2 = re.match(REGEX_UID_MIN, line) - if m1: - uid_max = int(m1.group("uid_max")) - if m2: - uid_min = int(m2.group("uid_min")) - - if not uid_max or not uid_min: - syslog.syslog(syslog.LOG_ERR,"failed, no UID_MAX/UID_MIN founded in login.def file") - return False - - # Get normal user list - normal_accounts = [] - for account in getent_out[0:-1]: # last item is always empty - account_spl = account.split(':') - account_number = int(account_spl[2]) - if account_number >= uid_min and account_number <= uid_max: - normal_accounts.append(account_spl[ACCOUNT_NAME]) - - normal_accounts.append('root') # root is also a candidate to be age modify. - return normal_accounts - - def modify_passw_conf_file(self): - passw_policies = self.passw_policies_default.copy() - passw_policies.update(self.passw_policies) - - # set new Password Hardening policies. - self.set_passw_hardening_policies(passw_policies) - - -class KdumpCfg(object): - def __init__(self, CfgDb): - self.config_db = CfgDb - self.kdump_defaults = { "enabled" : "false", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", - "num_dumps": "3" } - - def load(self, kdump_table): - """ - Set the KDUMP table in CFG DB to kdump_defaults if not set by the user - """ - syslog.syslog(syslog.LOG_INFO, "KdumpCfg init ...") - kdump_conf = kdump_table.get("config", {}) - for row in self.kdump_defaults: - value = self.kdump_defaults.get(row) - if not kdump_conf.get(row): - self.config_db.mod_entry("KDUMP", "config", {row : value}) - - def kdump_update(self, key, data): - syslog.syslog(syslog.LOG_INFO, "Kdump global configuration update") - if key == "config": - # Admin mode - kdump_enabled = self.kdump_defaults["enabled"] - if data.get("enabled") is not None: - kdump_enabled = data.get("enabled") - if kdump_enabled.lower() == "true": - enabled = True - else: - enabled = False - if enabled: - run_cmd("sonic-kdump-config --enable") - else: - run_cmd("sonic-kdump-config --disable") - - # Memory configuration - memory = self.kdump_defaults["memory"] - if data.get("memory") is not None: - memory = data.get("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") - run_cmd("sonic-kdump-config --num_dumps " + num_dumps) - -class NtpCfg(object): - """ - NtpCfg Config Daemon - 1) ntp-config.service handles the configuration updates and then starts ntp.service - 2) Both of them start after all the feature services start - 3) Purpose of this daemon is to propagate runtime config changes in - NTP, NTP_SERVER and LOOPBACK_INTERFACE - """ - def __init__(self): - 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: - return - - # check only the intf configured as source interface - if intf_name not in self.ntp_global.get('src_intf', '').split(';'): - return - else: - # just restart ntp config - cmd = 'systemctl restart ntp-config' - run_cmd(cmd) - - 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(";")) - orig_vrf = self.ntp_global.get('vrf', '') - - new_src = data.get('src_intf', '') - new_src_set = set(new_src.split(";")) - new_vrf = data.get('vrf', '') - - # 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") - return - - if orig_src_set != new_src_set: - syslog.syslog(syslog.LOG_INFO, "ntp global update for source intf old {} new {}, restarting ntp-config" - .format(orig_src_set, new_src_set)) - cmd = 'systemctl restart ntp-config' - run_cmd(cmd) - elif new_vrf != orig_vrf: - syslog.syslog(syslog.LOG_INFO, "ntp global update for vrf old {} new {}, restarting ntp service" - .format(orig_vrf, new_vrf)) - cmd = 'service ntp restart' - run_cmd(cmd) - - 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 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 - - if restart_config: - cmd = 'systemctl restart ntp-config' - syslog.syslog(syslog.LOG_INFO, 'ntp server update, restarting ntp-config, ntp servers configured {}'.format(self.ntp_servers)) - run_cmd(cmd) - -class PamLimitsCfg(object): - """ - PamLimit Config Daemon - 1) The pam_limits PAM module sets limits on the system resources that can be obtained in a user-session. - 2) Purpose of this daemon is to render pam_limits config file. - """ - def __init__(self, config_db): - self.config_db = config_db - self.hwsku = "" - self.type = "" - - # Load config from ConfigDb and render config file/ - def update_config_file(self): - device_metadata = self.config_db.get_table('DEVICE_METADATA') - if "localhost" not in device_metadata: - return - - self.read_localhost_config(device_metadata["localhost"]) - self.render_conf_file() - - # Read localhost config - def read_localhost_config(self, localhost): - if "hwsku" in localhost: - self.hwsku = localhost["hwsku"] - else: - self.hwsku = "" - - if "type" in localhost: - self.type = localhost["type"] - else: - self.type = "" - - # Render pam_limits config files - def render_conf_file(self): - env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) - env.filters['sub'] = sub - - try: - template_file = os.path.abspath(PAM_LIMITS_CONF_TEMPLATE) - template = env.get_template(template_file) - pam_limits_conf = template.render( - hwsku=self.hwsku, - type=self.type) - with open(PAM_LIMITS_CONF, 'w') as f: - f.write(pam_limits_conf) - - template_file = os.path.abspath(LIMITS_CONF_TEMPLATE) - template = env.get_template(template_file) - limits_conf = template.render( - hwsku=self.hwsku, - type=self.type) - with open(LIMITS_CONF, 'w') as f: - f.write(limits_conf) - except Exception as e: - syslog.syslog(syslog.LOG_ERR, - "modify pam_limits config file failed with exception: {}" - .format(e)) - -class HostConfigDaemon: - def __init__(self): - # Just a sanity check to verify if the CONFIG_DB has been initialized - # before moving forward - self.config_db = ConfigDBConnector() - self.config_db.connect(wait_for_init=True, retry_on=True) - syslog.syslog(syslog.LOG_INFO, 'ConfigDB connect success') - - # 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) - - # Initialize IpTables - self.iptables = Iptables() - - # Intialize Feature Handler - self.feature_handler = FeatureHandler(self.config_db, feature_state_table, self.device_config) - - # Initialize Ntp Config Handler - self.ntpcfg = NtpCfg() - - self.is_multi_npu = device_info.is_multi_npu() - - # Initialize AAACfg - self.hostname_cache="" - self.aaacfg = AaaCfg() - - # Initialize PasswHardening - self.passwcfg = PasswHardening() - - # Initialize PamLimitsCfg - self.pamLimitsCfg = PamLimitsCfg(self.config_db) - self.pamLimitsCfg.update_config_file() - - 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'] - passwh = init_data['PASSW_HARDENING'] - - 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) - self.passwcfg.load(passwh) - - 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) - - def __get_intf_name(self, key): - if isinstance(key, tuple) and key: - intf = key[0] - else: - intf = key - return intf - - def aaa_handler(self, key, op, data): - self.aaacfg.aaa_update(key, data) - syslog.syslog(syslog.LOG_INFO, 'AAA Update: key: {}, op: {}, data: {}'.format(key, op, data)) - - def passwh_handler(self, key, op, data): - self.passwcfg.passw_policies_update(key, data) - syslog.syslog(syslog.LOG_INFO, 'PASSW_HARDENING Update: key: {}, op: {}, data: {}'.format(key, op, data)) - - def tacacs_server_handler(self, key, op, data): - self.aaacfg.tacacs_server_update(key, data) - log_data = copy.deepcopy(data) - if 'passkey' in log_data: - log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_INFO, 'TACPLUS_SERVER update: key: {}, op: {}, data: {}'.format(key, op, log_data)) - - def tacacs_global_handler(self, key, op, data): - self.aaacfg.tacacs_global_update(key, data) - log_data = copy.deepcopy(data) - if 'passkey' in log_data: - log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_INFO, 'TACPLUS Global update: key: {}, op: {}, data: {}'.format(key, op, log_data)) - - def radius_server_handler(self, key, op, data): - self.aaacfg.radius_server_update(key, data) - log_data = copy.deepcopy(data) - if 'passkey' in log_data: - log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_INFO, 'RADIUS_SERVER update: key: {}, op: {}, data: {}'.format(key, op, log_data)) - - def radius_global_handler(self, key, op, data): - self.aaacfg.radius_global_update(key, data) - log_data = copy.deepcopy(data) - if 'passkey' in log_data: - log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_INFO, 'RADIUS Global update: key: {}, op: {}, data: {}'.format(key, op, log_data)) - - def mgmt_intf_handler(self, key, op, data): - key = ConfigDBConnector.deserialize_key(key) - mgmt_intf_name = self.__get_intf_name(key) - self.aaacfg.handle_radius_source_intf_ip_chg(mgmt_intf_name) - self.aaacfg.handle_radius_nas_ip_chg(mgmt_intf_name) - - def lpbk_handler(self, key, op, data): - key = ConfigDBConnector.deserialize_key(key) - if op == "DEL": - add = False - else: - add = True - - self.iptables.iptables_handler(key, data, add) - lpbk_name = self.__get_intf_name(key) - self.ntpcfg.handle_ntp_source_intf_chg(lpbk_name) - self.aaacfg.handle_radius_source_intf_ip_chg(key) - - def vlan_intf_handler(self, key, op, data): - key = ConfigDBConnector.deserialize_key(key) - self.aaacfg.handle_radius_source_intf_ip_chg(key) - - def vlan_sub_intf_handler(self, key, op, data): - key = ConfigDBConnector.deserialize_key(key) - self.aaacfg.handle_radius_source_intf_ip_chg(key) - - def portchannel_intf_handler(self, key, op, data): - key = ConfigDBConnector.deserialize_key(key) - self.aaacfg.handle_radius_source_intf_ip_chg(key) - - def phy_intf_handler(self, key, op, data): - key = ConfigDBConnector.deserialize_key(key) - self.aaacfg.handle_radius_source_intf_ip_chg(key) - - def ntp_server_handler(self, key, op, data): - self.ntpcfg.ntp_server_update(key, op) - - def ntp_global_handler(self, key, op, data): - self.ntpcfg.ntp_global_update(key, data) - - def kdump_handler (self, key, op, data): - syslog.syslog(syslog.LOG_INFO, 'Kdump handler...') - self.kdumpCfg.kdump_update(key, data) - - def wait_till_system_init_done(self): - # No need to print the output in the log file so using the "--quiet" - # flag - systemctl_cmd = "sudo systemctl is-system-running --wait --quiet" - subprocess.call(systemctl_cmd, shell=True) - - def register_callbacks(self): - - 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 - - self.config_db.subscribe('KDUMP', make_callback(self.kdump_handler)) - # Handle FEATURE updates before other tables - self.config_db.subscribe('FEATURE', make_callback(self.feature_handler.handler)) - # Handle AAA, TACACS and RADIUS related tables - 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)) - self.config_db.subscribe('PASSW_HARDENING', make_callback(self.passwh_handler)) - # Handle IPTables configuration - self.config_db.subscribe('LOOPBACK_INTERFACE', make_callback(self.lpbk_handler)) - # Handle NTP & NTP_SERVER updates - 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.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() - syslog.syslog(syslog.LOG_INFO, - "systemctl has finished initialization -- proceeding ...") - - def start(self): - self.config_db.listen(init_data_handler=self.load) - - -def main(): - signal.signal(signal.SIGTERM, signal_handler) - signal.signal(signal.SIGINT, signal_handler) - signal.signal(signal.SIGHUP, signal_handler) - daemon = HostConfigDaemon() - daemon.register_callbacks() - daemon.start() - -if __name__ == "__main__": - main() - diff --git a/src/sonic-host-services/scripts/procdockerstatsd b/src/sonic-host-services/scripts/procdockerstatsd deleted file mode 100755 index da6fa433e325..000000000000 --- a/src/sonic-host-services/scripts/procdockerstatsd +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/env python3 -''' -procdockerstatsd -Daemon which periodically gathers process and docker statistics and pushes the data to STATE_DB -''' - -import os -import re -import subprocess -import sys -import time -from datetime import datetime - -from sonic_py_common import daemon_base -from swsscommon import swsscommon - -VERSION = '1.0' - -SYSLOG_IDENTIFIER = "procdockerstatsd" - -REDIS_HOSTIP = "127.0.0.1" - - -class ProcDockerStats(daemon_base.DaemonBase): - - def __init__(self, log_identifier): - super(ProcDockerStats, self).__init__(log_identifier) - self.state_db = swsscommon.SonicV2Connector(host=REDIS_HOSTIP) - self.state_db.connect("STATE_DB") - - def run_command(self, cmd): - proc = subprocess.Popen(cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE) - (stdout, stderr) = proc.communicate() - if proc.returncode != 0: - self.log_error("Error running command '{}'".format(cmd)) - return None - else: - return stdout - - def format_docker_cmd_output(self, cmdout): - lines = cmdout.splitlines() - keys = re.split(" +", lines[0]) - docker_data = dict() - docker_data_list = [] - for line in lines[1:]: - values = re.split(" +", line) - docker_data = {key: value for key, value in zip(keys, values)} - docker_data_list.append(docker_data) - formatted_dict = self.create_docker_dict(docker_data_list) - return formatted_dict - - def format_process_cmd_output(self, cmdout): - lines = cmdout.splitlines() - keys = re.split(" +", lines[0]) - key_list = [key for key in keys if key] - process_data = dict() - process_data_list = [] - for line in lines[1:]: - values = re.split(" +", line) - # To remove extra space before UID - val_list = [val for val in values if val] - # Merging extra columns created due to space in cmd ouput - val_list[8:] = [' '.join(val_list[8:])] - process_data = {key: value for key, value in zip(key_list, val_list)} - process_data_list.append(process_data) - return process_data_list - - def convert_to_bytes(self, value): - UNITS_B = 'B' - UNITS_KB = 'KB' - UNITS_MB = 'MB' - UNITS_MiB = 'MiB' - UNITS_GiB = 'GiB' - - res = re.match(r'(\d+\.?\d*)([a-zA-Z]+)', value) - value = float(res.groups()[0]) - units = res.groups()[1] - if units.lower() == UNITS_KB.lower(): - value *= 1000 - elif units.lower() == UNITS_MB.lower(): - value *= (1000 * 1000) - elif units.lower() == UNITS_MiB.lower(): - value *= (1024 * 1024) - elif units.lower() == UNITS_GiB.lower(): - value *= (1024 * 1024 * 1024) - - return int(round(value)) - - def create_docker_dict(self, dict_list): - dockerdict = {} - for row in dict_list[0:]: - cid = row.get('CONTAINER ID') - if cid: - key = 'DOCKER_STATS|{}'.format(cid) - dockerdict[key] = {} - dockerdict[key]['NAME'] = row.get('NAME') - - cpu = row.get('CPU %').split("%") - dockerdict[key]['CPU%'] = str(cpu[0]) - - memuse = row.get('MEM USAGE / LIMIT').split(" / ") - # converting MiB and GiB to bytes - dockerdict[key]['MEM_BYTES'] = str(self.convert_to_bytes(memuse[0])) - dockerdict[key]['MEM_LIMIT_BYTES'] = str(self.convert_to_bytes(memuse[1])) - - mem = row.get('MEM %').split("%") - dockerdict[key]['MEM%'] = str(mem[0]) - - netio = row.get('NET I/O').split(" / ") - dockerdict[key]['NET_IN_BYTES'] = str(self.convert_to_bytes(netio[0])) - dockerdict[key]['NET_OUT_BYTES'] = str(self.convert_to_bytes(netio[1])) - - blockio = row.get('BLOCK I/O').split(" / ") - dockerdict[key]['BLOCK_IN_BYTES'] = str(self.convert_to_bytes(blockio[0])) - dockerdict[key]['BLOCK_OUT_BYTES'] = str(self.convert_to_bytes(blockio[1])) - - dockerdict[key]['PIDS'] = row.get('PIDS') - return dockerdict - - def update_dockerstats_command(self): - cmd = "docker stats --no-stream -a" - data = self.run_command(cmd) - if not data: - self.log_error("'{}' returned null output".format(cmd)) - return False - dockerdata = self.format_docker_cmd_output(data) - if not dockerdata: - self.log_error("formatting for docker output failed") - return False - # wipe out all data from state_db before updating - self.state_db.delete_all_by_pattern('STATE_DB', 'DOCKER_STATS|*') - for k1,v1 in dockerdata.items(): - for k2,v2 in v1.items(): - self.update_state_db(k1, k2, v2) - return True - - def update_processstats_command(self): - data = self.run_command("ps -eo uid,pid,ppid,%mem,%cpu,stime,tty,time,cmd --sort -%cpu | head -1024") - processdata = self.format_process_cmd_output(data) - value = "" - # wipe out all data before updating with new values - self.state_db.delete_all_by_pattern('STATE_DB', 'PROCESS_STATS|*') - for row in processdata[0:]: - cid = row.get('PID') - if cid: - value = 'PROCESS_STATS|{}'.format(cid) - uid = row.get('UID') - self.update_state_db(value, 'UID', uid) - ppid = row.get('PPID') - self.update_state_db(value, 'PPID', ppid) - cpu = row.get('%CPU') - self.update_state_db(value, '%CPU', str(cpu)) - mem = row.get('%MEM') - self.update_state_db(value, '%MEM', str(mem)) - stime = row.get('STIME') - self.update_state_db(value, 'STIME', stime) - tty = row.get('TT') - self.update_state_db(value, 'TT', tty) - time = row.get('TIME') - self.update_state_db(value, 'TIME', time) - cmd = row.get('CMD') - self.update_state_db(value, 'CMD', cmd) - - def update_state_db(self, key1, key2, value2): - self.state_db.set('STATE_DB', key1, key2, value2) - - def run(self): - self.log_info("Starting up ...") - - if not os.getuid() == 0: - self.log_error("Must be root to run this daemon") - print("Must be root to run this daemon") - sys.exit(1) - - while True: - self.update_dockerstats_command() - datetimeobj = datetime.now() - # Adding key to store latest update time. - self.update_state_db('DOCKER_STATS|LastUpdateTime', 'lastupdate', str(datetimeobj)) - self.update_processstats_command() - self.update_state_db('PROCESS_STATS|LastUpdateTime', 'lastupdate', str(datetimeobj)) - - # Data need to be updated every 2 mins. hence adding delay of 120 seconds - time.sleep(120) - - self.log_info("Exiting ...") - - -def main(): - # Instantiate a ProcDockerStats object - pd = ProcDockerStats(SYSLOG_IDENTIFIER) - - # Log all messages from INFO level and higher - pd.set_min_log_priority_info() - - pd.run() - - -if __name__ == '__main__': - main() diff --git a/src/sonic-host-services/scripts/process-reboot-cause b/src/sonic-host-services/scripts/process-reboot-cause deleted file mode 100755 index df43a131faa9..000000000000 --- a/src/sonic-host-services/scripts/process-reboot-cause +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python3 -# -# process-reboot-cause -# -# Program designed to read the previous reboot-cause files, log the last previous reboot-cause. -# And read the saved reboot-cause history files and save the reboot cause in the state-db. -# - -try: - import json - import os - import pwd - import sys - - from swsscommon import swsscommon - from sonic_py_common import logger -except ImportError as err: - raise ImportError("%s - required module not found" % str(err)) - -VERSION = "1.0" - -SYSLOG_IDENTIFIER = "process-reboot-cause" - -REBOOT_CAUSE_DIR = "/host/reboot-cause/" -REBOOT_CAUSE_HISTORY_DIR = "/host/reboot-cause/history/" -PREVIOUS_REBOOT_CAUSE_FILE = os.path.join(REBOOT_CAUSE_DIR, "previous-reboot-cause.json") -USER_ISSUED_REBOOT_CAUSE_REGEX ="User issued \'{}\' command [User: {}, Time: {}]" - -REBOOT_CAUSE_UNKNOWN = "Unknown" -REBOOT_CAUSE_TABLE_NAME = "REBOOT_CAUSE" - -REDIS_HOSTIP = "127.0.0.1" -state_db = None - -# Global logger class instance -sonic_logger = logger.Logger(SYSLOG_IDENTIFIER) - - -# ============================= Functions ============================= -def read_reboot_cause_files_and_save_state_db(): - # Connect State DB - state_db = swsscommon.SonicV2Connector(host=REDIS_HOSTIP) - state_db.connect(state_db.STATE_DB) - - # Sort the previous reboot cause files by creation time - REBOOT_FILE_LIST = [os.path.join(REBOOT_CAUSE_HISTORY_DIR, i) for i in os.listdir(REBOOT_CAUSE_HISTORY_DIR)] - TIME_SORTED_FULL_REBOOT_FILE_LIST = sorted(REBOOT_FILE_LIST, key=os.path.getmtime, reverse=True) - - data = [] - # Read each sorted previous reboot cause file and update the state db with previous reboot cause information - for i in range(min(10, len(TIME_SORTED_FULL_REBOOT_FILE_LIST))): - x = TIME_SORTED_FULL_REBOOT_FILE_LIST[i] - if os.path.isfile(x): - with open(x, "r") as cause_file: - data = json.load(cause_file) - _hash = '{}|{}'.format(REBOOT_CAUSE_TABLE_NAME, data['gen_time']) - state_db.set(state_db.STATE_DB, _hash, 'cause', data['cause']) - state_db.set(state_db.STATE_DB, _hash, 'time', data['time']) - state_db.set(state_db.STATE_DB, _hash, 'user', data['user']) - state_db.set(state_db.STATE_DB, _hash, 'comment', data['comment']) - - if len(TIME_SORTED_FULL_REBOOT_FILE_LIST) > 10: - for i in range(len(TIME_SORTED_FULL_REBOOT_FILE_LIST)): - if i >= 10: - x = TIME_SORTED_FULL_REBOOT_FILE_LIST[i] - os.remove(x) - - -def main(): - # Configure logger to log all messages INFO level and higher - sonic_logger.set_min_log_priority_info() - - sonic_logger.log_info("Starting up...") - - if not os.geteuid() == 0: - sonic_logger.log_error("User {} does not have permission to execute".format(pwd.getpwuid(os.getuid()).pw_name)) - sys.exit("This utility must be run as root") - - # Set a default previous reboot cause - previous_reboot_cause = REBOOT_CAUSE_UNKNOWN - - # Read the most recent reboot cause file and log data to syslog - if os.path.exists(PREVIOUS_REBOOT_CAUSE_FILE): - with open(PREVIOUS_REBOOT_CAUSE_FILE, "r") as last_cause_file: - data = json.load(last_cause_file) - if data['user']: - previous_reboot_cause = USER_ISSUED_REBOOT_CAUSE_REGEX.format(data['cause'], data['user'], data['time']) - else: - previous_reboot_cause = "{}".format(data['cause']) - - # Log the last reboot cause to the syslog - sonic_logger.log_info("Previous reboot cause: {}".format(previous_reboot_cause)) - - if os.path.exists(REBOOT_CAUSE_HISTORY_DIR): - # Read the previous reboot cause from saved reboot-cause files and save the previous reboot cause upto 10 entry to the state db - read_reboot_cause_files_and_save_state_db() - - -if __name__ == "__main__": - main() diff --git a/src/sonic-host-services/scripts/sonic-host-server b/src/sonic-host-services/scripts/sonic-host-server deleted file mode 100755 index bf4449e34eda..000000000000 --- a/src/sonic-host-services/scripts/sonic-host-server +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python3 -"""Host Service to handle docker-to-host communication""" - -import os -import os.path -import glob -import importlib -import sys - -import dbus -import dbus.service -import dbus.mainloop.glib - -from gi.repository import GObject - -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""" - 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'): - mod_name = os.path.basename(mod_file)[:-3] - module = importlib.import_module(mod_name) - - register_cb = getattr(module, 'register', None) - if not register_cb: - raise Exception('Missing register function for ' + mod_name) - - register_dbus(register_cb) - -def register_dbus(register_cb): - """Register DBus handlers for individual modules""" - handler_class, mod_name = register_cb() - handlers[mod_name] = handler_class(mod_name) - -# Create a main loop reactor -GObject.threads_init() -dbus.mainloop.glib.threads_init() -dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -loop = GObject.MainLoop() -handlers = {} - -class SignalManager(object): - ''' This is used to manage signals received (e.g. SIGINT). - When stopping a process (systemctl stop [service]), systemd sends - a SIGTERM signal. - ''' - shutdown = False - def __init__(self): - ''' Install signal handlers. - - SIGTERM is invoked when systemd wants to stop the daemon. - For example, "systemctl stop mydaemon.service" - or, "systemctl restart mydaemon.service" - - ''' - import signal - signal.signal(signal.SIGTERM, self.sigterm_hdlr) - - def sigterm_hdlr(self, _signum, _frame): - self.shutdown = True - loop.quit() - -sigmgr = SignalManager() -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: - import systemd.daemon - systemd.daemon.notify("READY=1") - - while not sigmgr.shutdown: - loop.run() - if sigmgr.shutdown: - break - - systemd.daemon.notify("STOPPING=1") -else: - print("No handlers to register, quitting...") diff --git a/src/sonic-host-services/setup.cfg b/src/sonic-host-services/setup.cfg deleted file mode 100644 index b7e478982ccf..000000000000 --- a/src/sonic-host-services/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[aliases] -test=pytest diff --git a/src/sonic-host-services/setup.py b/src/sonic-host-services/setup.py deleted file mode 100644 index 9ed9e1082a0c..000000000000 --- a/src/sonic-host-services/setup.py +++ /dev/null @@ -1,57 +0,0 @@ -from setuptools import setup - -setup( - name = 'sonic-host-services', - version = '1.0', - description = 'Python services which run in the SONiC host OS', - license = 'Apache 2.0', - author = 'SONiC Team', - author_email = 'linuxnetdev@microsoft.com', - url = 'https://github.com/Azure/sonic-buildimage', - maintainer = 'Joe LeVeque', - maintainer_email = 'jolevequ@microsoft.com', - packages = [ - 'host_modules' - ], - scripts = [ - 'scripts/caclmgrd', - 'scripts/hostcfgd', - 'scripts/aaastatsd', - 'scripts/procdockerstatsd', - 'scripts/determine-reboot-cause', - 'scripts/process-reboot-cause', - 'scripts/sonic-host-server' - ], - install_requires = [ - 'dbus-python', - 'systemd-python', - 'Jinja2>=2.10', - 'PyGObject', - 'sonic-py-common' - ], - setup_requires = [ - 'pytest-runner', - 'wheel' - ], - tests_require = [ - 'parameterized', - 'pytest', - 'pyfakefs', - 'sonic-py-common', - 'deepdiff' - ], - classifiers = [ - 'Development Status :: 3 - Alpha', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'Intended Audience :: Information Technology', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: Apache Software License', - 'Natural Language :: English', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 3.7', - 'Topic :: System', - ], - keywords = 'sonic SONiC host services', - test_suite = 'setup.get_test_suite' -) diff --git a/src/sonic-host-services/tests/__init__.py b/src/sonic-host-services/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/sonic-host-services/tests/caclmgrd/__init__.py b/src/sonic-host-services/tests/caclmgrd/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/sonic-host-services/tests/caclmgrd/caclmgrd_bfd_test.py b/src/sonic-host-services/tests/caclmgrd/caclmgrd_bfd_test.py deleted file mode 100644 index 358d4c413b9c..000000000000 --- a/src/sonic-host-services/tests/caclmgrd/caclmgrd_bfd_test.py +++ /dev/null @@ -1,50 +0,0 @@ -import os -import sys -import swsscommon - -from parameterized import parameterized -from sonic_py_common.general import load_module_from_source -from unittest import TestCase, mock -from pyfakefs.fake_filesystem_unittest import patchfs - -from .test_bfd_vectors import CACLMGRD_BFD_TEST_VECTOR -from tests.common.mock_configdb import MockConfigDb -from unittest.mock import MagicMock, patch - -DBCONFIG_PATH = '/var/run/redis/sonic-db/database_config.json' - -class TestCaclmgrdBfd(TestCase): - """ - Test caclmgrd bfd - """ - def setUp(self): - swsscommon.swsscommon.ConfigDBConnector = MockConfigDb - test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - modules_path = os.path.dirname(test_path) - scripts_path = os.path.join(modules_path, "scripts") - sys.path.insert(0, modules_path) - caclmgrd_path = os.path.join(scripts_path, 'caclmgrd') - self.caclmgrd = load_module_from_source('caclmgrd', caclmgrd_path) - - @parameterized.expand(CACLMGRD_BFD_TEST_VECTOR) - @patchfs - def test_caclmgrd_bfd(self, test_name, test_data, fs): - if not os.path.exists(DBCONFIG_PATH): - fs.create_file(DBCONFIG_PATH) # fake database_config.json - - MockConfigDb.set_config_db(test_data["config_db"]) - - with mock.patch("caclmgrd.subprocess") as mocked_subprocess: - popen_mock = mock.Mock() - popen_attrs = test_data["popen_attributes"] - popen_mock.configure_mock(**popen_attrs) - mocked_subprocess.Popen.return_value = popen_mock - mocked_subprocess.PIPE = -1 - - call_rc = test_data["call_rc"] - mocked_subprocess.call.return_value = call_rc - - caclmgrd_daemon = self.caclmgrd.ControlPlaneAclManager("caclmgrd") - caclmgrd_daemon.allow_bfd_protocol('') - mocked_subprocess.Popen.assert_has_calls(test_data["expected_subprocess_calls"], any_order=True) - diff --git a/src/sonic-host-services/tests/caclmgrd/caclmgrd_dhcp_test.py b/src/sonic-host-services/tests/caclmgrd/caclmgrd_dhcp_test.py deleted file mode 100644 index a6eae7ba1230..000000000000 --- a/src/sonic-host-services/tests/caclmgrd/caclmgrd_dhcp_test.py +++ /dev/null @@ -1,53 +0,0 @@ -import os -import sys -import swsscommon - -from parameterized import parameterized -from sonic_py_common.general import load_module_from_source -from unittest import TestCase, mock -from pyfakefs.fake_filesystem_unittest import patchfs - -from .test_dhcp_vectors import CACLMGRD_DHCP_TEST_VECTOR -from tests.common.mock_configdb import MockConfigDb - -DBCONFIG_PATH = '/var/run/redis/sonic-db/database_config.json' - -class TestCaclmgrdDhcp(TestCase): - """ - Test caclmgrd dhcp - """ - def setUp(self): - swsscommon.ConfigDBConnector = MockConfigDb - test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - modules_path = os.path.dirname(test_path) - scripts_path = os.path.join(modules_path, "scripts") - sys.path.insert(0, modules_path) - caclmgrd_path = os.path.join(scripts_path, 'caclmgrd') - self.caclmgrd = load_module_from_source('caclmgrd', caclmgrd_path) - - @parameterized.expand(CACLMGRD_DHCP_TEST_VECTOR) - @patchfs - def test_caclmgrd_dhcp(self, test_name, test_data, fs): - if not os.path.exists(DBCONFIG_PATH): - fs.create_file(DBCONFIG_PATH) # fake database_config.json - - MockConfigDb.set_config_db(test_data["config_db"]) - - with mock.patch("caclmgrd.subprocess") as mocked_subprocess: - popen_mock = mock.Mock() - popen_attrs = test_data["popen_attributes"] - popen_mock.configure_mock(**popen_attrs) - mocked_subprocess.Popen.return_value = popen_mock - - call_rc = test_data["call_rc"] - mocked_subprocess.call.return_value = call_rc - - mark = test_data["mark"] - - caclmgrd_daemon = self.caclmgrd.ControlPlaneAclManager("caclmgrd") - mux_update = test_data["mux_update"] - - for key,data in mux_update: - caclmgrd_daemon.update_dhcp_acl(key, '', data, mark) - - mocked_subprocess.call.assert_has_calls(test_data["expected_subprocess_calls"], any_order=False) diff --git a/src/sonic-host-services/tests/caclmgrd/test_bfd_vectors.py b/src/sonic-host-services/tests/caclmgrd/test_bfd_vectors.py deleted file mode 100644 index 35340849bd4c..000000000000 --- a/src/sonic-host-services/tests/caclmgrd/test_bfd_vectors.py +++ /dev/null @@ -1,29 +0,0 @@ -from unittest.mock import call -import subprocess - -""" - caclmgrd bfd test vector -""" -CACLMGRD_BFD_TEST_VECTOR = [ - [ - "BFD_SESSION_TEST", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "expected_subprocess_calls": [ - call("iptables -I INPUT 2 -p udp -m multiport --dports 3784,4784 -j ACCEPT", shell=True, universal_newlines=True, stdout=subprocess.PIPE), - call("ip6tables -I INPUT 2 -p udp -m multiport --dports 3784,4784 -j ACCEPT", shell=True, universal_newlines=True, stdout=subprocess.PIPE) - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 0, - } - ] -] diff --git a/src/sonic-host-services/tests/caclmgrd/test_dhcp_vectors.py b/src/sonic-host-services/tests/caclmgrd/test_dhcp_vectors.py deleted file mode 100644 index 7ebfca22a64b..000000000000 --- a/src/sonic-host-services/tests/caclmgrd/test_dhcp_vectors.py +++ /dev/null @@ -1,316 +0,0 @@ -from unittest.mock import call - -""" - caclmgrd dhcp test vector -""" -CACLMGRD_DHCP_TEST_VECTOR = [ - [ - "Active_Present_Interface", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "active"}), - ("Ethernet8", {"state": "active"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --delete DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --check DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - call("iptables --delete DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 0, - "mark": None, - }, - ], - [ - "Active_Present_Mark", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "active"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), - call("iptables --delete DHCP -m mark --mark 0x67004 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 0, - "mark": "0x67004", - }, - ], - [ - "Active_Absent_Interface", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "active"}), - ("Ethernet8", {"state": "active"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --check DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 1, - "mark": None, - }, - ], - [ - "Active_Absent_Mark", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "active"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 1, - "mark": "0x67004", - }, - ], - [ - "Standby_Present_Interface", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "standby"}), - ("Ethernet8", {"state": "standby"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --check DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 0, - "mark": None, - }, - ], - [ - "Standby_Present_Mark", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "standby"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 0, - "mark": "0x67004", - }, - ], - [ - "Standby_Absent_Interface", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "standby"}), - ("Ethernet8", {"state": "standby"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --insert DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --check DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - call("iptables --insert DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 1, - "mark": None, - }, - ], - [ - "Standby_Absent_Mark", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "standby"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), - call("iptables --insert DHCP -m mark --mark 0x67004 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 1, - "mark": "0x67004", - }, - ], - [ - "Unknown_Present_Interface", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "unknown"}), - ("Ethernet8", {"state": "unknown"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --delete DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --check DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - call("iptables --delete DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 0, - "mark": None, - }, - ], - [ - "Unknown_Present_Mark", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "unknown"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), - call("iptables --delete DHCP -m mark --mark 0x67004 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 0, - "mark": "0x67004", - }, - ], - [ - "Uknown_Absent_Interface", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "unknown"}), - ("Ethernet8", {"state": "unknown"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m physdev --physdev-in Ethernet4 -j DROP", shell=True), - call("iptables --check DHCP -m physdev --physdev-in Ethernet8 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 1, - "mark": None, - }, - ], - [ - "Uknown_Absent_Mark", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - }, - "mux_update": [ - ("Ethernet4", {"state": "unknown"}), - ], - "expected_subprocess_calls": [ - call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error'), - }, - "call_rc": 1, - "mark": "0x67004", - }, - ], -] diff --git a/src/sonic-host-services/tests/common/mock_configdb.py b/src/sonic-host-services/tests/common/mock_configdb.py deleted file mode 100644 index f0b12b11abf9..000000000000 --- a/src/sonic-host-services/tests/common/mock_configdb.py +++ /dev/null @@ -1,58 +0,0 @@ -class MockConfigDb(object): - """ - Mock Config DB which responds to data tables requests and store updates to the data table - """ - STATE_DB = None - CONFIG_DB = None - event_queue = [] - - def __init__(self, **kwargs): - self.handlers = {} - - @staticmethod - def set_config_db(test_config_db): - MockConfigDb.CONFIG_DB = test_config_db - - @staticmethod - def deserialize_key(key, separator="|"): - tokens = key.split(separator) - if len(tokens) > 1: - return tuple(tokens) - else: - return key - - @staticmethod - def get_config_db(): - return MockConfigDb.CONFIG_DB - - def connect(self, wait_for_init=True, retry_on=True): - pass - - def get(self, db_id, key, field): - return MockConfigDb.CONFIG_DB[key][field] - - def get_entry(self, key, field): - return MockConfigDb.CONFIG_DB[key][field] - - def mod_entry(self, key, field, data): - existing_data = self.get_entry(key, field) - existing_data.update(data) - self.set_entry(key, field, existing_data) - - def set_entry(self, key, field, data): - MockConfigDb.CONFIG_DB[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 - - 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(): - def __init__(self, db, val): - pass diff --git a/src/sonic-host-services/tests/determine-reboot-cause_test.py b/src/sonic-host-services/tests/determine-reboot-cause_test.py deleted file mode 100644 index 7d22a512f8ee..000000000000 --- a/src/sonic-host-services/tests/determine-reboot-cause_test.py +++ /dev/null @@ -1,119 +0,0 @@ -import sys -import os -import pytest - -from swsscommon import swsscommon -from sonic_py_common.general import load_module_from_source - -# TODO: Remove this if/else block once we no longer support Python 2 -if sys.version_info.major == 3: - from unittest import mock -else: - # Expect the 'mock' package for python 2 - # https://pypi.python.org/pypi/mock - import mock - -# TODO: Remove this if/else block once we no longer support Python 2 -if sys.version_info.major == 3: - BUILTINS = "builtins" -else: - BUILTINS = "__builtin__" - -from .mock_connector import MockConnector - -swsscommon.SonicV2Connector = MockConnector - -test_path = os.path.dirname(os.path.abspath(__file__)) -modules_path = os.path.dirname(test_path) -scripts_path = os.path.join(modules_path, "scripts") -sys.path.insert(0, modules_path) - -# Load the file under test -determine_reboot_cause_path = os.path.join(scripts_path, 'determine-reboot-cause') -determine_reboot_cause = load_module_from_source('determine_reboot_cause', determine_reboot_cause_path) - - -PROC_CMDLINE_CONTENTS = """\ -BOOT_IMAGE=/image-20191130.52/boot/vmlinuz-4.9.0-11-2-amd64 root=/dev/sda4 rw console=tty0 console=ttyS1,9600n8 quiet net.ifnames=0 biosdevname=0 loop=image-20191130.52/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor varlog_size=4096 usbcore.autosuspend=-1 module_blacklist=gpio_ich SONIC_BOOT_TYPE=warm""" - -EXPECTED_PARSE_WARMFAST_REBOOT_FROM_PROC_CMDLINE = "warm" - -PROC_CMDLINE_CONTENTS = """\ -BOOT_IMAGE=/image-20191130.52/boot/vmlinuz-4.9.0-11-2-amd64 root=/dev/sda4 rw console=tty0 console=ttyS1,9600n8 quiet net.ifnames=0 biosdevname=0 loop=image-20191130.52/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor varlog_size=4096 usbcore.autosuspend=-1 module_blacklist=gpio_ich SONIC_BOOT_TYPE=warm""" - -REBOOT_CAUSE_CONTENTS = """\ -User issued 'warm-reboot' command [User: admin, Time: Mon Nov 2 22:37:45 UTC 2020]""" - -GET_SONIC_VERSION_INFO = {'commit_id': 'e59ec8291', 'build_date': 'Mon Nov 2 06:00:14 UTC 2020', 'build_number': 75, 'kernel_version': '4.9.0-11-2-amd64', 'debian_version': '9.13', 'built_by': 'sonicbld@jenkins-slave-phx-2', 'asic_type': 'mellanox', 'build_version': '20191130.52'} - -REBOOT_CAUSE_WATCHDOG = "Watchdog" -GEN_TIME_WATCHDOG = "2020_10_22_03_15_08" -REBOOT_CAUSE_USER = "User issued 'reboot' command [User: admin, Time: Thu Oct 22 03:11:08 UTC 2020]" -GEN_TIME_USER = "2020_10_22_03_14_07" -REBOOT_CAUSE_KERNEL_PANIC = "Kernel Panic [Time: Sun Mar 28 13:45:12 UTC 2021]" -GEN_TIME_KERNEL_PANIC = "2021_3_28_13_48_49" - - -EXPECTED_PARSE_WARMFAST_REBOOT_FROM_PROC_CMDLINE = "warm-reboot" -EXPECTED_FIND_SOFTWARE_REBOOT_CAUSE_USER = "User issued 'warm-reboot' command [User: admin, Time: Mon Nov 2 22:37:45 UTC 2020]" -EXPECTED_FIND_FIRSTBOOT_VERSION = " (First boot of SONiC version 20191130.52)" -EXPECTED_FIND_SOFTWARE_REBOOT_CAUSE_FIRSTBOOT = "Unknown (First boot of SONiC version 20191130.52)" -EXPECTED_HARDWARE_REBOOT_CAUSE = {"warm-reboot", ""} - -EXPECTED_WATCHDOG_REBOOT_CAUSE_DICT = {'comment': '', 'gen_time': '2020_10_22_03_15_08', 'cause': 'Watchdog', 'user': 'N/A', 'time': 'N/A'} -EXPECTED_USER_REBOOT_CAUSE_DICT = {'comment': '', 'gen_time': '2020_10_22_03_14_07', 'cause': 'reboot', 'user': 'admin', 'time': 'Thu Oct 22 03:11:08 UTC 2020'} -EXPECTED_KERNEL_PANIC_REBOOT_CAUSE_DICT = {'comment': '', 'gen_time': '2021_3_28_13_48_49', 'cause': 'Kernel Panic', 'user': 'N/A', 'time': 'Sun Mar 28 13:45:12 UTC 2021'} - - -class TestDetermineRebootCause(object): - def test_parse_warmfast_reboot_from_proc_cmdline(self): - with mock.patch("os.path.isfile") as mock_isfile: - mock_isfile.return_value = True - open_mocked = mock.mock_open(read_data=PROC_CMDLINE_CONTENTS) - with mock.patch("{}.open".format(BUILTINS), open_mocked): - result = determine_reboot_cause.parse_warmfast_reboot_from_proc_cmdline() - assert result == EXPECTED_PARSE_WARMFAST_REBOOT_FROM_PROC_CMDLINE - open_mocked.assert_called_once_with("/proc/cmdline") - - def test_find_software_reboot_cause_user(self): - with mock.patch("os.path.isfile") as mock_isfile: - mock_isfile.return_value = True - open_mocked = mock.mock_open(read_data=REBOOT_CAUSE_CONTENTS) - with mock.patch("{}.open".format(BUILTINS), open_mocked): - result = determine_reboot_cause.find_software_reboot_cause_from_reboot_cause_file() - assert result == EXPECTED_FIND_SOFTWARE_REBOOT_CAUSE_USER - open_mocked.assert_called_once_with("/host/reboot-cause/reboot-cause.txt") - - def test_find_software_reboot_cause_first_boot(self): - with mock.patch("sonic_py_common.device_info.get_sonic_version_info", return_value=GET_SONIC_VERSION_INFO): - result = determine_reboot_cause.find_first_boot_version() - assert result == EXPECTED_FIND_FIRSTBOOT_VERSION - - def test_find_software_reboot_cause(self): - with mock.patch("determine_reboot_cause.find_software_reboot_cause_from_reboot_cause_file", return_value="Unknown"): - with mock.patch("os.path.isfile") as mock_isfile: - mock_isfile.return_value = False - result = determine_reboot_cause.find_software_reboot_cause() - assert result == "Unknown" - - def test_find_proc_cmdline_reboot_cause(self): - with mock.patch("determine_reboot_cause.parse_warmfast_reboot_from_proc_cmdline", return_value="fast-reboot"): - result = determine_reboot_cause.find_proc_cmdline_reboot_cause() - assert result == "fast-reboot" - - def test_find_hardware_reboot_cause(self): - with mock.patch("determine_reboot_cause.get_reboot_cause_from_platform", return_value=("Powerloss", None)): - result = determine_reboot_cause.find_hardware_reboot_cause() - assert result == "Powerloss (None)" - - def test_get_reboot_cause_dict_watchdog(self): - reboot_cause_dict = determine_reboot_cause.get_reboot_cause_dict(REBOOT_CAUSE_WATCHDOG, "", GEN_TIME_WATCHDOG) - assert reboot_cause_dict == EXPECTED_WATCHDOG_REBOOT_CAUSE_DICT - - def test_get_reboot_cause_dict_user(self): - reboot_cause_dict = determine_reboot_cause.get_reboot_cause_dict(REBOOT_CAUSE_USER, "", GEN_TIME_USER) - assert reboot_cause_dict == EXPECTED_USER_REBOOT_CAUSE_DICT - - def test_get_reboot_cause_dict_kernel_panic(self): - reboot_cause_dict = determine_reboot_cause.get_reboot_cause_dict(REBOOT_CAUSE_KERNEL_PANIC, "", GEN_TIME_KERNEL_PANIC) - assert reboot_cause_dict == EXPECTED_KERNEL_PANIC_REBOOT_CAUSE_DICT diff --git a/src/sonic-host-services/tests/hostcfgd/__init__.py b/src/sonic-host-services/tests/hostcfgd/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_passwh_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_passwh_test.py deleted file mode 100755 index da68ad861207..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_passwh_test.py +++ /dev/null @@ -1,182 +0,0 @@ -import importlib.machinery -import importlib.util -import filecmp -import shutil -import os -import sys -import subprocess -import re - -from parameterized import parameterized -from unittest import TestCase, mock -from tests.hostcfgd.test_passwh_vectors import HOSTCFGD_TEST_PASSWH_VECTOR -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) -scripts_path = os.path.join(modules_path, "scripts") -src_path = os.path.dirname(modules_path) -templates_path = os.path.join(src_path, "sonic-host-services-data/templates") -output_path = os.path.join(test_path, "hostcfgd/output") -sample_output_path = os.path.join(test_path, "hostcfgd/sample_output") -sys.path.insert(0, modules_path) - -# Load the file under test -hostcfgd_path = os.path.join(scripts_path, 'hostcfgd') -loader = importlib.machinery.SourceFileLoader('hostcfgd', hostcfgd_path) -spec = importlib.util.spec_from_loader(loader.name, loader) -hostcfgd = importlib.util.module_from_spec(spec) -loader.exec_module(hostcfgd) -sys.modules['hostcfgd'] = hostcfgd - -# Mock swsscommon classes -hostcfgd.ConfigDBConnector = MockConfigDb -hostcfgd.DBConnector = MockDBConnector -hostcfgd.Table = mock.Mock() - -AGE_DICT = { 'MAX_DAYS': {'REGEX_DAYS': r'^PASS_MAX_DAYS[ \t]*(?P\d*)', 'DAYS': 'max_days', 'CHAGE_FLAG': '-M '}, - 'WARN_DAYS': {'REGEX_DAYS': r'^PASS_WARN_AGE[ \t]*(?P\d*)', 'DAYS': 'warn_days', 'CHAGE_FLAG': '-W '} - } - -class TestHostcfgdPASSWH(TestCase): - """ - Test hostcfd daemon - PASSWH - """ - def run_diff(self, file1, file2): - try: - diff_out = subprocess.check_output('diff -ur {} {} || true'.format(file1, file2), shell=True) - return diff_out - except subprocess.CalledProcessError as err: - syslog.syslog(syslog.LOG_ERR, "{} - failed: return code - {}, output:\n{}".format(err.cmd, err.returncode, err.output)) - return -1 - - def get_passw_days(self, login_file, age_type): - days_num = -1 - - regex_days = AGE_DICT[age_type]['REGEX_DAYS'] - days_type = AGE_DICT[age_type]['DAYS'] - - with open(login_file, 'r') as f: - login_def_data = f.readlines() - - for line in login_def_data: - m1 = re.match(regex_days, line) - if m1: - days_num = int(m1.group(days_type)) - break - return days_num - - """ - Check different config - """ - def check_config(self, test_name, test_data, config_name): - t_path = templates_path - op_path = output_path + "/" + test_name + "_" + config_name - sop_path = sample_output_path + "/" + test_name + "_" + config_name - sop_path_common = sample_output_path + "/" + test_name - - hostcfgd.PAM_PASSWORD_CONF_TEMPLATE = t_path + "/common-password.j2" - hostcfgd.PAM_AUTH_CONF_TEMPLATE = t_path + "/common-auth-sonic.j2" - hostcfgd.NSS_TACPLUS_CONF_TEMPLATE = t_path + "/tacplus_nss.conf.j2" - hostcfgd.NSS_RADIUS_CONF_TEMPLATE = t_path + "/radius_nss.conf.j2" - hostcfgd.PAM_RADIUS_AUTH_CONF_TEMPLATE = t_path + "/pam_radius_auth.conf.j2" - hostcfgd.PAM_PASSWORD_CONF = op_path + "/common-password" - hostcfgd.ETC_LOGIN_DEF = op_path + "/login.defs" - hostcfgd.PAM_AUTH_CONF = op_path + "/common-auth-sonic" - hostcfgd.NSS_TACPLUS_CONF = op_path + "/tacplus_nss.conf" - hostcfgd.NSS_RADIUS_CONF = op_path + "/radius_nss.conf" - hostcfgd.NSS_CONF = op_path + "/nsswitch.conf" - hostcfgd.ETC_PAMD_SSHD = op_path + "/sshd" - hostcfgd.ETC_PAMD_LOGIN = op_path + "/login" - hostcfgd.RADIUS_PAM_AUTH_CONF_DIR = op_path + "/" - - shutil.rmtree(op_path, ignore_errors=True) - os.mkdir(op_path) - - shutil.copyfile(sop_path_common + "/login.defs.old", op_path + "/login.defs") - MockConfigDb.set_config_db(test_data[config_name]) - host_config_daemon = hostcfgd.HostConfigDaemon() - - try: - passwh_table = host_config_daemon.config_db.get_table('PASSW_HARDENING') - except Exception as e: - syslog.syslog(syslog.LOG_ERR, "failed: get_table 'PASSW_HARDENING', exception={}".format(e)) - passwh_table = [] - - host_config_daemon.passwcfg.load(passwh_table) - - - diff_output = "" - files_to_compare = ['common-password'] - - # check output files exists - for name in files_to_compare: - if not os.path.isfile(sop_path + "/" + name): - raise ValueError('filename: %s not exit' % (sop_path + "/" + name)) - if not os.path.isfile(op_path + "/" + name): - raise ValueError('filename: %s not exit' % (op_path + "/" + name)) - - # deep comparison - match, mismatch, errors = filecmp.cmpfiles(sop_path, op_path, files_to_compare, shallow=False) - - if not match: - for name in files_to_compare: - diff_output += self.run_diff( sop_path + "/" + name,\ - op_path + "/" + name).decode('utf-8') - - self.assertTrue(len(diff_output) == 0, diff_output) - - # compare age data in login.def file. - out_passw_age_days = self.get_passw_days(op_path + "/login.defs", 'MAX_DAYS') - sout_passw_age_days = self.get_passw_days(sop_path + "/login.defs", 'MAX_DAYS') - out_passw_age_warn_days = self.get_passw_days(op_path + "/login.defs", 'WARN_DAYS') - sout_passw_age_warn_days = self.get_passw_days(sop_path + "/login.defs", 'WARN_DAYS') - - self.assertEqual(out_passw_age_days, sout_passw_age_days) - self.assertEqual(out_passw_age_warn_days, sout_passw_age_warn_days) - - @parameterized.expand(HOSTCFGD_TEST_PASSWH_VECTOR) - def test_hostcfgd_passwh(self, test_name, test_data): - """ - Test PASSWH hostcfd daemon initialization - - Args: - test_name(str): test name - test_data(dict): test data which contains initial Config Db tables, and expected results - - Returns: - None - """ - - self.check_config(test_name, test_data, "default_values") - - @parameterized.expand(HOSTCFGD_TEST_PASSWH_VECTOR) - def test_hostcfgd_passwh_enable(self, test_name, test_data): - """ - Test PASSWH hostcfd daemon initialization - - Args: - test_name(str): test name - test_data(dict): test data which contains initial Config Db tables, and expected results - - Returns: - None - """ - - self.check_config(test_name, test_data, "enable_feature") - - - @parameterized.expand(HOSTCFGD_TEST_PASSWH_VECTOR) - def test_hostcfgd_passwh_classes(self, test_name, test_data): - """ - Test PASSWH hostcfd daemon initialization - - Args: - test_name(str): test name - test_data(dict): test data which contains initial Config Db tables, and expected results - - Returns: - None - """ - - self.check_config(test_name, test_data, "enable_digits_class") \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py deleted file mode 100644 index c08cd1829add..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py +++ /dev/null @@ -1,103 +0,0 @@ -import importlib.machinery -import importlib.util -import filecmp -import shutil -import os -import sys -import subprocess -from swsscommon import swsscommon - -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, MockDBConnector - - -test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -modules_path = os.path.dirname(test_path) -scripts_path = os.path.join(modules_path, "scripts") -src_path = os.path.dirname(modules_path) -templates_path = os.path.join(src_path, "sonic-host-services-data/templates") -output_path = os.path.join(test_path, "hostcfgd/output") -sample_output_path = os.path.join(test_path, "hostcfgd/sample_output") -sys.path.insert(0, modules_path) - -# Load the file under test -hostcfgd_path = os.path.join(scripts_path, 'hostcfgd') -loader = importlib.machinery.SourceFileLoader('hostcfgd', hostcfgd_path) -spec = importlib.util.spec_from_loader(loader.name, loader) -hostcfgd = importlib.util.module_from_spec(spec) -loader.exec_module(hostcfgd) -sys.modules['hostcfgd'] = hostcfgd - -# Mock swsscommon classes -hostcfgd.ConfigDBConnector = MockConfigDb -hostcfgd.DBConnector = MockDBConnector -hostcfgd.Table = mock.Mock() - -class TestHostcfgdRADIUS(TestCase): - """ - Test hostcfd daemon - RADIUS - """ - def run_diff(self, file1, file2): - return subprocess.check_output('diff -uR {} {} || true'.format(file1, file2), shell=True) - - - @parameterized.expand(HOSTCFGD_TEST_RADIUS_VECTOR) - def test_hostcfgd_radius(self, test_name, test_data): - """ - Test RADIUS hostcfd daemon initialization - Args: - test_name(str): test name - test_data(dict): test data which contains initial Config Db tables, and expected results - Returns: - None - """ - - t_path = templates_path - op_path = output_path + "/" + test_name - sop_path = sample_output_path + "/" + test_name - - hostcfgd.PAM_AUTH_CONF_TEMPLATE = t_path + "/common-auth-sonic.j2" - hostcfgd.NSS_TACPLUS_CONF_TEMPLATE = t_path + "/tacplus_nss.conf.j2" - hostcfgd.NSS_RADIUS_CONF_TEMPLATE = t_path + "/radius_nss.conf.j2" - hostcfgd.PAM_RADIUS_AUTH_CONF_TEMPLATE = t_path + "/pam_radius_auth.conf.j2" - hostcfgd.PAM_AUTH_CONF = op_path + "/common-auth-sonic" - hostcfgd.NSS_TACPLUS_CONF = op_path + "/tacplus_nss.conf" - hostcfgd.NSS_RADIUS_CONF = op_path + "/radius_nss.conf" - hostcfgd.NSS_CONF = op_path + "/nsswitch.conf" - hostcfgd.ETC_PAMD_SSHD = op_path + "/sshd" - hostcfgd.ETC_PAMD_LOGIN = op_path + "/login" - hostcfgd.RADIUS_PAM_AUTH_CONF_DIR = op_path + "/" - - shutil.rmtree( op_path, ignore_errors=True) - os.mkdir( op_path) - - shutil.copyfile( sop_path + "/sshd.old", op_path + "/sshd") - shutil.copyfile( sop_path + "/login.old", op_path + "/login") - - MockConfigDb.set_config_db(test_data["config_db"]) - host_config_daemon = hostcfgd.HostConfigDaemon() - - aaa = host_config_daemon.config_db.get_table('AAA') - - try: - radius_global = host_config_daemon.config_db.get_table('RADIUS') - except: - radius_global = [] - try: - radius_server = \ - host_config_daemon.config_db.get_table('RADIUS_SERVER') - except: - radius_server = [] - - host_config_daemon.aaacfg.load(aaa,[],[],radius_global,radius_server) - dcmp = filecmp.dircmp(sop_path, op_path) - diff_output = "" - for name in dcmp.diff_files: - diff_output += \ - "Diff: file: {} expected: {} output: {}\n".format(\ - name, dcmp.left, dcmp.right) - diff_output += self.run_diff( dcmp.left + "/" + name,\ - dcmp.right + "/" + name) - self.assertTrue(len(diff_output) == 0, diff_output) diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py deleted file mode 100644 index a6478c08dc0d..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py +++ /dev/null @@ -1,116 +0,0 @@ -import importlib.machinery -import importlib.util -import filecmp -import shutil -import os -import sys -import subprocess -from swsscommon import swsscommon - -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, MockDBConnector - -test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -modules_path = os.path.dirname(test_path) -scripts_path = os.path.join(modules_path, "scripts") -src_path = os.path.dirname(modules_path) -templates_path = os.path.join(src_path, "sonic-host-services-data/templates") -output_path = os.path.join(test_path, "hostcfgd/output") -sample_output_path = os.path.join(test_path, "hostcfgd/sample_output") -sys.path.insert(0, modules_path) - -# Load the file under test -hostcfgd_path = os.path.join(scripts_path, 'hostcfgd') -loader = importlib.machinery.SourceFileLoader('hostcfgd', hostcfgd_path) -spec = importlib.util.spec_from_loader(loader.name, loader) -hostcfgd = importlib.util.module_from_spec(spec) -loader.exec_module(hostcfgd) -sys.modules['hostcfgd'] = hostcfgd - -# Mock swsscommon classes -hostcfgd.ConfigDBConnector = MockConfigDb -hostcfgd.DBConnector = MockDBConnector -hostcfgd.Table = mock.Mock() - -class TestHostcfgdTACACS(TestCase): - """ - Test hostcfd daemon - TACACS - """ - def run_diff(self, file1, file2): - return subprocess.check_output('diff -uR {} {} || true'.format(file1, file2), shell=True) - - """ - Check different config - """ - def check_config(self, test_name, test_data, config_name): - t_path = templates_path - op_path = output_path + "/" + test_name + "_" + config_name - sop_path = sample_output_path + "/" + test_name + "_" + config_name - - hostcfgd.PAM_AUTH_CONF_TEMPLATE = t_path + "/common-auth-sonic.j2" - hostcfgd.NSS_TACPLUS_CONF_TEMPLATE = t_path + "/tacplus_nss.conf.j2" - hostcfgd.NSS_RADIUS_CONF_TEMPLATE = t_path + "/radius_nss.conf.j2" - hostcfgd.PAM_RADIUS_AUTH_CONF_TEMPLATE = t_path + "/pam_radius_auth.conf.j2" - hostcfgd.PAM_AUTH_CONF = op_path + "/common-auth-sonic" - hostcfgd.NSS_TACPLUS_CONF = op_path + "/tacplus_nss.conf" - hostcfgd.NSS_RADIUS_CONF = op_path + "/radius_nss.conf" - hostcfgd.NSS_CONF = op_path + "/nsswitch.conf" - hostcfgd.ETC_PAMD_SSHD = op_path + "/sshd" - hostcfgd.ETC_PAMD_LOGIN = op_path + "/login" - hostcfgd.RADIUS_PAM_AUTH_CONF_DIR = op_path + "/" - - shutil.rmtree( op_path, ignore_errors=True) - os.mkdir( op_path) - - shutil.copyfile( sop_path + "/sshd.old", op_path + "/sshd") - shutil.copyfile( sop_path + "/login.old", op_path + "/login") - - MockConfigDb.set_config_db(test_data[config_name]) - host_config_daemon = hostcfgd.HostConfigDaemon() - - aaa = host_config_daemon.config_db.get_table('AAA') - - try: - tacacs_global = host_config_daemon.config_db.get_table('TACPLUS') - except: - tacacs_global = [] - try: - tacacs_server = \ - host_config_daemon.config_db.get_table('TACPLUS_SERVER') - except: - tacacs_server = [] - - host_config_daemon.aaacfg.load(aaa,tacacs_global,tacacs_server,[],[]) - dcmp = filecmp.dircmp(sop_path, op_path) - diff_output = "" - for name in dcmp.diff_files: - diff_output += \ - "Diff: file: {} expected: {} output: {}\n".format(\ - name, dcmp.left, dcmp.right) - diff_output += self.run_diff( dcmp.left + "/" + name,\ - dcmp.right + "/" + name) - self.assertTrue(len(diff_output) == 0, diff_output) - - - @parameterized.expand(HOSTCFGD_TEST_TACACS_VECTOR) - def test_hostcfgd_tacacs(self, test_name, test_data): - """ - Test TACACS hostcfd daemon initialization - - Args: - test_name(str): test name - test_data(dict): test data which contains initial Config Db tables, and expected results - - Returns: - None - """ - # test local config - self.check_config(test_name, test_data, "config_db_local") - # test remote config - self.check_config(test_name, test_data, "config_db_tacacs") - # test local + tacacs config - self.check_config(test_name, test_data, "config_db_local_and_tacacs") - # test disable accounting - self.check_config(test_name, test_data, "config_db_disable_accounting") diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py deleted file mode 100644 index 786bd1c8f2a9..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py +++ /dev/null @@ -1,359 +0,0 @@ -import os -import sys -import swsscommon as swsscommon_package -from swsscommon import swsscommon - -from parameterized import parameterized -from sonic_py_common.general import load_module_from_source -from unittest import TestCase, mock - -from .test_vectors import HOSTCFGD_TEST_VECTOR, HOSTCFG_DAEMON_CFG_DB -from tests.common.mock_configdb import MockConfigDb, MockDBConnector - -from pyfakefs.fake_filesystem_unittest import patchfs -from deepdiff import DeepDiff -from unittest.mock import call - -test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -modules_path = os.path.dirname(test_path) -scripts_path = os.path.join(modules_path, 'scripts') -sys.path.insert(0, modules_path) - -# Load the file under test -hostcfgd_path = os.path.join(scripts_path, 'hostcfgd') -hostcfgd = load_module_from_source('hostcfgd', hostcfgd_path) -hostcfgd.ConfigDBConnector = MockConfigDb -hostcfgd.DBConnector = MockDBConnector -hostcfgd.Table = mock.Mock() - - -class TestFeatureHandler(TestCase): - """Test methods of `FeatureHandler` class. - """ - def checks_config_table(self, feature_table, expected_table): - """Compares `FEATURE` table in `CONFIG_DB` with expected output table. - - Args: - feature_table: A dictionary indicates current `FEATURE` table in `CONFIG_DB`. - expected_table A dictionary indicates the expected `FEATURE` table in `CONFIG_DB`. - - Returns: - Returns True if `FEATURE` table in `CONFIG_DB` was not modified unexpectedly; - otherwise, returns False. - """ - ddiff = DeepDiff(feature_table, expected_table, ignore_order=True) - - return True if not ddiff else False - - def checks_systemd_config_file(self, feature_table): - """Checks whether the systemd configuration file of each feature was created or not - and whether the `Restart=` field in the file is set correctly or not. - - Args: - feature_table: A dictionary indicates `Feature` table in `CONFIG_DB`. - - Returns: Boolean value indicates whether test passed or not. - """ - - truth_table = {'enabled': 'always', - 'disabled': 'no'} - - systemd_config_file_path = os.path.join(hostcfgd.FeatureHandler.SYSTEMD_SERVICE_CONF_DIR, - 'auto_restart.conf') - - for feature_name in feature_table: - auto_restart_status = feature_table[feature_name].get('auto_restart', 'disabled') - if "enabled" in auto_restart_status: - auto_restart_status = "enabled" - elif "disabled" in auto_restart_status: - auto_restart_status = "disabled" - - feature_systemd_config_file_path = systemd_config_file_path.format(feature_name) - is_config_file_existing = os.path.exists(feature_systemd_config_file_path) - assert is_config_file_existing, "Systemd configuration file of feature '{}' does not exist!".format(feature_name) - - with open(feature_systemd_config_file_path) as systemd_config_file: - status = systemd_config_file.read().strip() - assert status == '[Service]\nRestart={}'.format(truth_table[auto_restart_status]) - - def get_state_db_set_calls(self, feature_table): - """Returns a Mock call objects which recorded the `set` calls to `FEATURE` table in `STATE_DB`. - - Args: - feature_table: A dictionary indicates `FEATURE` table in `CONFIG_DB`. - - Returns: - set_call_list: A list indicates Mock call objects. - """ - set_call_list = [] - - for feature_name in feature_table.keys(): - feature_state = "" - if "enabled" in feature_table[feature_name]["state"]: - feature_state = "enabled" - elif "disabled" in feature_table[feature_name]["state"]: - feature_state = "disabled" - else: - feature_state = feature_table[feature_name]["state"] - - set_call_list.append(mock.call(feature_name, [("state", feature_state)])) - - return set_call_list - - @parameterized.expand(HOSTCFGD_TEST_VECTOR) - @patchfs - def test_sync_state_field(self, test_scenario_name, config_data, fs): - """Tests the method `sync_state_field(...)` of `FeatureHandler` class. - - Args: - test_secnario_name: A string indicates different testing scenario. - config_data: A dictionary contains initial `CONFIG_DB` tables and expected results. - - Returns: - Boolean value indicates whether test will pass or not. - """ - # add real path of sesscommon for database_config.json - fs.add_real_paths(swsscommon_package.__path__) - fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR) - - MockConfigDb.set_config_db(config_data['config_db']) - feature_state_table_mock = mock.Mock() - with mock.patch('hostcfgd.subprocess') as mocked_subprocess: - popen_mock = mock.Mock() - attrs = config_data['popen_attributes'] - popen_mock.configure_mock(**attrs) - mocked_subprocess.Popen.return_value = popen_mock - - device_config = {} - device_config['DEVICE_METADATA'] = MockConfigDb.CONFIG_DB['DEVICE_METADATA'] - feature_handler = hostcfgd.FeatureHandler(MockConfigDb(), feature_state_table_mock, device_config) - - feature_table = MockConfigDb.CONFIG_DB['FEATURE'] - feature_handler.sync_state_field(feature_table) - - is_any_difference = self.checks_config_table(MockConfigDb.get_config_db()['FEATURE'], - config_data['expected_config_db']['FEATURE']) - assert is_any_difference, "'FEATURE' table in 'CONFIG_DB' is modified unexpectedly!" - - feature_table_state_db_calls = self.get_state_db_set_calls(feature_table) - - self.checks_systemd_config_file(config_data['config_db']['FEATURE']) - mocked_subprocess.check_call.assert_has_calls(config_data['enable_feature_subprocess_calls'], - any_order=True) - mocked_subprocess.check_call.assert_has_calls(config_data['daemon_reload_subprocess_call'], - any_order=True) - feature_state_table_mock.set.assert_has_calls(feature_table_state_db_calls) - self.checks_systemd_config_file(config_data['config_db']['FEATURE']) - - @parameterized.expand(HOSTCFGD_TEST_VECTOR) - @patchfs - def test_handler(self, test_scenario_name, config_data, fs): - """Tests the method `handle(...)` of `FeatureHandler` class. - - Args: - test_secnario_name: A string indicates different testing scenario. - config_data: A dictionary contains initial `CONFIG_DB` tables and expected results. - - Returns: - Boolean value indicates whether test will pass or not. - """ - # add real path of sesscommon for database_config.json - fs.add_real_paths(swsscommon_package.__path__) - fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR) - - MockConfigDb.set_config_db(config_data['config_db']) - feature_state_table_mock = mock.Mock() - with mock.patch('hostcfgd.subprocess') as mocked_subprocess: - popen_mock = mock.Mock() - attrs = config_data['popen_attributes'] - popen_mock.configure_mock(**attrs) - mocked_subprocess.Popen.return_value = popen_mock - - device_config = {} - device_config['DEVICE_METADATA'] = MockConfigDb.CONFIG_DB['DEVICE_METADATA'] - feature_handler = hostcfgd.FeatureHandler(MockConfigDb(), feature_state_table_mock, device_config) - - feature_table = MockConfigDb.CONFIG_DB['FEATURE'] - - for feature_name, feature_config in feature_table.items(): - feature_handler.handler(feature_name, 'SET', feature_config) - - self.checks_systemd_config_file(config_data['config_db']['FEATURE']) - mocked_subprocess.check_call.assert_has_calls(config_data['enable_feature_subprocess_calls'], - any_order=True) - mocked_subprocess.check_call.assert_has_calls(config_data['daemon_reload_subprocess_call'], - any_order=True) - - def test_feature_config_parsing(self): - swss_feature = hostcfgd.Feature('swss', { - 'state': 'enabled', - 'auto_restart': 'enabled', - 'has_timer': 'True', - 'has_global_scope': 'False', - 'has_per_asic_scope': 'True', - }) - - assert swss_feature.name == 'swss' - assert swss_feature.state == 'enabled' - assert swss_feature.auto_restart == 'enabled' - assert swss_feature.has_timer - assert not swss_feature.has_global_scope - assert swss_feature.has_per_asic_scope - - def test_feature_config_parsing_defaults(self): - swss_feature = hostcfgd.Feature('swss', { - 'state': 'enabled', - }) - - assert swss_feature.name == 'swss' - assert swss_feature.state == 'enabled' - assert swss_feature.auto_restart == 'disabled' - assert not swss_feature.has_timer - assert swss_feature.has_global_scope - assert not swss_feature.has_per_asic_scope - - -class TesNtpCfgd(TestCase): - """ - Test hostcfd daemon - NtpCfgd - """ - def setUp(self): - MockConfigDb.CONFIG_DB['NTP'] = {'global': {'vrf': 'mgmt', 'src_intf': 'eth0'}} - MockConfigDb.CONFIG_DB['NTP_SERVER'] = {'0.debian.pool.ntp.org': {}} - - def tearDown(self): - MockConfigDb.CONFIG_DB = {} - - def test_ntp_global_update_with_no_servers(self): - with mock.patch('hostcfgd.subprocess') as mocked_subprocess: - popen_mock = mock.Mock() - attrs = {'communicate.return_value': ('output', 'error')} - popen_mock.configure_mock(**attrs) - mocked_subprocess.Popen.return_value = popen_mock - - ntpcfgd = hostcfgd.NtpCfg() - ntpcfgd.ntp_global_update('global', MockConfigDb.CONFIG_DB['NTP']['global']) - - mocked_subprocess.check_call.assert_not_called() - - def test_ntp_global_update_ntp_servers(self): - with mock.patch('hostcfgd.subprocess') as mocked_subprocess: - popen_mock = mock.Mock() - attrs = {'communicate.return_value': ('output', 'error')} - popen_mock.configure_mock(**attrs) - mocked_subprocess.Popen.return_value = popen_mock - - ntpcfgd = hostcfgd.NtpCfg() - ntpcfgd.ntp_global_update('global', MockConfigDb.CONFIG_DB['NTP']['global']) - ntpcfgd.ntp_server_update('0.debian.pool.ntp.org', 'SET') - mocked_subprocess.check_call.assert_has_calls([call('systemctl restart ntp-config', shell=True)]) - - def test_loopback_update(self): - with mock.patch('hostcfgd.subprocess') as mocked_subprocess: - popen_mock = mock.Mock() - attrs = {'communicate.return_value': ('output', 'error')} - popen_mock.configure_mock(**attrs) - mocked_subprocess.Popen.return_value = popen_mock - - ntpcfgd = hostcfgd.NtpCfg() - ntpcfgd.ntp_global = MockConfigDb.CONFIG_DB['NTP']['global'] - ntpcfgd.ntp_servers.add('0.debian.pool.ntp.org') - - ntpcfgd.handle_ntp_source_intf_chg('eth0') - mocked_subprocess.check_call.assert_has_calls([call('systemctl restart ntp-config', shell=True)]) - - -class TestHostcfgdDaemon(TestCase): - - def setUp(self): - MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB) - - def tearDown(self): - MockConfigDb.CONFIG_DB = {} - - @patchfs - def test_feature_events(self, fs): - fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR) - MockConfigDb.event_queue = [('FEATURE', 'dhcp_relay'), - ('FEATURE', 'mux'), - ('FEATURE', 'telemetry')] - daemon = hostcfgd.HostConfigDaemon() - daemon.register_callbacks() - with mock.patch('hostcfgd.subprocess') as mocked_subprocess: - popen_mock = mock.Mock() - attrs = {'communicate.return_value': ('output', 'error')} - popen_mock.configure_mock(**attrs) - mocked_subprocess.Popen.return_value = popen_mock - try: - daemon.start() - except TimeoutError: - pass - expected = [call('sudo systemctl daemon-reload', shell=True), - call('sudo systemctl unmask dhcp_relay.service', shell=True), - call('sudo systemctl enable dhcp_relay.service', shell=True), - call('sudo systemctl start dhcp_relay.service', shell=True), - call('sudo systemctl daemon-reload', shell=True), - call('sudo systemctl unmask mux.service', shell=True), - call('sudo systemctl enable mux.service', shell=True), - call('sudo systemctl start mux.service', shell=True), - call('sudo systemctl daemon-reload', shell=True), - call('sudo systemctl unmask telemetry.service', shell=True), - call('sudo systemctl unmask telemetry.timer', shell=True), - call('sudo systemctl enable telemetry.timer', shell=True), - call('sudo systemctl start telemetry.timer', shell=True)] - mocked_subprocess.check_call.assert_has_calls(expected) - - # Change the state to disabled - MockConfigDb.CONFIG_DB['FEATURE']['telemetry']['state'] = 'disabled' - MockConfigDb.event_queue = [('FEATURE', 'telemetry')] - try: - daemon.start() - except TimeoutError: - pass - expected = [call('sudo systemctl stop telemetry.timer', shell=True), - call('sudo systemctl disable telemetry.timer', shell=True), - call('sudo systemctl mask telemetry.timer', shell=True), - call('sudo systemctl stop telemetry.service', shell=True), - call('sudo systemctl disable telemetry.timer', shell=True), - call('sudo systemctl mask telemetry.timer', shell=True)] - mocked_subprocess.check_call.assert_has_calls(expected) - - def test_loopback_events(self): - MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB) - MockConfigDb.event_queue = [('NTP', 'global'), - ('NTP_SERVER', '0.debian.pool.ntp.org'), - ('LOOPBACK_INTERFACE', 'Loopback0|10.184.8.233/32')] - daemon = hostcfgd.HostConfigDaemon() - daemon.register_callbacks() - with mock.patch('hostcfgd.subprocess') as mocked_subprocess: - popen_mock = mock.Mock() - attrs = {'communicate.return_value': ('output', 'error')} - popen_mock.configure_mock(**attrs) - mocked_subprocess.Popen.return_value = popen_mock - try: - daemon.start() - except TimeoutError: - pass - expected = [call('systemctl restart ntp-config', shell=True), - call('iptables -t mangle --append PREROUTING -p tcp --tcp-flags SYN SYN -d 10.184.8.233 -j TCPMSS --set-mss 1460', shell=True), - call('iptables -t mangle --append POSTROUTING -p tcp --tcp-flags SYN SYN -s 10.184.8.233 -j TCPMSS --set-mss 1460', shell=True)] - mocked_subprocess.check_call.assert_has_calls(expected, any_order=True) - - def test_kdump_event(self): - MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB) - daemon = hostcfgd.HostConfigDaemon() - daemon.register_callbacks() - MockConfigDb.event_queue = [('KDUMP', 'config')] - with mock.patch('hostcfgd.subprocess') as mocked_subprocess: - popen_mock = mock.Mock() - attrs = {'communicate.return_value': ('output', 'error')} - popen_mock.configure_mock(**attrs) - mocked_subprocess.Popen.return_value = popen_mock - try: - daemon.start() - except TimeoutError: - pass - expected = [call('sonic-kdump-config --disable', shell=True), - call('sonic-kdump-config --num_dumps 3', shell=True), - call('sonic-kdump-config --memory 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M', shell=True)] - mocked_subprocess.check_call.assert_has_calls(expected, any_order=True) diff --git a/src/sonic-host-services/tests/hostcfgd/output/.gitignore b/src/sonic-host-services/tests/hostcfgd/output/.gitignore deleted file mode 100644 index 3f4e276cb2df..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/output/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore all test generated files -* -# But keep this file -!.gitignore diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/common-auth-sonic deleted file mode 100644 index 87af4cc5c6ac..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/common-auth-sonic +++ /dev/null @@ -1,21 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-auth- authentication settings common to all services -# This file is included from other service-specific PAM config files, -# and should contain a list of the authentication modules that define -# the central authentication scheme for use on the system -# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the -# traditional Unix authentication mechanisms. -# -# here are the per-package modules (the "Primary" block) - -auth [success=1 default=ignore] pam_unix.so nullok try_first_pass - -# -# here's the fallback if no module succeeds -auth requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -auth required pam_permit.so -# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/login b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/login deleted file mode 100644 index 80ba6452813f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/login +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth-sonic - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/login.old deleted file mode 100644 index 07ff95407ccd..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/login.old +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/radius_nss.conf deleted file mode 100644 index 8c31db9fbafe..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/radius_nss.conf +++ /dev/null @@ -1,56 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 -# RADIUS NSS Configuration File -# -# Debug: on|off|trace -# Default: off -# -# debug=on -debug=on - -# -# User Privilege: -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell - -# Eg: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell -# - -# many_to_one: -# y: Map RADIUS users to one local user per privilege. -# n: Create local user account on first successful authentication. -# Default: n -# - -# Eg: -# many_to_one=y -# - -# unconfirmed_disallow: -# y: Do not allow unconfirmed users (users created before authentication) -# n: Allow unconfirmed users. -# Default: n - -# Eg: -# unconfirmed_disallow=y -# - -# unconfirmed_ageout: -# : Wait time before purging unconfirmed users -# Default: 600 -# - -# Eg: -# unconfirmed_ageout=900 -# - -# unconfirmed_regexp: -# : The RE to match the command line of processes for which the -# creation of unconfirmed users are to be allowed. -# Default: (.*: \[priv\])|(.*: \[accepted\]) -# where: is the unconfirmed user. -# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/sshd deleted file mode 100644 index c025af353d6f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/sshd +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth-sonic - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/sshd.old deleted file mode 100644 index d70b384bd9a3..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/sshd.old +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/tacplus_nss.conf deleted file mode 100644 index eac828491ac1..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/tacplus_nss.conf +++ /dev/null @@ -1,40 +0,0 @@ -# Configuration for libnss-tacplus - -# debug - If you want to open debug log, set it on -# Default: off -# debug=on -debug=on - -# local_accounting - If you want to local accounting, set it -# Default: None -# local_accounting - -# tacacs_accounting - If you want to tacacs+ accounting, set it -# Default: None -# tacacs_accounting - -# local_authorization - If you want to local authorization, set it -# Default: None -# local_authorization -local_authorization - -# tacacs_authorization - If you want to tacacs+ authorization, set it -# Default: None -# tacacs_authorization - -# src_ip - set source address of TACACS+ protocol packets -# Default: None (auto source ip address) -# src_ip=2.2.2.2 - -# server - set ip address, tcp port, secret string and timeout for TACACS+ servers -# Default: None (no TACACS+ server) -# server=1.1.1.1:49,secret=test,timeout=3 - -# user_priv - set the map between TACACS+ user privilege and local user's passwd -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash - -# many_to_one - create one local user for many TACACS+ users which has the same privilege -# Default: many_to_one=n -# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING/login.defs.old b/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING/login.defs.old deleted file mode 100644 index db8baa4d2bf8..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING/login.defs.old +++ /dev/null @@ -1,340 +0,0 @@ -# -# /etc/login.defs - Configuration control definitions for the login package. -# -# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. -# If unspecified, some arbitrary (and possibly incorrect) value will -# be assumed. All other items are optional - if not specified then -# the described action or option will be inhibited. -# -# Comment lines (lines beginning with "#") and blank lines are ignored. -# -# Modified for Linux. --marekm - -# REQUIRED for useradd/userdel/usermod -# Directory where mailboxes reside, _or_ name of file, relative to the -# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, -# MAIL_DIR takes precedence. -# -# Essentially: -# - MAIL_DIR defines the location of users mail spool files -# (for mbox use) by appending the username to MAIL_DIR as defined -# below. -# - MAIL_FILE defines the location of the users mail spool files as the -# fully-qualified filename obtained by prepending the user home -# directory before $MAIL_FILE -# -# NOTE: This is no more used for setting up users MAIL environment variable -# which is, starting from shadow 4.0.12-1 in Debian, entirely the -# job of the pam_mail PAM modules -# See default PAM configuration files provided for -# login, su, etc. -# -# This is a temporary situation: setting these variables will soon -# move to /etc/default/useradd and the variables will then be -# no more supported -MAIL_DIR /var/mail -#MAIL_FILE .mail - -# -# Enable logging and display of /var/log/faillog login failure info. -# This option conflicts with the pam_tally PAM module. -# -FAILLOG_ENAB yes - -# -# Enable display of unknown usernames when login failures are recorded. -# -# WARNING: Unknown usernames may become world readable. -# See #290803 and #298773 for details about how this could become a security -# concern -LOG_UNKFAIL_ENAB no - -# -# Enable logging of successful logins -# -LOG_OK_LOGINS no - -# -# Enable "syslog" logging of su activity - in addition to sulog file logging. -# SYSLOG_SG_ENAB does the same for newgrp and sg. -# -SYSLOG_SU_ENAB yes -SYSLOG_SG_ENAB yes - -# -# If defined, all su activity is logged to this file. -# -#SULOG_FILE /var/log/sulog - -# -# If defined, file which maps tty line to TERM environment parameter. -# Each line of the file is in a format something like "vt100 tty01". -# -#TTYTYPE_FILE /etc/ttytype - -# -# If defined, login failures will be logged here in a utmp format -# last, when invoked as lastb, will read /var/log/btmp, so... -# -FTMP_FILE /var/log/btmp - -# -# If defined, the command name to display when running "su -". For -# example, if this is defined as "su" then a "ps" will display the -# command is "-su". If not defined, then "ps" would display the -# name of the shell actually being run, e.g. something like "-sh". -# -SU_NAME su - -# -# If defined, file which inhibits all the usual chatter during the login -# sequence. If a full pathname, then hushed mode will be enabled if the -# user's name or shell are found in the file. If not a full pathname, then -# hushed mode will be enabled if the file exists in the user's home directory. -# -HUSHLOGIN_FILE .hushlogin -#HUSHLOGIN_FILE /etc/hushlogins - -# -# *REQUIRED* The default PATH settings, for superuser and normal users. -# -# (they are minimal, add the rest in the shell startup files) -ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games - -# -# Terminal permissions -# -# TTYGROUP Login tty will be assigned this group ownership. -# TTYPERM Login tty will be set to this permission. -# -# If you have a "write" program which is "setgid" to a special group -# which owns the terminals, define TTYGROUP to the group number and -# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign -# TTYPERM to either 622 or 600. -# -# In Debian /usr/bin/bsd-write or similar programs are setgid tty -# However, the default and recommended value for TTYPERM is still 0600 -# to not allow anyone to write to anyone else console or terminal - -# Users can still allow other people to write them by issuing -# the "mesg y" command. - -TTYGROUP tty -TTYPERM 0600 - -# -# Login configuration initializations: -# -# ERASECHAR Terminal ERASE character ('\010' = backspace). -# KILLCHAR Terminal KILL character ('\025' = CTRL/U). -# UMASK Default "umask" value. -# -# The ERASECHAR and KILLCHAR are used only on System V machines. -# -# UMASK is the default umask value for pam_umask and is used by -# useradd and newusers to set the mode of the new home directories. -# 022 is the "historical" value in Debian for UMASK -# 027, or even 077, could be considered better for privacy -# There is no One True Answer here : each sysadmin must make up his/her -# mind. -# -# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value -# for private user groups, i. e. the uid is the same as gid, and username is -# the same as the primary group name: for these, the user permissions will be -# used as group permissions, e. g. 022 will become 002. -# -# Prefix these values with "0" to get octal, "0x" to get hexadecimal. -# -ERASECHAR 0177 -KILLCHAR 025 -UMASK 022 - -# -# Password aging controls: -# -# PASS_MAX_DAYS Maximum number of days a password may be used. -# PASS_MIN_DAYS Minimum number of days allowed between password changes. -# PASS_WARN_AGE Number of days warning given before a password expires. -# -PASS_MAX_DAYS 99999 -PASS_MIN_DAYS 0 -PASS_WARN_AGE 7 - -# -# Min/max values for automatic uid selection in useradd -# -UID_MIN 1000 -UID_MAX 60000 -# System accounts -#SYS_UID_MIN 100 -#SYS_UID_MAX 999 - -# -# Min/max values for automatic gid selection in groupadd -# -GID_MIN 1000 -GID_MAX 60000 -# System accounts -#SYS_GID_MIN 100 -#SYS_GID_MAX 999 - -# -# Max number of login retries if password is bad. This will most likely be -# overriden by PAM, since the default pam_unix module has it's own built -# in of 3 retries. However, this is a safe fallback in case you are using -# an authentication module that does not enforce PAM_MAXTRIES. -# -LOGIN_RETRIES 5 - -# -# Max time in seconds for login -# -LOGIN_TIMEOUT 60 - -# -# Which fields may be changed by regular users using chfn - use -# any combination of letters "frwh" (full name, room number, work -# phone, home phone). If not defined, no changes are allowed. -# For backward compatibility, "yes" = "rwh" and "no" = "frwh". -# -CHFN_RESTRICT rwh - -# -# Should login be allowed if we can't cd to the home directory? -# Default in no. -# -DEFAULT_HOME yes - -# -# If defined, this command is run when removing a user. -# It should remove any at/cron/print jobs etc. owned by -# the user to be removed (passed as the first argument). -# -#USERDEL_CMD /usr/sbin/userdel_local - -# -# If set to yes, userdel will remove the user's group if it contains no -# more members, and useradd will create by default a group with the name -# of the user. -# -# Other former uses of this variable such as setting the umask when -# user==primary group are not used in PAM environments, such as Debian -# -USERGROUPS_ENAB yes - -# -# Instead of the real user shell, the program specified by this parameter -# will be launched, although its visible name (argv[0]) will be the shell's. -# The program may do whatever it wants (logging, additional authentification, -# banner, ...) before running the actual shell. -# -# FAKE_SHELL /bin/fakeshell - -# -# If defined, either full pathname of a file containing device names or -# a ":" delimited list of device names. Root logins will be allowed only -# upon these devices. -# -# This variable is used by login and su. -# -#CONSOLE /etc/consoles -#CONSOLE console:tty01:tty02:tty03:tty04 - -# -# List of groups to add to the user's supplementary group set -# when logging in on the console (as determined by the CONSOLE -# setting). Default is none. -# -# Use with caution - it is possible for users to gain permanent -# access to these groups, even when not logged in on the console. -# How to do it is left as an exercise for the reader... -# -# This variable is used by login and su. -# -#CONSOLE_GROUPS floppy:audio:cdrom - -# -# If set to "yes", new passwords will be encrypted using the MD5-based -# algorithm compatible with the one used by recent releases of FreeBSD. -# It supports passwords of unlimited length and longer salt strings. -# Set to "no" if you need to copy encrypted passwords to other systems -# which don't understand the new algorithm. Default is "no". -# -# This variable is deprecated. You should use ENCRYPT_METHOD. -# -#MD5_CRYPT_ENAB no - -# -# If set to MD5 , MD5-based algorithm will be used for encrypting password -# If set to SHA256, SHA256-based algorithm will be used for encrypting password -# If set to SHA512, SHA512-based algorithm will be used for encrypting password -# If set to DES, DES-based algorithm will be used for encrypting password (default) -# Overrides the MD5_CRYPT_ENAB option -# -# Note: It is recommended to use a value consistent with -# the PAM modules configuration. -# -ENCRYPT_METHOD SHA512 - -# -# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. -# -# Define the number of SHA rounds. -# With a lot of rounds, it is more difficult to brute forcing the password. -# But note also that it more CPU resources will be needed to authenticate -# users. -# -# If not specified, the libc will choose the default number of rounds (5000). -# The values must be inside the 1000-999999999 range. -# If only one of the MIN or MAX values is set, then this value will be used. -# If MIN > MAX, the highest value will be used. -# -# SHA_CRYPT_MIN_ROUNDS 5000 -# SHA_CRYPT_MAX_ROUNDS 5000 - -################# OBSOLETED BY PAM ############## -# # -# These options are now handled by PAM. Please # -# edit the appropriate file in /etc/pam.d/ to # -# enable the equivelants of them. -# -############### - -#MOTD_FILE -#DIALUPS_CHECK_ENAB -#LASTLOG_ENAB -#MAIL_CHECK_ENAB -#OBSCURE_CHECKS_ENAB -#PORTTIME_CHECKS_ENAB -#SU_WHEEL_ONLY -#CRACKLIB_DICTPATH -#PASS_CHANGE_TRIES -#PASS_ALWAYS_WARN -#ENVIRON_FILE -#NOLOGINS_FILE -#ISSUE_FILE -#PASS_MIN_LEN -#PASS_MAX_LEN -#ULIMIT -#ENV_HZ -#CHFN_AUTH -#CHSH_AUTH -#FAIL_DELAY - -################# OBSOLETED ####################### -# # -# These options are no more handled by shadow. # -# # -# Shadow utilities will display a warning if they # -# still appear. # -# # -################################################### - -# CLOSE_SESSIONS -# LOGIN_STRING -# NO_PASSWORD_CONSOLE -# QMAIL_DIR - - - diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_default_values/common-password b/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_default_values/common-password deleted file mode 100644 index 0da639249c94..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_default_values/common-password +++ /dev/null @@ -1,36 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-password - password-related modules common to all services -# -# This file is included from other service-specific PAM config files, -# and should contain a list of modules that define the services to be -# used to change user passwords. The default is pam_unix. - -# Explanation of pam_unix options: -# The "yescrypt" option enables -#hashed passwords using the yescrypt algorithm, introduced in Debian -#11. Without this option, the default is Unix crypt. Prior releases -#used the option "sha512"; if a shadow password hash will be shared -#between Debian 11 and older releases replace "yescrypt" with "sha512" -#for compatibility . The "obscure" option replaces the old -#`OBSCURE_CHECKS_ENAB' option in login.defs. See the pam_unix manpage -#for other options. - -# As of pam 1.0.1-6, this file is managed by pam-auth-update by default. -# To take advantage of this, it is recommended that you configure any -# local modules either before or after the default block, and use -# pam-auth-update to manage selection of other modules. See -# pam-auth-update(8) for details. - -# here are the per-package modules (the "Primary" block) - - -password [success=1 default=ignore] pam_unix.so obscure yescrypt -# here's the fallback if no module succeeds -password requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -password required pam_permit.so -# and here are more per-package modules (the "Additional" block) -# end of pam-auth-update config \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_default_values/login.defs b/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_default_values/login.defs deleted file mode 100644 index db8baa4d2bf8..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_default_values/login.defs +++ /dev/null @@ -1,340 +0,0 @@ -# -# /etc/login.defs - Configuration control definitions for the login package. -# -# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. -# If unspecified, some arbitrary (and possibly incorrect) value will -# be assumed. All other items are optional - if not specified then -# the described action or option will be inhibited. -# -# Comment lines (lines beginning with "#") and blank lines are ignored. -# -# Modified for Linux. --marekm - -# REQUIRED for useradd/userdel/usermod -# Directory where mailboxes reside, _or_ name of file, relative to the -# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, -# MAIL_DIR takes precedence. -# -# Essentially: -# - MAIL_DIR defines the location of users mail spool files -# (for mbox use) by appending the username to MAIL_DIR as defined -# below. -# - MAIL_FILE defines the location of the users mail spool files as the -# fully-qualified filename obtained by prepending the user home -# directory before $MAIL_FILE -# -# NOTE: This is no more used for setting up users MAIL environment variable -# which is, starting from shadow 4.0.12-1 in Debian, entirely the -# job of the pam_mail PAM modules -# See default PAM configuration files provided for -# login, su, etc. -# -# This is a temporary situation: setting these variables will soon -# move to /etc/default/useradd and the variables will then be -# no more supported -MAIL_DIR /var/mail -#MAIL_FILE .mail - -# -# Enable logging and display of /var/log/faillog login failure info. -# This option conflicts with the pam_tally PAM module. -# -FAILLOG_ENAB yes - -# -# Enable display of unknown usernames when login failures are recorded. -# -# WARNING: Unknown usernames may become world readable. -# See #290803 and #298773 for details about how this could become a security -# concern -LOG_UNKFAIL_ENAB no - -# -# Enable logging of successful logins -# -LOG_OK_LOGINS no - -# -# Enable "syslog" logging of su activity - in addition to sulog file logging. -# SYSLOG_SG_ENAB does the same for newgrp and sg. -# -SYSLOG_SU_ENAB yes -SYSLOG_SG_ENAB yes - -# -# If defined, all su activity is logged to this file. -# -#SULOG_FILE /var/log/sulog - -# -# If defined, file which maps tty line to TERM environment parameter. -# Each line of the file is in a format something like "vt100 tty01". -# -#TTYTYPE_FILE /etc/ttytype - -# -# If defined, login failures will be logged here in a utmp format -# last, when invoked as lastb, will read /var/log/btmp, so... -# -FTMP_FILE /var/log/btmp - -# -# If defined, the command name to display when running "su -". For -# example, if this is defined as "su" then a "ps" will display the -# command is "-su". If not defined, then "ps" would display the -# name of the shell actually being run, e.g. something like "-sh". -# -SU_NAME su - -# -# If defined, file which inhibits all the usual chatter during the login -# sequence. If a full pathname, then hushed mode will be enabled if the -# user's name or shell are found in the file. If not a full pathname, then -# hushed mode will be enabled if the file exists in the user's home directory. -# -HUSHLOGIN_FILE .hushlogin -#HUSHLOGIN_FILE /etc/hushlogins - -# -# *REQUIRED* The default PATH settings, for superuser and normal users. -# -# (they are minimal, add the rest in the shell startup files) -ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games - -# -# Terminal permissions -# -# TTYGROUP Login tty will be assigned this group ownership. -# TTYPERM Login tty will be set to this permission. -# -# If you have a "write" program which is "setgid" to a special group -# which owns the terminals, define TTYGROUP to the group number and -# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign -# TTYPERM to either 622 or 600. -# -# In Debian /usr/bin/bsd-write or similar programs are setgid tty -# However, the default and recommended value for TTYPERM is still 0600 -# to not allow anyone to write to anyone else console or terminal - -# Users can still allow other people to write them by issuing -# the "mesg y" command. - -TTYGROUP tty -TTYPERM 0600 - -# -# Login configuration initializations: -# -# ERASECHAR Terminal ERASE character ('\010' = backspace). -# KILLCHAR Terminal KILL character ('\025' = CTRL/U). -# UMASK Default "umask" value. -# -# The ERASECHAR and KILLCHAR are used only on System V machines. -# -# UMASK is the default umask value for pam_umask and is used by -# useradd and newusers to set the mode of the new home directories. -# 022 is the "historical" value in Debian for UMASK -# 027, or even 077, could be considered better for privacy -# There is no One True Answer here : each sysadmin must make up his/her -# mind. -# -# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value -# for private user groups, i. e. the uid is the same as gid, and username is -# the same as the primary group name: for these, the user permissions will be -# used as group permissions, e. g. 022 will become 002. -# -# Prefix these values with "0" to get octal, "0x" to get hexadecimal. -# -ERASECHAR 0177 -KILLCHAR 025 -UMASK 022 - -# -# Password aging controls: -# -# PASS_MAX_DAYS Maximum number of days a password may be used. -# PASS_MIN_DAYS Minimum number of days allowed between password changes. -# PASS_WARN_AGE Number of days warning given before a password expires. -# -PASS_MAX_DAYS 99999 -PASS_MIN_DAYS 0 -PASS_WARN_AGE 7 - -# -# Min/max values for automatic uid selection in useradd -# -UID_MIN 1000 -UID_MAX 60000 -# System accounts -#SYS_UID_MIN 100 -#SYS_UID_MAX 999 - -# -# Min/max values for automatic gid selection in groupadd -# -GID_MIN 1000 -GID_MAX 60000 -# System accounts -#SYS_GID_MIN 100 -#SYS_GID_MAX 999 - -# -# Max number of login retries if password is bad. This will most likely be -# overriden by PAM, since the default pam_unix module has it's own built -# in of 3 retries. However, this is a safe fallback in case you are using -# an authentication module that does not enforce PAM_MAXTRIES. -# -LOGIN_RETRIES 5 - -# -# Max time in seconds for login -# -LOGIN_TIMEOUT 60 - -# -# Which fields may be changed by regular users using chfn - use -# any combination of letters "frwh" (full name, room number, work -# phone, home phone). If not defined, no changes are allowed. -# For backward compatibility, "yes" = "rwh" and "no" = "frwh". -# -CHFN_RESTRICT rwh - -# -# Should login be allowed if we can't cd to the home directory? -# Default in no. -# -DEFAULT_HOME yes - -# -# If defined, this command is run when removing a user. -# It should remove any at/cron/print jobs etc. owned by -# the user to be removed (passed as the first argument). -# -#USERDEL_CMD /usr/sbin/userdel_local - -# -# If set to yes, userdel will remove the user's group if it contains no -# more members, and useradd will create by default a group with the name -# of the user. -# -# Other former uses of this variable such as setting the umask when -# user==primary group are not used in PAM environments, such as Debian -# -USERGROUPS_ENAB yes - -# -# Instead of the real user shell, the program specified by this parameter -# will be launched, although its visible name (argv[0]) will be the shell's. -# The program may do whatever it wants (logging, additional authentification, -# banner, ...) before running the actual shell. -# -# FAKE_SHELL /bin/fakeshell - -# -# If defined, either full pathname of a file containing device names or -# a ":" delimited list of device names. Root logins will be allowed only -# upon these devices. -# -# This variable is used by login and su. -# -#CONSOLE /etc/consoles -#CONSOLE console:tty01:tty02:tty03:tty04 - -# -# List of groups to add to the user's supplementary group set -# when logging in on the console (as determined by the CONSOLE -# setting). Default is none. -# -# Use with caution - it is possible for users to gain permanent -# access to these groups, even when not logged in on the console. -# How to do it is left as an exercise for the reader... -# -# This variable is used by login and su. -# -#CONSOLE_GROUPS floppy:audio:cdrom - -# -# If set to "yes", new passwords will be encrypted using the MD5-based -# algorithm compatible with the one used by recent releases of FreeBSD. -# It supports passwords of unlimited length and longer salt strings. -# Set to "no" if you need to copy encrypted passwords to other systems -# which don't understand the new algorithm. Default is "no". -# -# This variable is deprecated. You should use ENCRYPT_METHOD. -# -#MD5_CRYPT_ENAB no - -# -# If set to MD5 , MD5-based algorithm will be used for encrypting password -# If set to SHA256, SHA256-based algorithm will be used for encrypting password -# If set to SHA512, SHA512-based algorithm will be used for encrypting password -# If set to DES, DES-based algorithm will be used for encrypting password (default) -# Overrides the MD5_CRYPT_ENAB option -# -# Note: It is recommended to use a value consistent with -# the PAM modules configuration. -# -ENCRYPT_METHOD SHA512 - -# -# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. -# -# Define the number of SHA rounds. -# With a lot of rounds, it is more difficult to brute forcing the password. -# But note also that it more CPU resources will be needed to authenticate -# users. -# -# If not specified, the libc will choose the default number of rounds (5000). -# The values must be inside the 1000-999999999 range. -# If only one of the MIN or MAX values is set, then this value will be used. -# If MIN > MAX, the highest value will be used. -# -# SHA_CRYPT_MIN_ROUNDS 5000 -# SHA_CRYPT_MAX_ROUNDS 5000 - -################# OBSOLETED BY PAM ############## -# # -# These options are now handled by PAM. Please # -# edit the appropriate file in /etc/pam.d/ to # -# enable the equivelants of them. -# -############### - -#MOTD_FILE -#DIALUPS_CHECK_ENAB -#LASTLOG_ENAB -#MAIL_CHECK_ENAB -#OBSCURE_CHECKS_ENAB -#PORTTIME_CHECKS_ENAB -#SU_WHEEL_ONLY -#CRACKLIB_DICTPATH -#PASS_CHANGE_TRIES -#PASS_ALWAYS_WARN -#ENVIRON_FILE -#NOLOGINS_FILE -#ISSUE_FILE -#PASS_MIN_LEN -#PASS_MAX_LEN -#ULIMIT -#ENV_HZ -#CHFN_AUTH -#CHSH_AUTH -#FAIL_DELAY - -################# OBSOLETED ####################### -# # -# These options are no more handled by shadow. # -# # -# Shadow utilities will display a warning if they # -# still appear. # -# # -################################################### - -# CLOSE_SESSIONS -# LOGIN_STRING -# NO_PASSWORD_CONSOLE -# QMAIL_DIR - - - diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_digits_class/common-password b/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_digits_class/common-password deleted file mode 100644 index 841074728a4f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_digits_class/common-password +++ /dev/null @@ -1,39 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-password - password-related modules common to all services -# -# This file is included from other service-specific PAM config files, -# and should contain a list of modules that define the services to be -# used to change user passwords. The default is pam_unix. - -# Explanation of pam_unix options: -# The "yescrypt" option enables -#hashed passwords using the yescrypt algorithm, introduced in Debian -#11. Without this option, the default is Unix crypt. Prior releases -#used the option "sha512"; if a shadow password hash will be shared -#between Debian 11 and older releases replace "yescrypt" with "sha512" -#for compatibility . The "obscure" option replaces the old -#`OBSCURE_CHECKS_ENAB' option in login.defs. See the pam_unix manpage -#for other options. - -# As of pam 1.0.1-6, this file is managed by pam-auth-update by default. -# To take advantage of this, it is recommended that you configure any -# local modules either before or after the default block, and use -# pam-auth-update to manage selection of other modules. See -# pam-auth-update(8) for details. - -# here are the per-package modules (the "Primary" block) - -password requisite pam_cracklib.so retry=3 maxrepeat=0 minlen=8 ucredit=0 lcredit=0 dcredit=-1 ocredit=0 enforce_for_root - -password required pam_pwhistory.so remember=0 use_authtok enforce_for_root - -password [success=1 default=ignore] pam_unix.so obscure yescrypt -# here's the fallback if no module succeeds -password requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -password required pam_permit.so -# and here are more per-package modules (the "Additional" block) -# end of pam-auth-update config \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_digits_class/login.defs b/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_digits_class/login.defs deleted file mode 100644 index db8baa4d2bf8..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_digits_class/login.defs +++ /dev/null @@ -1,340 +0,0 @@ -# -# /etc/login.defs - Configuration control definitions for the login package. -# -# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. -# If unspecified, some arbitrary (and possibly incorrect) value will -# be assumed. All other items are optional - if not specified then -# the described action or option will be inhibited. -# -# Comment lines (lines beginning with "#") and blank lines are ignored. -# -# Modified for Linux. --marekm - -# REQUIRED for useradd/userdel/usermod -# Directory where mailboxes reside, _or_ name of file, relative to the -# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, -# MAIL_DIR takes precedence. -# -# Essentially: -# - MAIL_DIR defines the location of users mail spool files -# (for mbox use) by appending the username to MAIL_DIR as defined -# below. -# - MAIL_FILE defines the location of the users mail spool files as the -# fully-qualified filename obtained by prepending the user home -# directory before $MAIL_FILE -# -# NOTE: This is no more used for setting up users MAIL environment variable -# which is, starting from shadow 4.0.12-1 in Debian, entirely the -# job of the pam_mail PAM modules -# See default PAM configuration files provided for -# login, su, etc. -# -# This is a temporary situation: setting these variables will soon -# move to /etc/default/useradd and the variables will then be -# no more supported -MAIL_DIR /var/mail -#MAIL_FILE .mail - -# -# Enable logging and display of /var/log/faillog login failure info. -# This option conflicts with the pam_tally PAM module. -# -FAILLOG_ENAB yes - -# -# Enable display of unknown usernames when login failures are recorded. -# -# WARNING: Unknown usernames may become world readable. -# See #290803 and #298773 for details about how this could become a security -# concern -LOG_UNKFAIL_ENAB no - -# -# Enable logging of successful logins -# -LOG_OK_LOGINS no - -# -# Enable "syslog" logging of su activity - in addition to sulog file logging. -# SYSLOG_SG_ENAB does the same for newgrp and sg. -# -SYSLOG_SU_ENAB yes -SYSLOG_SG_ENAB yes - -# -# If defined, all su activity is logged to this file. -# -#SULOG_FILE /var/log/sulog - -# -# If defined, file which maps tty line to TERM environment parameter. -# Each line of the file is in a format something like "vt100 tty01". -# -#TTYTYPE_FILE /etc/ttytype - -# -# If defined, login failures will be logged here in a utmp format -# last, when invoked as lastb, will read /var/log/btmp, so... -# -FTMP_FILE /var/log/btmp - -# -# If defined, the command name to display when running "su -". For -# example, if this is defined as "su" then a "ps" will display the -# command is "-su". If not defined, then "ps" would display the -# name of the shell actually being run, e.g. something like "-sh". -# -SU_NAME su - -# -# If defined, file which inhibits all the usual chatter during the login -# sequence. If a full pathname, then hushed mode will be enabled if the -# user's name or shell are found in the file. If not a full pathname, then -# hushed mode will be enabled if the file exists in the user's home directory. -# -HUSHLOGIN_FILE .hushlogin -#HUSHLOGIN_FILE /etc/hushlogins - -# -# *REQUIRED* The default PATH settings, for superuser and normal users. -# -# (they are minimal, add the rest in the shell startup files) -ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games - -# -# Terminal permissions -# -# TTYGROUP Login tty will be assigned this group ownership. -# TTYPERM Login tty will be set to this permission. -# -# If you have a "write" program which is "setgid" to a special group -# which owns the terminals, define TTYGROUP to the group number and -# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign -# TTYPERM to either 622 or 600. -# -# In Debian /usr/bin/bsd-write or similar programs are setgid tty -# However, the default and recommended value for TTYPERM is still 0600 -# to not allow anyone to write to anyone else console or terminal - -# Users can still allow other people to write them by issuing -# the "mesg y" command. - -TTYGROUP tty -TTYPERM 0600 - -# -# Login configuration initializations: -# -# ERASECHAR Terminal ERASE character ('\010' = backspace). -# KILLCHAR Terminal KILL character ('\025' = CTRL/U). -# UMASK Default "umask" value. -# -# The ERASECHAR and KILLCHAR are used only on System V machines. -# -# UMASK is the default umask value for pam_umask and is used by -# useradd and newusers to set the mode of the new home directories. -# 022 is the "historical" value in Debian for UMASK -# 027, or even 077, could be considered better for privacy -# There is no One True Answer here : each sysadmin must make up his/her -# mind. -# -# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value -# for private user groups, i. e. the uid is the same as gid, and username is -# the same as the primary group name: for these, the user permissions will be -# used as group permissions, e. g. 022 will become 002. -# -# Prefix these values with "0" to get octal, "0x" to get hexadecimal. -# -ERASECHAR 0177 -KILLCHAR 025 -UMASK 022 - -# -# Password aging controls: -# -# PASS_MAX_DAYS Maximum number of days a password may be used. -# PASS_MIN_DAYS Minimum number of days allowed between password changes. -# PASS_WARN_AGE Number of days warning given before a password expires. -# -PASS_MAX_DAYS 99999 -PASS_MIN_DAYS 0 -PASS_WARN_AGE 7 - -# -# Min/max values for automatic uid selection in useradd -# -UID_MIN 1000 -UID_MAX 60000 -# System accounts -#SYS_UID_MIN 100 -#SYS_UID_MAX 999 - -# -# Min/max values for automatic gid selection in groupadd -# -GID_MIN 1000 -GID_MAX 60000 -# System accounts -#SYS_GID_MIN 100 -#SYS_GID_MAX 999 - -# -# Max number of login retries if password is bad. This will most likely be -# overriden by PAM, since the default pam_unix module has it's own built -# in of 3 retries. However, this is a safe fallback in case you are using -# an authentication module that does not enforce PAM_MAXTRIES. -# -LOGIN_RETRIES 5 - -# -# Max time in seconds for login -# -LOGIN_TIMEOUT 60 - -# -# Which fields may be changed by regular users using chfn - use -# any combination of letters "frwh" (full name, room number, work -# phone, home phone). If not defined, no changes are allowed. -# For backward compatibility, "yes" = "rwh" and "no" = "frwh". -# -CHFN_RESTRICT rwh - -# -# Should login be allowed if we can't cd to the home directory? -# Default in no. -# -DEFAULT_HOME yes - -# -# If defined, this command is run when removing a user. -# It should remove any at/cron/print jobs etc. owned by -# the user to be removed (passed as the first argument). -# -#USERDEL_CMD /usr/sbin/userdel_local - -# -# If set to yes, userdel will remove the user's group if it contains no -# more members, and useradd will create by default a group with the name -# of the user. -# -# Other former uses of this variable such as setting the umask when -# user==primary group are not used in PAM environments, such as Debian -# -USERGROUPS_ENAB yes - -# -# Instead of the real user shell, the program specified by this parameter -# will be launched, although its visible name (argv[0]) will be the shell's. -# The program may do whatever it wants (logging, additional authentification, -# banner, ...) before running the actual shell. -# -# FAKE_SHELL /bin/fakeshell - -# -# If defined, either full pathname of a file containing device names or -# a ":" delimited list of device names. Root logins will be allowed only -# upon these devices. -# -# This variable is used by login and su. -# -#CONSOLE /etc/consoles -#CONSOLE console:tty01:tty02:tty03:tty04 - -# -# List of groups to add to the user's supplementary group set -# when logging in on the console (as determined by the CONSOLE -# setting). Default is none. -# -# Use with caution - it is possible for users to gain permanent -# access to these groups, even when not logged in on the console. -# How to do it is left as an exercise for the reader... -# -# This variable is used by login and su. -# -#CONSOLE_GROUPS floppy:audio:cdrom - -# -# If set to "yes", new passwords will be encrypted using the MD5-based -# algorithm compatible with the one used by recent releases of FreeBSD. -# It supports passwords of unlimited length and longer salt strings. -# Set to "no" if you need to copy encrypted passwords to other systems -# which don't understand the new algorithm. Default is "no". -# -# This variable is deprecated. You should use ENCRYPT_METHOD. -# -#MD5_CRYPT_ENAB no - -# -# If set to MD5 , MD5-based algorithm will be used for encrypting password -# If set to SHA256, SHA256-based algorithm will be used for encrypting password -# If set to SHA512, SHA512-based algorithm will be used for encrypting password -# If set to DES, DES-based algorithm will be used for encrypting password (default) -# Overrides the MD5_CRYPT_ENAB option -# -# Note: It is recommended to use a value consistent with -# the PAM modules configuration. -# -ENCRYPT_METHOD SHA512 - -# -# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. -# -# Define the number of SHA rounds. -# With a lot of rounds, it is more difficult to brute forcing the password. -# But note also that it more CPU resources will be needed to authenticate -# users. -# -# If not specified, the libc will choose the default number of rounds (5000). -# The values must be inside the 1000-999999999 range. -# If only one of the MIN or MAX values is set, then this value will be used. -# If MIN > MAX, the highest value will be used. -# -# SHA_CRYPT_MIN_ROUNDS 5000 -# SHA_CRYPT_MAX_ROUNDS 5000 - -################# OBSOLETED BY PAM ############## -# # -# These options are now handled by PAM. Please # -# edit the appropriate file in /etc/pam.d/ to # -# enable the equivelants of them. -# -############### - -#MOTD_FILE -#DIALUPS_CHECK_ENAB -#LASTLOG_ENAB -#MAIL_CHECK_ENAB -#OBSCURE_CHECKS_ENAB -#PORTTIME_CHECKS_ENAB -#SU_WHEEL_ONLY -#CRACKLIB_DICTPATH -#PASS_CHANGE_TRIES -#PASS_ALWAYS_WARN -#ENVIRON_FILE -#NOLOGINS_FILE -#ISSUE_FILE -#PASS_MIN_LEN -#PASS_MAX_LEN -#ULIMIT -#ENV_HZ -#CHFN_AUTH -#CHSH_AUTH -#FAIL_DELAY - -################# OBSOLETED ####################### -# # -# These options are no more handled by shadow. # -# # -# Shadow utilities will display a warning if they # -# still appear. # -# # -################################################### - -# CLOSE_SESSIONS -# LOGIN_STRING -# NO_PASSWORD_CONSOLE -# QMAIL_DIR - - - diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_feature/common-password b/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_feature/common-password deleted file mode 100644 index a66c1b1ade0c..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_feature/common-password +++ /dev/null @@ -1,39 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-password - password-related modules common to all services -# -# This file is included from other service-specific PAM config files, -# and should contain a list of modules that define the services to be -# used to change user passwords. The default is pam_unix. - -# Explanation of pam_unix options: -# The "yescrypt" option enables -#hashed passwords using the yescrypt algorithm, introduced in Debian -#11. Without this option, the default is Unix crypt. Prior releases -#used the option "sha512"; if a shadow password hash will be shared -#between Debian 11 and older releases replace "yescrypt" with "sha512" -#for compatibility . The "obscure" option replaces the old -#`OBSCURE_CHECKS_ENAB' option in login.defs. See the pam_unix manpage -#for other options. - -# As of pam 1.0.1-6, this file is managed by pam-auth-update by default. -# To take advantage of this, it is recommended that you configure any -# local modules either before or after the default block, and use -# pam-auth-update to manage selection of other modules. See -# pam-auth-update(8) for details. - -# here are the per-package modules (the "Primary" block) - -password requisite pam_cracklib.so retry=3 maxrepeat=0 minlen=8 ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1 reject_username enforce_for_root - -password required pam_pwhistory.so remember=10 use_authtok enforce_for_root - -password [success=1 default=ignore] pam_unix.so obscure yescrypt -# here's the fallback if no module succeeds -password requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -password required pam_permit.so -# and here are more per-package modules (the "Additional" block) -# end of pam-auth-update config \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_feature/login.defs b/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_feature/login.defs deleted file mode 100644 index 1c8b360a14aa..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/PASSWORD_HARDENING_enable_feature/login.defs +++ /dev/null @@ -1,340 +0,0 @@ -# -# /etc/login.defs - Configuration control definitions for the login package. -# -# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. -# If unspecified, some arbitrary (and possibly incorrect) value will -# be assumed. All other items are optional - if not specified then -# the described action or option will be inhibited. -# -# Comment lines (lines beginning with "#") and blank lines are ignored. -# -# Modified for Linux. --marekm - -# REQUIRED for useradd/userdel/usermod -# Directory where mailboxes reside, _or_ name of file, relative to the -# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, -# MAIL_DIR takes precedence. -# -# Essentially: -# - MAIL_DIR defines the location of users mail spool files -# (for mbox use) by appending the username to MAIL_DIR as defined -# below. -# - MAIL_FILE defines the location of the users mail spool files as the -# fully-qualified filename obtained by prepending the user home -# directory before $MAIL_FILE -# -# NOTE: This is no more used for setting up users MAIL environment variable -# which is, starting from shadow 4.0.12-1 in Debian, entirely the -# job of the pam_mail PAM modules -# See default PAM configuration files provided for -# login, su, etc. -# -# This is a temporary situation: setting these variables will soon -# move to /etc/default/useradd and the variables will then be -# no more supported -MAIL_DIR /var/mail -#MAIL_FILE .mail - -# -# Enable logging and display of /var/log/faillog login failure info. -# This option conflicts with the pam_tally PAM module. -# -FAILLOG_ENAB yes - -# -# Enable display of unknown usernames when login failures are recorded. -# -# WARNING: Unknown usernames may become world readable. -# See #290803 and #298773 for details about how this could become a security -# concern -LOG_UNKFAIL_ENAB no - -# -# Enable logging of successful logins -# -LOG_OK_LOGINS no - -# -# Enable "syslog" logging of su activity - in addition to sulog file logging. -# SYSLOG_SG_ENAB does the same for newgrp and sg. -# -SYSLOG_SU_ENAB yes -SYSLOG_SG_ENAB yes - -# -# If defined, all su activity is logged to this file. -# -#SULOG_FILE /var/log/sulog - -# -# If defined, file which maps tty line to TERM environment parameter. -# Each line of the file is in a format something like "vt100 tty01". -# -#TTYTYPE_FILE /etc/ttytype - -# -# If defined, login failures will be logged here in a utmp format -# last, when invoked as lastb, will read /var/log/btmp, so... -# -FTMP_FILE /var/log/btmp - -# -# If defined, the command name to display when running "su -". For -# example, if this is defined as "su" then a "ps" will display the -# command is "-su". If not defined, then "ps" would display the -# name of the shell actually being run, e.g. something like "-sh". -# -SU_NAME su - -# -# If defined, file which inhibits all the usual chatter during the login -# sequence. If a full pathname, then hushed mode will be enabled if the -# user's name or shell are found in the file. If not a full pathname, then -# hushed mode will be enabled if the file exists in the user's home directory. -# -HUSHLOGIN_FILE .hushlogin -#HUSHLOGIN_FILE /etc/hushlogins - -# -# *REQUIRED* The default PATH settings, for superuser and normal users. -# -# (they are minimal, add the rest in the shell startup files) -ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games - -# -# Terminal permissions -# -# TTYGROUP Login tty will be assigned this group ownership. -# TTYPERM Login tty will be set to this permission. -# -# If you have a "write" program which is "setgid" to a special group -# which owns the terminals, define TTYGROUP to the group number and -# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign -# TTYPERM to either 622 or 600. -# -# In Debian /usr/bin/bsd-write or similar programs are setgid tty -# However, the default and recommended value for TTYPERM is still 0600 -# to not allow anyone to write to anyone else console or terminal - -# Users can still allow other people to write them by issuing -# the "mesg y" command. - -TTYGROUP tty -TTYPERM 0600 - -# -# Login configuration initializations: -# -# ERASECHAR Terminal ERASE character ('\010' = backspace). -# KILLCHAR Terminal KILL character ('\025' = CTRL/U). -# UMASK Default "umask" value. -# -# The ERASECHAR and KILLCHAR are used only on System V machines. -# -# UMASK is the default umask value for pam_umask and is used by -# useradd and newusers to set the mode of the new home directories. -# 022 is the "historical" value in Debian for UMASK -# 027, or even 077, could be considered better for privacy -# There is no One True Answer here : each sysadmin must make up his/her -# mind. -# -# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value -# for private user groups, i. e. the uid is the same as gid, and username is -# the same as the primary group name: for these, the user permissions will be -# used as group permissions, e. g. 022 will become 002. -# -# Prefix these values with "0" to get octal, "0x" to get hexadecimal. -# -ERASECHAR 0177 -KILLCHAR 025 -UMASK 022 - -# -# Password aging controls: -# -# PASS_MAX_DAYS Maximum number of days a password may be used. -# PASS_MIN_DAYS Minimum number of days allowed between password changes. -# PASS_WARN_AGE Number of days warning given before a password expires. -# -PASS_MAX_DAYS 180 -PASS_MIN_DAYS 0 -PASS_WARN_AGE 15 - -# -# Min/max values for automatic uid selection in useradd -# -UID_MIN 1000 -UID_MAX 60000 -# System accounts -#SYS_UID_MIN 100 -#SYS_UID_MAX 999 - -# -# Min/max values for automatic gid selection in groupadd -# -GID_MIN 1000 -GID_MAX 60000 -# System accounts -#SYS_GID_MIN 100 -#SYS_GID_MAX 999 - -# -# Max number of login retries if password is bad. This will most likely be -# overriden by PAM, since the default pam_unix module has it's own built -# in of 3 retries. However, this is a safe fallback in case you are using -# an authentication module that does not enforce PAM_MAXTRIES. -# -LOGIN_RETRIES 5 - -# -# Max time in seconds for login -# -LOGIN_TIMEOUT 60 - -# -# Which fields may be changed by regular users using chfn - use -# any combination of letters "frwh" (full name, room number, work -# phone, home phone). If not defined, no changes are allowed. -# For backward compatibility, "yes" = "rwh" and "no" = "frwh". -# -CHFN_RESTRICT rwh - -# -# Should login be allowed if we can't cd to the home directory? -# Default in no. -# -DEFAULT_HOME yes - -# -# If defined, this command is run when removing a user. -# It should remove any at/cron/print jobs etc. owned by -# the user to be removed (passed as the first argument). -# -#USERDEL_CMD /usr/sbin/userdel_local - -# -# If set to yes, userdel will remove the user's group if it contains no -# more members, and useradd will create by default a group with the name -# of the user. -# -# Other former uses of this variable such as setting the umask when -# user==primary group are not used in PAM environments, such as Debian -# -USERGROUPS_ENAB yes - -# -# Instead of the real user shell, the program specified by this parameter -# will be launched, although its visible name (argv[0]) will be the shell's. -# The program may do whatever it wants (logging, additional authentification, -# banner, ...) before running the actual shell. -# -# FAKE_SHELL /bin/fakeshell - -# -# If defined, either full pathname of a file containing device names or -# a ":" delimited list of device names. Root logins will be allowed only -# upon these devices. -# -# This variable is used by login and su. -# -#CONSOLE /etc/consoles -#CONSOLE console:tty01:tty02:tty03:tty04 - -# -# List of groups to add to the user's supplementary group set -# when logging in on the console (as determined by the CONSOLE -# setting). Default is none. -# -# Use with caution - it is possible for users to gain permanent -# access to these groups, even when not logged in on the console. -# How to do it is left as an exercise for the reader... -# -# This variable is used by login and su. -# -#CONSOLE_GROUPS floppy:audio:cdrom - -# -# If set to "yes", new passwords will be encrypted using the MD5-based -# algorithm compatible with the one used by recent releases of FreeBSD. -# It supports passwords of unlimited length and longer salt strings. -# Set to "no" if you need to copy encrypted passwords to other systems -# which don't understand the new algorithm. Default is "no". -# -# This variable is deprecated. You should use ENCRYPT_METHOD. -# -#MD5_CRYPT_ENAB no - -# -# If set to MD5 , MD5-based algorithm will be used for encrypting password -# If set to SHA256, SHA256-based algorithm will be used for encrypting password -# If set to SHA512, SHA512-based algorithm will be used for encrypting password -# If set to DES, DES-based algorithm will be used for encrypting password (default) -# Overrides the MD5_CRYPT_ENAB option -# -# Note: It is recommended to use a value consistent with -# the PAM modules configuration. -# -ENCRYPT_METHOD SHA512 - -# -# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. -# -# Define the number of SHA rounds. -# With a lot of rounds, it is more difficult to brute forcing the password. -# But note also that it more CPU resources will be needed to authenticate -# users. -# -# If not specified, the libc will choose the default number of rounds (5000). -# The values must be inside the 1000-999999999 range. -# If only one of the MIN or MAX values is set, then this value will be used. -# If MIN > MAX, the highest value will be used. -# -# SHA_CRYPT_MIN_ROUNDS 5000 -# SHA_CRYPT_MAX_ROUNDS 5000 - -################# OBSOLETED BY PAM ############## -# # -# These options are now handled by PAM. Please # -# edit the appropriate file in /etc/pam.d/ to # -# enable the equivelants of them. -# -############### - -#MOTD_FILE -#DIALUPS_CHECK_ENAB -#LASTLOG_ENAB -#MAIL_CHECK_ENAB -#OBSCURE_CHECKS_ENAB -#PORTTIME_CHECKS_ENAB -#SU_WHEEL_ONLY -#CRACKLIB_DICTPATH -#PASS_CHANGE_TRIES -#PASS_ALWAYS_WARN -#ENVIRON_FILE -#NOLOGINS_FILE -#ISSUE_FILE -#PASS_MIN_LEN -#PASS_MAX_LEN -#ULIMIT -#ENV_HZ -#CHFN_AUTH -#CHSH_AUTH -#FAIL_DELAY - -################# OBSOLETED ####################### -# # -# These options are no more handled by shadow. # -# # -# Shadow utilities will display a warning if they # -# still appear. # -# # -################################################### - -# CLOSE_SESSIONS -# LOGIN_STRING -# NO_PASSWORD_CONSOLE -# QMAIL_DIR - - - diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.1_1645.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.1_1645.conf deleted file mode 100644 index ffdda7b401a7..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.1_1645.conf +++ /dev/null @@ -1,2 +0,0 @@ -# server[:port] shared_secret timeout(s) source_ip vrf -[10.10.10.1]:1645 pass1 1 \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.2_1645.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.2_1645.conf deleted file mode 100644 index 3b680807cbcf..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/10.10.10.2_1645.conf +++ /dev/null @@ -1,2 +0,0 @@ -# server[:port] shared_secret timeout(s) source_ip vrf -[10.10.10.2]:1645 pass2 2 \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/common-auth-sonic deleted file mode 100644 index d6b148633eb8..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/common-auth-sonic +++ /dev/null @@ -1,30 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-auth- authentication settings common to all services -# This file is included from other service-specific PAM config files, -# and should contain a list of the authentication modules that define -# the central authentication scheme for use on the system -# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the -# traditional Unix authentication mechanisms. -# -# here are the per-package modules (the "Primary" block) - -# root user can only be authenticated locally. Jump to local. -auth [success=2 default=ignore] pam_succeed_if.so user = root -# For the RADIUS servers, on success jump to the cache the MPL(Privilege) -auth [success=3 new_authtok_reqd=done default=ignore auth_err=die] pam_radius_auth.so conf=/etc/pam_radius_auth.d/10.10.10.1_1645.conf privilege_level protocol=pap retry=1 nas_ip_address=10.10.10.10 debug try_first_pass -auth [success=2 new_authtok_reqd=done default=ignore auth_err=die] pam_radius_auth.so conf=/etc/pam_radius_auth.d/10.10.10.2_1645.conf privilege_level protocol=chap retry=2 nas_ip_address=10.10.10.10 debug try_first_pass -# Local -auth [success=done new_authtok_reqd=done default=ignore auth_err=die maxtries=die] pam_unix.so nullok try_first_pass -auth requisite pam_deny.so -# Cache MPL(Privilege) -auth [success=1 default=ignore] pam_exec.so /usr/sbin/cache_radius - -# -# here's the fallback if no module succeeds -auth requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -auth required pam_permit.so -# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/login b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/login deleted file mode 100644 index 80ba6452813f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/login +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth-sonic - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/login.old deleted file mode 100644 index 07ff95407ccd..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/login.old +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/radius_nss.conf deleted file mode 100644 index 8c31db9fbafe..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/radius_nss.conf +++ /dev/null @@ -1,56 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 -# RADIUS NSS Configuration File -# -# Debug: on|off|trace -# Default: off -# -# debug=on -debug=on - -# -# User Privilege: -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell - -# Eg: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell -# - -# many_to_one: -# y: Map RADIUS users to one local user per privilege. -# n: Create local user account on first successful authentication. -# Default: n -# - -# Eg: -# many_to_one=y -# - -# unconfirmed_disallow: -# y: Do not allow unconfirmed users (users created before authentication) -# n: Allow unconfirmed users. -# Default: n - -# Eg: -# unconfirmed_disallow=y -# - -# unconfirmed_ageout: -# : Wait time before purging unconfirmed users -# Default: 600 -# - -# Eg: -# unconfirmed_ageout=900 -# - -# unconfirmed_regexp: -# : The RE to match the command line of processes for which the -# creation of unconfirmed users are to be allowed. -# Default: (.*: \[priv\])|(.*: \[accepted\]) -# where: is the unconfirmed user. -# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/sshd deleted file mode 100644 index c025af353d6f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/sshd +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth-sonic - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/sshd.old deleted file mode 100644 index d70b384bd9a3..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/sshd.old +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/tacplus_nss.conf deleted file mode 100644 index eac828491ac1..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/tacplus_nss.conf +++ /dev/null @@ -1,40 +0,0 @@ -# Configuration for libnss-tacplus - -# debug - If you want to open debug log, set it on -# Default: off -# debug=on -debug=on - -# local_accounting - If you want to local accounting, set it -# Default: None -# local_accounting - -# tacacs_accounting - If you want to tacacs+ accounting, set it -# Default: None -# tacacs_accounting - -# local_authorization - If you want to local authorization, set it -# Default: None -# local_authorization -local_authorization - -# tacacs_authorization - If you want to tacacs+ authorization, set it -# Default: None -# tacacs_authorization - -# src_ip - set source address of TACACS+ protocol packets -# Default: None (auto source ip address) -# src_ip=2.2.2.2 - -# server - set ip address, tcp port, secret string and timeout for TACACS+ servers -# Default: None (no TACACS+ server) -# server=1.1.1.1:49,secret=test,timeout=3 - -# user_priv - set the map between TACACS+ user privilege and local user's passwd -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash - -# many_to_one - create one local user for many TACACS+ users which has the same privilege -# Default: many_to_one=n -# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/common-auth-sonic deleted file mode 100644 index 87af4cc5c6ac..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/common-auth-sonic +++ /dev/null @@ -1,21 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-auth- authentication settings common to all services -# This file is included from other service-specific PAM config files, -# and should contain a list of the authentication modules that define -# the central authentication scheme for use on the system -# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the -# traditional Unix authentication mechanisms. -# -# here are the per-package modules (the "Primary" block) - -auth [success=1 default=ignore] pam_unix.so nullok try_first_pass - -# -# here's the fallback if no module succeeds -auth requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -auth required pam_permit.so -# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login deleted file mode 100644 index 80ba6452813f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth-sonic - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login.old deleted file mode 100644 index 07ff95407ccd..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login.old +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/radius_nss.conf deleted file mode 100644 index 1567b6e645e0..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/radius_nss.conf +++ /dev/null @@ -1,55 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 -# RADIUS NSS Configuration File -# -# Debug: on|off|trace -# Default: off -# -# debug=on - -# -# User Privilege: -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell - -# Eg: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell -# - -# many_to_one: -# y: Map RADIUS users to one local user per privilege. -# n: Create local user account on first successful authentication. -# Default: n -# - -# Eg: -# many_to_one=y -# - -# unconfirmed_disallow: -# y: Do not allow unconfirmed users (users created before authentication) -# n: Allow unconfirmed users. -# Default: n - -# Eg: -# unconfirmed_disallow=y -# - -# unconfirmed_ageout: -# : Wait time before purging unconfirmed users -# Default: 600 -# - -# Eg: -# unconfirmed_ageout=900 -# - -# unconfirmed_regexp: -# : The RE to match the command line of processes for which the -# creation of unconfirmed users are to be allowed. -# Default: (.*: \[priv\])|(.*: \[accepted\]) -# where: is the unconfirmed user. -# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd deleted file mode 100644 index c025af353d6f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth-sonic - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd.old deleted file mode 100644 index d70b384bd9a3..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd.old +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/tacplus_nss.conf deleted file mode 100644 index bffd6f70391f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/tacplus_nss.conf +++ /dev/null @@ -1,41 +0,0 @@ -# Configuration for libnss-tacplus - -# debug - If you want to open debug log, set it on -# Default: off -# debug=on - -# local_accounting - If you want to local accounting, set it -# Default: None -# local_accounting - -# tacacs_accounting - If you want to tacacs+ accounting, set it -# Default: None -# tacacs_accounting - -# local_authorization - If you want to local authorization, set it -# Default: None -# local_authorization -local_authorization - -# tacacs_authorization - If you want to tacacs+ authorization, set it -# Default: None -# tacacs_authorization - -# src_ip - set source address of TACACS+ protocol packets -# Default: None (auto source ip address) -# src_ip=2.2.2.2 - -# server - set ip address, tcp port, secret string and timeout for TACACS+ servers -# Default: None (no TACACS+ server) -# server=1.1.1.1:49,secret=test,timeout=3 -server=192.168.1.1:50,secret=dellsonic,timeout=10,vrf=default -server=192.168.1.2:51,secret=dellsonic1,timeout=15,vrf=mgmt - -# user_priv - set the map between TACACS+ user privilege and local user's passwd -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash - -# many_to_one - create one local user for many TACACS+ users which has the same privilege -# Default: many_to_one=n -# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/common-auth-sonic deleted file mode 100644 index 87af4cc5c6ac..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/common-auth-sonic +++ /dev/null @@ -1,21 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-auth- authentication settings common to all services -# This file is included from other service-specific PAM config files, -# and should contain a list of the authentication modules that define -# the central authentication scheme for use on the system -# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the -# traditional Unix authentication mechanisms. -# -# here are the per-package modules (the "Primary" block) - -auth [success=1 default=ignore] pam_unix.so nullok try_first_pass - -# -# here's the fallback if no module succeeds -auth requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -auth required pam_permit.so -# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login deleted file mode 100644 index 80ba6452813f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth-sonic - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login.old deleted file mode 100644 index 07ff95407ccd..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login.old +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/radius_nss.conf deleted file mode 100644 index 1567b6e645e0..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/radius_nss.conf +++ /dev/null @@ -1,55 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 -# RADIUS NSS Configuration File -# -# Debug: on|off|trace -# Default: off -# -# debug=on - -# -# User Privilege: -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell - -# Eg: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell -# - -# many_to_one: -# y: Map RADIUS users to one local user per privilege. -# n: Create local user account on first successful authentication. -# Default: n -# - -# Eg: -# many_to_one=y -# - -# unconfirmed_disallow: -# y: Do not allow unconfirmed users (users created before authentication) -# n: Allow unconfirmed users. -# Default: n - -# Eg: -# unconfirmed_disallow=y -# - -# unconfirmed_ageout: -# : Wait time before purging unconfirmed users -# Default: 600 -# - -# Eg: -# unconfirmed_ageout=900 -# - -# unconfirmed_regexp: -# : The RE to match the command line of processes for which the -# creation of unconfirmed users are to be allowed. -# Default: (.*: \[priv\])|(.*: \[accepted\]) -# where: is the unconfirmed user. -# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd deleted file mode 100644 index c025af353d6f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth-sonic - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd.old deleted file mode 100644 index d70b384bd9a3..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd.old +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/tacplus_nss.conf deleted file mode 100644 index d24cab57d1f4..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/tacplus_nss.conf +++ /dev/null @@ -1,42 +0,0 @@ -# Configuration for libnss-tacplus - -# debug - If you want to open debug log, set it on -# Default: off -# debug=on - -# local_accounting - If you want to local accounting, set it -# Default: None -# local_accounting -local_accounting - -# tacacs_accounting - If you want to tacacs+ accounting, set it -# Default: None -# tacacs_accounting - -# local_authorization - If you want to local authorization, set it -# Default: None -# local_authorization -local_authorization - -# tacacs_authorization - If you want to tacacs+ authorization, set it -# Default: None -# tacacs_authorization - -# src_ip - set source address of TACACS+ protocol packets -# Default: None (auto source ip address) -# src_ip=2.2.2.2 - -# server - set ip address, tcp port, secret string and timeout for TACACS+ servers -# Default: None (no TACACS+ server) -# server=1.1.1.1:49,secret=test,timeout=3 -server=192.168.1.1:50,secret=dellsonic,timeout=10,vrf=default -server=192.168.1.2:51,secret=dellsonic1,timeout=15,vrf=mgmt - -# user_priv - set the map between TACACS+ user privilege and local user's passwd -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash - -# many_to_one - create one local user for many TACACS+ users which has the same privilege -# Default: many_to_one=n -# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/common-auth-sonic deleted file mode 100644 index 87af4cc5c6ac..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/common-auth-sonic +++ /dev/null @@ -1,21 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-auth- authentication settings common to all services -# This file is included from other service-specific PAM config files, -# and should contain a list of the authentication modules that define -# the central authentication scheme for use on the system -# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the -# traditional Unix authentication mechanisms. -# -# here are the per-package modules (the "Primary" block) - -auth [success=1 default=ignore] pam_unix.so nullok try_first_pass - -# -# here's the fallback if no module succeeds -auth requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -auth required pam_permit.so -# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login deleted file mode 100644 index 80ba6452813f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth-sonic - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login.old deleted file mode 100644 index 07ff95407ccd..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login.old +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/radius_nss.conf deleted file mode 100644 index 1567b6e645e0..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/radius_nss.conf +++ /dev/null @@ -1,55 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 -# RADIUS NSS Configuration File -# -# Debug: on|off|trace -# Default: off -# -# debug=on - -# -# User Privilege: -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell - -# Eg: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell -# - -# many_to_one: -# y: Map RADIUS users to one local user per privilege. -# n: Create local user account on first successful authentication. -# Default: n -# - -# Eg: -# many_to_one=y -# - -# unconfirmed_disallow: -# y: Do not allow unconfirmed users (users created before authentication) -# n: Allow unconfirmed users. -# Default: n - -# Eg: -# unconfirmed_disallow=y -# - -# unconfirmed_ageout: -# : Wait time before purging unconfirmed users -# Default: 600 -# - -# Eg: -# unconfirmed_ageout=900 -# - -# unconfirmed_regexp: -# : The RE to match the command line of processes for which the -# creation of unconfirmed users are to be allowed. -# Default: (.*: \[priv\])|(.*: \[accepted\]) -# where: is the unconfirmed user. -# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd deleted file mode 100644 index c025af353d6f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth-sonic - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd.old deleted file mode 100644 index d70b384bd9a3..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd.old +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/tacplus_nss.conf deleted file mode 100644 index 431cbcec0aca..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/tacplus_nss.conf +++ /dev/null @@ -1,44 +0,0 @@ -# Configuration for libnss-tacplus - -# debug - If you want to open debug log, set it on -# Default: off -# debug=on - -# local_accounting - If you want to local accounting, set it -# Default: None -# local_accounting -local_accounting - -# tacacs_accounting - If you want to tacacs+ accounting, set it -# Default: None -# tacacs_accounting -tacacs_accounting - -# local_authorization - If you want to local authorization, set it -# Default: None -# local_authorization -local_authorization - -# tacacs_authorization - If you want to tacacs+ authorization, set it -# Default: None -# tacacs_authorization -tacacs_authorization - -# src_ip - set source address of TACACS+ protocol packets -# Default: None (auto source ip address) -# src_ip=2.2.2.2 - -# server - set ip address, tcp port, secret string and timeout for TACACS+ servers -# Default: None (no TACACS+ server) -# server=1.1.1.1:49,secret=test,timeout=3 -server=192.168.1.1:50,secret=dellsonic,timeout=10,vrf=default -server=192.168.1.2:51,secret=dellsonic1,timeout=15,vrf=mgmt - -# user_priv - set the map between TACACS+ user privilege and local user's passwd -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash - -# many_to_one - create one local user for many TACACS+ users which has the same privilege -# Default: many_to_one=n -# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/common-auth-sonic deleted file mode 100644 index 87af4cc5c6ac..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/common-auth-sonic +++ /dev/null @@ -1,21 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# -# /etc/pam.d/common-auth- authentication settings common to all services -# This file is included from other service-specific PAM config files, -# and should contain a list of the authentication modules that define -# the central authentication scheme for use on the system -# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the -# traditional Unix authentication mechanisms. -# -# here are the per-package modules (the "Primary" block) - -auth [success=1 default=ignore] pam_unix.so nullok try_first_pass - -# -# here's the fallback if no module succeeds -auth requisite pam_deny.so -# prime the stack with a positive return value if there isn't one already; -# this avoids us returning an error just because nothing sets a success code -# since the modules above will each just jump around -auth required pam_permit.so -# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login deleted file mode 100644 index 80ba6452813f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth-sonic - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login.old deleted file mode 100644 index 07ff95407ccd..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login.old +++ /dev/null @@ -1,116 +0,0 @@ -# -# The PAM configuration file for the Shadow `login' service -# - -# Enforce a minimal delay in case of failure (in microseconds). -# (Replaces the `FAIL_DELAY' setting from login.defs) -# Note that other modules may require another minimal delay. (for example, -# to disable any delay, you should add the nodelay option to pam_unix) -auth optional pam_faildelay.so delay=3000000 - -# Outputs an issue file prior to each login prompt (Replaces the -# ISSUE_FILE option from login.defs). Uncomment for use -# auth required pam_issue.so issue=/etc/issue - -# Disallows root logins except on tty's listed in /etc/securetty -# (Replaces the `CONSOLE' setting from login.defs) -# -# With the default control of this module: -# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] -# root will not be prompted for a password on insecure lines. -# if an invalid username is entered, a password is prompted (but login -# will eventually be rejected) -# -# You can change it to a "requisite" module if you think root may mis-type -# her login and should not be prompted for a password in that case. But -# this will leave the system as vulnerable to user enumeration attacks. -# -# You can change it to a "required" module if you think it permits to -# guess valid user names of your system (invalid user names are considered -# as possibly being root on insecure lines), but root passwords may be -# communicated over insecure lines. -auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so - -# Disallows other than root logins when /etc/nologin exists -# (Replaces the `NOLOGINS_FILE' option from login.defs) -auth requisite pam_nologin.so - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible -# that a module could execute code in the wrong domain. -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Sets the loginuid process attribute -session required pam_loginuid.so - -# SELinux needs to intervene at login time to ensure that the process -# starts in the proper default security context. Only sessions which are -# intended to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open -# When the module is present, "required" would be sufficient (When SELinux -# is disabled, this returns success.) - -# This module parses environment configuration file(s) -# and also allows you to use an extended config -# file /etc/security/pam_env.conf. -# -# parsing /etc/environment needs "readenv=1" -session required pam_env.so readenv=1 -# locale variables are also kept into /etc/default/locale in etch -# reading this file *in addition to /etc/environment* does not hurt -session required pam_env.so readenv=1 envfile=/etc/default/locale - -# Standard Un*x authentication. -@include common-auth - -# This allows certain extra groups to be granted to a user -# based on things like time of day, tty, service, and user. -# Please edit /etc/security/group.conf to fit your needs -# (Replaces the `CONSOLE_GROUPS' option in login.defs) -auth optional pam_group.so - -# Uncomment and edit /etc/security/time.conf if you need to set -# time restraint on logins. -# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs -# as well as /etc/porttime) -# account requisite pam_time.so - -# Uncomment and edit /etc/security/access.conf if you need to -# set access limits. -# (Replaces /etc/login.access file) -# account required pam_access.so - -# Sets up user limits according to /etc/security/limits.conf -# (Replaces the use of /etc/limits in old login) -session required pam_limits.so - -# Prints the last login info upon successful login -# (Replaces the `LASTLOG_ENAB' option from login.defs) -session optional pam_lastlog.so - -# Prints the message of the day upon successful login. -# (Replaces the `MOTD_FILE' option in login.defs) -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Prints the status of the user's mailbox upon successful login -# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). -# -# This also defines the MAIL environment variable -# However, userdel also needs MAIL_DIR and MAIL_FILE variables -# in /etc/login.defs to make sure that removing a user -# also removes the user's mail spool file. -# See comments in /etc/login.defs -session optional pam_mail.so standard - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x account and session -@include common-account -@include common-session -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/radius_nss.conf deleted file mode 100644 index 1567b6e645e0..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/radius_nss.conf +++ /dev/null @@ -1,55 +0,0 @@ -#THIS IS AN AUTO-GENERATED FILE -# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 -# RADIUS NSS Configuration File -# -# Debug: on|off|trace -# Default: off -# -# debug=on - -# -# User Privilege: -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell - -# Eg: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell -# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell -# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell -# - -# many_to_one: -# y: Map RADIUS users to one local user per privilege. -# n: Create local user account on first successful authentication. -# Default: n -# - -# Eg: -# many_to_one=y -# - -# unconfirmed_disallow: -# y: Do not allow unconfirmed users (users created before authentication) -# n: Allow unconfirmed users. -# Default: n - -# Eg: -# unconfirmed_disallow=y -# - -# unconfirmed_ageout: -# : Wait time before purging unconfirmed users -# Default: 600 -# - -# Eg: -# unconfirmed_ageout=900 -# - -# unconfirmed_regexp: -# : The RE to match the command line of processes for which the -# creation of unconfirmed users are to be allowed. -# Default: (.*: \[priv\])|(.*: \[accepted\]) -# where: is the unconfirmed user. -# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd deleted file mode 100644 index c025af353d6f..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth-sonic - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd.old deleted file mode 100644 index d70b384bd9a3..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd.old +++ /dev/null @@ -1,55 +0,0 @@ -# PAM configuration for the Secure Shell service - -# Standard Un*x authentication. -@include common-auth - -# Disallow non-root logins when /etc/nologin exists. -account required pam_nologin.so - -# Uncomment and edit /etc/security/access.conf if you need to set complex -# access limits that are hard to express in sshd_config. -# account required pam_access.so - -# Standard Un*x authorization. -@include common-account - -# SELinux needs to be the first session rule. This ensures that any -# lingering context has been cleared. Without this it is possible that a -# module could execute code in the wrong domain. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close - -# Set the loginuid process attribute. -session required pam_loginuid.so - -# Create a new session keyring. -session optional pam_keyinit.so force revoke - -# Standard Un*x session setup and teardown. -@include common-session - -# Print the message of the day upon successful login. -# This includes a dynamically generated part from /run/motd.dynamic -# and a static (admin-editable) part from /etc/motd. -session optional pam_motd.so motd=/run/motd.dynamic -session optional pam_motd.so noupdate - -# Print the status of the user's mailbox upon successful login. -session optional pam_mail.so standard noenv # [1] - -# Set up user limits from /etc/security/limits.conf. -session required pam_limits.so - -# Read environment variables from /etc/environment and -# /etc/security/pam_env.conf. -session required pam_env.so # [1] -# In Debian 4.0 (etch), locale-related environment variables were moved to -# /etc/default/locale, so read that as well. -session required pam_env.so user_readenv=1 envfile=/etc/default/locale - -# SELinux needs to intervene at login time to ensure that the process starts -# in the proper default security context. Only sessions which are intended -# to run in the user's context should be run after this. -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open - -# Standard Un*x password updating. -@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/tacplus_nss.conf deleted file mode 100644 index c9b8ab2944cc..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/tacplus_nss.conf +++ /dev/null @@ -1,42 +0,0 @@ -# Configuration for libnss-tacplus - -# debug - If you want to open debug log, set it on -# Default: off -# debug=on - -# local_accounting - If you want to local accounting, set it -# Default: None -# local_accounting - -# tacacs_accounting - If you want to tacacs+ accounting, set it -# Default: None -# tacacs_accounting -tacacs_accounting - -# local_authorization - If you want to local authorization, set it -# Default: None -# local_authorization - -# tacacs_authorization - If you want to tacacs+ authorization, set it -# Default: None -# tacacs_authorization -tacacs_authorization - -# src_ip - set source address of TACACS+ protocol packets -# Default: None (auto source ip address) -# src_ip=2.2.2.2 - -# server - set ip address, tcp port, secret string and timeout for TACACS+ servers -# Default: None (no TACACS+ server) -# server=1.1.1.1:49,secret=test,timeout=3 -server=192.168.1.1:50,secret=dellsonic,timeout=10,vrf=default -server=192.168.1.2:51,secret=dellsonic1,timeout=15,vrf=mgmt - -# user_priv - set the map between TACACS+ user privilege and local user's passwd -# Default: -# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash -# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash - -# many_to_one - create one local user for many TACACS+ users which has the same privilege -# Default: many_to_one=n -# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/test_passwh_vectors.py b/src/sonic-host-services/tests/hostcfgd/test_passwh_vectors.py deleted file mode 100644 index acf1c7671125..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/test_passwh_vectors.py +++ /dev/null @@ -1,244 +0,0 @@ -""" - hostcfgd test password hardening vector -""" -HOSTCFGD_TEST_PASSWH_VECTOR = [ - [ - "PASSWORD_HARDENING", - { - "default_values":{ - "PASSW_HARDENING": { - "POLICIES":{ - "state": "disabled", - "expiration": "180", - "expiration_warning": "15", - "history_cnt": "10", - "len_min": "8", - "reject_user_passw_match": "True", - "lower_class": "True", - "upper_class": "True", - "digits_class": "True", - "special_class": "True" - } - }, - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - } - }, - "enable_feature":{ - "PASSW_HARDENING": { - "POLICIES":{ - "state": "enabled", - "expiration": "180", - "expiration_warning": "15", - "history_cnt": "10", - "len_min": "8", - "reject_user_passw_match": "True", - "lower_class": "True", - "upper_class": "True", - "digits_class": "True", - "special_class": "True" - } - }, - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - } - }, - "enable_digits_class":{ - "PASSW_HARDENING": { - "POLICIES":{ - "state": "enabled", - "expiration": "0", - "expiration_warning": "0", - "history_cnt": "0", - "len_min": "8", - "reject_user_passw_match": "False", - "lower_class": "False", - "upper_class": "False", - "digits_class": "True", - "special_class": "False" - } - }, - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - } - }, - "enable_lower_class":{ - "PASSW_HARDENING": { - "POLICIES":{ - "state": "enabled", - "expiration": "0", - "expiration_warning": "0", - "history_cnt": "0", - "len_min": "8", - "reject_user_passw_match": "False", - "lower_class": "True", - "upper_class": "False", - "digits_class": "False", - "special_class": "False" - } - }, - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - }, - "enable_upper_class":{ - "PASSW_HARDENING": { - "POLICIES":{ - "state": "enabled", - "expiration": "0", - "expiration_warning": "0", - "history_cnt": "0", - "len_min": "8", - "reject_user_passw_match": "False", - "lower_class": "False", - "upper_class": "True", - "digits_class": "False", - "special_class": "False" - } - }, - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - } - }, - "enable_special_class":{ - "PASSW_HARDENING": { - "POLICIES":{ - "state": "enabled", - "expiration": "0", - "expiration_warning": "0", - "history_cnt": "0", - "len_min": "8", - "reject_user_passw_match": "False", - "lower_class": "False", - "upper_class": "False", - "digits_class": "False", - "special_class": "True" - } - }, - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - } - } - } - ] -] diff --git a/src/sonic-host-services/tests/hostcfgd/test_radius_vectors.py b/src/sonic-host-services/tests/hostcfgd/test_radius_vectors.py deleted file mode 100644 index df10499e1a23..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/test_radius_vectors.py +++ /dev/null @@ -1,181 +0,0 @@ -from unittest.mock import call - -""" - hostcfgd test radius vector -""" -HOSTCFGD_TEST_RADIUS_VECTOR = [ - [ - "RADIUS", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "AAA": { - "authentication": { - "login": "radius,local", - "debug": "True", - } - }, - "RADIUS": { - "global": { - "nas_ip": "10.10.10.10", - "auth_port": "1645", - "auth_type": "mschapv2", - "retransmit": "2", - "timeout": "3", - "passkey": "pass", - } - }, - "RADIUS_SERVER": { - "10.10.10.1": { - "auth_type": "pap", - "retransmit": "1", - "timeout": "1", - "passkey": "pass1", - }, - "10.10.10.2": { - "auth_type": "chap", - "retransmit": "2", - "timeout": "2", - "passkey": "pass2", - } - }, - }, - "expected_config_db": { - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "AAA": { - "authentication": { - "login": "radius,local", - "debug": "True", - } - }, - "RADIUS": { - "global": { - "nas_ip": "10.10.10.10", - "auth_port": "1645", - "auth_type": "mschapv2", - "retransmit": "2", - "timeout": "3", - "passkey": "pass", - } - }, - "RADIUS_SERVER": { - "10.10.10.1": { - "auth_type": "pap", - "retransmit": "1", - "timeout": "1", - "passkey": "pass1", - }, - "10.10.10.2": { - "auth_type": "chap", - "retransmit": "2", - "timeout": "2", - "passkey": "pass2", - } - }, - }, - "expected_subprocess_calls": [ - call("service aaastatsd start", shell=True), - ], - } - ], - [ - "LOCAL", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "hostname": "local", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "AAA": { - "authentication": { - "login": "local", - "debug": "True", - } - }, - }, - "expected_config_db": { - "DEVICE_METADATA": { - "localhost": { - "hostname": "local", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "AAA": { - "authentication": { - "login": "local", - "debug": "True", - } - }, - }, - "expected_subprocess_calls": [ - call("service aaastatsd start", shell=True), - ], - }, - ], -] diff --git a/src/sonic-host-services/tests/hostcfgd/test_tacacs_vectors.py b/src/sonic-host-services/tests/hostcfgd/test_tacacs_vectors.py deleted file mode 100644 index 38d0012fa854..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/test_tacacs_vectors.py +++ /dev/null @@ -1,260 +0,0 @@ -from unittest.mock import call - -""" - hostcfgd test tacacs vector -""" -HOSTCFGD_TEST_TACACS_VECTOR = [ - [ - "TACACS", - { - "config_db_local": { - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "AAA": { - "authentication": { - "login": "local" - }, - "authorization": { - "login": "local" - }, - "accounting": { - "login": "local" - } - }, - "TACPLUS": { - "global": { - "auth_type": "chap", - "timeout": 5, - "passkey": "dellsonic", - "src_intf": "Ethernet0" - } - }, - "TACPLUS_SERVER": { - "192.168.1.1" : { - "priority": 5, - "tcp_port": 50, - "timeout": 10, - "auth_type": "chap", - "passkey": "dellsonic", - "vrf": "default" - }, - "192.168.1.2" : { - "priority": 2, - "tcp_port": 51, - "timeout": 15, - "auth_type": "pap", - "passkey": "dellsonic1", - "vrf": "mgmt" - } - }, - }, - "config_db_tacacs": { - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "AAA": { - "authentication": { - "login": "local" - }, - "authorization": { - "login": "tacacs+" - }, - "accounting": { - "login": "tacacs+" - } - }, - "TACPLUS": { - "global": { - "auth_type": "chap", - "timeout": 5, - "passkey": "dellsonic", - "src_intf": "Ethernet0" - } - }, - "TACPLUS_SERVER": { - "192.168.1.1" : { - "priority": 5, - "tcp_port": 50, - "timeout": 10, - "auth_type": "chap", - "passkey": "dellsonic", - "vrf": "default" - }, - "192.168.1.2" : { - "priority": 2, - "tcp_port": 51, - "timeout": 15, - "auth_type": "pap", - "passkey": "dellsonic1", - "vrf": "mgmt" - } - }, - }, - "config_db_local_and_tacacs": { - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "AAA": { - "authentication": { - "login": "local" - }, - "authorization": { - "login": "tacacs+ local" - }, - "accounting": { - "login": "tacacs+ local" - } - }, - "TACPLUS": { - "global": { - "auth_type": "chap", - "timeout": 5, - "passkey": "dellsonic", - "src_intf": "Ethernet0" - } - }, - "TACPLUS_SERVER": { - "192.168.1.1" : { - "priority": 5, - "tcp_port": 50, - "timeout": 10, - "auth_type": "chap", - "passkey": "dellsonic", - "vrf": "default" - }, - "192.168.1.2" : { - "priority": 2, - "tcp_port": 51, - "timeout": 15, - "auth_type": "pap", - "passkey": "dellsonic1", - "vrf": "mgmt" - } - }, - }, - "config_db_disable_accounting": { - "DEVICE_METADATA": { - "localhost": { - "hostname": "radius", - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "AAA": { - "authentication": { - "login": "local" - }, - "authorization": { - "login": "local" - }, - "accounting": { - "login": "disable" - } - }, - "TACPLUS": { - "global": { - "auth_type": "chap", - "timeout": 5, - "passkey": "dellsonic", - "src_intf": "Ethernet0" - } - }, - "TACPLUS_SERVER": { - "192.168.1.1" : { - "priority": 5, - "tcp_port": 50, - "timeout": 10, - "auth_type": "chap", - "passkey": "dellsonic", - "vrf": "default" - }, - "192.168.1.2" : { - "priority": 2, - "tcp_port": 51, - "timeout": 15, - "auth_type": "pap", - "passkey": "dellsonic1", - "vrf": "mgmt" - } - }, - } - } - ] -] diff --git a/src/sonic-host-services/tests/hostcfgd/test_vectors.py b/src/sonic-host-services/tests/hostcfgd/test_vectors.py deleted file mode 100644 index 43754252c0e3..000000000000 --- a/src/sonic-host-services/tests/hostcfgd/test_vectors.py +++ /dev/null @@ -1,567 +0,0 @@ -from unittest.mock import call - -""" - hostcfgd test vector -""" -HOSTCFGD_TEST_VECTOR = [ - [ - "DualTorCase", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "{% 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 %}" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - }, - "expected_config_db": { - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "enabled" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - }, - "enable_feature_subprocess_calls": [ - call("sudo systemctl unmask dhcp_relay.service", shell=True), - call("sudo systemctl enable dhcp_relay.service", shell=True), - call("sudo systemctl start dhcp_relay.service", shell=True), - call("sudo systemctl unmask mux.service", shell=True), - call("sudo systemctl enable mux.service", shell=True), - call("sudo systemctl start mux.service", shell=True), - call("sudo systemctl unmask telemetry.service", shell=True), - call("sudo systemctl unmask telemetry.timer", shell=True), - call("sudo systemctl enable telemetry.timer", shell=True), - call("sudo systemctl start telemetry.timer", shell=True), - ], - "daemon_reload_subprocess_call": [ - call("sudo systemctl daemon-reload", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error') - }, - }, - ], - [ - "SingleToRCase", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "type": "ToR", - } - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "{% 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 %}" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - "sflow": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "always_enabled" - }, - }, - }, - "expected_config_db": { - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "disabled" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "always_disabled" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - "sflow": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "always_enabled" - }, - }, - }, - "enable_feature_subprocess_calls": [ - call("sudo systemctl stop mux.service", shell=True), - call("sudo systemctl disable mux.service", shell=True), - call("sudo systemctl mask mux.service", shell=True), - call("sudo systemctl unmask telemetry.service", shell=True), - call("sudo systemctl unmask telemetry.timer", shell=True), - call("sudo systemctl enable telemetry.timer", shell=True), - call("sudo systemctl start telemetry.timer", shell=True), - call("sudo systemctl unmask sflow.service", shell=True), - call("sudo systemctl enable sflow.service", shell=True), - call("sudo systemctl start sflow.service", shell=True), - ], - "daemon_reload_subprocess_call": [ - call("sudo systemctl daemon-reload", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error') - }, - }, - ], - [ - "T1Case", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "type": "T1", - } - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "{% 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 %}" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - }, - "expected_config_db": { - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "disabled" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "always_disabled" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - }, - "enable_feature_subprocess_calls": [ - call("sudo systemctl stop mux.service", shell=True), - call("sudo systemctl disable mux.service", shell=True), - call("sudo systemctl mask mux.service", shell=True), - call("sudo systemctl unmask telemetry.service", shell=True), - call("sudo systemctl unmask telemetry.timer", shell=True), - call("sudo systemctl enable telemetry.timer", shell=True), - call("sudo systemctl start telemetry.timer", shell=True), - ], - "daemon_reload_subprocess_call": [ - call("sudo systemctl daemon-reload", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error') - }, - }, - ], - [ - "SingleToRCase_DHCP_Relay_Enabled", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "type": "ToR", - } - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - }, - "expected_config_db": { - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "always_disabled" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - }, - "enable_feature_subprocess_calls": [ - call("sudo systemctl unmask dhcp_relay.service", shell=True), - call("sudo systemctl enable dhcp_relay.service", shell=True), - call("sudo systemctl start dhcp_relay.service", shell=True), - call("sudo systemctl stop mux.service", shell=True), - call("sudo systemctl disable mux.service", shell=True), - call("sudo systemctl mask mux.service", shell=True), - call("sudo systemctl unmask telemetry.service", shell=True), - call("sudo systemctl unmask telemetry.timer", shell=True), - call("sudo systemctl enable telemetry.timer", shell=True), - call("sudo systemctl start telemetry.timer", shell=True), - ], - "daemon_reload_subprocess_call": [ - call("sudo systemctl daemon-reload", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('output', 'error') - }, - }, - ], - [ - "DualTorCaseWithNoSystemCalls", - { - "config_db": { - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - }, - "KDUMP": { - "config": { - "enabled": "false", - "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } - }, - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "{% 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 %}" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - }, - "expected_config_db": { - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "enabled" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - }, - "enable_feature_subprocess_calls": [], - "daemon_reload_subprocess_call": [ - call("sudo systemctl daemon-reload", shell=True), - ], - "popen_attributes": { - 'communicate.return_value': ('enabled', 'error') - }, - } - ] -] - -HOSTCFG_DAEMON_CFG_DB = { - "FEATURE": { - "dhcp_relay": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "{% 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 %}" - }, - "mux": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "False", - "high_mem_alert": "disabled", - "set_owner": "local", - "state": "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}" - }, - "telemetry": { - "auto_restart": "enabled", - "has_global_scope": "True", - "has_per_asic_scope": "False", - "has_timer": "True", - "high_mem_alert": "disabled", - "set_owner": "kube", - "state": "enabled", - "status": "enabled" - }, - }, - "KDUMP": { - "config": { - - } - }, - "NTP": { - "global": { - "vrf": "default", - "src_intf": "eth0;Loopback0" - } - }, - "NTP_SERVER": { - "0.debian.pool.ntp.org": {} - }, - "LOOPBACK_INTERFACE": { - "Loopback0|10.184.8.233/32": { - "scope": "global", - "family": "IPv4" - } - }, - "DEVICE_METADATA": { - "localhost": { - "subtype": "DualToR", - "type": "ToRRouter", - } - } -} diff --git a/src/sonic-host-services/tests/mock_connector.py b/src/sonic-host-services/tests/mock_connector.py deleted file mode 100644 index d32017ff8485..000000000000 --- a/src/sonic-host-services/tests/mock_connector.py +++ /dev/null @@ -1,24 +0,0 @@ -class MockConnector(object): - STATE_DB = None - data = {} - - def __init__(self, host): - pass - - def connect(self, db_id): - pass - - def get(self, db_id, key, field): - return MockConnector.data[key][field] - - def keys(self, db_id, pattern): - match = pattern.split('*')[0] - ret = [] - for key in MockConnector.data.keys(): - if match in key: - ret.append(key) - - return ret - - def get_all(self, db_id, key): - return MockConnector.data[key] diff --git a/src/sonic-host-services/tests/procdockerstatsd_test.py b/src/sonic-host-services/tests/procdockerstatsd_test.py deleted file mode 100644 index 4db198be7d75..000000000000 --- a/src/sonic-host-services/tests/procdockerstatsd_test.py +++ /dev/null @@ -1,43 +0,0 @@ -import sys -import os -import pytest - -from swsscommon import swsscommon -from sonic_py_common.general import load_module_from_source - -from .mock_connector import MockConnector - -swsscommon.SonicV2Connector = MockConnector - -test_path = os.path.dirname(os.path.abspath(__file__)) -modules_path = os.path.dirname(test_path) -scripts_path = os.path.join(modules_path, "scripts") -sys.path.insert(0, modules_path) - -# Load the file under test -procdockerstatsd_path = os.path.join(scripts_path, 'procdockerstatsd') -procdockerstatsd = load_module_from_source('procdockerstatsd', procdockerstatsd_path) - -class TestProcDockerStatsDaemon(object): - def test_convert_to_bytes(self): - test_data = [ - ('1B', 1), - ('500B', 500), - ('1KB', 1000), - ('500KB', 500000), - ('1MB', 1000000), - ('500MB', 500000000), - ('1MiB', 1048576), - ('500MiB', 524288000), - ('66.41MiB', 69635932), - ('333.6MiB', 349804954), - ('1GiB', 1073741824), - ('500GiB', 536870912000), - ('7.751GiB', 8322572878) - ] - - pdstatsd = procdockerstatsd.ProcDockerStats(procdockerstatsd.SYSLOG_IDENTIFIER) - - for test_input, expected_output in test_data: - res = pdstatsd.convert_to_bytes(test_input) - assert res == expected_output diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 0d45adb62f48..912797e2cabc 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 0d45adb62f48637a575e09da7c61c58a7020e40e +Subproject commit 912797e2cabcd25a9a469827eb35807031ae13b5 diff --git a/src/sonic-py-common/sonic_py_common/port_util.py b/src/sonic-py-common/sonic_py_common/port_util.py new file mode 100644 index 000000000000..cb79be2742c4 --- /dev/null +++ b/src/sonic-py-common/sonic_py_common/port_util.py @@ -0,0 +1,196 @@ +""" +Bridge/Port mapping utility library. +""" +from swsscommon import swsscommon +import re + + +SONIC_ETHERNET_RE_PATTERN = "^Ethernet(\d+)$" +""" +Ethernet-BP refers to BackPlane interfaces +in multi-asic platform. +""" +SONIC_ETHERNET_BP_RE_PATTERN = "^Ethernet-BP(\d+)$" +SONIC_VLAN_RE_PATTERN = "^Vlan(\d+)$" +SONIC_PORTCHANNEL_RE_PATTERN = "^PortChannel(\d+)$" +SONIC_MGMT_PORT_RE_PATTERN = "^eth(\d+)$" +SONIC_ETHERNET_IB_RE_PATTERN = "^Ethernet-IB(\d+)$" +SONIC_ETHERNET_REC_RE_PATTERN = "^Ethernet-Rec(\d+)$" + +class BaseIdx: + ethernet_base_idx = 1 + vlan_interface_base_idx = 2000 + ethernet_bp_base_idx = 9000 + portchannel_base_idx = 1000 + mgmt_port_base_idx = 10000 + ethernet_ib_base_idx = 11000 + ethernet_rec_base_idx = 12000 + +def get_index(if_name): + """ + OIDs are 1-based, interfaces are 0-based, return the 1-based index + Ethernet N = N + 1 + Vlan N = N + 2000 + Ethernet_BP N = N + 9000 + PortChannel N = N + 1000 + eth N = N + 10000 + Ethernet_IB N = N + 11000 + Ethernet_Rec N = N + 12000 + """ + return get_index_from_str(if_name.decode()) + + +def get_index_from_str(if_name): + """ + OIDs are 1-based, interfaces are 0-based, return the 1-based index + Ethernet N = N + 1 + Vlan N = N + 2000 + Ethernet_BP N = N + 9000 + PortChannel N = N + 1000 + eth N = N + 10000 + Ethernet_IB N = N + 11000 + Ethernet_Rec N = N + 12000 + """ + patterns = { + SONIC_ETHERNET_RE_PATTERN: BaseIdx.ethernet_base_idx, + SONIC_ETHERNET_BP_RE_PATTERN: BaseIdx.ethernet_bp_base_idx, + SONIC_VLAN_RE_PATTERN: BaseIdx.vlan_interface_base_idx, + SONIC_PORTCHANNEL_RE_PATTERN: BaseIdx.portchannel_base_idx, + SONIC_MGMT_PORT_RE_PATTERN: BaseIdx.mgmt_port_base_idx, + SONIC_ETHERNET_IB_RE_PATTERN: BaseIdx.ethernet_ib_base_idx, + SONIC_ETHERNET_REC_RE_PATTERN: BaseIdx.ethernet_rec_base_idx + } + + for pattern, baseidx in patterns.items(): + match = re.match(pattern, if_name) + if match: + return int(match.group(1)) + baseidx + +def get_interface_oid_map(db, blocking=True): + """ + Get the Interface names from Counters DB + """ + db.connect('COUNTERS_DB') + if_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_PORT_NAME_MAP', blocking=blocking) + if_lag_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_LAG_NAME_MAP', blocking=blocking) + if_name_map.update(if_lag_name_map) + + if not if_name_map: + return {}, {} + + oid_pfx = len("oid:0x") + if_name_map = {if_name: sai_oid[oid_pfx:] for if_name, sai_oid in if_name_map.items()} + + # TODO: remove the first branch after all SonicV2Connector are migrated to decode_responses + if isinstance(db, swsscommon.SonicV2Connector) == False and db.dbintf.redis_kwargs.get('decode_responses', False) == False: + get_index_func = get_index + else: + get_index_func = get_index_from_str + + if_id_map = {sai_oid: if_name for if_name, sai_oid in if_name_map.items() + # only map the interface if it's a style understood to be a SONiC interface. + if get_index_func(if_name) is not None} + + return if_name_map, if_id_map + +def get_bridge_port_map(db): + """ + Get the Bridge port mapping from ASIC DB + """ + db.connect('ASIC_DB') + br_port_str = db.keys('ASIC_DB', "ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT:*") + if not br_port_str: + return {} + + if_br_oid_map = {} + offset = len("ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT:") + oid_pfx = len("oid:0x") + for br_s in br_port_str: + # Example output: ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT:oid:0x3a000000000616 + br_port_id = br_s[(offset + oid_pfx):] + ent = db.get_all('ASIC_DB', br_s, blocking=True) + # TODO: remove the first branch after all SonicV2Connector are migrated to decode_responses + if isinstance(db, swsscommon.SonicV2Connector) == False and db.dbintf.redis_kwargs.get('decode_responses', False) == False: + if b"SAI_BRIDGE_PORT_ATTR_PORT_ID" in ent: + port_id = ent[b"SAI_BRIDGE_PORT_ATTR_PORT_ID"][oid_pfx:] + if_br_oid_map[br_port_id] = port_id + else: + if "SAI_BRIDGE_PORT_ATTR_PORT_ID" in ent: + port_id = ent["SAI_BRIDGE_PORT_ATTR_PORT_ID"][oid_pfx:] + if_br_oid_map[br_port_id] = port_id + + return if_br_oid_map + +def get_vlan_id_from_bvid(db, bvid): + """ + Get the Vlan Id from Bridge Vlan Object + """ + db.connect('ASIC_DB') + vlan_obj = db.keys('ASIC_DB', str("ASIC_STATE:SAI_OBJECT_TYPE_VLAN:" + bvid)) + vlan_entry = db.get_all('ASIC_DB', vlan_obj[0], blocking=True) + vlan_id = None + # TODO: remove the first branch after all SonicV2Connector are migrated to decode_responses + if isinstance(db, swsscommon.SonicV2Connector) == False and db.dbintf.redis_kwargs.get('decode_responses', False) == False: + if b"SAI_VLAN_ATTR_VLAN_ID" in vlan_entry: + vlan_id = vlan_entry[b"SAI_VLAN_ATTR_VLAN_ID"] + else: + if "SAI_VLAN_ATTR_VLAN_ID" in vlan_entry: + vlan_id = vlan_entry["SAI_VLAN_ATTR_VLAN_ID"] + + return vlan_id + +def get_rif_port_map(db): + """ + Get the RIF port mapping from ASIC DB + """ + db.connect('ASIC_DB') + rif_keys_str = db.keys('ASIC_DB', "ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE:*") + if not rif_keys_str: + return {} + + rif_port_oid_map = {} + for rif_s in rif_keys_str: + rif_id = rif_s[len("ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x"):] + ent = db.get_all('ASIC_DB', rif_s, blocking=True) + # TODO: remove the first branch after all SonicV2Connector are migrated to decode_responses + if isinstance(db, swsscommon.SonicV2Connector) == False and db.dbintf.redis_kwargs.get('decode_responses', False) == False: + if b"SAI_ROUTER_INTERFACE_ATTR_PORT_ID" in ent: + port_id = ent[b"SAI_ROUTER_INTERFACE_ATTR_PORT_ID"].lstrip(b"oid:0x") + rif_port_oid_map[rif_id] = port_id + else: + if "SAI_ROUTER_INTERFACE_ATTR_PORT_ID" in ent: + port_id = ent["SAI_ROUTER_INTERFACE_ATTR_PORT_ID"].lstrip("oid:0x") + rif_port_oid_map[rif_id] = port_id + + return rif_port_oid_map + +def get_vlan_interface_oid_map(db, blocking=True): + """ + Get Vlan Interface names and sai oids + """ + db.connect('COUNTERS_DB') + + rif_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_NAME_MAP', blocking=blocking) + rif_type_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_TYPE_MAP', blocking=blocking) + + if not rif_name_map or not rif_type_name_map: + return {} + + oid_pfx = len("oid:0x") + vlan_if_name_map = {} + + # TODO: remove the first branch after all SonicV2Connector are migrated to decode_responses + if isinstance(db, swsscommon.SonicV2Connector) == False and db.dbintf.redis_kwargs.get('decode_responses', False) == False: + get_index_func = get_index + else: + get_index_func = get_index_from_str + + for if_name, sai_oid in rif_name_map.items(): + # Check if RIF is l3 vlan interface + # TODO: remove the first candidate after all SonicV2Connector are migrated to decode_responses + if rif_type_name_map[sai_oid] in (b'SAI_ROUTER_INTERFACE_TYPE_VLAN', 'SAI_ROUTER_INTERFACE_TYPE_VLAN'): + # Check if interface name is in style understood to be a SONiC interface + if get_index_func(if_name): + vlan_if_name_map[sai_oid[oid_pfx:]] = if_name + + return vlan_if_name_map diff --git a/src/sonic-py-common/sonic_py_common/util.py b/src/sonic-py-common/sonic_py_common/util.py new file mode 100755 index 000000000000..a63c98a38ff8 --- /dev/null +++ b/src/sonic-py-common/sonic_py_common/util.py @@ -0,0 +1,67 @@ +""" +Syslog and daemon script utility library. +""" + +from __future__ import print_function +import json +import logging +import logging.config +import sys +from getopt import getopt + + +# TODO: move to dbsync project. +def usage(script_name): + print('Usage: python ', script_name, + '-t [host] -p [port] -s [unix_socket_path] -d [logging_level] -f [update_frequency] -h [help]') + + +# TODO: move to dbsync project. +def process_options(script_name): + """ + Process command line options + """ + options, remainders = getopt(sys.argv[1:], "t:p:s:d:f:h", ["host=", "port=", "unix_socket_path=", "debug=", "frequency=", "help"]) + + args = {} + for (opt, arg) in options: + try: + if opt in ('-d', '--debug'): + args['log_level'] = int(arg) + elif opt in ('-t', '--host'): + args['host'] = arg + elif opt in ('-p', '--port'): + args['port'] = int(arg) + elif opt in ('-s', 'unix_socket_path'): + args['unix_socket_path'] = arg + elif opt in ('-f', '--frequency'): + args['update_frequency'] = int(arg) + elif opt in ('-h', '--help'): + usage(script_name) + except ValueError as e: + print('Invalid option for {}: {}'.format(opt, e)) + sys.exit(1) + + return args + + +# TODO: move +def setup_logging(config_file_path, log_level=logging.INFO): + """ + Logging configuration helper. + + :param config_file_path: file path to logging configuration file. + https://docs.python.org/3/library/logging.config.html#object-connections + :param log_level: defaults to logging.INFO + :return: None - access the logger by name as described in the config--or the "root" logger as a backup. + """ + try: + with open(config_file_path, 'rt') as f: + config = json.load(f) + logging.config.dictConfig(config) + except (ValueError, IOError, OSError): + # json.JSONDecodeError is throwable in Python3.5+ -- subclass of ValueError + logging.basicConfig(log_level=log_level) + logging.root.exception( + "Could not load specified logging configuration '{}'. Verify the filepath exists and is compliant with: " + "[https://docs.python.org/3/library/logging.config.html#object-connections]".format(config_file_path)) diff --git a/src/sonic-py-common/tests/test_port_util.py b/src/sonic-py-common/tests/test_port_util.py new file mode 100644 index 000000000000..2281f43d9a82 --- /dev/null +++ b/src/sonic-py-common/tests/test_port_util.py @@ -0,0 +1,19 @@ +import os +import sys + +if sys.version_info.major == 3: + from unittest import mock +else: + import mock + +modules_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +sys.path.insert(0, os.path.join(modules_path, 'src')) + +class TestPortUtil: + def test_get_vlan_interface_oid_map(self): + db = mock.MagicMock() + db.get_all = mock.MagicMock() + db.get_all.return_value = {} + + from swsssdk.port_util import get_vlan_interface_oid_map + assert not get_vlan_interface_oid_map(db, True) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 653bdba51750..cc847a2e11b3 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 653bdba51750cac95feb3dd47904bf4de2353fec +Subproject commit cc847a2e11b3dd6d7f9630bfcac2ac3af2912eba diff --git a/src/sonic-swss b/src/sonic-swss index 93af69c5cb9a..7126857c1e38 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 93af69c5cb9a78465604974b59d1b1ed709d2b10 +Subproject commit 7126857c1e387784bd04b9f7502018b2a4973d85 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 34c4b059e545..c30c34f7edea 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 34c4b059e545caff775d6be903206c7f39c5c112 +Subproject commit c30c34f7edea01b0391e615d9a24e9e24d07a142 diff --git a/src/sonic-utilities b/src/sonic-utilities index f64d2807381b..d6b886989cc1 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit f64d2807381bc4faf0b8d66c73b3a14b277d0408 +Subproject commit d6b886989cc1f2104613c2cb21d406f9ab5127dc diff --git a/src/sonic-yang-mgmt/setup.py b/src/sonic-yang-mgmt/setup.py index e97343ac0e0a..d513507dd17c 100644 --- a/src/sonic-yang-mgmt/setup.py +++ b/src/sonic-yang-mgmt/setup.py @@ -24,10 +24,14 @@ description="Package contains Python Library for YANG for sonic.", license="GNU General Public License v3", long_description=readme + '\n\n', + scripts = [ + 'sonic-cfg-help', + ], install_requires = [ 'xmltodict==0.12.0', 'ijson==2.6.1', 'jsondiff>=1.2.0', + 'tabulate==0.8.2' ], tests_require = [ 'pytest>3', diff --git a/src/sonic-yang-mgmt/sonic-cfg-help b/src/sonic-yang-mgmt/sonic-cfg-help new file mode 100755 index 000000000000..4c14cebc44b8 --- /dev/null +++ b/src/sonic-yang-mgmt/sonic-cfg-help @@ -0,0 +1,205 @@ +#!/usr/bin/env python3 + +import argparse +from tabulate import tabulate +import re +import textwrap + +import sonic_yang + +YANG_MODELS_DIR = "/usr/local/yang-models" + + +class SonicCfgDescriber: + + def __init__(self, table_name, field, print_format, + yang_models_dir=YANG_MODELS_DIR): + self.yang_models_dir = yang_models_dir + self.yang_parser = sonic_yang.SonicYang(self.yang_models_dir) + self.yang_parser.loadYangModel() + self.table_descr = {} + self.table_name = table_name + self.field = field + self.print_format = print_format + + def print_documentation(self): + for j in self.yang_parser.yJson: + toplevel = j['module'].get('container') + if toplevel is not None: + container = toplevel.get('container') + if isinstance(container, list): + for c in container: + if c.get('@name') == self.table_name or \ + not self.table_name: + self.print_table(c, self.field) + elif isinstance(container, dict): + if container.get('@name') == self.table_name or \ + not self.table_name: + self.print_table(container, self.field) + + def print_table(self, table, field): + if table is None: + return + print("\n" + table.get('@name')) + if table.get('description', {}).get('text') is not None: + print("Description: " + table.get('description').get('text')) + print () + + if table.get('list') is not None: + if (isinstance(table['list'], list)): + for schema in table['list']: + self.print_field_desc(schema, field) + print() + else: + self.print_field_desc(table['list'], field) + print() + elif table.get('container') is not None: + self.print_field_desc(table.get('container'), field) + print() + + def get_referenced_table_field(self, ref): + if 'LIST' in ref.split('/')[-2]: + table = ref.split('/')[-3].split(':')[-1] + else: + table = ref.split('/')[-2].split(':')[-1] + field = ref.split('/')[-1].split(':')[-1] + return(table + ":" + field) + + def parse_when_condition(self, table): + condition = table['@condition'] + desc = "" + if "boolean" in condition: + values = re.findall("\'(.*?)\'", condition, re.DOTALL) + field = re.search("boolean\((.*?)\[", condition) + desc = "when " + field.group(1) + " in " + ",".join(values) + elif condition.startswith("(/"): + field = re.search("/(.*)\:(.*) \=", condition) + ref_table = condition.split("/")[2].split(':')[-1] + values = re.findall("\'(.*?)\'", condition, re.DOTALL) + desc = "when " + ref_table + ":" + field.group(2) + \ + " in " + ",".join(values) + + return desc + + def parse_choice(self, table, field): + out = [] + for keys in table['case']: + desc = "Mutually exclusive in group " + table['@name'] + if 'when' in keys: + desc += "\n" + self.parse_when_condition(keys['when']) + out += self.validate_and_parse_leaf(keys, field, desc) + return out + + def parse_leaf(self, key, field, desc=""): + mandatory = '' + default = '' + out = [] + reference = '' + name = key.get('@name') + if field and name != field: + return [] + if isinstance(key, dict): + if key.get('description', {}).get('text') is not None: + desc += "\n".join(textwrap.wrap(re.sub(r"\s+", " ", + key['description']['text']), width=50)) + if key.get('mandatory') is not None: + mandatory = key.get('mandatory').get('@value') + if key.get('default') is not None: + default = key.get('default').get('@value') + if key.get('type') is not None: + if key['type'].get('@name') == 'leafref': + reference = self.get_referenced_table_field( + key['type']['path'].get('@value')) + elif key['type'].get('@name') == 'union': + for types in key['type']['type']: + if 'path' in types: + val = self.get_referenced_table_field( + types['path'].get('@value')) + if not reference: + reference = val + else: + reference += "\n" + val + out.append([name, desc, mandatory, default, reference]) + return out + + def validate_and_parse_leaf(self, table, field, desc=""): + out = [] + if 'leaf' in table: + if isinstance(table['leaf'], list): + for key in table['leaf']: + ret = self.parse_leaf(key, field, desc) + out = out + ret + elif isinstance(table['leaf'], dict): + ret = self.parse_leaf(table['leaf'], field, desc) + out = out + ret + + if 'leaf-list' in table: + if desc: + desc = desc + "\n" + desc = desc + "The field contains list of unique members" + if isinstance(table['leaf-list'], list): + for key in table['leaf-list']: + ret = self.parse_leaf(key, field, desc) + out = out + ret + elif isinstance(table['leaf-list'], dict): + ret = self.parse_leaf(table['leaf-list'], field, desc) + out = out + ret + return out + + def print_field_desc(self, table, field): + if table is None: + return + + header = ['Field', 'Description', 'Mandatory', 'Default', 'Reference'] + out = [] + if 'key' in table: + print("key - " + ":".join(table['key']['@value'].split())) + + out += self.validate_and_parse_leaf(table, field) + + if 'choice' in table: + if isinstance(table['choice'], list): + for key in table['choice']: + out += self.parse_choice(key, field) + elif isinstance(table['choice'], dict): + out += self.parse_choice(table['choice'], field) + + if 'list' in table: + out += self.validate_and_parse_leaf(table['list'], field, + "This field is for storing " + + "mapping between two fields") + + print(tabulate(out, header, tablefmt=self.print_format)) + + +def main(): + parser = argparse.ArgumentParser(description="Description of table name") + parser.add_argument("-t", "--table", help="Table name", default='') + parser.add_argument("-f", "--field", help="Field", default='') + parser.add_argument("-p", "--print_format", help="Print format", + default='grid') + parser.add_argument('-a', "--all", action="store_true", default=False, + help="Print all tables") + args = parser.parse_args() + if not (args.table or args.all): + print("Error: Table or all option is required") + parser.print_help() + return -1 + + if args.table and args.all: + print("Cannot have table and all option together") + parser.print_help() + return -1 + + if args.field and not args.table: + print("Error: Filter by field requires table to be specified") + parser.print_help() + return -1 + + yang_cfg = SonicCfgDescriber(args.table, args.field, args.print_format) + yang_cfg.print_documentation() + + +if __name__ == "__main__": + main() + diff --git a/src/sonic-yang-mgmt/tests/test_cfghelp.py b/src/sonic-yang-mgmt/tests/test_cfghelp.py new file mode 100644 index 000000000000..2c09625a0e6a --- /dev/null +++ b/src/sonic-yang-mgmt/tests/test_cfghelp.py @@ -0,0 +1,170 @@ +import json +import subprocess +import os + +from unittest import TestCase + +output1="""\ +Error: Table or all option is required +usage: sonic-cfg-help [-h] [-t TABLE] [-f FIELD] [-p PRINT_FORMAT] [-a] + +Description of table name + +optional arguments: + -h, --help show this help message and exit + -t TABLE, --table TABLE + Table name + -f FIELD, --field FIELD + Field + -p PRINT_FORMAT, --print_format PRINT_FORMAT + Print format + -a, --all Print all tables +""" + +techsupport_table_output="""\ + +AUTO_TECHSUPPORT +Description: AUTO_TECHSUPPORT part of config_db.json + ++-------------------------+----------------------------------------------------+-------------+-----------+-------------+ +| Field | Description | Mandatory | Default | Reference | ++=========================+====================================================+=============+===========+=============+ +| state | Knob to make techsupport invocation event-driven | | | | +| | based on core-dump generation | | | | ++-------------------------+----------------------------------------------------+-------------+-----------+-------------+ +| rate_limit_interval | Minimum time in seconds between two successive | | | | +| | techsupport invocations. Configure 0 to explicitly | | | | +| | disable | | | | ++-------------------------+----------------------------------------------------+-------------+-----------+-------------+ +| max_techsupport_limit | Max Limit in percentage for the cummulative size | | | | +| | of ts dumps. No cleanup is performed if the value | | | | +| | isn't configured or is 0.0 | | | | ++-------------------------+----------------------------------------------------+-------------+-----------+-------------+ +| max_core_limit | Max Limit in percentage for the cummulative size | | | | +| | of core dumps. No cleanup is performed if the | | | | +| | value isn't congiured or is 0.0 | | | | ++-------------------------+----------------------------------------------------+-------------+-----------+-------------+ +| available_mem_threshold | Memory threshold; 0 to disable techsupport | | 10.0 | | +| | invocation on memory usage threshold crossing | | | | ++-------------------------+----------------------------------------------------+-------------+-----------+-------------+ +| min_available_mem | Minimum Free memory (in MB) that should be | | 200 | | +| | available for the techsupport execution to start | | | | ++-------------------------+----------------------------------------------------+-------------+-----------+-------------+ +| since | Only collect the logs & core-dumps generated since | | | | +| | the time provided. A default value of '2 days ago' | | | | +| | is used if this value is not set explicitly or a | | | | +| | non-valid string is provided | | | | ++-------------------------+----------------------------------------------------+-------------+-----------+-------------+ + +""" + +techsupport_table_field_output="""\ + +AUTO_TECHSUPPORT +Description: AUTO_TECHSUPPORT part of config_db.json + ++---------+--------------------------------------------------+-------------+-----------+-------------+ +| Field | Description | Mandatory | Default | Reference | ++=========+==================================================+=============+===========+=============+ +| state | Knob to make techsupport invocation event-driven | | | | +| | based on core-dump generation | | | | ++---------+--------------------------------------------------+-------------+-----------+-------------+ + +""" + +portchannel_table_field_output="""\ + +PORTCHANNEL +Description: PORTCHANNEL part of config_db.json + +key - name ++---------+-------------------------------------------+-------------+-----------+-------------+ +| Field | Description | Mandatory | Default | Reference | ++=========+===========================================+=============+===========+=============+ +| members | The field contains list of unique members | | | PORT:name | ++---------+-------------------------------------------+-------------+-----------+-------------+ + +""" + +dscp_to_tc_table_field_output="""\ + +DSCP_TO_TC_MAP +Description: DSCP_TO_TC_MAP part of config_db.json + +key - name ++---------+------------------------------------------------------+-------------+-----------+-------------+ +| Field | Description | Mandatory | Default | Reference | ++=========+======================================================+=============+===========+=============+ +| name | | | | | ++---------+------------------------------------------------------+-------------+-----------+-------------+ +| dscp | This field is for storing mapping between two fields | | | | ++---------+------------------------------------------------------+-------------+-----------+-------------+ +| tc | This field is for storing mapping between two fields | | | | ++---------+------------------------------------------------------+-------------+-----------+-------------+ + +""" + +acl_rule_table_field_output="""\ + +ACL_RULE +Description: ACL_RULE part of config_db.json + +key - ACL_TABLE_NAME:RULE_NAME ++-----------+-----------------------------------------+-------------+-----------+-------------+ +| Field | Description | Mandatory | Default | Reference | ++===========+=========================================+=============+===========+=============+ +| ICMP_TYPE | Mutually exclusive in group icmp | | | | +| | when IP_TYPE in ANY,IP,IPV4,IPv4ANY,ARP | | | | ++-----------+-----------------------------------------+-------------+-----------+-------------+ + +""" + +class TestCfgHelp(TestCase): + + def setUp(self): + self.test_dir = os.path.dirname(os.path.realpath(__file__)) + self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfg-help') + + def run_script(self, argument): + print('\n Running sonic-cfg-help ' + argument) + output = subprocess.check_output(self.script_file + ' ' + argument, shell=True) + + output = output.decode() + + linecount = output.strip().count('\n') + if linecount <= 0: + print(' Output: ' + output.strip()) + else: + print(' Output: ({0} lines, {1} bytes)'.format(linecount + 1, len(output))) + return output + + def test_dummy_run(self): + argument = '' + output = self.run_script(argument) + self.assertEqual(output, output1) + + def test_single_table(self): + argument = '-t AUTO_TECHSUPPORT' + output = self.run_script(argument) + self.assertEqual(output, techsupport_table_output) + + def test_single_field(self): + argument = '-t AUTO_TECHSUPPORT -f state' + output = self.run_script(argument) + self.assertEqual(output, techsupport_table_field_output) + + def test_leaf_list(self): + argument = '-t PORTCHANNEL -f members' + output = self.run_script(argument) + self.assertEqual(output, portchannel_table_field_output) + + def test_leaf_list_map(self): + argument = '-t DSCP_TO_TC_MAP' + output = self.run_script(argument) + self.maxDiff = None + self.assertEqual(output, dscp_to_tc_table_field_output) + + def test_when_condition(self): + argument = '-t ACL_RULE -f ICMP_TYPE' + output = self.run_script(argument) + self.assertEqual(output, acl_rule_table_field_output) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index ab51762e5d7e..e66927b4a8c2 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -49,6 +49,7 @@ Table of Contents * [Versions](#versions) * [VLAN](#vlan) * [VLAN_MEMBER](#vlan_member) + * [VXLAN](#vxlan) * [Virtual router](#virtual-router) * [WRED_PROFILE](#wred_profile) * [PASSWORD_HARDENING](#password_hardening) @@ -1098,33 +1099,51 @@ These information are configured in individual tables. Domain name or IP address of the server is used as object key. Currently there are no attributes in those objects. -***NTP server*** -``` -{ -"NTP_SERVER": { - "2.debian.pool.ntp.org": {}, - "1.debian.pool.ntp.org": {}, - "3.debian.pool.ntp.org": {}, - "0.debian.pool.ntp.org": {} - }, - -"NTP_SERVER": { - "23.92.29.245": {}, - "204.2.134.164": {} - } -} -``` - -***Syslogserver*** -``` -{ -"SYSLOG_SERVER": { - "10.0.0.5": {}, - "10.0.0.6": {}, - "10.11.150.5": {} - } -} -``` +***NTP server*** +``` +{ + "NTP_SERVER": { + "2.debian.pool.ntp.org": {}, + "1.debian.pool.ntp.org": {}, + "3.debian.pool.ntp.org": {}, + "0.debian.pool.ntp.org": {} + }, + + "NTP_SERVER": { + "23.92.29.245": {}, + "204.2.134.164": {} + } +} +``` + +***Syslog server*** +``` +{ + "SYSLOG_SERVER": { + "10.0.0.5": {}, + "10.0.0.6": {}, + "10.11.150.5": {} + }, + + "SYSLOG_SERVER" : { + "2.2.2.2": { + "source": "1.1.1.1", + "port": "514", + "vrf": "default" + }, + "4.4.4.4": { + "source": "3.3.3.3", + "port": "514", + "vrf": "mgmt" + }, + "2222::2222": { + "source": "1111::1111", + "port": "514", + "vrf": "Vrf-Data" + } + } +} +``` ### Policer @@ -1460,6 +1479,37 @@ channel name as object key, and tagging mode as attributes. } ``` +### VXLAN + +VXLAN_TUNNEL holds the VTEP source ip configuration. +VXLAN_TUNNEL_MAP holds the vlan to vni and vni to vlan mapping configuration. +VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered tunnels. + +``` +{ +"VXLAN_TUNNEL": { + "vtep1": { + "src_ip": "10.10.10.10" + } + } +"VXLAN_TUNNEL_MAP" : { + "vtep1|map_1000_Vlan100": { + "vni": "1000", + "vlan": "100" + }, + "vtep1|testmap": { + "vni": "22000", + "vlan": "70" + }, + } + "VXLAN_EVPN_NVO": { + "nvo1": { + "source_vtep": "vtep1" + } + } +} +``` + ### Virtual router The virtual router table allows to insert or update a new virtual router diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 1c2bfaf2755a..6a7d78bdf4ef 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -134,6 +134,7 @@ def run(self): './yang-models/sonic-types.yang', './yang-models/sonic-versions.yang', './yang-models/sonic-vlan.yang', + './yang-models/sonic-vxlan.yang', './yang-models/sonic-vrf.yang', './yang-models/sonic-mclag.yang', './yang-models/sonic-vlan-sub-interface.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 97a02004306e..be8e6fb659c2 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -332,6 +332,12 @@ } }, "VLAN": { + "Vlan100": { + "description": "vxlan", + "vlanid": "100", + "mtu": "9216", + "admin_status": "up" + }, "Vlan111": { "description": "svlan", "dhcp_servers": [ @@ -1703,7 +1709,22 @@ "4": "4" } }, - + "VXLAN_TUNNEL": { + "vtep1": { + "src_ip": "1.2.3.4" + } + }, + "VXLAN_EVPN_NVO": { + "nvo1": { + "source_vtep": "vtep1" + } + }, + "VXLAN_TUNNEL_MAP": { + "vtep1|map_100_Vlan100": { + "vni" : "100", + "vlan": "Vlan100" + } + }, "PORT_QOS_MAP": { "Ethernet0": { "dot1p_to_tc_map" : "Dot1p_to_tc_map1", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/vxlan.json b/src/sonic-yang-models/tests/yang_model_tests/tests/vxlan.json new file mode 100644 index 000000000000..6bb0507fb050 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/vxlan.json @@ -0,0 +1,17 @@ +{ + "VXLAN_VALID_TEST": { + "desc": "Valid VXLAN Configuration." + }, + "VXLAN_EVPN_NVO_WITHOUT_VTEP": { + "desc": "Configure EVPN_NVO without VXLAN_TUNNEL entry", + "eStrKey" : "LeafRef" + }, + "VXLAN_MAP_WITHOUT_VTEP": { + "desc": "Configure VXLAN_TUNNEL_MAP without VXLAN_TUNNEL entry", + "eStrKey" : "LeafRef" + }, + "VXLAN_MAP_OOR_VNI": { + "desc": "VNI Out of Range in VXLAN_TUNNEL_MAP TABLE", + "eStrKey": "Range" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vxlan.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vxlan.json new file mode 100644 index 000000000000..90e71063cb24 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vxlan.json @@ -0,0 +1,129 @@ +{ + "VXLAN_VALID_TEST": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan100" + } + ] + } + }, + "sonic-vxlan:sonic-vxlan": { + "sonic-vxlan:VXLAN_TUNNEL": { + "VXLAN_TUNNEL_LIST": [ + { + "name": "vtep1", + "src_ip": "1.2.3.4" + } + ] + }, + "sonic-vxlan:VXLAN_EVPN_NVO": { + "VXLAN_EVPN_NVO_LIST": [ + { + "name": "nvo1", + "source_vtep": "vtep1" + } + ] + }, + "sonic-vxlan:VXLAN_TUNNEL_MAP": { + "VXLAN_TUNNEL_MAP_LIST": [ + { + "name": "vtep1", + "mapname": "map_100_Vlan100", + "vlan": "Vlan100", + "vni": "100" + } + ] + } + } + }, + "VXLAN_EVPN_NVO_WITHOUT_VTEP": { + "sonic-vxlan:sonic-vxlan": { + "sonic-vxlan:VXLAN_EVPN_NVO": { + "VXLAN_EVPN_NVO_LIST": [ + { + "name": "nvo1", + "source_vtep": "vtep1" + } + ] + } + } + }, + "VXLAN_MAP_WITHOUT_VTEP": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan100" + } + ] + } + }, + "sonic-vxlan:sonic-vxlan": { + "sonic-vxlan:VXLAN_TUNNEL_MAP": { + "VXLAN_TUNNEL_MAP_LIST": [ + { + "name": "vtep1", + "mapname": "map_100_Vlan100", + "vlan": "Vlan100", + "vni": "100" + } + ] + } + } + }, + "VXLAN_MAP_WITHOUT_VLAN": { + "sonic-vxlan:sonic-vxlan": { + "sonic-vxlan:VXLAN_TUNNEL": { + "VXLAN_TUNNEL_LIST": [ + { + "name": "vtep1", + "src_ip": "1.2.3.4" + } + ] + }, + "sonic-vxlan:VXLAN_TUNNEL_MAP": { + "VXLAN_TUNNEL_MAP_LIST": [ + { + "name": "vtep1", + "mapname": "map_100_Vlan100", + "vlan": "Vlan100", + "vni": "100" + } + ] + } + } + }, + "VXLAN_MAP_OOR_VNI": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan100" + } + ] + } + }, + "sonic-vxlan:sonic-vxlan": { + "sonic-vxlan:VXLAN_TUNNEL": { + "VXLAN_TUNNEL_LIST": [ + { + "name": "vtep1", + "src_ip": "1.2.3.4" + } + ] + }, + "sonic-vxlan:VXLAN_TUNNEL_MAP": { + "VXLAN_TUNNEL_MAP_LIST": [ + { + "name": "vtep1", + "mapname": "map_100_Vlan100", + "vlan": "Vlan100", + "vni": "16777299" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-vxlan.yang b/src/sonic-yang-models/yang-models/sonic-vxlan.yang new file mode 100644 index 000000000000..6a9b4ffb5e3b --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-vxlan.yang @@ -0,0 +1,126 @@ +module sonic-vxlan { + yang-version 1.1; + namespace "http://github.com/Azure/sonic-vxlan"; + prefix svxlan; + + import ietf-yang-types { + prefix yang; + } + + import ietf-inet-types { + prefix inet; + } + + import sonic-extension { + prefix sonic-ext; + } + // Comment sonic-vlan import here until libyang back-links issue is resolved for VLAN leaf reference. + //import sonic-vlan { + // prefix svlan; + //} + import sonic-types { + prefix stypes; + } + + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC VXLAN"; + + revision 2021-04-12 { + description + "First revision."; + } + + container sonic-vxlan { + + container VXLAN_TUNNEL { + + description "config db VXLAN_TUNNEL table"; + + list VXLAN_TUNNEL_LIST { + + key "name"; + max-elements 1; + + leaf name { + /* vni devices are created of the form 'name'-vlanid + The kernel has a max limit of 15 chars for netdevices. + keeping aside 5 chars for hyphen and vlanid the + name should have a max of 10 chars */ + + type string { + length 1..10; + } + } + + leaf src_ip { + type inet:ipv4-address; + } + } + } + + container VXLAN_TUNNEL_MAP { + + description "config db VXLAN_TUNNEL_MAP table"; + + list VXLAN_TUNNEL_MAP_LIST { + key "name mapname"; + + leaf name { + type leafref { + path "/svxlan:sonic-vxlan/svxlan:VXLAN_TUNNEL/svxlan:VXLAN_TUNNEL_LIST/svxlan:name"; + } + } + + leaf mapname { + type string; + } + + leaf vlan { + mandatory true; + // Comment VLAN leaf reference here until libyang back-links issue is resolved and use VLAN string pattern + // type leafref { + // path "/svlan:sonic-vlan/svlan:VLAN/svlan:VLAN_LIST/svlan:name"; + //} + type string { + pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])'; + } + + } + + leaf vni { + mandatory true; + type stypes:vnid_type; + } + } + } + + container VXLAN_EVPN_NVO { + + description "config db VXLAN_EVPN_NVO table"; + + list VXLAN_EVPN_NVO_LIST { + + key "name"; + max-elements 1; + + leaf name { + type string; + } + + leaf source_vtep { + mandatory true; + type leafref { + path "/svxlan:sonic-vxlan/svxlan:VXLAN_TUNNEL/svxlan:VXLAN_TUNNEL_LIST/svxlan:name"; + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 index 6d8bd198d216..f8d9d2c30586 100644 --- a/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 @@ -262,6 +262,14 @@ module sonic-types { } } + typedef vnid_type { + type uint32 { + range "1..16777215"; + } + description + "VXLAN Network Identifier"; + } + {% if yang_model_type == "cvl" %} /* Required for CVL */ container operation {