diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000000..05f39760b195 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,60 @@ + + +**Description** + + + +**Steps to reproduce the issue:** +1. +2. +3. + +**Describe the results you received:** + + +**Describe the results you expected:** + + +**Additional information you deem important (e.g. issue happens only occasionally):** + + **Output of `show version`:** + + ``` + (paste your output here) + ``` + + **Attach debug file `sudo generate_dump`:** + + ``` + (paste your output here) + ``` diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000000..2ac7d9e47730 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,26 @@ + + +**- What I did** + +**- How I did it** + +**- How to verify it** + +**- Description for the changelog** + + + +**- A picture of a cute animal (not mandatory but encouraged)** diff --git a/.gitmodules b/.gitmodules index 5bf6fb5b4a61..4bddfb4a60da 100644 --- a/.gitmodules +++ b/.gitmodules @@ -44,6 +44,7 @@ [submodule "src/sonic-utilities"] path = src/sonic-utilities url = https://github.com/Azure/sonic-utilities + branch = v1.0.3 [submodule "platform/broadcom/sonic-platform-modules-s6000"] path = platform/broadcom/sonic-platform-modules-s6000 url = https://github.com/Azure/sonic-platform-modules-s6000 @@ -56,10 +57,6 @@ [submodule "platform/broadcom/sonic-platform-modules-ingrasys"] path = platform/broadcom/sonic-platform-modules-ingrasys url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys -[submodule "src/SAI"] - path = src/SAI - url = https://github.com/opencomputeproject/SAI - branch = v0.9.4 [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons diff --git a/Makefile b/Makefile index d779c30718dc..d672edc6836a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,18 @@ ############################################################################### ## Wrapper for starting make inside sonic-slave container +# +# Supported parameters: +# +# * PLATFORM: Specific platform we wish to build images for. +# * BUILD_NUMBER: Desired version-number to pass to the building-system. +# * ENABLE_DHCP_GRAPH_SERVICE: Enables get-graph service to fetch minigraph files +# through http. +# * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart. +# * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. +# * USERNAME: Desired username -- default at rules/config +# * PASSWORD: Desired password -- default at rules/config +# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. +# ############################################################################### SHELL = /bin/bash @@ -13,7 +26,7 @@ $(shell rm -f .screen) MAKEFLAGS += -B SLAVE_BASE_TAG = $(shell shasum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') -SLAVE_TAG = $(shell shasum sonic-slave/Dockerfile.user | awk '{print substr($$1,0,11);}') +SLAVE_TAG = $(shell cat sonic-slave/Dockerfile.user sonic-slave/Dockerfile | shasum | awk '{print substr($$1,0,11);}') SLAVE_BASE_IMAGE = sonic-slave-base SLAVE_IMAGE = sonic-slave-$(USER) @@ -37,6 +50,16 @@ DOCKER_BUILD = docker build --no-cache \ sonic-slave && \ docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) +SONIC_BUILD_INSTRUCTION := make \ + -f slave.mk \ + PLATFORM=$(PLATFORM) \ + BUILD_NUMBER=$(BUILD_NUMBER) \ + ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ + SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ + SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ + PASSWORD=$(PASSWORD) \ + USERNAME=$(USERNAME) + .PHONY: sonic-slave-build sonic-slave-bash .DEFAULT_GOAL := all @@ -48,16 +71,11 @@ DOCKER_BUILD = docker build --no-cache \ @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) make \ - -f slave.mk \ - PLATFORM=$(PLATFORM) \ - BUILD_NUMBER=$(BUILD_NUMBER) \ - ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ - SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ - SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ - PASSWORD=$(PASSWORD) \ - USERNAME=$(USERNAME) \ - $@ +ifeq "$(KEEP_SLAVE_ON)" "yes" + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" +else + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@ +endif sonic-slave-build : $(DOCKER_BASE_BUILD) diff --git a/build_debian.sh b/build_debian.sh index 22cbef494f87..a21cdada0243 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -63,6 +63,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 touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime ## Build a basic Debian system by debootstrap @@ -132,6 +133,8 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista- ## 2. Bind-mount docker working directory (docker aufs cannot work over aufs rootfs) sudo cp files/initramfs-tools/union-mount $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mount sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mount +sudo cp files/initramfs-tools/varlog $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog sudo cp files/initramfs-tools/union-fsck $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chroot $FILESYSTEM_ROOT update-initramfs -u @@ -203,7 +206,13 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in curl \ kexec-tools \ less \ - unzip + unzip \ + gdisk + +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ + grub-pc-bin + +sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec @@ -239,10 +248,11 @@ EOF ## Config sysctl sudo mkdir -p $FILESYSTEM_ROOT/var/core sudo augtool --autosave " -set /files/etc/sysctl.conf/kernel.core_pattern '|/usr/bin/coredump-compress %e %p' +set /files/etc/sysctl.conf/kernel.core_pattern '|/usr/bin/coredump-compress %e %t %p' set /files/etc/sysctl.conf/kernel.softlockup_panic 1 set /files/etc/sysctl.conf/kernel.panic 10 +set /files/etc/sysctl.conf/fs.suid_dumpable 2 set /files/etc/sysctl.conf/net.ipv4.conf.default.forwarding 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.forwarding 1 @@ -312,6 +322,14 @@ if [ -f sonic_debian_extension.sh ]; then ./sonic_debian_extension.sh $FILESYSTEM_ROOT $PLATFORM_DIR fi +## Organization specific extensions such as Configuration & Scripts for features like AAA, ZTP... +if [ "${enable_organization_extensions}" = "y" ]; then + if [ -f files/build_templates/organization_extensions.sh ]; then + sudo chmod 755 files/build_templates/organization_extensions.sh + ./files/build_templates/organization_extensions.sh -f $FILESYSTEM_ROOT -h $HOSTNAME + fi +fi + ## Clean up apt sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoremove sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean diff --git a/build_image.sh b/build_image.sh index 2d229c2d194b..ee7fb8a75823 100755 --- a/build_image.sh +++ b/build_image.sh @@ -25,10 +25,6 @@ generate_onie_installer_image() cp ./device/$VENDOR/$PLATFORM/installer.conf ./installer/x86_64/platforms/$PLATFORM fi - if [ "$IMAGE_TYPE" = "raw" ] && [ -f ./device/$VENDOR/$PLATFORM/nos_to_sonic_grub.cfg ]; then - sed -i -e "s/%%IMAGE_VERSION%%/$IMAGE_VERSION/g" ./device/$VENDOR/$PLATFORM/nos_to_sonic_grub.cfg - echo "IMAGE_VERSION is $IMAGE_VERSION" - fi done done diff --git a/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc index e27679db9ab0..85030e1db349 100644 --- a/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc +++ b/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc @@ -1,163 +1,162 @@ -# LED setting for active -# ----------------------------------------------------------------------------- -# for as5712_54x (48xg+6qxg) -# -# on green - if link up -# off - if link down -# blink - if active -# ----------------------------------------------------------------------------- -m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 -m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 -m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 -m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 -m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 -m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 -m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 -m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 -m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 -m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 -m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 -m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 -m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 -m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 -m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 -m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 -m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 -m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 -m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 -m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 -m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 -m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 -m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 -m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 -m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 -m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 -m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 -m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 -m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 -m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 -m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 -m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 -m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 -m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 -m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 -m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 -m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 -m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 -m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 -m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 -m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 -m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 -m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 -m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 -m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 -m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 -m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 -m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 -m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 -m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 -m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 -m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 -m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 -m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 -m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 -m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 -m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 -m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 -m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 -m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 -m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 -m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 -m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 -m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 -m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 -m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 -m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 -m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 -m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 -m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 -m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 -m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 -m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 -m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 -m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 -m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 -m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 -m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 -m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 -m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 -m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 -m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 -m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 -m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 -m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 -m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 -m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 -m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 -m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 -m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 -m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 -m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 -m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 -m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 -m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 -m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 -m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 -m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 -m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 -m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 -m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 -m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 -m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 -m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 -m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 -m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 -m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 -m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 -m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 -m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 -m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 -m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 -m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 -m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 -m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 -m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 -m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 -m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 -m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 -m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 -m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 -m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 -m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 -m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 -m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 -m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 -m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 -m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 - -led 0 stop -led 0 prog \ - 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ - 61 FD 02 3F 60 FF 28 32 0F 87 67 4A 96 FF 06 FF \ - D2 2B 74 16 02 1F 60 FF 28 32 0F 87 67 4A 96 FF \ - 06 FF D2 13 74 28 02 0F 60 FF 28 32 0F 87 67 4A \ - 96 FF 06 FF D2 0B 74 3A 3A 48 32 07 32 08 C7 32 \ - 04 C7 97 71 57 77 69 32 00 32 01 B7 97 71 63 32 \ - 0E 77 6B 26 FD 97 27 77 6B 32 0F 87 57 00 00 00 -led 0 start - -led 1 stop -led 1 prog \ - 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ - 61 FD 02 20 67 89 02 24 67 89 02 10 67 89 02 28 \ - 67 89 02 2C 67 89 02 0C 67 89 02 2C 67 79 02 28 \ - 67 79 02 24 67 79 02 20 67 79 02 10 67 79 02 0C \ - 67 79 02 0B 60 FF 28 32 0F 87 67 56 96 FF 06 FF \ - D2 FF 74 46 3A 36 32 07 32 08 C7 32 04 C7 97 71 \ - 63 77 75 32 00 32 01 B7 97 71 6F 32 0E 77 77 26 \ - FD 97 27 77 77 32 0F 87 57 12 A0 F8 15 1A 01 75 \ - 85 28 67 56 57 32 0F 87 57 12 A0 F8 15 1A 01 71 \ - A1 28 67 56 80 28 67 56 80 28 67 56 80 28 67 56 \ - 57 32 0F 87 32 0F 87 32 0F 87 32 0F 87 57 00 00 -led 1 start - +# LED setting for active +# ----------------------------------------------------------------------------- +# for as5712_54x (48xg+6qxg) +# +# on green - if link up +# off - if link down +# blink - if active +# ----------------------------------------------------------------------------- +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 + +led 0 stop +led 0 prog \ + 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ + 61 FD 02 3F 60 FF 28 32 0F 87 67 4A 96 FF 06 FF \ + D2 2B 74 16 02 1F 60 FF 28 32 0F 87 67 4A 96 FF \ + 06 FF D2 13 74 28 02 0F 60 FF 28 32 0F 87 67 4A \ + 96 FF 06 FF D2 0B 74 3A 3A 48 32 07 32 08 C7 32 \ + 04 C7 97 71 57 77 69 32 00 32 01 B7 97 71 63 32 \ + 0E 77 6B 26 FD 97 27 77 6B 32 0F 87 57 00 00 00 +led 0 start + +led 1 stop +led 1 prog \ + 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ + 61 FD 02 20 67 89 02 24 67 89 02 10 67 89 02 28 \ + 67 89 02 2C 67 89 02 0C 67 89 02 2C 67 79 02 28 \ + 67 79 02 24 67 79 02 20 67 79 02 10 67 79 02 0C \ + 67 79 02 0B 60 FF 28 32 0F 87 67 56 96 FF 06 FF \ + D2 FF 74 46 3A 36 32 07 32 08 C7 32 04 C7 97 71 \ + 63 77 75 32 00 32 01 B7 97 71 6F 32 0E 77 77 26 \ + FD 97 27 77 77 32 0F 87 57 12 A0 F8 15 1A 01 75 \ + 85 28 67 56 57 32 0F 87 57 12 A0 F8 15 1A 01 71 \ + A1 28 67 56 80 28 67 56 80 28 67 56 80 28 67 56 \ + 57 32 0F 87 32 0F 87 32 0F 87 32 0F 87 57 00 00 +led 1 start diff --git a/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/port_config.ini b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/port_config.ini new file mode 100644 index 000000000000..8eeb6a993cb5 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias +Ethernet0 41 twentyfiveGigE1 +Ethernet1 42 twentyfiveGigE2 +Ethernet2 43 twentyfiveGigE3 +Ethernet3 44 twentyfiveGigE4 +Ethernet4 49 twentyfiveGigE5 +Ethernet5 50 twentyfiveGigE6 +Ethernet6 51 twentyfiveGigE7 +Ethernet7 52 twentyfiveGigE8 +Ethernet8 53 twentyfiveGigE9 +Ethernet9 54 twentyfiveGigE10 +Ethernet10 55 twentyfiveGigE11 +Ethernet11 56 twentyfiveGigE12 +Ethernet12 65 twentyfiveGigE13 +Ethernet13 66 twentyfiveGigE14 +Ethernet14 67 twentyfiveGigE15 +Ethernet15 68 twentyfiveGigE16 +Ethernet16 33 twentyfiveGigE17 +Ethernet17 34 twentyfiveGigE18 +Ethernet18 35 twentyfiveGigE19 +Ethernet19 36 twentyfiveGigE20 +Ethernet20 37 twentyfiveGigE21 +Ethernet21 38 twentyfiveGigE22 +Ethernet22 39 twentyfiveGigE23 +Ethernet23 40 twentyfiveGigE24 +Ethernet24 69 twentyfiveGigE25 +Ethernet25 70 twentyfiveGigE26 +Ethernet26 71 twentyfiveGigE27 +Ethernet27 72 twentyfiveGigE28 +Ethernet28 81 twentyfiveGigE29 +Ethernet29 82 twentyfiveGigE30 +Ethernet30 83 twentyfiveGigE31 +Ethernet31 84 twentyfiveGigE32 +Ethernet32 85 twentyfiveGigE33 +Ethernet33 86 twentyfiveGigE34 +Ethernet34 87 twentyfiveGigE35 +Ethernet35 88 twentyfiveGigE36 +Ethernet36 97 twentyfiveGigE37 +Ethernet37 98 twentyfiveGigE38 +Ethernet38 99 twentyfiveGigE39 +Ethernet39 100 twentyfiveGigE40 +Ethernet40 101 twentyfiveGigE41 +Ethernet41 102 twentyfiveGigE42 +Ethernet42 103 twentyfiveGigE43 +Ethernet43 104 twentyfiveGigE44 +Ethernet44 105 twentyfiveGigE45 +Ethernet45 106 twentyfiveGigE46 +Ethernet46 107 twentyfiveGigE47 +Ethernet47 108 twentyfiveGigE48 +Ethernet48 5,6,7,8 hundredGigE49 +Ethernet52 1,2,3,4 hundredGigE50 +Ethernet56 109,110,111,112 hundredGigE51 +Ethernet60 21,22,23,24 hundredGigE52 +Ethernet64 9,10,11,12 hundredGigE53 +Ethernet68 117,118,119,120 hundredGigE54 diff --git a/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile new file mode 100644 index 000000000000..f239b822834b --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7312-48x25G+6x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7312_54x-r0/installer.conf b/device/accton/x86_64-accton_as7312_54x-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7312_54x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7312_54x-r0/led_proc_init.soc new file mode 100755 index 000000000000..3074649497e0 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/led_proc_init.soc @@ -0,0 +1,79 @@ +# accton_as7312_54x 48x25G+6x100G SDK port LED macro init SOC +s CMIC_LEDUP0_DATA_RAM 0 +s CMIC_LEDUP1_DATA_RAM 0 + +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=63 REMAP_PORT_1=63 REMAP_PORT_2=63 REMAP_PORT_3=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=63 REMAP_PORT_5=63 REMAP_PORT_6=63 REMAP_PORT_7=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=27 REMAP_PORT_9=26 REMAP_PORT_10=25 REMAP_PORT_11=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=63 REMAP_PORT_18=63 REMAP_PORT_19=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=31 REMAP_PORT_21=30 REMAP_PORT_22=29 REMAP_PORT_23=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=15 REMAP_PORT_25=14 REMAP_PORT_26=13 REMAP_PORT_27=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=19 REMAP_PORT_29=18 REMAP_PORT_30=17 REMAP_PORT_31=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=63 REMAP_PORT_34=63 REMAP_PORT_35=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=63 REMAP_PORT_37=63 REMAP_PORT_38=63 REMAP_PORT_39=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 REMAP_PORT_41=34 REMAP_PORT_42=33 REMAP_PORT_43=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=23 REMAP_PORT_49=22 REMAP_PORT_50=21 REMAP_PORT_51=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=19 REMAP_PORT_1=18 REMAP_PORT_2=17 REMAP_PORT_3=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=23 REMAP_PORT_5=22 REMAP_PORT_6=21 REMAP_PORT_7=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=3 REMAP_PORT_9=2 REMAP_PORT_10=1 REMAP_PORT_11=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=7 REMAP_PORT_17=6 REMAP_PORT_18=5 REMAP_PORT_19=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=63 REMAP_PORT_25=63 REMAP_PORT_26=63 REMAP_PORT_27=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=63 REMAP_PORT_29=63 REMAP_PORT_30=63 REMAP_PORT_31=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=15 REMAP_PORT_33=14 REMAP_PORT_34=13 REMAP_PORT_35=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=27 REMAP_PORT_37=26 REMAP_PORT_38=25 REMAP_PORT_39=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=63 REMAP_PORT_41=63 REMAP_PORT_42=63 REMAP_PORT_43=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=31 REMAP_PORT_49=30 REMAP_PORT_50=29 REMAP_PORT_51=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=35 REMAP_PORT_53=34 REMAP_PORT_54=33 REMAP_PORT_55=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=63 REMAP_PORT_57=63 REMAP_PORT_58=63 REMAP_PORT_59=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=63 REMAP_PORT_62=63 REMAP_PORT_63=63 + +led 0 stop +led 0 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start +led auto on + +led 1 stop +led 1 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 1 start +led auto on diff --git a/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml new file mode 100644 index 000000000000..8547ceacbc58 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml @@ -0,0 +1,1184 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 65200 + ARISTA02T2 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 65200 + ARISTA04T2 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 65200 + ARISTA06T2 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 65200 + ARISTA08T2 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 65200 + ARISTA10T2 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 65200 + ARISTA12T2 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 65200 + ARISTA14T2 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + switch1 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet1 + 10.0.0.2/31 + + + + Ethernet2 + 10.0.0.4/31 + + + + Ethernet3 + 10.0.0.6/31 + + + + Ethernet4 + 10.0.0.8/31 + + + + Ethernet5 + 10.0.0.10/31 + + + + Ethernet6 + 10.0.0.12/31 + + + + Ethernet7 + 10.0.0.14/31 + + + + Ethernet8 + 10.0.0.16/31 + + + + Ethernet9 + 10.0.0.18/31 + + + + Ethernet10 + 10.0.0.20/31 + + + + Ethernet11 + 10.0.0.22/31 + + + + Ethernet12 + 10.0.0.24/31 + + + + Ethernet13 + 10.0.0.26/31 + + + + Ethernet14 + 10.0.0.28/31 + + + + Ethernet15 + 10.0.0.30/31 + + + + Ethernet16 + 10.0.0.32/31 + + + + Ethernet17 + 10.0.0.34/31 + + + + Ethernet18 + 10.0.0.36/31 + + + + Ethernet19 + 10.0.0.38/31 + + + + Ethernet20 + 10.0.0.40/31 + + + + Ethernet21 + 10.0.0.42/31 + + + + Ethernet22 + 10.0.0.44/31 + + + + Ethernet23 + 10.0.0.46/31 + + + + Ethernet24 + 10.0.0.48/31 + + + + Ethernet25 + 10.0.0.50/31 + + + + Ethernet26 + 10.0.0.52/31 + + + + Ethernet27 + 10.0.0.54/31 + + + + Ethernet28 + 10.0.0.56/31 + + + + Ethernet29 + 10.0.0.58/31 + + + + Ethernet30 + 10.0.0.60/31 + + + + Ethernet31 + 10.0.0.62/31 + + + + Ethernet32 + 10.0.0.64/31 + + + + Ethernet33 + 10.0.0.66/31 + + + + Ethernet34 + 10.0.0.68/31 + + + + Ethernet35 + 10.0.0.70/31 + + + + Ethernet36 + 10.0.0.72/31 + + + + Ethernet37 + 10.0.0.74/31 + + + + Ethernet38 + 10.0.0.76/31 + + + + Ethernet39 + 10.0.0.78/31 + + + + Ethernet40 + 10.0.0.80/31 + + + + Ethernet41 + 10.0.0.82/31 + + + + Ethernet42 + 10.0.0.84/31 + + + + Ethernet43 + 10.0.0.86/31 + + + + Ethernet44 + 10.0.0.88/31 + + + + Ethernet45 + 10.0.0.90/31 + + + + Ethernet46 + 10.0.0.92/31 + + + + Ethernet47 + 10.0.0.94/31 + + + + Ethernet48 + 10.0.0.96/31 + + + + Ethernet52 + 10.0.0.98/31 + + + + Ethernet56 + 10.0.0.100/31 + + + + Ethernet60 + 10.0.0.102/31 + + + + Ethernet64 + 10.0.0.104/31 + + + + Ethernet68 + 10.0.0.106/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet1 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet2 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet3 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet5 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet6 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet7 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet9 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet10 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet11 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet13 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet14 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet15 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet17 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet18 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet19 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet21 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet22 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet23 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet25 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet26 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet27 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet29 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet30 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet31 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Accton-AS7312-54X + + + + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch1 + Accton-AS7312-54X +
diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini index dea477b26152..1cc6c91b1308 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 125,126,127,128 Ethernet1/1 1 Ethernet4 121,122,123,124 Ethernet2/1 2 Ethernet8 13,14,15,16 Ethernet3/1 3 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini index 32fa6885fa93..b57f14497e39 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 125,126,127,128 Ethernet1/1 1 Ethernet4 121,122,123,124 Ethernet2/1 2 Ethernet8 13,14,15,16 Ethernet3/1 3 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini index cb36404ac44f..fda62e998c1a 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 9,10,11,12 Ethernet5/1 5 Ethernet4 13,14,15,16 Ethernet6/1 6 Ethernet8 17,18,19,20 Ethernet7/1 7 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini index c1dbcfabd9e3..bfe4a721141d 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 33,34,35,36 Ethernet1/1 1 Ethernet4 37,38,39,40 Ethernet2/1 2 Ethernet8 41,42,43,44 Ethernet3/1 3 diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/led_control.py b/device/arista/x86_64-arista_7060_cx32s/plugins/led_control.py new file mode 100644 index 000000000000..8d387e513c6c --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/plugins/led_control.py @@ -0,0 +1,6 @@ +try: + import arista.utils.sonic_leds as arista_leds +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +LedControl = arista_leds.getLedControl() diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini index 4f073e46dce3..1119dfd231c6 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 77,78,79,80 Ethernet1/1 1 Ethernet4 65,66,67,68 Ethernet2/1 2 Ethernet8 85,86,87,88 Ethernet3/1 3 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini index b06d1c7575d4..35a2175cf21d 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 77,78 Ethernet1/1 1 Ethernet2 79,80 Ethernet1/3 2 Ethernet4 65,66 Ethernet2/1 3 diff --git a/device/arista/x86_64-arista_7260cx3_64/plugins/led_control.py b/device/arista/x86_64-arista_7260cx3_64/plugins/led_control.py new file mode 100644 index 000000000000..8d387e513c6c --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/plugins/led_control.py @@ -0,0 +1,6 @@ +try: + import arista.utils.sonic_leds as arista_leds +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +LedControl = arista_leds.getLedControl() diff --git a/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc b/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc index fb898fcadfc1..450533c0dc68 100755 --- a/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc +++ b/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc @@ -1,11 +1,8 @@ - -# Download LED code into LED processor and enable (if applicable). - -led 0 load /usr/share/sonic/platform/led-code/ledcode0; -led 0 auto on; led 0 start; -led 1 load /usr/share/sonic/platform/led-code/ledcode1; -led 1 auto on; led 1 start; -led 2 load /usr/share/sonic/platform/led-code/ledcode2; -led 2 auto on; led 2 start - - +# Download LED code into LED processor and enable (if applicable). + +led 0 load /usr/share/sonic/platform/led-code/ledcode0; +led 0 auto on; led 0 start; +led 1 load /usr/share/sonic/platform/led-code/ledcode1; +led 1 auto on; led 1 start; +led 2 load /usr/share/sonic/platform/led-code/ledcode2; +led 2 auto on; led 2 start diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg b/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg deleted file mode 100644 index 058b1a9ea118..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg +++ /dev/null @@ -1,44 +0,0 @@ -# -# Grub config to launch SONiC -# with ONIE boot option - -insmod serial -# Initialize USB-Serial com2 port -serial --unit=1 --speed=9600 -#Serial port config;Defaults: COM1,9600 -serial --unit=0 --speed=9600 -terminal_output serial_com0 -terminal_input serial_com0 -#terminfo added to prevent text wrap issue. -terminfo -g 80x100 serial_com0 -terminfo -g 80x100 serial_com1 - -echo -n "Press Esc to stop autoboot ... " -if sleep --verbose --interruptible 5 ; then - insmod gzio - insmod part_msdos - insmod ext2 - set root='(hd0,gpt8)' - linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor - initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 - boot -else - menuentry 'SONiC' { - insmod gzio - insmod part_msdos - insmod ext2 - set root='(hd0,gpt8)' - linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor - initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 - boot - } - - menuentry 'ONIE' { - insmod force10 - onieboot - } - - menuentry 'DELL-DIAG' { - delldiagboot - } -fi diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg b/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg deleted file mode 100644 index 058b1a9ea118..000000000000 --- a/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg +++ /dev/null @@ -1,44 +0,0 @@ -# -# Grub config to launch SONiC -# with ONIE boot option - -insmod serial -# Initialize USB-Serial com2 port -serial --unit=1 --speed=9600 -#Serial port config;Defaults: COM1,9600 -serial --unit=0 --speed=9600 -terminal_output serial_com0 -terminal_input serial_com0 -#terminfo added to prevent text wrap issue. -terminfo -g 80x100 serial_com0 -terminfo -g 80x100 serial_com1 - -echo -n "Press Esc to stop autoboot ... " -if sleep --verbose --interruptible 5 ; then - insmod gzio - insmod part_msdos - insmod ext2 - set root='(hd0,gpt8)' - linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor - initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 - boot -else - menuentry 'SONiC' { - insmod gzio - insmod part_msdos - insmod ext2 - set root='(hd0,gpt8)' - linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor - initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 - boot - } - - menuentry 'ONIE' { - insmod force10 - onieboot - } - - menuentry 'DELL-DIAG' { - delldiagboot - } -fi diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini index fb9235101108..bf87e1402ab1 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 37,38,39,40 -Ethernet4 33,34,35,36 -Ethernet8 45,46,47,48 -Ethernet12 41,42,43,44 -Ethernet16 53,54,55,56 -Ethernet20 49,50,51,52 -Ethernet24 61,62,63,64 -Ethernet28 57,58,59,60 -Ethernet32 69,70,71,72 -Ethernet36 65,66,67,68 -Ethernet40 77,78,79,80 -Ethernet44 73,74,75,76 -Ethernet48 85,86,87,88 -Ethernet52 81,82,83,84 -Ethernet56 93,94,95,96 -Ethernet60 89,90,91,92 -Ethernet64 101,102,103,104 -Ethernet68 97,98,99,100 -Ethernet72 109,110,111,112 -Ethernet76 105,106,107,108 -Ethernet80 117,118,119,120 -Ethernet84 113,114,115,116 -Ethernet88 125,126,127,128 -Ethernet92 121,122,123,124 -Ethernet96 5,6,7,8 -Ethernet100 1,2,3,4 -Ethernet104 13,14,15,16 -Ethernet108 9,10,11,12 -Ethernet112 21,22,23,24 -Ethernet116 17,18,19,20 -Ethernet120 29,30,31,32 -Ethernet124 25,26,27,28 +# name lanes alias index +Ethernet0 37,38,39,40 Ethernet1/1 0 +Ethernet4 33,34,35,36 Ethernet2/1 1 +Ethernet8 45,46,47,48 Ethernet3/1 2 +Ethernet12 41,42,43,44 Ethernet4/1 3 +Ethernet16 53,54,55,56 Ethernet5/1 4 +Ethernet20 49,50,51,52 Ethernet6/1 5 +Ethernet24 61,62,63,64 Ethernet7/1 6 +Ethernet28 57,58,59,60 Ethernet8/1 7 +Ethernet32 69,70,71,72 Ethernet9/1 8 +Ethernet36 65,66,67,68 Ethernet10/1 9 +Ethernet40 77,78,79,80 Ethernet11/1 10 +Ethernet44 73,74,75,76 Ethernet12/1 11 +Ethernet48 85,86,87,88 Ethernet13/1 12 +Ethernet52 81,82,83,84 Ethernet14/1 13 +Ethernet56 93,94,95,96 Ethernet15/1 14 +Ethernet60 89,90,91,92 Ethernet16/1 15 +Ethernet64 101,102,103,104 Ethernet17/1 16 +Ethernet68 97,98,99,100 Ethernet18/1 17 +Ethernet72 109,110,111,112 Ethernet19/1 18 +Ethernet76 105,106,107,108 Ethernet20/1 19 +Ethernet80 117,118,119,120 Ethernet21/1 20 +Ethernet84 113,114,115,116 Ethernet22/1 21 +Ethernet88 125,126,127,128 Ethernet23/1 22 +Ethernet92 121,122,123,124 Ethernet24/1 23 +Ethernet96 5,6,7,8 Ethernet25/1 24 +Ethernet100 1,2,3,4 Ethernet26/1 25 +Ethernet104 13,14,15,16 Ethernet27/1 26 +Ethernet108 9,10,11,12 Ethernet28/1 27 +Ethernet112 21,22,23,24 Ethernet29/1 28 +Ethernet116 17,18,19,20 Ethernet30/1 29 +Ethernet120 29,30,31,32 Ethernet31/1 30 +Ethernet124 25,26,27,28 Ethernet32/1 31 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol index 05a71e8d999c..8c378371a9a2 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol @@ -1,12 +1,11 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon2=w83795adg -FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input -#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input -FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input -MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 -MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 -MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 -MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon1/device/temp2_input hwmon1/device/pwm1=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20 +MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60 +MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75 +MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py index 7bc71c27eeb6..bef254484ac4 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py @@ -1,61 +1,147 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - - -class sfputil(sfputilbase): - """Platform specific sfputil class""" - - port_start = 0 - port_end = 31 - ports_in_block = 32 - - port_to_eeprom_mapping = {} - #FIXME - port_to_i2c_mapping = { - 0: 18, - 1: 19, - 2: 20, - 3: 21, - 4: 22, - 5: 23, - 6: 24, - 7: 25, - 8: 26, - 9: 27, - 10: 28, - 11: 29, - 12: 30, - 13: 31, - 14: 32, - 15: 33, - 16: 34, - 17: 35, - 18: 36, - 19: 37, - 20: 38, - 21: 39, - 22: 40, - 23: 41, - 24: 42, - 25: 43, - 26: 44, - 27: 45, - 28: 46, - 29: 47, - 30: 48, - 31: 49 - } - - _qsfp_ports = range(0, ports_in_block + 1) - - def __init__(self, port_num): + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + EEPROM_OFFSET = 18 + + ABS_GPIO_BASE = 224 + #INT_GPIO_BASE = 192 + LP_GPIO_BASE = 160 + RST_GPIO_BASE = 128 + + BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" + BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" + + _port_to_eeprom_mapping = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + for x in range(self.port_start, self.port_end + 1): - port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) - self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + abs_device_file = self.BASE_VAL_PATH.format( + port_num + self.ABS_GPIO_BASE) + val_file = open(abs_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + port_num + self.LP_GPIO_BASE) + val_file = open(lpmode_val_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + port_num + self.LP_GPIO_BASE) + val_file = open(lpmode_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1" if lpmode is True else "0") + val_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + port_num + self.RST_GPIO_BASE) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1") + val_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + port_num + self.RST_GPIO_BASE) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("0") + val_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini index 24a2b8e29222..3350b68172cb 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini @@ -1,55 +1,55 @@ -# name lanes alias -Ethernet0 1 -Ethernet1 2 -Ethernet2 3 -Ethernet3 4 -Ethernet4 5 -Ethernet5 6 -Ethernet6 7 -Ethernet7 8 -Ethernet8 9 -Ethernet9 10 -Ethernet10 11 -Ethernet11 12 -Ethernet12 21 -Ethernet13 22 -Ethernet14 23 -Ethernet15 24 -Ethernet16 33 -Ethernet17 34 -Ethernet18 35 -Ethernet19 36 -Ethernet20 37 -Ethernet21 38 -Ethernet22 39 -Ethernet23 40 -Ethernet24 41 -Ethernet25 42 -Ethernet26 43 -Ethernet27 44 -Ethernet28 49 -Ethernet29 50 -Ethernet30 51 -Ethernet31 52 -Ethernet32 53 -Ethernet33 54 -Ethernet34 55 -Ethernet35 56 -Ethernet36 65 -Ethernet37 66 -Ethernet38 67 -Ethernet39 68 -Ethernet40 69 -Ethernet41 70 -Ethernet42 71 -Ethernet43 72 -Ethernet44 81 -Ethernet45 82 -Ethernet46 83 -Ethernet47 84 -Ethernet48 85,86,87,88 -Ethernet52 97,98,99,100 -Ethernet56 101,102,103,104 -Ethernet60 105,106,107,108 -Ethernet64 109,110,111,112 -Ethernet68 117,118,119,120 +# name lanes alias index +Ethernet0 1 Ethernet1 0 +Ethernet1 2 Ethernet2 1 +Ethernet2 3 Ethernet3 2 +Ethernet3 4 Ethernet4 3 +Ethernet4 5 Ethernet5 4 +Ethernet5 6 Ethernet6 5 +Ethernet6 7 Ethernet7 6 +Ethernet7 8 Ethernet8 7 +Ethernet8 9 Ethernet9 8 +Ethernet9 10 Ethernet10 9 +Ethernet10 11 Ethernet11 10 +Ethernet11 12 Ethernet12 11 +Ethernet12 21 Ethernet13 12 +Ethernet13 22 Ethernet14 13 +Ethernet14 23 Ethernet15 14 +Ethernet15 24 Ethernet16 15 +Ethernet16 33 Ethernet17 16 +Ethernet17 34 Ethernet18 17 +Ethernet18 35 Ethernet19 18 +Ethernet19 36 Ethernet20 19 +Ethernet20 37 Ethernet21 20 +Ethernet21 38 Ethernet22 21 +Ethernet22 39 Ethernet23 22 +Ethernet23 40 Ethernet24 23 +Ethernet24 41 Ethernet25 24 +Ethernet25 42 Ethernet26 25 +Ethernet26 43 Ethernet27 26 +Ethernet27 44 Ethernet28 27 +Ethernet28 49 Ethernet29 28 +Ethernet29 50 Ethernet30 29 +Ethernet30 51 Ethernet31 30 +Ethernet31 52 Ethernet32 31 +Ethernet32 53 Ethernet33 32 +Ethernet33 54 Ethernet34 33 +Ethernet34 55 Ethernet35 34 +Ethernet35 56 Ethernet36 35 +Ethernet36 65 Ethernet37 36 +Ethernet37 66 Ethernet38 37 +Ethernet38 67 Ethernet39 38 +Ethernet39 68 Ethernet40 39 +Ethernet40 69 Ethernet41 40 +Ethernet41 70 Ethernet42 41 +Ethernet42 71 Ethernet43 42 +Ethernet43 72 Ethernet44 43 +Ethernet44 81 Ethernet45 44 +Ethernet45 82 Ethernet46 45 +Ethernet46 83 Ethernet47 46 +Ethernet47 84 Ethernet48 47 +Ethernet48 85,86,87,88 Ethernet49/1 48 +Ethernet52 97,98,99,100 Ethernet50/1 49 +Ethernet56 101,102,103,104 Ethernet51/1 50 +Ethernet60 105,106,107,108 Ethernet52/1 51 +Ethernet64 109,110,111,112 Ethernet53/1 52 +Ethernet68 117,118,119,120 Ethernet54/1 53 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol index 827b0539546f..e1f88f6b79c5 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol @@ -1,11 +1,10 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon2=w83795adg -FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input -#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input -FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input -MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 -MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 -MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 -MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon1/device/temp2_input hwmon1/device/pwm1=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20 +MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60 +MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75 +MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml index 470b07922b9d..98c87eb8af0e 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml @@ -1,121 +1,121 @@ - - - - - - OCPSCH0104001MS - 10.10.1.30 - OCPSCH01040HHLF - 10.10.1.29 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.30 - OCPSCH01040HHLF - 10.10.2.29 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040HHLF - - -
10.10.1.30
- - -
- -
10.10.2.30
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.10/32 - - 100.0.0.10/32 - - - - - - - - OCPSCH01040HHLF - - - - - - Ethernet48 - 10.10.1.29/30 - - - - Ethernet52 - 10.10.2.29/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet48 - OCPSCH01040HHLF - Ethernet48 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet0 - OCPSCH01040HHLF - Ethernet52 - - - - - OCPSCH01040HHLF - INGRASYS-S8900-54XC - - - - OCPSCH01040HHLF - INGRASYS-S8900-54XC -
+ + + + + + OCPSCH0104001MS + 10.10.1.30 + OCPSCH01040HHLF + 10.10.1.29 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.30 + OCPSCH01040HHLF + 10.10.2.29 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040HHLF + + +
10.10.1.30
+ + +
+ +
10.10.2.30
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.10/32 + + 100.0.0.10/32 + + + + + + + + OCPSCH01040HHLF + + + + + + Ethernet48 + 10.10.1.29/30 + + + + Ethernet52 + 10.10.2.29/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet48 + OCPSCH01040HHLF + Ethernet48 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet0 + OCPSCH01040HHLF + Ethernet52 + + + + + OCPSCH01040HHLF + INGRASYS-S8900-54XC + + + + OCPSCH01040HHLF + INGRASYS-S8900-54XC +
diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py index 96fa0fca86ce..0bb52e88616a 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py @@ -1,19 +1,27 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) -class sfputil(sfputilbase): - """Platform specific sfputil class""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 53 - ports_in_block = 54 + PORT_START = 0 + PORT_END = 53 + QSFP_PORT_START = 48 + PORTS_IN_BLOCK = 54 + + BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" + BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 0: 18, 1: 19, @@ -71,12 +79,201 @@ class sfputil(sfputilbase): 53: 71 } - _qsfp_ports = range(0, ports_in_block + 1) + abs_to_gpio_mapping = { + 0: 192, + 1: 193, + 2: 194, + 3: 195, + 4: 196, + 5: 197, + 6: 198, + 7: 199, + 8: 200, + 9: 201, + 10: 202, + 11: 203, + 12: 204, + 13: 205, + 14: 206, + 15: 207, + 16: 176, + 17: 177, + 18: 178, + 19: 179, + 20: 180, + 21: 181, + 22: 182, + 23: 183, + 24: 184, + 25: 185, + 26: 186, + 27: 187, + 28: 188, + 29: 189, + 30: 190, + 31: 191, + 32: 160, + 33: 161, + 34: 162, + 35: 163, + 36: 164, + 37: 165, + 38: 166, + 39: 167, + 40: 168, + 41: 169, + 42: 170, + 43: 171, + 44: 172, + 45: 173, + 46: 174, + 47: 175, + 48: 240, + 49: 241, + 50: 242, + 51: 243, + 52: 244, + 53: 245 + } + + lpmode_to_gpio_mapping = { + 48: 224, + 49: 225, + 50: 226, + 51: 227, + 52: 228, + 53: 229 + } + + reset_to_gpio_mapping = { + 48: 208, + 49: 209, + 50: 210, + 51: 211, + 52: 212, + 53: 213 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START - def __init__(self, port_num): + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + abs_device_file = self.BASE_VAL_PATH.format( + self.abs_to_gpio_mapping[port_num]) + val_file = open(abs_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1" if lpmode is True else "0") + val_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + print "Error: unable to reset non-QSFP module: port %s" % str(port_num) + return False + + try: + print "port %s" % str(port_num) + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1") + val_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("0") + val_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini index 3e5c7be570e1..b950538edba7 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini @@ -1,65 +1,65 @@ -# name lanes alias -Ethernet0 17 -Ethernet1 18 -Ethernet2 19 -Ethernet3 20 -Ethernet4 24 -Ethernet5 23 -Ethernet6 22 -Ethernet7 21 -Ethernet8 28 -Ethernet9 27 -Ethernet10 26 -Ethernet11 25 -Ethernet12 32 -Ethernet13 31 -Ethernet14 30 -Ethernet15 29 -Ethernet16 1 -Ethernet17 2 -Ethernet18 3 -Ethernet19 4 -Ethernet20 8 -Ethernet21 7 -Ethernet22 6 -Ethernet23 5 -Ethernet24 12 -Ethernet25 11 -Ethernet26 10 -Ethernet27 9 -Ethernet28 13 -Ethernet29 14 -Ethernet30 15 -Ethernet31 16 -Ethernet32 33 -Ethernet33 34 -Ethernet34 35 -Ethernet35 36 -Ethernet36 38 -Ethernet37 39 -Ethernet38 40 -Ethernet39 37 -Ethernet40 41 -Ethernet41 42 -Ethernet42 43 -Ethernet43 44 -Ethernet44 48 -Ethernet45 45 -Ethernet46 46 -Ethernet47 47 -Ethernet48 49,50,51,52 -Ethernet52 53,54,55,56 -Ethernet56 57,58,59,60 -Ethernet60 61,62,63,64 -Ethernet64 65,66,67,68 -Ethernet68 69,70,71,72 -Ethernet72 73,74,75,76 -Ethernet76 77,78,79,80 -Ethernet80 81,82,83,84 -Ethernet84 85,86,87,88 -Ethernet88 89,90,91,92 -Ethernet92 93,94,95,96 -Ethernet96 97,98,99,100 -Ethernet100 101,102,103,104 -Ethernet104 105,106,107,108 -Ethernet108 109,110,111,112 +# name lanes alias index +Ethernet0 17 Ethernet1 0 +Ethernet1 18 Ethernet2 1 +Ethernet2 19 Ethernet3 2 +Ethernet3 20 Ethernet4 3 +Ethernet4 24 Ethernet5 4 +Ethernet5 23 Ethernet6 5 +Ethernet6 22 Ethernet7 6 +Ethernet7 21 Ethernet8 7 +Ethernet8 28 Ethernet9 8 +Ethernet9 27 Ethernet10 9 +Ethernet10 26 Ethernet11 10 +Ethernet11 25 Ethernet12 11 +Ethernet12 32 Ethernet13 12 +Ethernet13 31 Ethernet14 13 +Ethernet14 30 Ethernet15 14 +Ethernet15 29 Ethernet16 15 +Ethernet16 1 Ethernet17 16 +Ethernet17 2 Ethernet18 17 +Ethernet18 3 Ethernet19 18 +Ethernet19 4 Ethernet20 19 +Ethernet20 8 Ethernet21 20 +Ethernet21 7 Ethernet22 21 +Ethernet22 6 Ethernet23 22 +Ethernet23 5 Ethernet24 23 +Ethernet24 12 Ethernet25 24 +Ethernet25 11 Ethernet26 25 +Ethernet26 10 Ethernet27 26 +Ethernet27 9 Ethernet28 27 +Ethernet28 13 Ethernet29 28 +Ethernet29 14 Ethernet30 29 +Ethernet30 15 Ethernet31 30 +Ethernet31 16 Ethernet32 31 +Ethernet32 33 Ethernet33 32 +Ethernet33 34 Ethernet34 33 +Ethernet34 35 Ethernet35 34 +Ethernet35 36 Ethernet36 35 +Ethernet36 38 Ethernet37 36 +Ethernet37 39 Ethernet38 37 +Ethernet38 40 Ethernet39 38 +Ethernet39 37 Ethernet40 39 +Ethernet40 41 Ethernet41 40 +Ethernet41 42 Ethernet42 41 +Ethernet42 43 Ethernet43 42 +Ethernet43 44 Ethernet44 43 +Ethernet44 48 Ethernet45 44 +Ethernet45 45 Ethernet46 45 +Ethernet46 46 Ethernet47 46 +Ethernet47 47 Ethernet48 47 +Ethernet48 49,50,51,52 Ethernet49/1 48 +Ethernet52 53,54,55,56 Ethernet50/1 49 +Ethernet56 57,58,59,60 Ethernet51/1 50 +Ethernet60 61,62,63,64 Ethernet52/1 51 +Ethernet64 65,66,67,68 Ethernet53/1 52 +Ethernet68 69,70,71,72 Ethernet54/1 53 +Ethernet72 73,74,75,76 Ethernet55/1 54 +Ethernet76 77,78,79,80 Ethernet56/1 55 +Ethernet80 81,82,83,84 Ethernet57/1 56 +Ethernet84 85,86,87,88 Ethernet58/1 57 +Ethernet88 89,90,91,92 Ethernet59/1 58 +Ethernet92 93,94,95,96 Ethernet60/1 59 +Ethernet96 97,98,99,100 Ethernet61/1 60 +Ethernet100 101,102,103,104 Ethernet62/1 61 +Ethernet104 105,106,107,108 Ethernet63/1 62 +Ethernet108 109,110,111,112 Ethernet64/1 63 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol index cb07a7a07f4a..4819fe113172 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol @@ -1,10 +1,10 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon2=w83795adg -FCTEMPS=hwmon2/device/pwm1=hwmon2/device/temp2_input hwmon2/device/pwm2=hwmon2/device/temp2_input -FCFANS=hwmon2/device/pwm2=hwmon2/device/fan10_input hwmon2/device/pwm2=hwmon2/device/fan9_input hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input -MINTEMP=hwmon2/device/pwm1=20 hwmon2/device/pwm2=20 -MAXTEMP=hwmon2/device/pwm1=60 hwmon2/device/pwm2=60 -MINSTART=hwmon2/device/pwm1=150 hwmon2/device/pwm2=150 -MINSTOP=hwmon2/device/pwm1=0 hwmon2/device/pwm2=0 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm1=hwmon1/device/temp2_input hwmon1/device/pwm2=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan10_input hwmon1/device/pwm2=hwmon1/device/fan9_input hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm1=20 hwmon1/device/pwm2=20 +MAXTEMP=hwmon1/device/pwm1=60 hwmon1/device/pwm2=60 +MINSTART=hwmon1/device/pwm1=150 hwmon1/device/pwm2=150 +MINSTOP=hwmon1/device/pwm1=0 hwmon1/device/pwm2=0 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml index fe96dc87acf6..8a7d765cefc1 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml @@ -1,359 +1,359 @@ - - - - - - BGPSession - OCPSCH0104001MS - 10.10.1.2 - OCPSCH01040AALF - 10.10.1.1 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.6 - OCPSCH01040BBLF - 10.10.1.5 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.10 - OCPSCH01040CCLF - 10.10.1.9 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.14 - OCPSCH01040DDLF - 10.10.1.13 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.18 - OCPSCH01040EELF - 10.10.1.17 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.22 - OCPSCH01040FFLF - 10.10.1.21 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.30 - OCPSCH01040HHLF - 10.10.1.29 - 1 - 10 - 3 - - - - - 64542 - OCPSCH0104001MS - - - BGPPeer -
10.10.1.2
- - -
- - BGPPeer -
10.10.1.6
- - -
- - BGPPeer -
10.10.1.10
- - -
- - BGPPeer -
10.10.1.14
- - -
- - BGPPeer -
10.10.1.18
- - -
- - BGPPeer -
10.10.1.22
- - -
- - BGPPeer -
10.10.1.26
- - -
- - BGPPeer -
10.10.1.30
- - -
-
- -
- - 64536 - OCPSCH01040AALF - - - - 64536 - OCPSCH01040BBLF - - - - 64536 - OCPSCH01040CCLF - - - - 64536 - OCPSCH01040DDLF - - - - 64536 - OCPSCH01040EELF - - - - 64536 - OCPSCH01040FFLF - - - - 64536 - OCPSCH01040GGLF - - - - 64536 - OCPSCH01040HHLF - - -
-
- - - - - - LoopbackInterface - HostIP - Loopback0 - - 100.0.0.1/32 - - 100.0.0.1/32 - - - - - - - - OCPSCH0104001MS - - - - VlanInterface - Vlan851 - Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet96;Ethernet100;Ethernet104;Ethernet108 - False - 0.0.0.0/0 - - 851 - 10.20.1.0/24 - - - - - IPInterface - - Vlan851 - 10.20.1.1/24 - - - IPInterface - - Ethernet48 - 10.10.1.2/30 - - - IPInterface - - Ethernet52 - 10.10.1.6/30 - - - IPInterface - - Ethernet56 - 10.10.1.10/30 - - - IPInterface - - Ethernet60 - 10.10.1.14/30 - - - IPInterface - - Ethernet64 - 10.10.1.18/30 - - - IPInterface - - Ethernet68 - 10.10.1.22/30 - - - IPInterface - - Ethernet72 - 10.10.1.26/30 - - - IPInterface - - Ethernet76 - 10.10.1.30/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet48 - OCPSCH01040AALF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet52 - OCPSCH01040BBLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet56 - OCPSCH01040CCLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet60 - OCPSCH01040DDLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet64 - OCPSCH01040EELF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet68 - OCPSCH01040FFLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet72 - OCPSCH01040GGLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet76 - OCPSCH01040HHLF - Ethernet48 - - - - - OCPSCH0104001MS - INGRASYS-S8900-64XC - - - - - - - - OCPSCH0104001MS - INGRASYS-S8900-64XC -
+ + + + + + BGPSession + OCPSCH0104001MS + 10.10.1.2 + OCPSCH01040AALF + 10.10.1.1 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.6 + OCPSCH01040BBLF + 10.10.1.5 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.10 + OCPSCH01040CCLF + 10.10.1.9 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.14 + OCPSCH01040DDLF + 10.10.1.13 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.18 + OCPSCH01040EELF + 10.10.1.17 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.22 + OCPSCH01040FFLF + 10.10.1.21 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.30 + OCPSCH01040HHLF + 10.10.1.29 + 1 + 10 + 3 + + + + + 64542 + OCPSCH0104001MS + + + BGPPeer +
10.10.1.2
+ + +
+ + BGPPeer +
10.10.1.6
+ + +
+ + BGPPeer +
10.10.1.10
+ + +
+ + BGPPeer +
10.10.1.14
+ + +
+ + BGPPeer +
10.10.1.18
+ + +
+ + BGPPeer +
10.10.1.22
+ + +
+ + BGPPeer +
10.10.1.26
+ + +
+ + BGPPeer +
10.10.1.30
+ + +
+
+ +
+ + 64536 + OCPSCH01040AALF + + + + 64536 + OCPSCH01040BBLF + + + + 64536 + OCPSCH01040CCLF + + + + 64536 + OCPSCH01040DDLF + + + + 64536 + OCPSCH01040EELF + + + + 64536 + OCPSCH01040FFLF + + + + 64536 + OCPSCH01040GGLF + + + + 64536 + OCPSCH01040HHLF + + +
+
+ + + + + + LoopbackInterface + HostIP + Loopback0 + + 100.0.0.1/32 + + 100.0.0.1/32 + + + + + + + + OCPSCH0104001MS + + + + VlanInterface + Vlan851 + Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet96;Ethernet100;Ethernet104;Ethernet108 + False + 0.0.0.0/0 + + 851 + 10.20.1.0/24 + + + + + IPInterface + + Vlan851 + 10.20.1.1/24 + + + IPInterface + + Ethernet48 + 10.10.1.2/30 + + + IPInterface + + Ethernet52 + 10.10.1.6/30 + + + IPInterface + + Ethernet56 + 10.10.1.10/30 + + + IPInterface + + Ethernet60 + 10.10.1.14/30 + + + IPInterface + + Ethernet64 + 10.10.1.18/30 + + + IPInterface + + Ethernet68 + 10.10.1.22/30 + + + IPInterface + + Ethernet72 + 10.10.1.26/30 + + + IPInterface + + Ethernet76 + 10.10.1.30/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet48 + OCPSCH01040AALF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet52 + OCPSCH01040BBLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet56 + OCPSCH01040CCLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet60 + OCPSCH01040DDLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet64 + OCPSCH01040EELF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet68 + OCPSCH01040FFLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet72 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet76 + OCPSCH01040HHLF + Ethernet48 + + + + + OCPSCH0104001MS + INGRASYS-S8900-64XC + + + + + + + + OCPSCH0104001MS + INGRASYS-S8900-64XC +
diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py index d6573d20d72f..0b1ae8d3bc8e 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py @@ -1,24 +1,30 @@ -#!/usr/bin/env python - -import subprocess +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + import time + import subprocess + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + i2c_set = 'i2cset' +i2c_get = 'i2cget' cpld_addr = '0x33' mux_reg = '0x4A' -class sfputil(sfputilbase): - """Platform specific sfputil class""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 63 - ports_in_block = 64 + PORT_START = 0 + PORT_END = 63 + QSFP_PORT_START = 48 + PORTS_IN_BLOCK = 64 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 0: [2,1], 1: [2,2], @@ -44,64 +50,207 @@ class sfputil(sfputilbase): 21: [2,22], 22: [2,23], 23: [2,24], - 24: [3,1], - 25: [3,2], - 26: [3,3], - 27: [3,4], - 28: [3,5], - 29: [3,6], - 30: [3,7], - 31: [3,8], - 32: [3,9], - 33: [3,10], - 34: [3,11], - 35: [3,12], - 36: [3,13], - 37: [3,14], - 38: [3,15], - 39: [3,16], - 40: [3,17], - 41: [3,18], - 42: [3,19], - 43: [3,20], - 44: [3,21], - 45: [3,22], - 46: [3,23], - 47: [3,24], - 48: [4,1], - 49: [4,2], - 50: [4,3], - 51: [4,4], - 52: [4,5], - 53: [4,6], - 54: [4,7], - 55: [4,8], - 56: [4,9], - 57: [4,10], - 58: [4,11], - 59: [4,12], - 60: [4,13], - 61: [4,14], - 62: [4,15], - 63: [4,16] + 24: [3,25], + 25: [3,26], + 26: [3,27], + 27: [3,28], + 28: [3,29], + 29: [3,30], + 30: [3,31], + 31: [3,32], + 32: [3,33], + 33: [3,34], + 34: [3,35], + 35: [3,36], + 36: [3,37], + 37: [3,38], + 38: [3,39], + 39: [3,40], + 40: [3,41], + 41: [3,42], + 42: [3,43], + 43: [3,44], + 44: [3,45], + 45: [3,46], + 46: [3,47], + 47: [3,48], + 48: [4,49], + 49: [4,50], + 50: [4,51], + 51: [4,52], + 52: [4,53], + 53: [4,54], + 54: [4,55], + 55: [4,56], + 56: [4,57], + 57: [4,58], + 58: [4,59], + 59: [4,60], + 60: [4,61], + 61: [4,62], + 62: [4,63], + 63: [4,64] } + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END - _qsfp_ports = range(0, ports_in_block + 1) + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - i2c_bus = self.port_to_i2c_mapping[port_num][0] - sfp_idx = self.port_to_i2c_mapping[port_num][1] - proc = subprocess.Popen([i2c_set, '-y', str(i2c_bus), cpld_addr, mux_reg, str(sfp_idx)], - stdout=subprocess.PIPE, - shell=False, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping - eeprom_path = '/sys/class/i2c-adapter/i2c-{0[0]}/{0[0]}-0050/eeprom' - for x in range(self.port_start, self.port_end + 1): - port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + def __init__(self): + + sfp_eeprom_path = '/sys/bus/i2c/devices/{0[0]}-0050/sfp{0[1]}' + qsfp_eeprom_path = '/sys/bus/i2c/devices/{0[0]}-0050/qsfp{0[1]}' + for x in range(self.port_start, self.qsfp_port_start): + port_eeprom_path = sfp_eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + for x in range(self.qsfp_port_start, self.port_end + 1): + port_eeprom_path = qsfp_eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_modprs") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # content is a string, either "0" or "1" + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (port_num - self.qsfp_port_start) ) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (port_num - self.qsfp_port_start) ) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_reset" + + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (port_num - self.qsfp_port_start)) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini index d70c717fe4e2..ab0202011576 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 5,6,7,8 -Ethernet4 1,2,3,4 -Ethernet8 13,14,15,16 -Ethernet12 9,10,11,12 -Ethernet16 21,22,23,24 -Ethernet20 17,18,19,20 -Ethernet24 29,30,31,32 -Ethernet28 25,26,27,28 -Ethernet32 37,38,39,40 -Ethernet36 33,34,35,36 -Ethernet40 45,46,47,48 -Ethernet44 41,42,43,44 -Ethernet48 53,54,55,56 -Ethernet52 49,50,51,52 -Ethernet56 61,62,63,64 -Ethernet60 57,58,59,60 -Ethernet64 69,70,71,72 -Ethernet68 65,66,67,68 -Ethernet72 77,78,79,80 -Ethernet76 73,74,75,76 -Ethernet80 85,86,87,88 -Ethernet84 81,82,83,84 -Ethernet88 93,94,95,96 -Ethernet92 89,90,91,92 -Ethernet96 101,102,103,104 -Ethernet100 97,98,99,100 -Ethernet104 109,110,111,112 -Ethernet108 105,106,107,108 -Ethernet112 117,118,119,120 -Ethernet116 113,114,115,116 -Ethernet120 125,126,127,128 -Ethernet124 121,122,123,124 +# name lanes alias index +Ethernet0 5,6,7,8 Ethernet1/1 0 +Ethernet4 1,2,3,4 Ethernet2/1 1 +Ethernet8 13,14,15,16 Ethernet3/1 2 +Ethernet12 9,10,11,12 Ethernet4/1 3 +Ethernet16 21,22,23,24 Ethernet5/1 4 +Ethernet20 17,18,19,20 Ethernet6/1 5 +Ethernet24 29,30,31,32 Ethernet7/1 6 +Ethernet28 25,26,27,28 Ethernet8/1 7 +Ethernet32 37,38,39,40 Ethernet9/1 8 +Ethernet36 33,34,35,36 Ethernet10/1 9 +Ethernet40 45,46,47,48 Ethernet11/1 10 +Ethernet44 41,42,43,44 Ethernet12/1 11 +Ethernet48 53,54,55,56 Ethernet13/1 12 +Ethernet52 49,50,51,52 Ethernet14/1 13 +Ethernet56 61,62,63,64 Ethernet15/1 14 +Ethernet60 57,58,59,60 Ethernet16/1 15 +Ethernet64 69,70,71,72 Ethernet17/1 16 +Ethernet68 65,66,67,68 Ethernet18/1 17 +Ethernet72 77,78,79,80 Ethernet19/1 18 +Ethernet76 73,74,75,76 Ethernet20/1 19 +Ethernet80 85,86,87,88 Ethernet21/1 20 +Ethernet84 81,82,83,84 Ethernet22/1 21 +Ethernet88 93,94,95,96 Ethernet23/1 22 +Ethernet92 89,90,91,92 Ethernet24/1 23 +Ethernet96 101,102,103,104 Ethernet25/1 24 +Ethernet100 97,98,99,100 Ethernet26/1 25 +Ethernet104 109,110,111,112 Ethernet27/1 26 +Ethernet108 105,106,107,108 Ethernet28/1 27 +Ethernet112 117,118,119,120 Ethernet29/1 28 +Ethernet116 113,114,115,116 Ethernet30/1 29 +Ethernet120 125,126,127,128 Ethernet31/1 30 +Ethernet124 121,122,123,124 Ethernet32/1 31 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol index 827b0539546f..e1f88f6b79c5 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol @@ -1,11 +1,10 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon2=w83795adg -FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input -#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input -FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input -MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 -MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 -MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 -MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon1/device/temp2_input hwmon1/device/pwm1=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20 +MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60 +MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75 +MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py index f45502ab9ab4..f4ffc29bebc6 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py @@ -1,19 +1,26 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) -class sfputil(sfputilbase): - """Platform specific sfputil class""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 31 - ports_in_block = 32 + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 - port_to_eeprom_mapping = {} + BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" + BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" + + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 0: 11, 1: 10, @@ -49,12 +56,227 @@ class sfputil(sfputilbase): 31: 40 } - _qsfp_ports = range(0, ports_in_block + 1) + abs_to_gpio_mapping = { + 0: 241, + 1: 240, + 2: 243, + 3: 242, + 4: 245, + 5: 244, + 6: 247, + 7: 246, + 8: 249, + 9: 248, + 10: 251, + 11: 250, + 12: 253, + 13: 252, + 14: 255, + 15: 254, + 16: 225, + 17: 224, + 18: 227, + 19: 226, + 20: 229, + 21: 228, + 22: 231, + 23: 230, + 24: 233, + 25: 232, + 26: 235, + 27: 234, + 28: 237, + 29: 236, + 30: 239, + 31: 238 + } + + lpmode_to_gpio_mapping = { + 0: 177, + 1: 176, + 2: 179, + 3: 178, + 4: 181, + 5: 180, + 6: 183, + 7: 182, + 8: 185, + 9: 184, + 10: 187, + 11: 186, + 12: 189, + 13: 188, + 14: 191, + 15: 190, + 16: 161, + 17: 160, + 18: 163, + 19: 162, + 20: 165, + 21: 164, + 22: 167, + 23: 166, + 24: 169, + 25: 168, + 26: 171, + 27: 170, + 28: 173, + 29: 172, + 30: 175, + 31: 174 + } + + reset_to_gpio_mapping = { + 0: 145, + 1: 144, + 2: 147, + 3: 146, + 4: 149, + 5: 148, + 6: 151, + 7: 150, + 8: 153, + 9: 152, + 10: 155, + 11: 154, + 12: 157, + 13: 156, + 14: 159, + 15: 158, + 16: 129, + 17: 128, + 18: 131, + 19: 130, + 20: 133, + 21: 132, + 22: 135, + 23: 134, + 24: 137, + 25: 136, + 26: 139, + 27: 138, + 28: 141, + 29: 140, + 30: 143, + 31: 142 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) - def __init__(self, port_num): + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + abs_device_file = self.BASE_VAL_PATH.format( + self.abs_to_gpio_mapping[port_num]) + val_file = open(abs_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1" if lpmode is True else "0") + val_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1") + val_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("0") + val_file.close() + + return True diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml index ed21b8d6eeb9..ea765fab814d 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml @@ -2,11 +2,461 @@ + + ARISTA01T0 + 10.0.0.33 + switch2 + 10.0.0.32 + 1 + 180 + 60 + + + switch2 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch2 + 10.0.0.34 + 1 + 180 + 60 + + + switch2 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch2 + 10.0.0.36 + 1 + 180 + 60 + + + switch2 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch2 + 10.0.0.38 + 1 + 180 + 60 + + + switch2 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch2 + 10.0.0.40 + 1 + 180 + 60 + + + switch2 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch2 + 10.0.0.42 + 1 + 180 + 60 + + + switch2 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch2 + 10.0.0.44 + 1 + 180 + 60 + + + switch2 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch2 + 10.0.0.46 + 1 + 180 + 60 + + + switch2 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch2 + 10.0.0.48 + 1 + 180 + 60 + + + switch2 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch2 + 10.0.0.50 + 1 + 180 + 60 + + + switch2 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch2 + 10.0.0.52 + 1 + 180 + 60 + + + switch2 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch2 + 10.0.0.54 + 1 + 180 + 60 + + + switch2 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch2 + 10.0.0.56 + 1 + 180 + 60 + + + switch2 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch2 + 10.0.0.58 + 1 + 180 + 60 + + + switch2 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch2 + 10.0.0.60 + 1 + 180 + 60 + + + switch2 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch2 + 10.0.0.62 + 1 + 180 + 60 + + + switch2 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + 65100 switch2 + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.53
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.55
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.31
+ + +
+
@@ -482,13 +932,237 @@ + + DeviceInterfaceLink + switch2 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet124 + ARISTA16T0 + Ethernet1 + switch2 ACS-MSN2410 - ` + diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index a7e1a1cffb9d..3c6614c4921f 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -25,5 +25,6 @@ RUN rm -rf /debs COPY ["start.sh", "isc-dhcp-relay.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"] +COPY ["wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index 1c50b685ebda..cdedfcf9692b 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -1,25 +1,25 @@ -SERVERS="{{ dhcp_servers | join(' ') }}" +SERVERS="{{ DHCP_SERVER | join(' ') }}" INTERFACES=" {%- set add_preceding_space = { 'flag': False } %} -{%- for interface in minigraph_interfaces %} -{%- if interface['addr'] | ipv4 %} +{%- for (name, prefix) in INTERFACE %} +{%- if prefix | ipv4 %} {%- if add_preceding_space.flag %} {% endif %} -{{ interface['attachto'] }} +{{ name }} {%- set _dummy = add_preceding_space.update({'flag': True}) %} {%- endif %} {%- endfor %} -{%- for vlan_interface in minigraph_vlan_interfaces %} -{%- if vlan_interface['addr'] | ipv4 %} +{%- for (name, prefix) in VLAN_INTERFACE %} +{%- if prefix | ipv4 %} {%- if add_preceding_space.flag %} {% endif %} -{{ vlan_interface['attachto'] }} +{{ name }} {%- set _dummy = add_preceding_space.update({'flag': True}) %} {%- endif %} {%- endfor %} -{%- for pc_interface in minigraph_portchannel_interfaces %} -{%- if pc_interface['addr'] | ipv4 %} +{%- for (name, prefix) in PORTCHANNEL_INTERFACE %} +{%- if prefix | ipv4 %} {%- if add_preceding_space.flag %} {% endif %} -{{ pc_interface['attachto'] }} +{{ name }} {%- set _dummy = add_preceding_space.update({'flag': True}) %} {%- endif %} {%- endfor %}" diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index 5c2e9de09703..37c3f488a5c7 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -1,42 +1,16 @@ #!/usr/bin/env bash -function wait_until_iface_exists -{ - IFACE=$1 - - echo "Waiting for interface ${IFACE}..." - - # Wait for the interface to come up (i.e., 'ip link show' returns 0) - until ip link show $IFACE > /dev/null 2>&1; do - sleep 1 - done - - echo "Interface ${IFACE} is created" -} - # Create isc-dhcp-relay config file -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay +sonic-cfggen -d -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd # Wait for all interfaces to come up before starting the DHCP relay - -FRONT_PANEL_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') -for IFACE in $FRONT_PANEL_IFACES; do - wait_until_iface_exists $IFACE -done - -VLAN_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_vlan_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') -for IFACE in $VLAN_IFACES; do - wait_until_iface_exists $IFACE -done - -PORTCHANNEL_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_portchannel_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') -for IFACE in $PORTCHANNEL_IFACES; do - wait_until_iface_exists $IFACE -done +sonic-cfggen -d -t /usr/share/sonic/templates/wait_for_intf.sh.j2 > /usr/bin/wait_for_intf.sh +chmod +x /usr/bin/wait_for_intf.sh +/usr/bin/wait_for_intf.sh # Start the DHCP relay supervisorctl start isc-dhcp-relay diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 new file mode 100755 index 000000000000..b859a43b07b1 --- /dev/null +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +function wait_until_iface_exists +{ + IFACE=$1 + + echo "Waiting for interface ${IFACE}..." + + # Wait for the interface to come up (i.e., 'ip link show' returns 0) + until ip link show $IFACE > /dev/null 2>&1; do + sleep 1 + done + + echo "Interface ${IFACE} is created" +} + + +# Wait for all interfaces to come up before starting the DHCP relay +{% for (name, prefix) in INTERFACE %} +wait_until_iface_exists {{ name }} +{% endfor %} +{% for (name, prefix) in VLAN_INTERFACE %} +wait_until_iface_exists {{ name }} +{% endfor %} +{% for (name, prefix) in PORTCHANNEL_INTERFACE %} +wait_until_iface_exists {{ name }} +{% endfor %} + diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index c66d5bfb232f..5452a976368a 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -1,13 +1,13 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/bgpd.conf.j2 using minigraph_facts.py +! generated by templates/quagga/bgpd.conf.j2 with config DB data ! file: bgpd.conf ! {% endblock banner %} ! {% block system_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 @@ -23,46 +23,52 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp bestpath as-path multipath-relax no bgp default ipv4-unicast {# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} - bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }} + bgp router-id {{ LOOPBACK_INTERFACE.keys()[0][1] }} {# advertise loopback #} -{% for lo in minigraph_lo_interfaces %} -{% if lo['addr'] | ipv4 %} - network {{ lo['addr'] }}/32 -{% elif lo['addr'] | ipv6 %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix | ip }}/32 +{% elif prefix | ipv6 %} address-family ipv6 - network {{ lo['addr'] }}/128 + network {{ prefix | ip }}/128 exit-address-family {% endif %} {% endfor %} {% endblock bgp_init %} {% block vlan_advertisement %} -{% for vlan_interface in minigraph_vlan_interfaces %} -{% if vlan_interface['addr'] | ipv4 %} - network {{ vlan_interface['subnet'] }} -{% elif vlan_interface['addr'] | ipv6 %} +{% for (name, prefix) in VLAN_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix }} +{% elif prefix | ipv6 %} address-family ipv6 - network {{ vlan_interface['subnet'] }} + network {{ prefix }} exit-address-family {% endif %} {% endfor %} {% endblock vlan_advertisement %} {% block bgp_sessions %} {% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} -{% if bgp_session['asn'] != 0 %} +{% if bgp_session['asn'] | int != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} {% if neighbor_addr | ipv4 %} address-family ipv4 neighbor {{ neighbor_addr }} activate +{% if bgp_session['rrclient'] | int != 0 %} + neighbor {{ neighbor_addr }} route-reflector-client +{% endif %} maximum-paths 64 exit-address-family {% endif %} {% if neighbor_addr | ipv6 %} address-family ipv6 neighbor {{ neighbor_addr }} activate +{% if bgp_session['rrclient'] | int != 0 %} + neighbor {{ neighbor_addr }} route-reflector-client +{% endif %} maximum-paths 64 exit-address-family {% endif %} diff --git a/dockers/docker-fpm-frr/config.sh b/dockers/docker-fpm-frr/config.sh index 0636a6dc413c..ef7a13a214f4 100755 --- a/dockers/docker-fpm-frr/config.sh +++ b/dockers/docker-fpm-frr/config.sh @@ -1,14 +1,14 @@ #!/bin/bash mkdir -p /etc/frr -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/frr/bgpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/frr/zebra.conf +sonic-cfggen -d -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/frr/bgpd.conf +sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/frr/zebra.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate +sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate chown root:root /usr/sbin/bgp-isolate chmod 0755 /usr/sbin/bgp-isolate -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate +sonic-cfggen -d -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate diff --git a/dockers/docker-fpm-frr/zebra.conf.j2 b/dockers/docker-fpm-frr/zebra.conf.j2 index 1ce06eecd2d9..8b967f98671c 100644 --- a/dockers/docker-fpm-frr/zebra.conf.j2 +++ b/dockers/docker-fpm-frr/zebra.conf.j2 @@ -1,26 +1,26 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! generated by templates/quagga/zebra.conf.j2 using config DB data ! file: zebra.conf ! {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} ! {% block interfaces %} ! Enable link-detect (default disabled) -{% for interface in minigraph_interfaces %} -interface {{ interface['attachto'] }} +{% for (name, prefix) in INTERFACE %} +interface {{ name }} link-detect ! {% endfor %} -{% for interface in minigraph_portchannels.keys() %} -interface {{ interface }} +{% for pc in PORTCHANNEL %} +interface {{ pc }} link-detect ! {% endfor %} @@ -28,26 +28,34 @@ link-detect ! {% block default_route %} ! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 +{% endif %} +{% endfor %} {% endblock default_route %} ! {% block source_loopback %} -! Set ip source to loopback for bgp learned routes -route-map RM_SET_SRC permit 10 - set src {{ minigraph_lo_interfaces[0]['addr'] }} -! +{% set lo_ipv4_addrs = [] %} {% set lo_ipv6_addrs = [] %} -{% if minigraph_lo_interfaces is defined %} -{% for interface in minigraph_lo_interfaces %} -{% if interface['addr'] is defined and interface['addr']|ipv6 %} -{% if lo_ipv6_addrs.append(interface['addr']) %} +{% if LOOPBACK_INTERFACE %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv6 %} +{% if lo_ipv6_addrs.append(prefix) %} +{% endif %} +{% else %} +{% if lo_ipv4_addrs.append(prefix) %} {% endif %} {% endif %} {% endfor %} {% endif %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ lo_ipv4_addrs[0] | ip }} +! {% if lo_ipv6_addrs|length > 0 %} route-map RM_SET_SRC6 permit 10 - set src {{ lo_ipv6_addrs[0] }} + set src {{ lo_ipv6_addrs[0] | ip }} ! {% endif %} ip protocol bgp route-map RM_SET_SRC diff --git a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 index c6ec7a4fd166..a4fb80bf11ca 100644 --- a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 +++ b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 @@ -1,8 +1,8 @@ [global.config] as = {{ DEVICE_METADATA['localhost']['bgp_asn'] }} - router-id = "{{ minigraph_lo_interfaces[0]['addr'] }}" + router-id = "{{ LOOPBACK_INTERFACE.keys()[0][1] }}" {% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} -{% if bgp_session['asn'] != 0 %} +{% if bgp_session['asn'] | int != 0 %} [[neighbors]] [neighbors.config] peer-as = {{ bgp_session['asn'] }} diff --git a/dockers/docker-fpm-gobgp/start.sh b/dockers/docker-fpm-gobgp/start.sh index 636fceea0cbd..83afbda4f736 100755 --- a/dockers/docker-fpm-gobgp/start.sh +++ b/dockers/docker-fpm-gobgp/start.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash mkdir -p /etc/quagga -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/gobgpd.conf.j2 > /etc/gobgp/gobgpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf +sonic-cfggen -d -t /usr/share/sonic/templates/gobgpd.conf.j2 > /etc/gobgp/gobgpd.conf +sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate +sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate chown root:root /usr/sbin/bgp-isolate chmod 0755 /usr/sbin/bgp-isolate -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate +sonic-cfggen -d -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate diff --git a/dockers/docker-fpm-gobgp/zebra.conf.j2 b/dockers/docker-fpm-gobgp/zebra.conf.j2 index 1ce06eecd2d9..8b967f98671c 100644 --- a/dockers/docker-fpm-gobgp/zebra.conf.j2 +++ b/dockers/docker-fpm-gobgp/zebra.conf.j2 @@ -1,26 +1,26 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! generated by templates/quagga/zebra.conf.j2 using config DB data ! file: zebra.conf ! {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} ! {% block interfaces %} ! Enable link-detect (default disabled) -{% for interface in minigraph_interfaces %} -interface {{ interface['attachto'] }} +{% for (name, prefix) in INTERFACE %} +interface {{ name }} link-detect ! {% endfor %} -{% for interface in minigraph_portchannels.keys() %} -interface {{ interface }} +{% for pc in PORTCHANNEL %} +interface {{ pc }} link-detect ! {% endfor %} @@ -28,26 +28,34 @@ link-detect ! {% block default_route %} ! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 +{% endif %} +{% endfor %} {% endblock default_route %} ! {% block source_loopback %} -! Set ip source to loopback for bgp learned routes -route-map RM_SET_SRC permit 10 - set src {{ minigraph_lo_interfaces[0]['addr'] }} -! +{% set lo_ipv4_addrs = [] %} {% set lo_ipv6_addrs = [] %} -{% if minigraph_lo_interfaces is defined %} -{% for interface in minigraph_lo_interfaces %} -{% if interface['addr'] is defined and interface['addr']|ipv6 %} -{% if lo_ipv6_addrs.append(interface['addr']) %} +{% if LOOPBACK_INTERFACE %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv6 %} +{% if lo_ipv6_addrs.append(prefix) %} +{% endif %} +{% else %} +{% if lo_ipv4_addrs.append(prefix) %} {% endif %} {% endif %} {% endfor %} {% endif %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ lo_ipv4_addrs[0] | ip }} +! {% if lo_ipv6_addrs|length > 0 %} route-map RM_SET_SRC6 permit 10 - set src {{ lo_ipv6_addrs[0] }} + set src {{ lo_ipv6_addrs[0] | ip }} ! {% endif %} ip protocol bgp route-map RM_SET_SRC diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index eb1da1f1a3ea..0ef144016246 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -1,13 +1,13 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/bgpd.conf.j2 using minigraph_facts.py +! generated by templates/quagga/bgpd.conf.j2 with config DB data ! file: bgpd.conf ! {% endblock banner %} ! {% block system_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 @@ -26,51 +26,60 @@ route-map TO_BGP_SPEAKER_V4 deny 10 router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax + no bgp default ipv4-unicast {# Advertise graceful restart capability for ToR #} -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} bgp graceful-restart {% endif %} -{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} - bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{# TODO: use v4 lo for backward compatibility, will revisit the case with multiple lo interfaces #} +{% if prefix | ipv4 %} + bgp router-id {{ prefix | ip }} +{% endif %} +{% endfor %} {# advertise loopback #} -{% for lo in minigraph_lo_interfaces %} -{% if lo['addr'] | ipv4 %} - network {{ lo['addr'] }}/32 -{% elif lo['addr'] | ipv6 %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix | ip }}/32 +{% elif prefix | ipv6 %} address-family ipv6 - network {{ lo['addr'] }}/128 + network {{ prefix | ip }}/128 exit-address-family {% endif %} {% endfor %} {% endblock bgp_init %} {% endif %} {% block vlan_advertisement %} -{% for vlan_interface in minigraph_vlan_interfaces %} -{% if vlan_interface['addr'] | ipv4 %} - network {{ vlan_interface['subnet'] }} -{% elif vlan_interface['addr'] | ipv6 %} +{% for (name, prefix) in VLAN_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix }} +{% elif prefix | ipv6 %} address-family ipv6 - network {{ vlan_interface['subnet'] }} + network {{ prefix }} exit-address-family {% endif %} {% endfor %} {% endblock vlan_advertisement %} {% block bgp_sessions %} {% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} -{% if bgp_session['asn'] != 0 %} +{% if bgp_session['asn'] | int != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} {% if bgp_session.has_key('admin_status') and bgp_session['admin_status'] == 'down' or not bgp_session.has_key('admin_status') and DEVICE_METADATA['localhost'].has_key('default_bgp_status') and DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %} neighbor {{ neighbor_addr }} shutdown {% endif %} {% if neighbor_addr | ipv4 %} -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} - neighbor {{ neighbor_addr }} allowas-in 1 + address-family ipv4 +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} + neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} + neighbor {{ neighbor_addr }} activate + maximum-paths 64 + exit-address-family {% endif %} {% if neighbor_addr | ipv6 %} address-family ipv6 -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate @@ -81,10 +90,11 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endfor %} {% endblock bgp_sessions %} {% block bgp_peers_with_range %} +{% if BGP_PEER_RANGE %} {% for bgp_peer in BGP_PEER_RANGE.values() %} neighbor {{ bgp_peer['name'] }} peer-group neighbor {{ bgp_peer['name'] }} passive - neighbor {{ bgp_peer['name'] }} remote-as {{deployment_id_asn_map[deployment_id] }} + neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }} neighbor {{ bgp_peer['name'] }} ebgp-multihop 255 neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound neighbor {{ bgp_peer['name'] }} update-source Loopback0 @@ -93,7 +103,16 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% for ip_range in bgp_peer['ip_range'] %} bgp listen range {{ip_range}} peer-group {{ bgp_peer['name'] }} {% endfor %} + address-family ipv4 + neighbor {{ bgp_peer['name'] }} activate + maximum-paths 64 + exit-address-family + address-family ipv6 + neighbor {{ bgp_peer['name'] }} activate + maximum-paths 64 + exit-address-family {% endfor %} +{% endif %} {% endblock bgp_peers_with_range %} ! {% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %} diff --git a/dockers/docker-fpm-quagga/supervisord.conf b/dockers/docker-fpm-quagga/supervisord.conf index 5a310a790f18..92d806ff281c 100644 --- a/dockers/docker-fpm-quagga/supervisord.conf +++ b/dockers/docker-fpm-quagga/supervisord.conf @@ -36,7 +36,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:bgpd] -command=/usr/lib/quagga/bgpd -A 127.0.0.1 +command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F priority=5 autostart=false autorestart=false diff --git a/dockers/docker-fpm-quagga/zebra.conf.j2 b/dockers/docker-fpm-quagga/zebra.conf.j2 index 1ce06eecd2d9..8b967f98671c 100644 --- a/dockers/docker-fpm-quagga/zebra.conf.j2 +++ b/dockers/docker-fpm-quagga/zebra.conf.j2 @@ -1,26 +1,26 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! generated by templates/quagga/zebra.conf.j2 using config DB data ! file: zebra.conf ! {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} ! {% block interfaces %} ! Enable link-detect (default disabled) -{% for interface in minigraph_interfaces %} -interface {{ interface['attachto'] }} +{% for (name, prefix) in INTERFACE %} +interface {{ name }} link-detect ! {% endfor %} -{% for interface in minigraph_portchannels.keys() %} -interface {{ interface }} +{% for pc in PORTCHANNEL %} +interface {{ pc }} link-detect ! {% endfor %} @@ -28,26 +28,34 @@ link-detect ! {% block default_route %} ! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 +{% endif %} +{% endfor %} {% endblock default_route %} ! {% block source_loopback %} -! Set ip source to loopback for bgp learned routes -route-map RM_SET_SRC permit 10 - set src {{ minigraph_lo_interfaces[0]['addr'] }} -! +{% set lo_ipv4_addrs = [] %} {% set lo_ipv6_addrs = [] %} -{% if minigraph_lo_interfaces is defined %} -{% for interface in minigraph_lo_interfaces %} -{% if interface['addr'] is defined and interface['addr']|ipv6 %} -{% if lo_ipv6_addrs.append(interface['addr']) %} +{% if LOOPBACK_INTERFACE %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv6 %} +{% if lo_ipv6_addrs.append(prefix) %} +{% endif %} +{% else %} +{% if lo_ipv4_addrs.append(prefix) %} {% endif %} {% endif %} {% endfor %} {% endif %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ lo_ipv4_addrs[0] | ip }} +! {% if lo_ipv6_addrs|length > 0 %} route-map RM_SET_SRC6 permit 10 - set src {{ lo_ipv6_addrs[0] }} + set src {{ lo_ipv6_addrs[0] | ip }} ! {% endif %} ip protocol bgp route-map RM_SET_SRC diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index 4cfe48065e11..eb7202df7c67 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,5 +1,3 @@ -{% for member in minigraph_ports.keys() %} -{% if member in minigraph_neighbors %} -configure ports {{ member }} lldp portidsubtype local {{ minigraph_ports[member]['alias'] }} description {{ minigraph_neighbors[member]['name'] }}:{{ minigraph_neighbors[member]['port'] }} -{% endif %} +{% for local_port in DEVICE_NEIGHBOR %} +configure ports {{ local_port }} lldp portidsubtype local {{ PORT[local_port]['alias'] }} description {{ DEVICE_NEIGHBOR[local_port]['name'] }}:{{ DEVICE_NEIGHBOR[local_port]['port'] }} {% endfor %} diff --git a/dockers/docker-lldp-sv2/start.sh b/dockers/docker-lldp-sv2/start.sh index 63c8d32c34e6..3a765c6f5482 100755 --- a/dockers/docker-lldp-sv2/start.sh +++ b/dockers/docker-lldp-sv2/start.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf +sonic-cfggen -d -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status diff --git a/dockers/docker-orchagent/arp_update b/dockers/docker-orchagent/arp_update index 8291818e50fb..cfd87c1dc51f 100755 --- a/dockers/docker-orchagent/arp_update +++ b/dockers/docker-orchagent/arp_update @@ -4,7 +4,7 @@ # arp_update: Send gratuitous ARP requests to VLAN member neighbors to refresh # the neighbors state. -VLAN=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_vlans.keys() | join(" ")'` +VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` for vlan in $VLAN; do # generate a list of arping commands: # arping -q -w 0 -c 1 -i ; diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 6ffafd297496..2554755c701d 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -1,9 +1,16 @@ +{# only IPv4 decapsulation is supported #} +{% set ipv4_loopback_addresses = [] %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} + {%- if prefix | ipv4 %} + {%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %} + {%- endif %} +{% endfor %} [ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "src_ip":"{{ minigraph_lo_interfaces[0]['addr'] }}", - "dst_ip":"{{ minigraph_lo_interfaces[0]['addr'] }}", + "src_ip":"{{ ipv4_loopback_addresses | first | ip }}", + "dst_ip":"{% for prefix in ipv4_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", {% if onie_switch_asic == "mlnx" %} "dscp_mode":"uniform", "ecn_mode":"standard", @@ -16,4 +23,3 @@ "OP": "SET" } ] - diff --git a/dockers/docker-orchagent/mirror.json.j2 b/dockers/docker-orchagent/mirror.json.j2 index 4aa710cfcb71..3a3fc6eed079 100644 --- a/dockers/docker-orchagent/mirror.json.j2 +++ b/dockers/docker-orchagent/mirror.json.j2 @@ -1,9 +1,10 @@ [ -{% if erspan_dst %} +{% if MIRROR_SESSION %} +{% for session in MIRROR_SESSION %} { - "MIRROR_SESSION_TABLE:everflow": { - "src_ip": "{{ minigraph_lo_interfaces[0]['addr'] }}", - "dst_ip": "{{ erspan_dst[0] }}", + "MIRROR_SESSION_TABLE:{{session}}": { + "src_ip": "{{ MIRROR_SESSION[session]['src_ip'] }}", + "dst_ip": "{{ MIRROR_SESSION[session]['dst_ip'] }}", {% if onie_switch_asic == "mlnx" %} "gre_type": "0x6558", "queue": "1", @@ -15,7 +16,9 @@ "ttl": "255" }, "OP": "SET" - } + }{% if not loop.last %},{% endif %} + +{% endfor %} {% endif %} ] diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 328ce8fc053d..7103afcb81e9 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -2,7 +2,7 @@ # Export platform information. Required to be able to write # vendor specific code. -export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v onie_switch_asic` +export platform=`sonic-cfggen -v onie_switch_asic` ASIC=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type` diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index f59ee993eead..48be831025f8 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -1,11 +1,15 @@ [ -{% for interface in ethernet_interfaces %} +{% if PORT %} +{% for port in PORT %} +{% if PORT[port].has_key('speed') %} { - "PORT_TABLE:{{ interface['name'] }}": { - "speed": "{{ interface['speed'] }}" + "PORT_TABLE:{{ port }}": { + "speed": "{{ PORT[port]['speed'] }}" }, "OP": "SET" }{% if not loop.last %},{% endif %} +{% endif %} {% endfor %} +{% endif %} ] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 5f961a8bd294..0931321a9436 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -2,27 +2,16 @@ mkdir -p /etc/swss/config.d/ -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json +sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json +sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json +sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json -export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v platform` +export platform=`sonic-cfggen -v platform` rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd -# Wait for syncd to start -while true; do - RESULT=$(echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p) - - if [ "$RESULT" != "0" ]; then - break - fi - - sleep 1 -done - supervisorctl start orchagent supervisorctl start portsyncd @@ -34,7 +23,7 @@ supervisorctl start neighsyncd supervisorctl start swssconfig # Start arp_update when VLAN exists -VLAN=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_vlans.keys() | join(" ")'` +VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then supervisorctl start arp_update fi diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index a04238472c4c..09850b13d4a1 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -55,7 +55,8 @@ stderr_logfile=syslog command=/usr/bin/swssconfig.sh priority=7 autostart=false -autorestart=false +autorestart=unexpected +startretries=0 stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 2530aca06bb3..55a22c5353c8 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + function config_acl { if [ -f "/etc/sonic/acl.json" ]; then mkdir -p /etc/swss/config.d/acl @@ -32,11 +34,10 @@ function fast_reboot { esac } - # Restore FDB and ARP table ASAP fast_reboot -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` +HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json " @@ -46,10 +47,9 @@ elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "ACS-MSN2700" ]; then - SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " -elif [ "$HWSKU" == "ACS-MSN2740" ]; then - SWSSCONFIG_ARGS+="msn2740.32ports.buffers.json msn2740.32ports.qos.json " +elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then + sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json + SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn2700.32ports.qos.json " fi for file in $SWSSCONFIG_ARGS; do diff --git a/dockers/docker-platform-monitor/start.sh b/dockers/docker-platform-monitor/start.sh index fb87083f5cc6..b4023c16367a 100755 --- a/dockers/docker-platform-monitor/start.sh +++ b/dockers/docker-platform-monitor/start.sh @@ -18,6 +18,9 @@ fi # If this platform has a fancontrol config file, copy it to it's proper place # and start fancontrol if [ -e /usr/share/sonic/platform/fancontrol ]; then + # Remove stale pid file if it exists + rm -f /var/run/fancontrol.pid + /bin/cp -f /usr/share/sonic/platform/fancontrol /etc/ supervisorctl start fancontrol fi diff --git a/dockers/docker-snmp-sv2/alias_map.j2 b/dockers/docker-snmp-sv2/alias_map.j2 index 0f91fa26eabe..bd68353a91e3 100644 --- a/dockers/docker-snmp-sv2/alias_map.j2 +++ b/dockers/docker-snmp-sv2/alias_map.j2 @@ -1,5 +1,5 @@ { -{% for member in minigraph_ports.keys() %} - "{{member}}": "{{minigraph_ports[member]['alias']}}"{% if not loop.last %},{% endif %} +{% for member in PORT %} + "{{member}}": "{{PORT[member]['alias']}}"{% if not loop.last %},{% endif %} {% endfor %} } diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index c5d299af05ef..b46871dfd6f8 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -13,18 +13,22 @@ # AGENT BEHAVIOUR # -{% if minigraph_mgmt_interface.addr | ipv4 %} +{% if MGMT_INTERFACE %} # Listen for connections on localhost, loopback ip and mgmt (eth0) ip agentAddress udp:127.0.0.1:161 -agentAddress udp:{{ minigraph_mgmt_interface.addr }}:161 -{% for minigraph_lo_interface in minigraph_lo_interfaces %} +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +agentAddress udp:{{ prefix | ip }}:161 +{% endif %} +{% endfor %} # TODO: only support ipv4 lo addresses, add ipv6 support later -{% if minigraph_lo_interface.addr | ipv4 %} -agentAddress udp:{{ minigraph_lo_interface.addr }}:161 +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 %} +agentAddress udp:{{ prefix | ip }}:161 {% endif %} {% endfor %} {% else %} -# Listen on all addresses as mgmt ip not specified in minigraph +# Listen on all addresses as mgmt ip not specified agentAddress udp:161 {% endif %} @@ -57,7 +61,7 @@ sysServices 72 # # Process Monitoring # -# TODO: should we enable snmp based monitoring of sswsyncd and other processes? +# todo: should we enable snmp based monitoring of sswsyncd and other processes? # At least one 'sendmail' process, but no more than 10 #proc sendmail 10 1 @@ -72,12 +76,7 @@ sysServices 72 # 10MBs required on root disk, 5% free on /var, 10% free on all other disks disk / 10000 disk /var 5% - -# Note: includeAllDisks will conflict with ignoredisk -# TODO: /root/* are introduced by aufs union mount, happening in initramfs stage. Clean them in the mount list. -ignoredisk /root/host -ignoredisk /root/dev -ignoredisk /root/dev/pts +includeAllDisks 10% # Walk the UCD-SNMP-MIB::dskTable to see the resulting output # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file diff --git a/dockers/docker-snmp-sv2/start.sh b/dockers/docker-snmp-sv2/start.sh index ffbe8f196722..201239b1e7db 100755 --- a/dockers/docker-snmp-sv2/start.sh +++ b/dockers/docker-snmp-sv2/start.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash mkdir -p /etc/ssw -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 > /etc/ssw/sysDescription +sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 > /etc/ssw/sysDescription mkdir -p /etc/snmp -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 > /etc/snmp/snmpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/alias_map.j2 > /etc/snmp/alias_map.json +sonic-cfggen -d -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 > /etc/snmp/snmpd.conf +sonic-cfggen -d -t /usr/share/sonic/templates/alias_map.j2 > /etc/snmp/alias_map.json mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index 60313c57f813..d80579506100 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip -p /run/snmpd.pid +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw -p /run/snmpd.pid priority=3 autostart=false autorestart=false diff --git a/dockers/docker-snmp-sv2/sysDescription.j2 b/dockers/docker-snmp-sv2/sysDescription.j2 index 648ed161046e..207a8bf7de9a 100644 --- a/dockers/docker-snmp-sv2/sysDescription.j2 +++ b/dockers/docker-snmp-sv2/sysDescription.j2 @@ -1 +1 @@ -SONiC Software Version: SONiC.{{ build_version }} - HwSku: {{ minigraph_hwsku }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }} +SONiC Software Version: SONiC.{{ build_version }} - HwSku: {{ DEVICE_METADATA['localhost']['hwsku'] }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }} diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index fe4bfe1c584f..6b0a3d785894 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -15,8 +15,8 @@ if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC fi -for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do - sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf +for pc in `sonic-cfggen -d -v "PORTCHANNEL.keys() | join(' ') if PORTCHANNEL"`; do + sonic-cfggen -d -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf done mkdir -p /var/sonic diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index d6693719f1ad..d9ea1b790f89 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -5,14 +5,14 @@ "name": "lacp", "active": true, {# Use 75% links upperbound as min-links #} - "min_ports": {{ (minigraph_portchannels[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }}, + "min_ports": {{ (PORTCHANNEL[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }}, "tx_hash": ["eth", "ipv4", "ipv6"] }, "link_watch": { "name": "ethtool" }, "ports": { -{% for member in minigraph_portchannels[pc]['members'] %} +{% for member in PORTCHANNEL[pc]['members'] %} "{{ member }}": {}{% if not loop.last %},{% endif %} {% endfor %} diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh index 37b617150a04..2b6d9fb53970 100755 --- a/dockers/docker-teamd/teamd.sh +++ b/dockers/docker-teamd/teamd.sh @@ -24,15 +24,5 @@ function clean_up { trap clean_up SIGTERM SIGKILL -# Before teamd could automatically add newly created host interfaces into the -# LAG, this workaround will wait until the host interfaces are created and then -# the processes will be started. -while true; do - # Check if front-panel ports are configured - result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p` - if [ "$result" == "0" ]; then - start_app - read - fi - sleep 1 -done +start_app +read diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 3ae3acaed33b..a7aee83c70e6 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -1,24 +1,68 @@ #!/bin/bash -# Obtain our platform and HWSKU as we will mount directories with these names in each docker +function getMountPoint() +{ + echo $1 | python -c "import sys, json, os; mnts = [x for x in json.load(sys.stdin)[0]['Mounts'] if x['Destination'] == '/usr/share/sonic/hwsku']; print '' if len(mnts) == 0 else os.path.basename(mnts[0]['Source'])" 2>/dev/null +} + +function postStartAction() +{ +{%- if docker_container_name != "database" %} + : +{%- else %} + while true; do + if [[ "$(docker exec -i database redis-cli ping)" =~ PONG.* ]]; then + break + fi + sleep 1 + done +{%- endif %} +} + +# Obtain our platform as we will mount directories with these names in each docker PLATFORM=`sonic-cfggen -v platform` -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` + +{%- if docker_container_name == "database" %} +# Don't mount HWSKU in {{docker_container_name}} container. +HWSKU="" +{%- else %} +# Obtain our HWSKU as we will mount directories with these names in each docker +HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'` +{%- endif %} start() { - docker inspect --type container {{docker_container_name}} &>/dev/null + DOCKERCHECK=`docker inspect --type container {{docker_container_name}} 2>/dev/null` if [ "$?" -eq "0" ]; then - docker start {{docker_container_name}} - else + DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"` + if [ "$DOCKERMOUNT" == "$HWSKU" ]; then + echo "Starting existing {{docker_container_name}} container with HWSKU $HWSKU" + docker start {{docker_container_name}} + postStartAction + exit 0 + fi - docker run -d {{docker_image_run_opt}} \ + # docker created with a different HWSKU, remove and recreate + echo "Removing obsolete {{docker_container_name}} container with HWSKU $DOCKERMOUNT" + docker rm {{docker_container_name}} + fi + +{%- if docker_container_name == "database" %} + echo "Starting new {{docker_container_name}} container" +{%- else %} + echo "Starting new {{docker_container_name}} container with HWSKU $HWSKU" +{%- endif %} + docker run -d {{docker_image_run_opt}} \ {%- if '--log-driver=json-file' in docker_image_run_opt or '--log-driver' not in docker_image_run_opt %} - --log-opt max-size=2M --log-opt max-file=5 \ + --log-opt max-size=2M --log-opt max-file=5 \ {%- endif %} - -v /var/run/redis:/var/run/redis:rw \ - -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ - -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ - --name={{docker_container_name}} {{docker_image_name}}:latest - fi + -v /var/run/redis:/var/run/redis:rw \ + -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ +{%- if docker_container_name != "database" %} + -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ +{%- endif %} + --name={{docker_container_name}} {{docker_image_name}}:latest + + postStartAction } attach() { diff --git a/files/build_templates/organization_extensions.sh b/files/build_templates/organization_extensions.sh new file mode 100755 index 000000000000..db05a4e3f59d --- /dev/null +++ b/files/build_templates/organization_extensions.sh @@ -0,0 +1,52 @@ +#!/bin/bash +######################################################################### +## This script is to automate Orignaization specific extensions # +## such as Configuration & Scripts for features like AAA, ZTP, etc. # +## to include in ONIE installer image # +## # +## USAGE: # +## ./organization_extensions.sh -f -n # +## ./organization_extensions.sh \ # +## --fsroot \ # +## --hostname # +## PARAMETERS: # +## -f FILESYSTEM_ROOT # +## The location of the root file system # +## -h HOSTNAME # +## The hostname of the target system # +######################################################################### + +## Initialize the arguments to default values. +## The values get updated to user provided value, if supplied +FILESYSTEM_ROOT=./fsroot +HOSTNAME=sonic + +# read the options +TEMP=`getopt -o f:h: --long fsroot:,hostname: -- "$@"` +eval set -- "$TEMP" + +# extract options and their arguments into variables. +while true ; do + case "$1" in + -f|--fsroot) + case "$2" in + "") shift 2 ;; + *) FILESYSTEM_ROOT=$2 ; shift 2 ;; + esac ;; + -h|--hostname) + case "$2" in + "") shift 2 ;; + *) HOSTNAME=$2 ; shift 2 ;; + esac ;; + --) shift ; break ;; + *) echo "Internal error!" ; exit 1 ;; + esac +done + +echo "Executing SONIC Organization Extensions" + +## Place your Organization specific code / scipts here ... + + +echo "SONIC Organization Extensions - Done" + diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index ed6b852f18f9..af922530d8a2 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -5,6 +5,7 @@ Requires=database.service Requires=opennsl-modules-3.16.0-4-amd64.service {% endif %} After=database.service +After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} After=opennsl-modules-3.16.0-4-amd64.service {% endif %} diff --git a/files/image_config/interfaces/interfaces-config.service b/files/image_config/interfaces/interfaces-config.service index 0cc7f2981505..86706da22518 100644 --- a/files/image_config/interfaces/interfaces-config.service +++ b/files/image_config/interfaces/interfaces-config.service @@ -1,6 +1,7 @@ [Unit] Description=Update interfaces configuration -Before=database.service +Requires=database.service +After=database.service [Service] Type=oneshot diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index d2b42051cc8d..400b89a594c7 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,6 +1,6 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces +sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces [ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid service networking restart ifdown lo && ifup lo diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 425badf7f21f..6521eb7a67e1 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -10,34 +10,36 @@ auto lo iface lo inet loopback # Use command 'ip addr list dev lo' to check all addresses -{% for minigraph_lo_interface in minigraph_lo_interfaces %} -iface lo {{ 'inet' if minigraph_lo_interface['addr'] | ipv4 else 'inet6' }} static - address {{ minigraph_lo_interface['addr'] }} - netmask {{ minigraph_lo_interface['mask'] }} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +iface lo {{ 'inet' if prefix | ipv4 else 'inet6' }} static + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # {% endfor %} {% endblock loopback %} {% block mgmt_interface %} # The management network interface auto eth0 -{% if minigraph_mgmt_interface['addr'] %} -iface eth0 inet static - address {{ minigraph_mgmt_interface['addr'] }} - netmask {{ minigraph_mgmt_interface['mask'] }} +{% if MGMT_INTERFACE %} +{% for (name, prefix) in MGMT_INTERFACE %} +iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} ########## management network policy routing rules # management port up rules - up ip route add default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default - up ip rule add from {{ minigraph_mgmt_interface['addr'] }}/32 table default -{% for prefix in forced_mgmt_routes %} - up ip rule add to {{ prefix }} table default + up ip {{ '-4' if prefix | ipv4 else '-6' }} route add default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default + up ip {{ '-4' if prefix | ipv4 else '-6' }} rule add from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} table default +{% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} + up ip rule add to {{ route }} table default {% endfor %} # management port down rules - down ip route delete default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default - down ip rule delete from {{ minigraph_mgmt_interface['addr'] }}/32 table default -{% for prefix in forced_mgmt_routes %} - down ip rule delete to {{ prefix }} table default + down ip {{ '-4' if prefix | ipv4 else '-6' }} route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default + down ip {{ '-4' if prefix | ipv4 else '-6' }} rule delete from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} table default +{% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} + down ip rule delete to {{ route }} table default {% endfor %} {# TODO: COPP policy type rules #} +{% endfor %} {% else %} iface eth0 inet dhcp {% endif %} @@ -45,33 +47,32 @@ iface eth0 inet dhcp {% endblock mgmt_interface %} {% block front_panel_interfaces %} # The switch front panel interfaces -{% for interface in minigraph_interfaces %} -allow-hotplug {{ interface['attachto'] }} -iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static - mtu 9216 - address {{ interface['addr'] }} - netmask {{ interface['mask'] }} +{% for (name, prefix) in INTERFACE %} +allow-hotplug {{ name }} +iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static + mtu 9100 + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # {% endfor %} -{% if minigraph_vlans.keys() | length %} +{% if VLAN %} # "|| true" is added to suppress the error when interface is already a member of VLAN -{% endif %} -{% for vlan in minigraph_vlans.keys()|sort %} -{% for member in minigraph_vlans[vlan]['members'] %} +{% for vlan in VLAN.keys()|sort %} +{% for member in VLAN[vlan]['members'] %} allow-hotplug {{ member }} iface {{ member }} inet manual - pre-up ifconfig {{ member }} up mtu 9216 + pre-up ifconfig {{ member }} up mtu 9100 post-up brctl addif {{ vlan }} {{ member }} || true post-down ifconfig {{ member }} down # {% endfor %} {% endfor %} -{% if minigraph_portchannels.keys() | length %} +{% endif %} +{% if PORTCHANNEL %} # "|| true" is added to suppress the error when interface is already a member of LAG # "ip link show | grep -q master" is added to ensure interface is enslaved -{% endif %} -{% for pc in minigraph_portchannels.keys()|sort %} -{% for member in minigraph_portchannels[pc]['members'] %} +{% for pc in PORTCHANNEL.keys()|sort %} +{% for member in PORTCHANNEL[pc]['members'] %} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up teamdctl {{ pc }} port add {{ member }} || true @@ -80,30 +81,31 @@ iface {{ member }} inet manual # {% endfor %} {% endfor %} +{% endif %} {% endblock front_panel_interfaces %} -{% if minigraph_vlans.keys() | length %} {% block vlan_interfaces %} +{% if VLAN_INTERFACE %} # Vlan interfaces -{% for vlan_interface in minigraph_vlan_interfaces %} -auto {{ vlan_interface['attachto'] }} -iface {{ vlan_interface['attachto'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static +{% for (name, prefix) in VLAN_INTERFACE.keys() | sort %} +auto {{ name }} +iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static bridge_ports none - address {{ vlan_interface['addr'] }} - netmask {{ vlan_interface['mask'] }} + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} {% endfor %} # -{% endblock vlan_interfaces %} {% endif %} -{% if minigraph_portchannels.keys() | length %} +{% endblock vlan_interfaces %} {% block pc_interfaces %} +{% if PORTCHANNEL_INTERFACE %} # Portchannel interfaces -{% for pc_interface in minigraph_portchannel_interfaces %} -allow-hotplug {{ pc_interface['attachto'] }} -iface {{ pc_interface['attachto'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static - mtu 9216 - address {{ pc_interface['addr'] }} - netmask {{ pc_interface['mask'] }} +{% for (name, prefix) in PORTCHANNEL_INTERFACE.keys() | sort %} +allow-hotplug {{ name }} +iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static + mtu 9100 + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # {% endfor %} -{% endblock pc_interfaces %} {% endif %} +{% endblock pc_interfaces %} diff --git a/files/image_config/ntp/ntp-config.service b/files/image_config/ntp/ntp-config.service index 948e7f4953c8..05e6211b9782 100644 --- a/files/image_config/ntp/ntp-config.service +++ b/files/image_config/ntp/ntp-config.service @@ -1,6 +1,8 @@ [Unit] Description=Update NTP configuration Before=ntp.service +Requires=database.service +After=database.service [Service] Type=oneshot diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh index 2465058ba021..7c79a16c0ef3 100755 --- a/files/image_config/ntp/ntp-config.sh +++ b/files/image_config/ntp/ntp-config.sh @@ -1,3 +1,3 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf +sonic-cfggen -d -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf diff --git a/files/image_config/ntp/ntp.conf.j2 b/files/image_config/ntp/ntp.conf.j2 index 3ae0c1804e52..ae72820339be 100644 --- a/files/image_config/ntp/ntp.conf.j2 +++ b/files/image_config/ntp/ntp.conf.j2 @@ -23,13 +23,15 @@ filegen clockstats file clockstats type day enable # pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will # pick a different set every time it starts up. Please consider joining the # pool: -{% for ntp_server in ntp_servers %} +{% for ntp_server in NTP_SERVER %} server {{ ntp_server }} iburst {% endfor %} #only listen on localhost and eth0 ips (default is to listen on all ip addresses) interface ignore wildcard -interface listen {{ minigraph_mgmt_interface.addr }} +{% for (mgmt_intf, mgmt_prefix) in MGMT_INTERFACE %} +interface listen {{ mgmt_prefix | ip }} +{% endfor %} interface listen 127.0.0.1 # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 8b8db4a261c3..d3ecba7d8518 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -29,6 +29,7 @@ if [ ! -e /host/machine.conf ]; then done fi + migration="TRUE" umount /mnt/onie-boot fi @@ -36,6 +37,26 @@ fi echo "install platform dependent packages at the first boot time" +firsttime_exit() +{ + rm /host/image-$sonic_version/platform/firsttime + exit 0 +} + +# Given a string of tuples of the form field=value, extract the value for a field +# In : $string, $field +# Out: $value +value_extract() +{ +set -- $string +for x in "$@"; do + case "$x" in + $field=*) + value="${x#$field=}" + esac +done +} + sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") if [ -f /host/image-$sonic_version/platform/firsttime ]; then @@ -46,8 +67,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then platform=$onie_platform else echo "Unknown sonic platform" - rm /host/image-$sonic_version/platform/firsttime - exit 0 + firsttime_exit fi # Try to take old configuration saved during installation @@ -76,6 +96,88 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then dpkg -i /host/image-$sonic_version/platform/$platform/*.deb fi + # If the unit booted into SONiC from another NOS's grub, + # we now install a grub for SONiC. + if [ -n "$onie_platform" ] && [ -n "$migration" ]; then + + grub_bin=$(ls /host/image-$sonic_version/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null) + if [ -z "$grub_bin" ]; then + echo "Unable to locate grub package !" >> /etc/migration.log + firsttime_exit + fi + + dpkg -i $grub_bin > /dev/null 2>&1 + if [ $? != 0 ]; then + echo "Unable to install grub package !" >> /etc/migration.log + firsttime_exit + fi + + # Determine the block device to install grub + sonic_dev=$(blkid | grep SONiC-OS | head -n 1 | awk '{print $1}' | sed -e 's/[0-9]:.*$//') + if [ -z "$sonic_dev" ]; then + echo "Unable to determine sonic partition !" >> /etc/migration.log + firsttime_exit + fi + + grub-install --boot-directory=/host --recheck $sonic_dev 2>/dev/null + if [ $? != 0 ]; then + echo "grub install failed !" >> /etc/migration.log + firsttime_exit + fi + + # The SONiC "raw" build mode has already generated a proto grub.cfg + # as part of the migration. Platform specific constants need to be + # retrieved from installer.conf (if present) and assigned. + . /usr/share/sonic/device/$platform/installer.conf + + if [ ! -z "$CONSOLE_PORT" ]; then + field="\-\-port" + string=$(grep $field /host/grub.cfg) + value_extract $string $field + console_port=$value + if [ ! -z "$console_port" ] && [ "$console_port" != "$CONSOLE_PORT" ]; then + sed -i -e "s/\-\-port=$console_port/\-\-port=$CONSOLE_PORT/g" /host/grub.cfg + fi + echo "grub.cfg console port=$console_port & installer.conf CONSOLE_PORT=$CONSOLE_PORT" >> /etc/migration.log + fi + + if [ ! -z "$CONSOLE_DEV" ]; then + field="console" + string=$(grep $field /host/grub.cfg) + value_extract $string $field + console_dev_name=$(echo $value | sed -e "s/^.*=//" -e "s/,.*//") + console_dev="${console_dev_name#ttyS}" + if [ "$console_dev" != "$CONSOLE_DEV" ]; then + sed -i -e "s/console=ttyS$console_dev/console=ttyS$CONSOLE_DEV/g" /host/grub.cfg + fi + echo "grub.cfg console dev=$console_dev & installer.conf CONSOLE_DEV=$CONSOLE_DEV" >> /etc/migration.log + fi + + if [ ! -z "$VAR_LOG_SIZE" ]; then + field="var_log_size" + string=$(grep $field /host/grub.cfg) + value_extract $string $field + var_log_size=$value + if [ ! -z "$var_log_size" ] && [ "$var_log_size" != "$VAR_LOG_SIZE" ]; then + sed -i -e "s/var_log_size=$var_log_size/var_log_size=$VAR_LOG_SIZE/g" /host/grub.cfg + fi + echo "grub.cfg var_log_size=$var_log_size & installer.conf VAR_LOG_SIZE=$VAR_LOG_SIZE" >> /etc/migration.log + fi + + # Set the root based on the label + sonic_root=$(blkid | grep SONiC-OS | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') + sonic_root=$(echo "$sonic_root" | sed 's/\//\\\//g') + sed -i -e "s/%%SONIC_ROOT%%/$sonic_root/g" /host/grub.cfg + + # Add the Diag and ONIE entries + mount $onie_dev /mnt/onie-boot + . /mnt/onie-boot/onie/grub.d/50_onie_grub >> /host/grub.cfg + umount /mnt/onie-boot + + # Initialize the SONiC's grub config + mv /host/grub.cfg /host/grub/grub.cfg + fi + rm /host/image-$sonic_version/platform/firsttime fi diff --git a/files/image_config/rsyslog/rsyslog-config.service b/files/image_config/rsyslog/rsyslog-config.service index be3c209e7560..e013b992030d 100644 --- a/files/image_config/rsyslog/rsyslog-config.service +++ b/files/image_config/rsyslog/rsyslog-config.service @@ -1,5 +1,7 @@ [Unit] Description=Update rsyslog configuration +Requires=database.service +After=database.service [Service] Type=oneshot diff --git a/files/image_config/rsyslog/rsyslog-config.sh b/files/image_config/rsyslog/rsyslog-config.sh index 06a4934a4be5..c8ba7b99453c 100755 --- a/files/image_config/rsyslog/rsyslog-config.sh +++ b/files/image_config/rsyslog/rsyslog-config.sh @@ -1,4 +1,4 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf +sonic-cfggen -d -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf systemctl restart rsyslog diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 index 54e2eec3f999..063f119f6bdd 100644 --- a/files/image_config/rsyslog/rsyslog.conf.j2 +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -30,11 +30,6 @@ $UDPServerRun 514 ########################### #### GLOBAL DIRECTIVES #### ########################### -#Set remote syslog server -{% for server in syslog_servers %} -*.* @{{ server }}:514 -{% endfor %} - # # Use traditional timestamp format. # To enable high precision timestamps, comment out the following line. @@ -42,9 +37,14 @@ $UDPServerRun 514 #$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat # Define a custom template -$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$template SONiCFileFormat,"%timegenerated%.%timegenerated:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" $ActionFileDefaultTemplate SONiCFileFormat +#Set remote syslog server +{% for server in SYSLOG_SERVER %} +*.* @{{ server }}:514;SONiCFileFormat +{% endfor %} + # # Set the default permissions for all log files. # diff --git a/files/image_config/updategraph/updategraph.service b/files/image_config/updategraph/updategraph.service index ba0b5dcb85e2..c66e9be75702 100644 --- a/files/image_config/updategraph/updategraph.service +++ b/files/image_config/updategraph/updategraph.service @@ -1,8 +1,6 @@ [Unit] Description=download minigraph from graph service -Before=ntp-config.service -Before=rsyslog-config.service -Before=interfaces-config.service +Before=database.service [Service] Type=oneshot diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 81c6d9d1943f..75ce011e839a 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -82,28 +82,6 @@ run_cmd() { fi } -create_varlog_file() { - local err_msg="Error: create var-log ext4 file" - local cmd="[ -n "$varlog_size" ] && mkdir -p $root_mnt/disk-img && dd if=/dev/zero of=$root_mnt/disk-img/var-log.ext4 count=$((2048*$varlog_size)) && mke2fs -t ext4 -q -F $root_mnt/disk-img/var-log.ext4" - run_cmd "$cmd" "$err_msg" -} - -mount_and_create_varlog_file() { - [ -z "$varlog_size" ] && exit 0 - mkdir -p "$root_mnt" - mount -t ext4 "$root_dev" "$root_mnt" - # exit when the var_log.ext4 exists and the size matches - if [ -e "$root_mnt/disk-img/var-log.ext4" ]; then - cur_varlog_size=$(ls -l $root_mnt/disk-img/var-log.ext4 | awk '{print $5}') - if [ $cur_varlog_size == $((1024*1024*$varlog_size)) ]; then - exit 0 - fi - fi - create_varlog_file - umount "$root_mnt" - exit 0 -} - # Extract kernel parameters set -- $(cat /proc/cmdline) for x in "$@"; do @@ -114,9 +92,6 @@ for x in "$@"; do Aboot=*) aboot_flag="${x#Aboot=}" ;; - varlog_size=*) - varlog_size="${x#varlog_size=}" - ;; loop=*) x1="${x#loop=}" image_dir="${x1%/*}" @@ -135,8 +110,8 @@ if ! wait_for_root_dev; then exit 1 fi -# mount, create varlog file and exit when the root is ext4 -blkid | grep "$root_dev.*vfat" -q || mount_and_create_varlog_file +# exit when the root is ext4 +blkid | grep "$root_dev.*vfat" -q || exit 0 # Get flash dev name if [ -z "$block_flash" ]; then @@ -201,5 +176,3 @@ run_cmd "$cmd" "$err_msg" err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" cmd="cp -a $tmp_mnt/. $root_mnt/" run_cmd "$cmd" "$err_msg" - -create_varlog_file diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index acc21e2885bc..db40d4f08601 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -1,6 +1,12 @@ #!/bin/sh -e + +PREREQS="varlog" + +prereqs() { echo "$PREREQS"; } + case $1 in prereqs) + prereqs exit 0 ;; esac diff --git a/files/initramfs-tools/varlog b/files/initramfs-tools/varlog new file mode 100644 index 000000000000..d1340eaa9d8b --- /dev/null +++ b/files/initramfs-tools/varlog @@ -0,0 +1,36 @@ +#!/bin/sh -e + +PREREQS="" + +prereqs() { echo "$PREREQS"; } + +case $1 in + prereqs) + prereqs + exit 0 + ;; +esac + +# Extract kernel parameters +set -- $(cat /proc/cmdline) +for x in "$@"; do + case "$x" in + varlog_size=*) + varlog_size="${x#varlog_size=}" + esac +done + +[ -z "$varlog_size" ] && exit 0 + +# exit when the var_log.ext4 exists and the size matches +if [ -e "${rootmnt}/host/disk-img/var-log.ext4" ]; then + cur_varlog_size=$(ls -l ${rootmnt}/host/disk-img/var-log.ext4 | awk '{print $5}') + if [ $cur_varlog_size == $((1024*1024*$varlog_size)) ]; then + exit 0 + else + rm -rf ${rootmnt}/host/disk-img + fi +fi + +# create varlog disk +mkdir -p ${rootmnt}/host/disk-img && ${rootmnt}/usr/bin/fallocate -l "$varlog_size"M ${rootmnt}/host/disk-img/var-log.ext4 && mkfs.ext4 -q -F ${rootmnt}/host/disk-img/var-log.ext4 diff --git a/functions.sh b/functions.sh index c73aeb45d649..01f645ca72c7 100644 --- a/functions.sh +++ b/functions.sh @@ -55,7 +55,7 @@ sonic_get_version() { local latest_tag=$(git describe --tags --abbrev=0) local branch_name=$(git rev-parse --abbrev-ref HEAD) if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then - local dirty="-dirty" + local dirty="-dirty-$DIRTY_SUFFIX" fi BUILD_NUMBER=${BUILD_NUMBER:-0} ## Check if we are on tagged commit diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index ad1cc3691fbf..358da41071b5 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -423,7 +423,7 @@ else demo_mnt="build_raw_image_mnt" demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" - mkfs.ext4 $demo_dev + mkfs.ext4 -L $demo_volume_label $demo_dev echo "Mounting $demo_dev on $demo_mnt..." mkdir $demo_mnt @@ -450,24 +450,6 @@ TAR_EXTRA_OPTION="--numeric-owner" 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 -# Create loop device for /var/log to limit its size to $VAR_LOG_SIZE MB -if [ -f $demo_mnt/disk-img/var-log.ext4 ]; then - current_log_size_mb=$(ls -l --block-size=M $demo_mnt/disk-img/var-log.ext4 | cut -f5 -d" ") - if [ "$current_log_size_mb" = "$VAR_LOG_SIZE"M ]; then - echo "Log file system already exists. Size: ${VAR_LOG_SIZE}MB" - VAR_LOG_SIZE=0 - else - rm -rf $demo_mnt/disk-img - fi -fi - -if [ "$VAR_LOG_SIZE" != "0" ]; then - echo "Creating new log file system. Size: ${VAR_LOG_SIZE}MB" - mkdir -p $demo_mnt/disk-img - dd if=/dev/zero of=$demo_mnt/disk-img/var-log.ext4 count=$((2048*$VAR_LOG_SIZE)) - mkfs.ext4 -q $demo_mnt/disk-img/var-log.ext4 -F -fi - if [ "$install_env" = "onie" ]; then # Store machine description in target file system cp /etc/machine.conf $demo_mnt @@ -553,6 +535,12 @@ if [ "$install_env" = "sonic" ]; then onie_menuentry=$(cat /host/grub/grub.cfg | sed "/menuentry ONIE/,/}/!d") fi +if [ "$install_env" = "build" ]; then + grub_cfg_root=%%SONIC_ROOT%% +else + grub_cfg_root=$demo_dev +fi + cat <> $grub_cfg menuentry '$demo_grub_entry' { search --no-floppy --label --set=root $demo_volume_label @@ -561,9 +549,9 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$demo_dev rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ - apparmor=1 security=apparmor $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX + apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' initrd /$image_dir/boot/initrd.img-3.16.0-4-amd64 } @@ -582,6 +570,7 @@ EOF 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 diff --git a/platform/broadcom/docker-ptf-brcm.mk b/platform/broadcom/docker-ptf-brcm.mk index 7b78aa9ec316..c57ce43dc905 100644 --- a/platform/broadcom/docker-ptf-brcm.mk +++ b/platform/broadcom/docker-ptf-brcm.mk @@ -4,4 +4,4 @@ DOCKER_PTF_BRCM = docker-ptf-brcm.gz $(DOCKER_PTF_BRCM)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift $(DOCKER_PTF_BRCM)_DEPENDS += $(PYTHON_SAITHRIFT_BRCM) $(DOCKER_PTF_BRCM)_LOAD_DOCKERS += $(DOCKER_PTF) -SONIC_DOCKER_IMAGES += $(DOCKER_PTF_BRCM) +#SONIC_DOCKER_IMAGES += $(DOCKER_PTF_BRCM) diff --git a/platform/broadcom/libsaithrift-dev.mk b/platform/broadcom/libsaithrift-dev.mk index c809539b47fe..6e422db6e799 100644 --- a/platform/broadcom/libsaithrift-dev.mk +++ b/platform/broadcom/libsaithrift-dev.mk @@ -4,4 +4,4 @@ LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_0.9.4_amd64.deb $(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/SAI $(LIBSAITHRIFT_DEV_BRCM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) -SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BRCM) +#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BRCM) diff --git a/platform/broadcom/python-saithrift.mk b/platform/broadcom/python-saithrift.mk index f9da4143c7d9..18bf77c3d009 100644 --- a/platform/broadcom/python-saithrift.mk +++ b/platform/broadcom/python-saithrift.mk @@ -3,4 +3,4 @@ PYTHON_SAITHRIFT_BRCM = python-saithrift_0.9.4_amd64.deb $(PYTHON_SAITHRIFT_BRCM)_SRC_PATH = $(SRC_PATH)/SAI $(PYTHON_SAITHRIFT_BRCM)_DEPENDS += $(BRCM_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BRCM) +#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BRCM) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 30b517f8d385..b52118570251 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -15,7 +15,7 @@ include $(PLATFORM_PATH)/raw-image.mk include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk -include $(PLATFORM_PATH)/docker-ptf-brcm.mk +#include $(PLATFORM_PATH)/docker-ptf-brcm.mk BCMCMD = bcmcmd $(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/bcmcmd?sv=2015-04-05&sr=b&sig=OCW4mfmbQ6D0BH8nllpAWrS8XL9uczrw32w3XgL4jws%3D&se=2030-03-31T23%3A06%3A15Z&sp=r" @@ -26,12 +26,10 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/d SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ - $(DOCKER_FPM) \ - $(DOCKER_PTF_BRCM) \ - $(DOCKER_SYNCD_BRCM_RPC) + $(DOCKER_FPM) # Inject brcm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM) +$(LIBSAIREDIS)_DEPENDS += $(BRCM_SAI) $(BRCM_SAI_DEV) #$(LIBSAITHRIFT_DEV_BRCM) # Runtime dependency on brcm sai is set only for syncd -$(SYNCD)_RDEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) +$(SYNCD)_RDEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index eaf188485fed..ea804a69c0eb 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,10 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-17_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-17_amd64.deb?sv=2015-04-05&sr=b&sig=6sJ4dd%2FF1hqStNQk5Z6d%2BYQGRZxLDihXRl60EeN7agc%3D&se=2031-05-02T09%3A37%3A54Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-5_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-5_amd64.deb?sv=2015-04-05&sr=b&sig=MQE6FrxHs%2BIUPjRaSpWagcSjY6bbHLCUYasusxILkEs%3D&se=2031-06-07T21%3A50%3A36Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-17_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-5_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-17_amd64.deb?sv=2015-04-05&sr=b&sig=syV0rie0L2Dn4lhmndCTyCTgXQv8DPoWD3IxtlSdeNo%3D&se=2031-05-02T09%3A37%3A18Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-5_amd64.deb?sv=2015-04-05&sr=b&sig=o8bjWlxxYAM%2F95aSshRFJE57JwKVjRaH4jDU2lDEoMg%3D&se=2031-06-07T21%3A50%3A19Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) -$(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 5280fa2c9c1b..04d540c64582 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,4 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-10-20170707181826.44_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-10-20170707181826.44_amd64.deb?sv=2015-04-05&sr=b&sig=hc4PbMQvfOu7p7E0MR1kn0OA6vu%2BPIdYOLeDU9hPJMY%3D&se=2031-03-19T21%3A20%3A15Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3-1_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3-1_amd64.deb?sv=2015-04-05&sr=b&sig=Uepf4z2wOadX%2F6OR%2BCoQzjv2tkwEZ2AspBiuo5sb25s%3D&se=2031-05-30T19%3A37%3A19Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-10-20170707181826.44_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-10-20170707181826.44_amd64.deb?sv=2015-04-05&sr=b&sig=xtGLlxX5SspadCxaObMGGVMQliPGrTkuN0T6A4wLETA%3D&se=2031-03-19T21%3A21%3A43Z&sp=r" - -SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) +SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 7c505290bb26..d1417bff1778 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 7c505290bb26babdef604a377e71b3df702897a8 +Subproject commit d1417bff17780255d4cc371b315f620087673eb8 diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 5ab014c0d4f9..1abd4e6c41f6 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 5ab014c0d4f9ad71d7791e7d4da0645d2b2d493b +Subproject commit 1abd4e6c41f633272667a5833a63ab6f8da15199 diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 1a67af3caa00..e66b8839da21 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 1a67af3caa00352e5e7db880e1eeda0bdf1fde6b +Subproject commit e66b8839da2180fd586aae040701faf180d59477 diff --git a/platform/mellanox/docker-ptf-mlnx.mk b/platform/mellanox/docker-ptf-mlnx.mk index 7f23dc715e32..9f994f62de64 100644 --- a/platform/mellanox/docker-ptf-mlnx.mk +++ b/platform/mellanox/docker-ptf-mlnx.mk @@ -4,4 +4,4 @@ DOCKER_PTF_MLNX = docker-ptf-mlnx.gz $(DOCKER_PTF_MLNX)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift $(DOCKER_PTF_MLNX)_DEPENDS += $(PYTHON_SAITHRIFT_MLNX) $(DOCKER_PTF_MLNX)_LOAD_DOCKERS += $(DOCKER_PTF) -SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MLNX) +#SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MLNX) diff --git a/platform/mellanox/docker-syncd-mlnx/start.sh b/platform/mellanox/docker-syncd-mlnx/start.sh index 0ad00c6fc252..623316050475 100755 --- a/platform/mellanox/docker-syncd-mlnx/start.sh +++ b/platform/mellanox/docker-syncd-mlnx/start.sh @@ -4,8 +4,4 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd -# mlnx-fw-upgrade.sh will exit if firmware was actually upgraded -# or if some error occurs -. mlnx-fw-upgrade.sh - supervisorctl start syncd diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index a50230a025d9..8c40d46d9182 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1224.0140 +MLNX_FW_VERSION = 13.1400.0126 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index 0fc6d3f4eb84..39222be39cab 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -4,4 +4,4 @@ LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_0.9.4_amd64.deb $(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/SAI $(LIBSAITHRIFT_DEV_MLNX)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV) $(LIBSAITHRIFT_DEV_MLNX)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) -SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MLNX) +#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MLNX) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 332d496e76d0..bba10132160d 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = ba3ccd6de8e5b82fa2cdfc30f9b8b1f1882bfede +MLNX_SAI_VERSION = sonic1.9.1fixes-master +MLNX_SAI_REVISION = dc0e84b3762f847369524a917e271ceb2878b4d3 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/python-saithrift.mk b/platform/mellanox/python-saithrift.mk index cbe5af29b3e2..59685121e02c 100644 --- a/platform/mellanox/python-saithrift.mk +++ b/platform/mellanox/python-saithrift.mk @@ -3,4 +3,4 @@ PYTHON_SAITHRIFT_MLNX = python-saithrift_0.9.4_amd64.deb $(PYTHON_SAITHRIFT_MLNX)_SRC_PATH = $(SRC_PATH)/SAI $(PYTHON_SAITHRIFT_MLNX)_DEPENDS += $(MLNX_SAI_DEV) $(MLNX_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MLNX) +#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MLNX) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 6b88748c73a2..d67401df245d 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -12,12 +12,10 @@ include $(PLATFORM_PATH)/python-saithrift.mk include $(PLATFORM_PATH)/docker-ptf-mlnx.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM) \ - $(DOCKER_PTF_MLNX) \ - $(DOCKER_SYNCD_MLNX_RPC) + $(DOCKER_FPM) # Inject mlnx sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) $(LIBSAITHRIFT_DEV_MLNX) +$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) #$(LIBSAITHRIFT_DEV_MLNX) # Runtime dependency on mlnx sai is set only for syncd $(SYNCD)_RDEPENDS += $(MLNX_SAI) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index bb576aaabee5..7c517627c23d 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/ba3ccd6de8e5b82fa2cdfc30f9b8b1f1882bfede/sdk -MLNX_SDK_VERSION = 4.2.3130 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/4ebc01e95b754c56da7f8b5fb45b82fbe661d05a/sdk +MLNX_SDK_VERSION = 4.2.5010 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) @@ -20,8 +20,6 @@ $(eval $(call add_derived_package,$(IPROUTE2),$(IPROUTE2_DEV))) SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV))) -SX_COMPLIB_DEV_STATIC = sx-complib-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV_STATIC))) SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(SX_EXAMPLES)_DEPENDS += $(APPLIBS) $(SX_SCEW) $(SXD_LIBS) SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb @@ -33,13 +31,9 @@ $(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DEV))) SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SX_SCEW_DEV = sx-scew-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV))) -SX_SCEW_DEV_STATIC = sx-scew-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV_STATIC))) SXD_LIBS = sxd-libs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SXD_LIBS_DEV = sxd-libs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV))) -SXD_LIBS_DEV_STATIC = sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV_STATIC))) #packages that are required for runtime only PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(PYTHON_SDK_API)_DEPENDS += $(APPLIBS) $(SXD_LIBS) diff --git a/rules/config b/rules/config index 5403c981f170..ad13ad047e04 100644 --- a/rules/config +++ b/rules/config @@ -12,9 +12,8 @@ # container. SONIC_CONFIG_BUILD_JOBS = 1 -# SONIC_CONFIG_BUILD_JOBS - set number of jobs for number of jobs per package. +# SONIC_CONFIG_MAKE_JOBS - set number of parallel make jobs per package. # Corresponding -j argument will be passed to make/dpkg commands that build separate packages -# container. SONIC_CONFIG_MAKE_JOBS = $(shell nproc) # SONIC_CONFIG_ENABLE_COLORS - enable colored output in build system. @@ -49,3 +48,6 @@ SONIC_ROUTING_STACK = quagga # ENABLE_SYNCD_RPC - build docker-syncd with rpc packages for testing purposes. # Uncomment to enable: # ENABLE_SYNCD_RPC = y + +# Enable Origanization Extensions - Specific to the deployment scenarios of the Organization +ENABLE_ORGANIZATION_EXTENSIONS = y diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 39f8cdd3f297..76e7dac4ab63 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -12,4 +12,7 @@ $(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += --net=host --privileged -t $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +# Mount Arista python library on Aboot images to be used by plugins +$(DOCKER_PLATFORM_MONITOR)_aboot_RUN_OPT += -v /usr/lib/python2.7/dist-packages/arista:/usr/lib/python2.7/dist-packages/arista:ro + $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += sensors:/usr/bin/sensors diff --git a/slave.mk b/slave.mk index cc4a59a6d881..c26e4932f05a 100644 --- a/slave.mk +++ b/slave.mk @@ -99,6 +99,7 @@ $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") $(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)") $(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") +$(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)") $(info ) ############################################################################### @@ -179,13 +180,13 @@ SONIC_TARGET_LIST += $(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES)) # SONIC_MAKE_DEBS += $(SOME_NEW_DEB) $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(HEADER) - # remove target to force rebuild + # Remove target to force rebuild rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) - # apply series of patches if exist + # Apply series of patches if exist if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi - # build project and take package + # Build project and take package make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) - # clean up + # Clean up if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi $(FOOTER) @@ -199,16 +200,18 @@ SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) # SONIC_DPKG_DEBS += $(SOME_NEW_DEB) $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(HEADER) - # Build project and take package + # Remove old build logs if they exist rm -f $($*_SRC_PATH)/debian/*.debhelper.log - # apply series of patches if exist + # Apply series of patches if exist if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + # Build project pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) popd $(LOG) - # clean up + # Clean up if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi + # Take built package(s) mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) @@ -222,10 +225,15 @@ SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) # SONIC_PYTHON_STDEB_DEBS += $(SOME_NEW_DEB) $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(HEADER) - # Build project and take package + # Apply series of patches if exist + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + # Build project pushd $($*_SRC_PATH) $(LOG) python setup.py --command-packages=stdeb.command bdist_deb $(LOG) popd $(LOG) + # Clean up + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi + # Take built package(s) mv $(addprefix $($*_SRC_PATH)/deb_dist/, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) @@ -374,13 +382,14 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA # targets for building installers with base image $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $(HEADER) - ## Pass initramfs and linux kernel explicitly. They are used for all platforms + # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" export linux_kernel="$(DEBS_PATH)/$(LINUX_KERNEL)" export kversion="$(KVERSION)" export image_type="$($*_IMAGE_TYPE)" export sonicadmin_user="$(USERNAME)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)" + export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)" export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" @@ -393,6 +402,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export docker_image="$(docker)" export docker_image_name="$(basename $(docker))" export docker_container_name="$($(docker)_CONTAINER_NAME)" + $(eval $(docker)_RUN_OPT += $($(docker)_$($*_IMAGE_TYPE)_RUN_OPT)) export docker_image_run_opt="$($(docker)_RUN_OPT)" j2 files/build_templates/docker_image_ctl.j2 > $($(docker)_CONTAINER_NAME).sh if [ -f files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 ]; then @@ -413,6 +423,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform chmod +x sonic_debian_extension.sh, ) + DIRTY_SUFFIX="$(shell date +%Y%m%d\.%H%M%S)" + export DIRTY_SUFFIX ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG) diff --git a/src/SAI b/src/SAI deleted file mode 160000 index 940c7b6afb1d..000000000000 --- a/src/SAI +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 940c7b6afb1db4e8504b7cdb24ccd669748dbde8 diff --git a/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch b/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch new file mode 100644 index 000000000000..1cae8bad21aa --- /dev/null +++ b/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch @@ -0,0 +1,98 @@ +From 417e9dfdccbbee2cf86e46e994e8ece3433b46a4 Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Wed, 20 Sep 2017 00:34:07 +0000 +Subject: [PATCH] [teamd] lacp runner will send lacp update right after it + received SIGINT signal + +--- + teamd/teamd.c | 1 + + teamd/teamd.h | 3 +++ + teamd/teamd_events.c | 13 +++++++++++++ + teamd/teamd_runner_lacp.c | 10 ++++++++++ + 4 files changed, 27 insertions(+) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index aac2511..c987333 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -386,6 +386,7 @@ static int teamd_run_loop_run(struct teamd_context *ctx) + case 'q': + if (quit_in_progress) + return -EBUSY; ++ teamd_refresh_ports(ctx); + err = teamd_flush_ports(ctx); + if (err) + return err; +diff --git a/teamd/teamd.h b/teamd/teamd.h +index 5dbfb9b..ef0fb1c 100644 +--- a/teamd/teamd.h ++++ b/teamd/teamd.h +@@ -189,11 +189,14 @@ struct teamd_event_watch_ops { + struct teamd_port *tdport, void *priv); + int (*port_ifname_changed)(struct teamd_context *ctx, + struct teamd_port *tdport, void *priv); ++ void (*refresh)(struct teamd_context *ctx, ++ struct teamd_port *tdport, void *priv); + int (*option_changed)(struct teamd_context *ctx, + struct team_option *option, void *priv); + char *option_changed_match_name; + }; + ++void teamd_refresh_ports(struct teamd_context *ctx); + int teamd_event_port_added(struct teamd_context *ctx, + struct teamd_port *tdport); + void teamd_event_port_removed(struct teamd_context *ctx, +diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c +index 1a95974..5c2ef56 100644 +--- a/teamd/teamd_events.c ++++ b/teamd/teamd_events.c +@@ -34,6 +34,19 @@ struct event_watch_item { + void *priv; + }; + ++void teamd_refresh_ports(struct teamd_context *ctx) ++{ ++ struct teamd_port *tdport; ++ struct event_watch_item *watch; ++ ++ teamd_for_each_tdport(tdport, ctx) { ++ list_for_each_node_entry(watch, &ctx->event_watch_list, list) { ++ if (!watch->ops->refresh) continue; ++ watch->ops->refresh(ctx, tdport, watch->priv); ++ } ++ } ++} ++ + int teamd_event_port_added(struct teamd_context *ctx, + struct teamd_port *tdport) + { +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 9c77fae..e38c291 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -1383,12 +1383,22 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, + return lacp_port_link_update(lacp_port); + } + ++static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) ++{ ++ struct lacp *lacp = priv; ++ ++ struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); ++ if (lacp_port_selected(lacp_port)) ++ (void) lacpdu_send(lacp_port); ++} ++ + static const struct teamd_event_watch_ops lacp_event_watch_ops = { + .hwaddr_changed = lacp_event_watch_hwaddr_changed, + .port_added = lacp_event_watch_port_added, + .port_removed = lacp_event_watch_port_removed, + .port_changed = lacp_event_watch_port_changed, + .admin_state_changed = lacp_event_watch_admin_state_changed, ++ .refresh = lacp_event_watch_refresh, + }; + + static int lacp_carrier_init(struct teamd_context *ctx, struct lacp *lacp) +-- +2.7.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index 283a6b56fbec..c84250749477 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -17,6 +17,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Apply patch git apply ../0001-libteam-Add-team_get_port_enabled-function.patch git apply ../0002-libteam-Temporarily-remove-redundant-debug-mes.patch + git apply ../0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch popd # Obtain debian packaging diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 1877e552858e..997008af5cee 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -100,9 +100,8 @@ def parse_png(png, hname): if child.tag == str(QName(ns, "Devices")): for device in child.findall(str(QName(ns, "Device"))): (lo_prefix, mgmt_prefix, name, hwsku, d_type) = parse_device(device) - lo_addr = None if not lo_prefix else lo_prefix.split('/')[0] - mgmt_addr = None if not mgmt_prefix else mgmt_prefix.split('/')[0] - devices[name] = {'lo_addr': lo_addr, 'type': d_type, 'mgmt_addr': mgmt_addr, 'hwsku': hwsku} + device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku } + devices[name] = device_data if child.tag == str(QName(ns, "DeviceInterfaceLinks")): for if_link in child.findall(str(QName(ns, 'DeviceLinkBase'))): @@ -131,71 +130,28 @@ def parse_dpg(dpg, hname): continue ipintfs = child.find(str(QName(ns, "IPInterfaces"))) - intfs = [] + intfs = {} for ipintf in ipintfs.findall(str(QName(ns, "IPInterface"))): intfalias = ipintf.find(str(QName(ns, "AttachTo"))).text intfname = port_alias_map.get(intfalias, intfalias) ipprefix = ipintf.find(str(QName(ns, "Prefix"))).text - ipn = ipaddress.IPNetwork(ipprefix) - ipaddr = ipn.ip - prefix_len = ipn.prefixlen - addr_bits = ipn.max_prefixlen - subnet = ipaddress.IPNetwork(str(ipn.network) + '/' + str(prefix_len)) - ipmask = ipn.netmask - - intf = {'addr': ipaddr, 'subnet': subnet} - if isinstance(ipn, ipaddress.IPv4Network): - intf['mask'] = ipmask - else: - intf['mask'] = str(prefix_len) - intf.update({'attachto': intfname, 'prefixlen': int(prefix_len)}) - - # TODO: remove peer_addr after dependency removed - ipaddr_val = int(ipn.ip) - peer_addr_val = None - if int(prefix_len) == addr_bits - 2: - if ipaddr_val & 0x3 == 1: - peer_addr_val = ipaddr_val + 1 - else: - peer_addr_val = ipaddr_val - 1 - elif int(prefix_len) == addr_bits - 1: - if ipaddr_val & 0x1 == 0: - peer_addr_val = ipaddr_val + 1 - else: - peer_addr_val = ipaddr_val - 1 - if peer_addr_val is not None: - intf['peer_addr'] = ipaddress.IPAddress(peer_addr_val) - intfs.append(intf) + intfs[(intfname, ipprefix)] = {} lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) - lo_intfs = [] + lo_intfs = {} for lointf in lointfs.findall(str(QName(ns1, "LoopbackIPInterface"))): intfname = lointf.find(str(QName(ns, "AttachTo"))).text ipprefix = lointf.find(str(QName(ns1, "PrefixStr"))).text - ipn = ipaddress.IPNetwork(ipprefix) - ipaddr = ipn.ip - prefix_len = ipn.prefixlen - ipmask = ipn.netmask - lo_intf = {'name': intfname, 'addr': ipaddr, 'prefixlen': prefix_len} - if isinstance(ipn, ipaddress.IPv4Network): - lo_intf['mask'] = ipmask - else: - lo_intf['mask'] = str(prefix_len) - lo_intfs.append(lo_intf) - + lo_intfs[(intfname, ipprefix)] = {} + mgmtintfs = child.find(str(QName(ns, "ManagementIPInterfaces"))) - mgmt_intf = None + mgmt_intf = {} for mgmtintf in mgmtintfs.findall(str(QName(ns1, "ManagementIPInterface"))): + intfname = mgmtintf.find(str(QName(ns, "AttachTo"))).text ipprefix = mgmtintf.find(str(QName(ns1, "PrefixStr"))).text mgmtipn = ipaddress.IPNetwork(ipprefix) - # Ignore IPv6 management address - if mgmtipn.version == 6: - continue - ipaddr = mgmtipn.ip - prefix_len = str(mgmtipn.prefixlen) - ipmask = mgmtipn.netmask gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1) - mgmt_intf = {'addr': ipaddr, 'prefixlen': prefix_len, 'mask': ipmask, 'gwaddr': gwaddr} + mgmt_intf[(intfname, ipprefix)] = {'gwaddr': gwaddr} pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] @@ -206,7 +162,7 @@ def parse_dpg(dpg, hname): pcmbr_list = pcintfmbr.split(';') for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) - pcs[pcintfname] = {'name': pcintfname, 'members': pcmbr_list} + pcs[pcintfname] = {'members': pcmbr_list} vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlan_intfs = [] @@ -218,7 +174,7 @@ def parse_dpg(dpg, hname): vmbr_list = vintfmbr.split(';') for i, member in enumerate(vmbr_list): vmbr_list[i] = port_alias_map.get(member, member) - vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} + vlan_attributes = {'members': vmbr_list, 'vlanid': vlanid} sonic_vlan_name = "Vlan%s" % vlanid vlans[sonic_vlan_name] = vlan_attributes @@ -243,7 +199,7 @@ def parse_dpg(dpg, hname): acl_intfs = port_alias_map.values() break; if acl_intfs: - acls[aclname] = { 'AttachTo': acl_intfs, 'IsMirror': is_mirror } + acls[aclname] = { 'policy_desc': aclname, 'ports': acl_intfs, 'type': 'mirror' if is_mirror else 'L3'} return intfs, lo_intfs, mgmt_intf, vlans, pcs, acls return None, None, None, None, None, None @@ -274,8 +230,12 @@ def parse_cpg(cpg, hname): for router in child.findall(str(QName(ns1, "BGPRouterDeclaration"))): asn = router.find(str(QName(ns1, "ASN"))).text hostname = router.find(str(QName(ns1, "Hostname"))).text + if router.find(str(QName(ns1, "RRClient"))): + rrclient = '1' + else: + rrclient = '0' if hostname == hname: - myasn = int(asn) + myasn = asn peers = router.find(str(QName(ns1, "Peers"))) for bgpPeer in peers.findall(str(QName(ns, "BGPPeer"))): addr = bgpPeer.find(str(QName(ns, "Address"))).text @@ -291,7 +251,8 @@ def parse_cpg(cpg, hname): for peer in bgp_sessions: bgp_session = bgp_sessions[peer] if hostname == bgp_session['name']: - bgp_session['asn'] = int(asn) + bgp_session['asn'] = asn + bgp_session['rrclient'] = rrclient return bgp_sessions, myasn, bgp_peers_with_range @@ -326,51 +287,17 @@ def parse_meta(meta, hname): return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id def parse_deviceinfo(meta, hwsku): - ethernet_interfaces = [] - + ethernet_interfaces = {} for device_info in meta.findall(str(QName(ns, "DeviceInfo"))): dev_sku = device_info.find(str(QName(ns, "HwSku"))).text if dev_sku == hwsku: interfaces = device_info.find(str(QName(ns, "EthernetInterfaces"))) for interface in interfaces.findall(str(QName(ns1, "EthernetInterface"))): - name = interface.find(str(QName(ns, "InterfaceName"))).text + alias = interface.find(str(QName(ns, "InterfaceName"))).text speed = interface.find(str(QName(ns, "Speed"))).text - ethernet_interfaces.append({ 'name':name, 'speed':speed }) - + ethernet_interfaces[port_alias_map.get(alias, alias)] = speed return ethernet_interfaces -def get_console_info(devices, dev, port): - for k, v in devices.items(): - if k == dev: - break - else: - return {} - - ret_val = v - ret_val.update({ - 'ts_port': port, - 'ts_dev': dev - }) - - return ret_val - - -def get_mgmt_info(devices, dev, port): - for k, v in devices.items(): - if k == dev: - break - else: - return {} - - ret_val = v - ret_val.update({ - 'mgmt_port': port, - 'mgmt_dev': dev - }) - - return ret_val - - def parse_port_config(hwsku, platform=None, port_config_file=None): port_config_candidates = [] if port_config_file != None: @@ -401,7 +328,7 @@ def parse_port_config(hwsku, platform=None, port_config_file=None): alias = name else: alias = tokens[2].strip() - ports[name] = {'name': name, 'alias': alias} + ports[name] = {'alias': alias} port_alias_map[alias] = name return ports @@ -424,7 +351,7 @@ def parse_xml(filename, platform=None, port_config_file=None): neighbors = None devices = None hostname = None - ethernet_interfaces = [] + port_speeds = {} syslog_servers = [] dhcp_servers = [] ntp_servers = [] @@ -455,93 +382,91 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "MetadataDeclaration")): (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) elif child.tag == str(QName(ns, "DeviceInfos")): - ethernet_interfaces = parse_deviceinfo(child, hwsku) + port_speeds = parse_deviceinfo(child, hwsku) results = {} - results['minigraph_hwsku'] = hwsku - # sorting by lambdas are not easily done without custom filters. - # TODO: add jinja2 filter to accept a lambda to sort a list of dictionaries by attribute. - # TODO: alternatively (preferred), implement class containers for multiple-attribute entries, enabling sort by attr + results['DEVICE_METADATA'] = {'localhost': { + 'bgp_asn': bgp_asn, + 'deployment_id': deployment_id, + 'hostname': hostname, + 'hwsku': hwsku, + 'type': devices[hostname]['type'] + }} results['BGP_NEIGHBOR'] = bgp_sessions - results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn }} results['BGP_PEER_RANGE'] = bgp_peers_with_range - # TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s). - - phyport_intfs = [] - vlan_intfs = [] - pc_intfs = [] + if mgmt_routes: + # TODO: differentiate v4 and v6 + mgmt_intf.itervalues().next()['forced_mgmt_routes'] = mgmt_routes + results['MGMT_INTERFACE'] = mgmt_intf + results['LOOPBACK_INTERFACE'] = lo_intfs + + phyport_intfs = {} + vlan_intfs = {} + pc_intfs = {} for intf in intfs: - intfname = intf['attachto'] - if intfname[0:4] == 'Vlan': - vlan_intfs.append(intf) - elif intfname[0:11] == 'PortChannel': - pc_intfs.append(intf) + if intf[0][0:4] == 'Vlan': + vlan_intfs[intf] = {} + elif intf[0][0:11] == 'PortChannel': + pc_intfs[intf] = {} else: - phyport_intfs.append(intf) - - results['minigraph_interfaces'] = sorted(phyport_intfs, key=lambda x: x['attachto']) - results['minigraph_vlan_interfaces'] = sorted(vlan_intfs, key=lambda x: x['attachto']) - results['minigraph_portchannel_interfaces'] = sorted(pc_intfs, key=lambda x: x['attachto']) - results['minigraph_ports'] = ports - results['minigraph_vlans'] = vlans - results['minigraph_portchannels'] = pcs - results['minigraph_mgmt_interface'] = mgmt_intf - results['minigraph_lo_interfaces'] = lo_intfs - results['minigraph_acls'] = acls - results['minigraph_neighbors'] = neighbors - results['minigraph_devices'] = devices - results['minigraph_underlay_neighbors'] = u_neighbors - results['minigraph_underlay_devices'] = u_devices - results['minigraph_as_xml'] = mini_graph_path - if devices != None: - results['minigraph_console'] = get_console_info(devices, console_dev, console_port) - results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) - results['minigraph_hostname'] = hostname - results['inventory_hostname'] = hostname - results['syslog_servers'] = syslog_servers - results['dhcp_servers'] = dhcp_servers - results['ntp_servers'] = ntp_servers - results['forced_mgmt_routes'] = mgmt_routes - results['erspan_dst'] = erspan_dst - results['deployment_id'] = deployment_id - results['ethernet_interfaces'] = ethernet_interfaces + phyport_intfs[intf] = {} + + results['INTERFACE'] = phyport_intfs + results['VLAN_INTERFACE'] = vlan_intfs + results['PORTCHANNEL_INTERFACE'] = pc_intfs + + for port_name in port_speeds: + ports.setdefault(port_name, {})['speed'] = port_speeds[port_name] + results['PORT'] = ports + results['PORTCHANNEL'] = pcs + results['VLAN'] = vlans + + results['DEVICE_NEIGHBOR'] = neighbors + results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) + results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) + results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers) + + results['ACL_TABLE'] = acls + mirror_sessions = {} + if erspan_dst: + lo_addr = '0.0.0.0' + for lo in lo_intfs: + lo_network = ipaddress.IPNetwork(lo[1]) + if lo_network.version == 4: + lo_addr = str(lo_network.ip) + break + count = 0 + for dst in erspan_dst: + mirror_sessions['everflow{}'.format(count)] = {"dst_ip": dst, "src_ip": lo_addr} + count += 1 + results['MIRROR_SESSION'] = mirror_sessions return results + def parse_device_desc_xml(filename): root = ET.parse(filename).getroot() (lo_prefix, mgmt_prefix, hostname, hwsku, d_type) = parse_device(root) results = {} - results['minigraph_hwsku'] = hwsku - results['minigraph_hostname'] = hostname - results['inventory_hostname'] = hostname - - lo_intfs = [] - ipn = ipaddress.IPNetwork(lo_prefix) - ipaddr = ipn.ip - prefix_len = ipn.prefixlen - ipmask = ipn.netmask - lo_intf = {'name': None, 'addr': ipaddr, 'prefixlen': prefix_len} - if isinstance(ipn, ipaddress.IPv4Network): - lo_intf['mask'] = ipmask - else: - lo_intf['mask'] = str(prefix_len) - lo_intfs.append(lo_intf) - results['minigraph_lo_interfaces'] = lo_intfs + results['DEVICE_METADATA'] = {'localhost': { + 'hostname': hostname, + 'hwsku': hwsku, + }} + + results['LOOPBACK_INTERFACE'] = {('lo', lo_prefix): {}} + + mgmt_intf = {} + mgmtipn = ipaddress.IPNetwork(mgmt_prefix) + gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1) + results['MGMT_INTERFACE'] = {('eth0', mgmt_prefix): {'gwaddr': gwaddr}} - mgmt_intf = None - mgmt_ipn = ipaddress.IPNetwork(mgmt_prefix) - ipaddr = mgmt_ipn.ip - prefix_len = str(mgmt_ipn.prefixlen) - ipmask = mgmt_ipn.netmask - gwaddr = ipaddress.IPAddress(int(mgmt_ipn.network) + 1) - mgmt_intf = {'addr': ipaddr, 'prefixlen': prefix_len, 'mask': ipmask, 'gwaddr': gwaddr} - results['minigraph_mgmt_interface'] = mgmt_intf return results + port_alias_map = {} + def print_parse_xml(filename): results = parse_xml(filename) print(json.dumps(results, indent=3, cls=minigraph_encoder)) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 070b3100ea5a..5303557c4fb4 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -22,6 +22,7 @@ import yaml import jinja2 import netaddr import json +from functools import partial from minigraph import minigraph_encoder from minigraph import parse_xml from minigraph import parse_device_desc_xml @@ -32,11 +33,11 @@ from swsssdk import ConfigDBConnector def is_ipv4(value): if not value: return False - if isinstance(value, netaddr.IPAddress): + if isinstance(value, netaddr.IPNetwork): addr = value else: try: - addr = netaddr.IPAddress(str(value)) + addr = netaddr.IPNetwork(str(value)) except: return False return addr.version == 4 @@ -44,15 +45,25 @@ def is_ipv4(value): def is_ipv6(value): if not value: return False - if isinstance(value, netaddr.IPAddress): + if isinstance(value, netaddr.IPNetwork): addr = value else: try: - addr = netaddr.IPAddress(str(value)) + addr = netaddr.IPNetwork(str(value)) except: return False return addr.version == 6 +def prefix_attr(attr, value): + if not value: + return None + else: + try: + prefix = netaddr.IPNetwork(str(value)) + except: + return None + return str(getattr(prefix, attr)) + def unique_name(l): name_list = [] new_list = [] @@ -79,10 +90,31 @@ TODO(taoyl): Current version of config db only supports BGP admin states. def output_to_db(output_data): db_data = {} for table_name in output_data: - if table_name == 'BGP_NEIGHBOR' or table_name == 'BGP_PEER_RANGE' or table_name == 'DEVICE_METADATA': + if table_name[0].isupper(): db_data[table_name] = output_data[table_name] return db_data + @staticmethod + def to_serialized(data): + for table in data: + if type(data[table]) is dict: + for key in data[table].keys(): + new_key = ConfigDBConnector.serialize_key(key) + if new_key != key: + data[table][new_key] = data[table].pop(key) + return data + + @staticmethod + def to_deserialized(data): + for table in data: + if type(data[table]) is dict: + for key in data[table].keys(): + new_key = ConfigDBConnector.deserialize_key(key) + if new_key != key: + data[table][new_key] = data[table].pop(key) + return data + + def deep_update(dst, src): for key, value in src.iteritems(): if isinstance(value, dict): @@ -138,11 +170,11 @@ def main(): for yaml_file in args.yaml: with open(yaml_file, 'r') as stream: additional_data = yaml.load(stream) - deep_update(data, additional_data) + deep_update(data, FormatConverter.to_deserialized(additional_data)) for json_file in args.json: with open(json_file, 'r') as stream: - deep_update(data, json.load(stream)) + deep_update(data, FormatConverter.to_deserialized(json.load(stream))) if args.additional_data != None: deep_update(data, json.loads(args.additional_data)) @@ -158,6 +190,8 @@ def main(): env.filters['ipv4'] = is_ipv4 env.filters['ipv6'] = is_ipv6 env.filters['unique_name'] = unique_name + for attr in ['ip', 'network', 'prefixlen', 'netmask']: + env.filters[attr] = partial(prefix_attr, attr) template = env.get_template(template_file) print template.render(data) @@ -174,7 +208,7 @@ def main(): configdb.set_config(FormatConverter.output_to_db(data)) if args.print_data: - print json.dumps(data, indent=4, cls=minigraph_encoder) + print json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder) if __name__ == "__main__": diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index 5c57bf8fac85..ec3b6f740bc4 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -22,155 +22,165 @@ iface eth0 inet static netmask 255.255.255.0 ########## management network policy routing rules # management port up rules - up ip route add default via 10.0.0.1 dev eth0 table default - up ip rule add from 10.0.0.100/32 table default + up ip -4 route add default via 10.0.0.1 dev eth0 table default + up ip -4 rule add from 10.0.0.100/32 table default # management port down rules - down ip route delete default via 10.0.0.1 dev eth0 table default - down ip rule delete from 10.0.0.100/32 table default + down ip -4 route delete default via 10.0.0.1 dev eth0 table default + down ip -4 rule delete from 10.0.0.100/32 table default +iface eth0 inet6 static + address 2603:10e2:0:2902::8 + netmask 64 + ########## 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 + up ip -6 rule add from 2603:10e2:0:2902::8/128 table default + # management port down rules + down ip -6 route delete default via 2603:10e2:0:2902::1 dev eth0 table default + down ip -6 rule delete from 2603:10e2:0:2902::8/128 table default # # The switch front panel interfaces # "|| true" is added to suppress the error when interface is already a member of VLAN allow-hotplug fortyGigE0/4 iface fortyGigE0/4 inet manual - pre-up ifconfig fortyGigE0/4 up mtu 9216 + pre-up ifconfig fortyGigE0/4 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/4 || true post-down ifconfig fortyGigE0/4 down # allow-hotplug fortyGigE0/8 iface fortyGigE0/8 inet manual - pre-up ifconfig fortyGigE0/8 up mtu 9216 + pre-up ifconfig fortyGigE0/8 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/8 || true post-down ifconfig fortyGigE0/8 down # allow-hotplug fortyGigE0/12 iface fortyGigE0/12 inet manual - pre-up ifconfig fortyGigE0/12 up mtu 9216 + pre-up ifconfig fortyGigE0/12 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/12 || true post-down ifconfig fortyGigE0/12 down # allow-hotplug fortyGigE0/16 iface fortyGigE0/16 inet manual - pre-up ifconfig fortyGigE0/16 up mtu 9216 + pre-up ifconfig fortyGigE0/16 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/16 || true post-down ifconfig fortyGigE0/16 down # allow-hotplug fortyGigE0/20 iface fortyGigE0/20 inet manual - pre-up ifconfig fortyGigE0/20 up mtu 9216 + pre-up ifconfig fortyGigE0/20 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/20 || true post-down ifconfig fortyGigE0/20 down # allow-hotplug fortyGigE0/24 iface fortyGigE0/24 inet manual - pre-up ifconfig fortyGigE0/24 up mtu 9216 + pre-up ifconfig fortyGigE0/24 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/24 || true post-down ifconfig fortyGigE0/24 down # allow-hotplug fortyGigE0/28 iface fortyGigE0/28 inet manual - pre-up ifconfig fortyGigE0/28 up mtu 9216 + pre-up ifconfig fortyGigE0/28 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/28 || true post-down ifconfig fortyGigE0/28 down # allow-hotplug fortyGigE0/32 iface fortyGigE0/32 inet manual - pre-up ifconfig fortyGigE0/32 up mtu 9216 + pre-up ifconfig fortyGigE0/32 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/32 || true post-down ifconfig fortyGigE0/32 down # allow-hotplug fortyGigE0/36 iface fortyGigE0/36 inet manual - pre-up ifconfig fortyGigE0/36 up mtu 9216 + pre-up ifconfig fortyGigE0/36 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/36 || true post-down ifconfig fortyGigE0/36 down # allow-hotplug fortyGigE0/40 iface fortyGigE0/40 inet manual - pre-up ifconfig fortyGigE0/40 up mtu 9216 + pre-up ifconfig fortyGigE0/40 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/40 || true post-down ifconfig fortyGigE0/40 down # allow-hotplug fortyGigE0/44 iface fortyGigE0/44 inet manual - pre-up ifconfig fortyGigE0/44 up mtu 9216 + pre-up ifconfig fortyGigE0/44 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/44 || true post-down ifconfig fortyGigE0/44 down # allow-hotplug fortyGigE0/48 iface fortyGigE0/48 inet manual - pre-up ifconfig fortyGigE0/48 up mtu 9216 + pre-up ifconfig fortyGigE0/48 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/48 || true post-down ifconfig fortyGigE0/48 down # allow-hotplug fortyGigE0/52 iface fortyGigE0/52 inet manual - pre-up ifconfig fortyGigE0/52 up mtu 9216 + pre-up ifconfig fortyGigE0/52 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/52 || true post-down ifconfig fortyGigE0/52 down # allow-hotplug fortyGigE0/56 iface fortyGigE0/56 inet manual - pre-up ifconfig fortyGigE0/56 up mtu 9216 + pre-up ifconfig fortyGigE0/56 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/56 || true post-down ifconfig fortyGigE0/56 down # allow-hotplug fortyGigE0/60 iface fortyGigE0/60 inet manual - pre-up ifconfig fortyGigE0/60 up mtu 9216 + pre-up ifconfig fortyGigE0/60 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/60 || true post-down ifconfig fortyGigE0/60 down # allow-hotplug fortyGigE0/64 iface fortyGigE0/64 inet manual - pre-up ifconfig fortyGigE0/64 up mtu 9216 + pre-up ifconfig fortyGigE0/64 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/64 || true post-down ifconfig fortyGigE0/64 down # allow-hotplug fortyGigE0/68 iface fortyGigE0/68 inet manual - pre-up ifconfig fortyGigE0/68 up mtu 9216 + pre-up ifconfig fortyGigE0/68 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/68 || true post-down ifconfig fortyGigE0/68 down # allow-hotplug fortyGigE0/72 iface fortyGigE0/72 inet manual - pre-up ifconfig fortyGigE0/72 up mtu 9216 + pre-up ifconfig fortyGigE0/72 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/72 || true post-down ifconfig fortyGigE0/72 down # allow-hotplug fortyGigE0/76 iface fortyGigE0/76 inet manual - pre-up ifconfig fortyGigE0/76 up mtu 9216 + pre-up ifconfig fortyGigE0/76 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/76 || true post-down ifconfig fortyGigE0/76 down # allow-hotplug fortyGigE0/80 iface fortyGigE0/80 inet manual - pre-up ifconfig fortyGigE0/80 up mtu 9216 + pre-up ifconfig fortyGigE0/80 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/80 || true post-down ifconfig fortyGigE0/80 down # allow-hotplug fortyGigE0/84 iface fortyGigE0/84 inet manual - pre-up ifconfig fortyGigE0/84 up mtu 9216 + pre-up ifconfig fortyGigE0/84 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/84 || true post-down ifconfig fortyGigE0/84 down # allow-hotplug fortyGigE0/88 iface fortyGigE0/88 inet manual - pre-up ifconfig fortyGigE0/88 up mtu 9216 + pre-up ifconfig fortyGigE0/88 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/88 || true post-down ifconfig fortyGigE0/88 down # allow-hotplug fortyGigE0/92 iface fortyGigE0/92 inet manual - pre-up ifconfig fortyGigE0/92 up mtu 9216 + pre-up ifconfig fortyGigE0/92 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/92 || true post-down ifconfig fortyGigE0/92 down # allow-hotplug fortyGigE0/96 iface fortyGigE0/96 inet manual - pre-up ifconfig fortyGigE0/96 up mtu 9216 + pre-up ifconfig fortyGigE0/96 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/96 || true post-down ifconfig fortyGigE0/96 down # @@ -210,49 +220,49 @@ iface Vlan1000 inet static # Portchannel interfaces allow-hotplug PortChannel01 iface PortChannel01 inet static - mtu 9216 + mtu 9100 address 10.0.0.56 netmask 255.255.255.254 # allow-hotplug PortChannel01 iface PortChannel01 inet6 static - mtu 9216 + mtu 9100 address fc00::71 netmask 126 # allow-hotplug PortChannel02 iface PortChannel02 inet static - mtu 9216 + mtu 9100 address 10.0.0.58 netmask 255.255.255.254 # allow-hotplug PortChannel02 iface PortChannel02 inet6 static - mtu 9216 + mtu 9100 address fc00::75 netmask 126 # allow-hotplug PortChannel03 iface PortChannel03 inet static - mtu 9216 + mtu 9100 address 10.0.0.60 netmask 255.255.255.254 # allow-hotplug PortChannel03 iface PortChannel03 inet6 static - mtu 9216 + mtu 9100 address fc00::79 netmask 126 # allow-hotplug PortChannel04 iface PortChannel04 inet static - mtu 9216 + mtu 9100 address 10.0.0.62 netmask 255.255.255.254 # allow-hotplug PortChannel04 iface PortChannel04 inet6 static - mtu 9216 + mtu 9100 address fc00::7d netmask 126 # diff --git a/src/sonic-config-engine/tests/sample_output/ipinip.json b/src/sonic-config-engine/tests/sample_output/ipinip.json index 00862a379281..5a7ac1b6063b 100644 --- a/src/sonic-config-engine/tests/sample_output/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/ipinip.json @@ -11,4 +11,3 @@ "OP": "SET" } ] - diff --git a/src/sonic-config-engine/tests/sample_output/lldpd.conf b/src/sonic-config-engine/tests/sample_output/lldpd.conf new file mode 100644 index 000000000000..0328385cf307 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/lldpd.conf @@ -0,0 +1,5 @@ +configure ports Ethernet116 lldp portidsubtype local fortyGigE0/116 description ARISTA02T1:Ethernet1/1 +configure ports Ethernet124 lldp portidsubtype local fortyGigE0/124 description ARISTA04T1:Ethernet1/1 +configure ports Ethernet112 lldp portidsubtype local fortyGigE0/112 description ARISTA01T1:Ethernet1/1 +configure ports Ethernet120 lldp portidsubtype local fortyGigE0/120 description ARISTA03T1:Ethernet1/1 + diff --git a/src/sonic-config-engine/tests/sample_output/mirror.json b/src/sonic-config-engine/tests/sample_output/mirror.json index 54065700a282..225235067e23 100644 --- a/src/sonic-config-engine/tests/sample_output/mirror.json +++ b/src/sonic-config-engine/tests/sample_output/mirror.json @@ -1,6 +1,6 @@ [ { - "MIRROR_SESSION_TABLE:everflow": { + "MIRROR_SESSION_TABLE:everflow0": { "src_ip": "10.1.0.32", "dst_ip": "2.2.2.2", "gre_type": "0x88be", diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 153b0bb14f36..d78b19d88ba7 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -31,17 +31,17 @@ def test_dummy_run(self): self.assertEqual(output, '') def test_device_desc(self): - argument = '-v minigraph_hwsku -M "' + self.sample_device_desc + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -M "' + self.sample_device_desc + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'ACS-MSN2700') def test_device_desc_mgmt_ip(self): - argument = '-v "minigraph_mgmt_interface[\'addr\']" -M "' + self.sample_device_desc + '"' + argument = '-v "MGMT_INTERFACE.keys()[0]" -M "' + self.sample_device_desc + '"' output = self.run_script(argument) - self.assertEqual(output.strip(), '10.0.1.5') + self.assertEqual(output.strip(), "('eth0', '10.0.1.5/28')") def test_minigraph_sku(self): - argument = '-v minigraph_hwsku -m "' + self.sample_graph + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'Force10-Z9100') @@ -51,7 +51,7 @@ def test_print_data(self): self.assertTrue(len(output.strip()) > 0) def test_jinja_expression(self): - argument = '-m "' + self.sample_graph + '" -v "minigraph_devices[minigraph_hostname][\'type\']"' + argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' output = self.run_script(argument) self.assertEqual(output.strip(), 'LeafRouter') @@ -71,44 +71,49 @@ def test_render_template(self): self.assertEqual(output.strip(), 'value1\nvalue2') def test_minigraph_acl(self): - argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_acls' + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'dataacl': {'IsMirror': False, 'AttachTo': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'dataacl': {'type': 'L3', 'policy_desc': 'dataacl', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") def test_minigraph_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v \'INTERFACE.keys()\'' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.58/31'), 'peer_addr': IPv4Address('10.0.0.59'), 'addr': IPv4Address('10.0.0.58'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'Ethernet0', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::74/126'), 'peer_addr': IPv6Address('fc00::76'), 'addr': IPv6Address('fc00::75'), 'mask': '126', 'attachto': 'Ethernet0', 'prefixlen': 126}]") + self.assertEqual(output.strip(), "[('Ethernet0', '10.0.0.58/31'), ('Ethernet0', 'FC00::75/126')]") def test_minigraph_vlans(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlans' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Vlan1000': {'name': 'Vlan1000', 'members': ['Ethernet8'], 'vlanid': '1000'}}") + self.assertEqual(output.strip(), "{'Vlan1000': {'members': ['Ethernet8'], 'vlanid': '1000'}}") def test_minigraph_vlan_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlan_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE.keys()"' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'prefixlen': 27, 'subnet': IPv4Network('192.168.0.0/27'), 'mask': IPv4Address('255.255.255.224'), 'addr': IPv4Address('192.168.0.1'), 'attachto': 'Vlan1000'}]") + self.assertEqual(output.strip(), "[('Vlan1000', '192.168.0.1/27')]") def test_minigraph_portchannels(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannels' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'name': 'PortChannel01', 'members': ['Ethernet4']}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet4']}}") def test_minigraph_portchannels_more_member(self): - argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v minigraph_portchannels' + argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'name': 'PortChannel01', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") def test_minigraph_portchannel_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannel_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORTCHANNEL_INTERFACE.keys()"' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.56/31'), 'peer_addr': IPv4Address('10.0.0.57'), 'addr': IPv4Address('10.0.0.56'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'PortChannel01', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::70/126'), 'peer_addr': IPv6Address('fc00::72'), 'addr': IPv6Address('fc00::71'), 'mask': '126', 'attachto': 'PortChannel01', 'prefixlen': 126}]") + self.assertEqual(output.strip(), "[('PortChannel01', 'FC00::71/126'), ('PortChannel01', '10.0.0.56/31')]") def test_minigraph_neighbors(self): - argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_neighbors' + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "DEVICE_NEIGHBOR[\'Ethernet124\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, 'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, 'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, 'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") + self.assertEqual(output.strip(), "{'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}") + + def test_minigraph_bgp(self): + argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "BGP_NEIGHBOR[\'10.0.0.59\']"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'rrclient': '0', 'local_addr': '10.0.0.58', 'asn': '64600', 'name': 'ARISTA02T1'}") def test_minigraph_peers_with_range(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v BGP_PEER_RANGE.values\(\)' @@ -116,11 +121,11 @@ def test_minigraph_peers_with_range(self): self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]") def test_minigraph_deployment_id(self): - argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id' + argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' output = self.run_script(argument) self.assertEqual(output.strip(), "1") def test_minigraph_ethernet_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v ethernet_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'speed': '10000', 'name': 'fortyGigE0/0'}, {'speed': '25000', 'name': 'fortyGigE0/4'}, {'speed': '40000', 'name': 'fortyGigE0/8'}, {'speed': '1000000', 'name': 'fortyGigE0/12'}]") + self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'speed': '40000'}") diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 0f9264eb1d3b..4bdc1b41f5b4 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -26,10 +26,16 @@ def test_interfaces(self): def test_alias_map(self): alias_map_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-snmp-sv2', 'alias_map.j2') - argument = '-m "' + self.t0_minigraph + '" -p "' + self.t0_port_config + '" -t "' + alias_map_template + '"' + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + alias_map_template output = self.run_script(argument) data = json.loads(output) self.assertEqual(data["Ethernet4"], "fortyGigE0/4") + + def test_lldp(self): + lldpd_conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-lldp-sv2', 'lldpd.conf.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + lldpd_conf_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'lldpd.conf'), self.output_file)) def test_teamd(self): @@ -40,7 +46,7 @@ def test_render_teamd(self, pc, minigraph, sample_output): self.assertTrue(filecmp.cmp(sample_output, self.output_file)) # Test T0 minigraph - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' output = self.run_script(argument) # Mock the output via config.sh in docker-teamd pc_list = output.split() @@ -51,7 +57,7 @@ def test_render_teamd(self, pc, minigraph, sample_output): test_render_teamd(self, pc_name, self.t0_minigraph, sample_output) # Test port channel test minigraph - argument = '-m ' + self.pc_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' + argument = '-m ' + self.pc_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' output = self.run_script(argument) # Mock the output via config.sh in docker-teamd pc_list = output.split() diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index 5525eff96774..b8138cf36b18 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -110,13 +110,14 @@ def generate_rule_json(table_name, rule, max_priority, mirror): rule_props["TCP_FLAGS"] = '0x{:02x}/0x{:02x}'.format(tcp_flags, tcp_flags) return rule_data -def generate_table_json(aclset, aclname, ports, mirror, max_priority, output_path='.'): +def generate_table_json(aclset, aclname, ports, t_type, max_priority, output_path='.'): table_name = aclname.replace(" ", "_").replace("-", "_") #table_name = generate_random_table_name() + mirror = (t_type == 'mirror') table_props = {} table_props["policy_desc"] = table_name - table_props["type"] = "mirror" if mirror else "L3" + table_props["type"] = t_type table_props["ports"] = ports table_data = [{}] @@ -138,7 +139,7 @@ def translate_acl_fixed_port(filename, output_path, port, max_priority): yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") for aclsetname in yang_acl.acl.acl_sets.acl_set: aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] - generate_table_json(aclset, aclsetname, port, max_priority, output_path) + generate_table_json(aclset, aclsetname, port, 'l3', max_priority, output_path) return def translate_acl(filename, output_path, mini_acl, max_priority): @@ -146,10 +147,10 @@ def translate_acl(filename, output_path, mini_acl, max_priority): for aclsetname in yang_acl.acl.acl_sets.acl_set: tablename = aclsetname.replace(" ", "_").replace("-", "_") if mini_acl.has_key(tablename): - is_mirror = mini_acl[tablename]['IsMirror'] - ports = ','.join(mini_acl[tablename]['AttachTo']) + t_type = mini_acl[tablename]['type'] + ports = ','.join(mini_acl[tablename]['ports']) aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] - generate_table_json(aclset, aclsetname, ports, is_mirror, max_priority, output_path) + generate_table_json(aclset, aclsetname, ports, t_type, max_priority, output_path) return def main(): @@ -166,8 +167,8 @@ def main(): translate_acl_fixed_port(args.input, args.output_path, args.port, args.max_priority) elif args.minigraph: mini_data = parse_xml(args.minigraph, port_config_file=args.port_config) - if mini_data['minigraph_acls']: - translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) + if mini_data['ACL_TABLE']: + translate_acl(args.input, args.output_path, mini_data['ACL_TABLE'], args.max_priority) if __name__ == "__main__": main() diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 9b54b80f1783..96b4928e790b 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 9b54b80f1783808c5ae2a30e189f24a7404a8c95 +Subproject commit 96b4928e790bbce7c959f0b5cbb0510e5954afb1 diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 3f4afbbd9d7e..e4d24276cb6f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 3f4afbbd9d7ed2f077922e0cb0d59df743e34a9a +Subproject commit e4d24276cb6fc7122f756c637f30ddea27487c70 diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 186a4f65fbdd..bc4becf97ea6 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 186a4f65fbdde9d277d0aeef562e1fc196266fdb +Subproject commit bc4becf97ea69c15315414e8c7cba44067af2461 diff --git a/src/sonic-swss b/src/sonic-swss index eaccf67cabd2..bcdea1323e70 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit eaccf67cabd22df0ff7d0117fe55f4261bc961d9 +Subproject commit bcdea1323e70c73fa0a85c6df55eaed886bded81 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 4f917f2cc345..f6ff19bee131 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 4f917f2cc345c54d1bf9d9f01d96e4c01071ac9a +Subproject commit f6ff19bee131048f2274a21ea1064a8493a7fd8b diff --git a/src/sonic-utilities b/src/sonic-utilities index d1ded16b06b4..b27d4f9e976f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit d1ded16b06b493e2420d1013aee97afbdc8160d9 +Subproject commit b27d4f9e976f944f50d81e2354ba826194971774