diff --git a/.gitignore b/.gitignore index c5ed255e62a9..98ef49099546 100644 --- a/.gitignore +++ b/.gitignore @@ -12,28 +12,32 @@ target/ # Subdirectories in src src/hiredis/* !src/hiredis/Makefile +src/igb/* +!src/igb/Makefile src/initramfs-tools/* !src/initramfs-tools/Makefile -src/redis/* -!src/redis/Makefile +src/isc-dhcp/* +!src/isc-dhcp/Makefile +!src/isc-dhcp/patch/ src/libnl3/* !src/libnl3/Makefile src/libteam/* !src/libteam/Makefile -src/snmpd/* -!src/snmpd/Makefile -src/thrift/* -!src/thrift/Makefile -src/sonic-device-data/src/device/ -src/sonic-device-data/src/debian/ -src/igb/* -!src/igb/Makefile src/mpdecimal/* !src/mpdecimal/Makefile src/python3/* !src/python3/Makefile +src/redis/* +!src/redis/Makefile +src/snmpd/* +!src/snmpd/Makefile +src/sonic-device-data/src/device/ +src/sonic-device-data/src/debian/ src/supervisor/* !src/supervisor/Makefile +!src/supervisor/patch/ +src/thrift/* +!src/thrift/Makefile # Autogenerated Dockerfiles dockers/docker-base/Dockerfile @@ -46,6 +50,7 @@ dockers/docker-fpm-quagga/Dockerfile dockers/docker-lldp-sv2/Dockerfile dockers/docker-orchagent/Dockerfile dockers/docker-platform-monitor/Dockerfile +dockers/docker-router-advertiser/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-teamd/Dockerfile dockers/docker-sonic-mgmt/Dockerfile diff --git a/.gitmodules b/.gitmodules index cc2b5b416028..bcc9a8f3038a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,12 +10,6 @@ [submodule "sonic-swss"] path = src/sonic-swss url = https://github.com/Azure/sonic-swss -[submodule "src/p4-switch/switch"] - path = platform/p4/p4-switch/switch - url = https://github.com/krambn/switch -[submodule "src/p4-bmv2/behavioral-model"] - path = platform/p4/p4-bmv/behavioral-model - url = https://github.com/krambn/behavioral-model [submodule "src/p4c-bm/p4c-bm"] path = platform/p4/p4c-bm/p4c-bm url = https://github.com/krambn/p4c-bm @@ -56,6 +50,9 @@ [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/sonic-platform-common"] + path = src/sonic-platform-common + url = https://github.com/Azure/sonic-platform-common [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons @@ -68,3 +65,12 @@ [submodule "src/sonic-frr/frr"] path = src/sonic-frr/frr url = https://github.com/FRRouting/frr.git +[submodule "platform/p4/p4-hlir/p4-hlir-v1.1"] + path = platform/p4/p4-hlir/p4-hlir-v1.1 + url = https://github.com/p4lang/p4-hlir.git +[submodule "platform/p4/SAI-P4-BM"] + path = platform/p4/SAI-P4-BM + url = https://github.com/Mellanox/SAI-P4-BM.git +[submodule "platform/nephos/sonic-platform-modules-ingrasys"] + path = platform/nephos/sonic-platform-modules-ingrasys + url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys-nephos.git diff --git a/Makefile b/Makefile index 800cd32093e3..aa3492561cb2 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ # * 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. +# * SOURCE_FOLDER: host path to be mount as /var/src, only effective when KEEP_SLAVE_ON=yes +# * SONIC_BUILD_JOB: Specifying number of concurrent build job(s) to run # ############################################################################### @@ -33,10 +35,14 @@ SLAVE_IMAGE = sonic-slave-$(USER) DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ -w /sonic \ + -e "http_proxy=$(http_proxy)" \ + -e "https_proxy=$(https_proxy)" \ -i$(if $(TERM),t,) DOCKER_BASE_BUILD = docker build --no-cache \ -t $(SLAVE_BASE_IMAGE) \ + --build-arg http_proxy=$(http_proxy) \ + --build-arg https_proxy=$(https_proxy) \ sonic-slave && \ docker tag $(SLAVE_BASE_IMAGE):latest $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) @@ -58,9 +64,12 @@ SONIC_BUILD_INSTRUCTION := make \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ PASSWORD=$(PASSWORD) \ - USERNAME=$(USERNAME) + USERNAME=$(USERNAME) \ + SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + HTTP_PROXY=$(http_proxy) \ + HTTPS_PROXY=$(https_proxy) -.PHONY: sonic-slave-build sonic-slave-bash init +.PHONY: sonic-slave-build sonic-slave-bash init reset .DEFAULT_GOAL := all @@ -72,7 +81,11 @@ SONIC_BUILD_INSTRUCTION := make \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } ifeq "$(KEEP_SLAVE_ON)" "yes" - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + ifdef SOURCE_FOLDER + @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + else + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + endif else @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@ endif @@ -91,5 +104,18 @@ sonic-slave-bash : @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash init : - git submodule update --init --recursive - git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' + @git submodule update --init --recursive + @git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' + +reset : + @echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " + @read ans && \ + if [ $$ans == y ]; then \ + git clean -xfdf; \ + git reset --hard; \ + git submodule foreach --recursive git clean -xfdf; \ + git submodule foreach --recursive git reset --hard; \ + git submodule update --init --recursive;\ + else \ + echo "Reset aborted"; \ + fi diff --git a/README.md b/README.md index bbae2e150b8e..e368b60291b1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ -*master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) -Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) -P4: [![P4](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) -VS: [![VS](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all) - -*201709*: Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) -Centec: [![Centec](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) -Nephos: [![Nephos](https://sonic-jenkins.westus.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/) -Marvell: [![Marvell](https://sonic-jenkins.westus.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/) +*master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) +Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) +Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all) +P4: [![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all) +VS: [![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all) + +*201709*: +Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/) +Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) +Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) +Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/) +Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/) +Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/) # sonic-buildimage @@ -27,12 +31,17 @@ Please refer to [SONiC roadmap](https://github.com/Azure/SONiC/wiki/Sonic-Roadma ## Clone or fetch the code repository with all git submodules To clone the code repository recursively, assuming git version 1.9 or newer: - git clone --recursive https://github.com/Azure/sonic-buildimage.git + git clone https://github.com/Azure/sonic-buildimage.git ## Usage To build SONiC installer image and docker images, run the following commands: + cd sonic-buildimage + + # (Optional) Checkout a specific branch. By default, it uses master branch + git checkout [branch_name] + # Execute make init once after cloning the repo, or fetched remote repo with submodule updates make init @@ -41,8 +50,11 @@ To build SONiC installer image and docker images, run the following commands: make - **NOTE**: We recommend reserving 50G free space to build one platform. - + **NOTE**: + +- We recommend reserving 50G free space to build one platform. +- Use ```http_proxy=[your_proxy] https_proxy=[your_proxy] make``` to enable http(s) proxy in the build process. + The SONiC installer contains all docker images needed. SONiC uses one image for all devices of a same ASIC vendor. The supported ASIC vendors are: - PLATFORM=broadcom @@ -50,6 +62,7 @@ The SONiC installer contains all docker images needed. SONiC uses one image for - PLATFORM=mellanox - PLATFORM=cavium - PLATFORM=centec +- PLATFORM=nephos - PLATFORM=p4 - PLATFORM=vs @@ -93,9 +106,11 @@ This may take a while, but it is a one-time action, so please be patient. - docker-orchagent-brcm.gz: docker image for SWitch State Service (SWSS) on Broadcom platform (gzip tar archive) - docker-orchagent-cavm.gz: docker image for SWitch State Service (SWSS) on Cavium platform (gzip tar archive) - docker-orchagent-mlnx.gz: docker image for SWitch State Service (SWSS) on Mellanox platform (gzip tar archive) + - docker-orchagent-nephos.gz: docker image for SWitch State Service (SWSS) on Nephos platform (gzip tar archive) - docker-syncd-brcm.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) - docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) - docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) + - docker-syncd-nephos.gz: docker image for the daemon to sync database and Nephos switch ASIC (gzip tar archive) - docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) - docker-sonic-vs.gz: docker image for all-in-one for software virtual switch (gzip tar archive) diff --git a/build_debian.sh b/build_debian.sh index 3c6673a53ec4..6a27bd5d237f 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -68,7 +68,7 @@ touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime ## Build a basic Debian system by debootstrap echo '[INFO] Debootstrap...' -sudo debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian +sudo http_proxy=$http_proxy debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://debian-archive.trafficmanager.net/debian ## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...' sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname" @@ -79,6 +79,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '127.0.0.1 localhos sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "proc /proc proc defaults 0 0" >> /etc/fstab' sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "sysfs /sys sysfs defaults 0 0" >> /etc/fstab' +## Setup proxy +[ -n "$http_proxy" ] && sudo /bin/bash -c "echo 'Acquire::http::Proxy \"$http_proxy\";' > $FILESYSTEM_ROOT/etc/apt/apt.conf.d/01proxy" + ## Note: mounting is necessary to makedev and install linux image echo '[INFO] Mount all' ## Output all the mounted device for troubleshooting @@ -123,6 +126,8 @@ sudo cp files/initramfs-tools/arista-convertfs $FILESYSTEM_ROOT/etc/initramfs-to sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs +sudo cp files/initramfs-tools/setfacl $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl # Hook into initramfs: rename the management interfaces on arista switches sudo cp files/initramfs-tools/arista-net $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net @@ -142,6 +147,9 @@ sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel igb driver sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko +## Install latest intel ixgbe driver +sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko + ## Install docker echo '[INFO] Install docker' ## Install apparmor utils since they're missing and apparmor is enabled in the kernel @@ -208,6 +216,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in less \ unzip \ gdisk \ + sysfsutils \ grub2-common sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ @@ -224,6 +233,8 @@ sudo cp files/sshd/host-ssh-keygen.sh $FILESYSTEM_ROOT/usr/local/bin/ sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.service ## Config sshd sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTEM_ROOT +sudo sed -i 's/^ListenAddress ::/#ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/sshd_config +sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' $FILESYSTEM_ROOT/etc/ssh/sshd_config ## Config monit sudo sed -i ' @@ -285,8 +296,8 @@ set /files/etc/sysctl.conf/net.core.rmem_max 2097152 " -r $FILESYSTEM_ROOT ## docker-py is needed by Ansible docker module -sudo LANG=C chroot $FILESYSTEM_ROOT easy_install pip -sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT easy_install pip +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' ## Note: keep pip installed for maintainance purpose ## Create /var/run/redis folder for docker-database to mount @@ -310,7 +321,7 @@ sudo cp files/dhcp/dhclient.conf $FILESYSTEM_ROOT/etc/dhcp/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml > /dev/null < + - OCPSCH0104001MS - 10.10.1.26 - switch1 - 10.10.1.25 + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 1 - 10 - 3 + 180 + 60 - OCPSCH0104002MS - 10.10.2.26 - switch1 - 10.10.2.25 + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 1 - 10 - 3 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 - 64536 - switch1 + 65100 + sonic -
10.10.1.26
+
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.10.2.26
+
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
@@ -40,13 +460,163 @@
- 64542 - OCPSCH0104001MS + 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 - 64543 - OCPSCH0104002MS + 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
@@ -58,10 +628,10 @@ HostIP Loopback0 - - 100.0.0.9/32 + + 10.1.0.32/32 - 100.0.0.9/32 + 10.1.0.32/32 @@ -69,19 +639,369 @@ - switch1 + sonic - - Ethernet48 - 10.10.1.25/30 + + tenGigE0 + 10.0.0.0/31 + + + + tenGigE1 + 10.0.0.2/31 + + + + tenGigE2 + 10.0.0.4/31 + + + + tenGigE3 + 10.0.0.6/31 + + + + tenGigE4 + 10.0.0.8/31 + + + + tenGigE5 + 10.0.0.10/31 + + + + tenGigE6 + 10.0.0.12/31 + + + + tenGigE7 + 10.0.0.14/31 + + + + tenGigE8 + 10.0.0.16/31 + + + + tenGigE9 + 10.0.0.18/31 + + + + tenGigE10 + 10.0.0.20/31 + + + + tenGigE11 + 10.0.0.22/31 + + + + tenGigE12 + 10.0.0.24/31 + + + + tenGigE13 + 10.0.0.26/31 + + + + tenGigE14 + 10.0.0.28/31 + + + + tenGigE15 + 10.0.0.30/31 + + + + tenGigE16 + 10.0.0.32/31 + + + + tenGigE17 + 10.0.0.34/31 + + + + tenGigE18 + 10.0.0.36/31 + + + + tenGigE19 + 10.0.0.38/31 + + + + tenGigE20 + 10.0.0.40/31 + + + + tenGigE21 + 10.0.0.42/31 + + + + tenGigE22 + 10.0.0.44/31 + + + + tenGigE23 + 10.0.0.46/31 + + + + tenGigE24 + 10.0.0.48/31 + + + + tenGigE25 + 10.0.0.50/31 + + + + tenGigE26 + 10.0.0.52/31 + + + + tenGigE27 + 10.0.0.54/31 + + + + tenGigE28 + 10.0.0.56/31 + + + + tenGigE29 + 10.0.0.58/31 + + + + tenGigE30 + 10.0.0.60/31 + + + + tenGigE31 + 10.0.0.62/31 + + + + tenGigE32 + 10.0.0.64/31 + + + + tenGigE33 + 10.0.0.66/31 + + + + tenGigE34 + 10.0.0.68/31 + + + + tenGigE35 + 10.0.0.70/31 + + + + tenGigE36 + 10.0.0.72/31 + + + + tenGigE37 + 10.0.0.74/31 + + + + tenGigE38 + 10.0.0.76/31 + + + + tenGigE39 + 10.0.0.78/31 - - Ethernet52 - 10.10.2.25/30 + + tenGigE40 + 10.0.0.80/31 + + + + tenGigE41 + 10.0.0.82/31 + + + + tenGigE42 + 10.0.0.84/31 + + + + tenGigE43 + 10.0.0.86/31 + + + + tenGigE44 + 10.0.0.88/31 + + + + tenGigE45 + 10.0.0.90/31 + + + + tenGigE46 + 10.0.0.92/31 + + + + tenGigE47 + 10.0.0.94/31 + + + + tenGigE48 + 10.0.0.96/31 + + + + tenGigE49 + 10.0.0.98/31 + + + + tenGigE50 + 10.0.0.100/31 + + + + tenGigE51 + 10.0.0.102/31 + + + + tenGigE52 + 10.0.0.104/31 + + + + tenGigE53 + 10.0.0.106/31 + + + + tenGigE54 + 10.0.0.108/31 + + + + tenGigE55 + 10.0.0.110/31 + + + + tenGigE56 + 10.0.0.112/31 + + + + tenGigE57 + 10.0.0.114/31 + + + + tenGigE58 + 10.0.0.116/31 + + + + tenGigE59 + 10.0.0.118/31 + + + + tenGigE60 + 10.0.0.120/31 + + + + tenGigE61 + 10.0.0.122/31 + + + + tenGigE62 + 10.0.0.124/31 + + + + tenGigE63 + 10.0.0.126/31 + + + + tenGigE64 + 10.0.0.128/31 + + + + tenGigE65 + 10.0.0.130/31 + + + + tenGigE66 + 10.0.0.132/31 + + + + tenGigE67 + 10.0.0.134/31 + + + + tenGigE68 + 10.0.0.136/31 + + + + tenGigE69 + 10.0.0.138/31 + + + + tenGigE70 + 10.0.0.140/31 + + + + tenGigE71 + 10.0.0.142/31 @@ -92,34 +1012,242 @@ - - 40000 + DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - switch1 - Ethernet48 + sonic + tenGigE0 + ARISTA01T2 + tenGigE1 - - 40000 + DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - switch1 - Ethernet52 + sonic + tenGigE1 + ARISTA02T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE2 + ARISTA03T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE3 + ARISTA04T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE4 + ARISTA05T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE5 + ARISTA06T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE6 + ARISTA07T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE7 + ARISTA08T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE8 + ARISTA09T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE9 + ARISTA10T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE10 + ARISTA11T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE11 + ARISTA12T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE12 + ARISTA13T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE13 + ARISTA14T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE14 + ARISTA15T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE15 + ARISTA16T2 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE16 + ARISTA01T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE17 + ARISTA02T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE18 + ARISTA03T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE19 + ARISTA04T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE20 + ARISTA05T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE21 + ARISTA06T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE22 + ARISTA07T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE23 + ARISTA08T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE24 + ARISTA09T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE25 + ARISTA10T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE26 + ARISTA11T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE27 + ARISTA12T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE28 + ARISTA13T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE29 + ARISTA14T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE30 + ARISTA15T0 + tenGigE1 + + + DeviceInterfaceLink + sonic + tenGigE31 + ARISTA16T0 + tenGigE1 - switch1 + sonic Accton-AS5712-54X - + - switch1 + sonic DhcpResources @@ -136,16 +1264,11 @@ - - ErspanDestinationIpv4 - - 2.2.2.2 - - switch1 + sonic Accton-AS5712-54X
diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py old mode 100644 new mode 100755 index 070b1da934cb..d554910ac5cd --- a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py @@ -14,12 +14,91 @@ class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 - PORT_END = 31 - PORTS_IN_BLOCK = 32 + PORT_END = 71 + PORTS_IN_BLOCK = 72 + QSFP_PORT_START = 48 + QSFP_PORT_END = 72 - EEPROM_OFFSET = 20 + BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" + + _port_to_is_present = {} + _port_to_lp_mode = {} _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [2, 2], + 1: [3, 3], + 2: [4, 4], + 3: [5, 5], + 4: [6, 6], + 5: [7, 7], + 6: [8, 8], + 7: [9, 9], + 8: [10, 10], + 9: [11, 11], + 10: [12, 12], + 11: [13, 13], + 12: [14, 14], + 13: [15, 15], + 14: [16, 16], + 15: [17, 17], + 16: [18, 18], + 17: [19, 19], + 18: [20, 20], + 19: [21, 21], + 20: [22, 22], + 21: [23, 23], + 22: [24, 24], + 23: [25, 25], + 24: [26, 26], + 25: [27, 27], + 26: [28, 28], + 27: [29, 29], + 28: [30, 30], + 29: [31, 31], + 30: [32, 32], + 31: [33, 33], + 32: [34, 34], + 33: [35, 35], + 34: [36, 36], + 35: [37, 37], + 36: [38, 38], + 37: [39, 39], + 38: [40, 40], + 39: [41, 41], + 40: [42, 42], + 41: [43, 43], + 42: [44, 44], + 43: [45, 45], + 44: [46, 46], + 45: [47, 47], + 46: [48, 48], + 47: [49, 49], + 48: [50, 50], #QSFP49 + 49: [50, 50], + 50: [50, 50], + 51: [50, 50], + 52: [52, 52], #QSFP50 + 53: [52, 52], + 54: [52, 52], + 55: [52, 52], + 56: [54, 54], #QSFP51 + 57: [54, 54], + 58: [54, 54], + 59: [54, 54], + 60: [51, 51], #QSFP52 + 61: [51, 51], + 62: [51, 51], + 63: [51, 51], + 64: [53, 53], #QSFP53 + 65: [53, 53], + 66: [53, 53], + 67: [53, 53], + 68: [55, 55], #QSFP54 + 69: [55, 55], + 70: [55, 55], + 71: [55, 55], + } @property def port_start(self): @@ -29,19 +108,29 @@ def port_start(self): def port_end(self): return self.PORT_END + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + eeprom_path = self.BASE_VAL_PATH + "sfp_eeprom" - for x in range(0, self.port_end + 1): - self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][0], + self._port_to_i2c_mapping[x][1]) SfpUtilBase.__init__(self) @@ -50,126 +139,84 @@ def get_presence(self, port_num): if port_num < self.port_start or port_num > self.port_end: return False + present_path = self.BASE_VAL_PATH + "sfp_is_present" + self.__port_to_is_present = present_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + try: - reg_file = open("/sys/devices/platform/accton/qsfp_modprs") + val_file = open(self.__port_to_is_present) except IOError as e: - print "Error: unable to open file: %s" % str(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) + content = val_file.readline().rstrip() + val_file.close() - # Mask off the bit corresponding to our port - mask = (1 << port_num) - - # ModPrsL is active low - if reg_value & mask == 0: + # 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: + def get_low_power_mode(self, port_num): + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - + + lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode" + self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + try: - reg_file = open("/sys/devices/platform/accton/qsfp_lpmode") + val_file = open(self.__port_to_lp_mode) except IOError as e: - print "Error: unable to open file: %s" % str(e) - - 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) - - # LPMode is active high - if reg_value & mask == 0: + print "Error: unable to open file: %s" % str(e) return False - return True + content = val_file.readline().rstrip() + val_file.close() - 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 + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + def set_low_power_mode(self, port_num, lpmode): + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode" + self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + try: - reg_file = open("/sys/devices/platform/accton/qsfp_lpmode", "r+") + reg_file = open(self.__port_to_lp_mode, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(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) - - # LPMode is active high; set or clear the bit accordingly if lpmode is True: - reg_value = reg_value | mask + reg_value = '1' else: - reg_value = reg_value & ~mask + reg_value = '0' - # 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.write(reg_value) reg_file.close() return True def reset(self, port_num): - QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/accton/qsfp_reset" - - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - + + mod_rst_path = self.BASE_VAL_PATH + "sfp_mod_rst" + self.__port_to_mod_rst = mod_rst_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) try: - reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + reg_file = open(self.__port_to_mod_rst, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(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) + reg_value = '1' - # 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.write(reg_value) reg_file.close() - - return True + + return True \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml index 8547ceacbc58..a967047b237b 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -924,224 +924,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet1 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet2 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet3 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet5 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet6 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet7 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet9 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet10 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet11 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet13 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet14 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet15 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet17 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet18 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet19 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet21 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet22 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet23 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet25 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet26 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet27 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet29 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet30 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet31 ARISTA16T0 Ethernet1 @@ -1149,7 +1149,7 @@ - switch1 + sonic Accton-AS7312-54X @@ -1157,7 +1157,7 @@ - switch1 + sonic DhcpResources @@ -1179,6 +1179,6 @@ - switch1 + sonic Accton-AS7312-54X diff --git a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml index 758aca3551d6..ac05be93960a 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic AS7512 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic AS7512 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/fancontrol b/device/accton/x86_64-accton_as7712_32x-r0/fancontrol new file mode 100644 index 000000000000..9d057024f946 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +FCTEMPS=/sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/sys_temp +FCFANS=/sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan1_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan2_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan3_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan4_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan5_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan6_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan11_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan12_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan13_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan14_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan15_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan16_input +MINTEMP=/sys/bus/i2c/devices/2-0066/pwm1=135 +MAXTEMP=/sys/bus/i2c/devices/2-0066/pwm1=160 +MINSTART=/sys/bus/i2c/devices/2-0066/pwm1=100 +MINSTOP=/sys/bus/i2c/devices/2-0066/pwm1=32 +MINPWM=/sys/bus/i2c/devices/2-0066/pwm1=32 +MAXPWM=/sys/bus/i2c/devices/2-0066/pwm1=69 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml index 025985c83675..d252de01ca8a 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Accton-AS7712-32X @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1069,6 +1069,6 @@ - switch1 + sonic Accton-AS7712-32X diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..d7600a2af4b1 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "11-0053", + 2: "10-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py index 6dc35d72bb21..2e636292bfa9 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py @@ -1,19 +1,20 @@ #!/usr/bin/env python try: - from sonic_sfp.sfputilbase import sfputilbase + import time + from sonic_sfp.sfputilbase import SfpUtilBase except ImportError, e: raise ImportError (str(e) + "- required module not found") -class sfputil(sfputilbase): - """Platform specific sfputil class""" +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" - port_start = 0 - port_end = 31 + _port_start = 0 + _port_end = 31 ports_in_block = 32 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 9 : 18, 10 : 19, @@ -51,10 +52,77 @@ class sfputil(sfputilbase): _qsfp_ports = range(0, ports_in_block + 1) - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization + def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' - for x in range(self.port_start, self.port_end + 1): + for x in range(0, self._port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1]) - self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + self._port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedError + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + 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 + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + @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 + + diff --git a/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf b/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf new file mode 100644 index 000000000000..33d75d598123 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf @@ -0,0 +1,23 @@ +# libsensors configuration file for AS7712-32X +# ------------------------------------------------ +# + +#Comment out the following for sku-sensors-data.yml +#chip "ym2651-*" +# label power1 "PSU Output Power" +# label temp1 "Power Supply Temp" +# label fan1 "Fan Speed" +# +#chip "as7712_32x_fan-*" +# label fan1 "Fan tray 1 front" +# label fan2 "Fan tray 2 front" +# label fan3 "Fan tray 3 front" +# label fan4 "Fan tray 4 front" +# label fan5 "Fan tray 5 front" +# label fan6 "Fan tray 6 front" +# label fan11 "Fan tray 1 rear" +# label fan12 "Fan tray 2 rear" +# label fan13 "Fan tray 3 rear" +# label fan14 "Fan tray 4 rear" +# label fan15 "Fan tray 5 rear" +# label fan16 "Fan tray 6 rear" diff --git a/device/accton/x86_64-accton_as7716_32x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7716_32x-r0/led_proc_init.soc new file mode 100755 index 000000000000..719cb777719f --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/led_proc_init.soc @@ -0,0 +1,41 @@ +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 REMAP_PORT_1=30 REMAP_PORT_2=29 REMAP_PORT_3=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 REMAP_PORT_5=26 REMAP_PORT_6=25 REMAP_PORT_7=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 REMAP_PORT_9=22 REMAP_PORT_10=21 REMAP_PORT_11=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 REMAP_PORT_13=18 REMAP_PORT_14=17 REMAP_PORT_15=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=62 REMAP_PORT_18=61 REMAP_PORT_19=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=59 REMAP_PORT_21=58 REMAP_PORT_22=57 REMAP_PORT_23=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=55 REMAP_PORT_25=54 REMAP_PORT_26=53 REMAP_PORT_27=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=51 REMAP_PORT_29=50 REMAP_PORT_30=49 REMAP_PORT_31=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=47 REMAP_PORT_33=46 REMAP_PORT_34=45 REMAP_PORT_35=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=43 REMAP_PORT_37=42 REMAP_PORT_38=41 REMAP_PORT_39=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=39 REMAP_PORT_41=38 REMAP_PORT_42=37 REMAP_PORT_43=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=35 REMAP_PORT_45=34 REMAP_PORT_46=33 REMAP_PORT_47=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 REMAP_PORT_49=14 REMAP_PORT_50=13 REMAP_PORT_51=12 +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=35 REMAP_PORT_1=34 REMAP_PORT_2=33 REMAP_PORT_3=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=39 REMAP_PORT_5=38 REMAP_PORT_6=37 REMAP_PORT_7=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=43 REMAP_PORT_9=42 REMAP_PORT_10=41 REMAP_PORT_11=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=47 REMAP_PORT_13=46 REMAP_PORT_14=45 REMAP_PORT_15=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=3 REMAP_PORT_17=2 REMAP_PORT_18=1 REMAP_PORT_19=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=7 REMAP_PORT_21=6 REMAP_PORT_22=5 REMAP_PORT_23=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=11 REMAP_PORT_25=10 REMAP_PORT_26=9 REMAP_PORT_27=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=15 REMAP_PORT_29=14 REMAP_PORT_30=13 REMAP_PORT_31=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 REMAP_PORT_33=18 REMAP_PORT_34=17 REMAP_PORT_35=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 REMAP_PORT_41=26 REMAP_PORT_42=25 REMAP_PORT_43=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 REMAP_PORT_45=30 REMAP_PORT_46=29 REMAP_PORT_47=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + +led 0 prog 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 E0 02 FB 42 40 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 84 67 98 57 80 18 71 EB 67 98 67 84 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 1 prog 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 E0 02 FB 42 40 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 84 67 98 57 80 18 71 EB 67 98 67 84 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 \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml index e197d4cd7178..148a17769129 100644 --- a/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Accton-AS7716-32X @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1069,6 +1069,6 @@ - switch1 + sonic Accton-AS7716-32X diff --git a/device/accton/x86_64-accton_as7716_32x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7716_32x-r0/plugins/eeprom.py new file mode 100755 index 000000000000..c0122e65844a --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7716_32x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7716_32x-r0/plugins/psuutil.py new file mode 100755 index 000000000000..d8fddc23550b --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "18-0053", + 2: "17-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py new file mode 100755 index 000000000000..7a36db7cf458 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py @@ -0,0 +1,134 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + 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 + + BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" + BASE_CPLD_PATH = "/sys/bus/i2c/devices/11-0060/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [1, 29], + 1: [2, 30], + 2: [3, 31], + 3: [4, 32], + 4: [5, 34], + 5: [6, 33], + 6: [7, 36], + 7: [8, 35], + 8: [9, 25], + 9: [10, 26], + 10: [11, 27], + 11: [12, 28], + 12: [14, 37], + 13: [15, 38], + 14: [16, 39], + 15: [17, 40], + 16: [18, 41], + 17: [19, 42], + 18: [20, 43], + 19: [21, 44], + 20: [22, 53], + 21: [23, 54], + 22: [24, 55], + 23: [25, 56], + 24: [26, 45], + 25: [27, 46], + 26: [28, 47], + 27: [29, 48], + 28: [30, 49], + 29: [31, 50], + 30: [32, 51], + 31: [33, 52], + } + + @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(self.PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = self.BASE_OOM_PATH + "eeprom" + + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][1] + ) + + 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 + + present_path = self.BASE_CPLD_PATH + "module_present_" + str(port_num+1) + self.__port_to_is_present = present_path + + try: + val_file = open(self.__port_to_is_present) + 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): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + if port_num < self.port_start or port_num > self.port_end: + return False + + mod_rst_path = self.BASE_CPLD_PATH + "module_reset_" + str(port_num+1) + self.__port_to_mod_rst = mod_rst_path + try: + reg_file = open(self.__port_to_mod_rst, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = '1' + + reg_file.write(reg_value) + reg_file.close() + + return True \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/port_config.ini b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/port_config.ini new file mode 100644 index 000000000000..f6c7b0c4a876 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/port_config.ini @@ -0,0 +1 @@ +# name lanes alias diff --git a/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/installer.conf b/device/accton/x86_64-accton_as7816_64x-r0/installer.conf new file mode 100644 index 000000000000..5e62742c11bf --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/installer.conf @@ -0,0 +1 @@ +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7816_64x-r0/led_proc_init.soc new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml b/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml new file mode 100644 index 000000000000..d252de01ca8a --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml @@ -0,0 +1,1074 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
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 + + + + + + + + sonic + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + sonic + Accton-AS7712-32X + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + sonic + Accton-AS7712-32X +
diff --git a/device/accton/x86_64-accton_as7816_64x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7816_64x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..1e7d1046d93d --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..7c82583c26bb --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 63 + ports_in_block = 64 + + _port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 61 : 25, + 62 : 26, + 63 : 27, + 64 : 28, + 55 : 29, + 56 : 30, + 53 : 31, + 54 : 32, + 9 : 33, + 10 : 34, + 11 : 35, + 12 : 36, + 1 : 37, + 2 : 38, + 3 : 39, + 4 : 40, + 6 : 41, + 5 : 42, + 8 : 43, + 7 : 44, + 13 : 45, + 14 : 46, + 15 : 47, + 16 : 48, + 17 : 49, + 18 : 50, + 19 : 51, + 20 : 52, + 25 : 53, + 26 : 54, + 27 : 55, + 28 : 56, + 29 : 57, + 30 : 58, + 31 : 59, + 32 : 60, + 21 : 61, + 22 : 62, + 23 : 63, + 24 : 64, + 41 : 65, + 42 : 66, + 43 : 67, + 44 : 68, + 33 : 69, + 34 : 70, + 35 : 71, + 36 : 72, + 45 : 73, + 46 : 74, + 47 : 75, + 48 : 76, + 37 : 77, + 38 : 78, + 39 : 79, + 40 : 80, + 57 : 81, + 58 : 82, + 59 : 83, + 60 : 84, + 49 : 85, + 50 : 86, + 51 : 87, + 52 : 88,} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' + for x in range(0, self._port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1]) + self._port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedErro + + def get_low_power_mode(self, port_num): + raise NotImplementedErro + + 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 + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + @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 + + diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 new file mode 100644 index 000000000000..560cae5dd1b4 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 @@ -0,0 +1,135 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "7274496", + "type": "ingress", + "mode": "static" + }, + "ingress_lossy_pool": { + "size": "5491712", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool0": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossless_pool1": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "5491712", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossless_profile0": { + "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossless_profile1": { + "pool":"[BUFFER_POOL|egress_lossless_pool1]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" + }, + "{{ port_names }}|4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini new file mode 100644 index 000000000000..f3a0840558a6 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 113664 18432 76800 0 + 25000 5m 113664 18432 76800 0 + 40000 5m 113664 18432 76800 0 + 50000 5m 113664 18432 76800 0 + 100000 5m 113664 18432 76800 0 + 10000 40m 113664 18432 76800 0 + 25000 40m 113664 18432 76800 0 + 40000 40m 113664 18432 76800 0 + 50000 40m 113664 18432 76800 0 + 100000 40m 113664 18432 76800 0 + 10000 300m 113664 18432 76800 0 + 25000 300m 113664 18432 76800 0 + 40000 300m 113664 18432 76800 0 + 50000 300m 113664 18432 76800 0 + 100000 300m 113664 18432 76800 0 diff --git a/device/arista/x86_64-arista_7050_qx32/fancontrol b/device/arista/x86_64-arista_7050_qx32/fancontrol new file mode 100644 index 000000000000..02bf4d76dbec --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon1=devices/platform/sb800-fans hwmon2=devices/pci0000:00/0000:00:09.0/0000:04:00.0/i2c-2/2-004c +DEVNAME=hwmon1=fans hwmon2=max6658 +FCTEMPS=hwmon1/pwm4=hwmon2/temp1_input hwmon1/pwm3=hwmon2/temp1_input hwmon1/pwm2=hwmon2/temp1_input hwmon1/pwm1=hwmon2/temp1_input +FCFANS=hwmon1/pwm4=hwmon1/fan4_input hwmon1/pwm3=hwmon1/fan3_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm1=hwmon1/fan1_input +MINTEMP=hwmon1/pwm4=30 hwmon1/pwm3=30 hwmon1/pwm2=30 hwmon1/pwm1=30 +MINPWM=hwmon1/pwm4=179 hwmon1/pwm3=179 hwmon1/pwm2=179 hwmon1/pwm1=179 +MAXTEMP=hwmon1/pwm4=40 hwmon1/pwm3=40 hwmon1/pwm2=40 hwmon1/pwm1=40 +MINSTART=hwmon1/pwm4=179 hwmon1/pwm3=179 hwmon1/pwm2=179 hwmon1/pwm1=179 +MINSTOP=hwmon1/pwm4=179 hwmon1/pwm3=179 hwmon1/pwm2=179 hwmon1/pwm1=179 diff --git a/device/arista/x86_64-arista_7050_qx32/minigraph.xml b/device/arista/x86_64-arista_7050_qx32/minigraph.xml index bbf2508ce4cc..538a0ca61a0d 100644 --- a/device/arista/x86_64-arista_7050_qx32/minigraph.xml +++ b/device/arista/x86_64-arista_7050_qx32/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet2/1 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet3/1 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4/1 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet5/1 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet6/1 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet7/1 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8/1 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet9/1 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet10/1 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet11/1 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12/1 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet13/1 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet14/1 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet15/1 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16/1 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet17/1 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet18/1 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet19/1 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20/1 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet21/1 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet22/1 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet23/1 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24/1 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Arista-7050-QX32 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Arista-7050-QX32 diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/psuutil.py b/device/arista/x86_64-arista_7050_qx32/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/device/arista/x86_64-arista_7050_qx32/sensors.conf b/device/arista/x86_64-arista_7050_qx32/sensors.conf index dde0d35df8cb..469f63eaf1e4 100644 --- a/device/arista/x86_64-arista_7050_qx32/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32/sensors.conf @@ -12,38 +12,38 @@ chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" chip "lm73-i2c-3-48" - label temp1 "Rear Temp Sensor" + label temp1 "Back panel temp sensor" set temp1_max 65 #set temp1_max_alarm 75 # read-only chip "max6658-i2c-2-4c" - label temp1 "Board Temp Sensor" + label temp1 "Board temp sensor" set temp1_max 65 set temp1_crit 75 - label temp2 "Front-panel Temp Sensor" + label temp2 "Front panel temp sensor" set temp2_max 65 set temp2_crit 75 # disabled because of some eeprom corruption risks #chip "pmbus-i2c-3-4e" -# label temp1 "Power Controller Sensor 1" +# label temp1 "Power controller sensor 1" # set temp1_max 60 # set temp1_crit 70 -# label temp2 "Power Controller Sensor 2" +# label temp2 "Power controller sensor 2" # set temp2_max 60 # set temp2_crit 70 # ignore curr1 chip "dps460-i2c-5-58" - label temp1 "Power Supply 1 Sensor 1" + label temp1 "Power supply 1 inlet temp sensor" # maximum and critical thresholds are not supported for this psu set temp1_max 60 set temp1_crit 70 - label temp2 "Power Supply 1 Sensor 2" + label temp2 "Power supply 1 internal sensor" set temp2_max 60 set temp2_crit 70 @@ -60,12 +60,12 @@ chip "dps460-i2c-5-58" set curr2_crit 37 chip "dps460-i2c-6-58" - label temp1 "Power Supply 2 Sensor 1" + label temp1 "Power supply 2 inlet temp sensor" # maximum and critical thresholds are not supported for this psu set temp1_max 60 set temp1_crit 70 - label temp2 "Power Supply 2 Sensor 2" + label temp2 "Power supply 2 internal sensor" set temp2_max 60 set temp2_crit 70 diff --git a/device/arista/x86_64-arista_7050_qx32s/fancontrol b/device/arista/x86_64-arista_7050_qx32s/fancontrol new file mode 100644 index 000000000000..9c329897c9e4 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon2=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-2/2-004c hwmon4=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060 +DEVNAME=hwmon2=max6658 hwmon4=crow_cpld +FCTEMPS=hwmon4/pwm4=hwmon2/temp1_input hwmon4/pwm3=hwmon2/temp1_input hwmon4/pwm2=hwmon2/temp1_input hwmon4/pwm1=hwmon2/temp1_input +FCFANS=hwmon4/pwm4=hwmon4/fan4_input hwmon4/pwm3=hwmon4/fan3_input hwmon4/pwm2=hwmon4/fan2_input hwmon4/pwm1=hwmon4/fan1_input +MINTEMP=hwmon4/pwm4=35 hwmon4/pwm3=35 hwmon4/pwm2=35 hwmon4/pwm1=35 +MINPWM=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 +MAXTEMP=hwmon4/pwm4=45 hwmon4/pwm3=45 hwmon4/pwm2=45 hwmon4/pwm1=45 +MINSTART=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 +MINSTOP=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 diff --git a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml index efd30582947a..f28c9a9ae6cb 100644 --- a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet2/1 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet3/1 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4/1 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet5/1 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet6/1 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet7/1 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8/1 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet9/1 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet10/1 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet11/1 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12/1 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet13/1 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet14/1 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet15/1 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16/1 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet17/1 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet18/1 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet19/1 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20/1 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet21/1 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet22/1 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet23/1 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24/1 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Arista-7050-QX-32S @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Arista-7050-QX-32S diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/psuutil.py b/device/arista/x86_64-arista_7050_qx32s/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/device/arista/x86_64-arista_7050_qx32s/sensors.conf b/device/arista/x86_64-arista_7050_qx32s/sensors.conf index cf4977f1cc12..9c2dd38597a3 100644 --- a/device/arista/x86_64-arista_7050_qx32s/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32s/sensors.conf @@ -29,14 +29,6 @@ chip "max6658-i2c-3-4c" set temp2_max 75 set temp2_crit 80 -chip "pmbus-i2c-3-4e" - label temp1 "Power controller 1 sensor 1" - label temp2 "Power controller 1 sensor 2" - -chip "pmbus-i2c-7-4e" - label temp1 "Power controller 2 sensor 1" - label temp2 "Power controller 2 sensor 2" - chip "pmbus-i2c-6-58" label temp1 "Power supply 1 hotspot sensor" label temp2 "Power supply 1 inlet temp sensor" diff --git a/device/arista/x86_64-arista_7060_cx32s/fancontrol b/device/arista/x86_64-arista_7060_cx32s/fancontrol new file mode 100644 index 000000000000..e69f9d75acda --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-2/2-001a hwmon3=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060 +DEVNAME=hwmon1=max6697 hwmon3=crow_cpld +FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input +FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input +MINTEMP=hwmon3/pwm4=40 hwmon3/pwm3=40 hwmon3/pwm2=40 hwmon3/pwm1=40 +MINPWM=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 +MAXTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 +MINSTART=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 +MINSTOP=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 diff --git a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml index 23282de17af1..772325080e79 100644 --- a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet2/1 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet3/1 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4/1 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet5/1 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet6/1 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet7/1 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8/1 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet9/1 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet10/1 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet11/1 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12/1 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet13/1 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet14/1 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet15/1 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16/1 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet17/1 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet18/1 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet19/1 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20/1 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet21/1 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet22/1 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet23/1 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24/1 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet25/1 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet26/1 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet27/1 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28/1 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet29/1 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet30/1 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet31/1 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32/1 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Arista-7060CX-32S-C32 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Arista-7060CX-32S-C32 diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/psuutil.py b/device/arista/x86_64-arista_7060_cx32s/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/device/arista/x86_64-arista_7060_cx32s/sensors.conf b/device/arista/x86_64-arista_7060_cx32s/sensors.conf index 20ebbeb5bbc7..57e785881912 100644 --- a/device/arista/x86_64-arista_7060_cx32s/sensors.conf +++ b/device/arista/x86_64-arista_7060_cx32s/sensors.conf @@ -2,21 +2,34 @@ # ------------------------------------------------ # -bus "i2c-2" "SCD SMBus master 0 bus 0" -bus "i2c-3" "SCD SMBus master 0 bus 1" -bus "i2c-5" "SCD SMBus master 0 bus 3" -bus "i2c-6" "SCD SMBus master 0 bus 4" -bus "i2c-7" "SCD SMBus master 0 bus 5" +bus "i2c-2" "SCD 0000:02:00.0 SMBus master 0 bus 0" +bus "i2c-3" "SCD 0000:02:00.0 SMBus master 0 bus 1" +bus "i2c-5" "SCD 0000:02:00.0 SMBus master 0 bus 3" +bus "i2c-6" "SCD 0000:02:00.0 SMBus master 0 bus 4" +bus "i2c-7" "SCD 0000:02:00.0 SMBus master 0 bus 5" chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" -# missing support for -# chip "max6697-i2c-2-1a" -# board sensor 65 75 -# (1) switch chip left sensor 95 105 -# (5) switch chip right sensor 95 105 -# (6) front panel temp sensor 65 75 +chip "max6697-i2c-2-1a" + label temp1 "Board sensor" + set temp1_max 95 + + label temp2 "Switch chip left sensor" + set temp2_max 95 + set temp2_crit 105 + + ignore temp3 + ignore temp4 + ignore temp5 + + label temp6 "Switch chip right sensor" + set temp6_max 95 + set temp6_crit 105 + + label temp7 "Front panel temp sensor" + set temp7_max 65 + set temp7_crit 75 chip "max6658-i2c-3-4c" label temp1 "Cpu board temp sensor" @@ -27,20 +40,12 @@ chip "max6658-i2c-3-4c" set temp2_max 75 set temp2_crit 80 -chip "pmbus-i2c-3-4e" - label temp1 "Power controller 1 sensor 1" - label temp2 "Power controller 1 sensor 2" - -chip "pmbus-i2c-7-4e" - label temp1 "Power controller 2 sensor 1" - label temp2 "Power controller 2 sensor 2" - chip "pmbus-i2c-6-58" label temp1 "Power supply 1 hotspot sensor" label temp2 "Power supply 1 inlet temp sensor" - label temp3 "Power supply 1 sensor" + label temp3 "Power supply 1 exhaust temp sensor" chip "pmbus-i2c-5-58" label temp1 "Power supply 2 hotspot sensor" label temp2 "Power supply 2 inlet temp sensor" - label temp3 "Power supply 2 sensor" + label temp3 "Power supply 2 exhaust temp sensor" 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 541b197f6bb8..d67a4f1bc016 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 @@ -33,10 +33,12 @@ Ethernet60 121,122 Ethernet16/1 16 Ethernet62 123,124 Ethernet16/3 16 Ethernet64 141,142 Ethernet17/1 17 Ethernet66 143,144 Ethernet17/3 17 -Ethernet68 133,134,135,136 Ethernet18/1 18 +Ethernet68 133,134 Ethernet18/1 18 +Ethernet70 135,136 Ethernet18/3 18 Ethernet72 197,198 Ethernet19/1 19 Ethernet74 199,200 Ethernet19/3 19 -Ethernet76 205,206,207,208 Ethernet20/1 20 +Ethernet76 205,206 Ethernet20/1 20 +Ethernet78 207,208 Ethernet20/3 20 Ethernet80 217,218 Ethernet21/1 21 Ethernet82 219,220 Ethernet21/3 21 Ethernet84 213,214 Ethernet22/1 22 diff --git a/device/arista/x86_64-arista_7260cx3_64/fancontrol b/device/arista/x86_64-arista_7260cx3_64/fancontrol new file mode 100644 index 000000000000..c78f598ff111 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-1/1-004c hwmon3=devices/pci0000:ff/0000:ff:0b.3/i2c-85/85-0060 +DEVNAME=hwmon1=max6658 hwmon3=rook_cpld +FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input +FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input +MINTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 +MINPWM=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 +MAXTEMP=hwmon3/pwm4=60 hwmon3/pwm3=60 hwmon3/pwm2=60 hwmon3/pwm1=60 +MINSTART=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 +MINSTOP=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 diff --git a/device/arista/x86_64-arista_7260cx3_64/platform_reboot b/device/arista/x86_64-arista_7260cx3_64/platform_reboot new file mode 100755 index 000000000000..8a3722461157 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/platform_reboot @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. +# Arista Networks, Inc. Confidential and Proprietary. + +# Reboot script for 7260CX3 + +from __future__ import print_function +import sys +import mmap, os +import subprocess +from struct import pack, unpack + +class MmapResource( object ): + """Resource implementation for a directly-mapped memory region.""" + + def __init__( self, path ): + try: + fd = os.open( path, os.O_RDWR ) + except EnvironmentError: + print( "FAIL can not open scd memory-map resource file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + try: + size = os.fstat( fd ).st_size + except EnvironmentError: + print( "FAIL can not fstat scd memory-map resource file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + try: + self.mmap_ = mmap.mmap( fd, size, mmap.MAP_SHARED, + mmap.PROT_READ | mmap.PROT_WRITE ) + except EnvironmentError: + print( "FAIL can not map scd memory-map file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + finally: + try: + # Note that closing the file descriptor has no effect on the memory map + os.close( fd ) + except EnvironmentError: + print( "FAIL failed to close scd memory-map file" ) + sys.exit( 1 ) + + def read32( self, addr ): + return unpack( ' ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60
- switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -1214,224 +1214,224 @@ DeviceInterfaceLink - switch1 + sonic tenGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/32 ARISTA16T0 Ethernet1 @@ -1439,7 +1439,7 @@ - switch1 + sonic Seastone-DX010-10-50 @@ -1447,7 +1447,7 @@ - switch1 + sonic DhcpResources @@ -1474,6 +1474,6 @@ - switch1 + sonic Seastone-DX010-10-50 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml index 47dc749df6f5..d2259d4b2062 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -974,224 +974,224 @@ DeviceInterfaceLink - switch1 + sonic fiftyGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/32 ARISTA16T0 Ethernet1 @@ -1199,7 +1199,7 @@ - switch1 + sonic Seastone-DX010-50 @@ -1207,7 +1207,7 @@ - switch1 + sonic DhcpResources @@ -1234,6 +1234,6 @@ - switch1 + sonic Seastone-DX010-50 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml index 921839b0d72d..c32f9e47513d 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic hundredGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Seastone-DX010 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Seastone-DX010 diff --git a/device/celestica/x86_64-cel_seastone-r0/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/minigraph.xml index 921839b0d72d..c32f9e47513d 100644 --- a/device/celestica/x86_64-cel_seastone-r0/minigraph.xml +++ b/device/celestica/x86_64-cel_seastone-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic hundredGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Seastone-DX010 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Seastone-DX010 diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml b/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml index fd35742353c9..950c52a64134 100644 --- a/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml +++ b/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,11 +1039,11 @@ - switch1 + sonic E582-48x6q - switch1 + sonic E582-48x6q diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml b/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml index 03be9a51b7c1..cb0e9d4e2b0a 100644 --- a/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,11 +1039,11 @@ - switch1 + sonic ES6428A-X48Q2H4 - switch1 + sonic ES6428A-X48Q2H4 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 new file mode 100644 index 000000000000..560cae5dd1b4 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 @@ -0,0 +1,135 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "7274496", + "type": "ingress", + "mode": "static" + }, + "ingress_lossy_pool": { + "size": "5491712", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool0": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossless_pool1": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "5491712", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossless_profile0": { + "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossless_profile1": { + "pool":"[BUFFER_POOL|egress_lossless_pool1]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" + }, + "{{ port_names }}|4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini new file mode 100644 index 000000000000..f3a0840558a6 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 113664 18432 76800 0 + 25000 5m 113664 18432 76800 0 + 40000 5m 113664 18432 76800 0 + 50000 5m 113664 18432 76800 0 + 100000 5m 113664 18432 76800 0 + 10000 40m 113664 18432 76800 0 + 25000 40m 113664 18432 76800 0 + 40000 40m 113664 18432 76800 0 + 50000 40m 113664 18432 76800 0 + 100000 40m 113664 18432 76800 0 + 10000 300m 113664 18432 76800 0 + 25000 300m 113664 18432 76800 0 + 40000 300m 113664 18432 76800 0 + 50000 300m 113664 18432 76800 0 + 100000 300m 113664 18432 76800 0 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml index 871a91c7fd02..d5b453c43081 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml +++ b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic fortyGigE0/0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Force10-S6000 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Force10-S6000 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/psuutil.py new file mode 100644 index 000000000000..537605f3975b --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_cpld_register(self, reg_name): + cpld_dir = "/sys/devices/platform/dell-s6000-cpld.0" + retval = 'ERR' + reg_file = cpld_dir +'/' + reg_name + if (not os.path.isfile(reg_file)): + return retval + + try: + with open(reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", reg_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + S6000_MAX_PSUS = 2 + return S6000_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.get_cpld_register('psu'+str(index - 1)+'_status') + if (psu_status != 'ERR'): + status = int(psu_status, 10) + + presence = self.get_psu_presence(index) + + return (status & presence) + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_presence = self.get_cpld_register('psu'+str(index - 1)+'_prs') + if (psu_presence != 'ERR'): + status = int(psu_presence, 10) + + return status diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf b/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf index 2208bb6340d1..c87af11afacc 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf +++ b/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf @@ -27,27 +27,6 @@ chip "max6620-i2c-*-2a" ignore fan3 ignore fan4 -chip "w83627dhg-*" - label in0 "VCore 1" - label in1 "VCore 2" - set in0_min 0 - set in0_max 1.74 - set in1_min 0 - set in1_max 1.74 - ignore fan1 - ignore fan2 - ignore fan3 - ignore fan4 - ignore fan5 - ignore in4 - ignore in5 - ignore in6 - ignore temp1 - ignore temp2 - ignore temp3 - ignore cpu0_vid - ignore intrusion0 - chip "jc42-*" set temp1_max 50 set temp1_crit 85 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 new file mode 100644 index 000000000000..b12fc3851177 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 @@ -0,0 +1,126 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 64 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % port_idx) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_lossy_pool": { + "size": "10443264", + "type": "ingress", + "mode": "dynamic", + "xoff": "4625920" + }, + "egress_lossy_pool": { + "size": "8877440", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982592", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool": "[BUFFER_POOL|ingress_lossless_lossy_pool]", + "xon": "4096", + "xoff": "58448", + "size": "1248", + "dynamic_th": "-4" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995648" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}:3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml index 37fba6c291b1..224cf4a9a6bb 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml +++ b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml @@ -5,7 +5,7 @@ ARISTA01T1 10.0.0.1 - switch1 + sonic 10.0.0.0 1 180 @@ -14,7 +14,7 @@ ARISTA02T1 10.0.0.5 - switch1 + sonic 10.0.0.4 1 180 @@ -23,7 +23,7 @@ ARISTA03T1 10.0.0.9 - switch1 + sonic 10.0.0.8 1 180 @@ -32,7 +32,7 @@ ARISTA04T1 10.0.0.13 - switch1 + sonic 10.0.0.12 1 180 @@ -41,7 +41,7 @@ ARISTA01T1 FC00::2 - switch1 + sonic FC00::1 1 180 @@ -50,7 +50,7 @@ ARISTA02T1 FC00::A - switch1 + sonic FC00::9 1 180 @@ -59,7 +59,7 @@ ARISTA03T1 FC00::12 - switch1 + sonic FC00::11 1 180 @@ -68,7 +68,7 @@ ARISTA04T1 FC00::1A - switch1 + sonic FC00::19 1 180 @@ -78,7 +78,7 @@ 64601 - switch1 + sonic BGPPeer @@ -187,7 +187,7 @@ - switch1 + sonic PortChannelInterface @@ -298,7 +298,7 @@ ARISTA01T1 Ethernet1 true - switch1 + sonic fortyGigE1/1/1 @@ -308,7 +308,7 @@ ARISTA01T1 Ethernet2 true - switch1 + sonic fortyGigE1/1/2 @@ -318,7 +318,7 @@ ARISTA02T1 Ethernet1 true - switch1 + sonic fortyGigE1/1/5 @@ -328,7 +328,7 @@ ARISTA02T1 Ethernet2 true - switch1 + sonic fortyGigE1/1/6 @@ -338,7 +338,7 @@ ARISTA03T1 Ethernet1 true - switch1 + sonic fortyGigE1/2/1 @@ -348,7 +348,7 @@ ARISTA03T1 Ethernet2 true - switch1 + sonic fortyGigE1/2/2 @@ -358,7 +358,7 @@ ARISTA04T1 Ethernet1 true - switch1 + sonic fortyGigE1/2/5 @@ -368,14 +368,14 @@ ARISTA04T1 Ethernet2 true - switch1 + sonic fortyGigE1/2/6 DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/7 true server-01 @@ -385,7 +385,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/8 true server-02 @@ -395,7 +395,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/9 true server-03 @@ -405,7 +405,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/10 true server-04 @@ -415,7 +415,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/11 true server-05 @@ -425,7 +425,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/12 true server-06 @@ -435,7 +435,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/13 true server-07 @@ -445,7 +445,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/14 true server-08 @@ -455,7 +455,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/15 true server-09 @@ -465,7 +465,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/16 true server-10 @@ -475,7 +475,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/1 true server-11 @@ -485,7 +485,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/5 true server-12 @@ -495,7 +495,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/6 true server-13 @@ -505,7 +505,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/7 true server-14 @@ -515,7 +515,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/8 true server-15 @@ -525,7 +525,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/9 true server-16 @@ -535,7 +535,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/10 true server-17 @@ -545,7 +545,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/11 true server-18 @@ -555,7 +555,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/7 true server-19 @@ -565,7 +565,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/8 true server-20 @@ -575,7 +575,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/9 true server-21 @@ -585,7 +585,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/10 true server-22 @@ -595,7 +595,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/11 true server-23 @@ -605,7 +605,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/12 true server-24 @@ -615,7 +615,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/13 true server-25 @@ -625,7 +625,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/14 true server-26 @@ -635,7 +635,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/15 true server-27 @@ -645,7 +645,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/16 true server-28 @@ -655,7 +655,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/1 true server-29 @@ -665,7 +665,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/5 true server-30 @@ -675,7 +675,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/6 true server-31 @@ -685,7 +685,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/7 true server-32 @@ -695,7 +695,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/8 true server-33 @@ -705,7 +705,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/9 true server-34 @@ -715,7 +715,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/10 true server-35 @@ -725,7 +725,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/11 true server-36 @@ -734,7 +734,7 @@ - switch1 + sonic Force10-S6100 @@ -742,7 +742,7 @@ - switch1 + sonic DhcpResources @@ -769,6 +769,6 @@ - switch1 + sonic Force10-S6100 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py index 6af56578c682..7265b90efb1f 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py @@ -21,3 +21,13 @@ def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) + def serial_number_str(self, e): + """Return service tag instead of serial number""" + + (is_valid, results) = self.get_tlv_field(e, self._TLV_CODE_SERVICE_TAG) + if is_valid == False: + return "Bad service tag" + + # 'results' is a list containing 3 elements, type (int), length (int), + # and value (string) of the requested TLV + return results[2] diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py new file mode 100644 index 000000000000..83452f69aaa4 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py @@ -0,0 +1,79 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + # Get a mailbox register + def get_pmc_register(self, reg_name): + mailbox_dir = "/sys/devices/platform/dell_s6100_lpc" + retval = 'ERR' + mb_reg_file = mailbox_dir+'/' + reg_name + if (not os.path.isfile(mb_reg_file)): + return retval + + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + S6100_MAX_PSUS = 2 + return S6100_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_status != 'ERR'): + psu_status = int(psu_status, 16) + # Check for PSU statuse + if (~psu_status & 0b1000) or (psu_status & 0b0100): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_presence != 'ERR'): + psu_presence = int(psu_presence, 16) + # Check for PSU presence + if (~psu_presence & 0b1): + status = 1 + + return status diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml index b45892801ed3..e1d42d180fe0 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml +++ b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic hundredGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Force10-Z9100 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Force10-Z9100 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py new file mode 100644 index 000000000000..2ad6ae7d1491 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py @@ -0,0 +1,79 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + # Get a mailbox register + def get_pmc_register(self, reg_name): + mailbox_dir = "/sys/devices/platform/dell_mailbox" + retval = 'ERR' + mb_reg_file = mailbox_dir+'/' + reg_name + if (not os.path.isfile(mb_reg_file)): + return retval + + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + Z9100_MAX_PSUS = 2 + return Z9100_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_status != 'ERR'): + psu_status = int(psu_status, 16) + # Check for PSU statuse + if (~psu_status & 0b1000) or (psu_status & 0b0100): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_presence != 'ERR'): + psu_presence = int(psu_presence, 16) + # Check for PSU presence + if (~psu_presence & 0b1): + status = 1 + + return status diff --git a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini new file mode 100644 index 000000000000..e000f29bef38 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 49,50,51,52 hundredGigE1/1 +Ethernet4 53,54,55,56 hundredGigE1/2 +Ethernet8 57,58,59,60 hundredGigE1/3 +Ethernet12 61,62,63,64 hundredGigE1/4 +Ethernet16 65,66,67,68 hundredGigE1/5 +Ethernet20 69,70,71,72 hundredGigE1/6 +Ethernet24 73,74,75,76 hundredGigE1/7 +Ethernet28 77,78,79,80 hundredGigE1/8 +Ethernet32 37,38,39,40 hundredGigE1/9 +Ethernet36 33,34,35,36 hundredGigE1/10 +Ethernet40 45,46,47,48 hundredGigE1/11 +Ethernet44 41,42,43,44 hundredGigE1/12 +Ethernet48 81,82,83,84 hundredGigE1/13 +Ethernet52 85,86,87,88 hundredGigE1/14 +Ethernet56 89,90,91,92 hundredGigE1/15 +Ethernet60 93,94,95,96 hundredGigE1/16 +Ethernet64 97,98,99,100 hundredGigE1/17 +Ethernet68 101,102,103,104 hundredGigE1/18 +Ethernet72 105,106,107,108 hundredGigE1/19 +Ethernet76 109,110,111,112 hundredGigE1/20 +Ethernet80 21,22,23,24 hundredGigE1/21 +Ethernet84 17,18,19,20 hundredGigE1/22 +Ethernet88 29,30,31,32 hundredGigE1/23 +Ethernet92 25,26,27,28 hundredGigE1/24 +Ethernet96 117,118,119,120 hundredGigE1/25 +Ethernet100 113,114,115,116 hundredGigE1/26 +Ethernet104 125,126,127,128 hundredGigE1/27 +Ethernet108 121,122,123,124 hundredGigE1/28 +Ethernet112 5,6,7,8 hundredGigE1/29 +Ethernet116 1,2,3,4 hundredGigE1/30 +Ethernet120 13,14,15,16 hundredGigE1/31 +Ethernet124 9,10,11,12 hundredGigE1/32 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile new file mode 100644 index 000000000000..08d9e7fa3b47 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-ag9032v1-32x100G.config.bcm diff --git a/device/delta/x86_64-delta_ag9032v1-r0/fancontrol b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol new file mode 100644 index 000000000000..4a1cde92478f --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=10 +DEVPATH=hwmon1=/sys/bus/i2c/devices +DEVNAME=hwmon1=emc2305 +FCTEMPS=hwmon1/2-004d/hwmon/hwmon*/temp1_input hwmon1/7-004c/hwmon/hwmon*/temp1_input hwmon1/7-004d/hwmon/hwmon*/temp1_input hwmon1/7-004e/hwmon/hwmon*/temp1_input hwmon1/30-004f/hwmon/hwmon*/temp1_input hwmon1/40-0058/temp1_input hwmon1/41-0058/temp1_input + +FCFANS=hwmon1/37-002c/fan1_input hwmon1/37-002c/fan2_input hwmon1/37-002c/fan3_input hwmon1/37-002c/fan4_input hwmon1/37-002c/fan5_input hwmon1/38-002d/fan1_input hwmon1/38-002d/fan2_input hwmon1/38-002d/fan3_input hwmon1/38-002d/fan4_input hwmon1/38-002d/fan5_input +MINTEMP=20 +MAXTEMP=60 +MINSTART=75 +MINSTOP=22 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service new file mode 100755 index 000000000000..17f647effb5b --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service @@ -0,0 +1,244 @@ +#!/bin/bash +# +# Simple script implementing a temperature dependent fan speed control +# Supported Linux kernel versions: 2.6.5 and later +# +# Version 0.70 +# +# Usage: fancontrol [CONFIGFILE] +# +# Dependencies: +# bash, egrep, sed, cut, sleep, readlink, lm_sensors :) +# +# Please send any questions, comments or success stories to +# marius.reiner@hdev.de +# Thanks! +# +# For configuration instructions and warnings please see fancontrol.txt, which +# can be found in the doc/ directory or at the website mentioned above. +# +# +# Copyright 2003 Marius Reiner +# Copyright (C) 2007-2009 Jean Delvare +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA. +# +# + +PIDFILE="/var/run/fancontrol.pid" + +#DEBUG=1 +MAX=255 + +function LoadConfig +{ + local fcvcount fcv + + echo "Loading configuration from $1 ..." + if [ ! -r "$1" ] + then + echo "Error: Can't read configuration file" >&2 + exit 1 + fi + + # grep configuration from file + INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'` + DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'` + DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'` + FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'` + MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'` + MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g'` + MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g'` + MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'` + HWMON=$( echo "$DEVPATH" | sed 's/=.*$//g') + FCDEVPATH=$( echo "$DEVPATH" | sed 's/^.*=//g') + FCMINTEMP=$MINTEMP + FCMAXTEMP=$MAXTEMP + FCMINSTART=$MINSTART + FCMINSTOP=$MINSTOP + + FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'` + + # Check whether all mandatory settings are set + if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]] + then + echo "Some mandatory settings missing, please check your config file!" >&2 + exit 1 + fi + if [ "$INTERVAL" -le 0 ] + then + echo "Error in configuration file:" >&2 + echo "INTERVAL must be at least 1" >&2 + exit 1 + fi + + # write settings to arrays for easier use and print them + echo + echo "Common settings:" + + temp_string=$FCTEMPS + + let fcvcount=0 + for fcv in $FCTEMPS + do + fcvcount=$((fcvcount+1)) + AFCTEMP[$fcvcount]=$( echo "$temp_string" | cut -d" " -f $fcvcount ) + AFCTEMP[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCTEMP_PATH[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + + AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} ) + AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 )) + done + + fan_string=$FCFANS + fcvcount=0 + zero=0 + for fcv in $FCFANS + do + fcvcount=$((fcvcount+1)) + AFCFAN[$fcvcount]=$( echo "$fan_string" | cut -d" " -f $fcvcount ) + AFCFAN_PATH[$fcvcount]=$( echo "${AFCFAN[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCFAN_TARGET[$fcvcount]=$( echo "${AFCFAN_PATH[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCFAN_TARGET[$fcvcount]=$( echo "${AFCFAN_TARGET[$fcvcount]}" | sed 's/$/_percentage/g') + AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} ) + if [ "${AFCFAN[$fcvcount]}" == 960 ] + then + AFCFAN[$fcvcount]=$zero + fi + done +} + +# Check that all referenced sysfs files exist +function CheckFiles +{ + local outdated=0 fcvcount tsen fan + if [ $outdated -eq 1 ] + then + echo >&2 + echo "At least one referenced file is missing. Either some required kernel" >&2 + echo "modules haven't been loaded, or your configuration file is outdated." >&2 + echo "In the latter case, you should run pwmconfig again." >&2 + fi + return $outdated +} + +LoadConfig $1 + +# Detect path to sensors +if [ ! -d $DIR ] +then + echo $0: 'No sensors found! (did you load the necessary modules?)' >&2 + exit 1 +fi +cd $DIR + +# Check for configuration change +if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ] +then + echo "Configuration is too old, please run pwmconfig again" >&2 + exit 1 +fi +if [ "$DIR" = "/" -a -n "$DEVPATH" ] +then + echo "Unneeded DEVPATH with absolute device paths" >&2 + exit 1 +fi +CheckFiles || exit 1 + +if [ -f "$PIDFILE" ] +then + echo "File $PIDFILE exists, is fancontrol already running?" >&2 + exit 1 +fi +echo $$ > "$PIDFILE" + + +# main function +function UpdateThermalSensors +{ + echo "" + TEMP_HIGHEST=0 + FAN_PERCENTAGE=0 + + for i in ${AFCTEMP_PATH[@]}; do + if (( $(cat $i) > $TEMP_HIGHEST )); then + TEMP_HIGHEST=$(cat $i); + fi; + done + TEMP_HIGHEST=$((TEMP_HIGHEST/1000)) + echo "The highest temperature of thermal sensors: $TEMP_HIGHEST °C" +} + +function UpdateFanSpeeds +{ + if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50 + FAN_PERCENTAGE=40 + elif [ $TEMP_HIGHEST -lt 56 -a $TEMP_HIGHEST -gt 50 ]; then #50 ${AFCFAN_TARGET[$fcvcount]} + AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} ) + + if [ "${AFCFAN[$fcvcount]}" == 960 ] + then + AFCFAN[$fcvcount]=$zero + fi + done + + if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50 + FAN_ON_PSU_PERCENTAGE=50 + elif [ $TEMP_HIGHEST -lt 100 -a $TEMP_HIGHEST -gt 50 ]; then #50 '/sys/bus/i2c/devices/4-0058/psu_select_member' + echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/40-0058/fan1_set_percentage' + echo "PSU fan1 =$( cat '/sys/bus/i2c/devices/40-0058/fan1_input' ) (rpm)" + #Set speed to PSU_FAN2 + #echo "0x20" > '/sys/bus/i2c/devices/4-0058/psu_select_member' + echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/41-0058/fan1_set_percentage' + echo "PSU fan2 =$( cat '/sys/bus/i2c/devices/41-0058/fan1_input' ) (rpm)" + + rm -f "$PIDFILE" +} +# main loop calling the main function at specified intervals +while true +do + UpdateThermalSensors + UpdateFanSpeeds + echo "Sleep $INTERVAL seconds ..." + # Sleep while still handling signals + sleep $INTERVAL & + wait $! +done diff --git a/device/delta/x86_64-delta_ag9032v1-r0/installer.conf b/device/delta/x86_64-delta_ag9032v1-r0/installer.conf new file mode 100644 index 000000000000..fa2af8b7a007 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_SPEED=115200 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/led_proc_init.soc b/device/delta/x86_64-delta_ag9032v1-r0/led_proc_init.soc new file mode 100644 index 000000000000..7f6789e90123 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/led_proc_init.soc @@ -0,0 +1,45 @@ +s CMIC_LEDUP0_PROGRAM_RAM 0 +s CMIC_LEDUP1_PROGRAM_RAM 0 + +led 0 stop +led 0 prog 02 00 60 E0 86 ED 2E E0 32 08 97 02 00 0E 00 60 E3 2E E0 32 00 32 01 B7 97 02 00 0E 00 12 E7 50 86 E0 86 E0 86 E0 86 E0 16 E7 61 EB 06 E3 67 4E 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 06 E0 D2 40 74 06 3A C0 D2 01 74 66 06 EB D2 00 70 62 16 ED 99 99 1A 00 71 62 77 66 32 0F 87 57 32 0E 87 57 +led 0 auto on +led 0 start +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 REMAP_PORT_1=30 REMAP_PORT_2=29 REMAP_PORT_3=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 REMAP_PORT_5=26 REMAP_PORT_6=25 REMAP_PORT_7=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 REMAP_PORT_9=22 REMAP_PORT_10=21 REMAP_PORT_11=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 REMAP_PORT_13=18 REMAP_PORT_14=17 REMAP_PORT_15=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=15 REMAP_PORT_17=14 REMAP_PORT_18=13 REMAP_PORT_19=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=7 REMAP_PORT_25=6 REMAP_PORT_26=5 REMAP_PORT_27=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=3 REMAP_PORT_29=2 REMAP_PORT_30=1 REMAP_PORT_31=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=62 REMAP_PORT_34=61 REMAP_PORT_35=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=59 REMAP_PORT_37=58 REMAP_PORT_38=57 REMAP_PORT_39=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=55 REMAP_PORT_41=54 REMAP_PORT_42=53 REMAP_PORT_43=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=51 REMAP_PORT_45=50 REMAP_PORT_46=49 REMAP_PORT_47=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=47 REMAP_PORT_49=46 REMAP_PORT_50=45 REMAP_PORT_51=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=43 REMAP_PORT_53=42 REMAP_PORT_54=41 REMAP_PORT_55=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=39 REMAP_PORT_57=38 REMAP_PORT_58=37 REMAP_PORT_59=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=35 REMAP_PORT_61=34 REMAP_PORT_62=33 REMAP_PORT_63=32 + +led 1 stop +led 1 prog 02 00 60 E0 86 ED 2E E0 32 08 97 02 00 0E 00 60 E3 2E E0 32 00 32 01 B7 97 02 00 0E 00 12 E7 50 86 E0 86 E0 86 E0 86 E0 16 E7 61 EB 06 E3 67 4E 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 06 E0 D2 40 74 06 3A C0 D2 01 74 66 06 EB D2 00 70 62 16 ED 99 99 1A 00 71 62 77 66 32 0F 87 57 32 0E 87 57 +led 1 auto on +led 1 start +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=3 REMAP_PORT_1=2 REMAP_PORT_2=1 REMAP_PORT_3=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=7 REMAP_PORT_5=6 REMAP_PORT_6=5 REMAP_PORT_7=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=11 REMAP_PORT_9=10 REMAP_PORT_10=9 REMAP_PORT_11=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=15 REMAP_PORT_13=14 REMAP_PORT_14=13 REMAP_PORT_15=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=19 REMAP_PORT_17=18 REMAP_PORT_18=17 REMAP_PORT_19=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=23 REMAP_PORT_21=22 REMAP_PORT_22=21 REMAP_PORT_23=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=27 REMAP_PORT_25=26 REMAP_PORT_26=25 REMAP_PORT_27=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 REMAP_PORT_29=30 REMAP_PORT_30=29 REMAP_PORT_31=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=35 REMAP_PORT_33=34 REMAP_PORT_34=33 REMAP_PORT_35=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=39 REMAP_PORT_37=38 REMAP_PORT_38=37 REMAP_PORT_39=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=43 REMAP_PORT_41=42 REMAP_PORT_42=41 REMAP_PORT_43=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=47 REMAP_PORT_45=46 REMAP_PORT_46=45 REMAP_PORT_47=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + diff --git a/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml b/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml new file mode 100644 index 000000000000..129103ce6bfe --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 180 + 60 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 180 + 60 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + sonic + 10.0.0.36 + 1 + 180 + 60 + + + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + sonic + 10.0.0.38 + 1 + 180 + 60 + + + sonic + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + sonic + 10.0.0.40 + 1 + 180 + 60 + + + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + sonic + 10.0.0.42 + 1 + 180 + 60 + + + sonic + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + sonic + 10.0.0.44 + 1 + 180 + 60 + + + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + sonic + 10.0.0.46 + 1 + 180 + 60 + + + sonic + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + sonic + 10.0.0.48 + 1 + 180 + 60 + + + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + sonic + 10.0.0.50 + 1 + 180 + 60 + + + sonic + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + sonic + 10.0.0.52 + 1 + 180 + 60 + + + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + sonic + 10.0.0.54 + 1 + 180 + 60 + + + sonic + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + sonic + 10.0.0.56 + 1 + 180 + 60 + + + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + sonic + 10.0.0.58 + 1 + 180 + 60 + + + sonic + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + sonic + 10.0.0.60 + 1 + 180 + 60 + + + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + sonic + 10.0.0.62 + 1 + 180 + 60 + + + sonic + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
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 + + + + + + + + sonic + + + + + + hundredGigE1/1 + 10.0.0.0/31 + + + + hundredGigE1/2 + 10.0.0.2/31 + + + + hundredGigE1/3 + 10.0.0.4/31 + + + + hundredGigE1/4 + 10.0.0.6/31 + + + + hundredGigE1/5 + 10.0.0.8/31 + + + + hundredGigE1/6 + 10.0.0.10/31 + + + + hundredGigE1/7 + 10.0.0.12/31 + + + + hundredGigE1/8 + 10.0.0.14/31 + + + + hundredGigE1/9 + 10.0.0.16/31 + + + + hundredGigE1/10 + 10.0.0.18/31 + + + + hundredGigE1/11 + 10.0.0.20/31 + + + + hundredGigE1/12 + 10.0.0.22/31 + + + + hundredGigE1/13 + 10.0.0.24/31 + + + + hundredGigE1/14 + 10.0.0.26/31 + + + + hundredGigE1/15 + 10.0.0.28/31 + + + + hundredGigE1/16 + 10.0.0.30/31 + + + + hundredGigE1/17 + 10.0.0.32/31 + + + + hundredGigE1/18 + 10.0.0.34/31 + + + + hundredGigE1/19 + 10.0.0.36/31 + + + + hundredGigE1/20 + 10.0.0.38/31 + + + + hundredGigE1/21 + 10.0.0.40/31 + + + + hundredGigE1/22 + 10.0.0.42/31 + + + + hundredGigE1/23 + 10.0.0.44/31 + + + + hundredGigE1/24 + 10.0.0.46/31 + + + + hundredGigE1/25 + 10.0.0.48/31 + + + + hundredGigE1/26 + 10.0.0.50/31 + + + + hundredGigE1/27 + 10.0.0.52/31 + + + + hundredGigE1/28 + 10.0.0.54/31 + + + + hundredGigE1/29 + 10.0.0.56/31 + + + + hundredGigE1/30 + 10.0.0.58/31 + + + + hundredGigE1/31 + 10.0.0.60/31 + + + + hundredGigE1/32 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + hundredGigE1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/2 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/3 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/4 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/5 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/6 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/7 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/8 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/9 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/10 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/11 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/12 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/13 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/14 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/15 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/16 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/17 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/18 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/19 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/20 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/21 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/22 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/23 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/24 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + hundredGigE1/32 + ARISTA16T0 + Ethernet1 + + + + + sonic + Delta-ag9032v1 + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + sonic + Delta-ag9032v1 +
diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/eeprom.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/eeprom.py new file mode 100644 index 000000000000..786e1fdc85e3 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/eeprom.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-2/2-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4b370d9a7443 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py @@ -0,0 +1,57 @@ +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/{}-0058/" + self.psu_oper_status = "in1_input" + self.psu_presence = "i2cget -y {} 0x50 0x00" + + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + if index is None: + return False + Base_bus_number = 39 + status = 0 + #index from 1, psu attribute bus from 40 + try: + with open(self.psu_path.format(index + Base_bus_number) + self.psu_oper_status, 'r') as power_status: + if int(power_status.read()) == 0 : + return False + else: + status = 1 + except IOError: + return False + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + Base_bus_number = 39 + status = 0 + try: + p = os.popen(self.psu_presence.format(index + Base_bus_number)+ "> /dev/null 2>&1") + if p.readline() != None: + status = 1 + p.close() + except IOError: + return False + return status == 1 + + diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py new file mode 100644 index 000000000000..54d69446b1d8 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py @@ -0,0 +1,175 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + 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 = 50 + + _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): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + 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: + reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_present") + 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) + + # ModPrsL is active low + 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.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + 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) + + # 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.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_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) + + # 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/delta-ag9032v1-cpld.0/sfp_reset" + + # Check for invalid port_num + if port_num < self.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) + + # 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 \ No newline at end of file diff --git a/device/delta/x86_64-delta_ag9032v1-r0/sensors.conf b/device/delta/x86_64-delta_ag9032v1-r0/sensors.conf new file mode 100644 index 000000000000..d3b2aea2a5af --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/sensors.conf @@ -0,0 +1,61 @@ +# libsensors configuration file for DCS-7060CX-32S +# ------------------------------------------------ +# + +bus "i2c-2" "i2c-1-mux (chan_id 0)" +bus "i2c-3" "i2c-1-mux (chan_id 1)" +bus "i2c-4" "i2c-1-mux (chan_id 2)" +bus "i2c-7" "i2c-1-mux (chan_id 5)" + + +# tmp75-i2c-2-4d CPU below side thermal sensor. +# tmp75-i2c-3-4f Wind thermal sensor. +# tmp75-i2c-7-4c MAC up side thermal sensor. +# tmp75-i2c-7-4d MAC down side thermal sensor. +# tmp75-i2c-7-4e Surroundings thermal sensor. + +chip "tmp75-i2c-2-4d" + label temp1 "CPU below side thermal sensor" + set temp1_max 60 + set temp1_max_hyst 55 + +chip "tmp75-i2c-*-4f" + label temp1 "Wind thermal sensor" + set temp1_max 65 + set temp1_max_hyst 60 +chip "tmp75-i2c-7-4c" + label temp1 "MAC up side thermal sensor" + set temp1_max 80 + set temp1_max_hyst 75 +chip "tmp75-i2c-7-4d" + label temp1 "MAC down side thermal sensor" + set temp1_max 75 + set temp1_max_hyst 70 +chip "tmp75-i2c-7-4e" + label temp1 "Surroundings thermal sensor" + set temp1_max 65 + set temp1_max_hyst 60 + + +chip "emc2305-i2c-3-2d" + label fan1 "FANTRAY 1 REAR" + label fan2 "FANTRAY 2 REAR" + label fan3 "FANTRAY 3 REAR" + label fan4 "FANTRAY 4 REAR" + label fan5 "FANTRAY 5 REAR" +chip "emc2305-i2c-3-2c" + label fan1 "FANTRAY 1 FRONT" + label fan2 "FANTRAY 2 FRONT" + label fan3 "FANTRAY 3 FRONT" + label fan4 "FANTRAY 4 FRONT" + label fan5 "FANTRAY 5 FRONT" +chip "pmbus-i2c-4-50" + label temp1 "Fan of power supply controller 1 sensor 1" + label temp2 "Fan of Power supply controller 1 sensor 2" + +chip "pmbus-i2c-4-40" + label temp1 "Power supply 1 hotspot sensor" + +chip "pmbus-i2c-4-40" + label temp1 "Power supply 2 hotspot sensor" + diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml index ab90ada24274..991591585cca 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml @@ -103,7 +103,7 @@ 40000 DeviceInterfaceLink - OCPSCH8810MS + OCPSCH0104002MS Ethernet0 OCPSCH01040HHLF Ethernet52 @@ -111,7 +111,7 @@ - OCPSCH8810HHLF + OCPSCH01040HHLF INGRASYS-S8810-32Q diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/psuutil.py new file mode 100644 index 000000000000..7e69360b0402 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-3/3-0051", + "/sys/bus/i2c/devices/i2c-4/4-0051"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf index 7ab599698225..8332fbdf9086 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf @@ -9,8 +9,8 @@ chip "jc42-*" chip "w83795adg-*" label in0 "ROV" - set in0_min 1 * 0.97 - set in0_max 1 * 1.033 + set in0_min 1.025 * 0.98 + set in0_max 1.025 * 1.02 ignore in1 ignore in2 label in3 "1.0V" 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 3350b68172cb..079bb63455f2 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 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 +Ethernet0 1 Ethernet1/1 0 +Ethernet1 2 Ethernet2/1 1 +Ethernet2 3 Ethernet3/1 2 +Ethernet3 4 Ethernet4/1 3 +Ethernet4 5 Ethernet5/1 4 +Ethernet5 6 Ethernet6/1 5 +Ethernet6 7 Ethernet7/1 6 +Ethernet7 8 Ethernet8/1 7 +Ethernet8 9 Ethernet9/1 8 +Ethernet9 10 Ethernet10/1 9 +Ethernet10 11 Ethernet11/1 10 +Ethernet11 12 Ethernet12/1 11 +Ethernet12 21 Ethernet13/1 12 +Ethernet13 22 Ethernet14/1 13 +Ethernet14 23 Ethernet15/1 14 +Ethernet15 24 Ethernet16/1 15 +Ethernet16 33 Ethernet17/1 16 +Ethernet17 34 Ethernet18/1 17 +Ethernet18 35 Ethernet19/1 18 +Ethernet19 36 Ethernet20/1 19 +Ethernet20 37 Ethernet21/1 20 +Ethernet21 38 Ethernet22/1 21 +Ethernet22 39 Ethernet23/1 22 +Ethernet23 40 Ethernet24/1 23 +Ethernet24 41 Ethernet25/1 24 +Ethernet25 42 Ethernet26/1 25 +Ethernet26 43 Ethernet27/1 26 +Ethernet27 44 Ethernet28/1 27 +Ethernet28 49 Ethernet29/1 28 +Ethernet29 50 Ethernet30/1 29 +Ethernet30 51 Ethernet31/1 30 +Ethernet31 52 Ethernet32/1 31 +Ethernet32 53 Ethernet33/1 32 +Ethernet33 54 Ethernet34/1 33 +Ethernet34 55 Ethernet35/1 34 +Ethernet35 56 Ethernet36/1 35 +Ethernet36 65 Ethernet37/1 36 +Ethernet37 66 Ethernet38/1 37 +Ethernet38 67 Ethernet39/1 38 +Ethernet39 68 Ethernet40/1 39 +Ethernet40 69 Ethernet41/1 40 +Ethernet41 70 Ethernet42/1 41 +Ethernet42 71 Ethernet43/1 42 +Ethernet43 72 Ethernet44/1 43 +Ethernet44 81 Ethernet45/1 44 +Ethernet45 82 Ethernet46/1 45 +Ethernet46 83 Ethernet47/1 46 +Ethernet47 84 Ethernet48/1 47 +Ethernet48 85,86,87,88 Ethernet52/1 48 +Ethernet52 97,98,99,100 Ethernet56/1 49 +Ethernet56 101,102,103,104 Ethernet60/1 50 +Ethernet60 105,106,107,108 Ethernet64/1 51 +Ethernet64 109,110,111,112 Ethernet68/1 52 +Ethernet68 117,118,119,120 Ethernet69/1 53 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 0bb52e88616a..076ecff4d42d 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 @@ -168,7 +168,7 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): 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 b950538edba7..385056e6e8f0 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,52 +1,52 @@ # 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 +Ethernet0 17 Ethernet1/1 0 +Ethernet1 18 Ethernet2/1 1 +Ethernet2 19 Ethernet3/1 2 +Ethernet3 20 Ethernet4/1 3 +Ethernet4 24 Ethernet5/1 4 +Ethernet5 23 Ethernet6/1 5 +Ethernet6 22 Ethernet7/1 6 +Ethernet7 21 Ethernet8/1 7 +Ethernet8 28 Ethernet9/1 8 +Ethernet9 27 Ethernet10/1 9 +Ethernet10 26 Ethernet11/1 10 +Ethernet11 25 Ethernet12/1 11 +Ethernet12 32 Ethernet13/1 12 +Ethernet13 31 Ethernet14/1 13 +Ethernet14 30 Ethernet15/1 14 +Ethernet15 29 Ethernet16/1 15 +Ethernet16 1 Ethernet17/1 16 +Ethernet17 2 Ethernet18/1 17 +Ethernet18 3 Ethernet19/1 18 +Ethernet19 4 Ethernet20/1 19 +Ethernet20 8 Ethernet21/1 20 +Ethernet21 7 Ethernet22/1 21 +Ethernet22 6 Ethernet23/1 22 +Ethernet23 5 Ethernet24/1 23 +Ethernet24 12 Ethernet25/1 24 +Ethernet25 11 Ethernet26/1 25 +Ethernet26 10 Ethernet27/1 26 +Ethernet27 9 Ethernet28/1 27 +Ethernet28 13 Ethernet29/1 28 +Ethernet29 14 Ethernet30/1 29 +Ethernet30 15 Ethernet31/1 30 +Ethernet31 16 Ethernet32/1 31 +Ethernet32 33 Ethernet33/1 32 +Ethernet33 34 Ethernet34/1 33 +Ethernet34 35 Ethernet35/1 34 +Ethernet35 36 Ethernet36/1 35 +Ethernet36 38 Ethernet37/1 36 +Ethernet37 39 Ethernet38/1 37 +Ethernet38 40 Ethernet39/1 38 +Ethernet39 37 Ethernet40/1 39 +Ethernet40 41 Ethernet41/1 40 +Ethernet41 42 Ethernet42/1 41 +Ethernet42 43 Ethernet43/1 42 +Ethernet43 44 Ethernet44/1 43 +Ethernet44 48 Ethernet45/1 44 +Ethernet45 45 Ethernet46/1 45 +Ethernet46 46 Ethernet47/1 46 +Ethernet47 47 Ethernet48/1 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 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 0b1ae8d3bc8e..78793beec69d 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 @@ -102,7 +102,7 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4f226c69fff3 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_CPLD_DIR = "/sys/bus/i2c/devices/0-0033" + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + mask = [ 0x08, 0x10 ] + attr_file = 'cpld_pw_good' + attr_path = self.PSU_CPLD_DIR +'/'+ attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value & mask[index-1]): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + mask = [ 0x01, 0x02 ] + attr_file ='cpld_pw_abs' + attr_path = self.PSU_CPLD_DIR +'/'+ attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (~attr_value & mask[index-1]): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf index c55f5c764e65..5535db7e7eb4 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf @@ -9,14 +9,24 @@ chip "jc42-*" chip "w83795adg-*" label in0 "1.0V" + set in0_min 1.00 * 0.97 + set in0_max 1.00 * 1.03 label in1 "1.0V_ROV" + set in1_min 1.00 * 0.98 + set in1_max 1.00 * 1.02 label in2 "1.25V" + set in2_min 1.25 * 0.97 + set in2_max 1.25 * 1.03 label in3 "1.8V" + set in3_min 1.80 * 0.97 + set in3_max 1.80 * 1.03 ignore in4 ignore in5 ignore in6 ignore in7 label in12 "+3.3V" + set in12_min 3.30 * 0.97 + set in12_max 3.30 * 1.03 ignore in14 ignore in15 ignore in16 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.ini new file mode 100644 index 000000000000..bb26684cb7da --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index +Ethernet0 0,1,2,3 Ethernet1/1 0 +Ethernet4 4,5,6,7 Ethernet2/1 1 +Ethernet8 8,9,10,11 Ethernet3/1 2 +Ethernet12 12,13,14,15 Ethernet4/1 3 +Ethernet16 16,17,18,19 Ethernet5/1 4 +Ethernet20 20,21,22,23 Ethernet6/1 5 +Ethernet24 24,25,26,27 Ethernet7/1 6 +Ethernet28 28,29,30,31 Ethernet8/1 7 +Ethernet32 32,33,34,35 Ethernet9/1 8 +Ethernet36 36,37,38,39 Ethernet10/1 9 +Ethernet40 40,41,42,43 Ethernet11/1 10 +Ethernet44 44,45,46,47 Ethernet12/1 11 +Ethernet48 48,49,50,51 Ethernet13/1 12 +Ethernet52 52,53,54,55 Ethernet14/1 13 +Ethernet56 56,57,58,59 Ethernet15/1 14 +Ethernet60 60,61,62,63 Ethernet16/1 15 +Ethernet64 64,65,66,67 Ethernet17/1 16 +Ethernet68 68,69,70,71 Ethernet18/1 17 +Ethernet72 72,73,74,75 Ethernet19/1 18 +Ethernet76 76,77,78,79 Ethernet20/1 19 +Ethernet80 80,81,82,83 Ethernet21/1 20 +Ethernet84 84,85,86,87 Ethernet22/1 21 +Ethernet88 88,89,90,91 Ethernet23/1 22 +Ethernet92 92,93,94,95 Ethernet24/1 23 +Ethernet96 96,97,98,99 Ethernet25/1 24 +Ethernet100 100,101,102,103 Ethernet26/1 25 +Ethernet104 104,105,106,107 Ethernet27/1 26 +Ethernet108 108,109,110,111 Ethernet28/1 27 +Ethernet112 112,113,114,115 Ethernet29/1 28 +Ethernet116 116,117,118,119 Ethernet30/1 29 +Ethernet120 120,121,122,123 Ethernet31/1 30 +Ethernet124 124,125,126,127 Ethernet32/1 31 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps new file mode 100644 index 000000000000..ac6268716170 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps @@ -0,0 +1,318 @@ +init start stage low-level +init set port-map port=0 eth-macro=0 lane=0 max-speed=100g active=true +init set port-map port=1 eth-macro=1 lane=0 max-speed=100g active=true +init set port-map port=2 eth-macro=2 lane=0 max-speed=100g active=true +init set port-map port=3 eth-macro=3 lane=0 max-speed=100g active=true +init set port-map port=4 eth-macro=4 lane=0 max-speed=100g active=true +init set port-map port=5 eth-macro=5 lane=0 max-speed=100g active=true +init set port-map port=6 eth-macro=6 lane=0 max-speed=100g active=true +init set port-map port=7 eth-macro=7 lane=0 max-speed=100g active=true +init set port-map port=8 eth-macro=8 lane=0 max-speed=100g active=true +init set port-map port=9 eth-macro=9 lane=0 max-speed=100g active=true +init set port-map port=10 eth-macro=10 lane=0 max-speed=100g active=true +init set port-map port=11 eth-macro=11 lane=0 max-speed=100g active=true +init set port-map port=12 eth-macro=12 lane=0 max-speed=100g active=true +init set port-map port=13 eth-macro=13 lane=0 max-speed=100g active=true +init set port-map port=14 eth-macro=14 lane=0 max-speed=100g active=true +init set port-map port=15 eth-macro=15 lane=0 max-speed=100g active=true +init set port-map port=16 eth-macro=16 lane=0 max-speed=100g active=true +init set port-map port=17 eth-macro=17 lane=0 max-speed=100g active=true +init set port-map port=18 eth-macro=18 lane=0 max-speed=100g active=true +init set port-map port=19 eth-macro=19 lane=0 max-speed=100g active=true +init set port-map port=20 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map port=21 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map port=22 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map port=23 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map port=24 eth-macro=24 lane=0 max-speed=100g active=true +init set port-map port=25 eth-macro=25 lane=0 max-speed=100g active=true +init set port-map port=26 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map port=27 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map port=28 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map port=29 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map port=30 eth-macro=30 lane=0 max-speed=100g active=true +init set port-map port=31 eth-macro=31 lane=0 max-speed=100g active=true +init set port-map port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage task-rsrc +init start stage module +init start stage task +phy set lane-swap portlist=0 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=1 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=2 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=3 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=4 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=5 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=6 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=7 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=8 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=9 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=10 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=11 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=12 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=13 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=14 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=15 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=16 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=17 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=18 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=19 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=20 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=21 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=22 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=23 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=24 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=25 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=26 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=27 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=28 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=29 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=30 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=31 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=129 lane-num=1 property=tx data=0x1 +phy set lane-swap portlist=130 lane-num=1 property=tx data=0x0 +phy set lane-swap portlist=0 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=1 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=2 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=3 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=4 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=5 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=6 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=7 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=8 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=9 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=10 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=11 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=12 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=13 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=14 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=15 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=16 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=17 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=18 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=19 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=20 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=21 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=22 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=23 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=24 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=25 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=26 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=27 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=28 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=29 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=30 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=31 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=129 lane-num=1 property=rx data=0x1 +phy set lane-swap portlist=130 lane-num=1 property=rx data=0x0 +phy set polarity-rev portlist=0 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=1 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=2 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=3 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=4 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=5 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=6 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=7 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=8 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=9 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=10 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=11 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=12 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=13 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=14 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=15 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=16 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=17 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=18 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=19 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=20 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=21 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=22 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=23 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=24 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=25 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=26 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=27 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=28 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=29 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=30 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=31 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=129 lane-num=1 property=tx data=0x0 +phy set polarity-rev portlist=130 lane-num=1 property=tx data=0x0 +phy set polarity-rev portlist=0 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=1 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=2 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=3 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=4 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=5 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=6 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=7 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=8 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=9 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=10 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=11 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=12 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=13 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=14 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=15 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=16 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=17 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=18 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=19 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=20 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=21 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=22 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=23 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=24 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=25 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=26 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=27 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=28 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=29 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=30 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=31 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=129 lane-num=1 property=rx data=0x0 +phy set polarity-rev portlist=130 lane-num=1 property=rx data=0x0 +phy set pre-emphasis portlist=0 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=0 lane-num=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis portlist=0 lane-num=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=0 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=1 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=1 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=1 lane-num=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=1 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=2 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=2 lane-num=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis portlist=2 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=2 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=3 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=3 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=3 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=3 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=4 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=4 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=4 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=4 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=5 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=5 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=5 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=5 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=6 lane-num=4 property=c2 data=0x03.03.03.03 +phy set pre-emphasis portlist=6 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=6 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=6 lane-num=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis portlist=7 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=7 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=7 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=7 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=8 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=8 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=8 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=8 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=9 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=9 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=9 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=9 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=10 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=10 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=10 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=10 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=11 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=11 lane-num=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis portlist=11 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=11 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=12 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=12 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=12 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=12 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=13 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=13 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=13 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=13 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=14 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=14 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=14 lane-num=4 property=c0 data=0x1D.1D.1D.1D +phy set pre-emphasis portlist=14 lane-num=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis portlist=15 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=15 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=15 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=15 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=16 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=16 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=16 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=16 lane-num=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis portlist=17 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=17 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=17 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=17 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=18 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=18 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=18 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=18 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=19 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=19 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=19 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=19 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=20 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=20 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=20 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=20 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=21 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=21 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=21 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=21 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=22 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=22 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=22 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=22 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=23 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=23 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=23 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=23 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=24 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=24 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=24 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=24 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=25 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=25 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=25 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=25 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=26 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=26 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=26 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=26 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=27 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=27 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=27 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=27 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=28 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=28 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=28 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=28 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=29 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=29 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=29 lane-num=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=29 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=30 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=30 lane-num=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis portlist=30 lane-num=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=30 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=31 lane-num=4 property=c2 data=0x01.01.01.01 +phy set pre-emphasis portlist=31 lane-num=4 property=cn1 data=0x03.03.03.03 +phy set pre-emphasis portlist=31 lane-num=4 property=c0 data=0x17.17.17.17 +phy set pre-emphasis portlist=31 lane-num=4 property=c1 data=0x09.09.09.09 +phy set pre-emphasis portlist=129 lane-num=1 property=c2 data=0x01 +phy set pre-emphasis portlist=129 lane-num=1 property=cn1 data=0x01 +phy set pre-emphasis portlist=129 lane-num=1 property=c0 data=0x02 +phy set pre-emphasis portlist=129 lane-num=1 property=c1 data=0x03 +phy set pre-emphasis portlist=130 lane-num=1 property=c2 data=0x01 +phy set pre-emphasis portlist=130 lane-num=1 property=cn1 data=0x01 +phy set pre-emphasis portlist=130 lane-num=1 property=c0 data=0x02 +phy set pre-emphasis portlist=130 lane-num=1 property=c1 data=0x03 +port set portlist=0-31 speed=100g +port set portlist=129-130 speed=10g +port set portlist=0-31 medium-type=sr4 +port set portlist=129-130 medium-type=kr +port set portlist=0-31 fec=rs +port advertise portlist=129-130 speed-10g-kr +port set portlist=129-130 an=enable +port set portlist=0-31,129-130 admin=enable diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/sai.profile b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/sai.profile new file mode 100644 index 000000000000..880f47910ac1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/led_proc_init.nps +SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/fancontrol new file mode 100644 index 000000000000..5ed165966b93 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon5=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-8/8-002f +DEVNAME=hwmon5=w83795adg +FCTEMPS=hwmon5/device/pwm2=hwmon1/temp1_input hwmon5/device/pwm1=hwmon1/temp1_input +FCFANS=hwmon5/device/pwm2=hwmon5/device/fan8_input hwmon5/device/pwm2=hwmon5/device/fan7_input hwmon5/device/pwm2=hwmon5/device/fan6_input hwmon5/device/pwm2=hwmon5/device/fan5_input hwmon5/device/pwm1=hwmon5/device/fan4_input hwmon5/device/pwm1=hwmon5/device/fan3_input hwmon5/device/pwm1=hwmon5/device/fan2_input hwmon5/device/pwm1=hwmon5/device/fan1_input +# TODO: check the temp value with HW after board ready +MINTEMP=hwmon5/device/pwm2=20 hwmon5/device/pwm1=20 +MAXTEMP=hwmon5/device/pwm2=60 hwmon5/device/pwm1=60 +MINSTART=hwmon5/device/pwm2=75 hwmon5/device/pwm1=75 +MINSTOP=hwmon5/device/pwm2=22 hwmon5/device/pwm1=22 + diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps new file mode 100644 index 000000000000..d1695e36b59a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps @@ -0,0 +1,9 @@ +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_HASH_L2_FDB_REGION_ENTRY_NUM 0 0 49152 +0 NPS_CFG_TYPE_HASH_L3_WITH_IPV6_PREFIX_64_REGION_ENTRY_NUM 0 0 32768 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml new file mode 100644 index 000000000000..6b29a7eb83b8 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + + OCPSCH01040GGLF + INGRASYS-S9130-32X + + + + + + + OCPSCH01040GGLF + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + OCPSCH01040GGLF + INGRASYS-S9130-32X +
diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..0f47704ed2cb --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9130-32X +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0055/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4a029c15b1a6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-10/10-0050", + "/sys/bus/i2c/devices/i2c-9/9-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..387c8155eef2 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py @@ -0,0 +1,187 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + 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 = 21 + ABS_GPIO_BASE_0_15 = 240 + ABS_GPIO_BASE_16_31 = 224 + LP_MODE_GPIO_BASE_0_15 = 176 + LP_MODE_GPIO_BASE_16_31 = 160 + RST_GPIO_BASE_0_15 = 144 + RST_GPIO_BASE_16_31 = 128 + + GPIO_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' + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(x + self.EEPROM_OFFSET) + self.port_to_eeprom_mapping[x] = port_eeprom_path + + 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 + + # open corrsponding gpio file + try: + if port_num <= 15: + gpio_base = self.ABS_GPIO_BASE_0_15 + else : + gpio_base = self.ABS_GPIO_BASE_16_31 + gpio_index = gpio_base + (port_num % 16) + gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index) + gpio_file = open(gpio_file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the gpio value + gpio_val = int(gpio_file.readline().rstrip()) + gpio_file.close() + + # the gpio pin is ACTIVE_LOW but reversed + if gpio_val == 0: + return False + + return True + + 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 + + # open corrsponding gpio file + try: + if port_num <= 15: + gpio_base = self.LP_MODE_GPIO_BASE_0_15 + else : + gpio_base = self.LP_MODE_GPIO_BASE_16_31 + gpio_index = gpio_base + (port_num % 16) + gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index) + gpio_file = open(gpio_file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the gpio value + gpio_val = int(gpio_file.readline().rstrip()) + gpio_file.close() + + if gpio_val == 0: + return False + + return True + + 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 + + # open corrsponding gpio file + try: + if port_num <= 15: + gpio_base = self.LP_MODE_GPIO_BASE_0_15 + else : + gpio_base = self.LP_MODE_GPIO_BASE_16_31 + gpio_index = gpio_base + (port_num % 16) + gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index) + gpio_file = open(gpio_file_path, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # the gpio pin is ACTIVE_HIGH + if lpmode is True: + gpio_val = "1" + else: + gpio_val = "0" + + # write value to gpio + gpio_file.seek(0) + gpio_file.write(gpio_val) + gpio_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 + + # open corrsponding gpio file + try: + if port_num <= 15: + gpio_base = self.RST_GPIO_BASE_0_15 + else : + gpio_base = self.RST_GPIO_BASE_16_31 + gpio_index = gpio_base + (port_num % 16) + gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index) + gpio_file = open(gpio_file_path, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # set the gpio to take port into reset + # the gpio pin is ACTIVE_LOW but reversed + gpio_val = "1" + # write value to gpio + gpio_file.seek(0) + gpio_file.write(gpio_val) + gpio_file.close() + + # Sleep 1 second to let it settle + time.sleep(1) + + # open corrsponding gpio file + try: + gpio_file = open(gpio_file_path, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # set gpio back low to take port out of reset + # the gpio pin is ACTIVE_LOW but reversed + gpio_val = "0" + # write value to gpio + gpio_file.seek(0) + gpio_file.write(gpio_val) + gpio_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/sensors.conf new file mode 100644 index 000000000000..9b55f73af2af --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/sensors.conf @@ -0,0 +1,69 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + +bus "i2c-8" "i2c-mux-0 (chan_id 7)" +chip "w83795adg-*" + label in0 "0.9V" + set in0_max 0.945 + set in0_min 0.855 + label in1 "VDD_CORE" + set in1_max 0.945 + set in1_min 0.855 + label in2 "1.2V" + set in2_max 1.26 + set in2_min 1.14 + label in3 "1.8V" + set in3_max 1.89 + set in3_min 1.71 + label in4 "1.01V" + set in4_max 1.0605 + set in4_min 0.9595 + ignore in5 + ignore in6 + ignore in7 + ignore in11 + label in12 "3.3VDD" + set in12_max 3.465 + set in12_min 3.135 + # in12 and in13 are the same source + ignore in13 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore intrusion0 + +chip "tmp75-i2c-*-4A" + label temp1 "BMC board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-0" "i2c-main" +chip "tmp75-i2c-*-4F" + label temp1 "x86 CPU board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-12" "i2c-mux-1 (chan_id 3)" +chip "tmp75-i2c-*-4C" + label temp1 "rear MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +chip "tmp75-i2c-*-49" + label temp1 "front MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/port_config.ini new file mode 100644 index 000000000000..f1127a5aa046 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias index +Ethernet0 1,2,3,4 Ethernet1/1 0 +Ethernet4 5,6,7,8 Ethernet2/1 1 +Ethernet8 17,18,19,20 Ethernet3/1 2 +Ethernet12 21,22,23,24 Ethernet4/1 3 +Ethernet16 33,34,35,36 Ethernet5/1 4 +Ethernet20 37,38,39,40 Ethernet6/1 5 +Ethernet24 49,50,51,52 Ethernet7/1 6 +Ethernet28 53,54,55,56 Ethernet8/1 7 +Ethernet32 65,66,67,68 Ethernet9/1 8 +Ethernet36 69,70,71,72 Ethernet10/1 9 +Ethernet40 81,82,83,84 Ethernet11/1 10 +Ethernet44 85,86,87,88 Ethernet12/1 11 +Ethernet48 97,98,99,100 Ethernet13/1 12 +Ethernet52 101,102,103,104 Ethernet14/1 13 +Ethernet56 113,114,115,116 Ethernet15/1 14 +Ethernet60 117,118,119,120 Ethernet16/1 15 +Ethernet64 129,130,131,132 Ethernet17/1 16 +Ethernet68 133,134,135,136 Ethernet18/1 17 +Ethernet72 145,146,147,148 Ethernet19/1 18 +Ethernet76 149,150,151,152 Ethernet20/1 19 +Ethernet80 161,162,163,164 Ethernet21/1 20 +Ethernet84 165,166,167,168 Ethernet22/1 21 +Ethernet88 177,178,179,180 Ethernet23/1 22 +Ethernet92 181,182,183,184 Ethernet24/1 23 +Ethernet96 193,194,195,196 Ethernet25/1 24 +Ethernet100 197,198,199,200 Ethernet26/1 25 +Ethernet104 209,210,211,212 Ethernet27/1 26 +Ethernet108 213,214,215,216 Ethernet28/1 27 +Ethernet112 225,226,227,228 Ethernet29/1 28 +Ethernet116 229,230,231,232 Ethernet30/1 29 +Ethernet120 241,242,243,244 Ethernet31/1 30 +Ethernet124 245,246,247,248 Ethernet32/1 31 +Ethernet128 9,10,11,12 Ethernet33/1 32 +Ethernet132 13,14,15,16 Ethernet34/1 33 +Ethernet136 25,26,27,28 Ethernet35/1 34 +Ethernet140 29,30,31,32 Ethernet36/1 35 +Ethernet144 41,42,43,44 Ethernet37/1 36 +Ethernet148 45,46,47,48 Ethernet38/1 37 +Ethernet152 57,58,59,60 Ethernet39/1 38 +Ethernet156 61,62,63,64 Ethernet40/1 39 +Ethernet160 73,74,75,76 Ethernet41/1 40 +Ethernet164 77,78,79,80 Ethernet42/1 41 +Ethernet168 89,90,91,92 Ethernet43/1 42 +Ethernet172 93,94,95,96 Ethernet44/1 43 +Ethernet176 105,106,107,108 Ethernet45/1 44 +Ethernet180 109,110,111,112 Ethernet46/1 45 +Ethernet184 121,122,123,124 Ethernet47/1 46 +Ethernet188 125,126,127,128 Ethernet48/1 47 +Ethernet192 137,138,139,140 Ethernet49/1 48 +Ethernet196 141,142,143,144 Ethernet50/1 49 +Ethernet200 153,154,155,156 Ethernet51/1 50 +Ethernet204 157,158,159,160 Ethernet52/1 51 +Ethernet208 169,170,171,172 Ethernet53/1 52 +Ethernet212 173,174,175,176 Ethernet54/1 53 +Ethernet216 185,186,187,188 Ethernet55/1 54 +Ethernet220 189,190,191,192 Ethernet56/1 55 +Ethernet224 201,202,203,204 Ethernet57/1 56 +Ethernet228 205,206,207,208 Ethernet58/1 57 +Ethernet232 217,218,219,220 Ethernet59/1 58 +Ethernet236 221,222,223,224 Ethernet60/1 59 +Ethernet240 233,234,235,236 Ethernet61/1 60 +Ethernet244 237,238,239,240 Ethernet62/1 61 +Ethernet248 249,250,251,252 Ethernet63/1 62 +Ethernet252 253,254,255,256 Ethernet64/1 63 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/sai.profile b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/sai.profile new file mode 100644 index 000000000000..20bbcc6a07df --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th2-s9200-64x100G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/fancontrol new file mode 100644 index 000000000000..185ee3a2fc25 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +DEVPATH=hwmon5=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-16/16-002f hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-7/7-004d +DEVNAME=hwmon5=w83795adg +FCTEMPS=hwmon5/device/pwm2=hwmon1/temp1_input +FCFANS=hwmon5/device/pwm2=hwmon5/device/fan7_input hwmon5/device/pwm2=hwmon5/device/fan5_input hwmon5/device/pwm2=hwmon5/device/fan3_input hwmon5/device/pwm2=hwmon5/device/fan1_input +MINTEMP=hwmon5/device/pwm2=20 +MAXTEMP=hwmon5/device/pwm2=60 +MINSTART=hwmon5/device/pwm2=75 +MINSTOP=hwmon5/device/pwm2=22 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/led_proc_init.soc b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/led_proc_init.soc new file mode 100644 index 000000000000..774923ff868d --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/led_proc_init.soc @@ -0,0 +1,111 @@ +#processor initialization for Ingrasys S9200-64X + +led 0 stop +led 0 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=56 REMAP_PORT_2=57 REMAP_PORT_1=58 REMAP_PORT_0=59 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=60 REMAP_PORT_6=61 REMAP_PORT_5=62 REMAP_PORT_4=63 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=52 REMAP_PORT_10=53 REMAP_PORT_9=54 REMAP_PORT_8=55 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=48 REMAP_PORT_14=49 REMAP_PORT_13=50 REMAP_PORT_12=51 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=40 REMAP_PORT_18=41 REMAP_PORT_17=42 REMAP_PORT_16=43 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=44 REMAP_PORT_22=45 REMAP_PORT_21=46 REMAP_PORT_20=47 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 REMAP_PORT_26=37 REMAP_PORT_25=38 REMAP_PORT_24=39 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 REMAP_PORT_30=33 REMAP_PORT_29=34 REMAP_PORT_28=35 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=24 REMAP_PORT_34=25 REMAP_PORT_33=26 REMAP_PORT_32=27 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=28 REMAP_PORT_38=29 REMAP_PORT_37=30 REMAP_PORT_36=31 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=20 REMAP_PORT_42=21 REMAP_PORT_41=22 REMAP_PORT_40=23 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=16 REMAP_PORT_46=17 REMAP_PORT_45=18 REMAP_PORT_44=19 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=8 REMAP_PORT_50=9 REMAP_PORT_49=10 REMAP_PORT_48=11 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=12 REMAP_PORT_54=13 REMAP_PORT_53=14 REMAP_PORT_52=15 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 REMAP_PORT_58=5 REMAP_PORT_57=6 REMAP_PORT_56=7 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 REMAP_PORT_62=1 REMAP_PORT_61=2 REMAP_PORT_60=3 + +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=12 REMAP_PORT_10=13 REMAP_PORT_9=14 REMAP_PORT_8=15 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=8 REMAP_PORT_14=9 REMAP_PORT_13=10 REMAP_PORT_12=11 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=16 REMAP_PORT_18=17 REMAP_PORT_17=18 REMAP_PORT_16=19 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=20 REMAP_PORT_22=21 REMAP_PORT_21=22 REMAP_PORT_20=23 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=28 REMAP_PORT_26=29 REMAP_PORT_25=30 REMAP_PORT_24=31 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=24 REMAP_PORT_30=25 REMAP_PORT_29=26 REMAP_PORT_28=27 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=32 REMAP_PORT_34=33 REMAP_PORT_33=34 REMAP_PORT_32=35 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=36 REMAP_PORT_38=37 REMAP_PORT_37=38 REMAP_PORT_36=39 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=44 REMAP_PORT_42=45 REMAP_PORT_41=46 REMAP_PORT_40=47 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=40 REMAP_PORT_46=41 REMAP_PORT_45=42 REMAP_PORT_44=43 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=48 REMAP_PORT_50=49 REMAP_PORT_49=50 REMAP_PORT_48=51 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=52 REMAP_PORT_54=53 REMAP_PORT_53=54 REMAP_PORT_52=55 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=60 REMAP_PORT_58=61 REMAP_PORT_57=62 REMAP_PORT_56=63 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=56 REMAP_PORT_62=57 REMAP_PORT_61=58 REMAP_PORT_60=59 + +led 1 auto on +led 1 start + +led 2 stop +led 2 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=56 REMAP_PORT_2=57 REMAP_PORT_1=58 REMAP_PORT_0=59 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=60 REMAP_PORT_6=61 REMAP_PORT_5=62 REMAP_PORT_4=63 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=52 REMAP_PORT_10=53 REMAP_PORT_9=54 REMAP_PORT_8=55 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=48 REMAP_PORT_14=49 REMAP_PORT_13=50 REMAP_PORT_12=51 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=40 REMAP_PORT_18=41 REMAP_PORT_17=42 REMAP_PORT_16=43 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=44 REMAP_PORT_22=45 REMAP_PORT_21=46 REMAP_PORT_20=47 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 REMAP_PORT_26=37 REMAP_PORT_25=38 REMAP_PORT_24=39 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 REMAP_PORT_30=33 REMAP_PORT_29=34 REMAP_PORT_28=35 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=24 REMAP_PORT_34=25 REMAP_PORT_33=26 REMAP_PORT_32=27 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=28 REMAP_PORT_38=29 REMAP_PORT_37=30 REMAP_PORT_36=31 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=20 REMAP_PORT_42=21 REMAP_PORT_41=22 REMAP_PORT_40=23 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=16 REMAP_PORT_46=17 REMAP_PORT_45=18 REMAP_PORT_44=19 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=8 REMAP_PORT_50=9 REMAP_PORT_49=10 REMAP_PORT_48=11 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=12 REMAP_PORT_54=13 REMAP_PORT_53=14 REMAP_PORT_52=15 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 REMAP_PORT_58=5 REMAP_PORT_57=6 REMAP_PORT_56=7 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 REMAP_PORT_62=1 REMAP_PORT_61=2 REMAP_PORT_60=3 + +led 2 auto on +led 2 start + +led 3 stop +led 3 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=12 REMAP_PORT_10=13 REMAP_PORT_9=14 REMAP_PORT_8=15 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=8 REMAP_PORT_14=9 REMAP_PORT_13=10 REMAP_PORT_12=11 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=16 REMAP_PORT_18=17 REMAP_PORT_17=18 REMAP_PORT_16=19 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=20 REMAP_PORT_22=21 REMAP_PORT_21=22 REMAP_PORT_20=23 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=28 REMAP_PORT_26=29 REMAP_PORT_25=30 REMAP_PORT_24=31 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=24 REMAP_PORT_30=25 REMAP_PORT_29=26 REMAP_PORT_28=27 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=32 REMAP_PORT_34=33 REMAP_PORT_33=34 REMAP_PORT_32=35 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=36 REMAP_PORT_38=37 REMAP_PORT_37=38 REMAP_PORT_36=39 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=44 REMAP_PORT_42=45 REMAP_PORT_41=46 REMAP_PORT_40=47 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=40 REMAP_PORT_46=41 REMAP_PORT_45=42 REMAP_PORT_44=43 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=48 REMAP_PORT_50=49 REMAP_PORT_49=50 REMAP_PORT_48=51 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=52 REMAP_PORT_54=53 REMAP_PORT_53=54 REMAP_PORT_52=55 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=60 REMAP_PORT_58=61 REMAP_PORT_57=62 REMAP_PORT_56=63 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=56 REMAP_PORT_62=57 REMAP_PORT_61=58 REMAP_PORT_60=59 + +led 3 auto on +led 3 start + +led 4 stop +led 4 prog 12 00 61 F1 12 40 61 F2 12 01 61 F3 12 01 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=62 REMAP_PORT_2=0 REMAP_PORT_1=63 REMAP_PORT_0=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=0 REMAP_PORT_6=0 REMAP_PORT_5=0 REMAP_PORT_4=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=0 REMAP_PORT_10=0 REMAP_PORT_9=0 REMAP_PORT_8=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=0 REMAP_PORT_14=0 REMAP_PORT_13=0 REMAP_PORT_12=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=0 REMAP_PORT_18=0 REMAP_PORT_17=0 REMAP_PORT_16=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=0 REMAP_PORT_22=0 REMAP_PORT_21=0 REMAP_PORT_20=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=0 REMAP_PORT_26=0 REMAP_PORT_25=0 REMAP_PORT_24=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0 REMAP_PORT_30=0 REMAP_PORT_29=0 REMAP_PORT_28=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=0 REMAP_PORT_34=0 REMAP_PORT_33=0 REMAP_PORT_32=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=0 REMAP_PORT_38=0 REMAP_PORT_37=0 REMAP_PORT_36=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=0 REMAP_PORT_42=0 REMAP_PORT_41=0 REMAP_PORT_40=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=0 REMAP_PORT_46=0 REMAP_PORT_45=0 REMAP_PORT_44=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=0 REMAP_PORT_50=0 REMAP_PORT_49=0 REMAP_PORT_48=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=0 REMAP_PORT_54=0 REMAP_PORT_53=0 REMAP_PORT_52=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=0 REMAP_PORT_58=0 REMAP_PORT_57=0 REMAP_PORT_56=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 REMAP_PORT_62=0 REMAP_PORT_61=0 REMAP_PORT_60=0 + +led 4 auto on +led 4 start diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml new file mode 100644 index 000000000000..2b05e9ed15b7 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + + OCPSCH01040GGLF + INGRASYS-S9200-64X + + + + + + + OCPSCH01040GGLF + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + OCPSCH01040GGLF + INGRASYS-S9200-64X +
diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..3d01608ef7b2 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9200-64X +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + i2c_bus = "0" + i2c_addr = "0055" + self.eeprom_path = "/sys/class/i2c-adapter/i2c-" + i2c_bus + "/" + i2c_bus + "-" + i2c_addr + "/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..cc996057e09e --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-18/18-0050", + "/sys/bus/i2c/devices/i2c-17/17-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..4d5651c63a68 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py @@ -0,0 +1,260 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + 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 = 63 + PORTS_IN_BLOCK = 64 + + EEPROM_OFFSET = 29 + + _port_to_eeprom_mapping = {} + + _logic_to_phy_port_mapping = { + 0: 0, + 1: 1, + 2: 4, + 3: 5, + 4: 8, + 5: 9, + 6: 12, + 7: 13, + 8: 16, + 9: 17, + 10: 20, + 11: 21, + 12: 24, + 13: 25, + 14: 28, + 15: 29, + 16: 32, + 17: 33, + 18: 36, + 19: 37, + 20: 40, + 21: 41, + 22: 44, + 23: 45, + 24: 48, + 25: 49, + 26: 52, + 27: 53, + 28: 56, + 29: 57, + 30: 60, + 31: 61, + 32: 2, + 33: 3, + 34: 6, + 35: 7, + 36: 10, + 37: 11, + 38: 14, + 39: 15, + 40: 18, + 41: 19, + 42: 22, + 43: 23, + 44: 26, + 45: 27, + 46: 30, + 47: 31, + 48: 34, + 49: 35, + 50: 38, + 51: 39, + 52: 42, + 53: 43, + 54: 46, + 55: 47, + 56: 50, + 57: 51, + 58: 54, + 59: 55, + 60: 58, + 61: 59, + 62: 62, + 63: 63 + } + + @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): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + phy_port = self._logic_to_phy_port_mapping[x] + self._port_to_eeprom_mapping[x] = eeprom_path.format(phy_port + 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 + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + try: + reg_file = open("/sys/devices/platform/ingrasys-s9200-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) + + # ModPrsL is active low + 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.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + try: + reg_file = open("/sys/devices/platform/ingrasys-s9200-cpld.0/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + 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) + + # 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.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + try: + reg_file = open("/sys/devices/platform/ingrasys-s9200-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) + + # 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 = format(reg_value, 'x') + + 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-s9200-cpld.0/qsfp_reset" + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + 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) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = format(reg_value, 'x') + + reg_file.seek(0) + reg_file.write(content) + 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 + content = format(reg_value, 'x') + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf new file mode 100644 index 000000000000..065c1ebddf36 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf @@ -0,0 +1,78 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +chip "w83795adg-*" + ignore in0 + label in1 "P0V9" + set in1_min 0.90 * 0.97 + set in1_max 0.90 * 1.03 + ignore in2 + label in3 "P1V8" + set in3_min 1.8 * 0.97 + set in3_max 1.8 * 1.03 + label in4 "P1V0" + set in4_min 1.0 * 0.97 + set in4_max 1.0 * 1.03 + label in5 "P0V8" + set in5_min 0.8 * 0.97 + set in5_max 0.8 * 1.03 + ignore in6 + ignore in7 + ignore in8 + ignore in9 + ignore in10 + ignore in11 + ignore in12 + ignore in13 + ignore in14 + ignore in15 + ignore in16 + ignore in17 + ignore in18 + ignore in19 + label fan1 "FANTRAY 1" + ignore fan2 + label fan3 "FANTRAY 2" + ignore fan4 + label fan5 "FANTRAY 3" + ignore fan6 + label fan7 "FANTRAY 4" + ignore fan8 + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore intrusion0 + +chip "tmp75-i2c-*-4A" + label temp1 "BMC Board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +chip "tmp75-i2c-*-4F" + label temp1 "x86 CPU Board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-6" "i2c-0-mux (chan_id 5)" +chip "lm75-i2c-6-4E" + label temp1 "MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +chip "lm75-i2c-6-4D" + label temp1 "REAR MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-7" "i2c-0-mux (chan_id 6)" +chip "lm75-i2c-7-4D" + label temp1 "Front MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.ini new file mode 100644 index 000000000000..ddd76b51167f --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias index +Ethernet0 7,6,5,4 Ethernet1/1 0 +Ethernet4 3,2,1,0 Ethernet2/1 1 +Ethernet8 15,14,13,12 Ethernet3/1 2 +Ethernet12 11,10,9,8 Ethernet4/1 3 +Ethernet16 23,22,21,20 Ethernet5/1 4 +Ethernet20 19,18,17,16 Ethernet6/1 5 +Ethernet24 31,30,29,28 Ethernet7/1 6 +Ethernet28 27,26,25,24 Ethernet8/1 7 +Ethernet32 39,38,37,36 Ethernet9/1 8 +Ethernet36 35,34,33,32 Ethernet10/1 9 +Ethernet40 47,46,45,44 Ethernet11/1 10 +Ethernet44 43,42,41,40 Ethernet12/1 11 +Ethernet48 55,54,53,52 Ethernet13/1 12 +Ethernet52 51,50,49,48 Ethernet14/1 13 +Ethernet56 63,62,61,60 Ethernet15/1 14 +Ethernet60 59,58,57,56 Ethernet16/1 15 +Ethernet64 71,70,69,68 Ethernet17/1 16 +Ethernet68 67,66,65,64 Ethernet18/1 17 +Ethernet72 79,78,77,76 Ethernet19/1 18 +Ethernet76 75,74,73,72 Ethernet20/1 19 +Ethernet80 87,86,85,84 Ethernet21/1 20 +Ethernet84 83,82,81,80 Ethernet22/1 21 +Ethernet88 95,94,93,92 Ethernet23/1 22 +Ethernet92 91,90,89,88 Ethernet24/1 23 +Ethernet96 97,98,99,100 Ethernet25/1 24 +Ethernet100 101,102,103,104 Ethernet26/1 25 +Ethernet104 105,106,107,108 Ethernet27/1 26 +Ethernet108 109,110,111,112 Ethernet28/1 27 +Ethernet112 119,118,117,116 Ethernet29/1 28 +Ethernet116 115,114,113,112 Ethernet30/1 29 +Ethernet120 127,126,125,124 Ethernet31/1 30 +Ethernet124 123,122,121,120 Ethernet32/1 31 +Ethernet128 135,134,133,132 Ethernet33/1 32 +Ethernet132 131,130,129,128 Ethernet34/1 33 +Ethernet136 143,142,141,140 Ethernet35/1 34 +Ethernet140 139,138,137,136 Ethernet36/1 35 +Ethernet144 151,150,149,148 Ethernet37/1 36 +Ethernet148 147,146,145,144 Ethernet38/1 37 +Ethernet152 159,158,157,156 Ethernet39/1 38 +Ethernet156 155,154,153,152 Ethernet40/1 39 +Ethernet160 167,166,165,164 Ethernet41/1 40 +Ethernet164 163,162,161,160 Ethernet42/1 41 +Ethernet168 175,174,173,172 Ethernet43/1 42 +Ethernet172 171,170,169,168 Ethernet44/1 43 +Ethernet176 183,182,181,180 Ethernet45/1 44 +Ethernet180 179,178,177,176 Ethernet46/1 45 +Ethernet184 191,190,189,188 Ethernet47/1 46 +Ethernet188 187,186,185,184 Ethernet48/1 47 +Ethernet192 199,198,197,196 Ethernet49/1 48 +Ethernet196 195,194,193,192 Ethernet50/1 49 +Ethernet200 207,206,205,204 Ethernet51/1 50 +Ethernet204 203,202,201,200 Ethernet52/1 51 +Ethernet208 215,214,213,212 Ethernet53/1 52 +Ethernet212 211,210,209,208 Ethernet54/1 53 +Ethernet216 223,222,221,220 Ethernet55/1 54 +Ethernet220 219,218,217,216 Ethernet56/1 55 +Ethernet224 231,230,229,228 Ethernet57/1 56 +Ethernet228 227,226,225,224 Ethernet58/1 57 +Ethernet232 239,238,237,236 Ethernet59/1 58 +Ethernet236 235,234,233,232 Ethernet60/1 59 +Ethernet240 247,246,245,244 Ethernet61/1 60 +Ethernet244 243,242,241,240 Ethernet62/1 61 +Ethernet248 255,254,253,252 Ethernet63/1 62 +Ethernet252 251,250,249,248 Ethernet64/1 63 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps new file mode 100644 index 000000000000..2b013f7641eb --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps @@ -0,0 +1,864 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=1 lane=0 max-speed=100g active=true +init set port-map unit=0 port=1 eth-macro=0 lane=0 max-speed=100g active=true +init set port-map unit=0 port=2 eth-macro=5 lane=0 max-speed=100g active=true +init set port-map unit=0 port=3 eth-macro=4 lane=0 max-speed=100g active=true +init set port-map unit=0 port=4 eth-macro=9 lane=0 max-speed=100g active=true +init set port-map unit=0 port=5 eth-macro=8 lane=0 max-speed=100g active=true +init set port-map unit=0 port=6 eth-macro=13 lane=0 max-speed=100g active=true +init set port-map unit=0 port=7 eth-macro=12 lane=0 max-speed=100g active=true +init set port-map unit=0 port=8 eth-macro=17 lane=0 max-speed=100g active=true +init set port-map unit=0 port=9 eth-macro=16 lane=0 max-speed=100g active=true +init set port-map unit=0 port=10 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=11 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=12 eth-macro=25 lane=0 max-speed=100g active=true +init set port-map unit=0 port=13 eth-macro=24 lane=0 max-speed=100g active=true +init set port-map unit=0 port=14 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=15 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=16 eth-macro=33 lane=0 max-speed=100g active=true +init set port-map unit=0 port=17 eth-macro=32 lane=0 max-speed=100g active=true +init set port-map unit=0 port=18 eth-macro=37 lane=0 max-speed=100g active=true +init set port-map unit=0 port=19 eth-macro=36 lane=0 max-speed=100g active=true +init set port-map unit=0 port=20 eth-macro=41 lane=0 max-speed=100g active=true +init set port-map unit=0 port=21 eth-macro=40 lane=0 max-speed=100g active=true +init set port-map unit=0 port=22 eth-macro=45 lane=0 max-speed=100g active=true +init set port-map unit=0 port=23 eth-macro=44 lane=0 max-speed=100g active=true +init set port-map unit=0 port=24 eth-macro=49 lane=0 max-speed=100g active=true +init set port-map unit=0 port=25 eth-macro=48 lane=0 max-speed=100g active=true +init set port-map unit=0 port=26 eth-macro=53 lane=0 max-speed=100g active=true +init set port-map unit=0 port=27 eth-macro=52 lane=0 max-speed=100g active=true +init set port-map unit=0 port=28 eth-macro=57 lane=0 max-speed=100g active=true +init set port-map unit=0 port=29 eth-macro=56 lane=0 max-speed=100g active=true +init set port-map unit=0 port=30 eth-macro=61 lane=0 max-speed=100g active=true +init set port-map unit=0 port=31 eth-macro=60 lane=0 max-speed=100g active=true +init set port-map unit=0 port=32 eth-macro=3 lane=0 max-speed=100g active=true +init set port-map unit=0 port=33 eth-macro=2 lane=0 max-speed=100g active=true +init set port-map unit=0 port=34 eth-macro=7 lane=0 max-speed=100g active=true +init set port-map unit=0 port=35 eth-macro=6 lane=0 max-speed=100g active=true +init set port-map unit=0 port=36 eth-macro=11 lane=0 max-speed=100g active=true +init set port-map unit=0 port=37 eth-macro=10 lane=0 max-speed=100g active=true +init set port-map unit=0 port=38 eth-macro=15 lane=0 max-speed=100g active=true +init set port-map unit=0 port=39 eth-macro=14 lane=0 max-speed=100g active=true +init set port-map unit=0 port=40 eth-macro=19 lane=0 max-speed=100g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=0 max-speed=100g active=true +init set port-map unit=0 port=42 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=43 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=44 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=45 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=46 eth-macro=31 lane=0 max-speed=100g active=true +init set port-map unit=0 port=47 eth-macro=30 lane=0 max-speed=100g active=true +init set port-map unit=0 port=48 eth-macro=35 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=34 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=39 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=38 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=43 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=42 lane=0 max-speed=100g active=true +init set port-map unit=0 port=54 eth-macro=47 lane=0 max-speed=100g active=true +init set port-map unit=0 port=55 eth-macro=46 lane=0 max-speed=100g active=true +init set port-map unit=0 port=56 eth-macro=51 lane=0 max-speed=100g active=true +init set port-map unit=0 port=57 eth-macro=50 lane=0 max-speed=100g active=true +init set port-map unit=0 port=58 eth-macro=55 lane=0 max-speed=100g active=true +init set port-map unit=0 port=59 eth-macro=54 lane=0 max-speed=100g active=true +init set port-map unit=0 port=60 eth-macro=59 lane=0 max-speed=100g active=true +init set port-map unit=0 port=61 eth-macro=58 lane=0 max-speed=100g active=true +init set port-map unit=0 port=62 eth-macro=63 lane=0 max-speed=100g active=true +init set port-map unit=0 port=63 eth-macro=62 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=1 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=2 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=3 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=4 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=5 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=6 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=7 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=8 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=9 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=10 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=11 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=12 lane-num=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=13 lane-num=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=14 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=15 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=16 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=17 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=18 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=19 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=20 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=21 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=22 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=23 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=24 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=25 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=26 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=27 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=28 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=29 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=30 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=31 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=32 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=33 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=34 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=35 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=36 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=37 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=38 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=39 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=40 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=41 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=42 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=43 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=44 lane-num=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=45 lane-num=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=46 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=47 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=48 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=49 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=50 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=52 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=53 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=54 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=55 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=56 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=57 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=58 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=59 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=60 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=61 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=62 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=63 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=129 lane-num=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-num=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=1 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=2 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=3 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=4 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=5 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=6 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=7 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=8 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=9 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=10 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=11 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=12 lane-num=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=13 lane-num=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=14 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=15 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=16 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=17 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=18 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=19 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=20 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=21 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=22 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=23 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=24 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=25 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=26 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=27 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=28 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=29 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=30 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=31 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=32 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=33 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=34 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=35 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=36 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=37 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=38 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=39 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=40 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=41 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=42 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=43 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=44 lane-num=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=45 lane-num=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=46 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=47 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=48 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=49 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=50 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=52 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=53 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=54 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=55 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=56 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=57 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=58 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=59 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=60 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=61 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=62 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=63 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=129 lane-num=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-num=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=1 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=2 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=3 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=4 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=5 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=6 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=7 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=8 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=9 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=10 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=11 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=12 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=13 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=14 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=15 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=16 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=17 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=18 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=19 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=20 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=21 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=22 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=23 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=24 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=25 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=26 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=27 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=28 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=29 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=30 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=31 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=32 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=33 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=34 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=35 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=36 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=37 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=38 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=39 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=40 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=41 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=42 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=43 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=44 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=45 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=46 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=47 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=48 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=56 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=57 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=58 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=59 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=60 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=61 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=62 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=63 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-num=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-num=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=1 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=2 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=3 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=4 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=5 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=6 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=7 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=8 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=9 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=10 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=11 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=12 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=13 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=14 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=15 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=16 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=17 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=18 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=19 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=20 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=21 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=22 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=23 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=24 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=25 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=26 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=27 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=28 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=29 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=30 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=31 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=32 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=33 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=34 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=35 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=36 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=37 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=38 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=39 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=40 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=41 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=42 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=43 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=44 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=45 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=46 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=47 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=48 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=56 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=57 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=58 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=59 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=60 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=61 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=62 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=63 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-num=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-num=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=0 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=0 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=0 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=1 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=1 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=1 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=1 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=2 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=2 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=2 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=2 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=3 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=3 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=3 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=3 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=4 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=4 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=4 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=4 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=5 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=5 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=5 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=5 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=6 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=6 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=6 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=6 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=7 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=7 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=7 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=7 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=8 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=8 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=8 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=8 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=9 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=9 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=9 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=9 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=10 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=10 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=10 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=10 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=11 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=11 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=11 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=11 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=12 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=12 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=12 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=12 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=13 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=13 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=13 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=13 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=14 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=14 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=14 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=14 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=15 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=15 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=15 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=15 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=16 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=16 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=16 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=16 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=17 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=17 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=17 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=17 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=18 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=18 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=18 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=18 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=19 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=19 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=19 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=19 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=20 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=20 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=20 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=20 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=21 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=21 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=21 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=21 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=22 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=22 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=22 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=22 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=23 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=23 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=23 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=23 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=24 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=24 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=24 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=24 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=25 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=25 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=25 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=25 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=26 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=26 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=26 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=26 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=27 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=27 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=27 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=27 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=28 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=28 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=28 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=28 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=29 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=29 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=29 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=29 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=30 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=30 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=30 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=30 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=31 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=31 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=31 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=31 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=32 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=32 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=32 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=32 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=33 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=33 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=33 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=33 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=34 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=34 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=34 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=34 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=35 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=35 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=35 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=35 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=36 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=36 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=36 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=36 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=37 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=37 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=37 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=37 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=38 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=38 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=38 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=38 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=39 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=39 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=39 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=39 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=40 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=40 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=40 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=40 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=41 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=41 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=41 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=41 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=42 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=42 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=42 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=42 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=43 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=43 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=43 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=43 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=44 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=44 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=44 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=44 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=45 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=45 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=45 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=45 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=46 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=46 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=46 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=46 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=47 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=47 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=47 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=47 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=48 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=48 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=48 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=48 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=49 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=49 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=49 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=49 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=50 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=50 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=50 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=50 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=51 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=51 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=51 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=51 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=52 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=52 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=52 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=52 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=53 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=53 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=53 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=53 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=54 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=54 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=54 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=54 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=55 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=55 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=55 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=55 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=56 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=56 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=56 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=56 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=57 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=57 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=57 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=57 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=58 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=58 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=58 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=58 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=59 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=59 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=59 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=59 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=60 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=60 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=60 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=60 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=61 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=61 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=61 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=61 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=62 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=62 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=62 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=62 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=63 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=63 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=63 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=63 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=129 lane-num=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-num=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-num=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=129 lane-num=1 property=c1 data=0x3 +phy set pre-emphasis unit=0 portlist=130 lane-num=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-num=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-num=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=130 lane-num=1 property=c1 data=0x3 +port set unit=0 portlist=0 speed=100g +port set unit=0 portlist=1 speed=100g +port set unit=0 portlist=2 speed=100g +port set unit=0 portlist=3 speed=100g +port set unit=0 portlist=4 speed=100g +port set unit=0 portlist=5 speed=100g +port set unit=0 portlist=6 speed=100g +port set unit=0 portlist=7 speed=100g +port set unit=0 portlist=8 speed=100g +port set unit=0 portlist=9 speed=100g +port set unit=0 portlist=10 speed=100g +port set unit=0 portlist=11 speed=100g +port set unit=0 portlist=12 speed=100g +port set unit=0 portlist=13 speed=100g +port set unit=0 portlist=14 speed=100g +port set unit=0 portlist=15 speed=100g +port set unit=0 portlist=16 speed=100g +port set unit=0 portlist=17 speed=100g +port set unit=0 portlist=18 speed=100g +port set unit=0 portlist=19 speed=100g +port set unit=0 portlist=20 speed=100g +port set unit=0 portlist=21 speed=100g +port set unit=0 portlist=22 speed=100g +port set unit=0 portlist=23 speed=100g +port set unit=0 portlist=24 speed=100g +port set unit=0 portlist=25 speed=100g +port set unit=0 portlist=26 speed=100g +port set unit=0 portlist=27 speed=100g +port set unit=0 portlist=28 speed=100g +port set unit=0 portlist=29 speed=100g +port set unit=0 portlist=30 speed=100g +port set unit=0 portlist=31 speed=100g +port set unit=0 portlist=32 speed=100g +port set unit=0 portlist=33 speed=100g +port set unit=0 portlist=34 speed=100g +port set unit=0 portlist=35 speed=100g +port set unit=0 portlist=36 speed=100g +port set unit=0 portlist=37 speed=100g +port set unit=0 portlist=38 speed=100g +port set unit=0 portlist=39 speed=100g +port set unit=0 portlist=40 speed=100g +port set unit=0 portlist=41 speed=100g +port set unit=0 portlist=42 speed=100g +port set unit=0 portlist=43 speed=100g +port set unit=0 portlist=44 speed=100g +port set unit=0 portlist=45 speed=100g +port set unit=0 portlist=46 speed=100g +port set unit=0 portlist=47 speed=100g +port set unit=0 portlist=48 speed=100g +port set unit=0 portlist=49 speed=100g +port set unit=0 portlist=50 speed=100g +port set unit=0 portlist=51 speed=100g +port set unit=0 portlist=52 speed=100g +port set unit=0 portlist=53 speed=100g +port set unit=0 portlist=54 speed=100g +port set unit=0 portlist=55 speed=100g +port set unit=0 portlist=56 speed=100g +port set unit=0 portlist=57 speed=100g +port set unit=0 portlist=58 speed=100g +port set unit=0 portlist=59 speed=100g +port set unit=0 portlist=60 speed=100g +port set unit=0 portlist=61 speed=100g +port set unit=0 portlist=62 speed=100g +port set unit=0 portlist=63 speed=100g +port set unit=0 portlist=129 speed=10g +port set unit=0 portlist=130 speed=10g +port set unit=0 portlist=0 medium-type=sr4 +port set unit=0 portlist=1 medium-type=sr4 +port set unit=0 portlist=2 medium-type=sr4 +port set unit=0 portlist=3 medium-type=sr4 +port set unit=0 portlist=4 medium-type=sr4 +port set unit=0 portlist=5 medium-type=sr4 +port set unit=0 portlist=6 medium-type=sr4 +port set unit=0 portlist=7 medium-type=sr4 +port set unit=0 portlist=8 medium-type=sr4 +port set unit=0 portlist=9 medium-type=sr4 +port set unit=0 portlist=10 medium-type=sr4 +port set unit=0 portlist=11 medium-type=sr4 +port set unit=0 portlist=12 medium-type=sr4 +port set unit=0 portlist=13 medium-type=sr4 +port set unit=0 portlist=14 medium-type=sr4 +port set unit=0 portlist=15 medium-type=sr4 +port set unit=0 portlist=16 medium-type=sr4 +port set unit=0 portlist=17 medium-type=sr4 +port set unit=0 portlist=18 medium-type=sr4 +port set unit=0 portlist=19 medium-type=sr4 +port set unit=0 portlist=20 medium-type=sr4 +port set unit=0 portlist=21 medium-type=sr4 +port set unit=0 portlist=22 medium-type=sr4 +port set unit=0 portlist=23 medium-type=sr4 +port set unit=0 portlist=24 medium-type=sr4 +port set unit=0 portlist=25 medium-type=sr4 +port set unit=0 portlist=26 medium-type=sr4 +port set unit=0 portlist=27 medium-type=sr4 +port set unit=0 portlist=28 medium-type=sr4 +port set unit=0 portlist=29 medium-type=sr4 +port set unit=0 portlist=30 medium-type=sr4 +port set unit=0 portlist=31 medium-type=sr4 +port set unit=0 portlist=32 medium-type=sr4 +port set unit=0 portlist=33 medium-type=sr4 +port set unit=0 portlist=34 medium-type=sr4 +port set unit=0 portlist=35 medium-type=sr4 +port set unit=0 portlist=36 medium-type=sr4 +port set unit=0 portlist=37 medium-type=sr4 +port set unit=0 portlist=38 medium-type=sr4 +port set unit=0 portlist=39 medium-type=sr4 +port set unit=0 portlist=40 medium-type=sr4 +port set unit=0 portlist=41 medium-type=sr4 +port set unit=0 portlist=42 medium-type=sr4 +port set unit=0 portlist=43 medium-type=sr4 +port set unit=0 portlist=44 medium-type=sr4 +port set unit=0 portlist=45 medium-type=sr4 +port set unit=0 portlist=46 medium-type=sr4 +port set unit=0 portlist=47 medium-type=sr4 +port set unit=0 portlist=48 medium-type=sr4 +port set unit=0 portlist=49 medium-type=sr4 +port set unit=0 portlist=50 medium-type=sr4 +port set unit=0 portlist=51 medium-type=sr4 +port set unit=0 portlist=52 medium-type=sr4 +port set unit=0 portlist=53 medium-type=sr4 +port set unit=0 portlist=54 medium-type=sr4 +port set unit=0 portlist=55 medium-type=sr4 +port set unit=0 portlist=56 medium-type=sr4 +port set unit=0 portlist=57 medium-type=sr4 +port set unit=0 portlist=58 medium-type=sr4 +port set unit=0 portlist=59 medium-type=sr4 +port set unit=0 portlist=60 medium-type=sr4 +port set unit=0 portlist=61 medium-type=sr4 +port set unit=0 portlist=62 medium-type=sr4 +port set unit=0 portlist=63 medium-type=sr4 +port set unit=0 portlist=129 medium-type=kr +port set unit=0 portlist=130 medium-type=kr +port set unit=0 portlist=0 fec=rs +port set unit=0 portlist=1 fec=rs +port set unit=0 portlist=2 fec=rs +port set unit=0 portlist=3 fec=rs +port set unit=0 portlist=4 fec=rs +port set unit=0 portlist=5 fec=rs +port set unit=0 portlist=6 fec=rs +port set unit=0 portlist=7 fec=rs +port set unit=0 portlist=8 fec=rs +port set unit=0 portlist=9 fec=rs +port set unit=0 portlist=10 fec=rs +port set unit=0 portlist=11 fec=rs +port set unit=0 portlist=12 fec=rs +port set unit=0 portlist=13 fec=rs +port set unit=0 portlist=14 fec=rs +port set unit=0 portlist=15 fec=rs +port set unit=0 portlist=16 fec=rs +port set unit=0 portlist=17 fec=rs +port set unit=0 portlist=18 fec=rs +port set unit=0 portlist=19 fec=rs +port set unit=0 portlist=20 fec=rs +port set unit=0 portlist=21 fec=rs +port set unit=0 portlist=22 fec=rs +port set unit=0 portlist=23 fec=rs +port set unit=0 portlist=24 fec=rs +port set unit=0 portlist=25 fec=rs +port set unit=0 portlist=26 fec=rs +port set unit=0 portlist=27 fec=rs +port set unit=0 portlist=28 fec=rs +port set unit=0 portlist=29 fec=rs +port set unit=0 portlist=30 fec=rs +port set unit=0 portlist=31 fec=rs +port set unit=0 portlist=32 fec=rs +port set unit=0 portlist=33 fec=rs +port set unit=0 portlist=34 fec=rs +port set unit=0 portlist=35 fec=rs +port set unit=0 portlist=36 fec=rs +port set unit=0 portlist=37 fec=rs +port set unit=0 portlist=38 fec=rs +port set unit=0 portlist=39 fec=rs +port set unit=0 portlist=40 fec=rs +port set unit=0 portlist=41 fec=rs +port set unit=0 portlist=42 fec=rs +port set unit=0 portlist=43 fec=rs +port set unit=0 portlist=44 fec=rs +port set unit=0 portlist=45 fec=rs +port set unit=0 portlist=46 fec=rs +port set unit=0 portlist=47 fec=rs +port set unit=0 portlist=48 fec=rs +port set unit=0 portlist=49 fec=rs +port set unit=0 portlist=50 fec=rs +port set unit=0 portlist=51 fec=rs +port set unit=0 portlist=52 fec=rs +port set unit=0 portlist=53 fec=rs +port set unit=0 portlist=54 fec=rs +port set unit=0 portlist=55 fec=rs +port set unit=0 portlist=56 fec=rs +port set unit=0 portlist=57 fec=rs +port set unit=0 portlist=58 fec=rs +port set unit=0 portlist=59 fec=rs +port set unit=0 portlist=60 fec=rs +port set unit=0 portlist=61 fec=rs +port set unit=0 portlist=62 fec=rs +port set unit=0 portlist=63 fec=rs +port advertise unit=0 portlist=129 speed-10g-kr +port advertise unit=0 portlist=130 speed-10g-kr +port set unit=0 portlist=129 an=enable +port set unit=0 portlist=130 an=enable +port set unit=0 portlist=0 admin=enable +port set unit=0 portlist=1 admin=enable +port set unit=0 portlist=2 admin=enable +port set unit=0 portlist=3 admin=enable +port set unit=0 portlist=4 admin=enable +port set unit=0 portlist=5 admin=enable +port set unit=0 portlist=6 admin=enable +port set unit=0 portlist=7 admin=enable +port set unit=0 portlist=8 admin=enable +port set unit=0 portlist=9 admin=enable +port set unit=0 portlist=10 admin=enable +port set unit=0 portlist=11 admin=enable +port set unit=0 portlist=12 admin=enable +port set unit=0 portlist=13 admin=enable +port set unit=0 portlist=14 admin=enable +port set unit=0 portlist=15 admin=enable +port set unit=0 portlist=16 admin=enable +port set unit=0 portlist=17 admin=enable +port set unit=0 portlist=18 admin=enable +port set unit=0 portlist=19 admin=enable +port set unit=0 portlist=20 admin=enable +port set unit=0 portlist=21 admin=enable +port set unit=0 portlist=22 admin=enable +port set unit=0 portlist=23 admin=enable +port set unit=0 portlist=24 admin=enable +port set unit=0 portlist=25 admin=enable +port set unit=0 portlist=26 admin=enable +port set unit=0 portlist=27 admin=enable +port set unit=0 portlist=28 admin=enable +port set unit=0 portlist=29 admin=enable +port set unit=0 portlist=30 admin=enable +port set unit=0 portlist=31 admin=enable +port set unit=0 portlist=32 admin=enable +port set unit=0 portlist=33 admin=enable +port set unit=0 portlist=34 admin=enable +port set unit=0 portlist=35 admin=enable +port set unit=0 portlist=36 admin=enable +port set unit=0 portlist=37 admin=enable +port set unit=0 portlist=38 admin=enable +port set unit=0 portlist=39 admin=enable +port set unit=0 portlist=40 admin=enable +port set unit=0 portlist=41 admin=enable +port set unit=0 portlist=42 admin=enable +port set unit=0 portlist=43 admin=enable +port set unit=0 portlist=44 admin=enable +port set unit=0 portlist=45 admin=enable +port set unit=0 portlist=46 admin=enable +port set unit=0 portlist=47 admin=enable +port set unit=0 portlist=48 admin=enable +port set unit=0 portlist=49 admin=enable +port set unit=0 portlist=50 admin=enable +port set unit=0 portlist=51 admin=enable +port set unit=0 portlist=52 admin=enable +port set unit=0 portlist=53 admin=enable +port set unit=0 portlist=54 admin=enable +port set unit=0 portlist=55 admin=enable +port set unit=0 portlist=56 admin=enable +port set unit=0 portlist=57 admin=enable +port set unit=0 portlist=58 admin=enable +port set unit=0 portlist=59 admin=enable +port set unit=0 portlist=60 admin=enable +port set unit=0 portlist=61 admin=enable +port set unit=0 portlist=62 admin=enable +port set unit=0 portlist=63 admin=enable +port set unit=0 portlist=129 admin=enable +port set unit=0 portlist=130 admin=enable diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/sai.profile b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/sai.profile new file mode 100644 index 000000000000..880f47910ac1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/led_proc_init.nps +SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/fancontrol new file mode 100644 index 000000000000..86b4e636375f --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +DEVPATH=hwmon7=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-16/16-002f hwmon4=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-7/7-004e +DEVNAME=hwmon7=w83795adg +FCTEMPS=hwmon7/device/pwm2=hwmon4/temp1_input +FCFANS=hwmon7/device/pwm2=hwmon7/device/fan7_input hwmon7/device/pwm2=hwmon7/device/fan5_input hwmon7/device/pwm2=hwmon7/device/fan3_input hwmon7/device/pwm2=hwmon7/device/fan1_input +MINTEMP=hwmon7/device/pwm2=20 +MAXTEMP=hwmon7/device/pwm2=60 +MINSTART=hwmon7/device/pwm2=75 +MINSTOP=hwmon7/device/pwm2=22 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps new file mode 100644 index 000000000000..fc640e0d78f8 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps @@ -0,0 +1,9 @@ +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 2 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_HASH_L2_FDB_REGION_ENTRY_NUM 0 0 49152 +0 NPS_CFG_TYPE_HASH_L3_WITH_IPV6_PREFIX_64_REGION_ENTRY_NUM 0 0 32768 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml new file mode 100644 index 000000000000..9ac02997e44d --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + + OCPSCH01040GGLF + INGRASYS-S9230-64X + + + + + + + OCPSCH01040GGLF + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + OCPSCH01040GGLF + INGRASYS-S9230-64X +
diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..ab398102c9b5 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9230-64X +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0055/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..cc996057e09e --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-18/18-0050", + "/sys/bus/i2c/devices/i2c-17/17-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..70e5ebff403d --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py @@ -0,0 +1,293 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + 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 = 63 + PORTS_IN_BLOCK = 64 + #TODO: modify according to port map + EEPROM_OFFSET = 33 + CPLD1_PORTS = 12 + CPLDx_PORTS = 13 + CPLD_OFFSET = 1 + CPLD_PRES_BIT = 1 + CPLD_RESET_BIT = 0 + CPLD_LPMOD_BIT = 2 + CPLDx_I2C_ADDR = "33" + CPLD_PORT_STATUS_KEY = "cpld_qsfp_port_status" + CPLD_PORT_CONFIG_KEY = "cpld_qsfp_port_config" + CPLD_REG_PATH = "/sys/bus/i2c/devices/{0}-00{1}/{2}_{3}" + + _port_to_eeprom_mapping = {} + + _logic_to_phy_port_mapping = { + 0: 0, + 1: 1, + 2: 4, + 3: 5, + 4: 8, + 5: 9, + 6: 12, + 7: 13, + 8: 16, + 9: 17, + 10: 20, + 11: 21, + 12: 24, + 13: 25, + 14: 28, + 15: 29, + 16: 32, + 17: 33, + 18: 36, + 19: 37, + 20: 40, + 21: 41, + 22: 44, + 23: 45, + 24: 48, + 25: 49, + 26: 52, + 27: 53, + 28: 56, + 29: 57, + 30: 60, + 31: 61, + 32: 2, + 33: 3, + 34: 6, + 35: 7, + 36: 10, + 37: 11, + 38: 14, + 39: 15, + 40: 18, + 41: 19, + 42: 22, + 43: 23, + 44: 26, + 45: 27, + 46: 30, + 47: 31, + 48: 34, + 49: 35, + 50: 38, + 51: 39, + 52: 42, + 53: 43, + 54: 46, + 55: 47, + 56: 50, + 57: 51, + 58: 54, + 59: 55, + 60: 58, + 61: 59, + 62: 62, + 63: 63 + } + + @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" + for x in range(self.port_start, self.port_end + 1): + phy_port = self._logic_to_phy_port_mapping[x] + port_eeprom_path = eeprom_path.format(phy_port + self.EEPROM_OFFSET) + self.port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def qsfp_to_cpld_index(self, port_num): + if port_num < self.CPLD1_PORTS: + cpld_id = 0 + cpld_port_index = port_num + 1 + else: + cpld_id = 1 + (port_num - self.CPLD1_PORTS) / self.CPLDx_PORTS + cpld_port_index = ((port_num - self.CPLD1_PORTS) % self.CPLDx_PORTS) + 1 + return cpld_id, cpld_port_index + + 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 + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_STATUS_KEY, cpld_port_index) + + try: + reg_file = open(reg_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_file.close() + + reg_value = int(content, 16) + # mask for presence bit (bit 1) + mask = (1 << self.CPLD_PRES_BIT) + + # 0 - presence, 1 - absence + 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.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + try: + reg_file = open(reg_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_file.close() + + reg_value = int(content, 16) + # mask for lp_mod bit (bit 2) + mask = (1 << self.CPLD_LPMOD_BIT) + + # 0 - disable, 1 - low power mode + 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.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + try: + reg_file = open(reg_path, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + # mask for lp_mod bit (bit 2) + mask = (1 << self.CPLD_LPMOD_BIT) + + # 1 - low power mode, 0 - high power mode + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # convert value to hex string + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_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 + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + # reset the port + try: + reg_file = open(reg_path, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + # mask for reset bit (bit 0) + mask = (1 << self.CPLD_RESET_BIT) + + # 1 - out of reset, 0 - reset + reg_value = reg_value & ~mask + + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 1 second to reset done + time.sleep(1) + + # take the port out of reset + try: + reg_file = open(reg_path, "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_s9230_64x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf new file mode 100644 index 000000000000..b5daa9af42b7 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf @@ -0,0 +1,90 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + +bus "i2c-16" "i2c-mux-1 (chan_id 7)" +chip "w83795adg-*" + ignore in0 + label in1 "VDD_CORE" + set in1_min 0.90 * 0.98 + set in1_max 0.90 * 1.02 + ignore in2 + label in3 "1.8V" + set in3_min 1.8 * 0.97 + set in3_max 1.8 * 1.03 + label in4 "3.3V" + compute in4 @/(0.3052), (0.3052)*@ + set in4_min 3.3 * 0.95 + set in4_max 3.3 * 1.05 + label in5 "0.9V" + set in5_min 0.90 * 0.98 + set in5_max 0.90 * 1.02 + ignore in6 + ignore in7 + ignore in8 + ignore in9 + ignore in10 + ignore in11 + ignore in12 + ignore in13 + ignore in14 + ignore in15 + ignore in16 + ignore in17 + ignore in18 + ignore in19 + label fan1 "FANTRAY 1" + #label fan2 "FANTRAY 1-B" + ignore fan2 + label fan3 "FANTRAY 2" + #label fan4 "FANTRAY 2-B" + ignore fan4 + label fan5 "FANTRAY 3" + #label fan6 "FANTRAY 3-B" + ignore fan6 + label fan7 "FANTRAY 4" + #label fan8 "FANTRAY 4-B" + ignore fan8 + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore intrusion0 + +# TODO: need to confirm the critial temp value with HW after board ready +chip "tmp75-i2c-*-4A" + label temp1 "BMC board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-0" "SMBus I801 adapter at f000" +chip "tmp75-i2c-*-4F" + label temp1 "x86 CPU board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-6" "i2c-0-mux (chan_id 5)" +chip "lm75-i2c-6-4D" + label temp1 "Rear Panel Temp" + set temp1_max 50 + set temp1_max_hyst 45 +chip "lm75-i2c-6-4E" + label temp1 "Rear MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-7" "i2c-0-mux (chan_id 6)" +chip "lm75-i2c-7-4D" + label temp1 "Front Panel Temp" + set temp1_max 50 + set temp1_max_hyst 45 +chip "lm75-i2c-7-4E" + label temp1 "Front MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + + diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini index a8eaeb1f0665..8b0addcada13 100644 --- a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini @@ -1,56 +1,55 @@ -# 48x25G + 6x100G # name lanes alias -Ethernet0 2 Ethernet0 -Ethernet4 1 Ethernet4 -Ethernet8 4 Ethernet8 -Ethernet12 3 Ethernet12 -Ethernet16 6 Ethernet16 -Ethernet20 5 Ethernet20 -Ethernet24 8 Ethernet24 -Ethernet28 7 Ethernet28 -Ethernet32 10 Ethernet32 -Ethernet36 9 Ethernet36 -Ethernet40 12 Ethernet40 -Ethernet44 11 Ethernet44 -Ethernet48 22 Ethernet48 -Ethernet52 21 Ethernet52 -Ethernet56 24 Ethernet56 -Ethernet60 23 Ethernet60 -Ethernet64 34 Ethernet64 -Ethernet68 33 Ethernet68 -Ethernet72 36 Ethernet72 -Ethernet76 35 Ethernet76 -Ethernet80 38 Ethernet80 -Ethernet84 37 Ethernet84 -Ethernet88 40 Ethernet88 -Ethernet92 39 Ethernet92 -Ethernet96 42 Ethernet96 -Ethernet100 41 Ethernet100 -Ethernet104 44 Ethernet104 -Ethernet108 43 Ethernet108 -Ethernet112 50 Ethernet112 -Ethernet116 49 Ethernet116 -Ethernet120 52 Ethernet120 -Ethernet124 51 Ethernet124 -Ethernet128 54 Ethernet128 -Ethernet132 53 Ethernet132 -Ethernet136 56 Ethernet136 -Ethernet140 55 Ethernet140 -Ethernet144 66 Ethernet144 -Ethernet148 65 Ethernet148 -Ethernet152 68 Ethernet152 -Ethernet156 67 Ethernet156 -Ethernet160 70 Ethernet160 -Ethernet164 69 Ethernet164 -Ethernet168 72 Ethernet168 -Ethernet172 71 Ethernet172 -Ethernet176 82 Ethernet176 -Ethernet180 81 Ethernet180 -Ethernet184 84 Ethernet184 -Ethernet188 83 Ethernet188 -Ethernet192 85,86,87,88 Ethernet192 -Ethernet196 97,98,99,100 Ethernet196 -Ethernet200 105,106,107,108 Ethernet200 -Ethernet204 101,102,103,104 Ethernet204 -Ethernet208 117,118,119,120 Ethernet208 -Ethernet212 109,110,111,112 Ethernet212 +Ethernet0 2 Ethernet0 +Ethernet4 1 Ethernet4 +Ethernet8 4 Ethernet8 +Ethernet12 3 Ethernet12 +Ethernet16 6 Ethernet16 +Ethernet20 5 Ethernet20 +Ethernet24 8 Ethernet24 +Ethernet28 7 Ethernet28 +Ethernet32 10 Ethernet32 +Ethernet36 9 Ethernet36 +Ethernet40 12 Ethernet40 +Ethernet44 11 Ethernet44 +Ethernet48 22 Ethernet48 +Ethernet52 21 Ethernet52 +Ethernet56 24 Ethernet56 +Ethernet60 23 Ethernet60 +Ethernet64 34 Ethernet64 +Ethernet68 33 Ethernet68 +Ethernet72 36 Ethernet72 +Ethernet76 35 Ethernet76 +Ethernet80 38 Ethernet80 +Ethernet84 37 Ethernet84 +Ethernet88 40 Ethernet88 +Ethernet92 39 Ethernet92 +Ethernet96 42 Ethernet96 +Ethernet100 41 Ethernet100 +Ethernet104 44 Ethernet104 +Ethernet108 43 Ethernet108 +Ethernet112 50 Ethernet112 +Ethernet116 49 Ethernet116 +Ethernet120 52 Ethernet120 +Ethernet124 51 Ethernet124 +Ethernet128 54 Ethernet128 +Ethernet132 53 Ethernet132 +Ethernet136 56 Ethernet136 +Ethernet140 55 Ethernet140 +Ethernet144 66 Ethernet144 +Ethernet148 65 Ethernet148 +Ethernet152 68 Ethernet152 +Ethernet156 67 Ethernet156 +Ethernet160 70 Ethernet160 +Ethernet164 69 Ethernet164 +Ethernet168 72 Ethernet168 +Ethernet172 71 Ethernet172 +Ethernet176 82 Ethernet176 +Ethernet180 81 Ethernet180 +Ethernet184 84 Ethernet184 +Ethernet188 83 Ethernet188 +Ethernet192 85,86,87,88 Ethernet192 +Ethernet196 97,98,99,100 Ethernet196 +Ethernet200 105,106,107,108 Ethernet200 +Ethernet204 101,102,103,104 Ethernet204 +Ethernet208 117,118,119,120 Ethernet208 +Ethernet212 109,110,111,112 Ethernet212 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml index 859c22a7dac3..d902d6eac4d4 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml @@ -3,7 +3,7 @@ - switch2 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -12,7 +12,7 @@ 60 - switch2 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -21,7 +21,7 @@ 60 - switch2 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -30,7 +30,7 @@ 60 - switch2 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -39,7 +39,7 @@ 60 - switch2 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -48,7 +48,7 @@ 60 - switch2 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -57,7 +57,7 @@ 60 - switch2 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -66,7 +66,7 @@ 60 - switch2 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -75,7 +75,7 @@ 60 - switch2 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -84,7 +84,7 @@ 60 - switch2 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -93,7 +93,7 @@ 60 - switch2 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -102,7 +102,7 @@ 60 - switch2 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -111,7 +111,7 @@ 60 - switch2 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -120,7 +120,7 @@ 60 - switch2 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -129,7 +129,7 @@ 60 - switch2 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -138,7 +138,7 @@ 60 - switch2 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -150,7 +150,7 @@ 65100 - switch2 + sonic
10.0.0.1
@@ -335,7 +335,7 @@ - switch2 + sonic @@ -430,112 +430,112 @@ DeviceInterfaceLink - switch2 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet60 ARISTA16T2 Ethernet1 @@ -543,7 +543,7 @@ - switch2 + sonic ACS-MSN2700 ` @@ -551,7 +551,7 @@ - switch2 + sonic DhcpResources @@ -573,6 +573,6 @@ - switch2 + sonic ACS-MSN2100 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py new file mode 100644 index 000000000000..88bdd51e9b67 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + return isinstance(index, int) and index > 0 and index <= self.get_num_psus() diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml index ea765fab814d..8b417c35353f 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch2 + sonic 10.0.0.32 1 180 60 - switch2 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch2 + sonic 10.0.0.34 1 180 60 - switch2 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch2 + sonic 10.0.0.36 1 180 60 - switch2 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch2 + sonic 10.0.0.38 1 180 60 - switch2 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch2 + sonic 10.0.0.40 1 180 60 - switch2 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch2 + sonic 10.0.0.42 1 180 60 - switch2 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch2 + sonic 10.0.0.44 1 180 60 - switch2 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch2 + sonic 10.0.0.46 1 180 60 - switch2 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch2 + sonic 10.0.0.48 1 180 60 - switch2 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch2 + sonic 10.0.0.50 1 180 60 - switch2 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch2 + sonic 10.0.0.52 1 180 60 - switch2 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch2 + sonic 10.0.0.54 1 180 60 - switch2 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch2 + sonic 10.0.0.56 1 180 60 - switch2 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch2 + sonic 10.0.0.58 1 180 60 - switch2 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch2 + sonic 10.0.0.60 1 180 60 - switch2 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch2 + sonic 10.0.0.62 1 180 60 - switch2 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch2 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch2 + sonic @@ -934,224 +934,224 @@ DeviceInterfaceLink - switch2 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1159,7 +1159,7 @@ - switch2 + sonic ACS-MSN2410 @@ -1167,7 +1167,7 @@ - switch2 + sonic DhcpResources @@ -1194,6 +1194,6 @@ - switch2 + sonic ACS-MSN2410 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py new file mode 100644 index 000000000000..301569c13a94 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json new file mode 100644 index 000000000000..3e01af3f2c64 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json @@ -0,0 +1,166 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700 new file mode 120000 index 000000000000..9f12504c7c5a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700 @@ -0,0 +1 @@ +ACS-MSN2700 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml index 50f49f63878a..19ea4a9670bf 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch2 + sonic 10.0.0.32 1 180 60 - switch2 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch2 + sonic 10.0.0.34 1 180 60 - switch2 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch2 + sonic 10.0.0.36 1 180 60 - switch2 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch2 + sonic 10.0.0.38 1 180 60 - switch2 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch2 + sonic 10.0.0.40 1 180 60 - switch2 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch2 + sonic 10.0.0.42 1 180 60 - switch2 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch2 + sonic 10.0.0.44 1 180 60 - switch2 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch2 + sonic 10.0.0.46 1 180 60 - switch2 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch2 + sonic 10.0.0.48 1 180 60 - switch2 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch2 + sonic 10.0.0.50 1 180 60 - switch2 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch2 + sonic 10.0.0.52 1 180 60 - switch2 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch2 + sonic 10.0.0.54 1 180 60 - switch2 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch2 + sonic 10.0.0.56 1 180 60 - switch2 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch2 + sonic 10.0.0.58 1 180 60 - switch2 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch2 + sonic 10.0.0.60 1 180 60 - switch2 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch2 + sonic 10.0.0.62 1 180 60 - switch2 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch2 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch2 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch2 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch2 + sonic ACS-MSN2700 @@ -1047,7 +1047,7 @@ - switch2 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch2 + sonic ACS-MSN2700 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py new file mode 100644 index 000000000000..301569c13a94 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json new file mode 120000 index 000000000000..ae738e606a9d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml index 81deffca3ae3..f25aa94384e5 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch2 + sonic 10.0.0.32 1 180 60 - switch2 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch2 + sonic 10.0.0.34 1 180 60 - switch2 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch2 + sonic 10.0.0.36 1 180 60 - switch2 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch2 + sonic 10.0.0.38 1 180 60 - switch2 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch2 + sonic 10.0.0.40 1 180 60 - switch2 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch2 + sonic 10.0.0.42 1 180 60 - switch2 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch2 + sonic 10.0.0.44 1 180 60 - switch2 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch2 + sonic 10.0.0.46 1 180 60 - switch2 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch2 + sonic 10.0.0.48 1 180 60 - switch2 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch2 + sonic 10.0.0.50 1 180 60 - switch2 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch2 + sonic 10.0.0.52 1 180 60 - switch2 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch2 + sonic 10.0.0.54 1 180 60 - switch2 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch2 + sonic 10.0.0.56 1 180 60 - switch2 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch2 + sonic 10.0.0.58 1 180 60 - switch2 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch2 + sonic 10.0.0.60 1 180 60 - switch2 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch2 + sonic 10.0.0.62 1 180 60 - switch2 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch2 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch2 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch2 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch2 + sonic ACS-MSN2740 ` @@ -1047,7 +1047,7 @@ - switch2 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch2 + sonic ACS-MSN2740 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py new file mode 100644 index 000000000000..301569c13a94 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 19fd412b0387..7fb3401184f2 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -33,6 +33,6 @@ RUN sed -ri 's/^(save .*$)/# \1/g; ' /etc/redis/redis.conf COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["configdb-load.sh", "/usr/bin/"] +COPY ["files/configdb-load.sh", "/usr/bin/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-database/supervisord.conf b/dockers/docker-database/supervisord.conf index 9ad7ff32bcf9..8237ea876790 100644 --- a/dockers/docker-database/supervisord.conf +++ b/dockers/docker-database/supervisord.conf @@ -24,5 +24,6 @@ command=/usr/bin/configdb-load.sh priority=3 autostart=true autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index b53d7e4e238a..2ee80c4e3388 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -6,7 +6,12 @@ rm -f /var/run/rsyslogd.pid # Start rsyslog supervisorctl start rsyslogd -# Wait for all interfaces to come up before starting the DHCP relay agent(s) +# Wait for all interfaces to come up and be assigned IPv4 addresses before +# starting the DHCP relay agent(s). If an interface the relay should listen +# on is down, the relay agent will not start. If an interface the relay should +# listen on is up but does not have an IP address assigned when the relay +# agent starts, it will not listen or send on that interface for the lifetime +# of the process. /usr/bin/wait_for_intf.sh # Start the DHCP relay agent(s) diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 index 1524b3221312..037dc66ead63 100644 --- a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -1,27 +1,42 @@ #!/usr/bin/env bash -function wait_until_iface_exists +function wait_until_iface_ready { IFACE=$1 - echo "Waiting for interface ${IFACE}..." + echo "Waiting until interface $IFACE is up..." # Wait for the interface to come up (i.e., 'ip link show' returns 0) - until ip link show $IFACE > /dev/null 2>&1; do + until ip link show dev $IFACE up > /dev/null 2>&1; do sleep 1 done - echo "Interface ${IFACE} is created" + echo "Interface $IFACE is up" + + echo "Waiting until interface $IFACE has an IPv4 address..." + + # Wait until the interface gets assigned an IPv4 address + while true; do + IP=$(ip -4 addr show dev $IFACE | grep "inet " | awk '{ print $2 }' | cut -d '/' -f1) + + if [ -n "$IP" ]; then + break + fi + + sleep 1 + done + + echo "Interface $IFACE is configured with IP $IP" } -# Wait for all interfaces to come up before starting the DHCP relay +# Wait for all interfaces to come up and have IPv4 addresses assigned {% for (name, prefix) in INTERFACE %} -wait_until_iface_exists {{ name }} +wait_until_iface_ready {{ name }} {% endfor %} {% for (name, prefix) in VLAN_INTERFACE %} -wait_until_iface_exists {{ name }} +wait_until_iface_ready {{ name }} {% endfor %} {% for (name, prefix) in PORTCHANNEL_INTERFACE %} -wait_until_iface_exists {{ name }} +wait_until_iface_ready {{ name }} {% endfor %} diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index 07e2dd0c571e..9afd6a5a8bf0 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -23,8 +23,13 @@ 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 {{ LOOPBACK_INTERFACE.keys()[0][1] }} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 and name == 'Loopback0' %} + bgp router-id {{ prefix | ip }} +{% endif %} +{% endfor %} {# advertise loopback #} + {% for (name, prefix) in LOOPBACK_INTERFACE %} {% if prefix | ipv4 %} network {{ prefix | ip }}/32 diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index 1e7a49809d55..06fdd3bb3961 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash mkdir -p /etc/quagga -sonic-cfggen -m -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf +sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf -sonic-cfggen -m -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf +sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf -sonic-cfggen -m -d -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 -d -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-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index eb7202df7c67..165ded79f392 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,3 +1,4 @@ +configure ports eth0 lldp portidsubtype local {{ MGMT_INTERFACE.keys()[0][0] }} {% 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-orchagent-nephos b/dockers/docker-orchagent-nephos new file mode 120000 index 000000000000..8d52609c56e5 --- /dev/null +++ b/dockers/docker-orchagent-nephos @@ -0,0 +1 @@ +docker-orchagent \ No newline at end of file diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 9fba8d17b9d6..3d6671996358 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -26,7 +26,8 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] +COPY ["files/arp_update", "/usr/bin"] +COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] ## Copy all Jinja2 template files into the templates folder diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 deleted file mode 100644 index ce1ddedbba37..000000000000 --- a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 +++ /dev/null @@ -1,287 +0,0 @@ -[ -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') %} - { - "BUFFER_POOL_TABLE:ingress_lossy_pool": { - "size": "6422528", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossless_pool": { - "size": "7291456", - "type": "egress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossy_pool": { - "size": "8254464", - "type": "egress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", - "size":"0", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"1518", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", - "size":"4096", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:pg_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", - "size":"0", - "dynamic_th":"1" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_INGRESS_PROFILE_LIST:{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_EGRESS_PROFILE_LIST:{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" - }, - "OP": "SET" - }, - -{# The following template part is for variable PG profile configuration #} -{% set non_pg_lossless_pool_size = 866726 %} -{% set pg_range = '3-4' %} -{# Lists of supported speed and cable length #} -{% set supported_speed = [10000, 25000, 40000, 50000, 100000] %} -{% set supported_cable = [5, 40, 300] %} - -{# The key in this lictionary consist of two parts: (port speed)_(cable length) #} -{%- set portconfig2profile = { - '10000_5' : 'pg_lossless_10G_5m_profile', - '25000_5' : 'pg_lossless_25G_5m_profile', - '40000_5' : 'pg_lossless_40G_5m_profile', - '50000_5' : 'pg_lossless_50G_5m_profile', - '100000_5' : 'pg_lossless_100G_5m_profile', - - '10000_40' : 'pg_lossless_10G_40m_profile', - '25000_40' : 'pg_lossless_25G_40m_profile', - '40000_40' : 'pg_lossless_40G_40m_profile', - '50000_40' : 'pg_lossless_50G_40m_profile', - '100000_40' : 'pg_lossless_100G_40m_profile', - - '10000_300' : 'pg_lossless_10G_300m_profile', - '25000_300' : 'pg_lossless_25G_300m_profile', - '40000_300' : 'pg_lossless_40G_300m_profile', - '50000_300' : 'pg_lossless_50G_300m_profile', - '100000_300': 'pg_lossless_100G_300m_profile' - } --%} - -{# PG profiles. All profiles reffered in portconfig2profile dictionary should be declared here #} -{# Only those which were actually used will be created in SAI #} -{%- set pg_profiles = { - 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 }, - - 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 }, - 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 1 }, - 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 }, - 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 }, - 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 1 }, - - 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 1 }, - 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 1 }, - 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 }, - 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 }, - 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 1 }, - } --%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'ToRRouter_Server' : '5', - 'LeafRouter_ToRRouter' : '40', - 'SpineRouter_LeafRouter' : '300' - } -%} - -{% set switch_role = DEVICE_METADATA['localhost']['type'] %} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {% endif %} - {% endif %} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ supported_cable | last }} - {%- endif -%} -{% endmacro %} - -{%- macro find_closest_greater_config(speed, cable) -%} -{%- set new_speed = [] -%} -{%- for std_speed in supported_speed -%} - {%- if std_speed | int >= speed | int -%} - {%- if new_speed.append(std_speed) -%}{%- endif -%} - {% endif -%} -{%- endfor -%} -{%- set new_cable = [] -%} -{%- for std_cable in supported_cable -%} - {% if std_cable | int >= cable | int -%} - {%- if new_cable.append(std_cable) -%}{%- endif -%} - {% endif %} -{%- endfor -%} -{{ new_speed.0 }}_{{ new_cable.0 }} -{%- endmacro -%} - -{% set ingress_lossless_pg_pool_size = [] %} -{% set used_pg_profiles = [] %} -{% for port in PORT %} - {%- if PORT[port].speed -%} - {%- set speed = PORT[port]['speed'] -%} - {% else %} - {%- set speed = supported_speed|last -%} - {%- endif -%} - {%- set cable = cable_length(port) -%} - {%- set port_config = speed|string + '_' + cable -%} - {%- if not port_config in portconfig2profile -%} - {% set port_config = find_closest_greater_config(speed, cable) -%} - {%- endif -%} - {% set profile = portconfig2profile[port_config] -%} - {% if ingress_lossless_pg_pool_size.append(pg_profiles[profile]['size']) %}{% endif %} - {# add to list profiles which were actually used #} - {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif -%} - { - "BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": { - "profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]" - }, - "OP": "SET" - }, -{% endfor -%} - -{# PG profiles declaration #} - -{% for profile_name in used_pg_profiles %} - {%- set profile_config = pg_profiles[profile_name] %} - { - "BUFFER_PROFILE_TABLE:{{ profile_name }}": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "xon":"{{ profile_config['xon'] }}", - "xoff":"{{ profile_config['xoff'] }}", - "size":"{{ profile_config['size'] }}", - "dynamic_th":"{{ profile_config['dynamic_th'] }}" - }, - "OP": "SET" - }, -{% endfor -%} - - {# Lossless pool declaration #} - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "{{ ingress_lossless_pg_pool_size | sum + non_pg_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:{{ port_names }}:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" - }, - "OP": "SET" - }, - { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "PORT_QOS_MAP_TABLE:{{ port_names }}": { - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" - }, - "OP": "SET" - } -] diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index f92dfe5fd543..027c6d52a2fe 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -18,6 +18,8 @@ if [ "$platform" == "broadcom" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$platform" == "cavium" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$platform" == "nephos" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index 48be831025f8..b10d4d58a43d 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -1,15 +1,20 @@ [ +{% set ports_with_speed_set=[] %} {% if PORT %} {% for port in PORT %} {% if PORT[port].has_key('speed') %} + {%- if ports_with_speed_set.append(port) -%}{%- endif -%} +{%- endif -%} +{% endfor %} +{% for port in ports_with_speed_set %} { "PORT_TABLE:{{ port }}": { - "speed": "{{ PORT[port]['speed'] }}" + "speed": "{{ PORT[port]['speed'] }}", + "description": "{{ PORT[port]['description'] }}" }, "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 9f3ba3cb078d..80ccac913ff2 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -2,9 +2,9 @@ mkdir -p /etc/swss/config.d/ -sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.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/ports.json.j2 > /etc/swss/config.d/ports.json +sonic-cfggen -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.json +sonic-cfggen -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json +sonic-cfggen -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json export platform=`sonic-cfggen -v platform` @@ -26,6 +26,8 @@ supervisorctl start vlanmgrd supervisorctl start intfmgrd +supervisorctl start buffermgrd + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 95e92be622bb..84beaed440a3 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -83,3 +83,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:buffermgrd] +command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 3458ddae61e6..6dd3486ee3b6 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -25,7 +25,7 @@ function fast_reboot { # Restore FDB and ARP table ASAP fast_reboot -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"` +HWSKU=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['hwsku']"` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json ports.json switch.json " @@ -33,11 +33,10 @@ if [ "$HWSKU" == "Force10-S6000" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +elif [ "$HWSKU" == "Force10-S6100" ]; then + SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.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 msn27xx.32ports.qos.json " fi for file in $SWSSCONFIG_ARGS; do diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index b6406b3e3a6a..4dd8acaf0e26 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -9,44 +9,30 @@ RUN apt-get update # Install required packages RUN apt-get install -y python-pip sensord fancontrol -{% if docker_platform_monitor_debs.strip() %} -# Copy built Debian packages -COPY \ -{% for deb in docker_platform_monitor_debs.split(' ') -%} +{% if docker_platform_monitor_debs.strip() -%} +# Copy all locally-built Debian package dependencies +COPY{{' '}} +{%- for deb in docker_platform_monitor_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} -debs/ -{%- endif %} +/debs/ -{% if docker_platform_monitor_debs.strip() %} -# Install built Debian packages -RUN dpkg -i \ -{% for deb in docker_platform_monitor_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} -{%- endif %} +# Install all locally-built Debian package dependencies +# and implicitly install their dependencies +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/*.deb +{% endif %} -{% if docker_platform_monitor_whls.strip() %} -# Copy built Python wheels -COPY \ -{% for whl in docker_platform_monitor_whls.split(' ') -%} +{% if docker_platform_monitor_whls.strip() -%} +# Copy all locally-built Python wheel dependencies +COPY{{' '}} +{%- for whl in docker_platform_monitor_whls.split(' ') -%} python-wheels/{{ whl }}{{' '}} {%- endfor -%} -python-wheels/ -{%- endif %} - -{% if docker_platform_monitor_whls.strip() %} -# Install built Python wheels -RUN pip install \ -{% for whl in docker_platform_monitor_whls.split(' ') -%} -python-wheels/{{ whl }}{{' '}} -{%- endfor %} -{%- endif %} - -COPY python-wheels /python-wheels +/python-wheels/ -# Install Python SwSS SDK (dependency of sonic-ledd) -RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl +# Install all locally-built Python wheel dependencies +RUN pip install /python-wheels/*.whl +{% endif %} # Clean up RUN apt-get remove -y python-pip diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 01312687b93c..2d9b1544d95a 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -100,6 +100,10 @@ RUN mkdir /var/run/sshd \ COPY ["supervisord.conf", "/etc/supervisor/"] COPY ["conf.d/supervisord.conf", "conf.d/sshd.conf", "conf.d/ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] +# Move tcpdump into /usr/bin Otherwise it's impossible to run tcpdump due to a docker bug +RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump +RUN ln -s /usr/bin/tcpdump /usr/sbin/tcpdump + RUN mkdir -p /var/log/supervisor EXPOSE 22 diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 new file mode 100644 index 000000000000..5007daf122cf --- /dev/null +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -0,0 +1,32 @@ +FROM docker-config-engine + +# Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Update apt's cache of available packages +RUN apt-get update + +# Install radvd Debian package +RUN apt-get -y install radvd + +{% if docker_router_advertiser_debs.strip() -%} +# Copy built Debian packages +{%- for deb in docker_router_advertiser_debs.split(' ') %} +COPY debs/{{ deb }} debs/ +{%- endfor %} + +# Install built Debian packages and implicitly install their dependencies +{%- for deb in docker_router_advertiser_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }} +{%- endfor %} +{%- endif %} + +# Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +COPY ["start.sh", "/usr/bin/"] +COPY ["docker-router-advertiser.supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["radvd.conf.j2", "/usr/share/sonic/templates/"] + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf new file mode 100644 index 000000000000..08a3e0a94872 --- /dev/null +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:radvd] +command=/usr/sbin/radvd -n +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/dockers/docker-router-advertiser/radvd.conf.j2 b/dockers/docker-router-advertiser/radvd.conf.j2 new file mode 100644 index 000000000000..940c26fd6588 --- /dev/null +++ b/dockers/docker-router-advertiser/radvd.conf.j2 @@ -0,0 +1,37 @@ +{% block banner %} +# =========== Managed by sonic-cfggen -- DO NOT edit manually! ==================== +# Generated by /usr/share/sonic/templates/radvd.conf.j2 using config DB data +# File: /etc/radvd.conf +# +{% endblock banner %} +# Config file for radvd, the router advertisement daemon +# See man page for radvd.conf for descriptions of all available options +# + +{# If our configuration has VLAN interfaces... #} +{% if VLAN_INTERFACE %} +{% for (name, prefix) in VLAN_INTERFACE %} +{# If this VLAN has an IPv6 address... #} +{% if prefix | ipv6 %} +interface {{ name }} +{ + IgnoreIfMissing on; + AdvSendAdvert on; + MinRtrAdvInterval 200; + MaxRtrAdvInterval 600; + AdvManagedFlag on; + AdvOtherConfigFlag off; + AdvLinkMTU 9100; + AdvHomeAgentFlag off; + prefix {{ prefix | network }}/{{ prefix | prefixlen }} { + AdvOnLink on; + AdvAutonomous off; + AdvRouterAddr off; + AdvValidLifetime infinity; + AdvPreferredLifetime infinity; + }; +}; + +{% endif %} +{% endfor %} +{% endif %} diff --git a/dockers/docker-router-advertiser/start.sh b/dockers/docker-router-advertiser/start.sh new file mode 100755 index 000000000000..cbd5ec383bd6 --- /dev/null +++ b/dockers/docker-router-advertiser/start.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Generate /etc/radvd.conf config file +sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +# Start the router advertiser +supervisorctl start radvd diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 2ab867031874..0e83b230746a 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -7,6 +7,7 @@ COPY [ \ "/debs/"] # Install Python SwSSSDK (SNMP subagent dependency) +COPY python-wheels/sonic_platform_common-*-py3-*.whl /python-wheels/ COPY python-wheels/swsssdk-*-py3-*.whl /python-wheels/ COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 6cfe28603894..be2f1b6518b5 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -18,7 +18,9 @@ RUN apt-get install -y \ sshpass \ libxml2 \ libxslt1-dev \ - python-setuptools + python-setuptools \ + build-essential \ + curl # For JNLP launcher RUN apt-get install -y default-jre @@ -87,4 +89,10 @@ RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers USER $user -RUN cd /var/$user && git clone https://github.com/Azure/sonic-mgmt +# Install Azure CLI +WORKDIR /var/$user +RUN curl -L https://aka.ms/InstallAzureCliBundled -o azure-cli_bundle.tar.gz +RUN tar -xvzf azure-cli_bundle.tar.gz +RUN azure-cli_bundle_*/installer + +RUN git clone https://github.com/Azure/sonic-mgmt diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index d9ea1b790f89..9f53534a808b 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -4,8 +4,12 @@ "runner": { "name": "lacp", "active": true, +{% if PORTCHANNEL[pc]['fallback'] and ((PORTCHANNEL[pc]['members'] | length) == 1) %} + "fallback": {{ PORTCHANNEL[pc]['fallback'] }}, +{% else %} {# Use 75% links upperbound as min-links #} "min_ports": {{ (PORTCHANNEL[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }}, +{% endif %} "tx_hash": ["eth", "ipv4", "ipv6"] }, "link_watch": { diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 8ea085bf5e8d..a2c683b20c91 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -110,30 +110,37 @@ platform_specific() { # set varlog size to 100MB local varlog_size=100 - # This is temporary as the platform= and sid= parameters don't provide enough - # information to identify the SKU - # An initramfs hook or a later processing done by the initscripts will be - # required to read the system eeprom + local flash_size=$(($(df | grep flash | tr -s ' ' | cut -f2 -d' ') / 1000)) + if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 + flash_size=2000 echo "modprobe.blacklist=radeon" >>/tmp/append fi if [ "$platform" = "crow" ]; then aboot_machine=arista_7050_qx32s + flash_size=3700 echo "modprobe.blacklist=radeon" >>/tmp/append fi if [ "$sid" = "Upperlake" ] || [ "$sid" = "UpperlakeES" ]; then aboot_machine=arista_7060_cx32s + flash_size=3700 echo "amd_iommu=off" >> /tmp/append fi if [ "$sid" = "Gardena" ] || [ "$sid" = "GardenaSsd" ]; then aboot_machine=arista_7260cx3_64 + flash_size=28000 fi if [ "$platform" = "rook" ]; then - varlog_size=200 readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl fi + if [ $flash_size -ge 28000 ]; then + varlog_size=4096 + elif [ $flash_size -ge 3700 ]; then + varlog_size=400 + fi + echo "varlog_size=$varlog_size" >>/tmp/append } diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index c1499c8f8797..ff43a3c2d024 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -1,6 +1,6 @@ [Unit] Description=DHCP relay container -Requires=docker.service +Requires=docker.service teamd.service After=swss.service [Service] diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index a7aee83c70e6..240a7514d65b 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -10,13 +10,13 @@ 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 + until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do + sleep 1; done {%- endif %} +{%- if docker_container_name == "snmp" %} + docker exec -i database redis-cli -n 6 HSET 'DEVICE_METADATA|localhost' chassis_serial_number $(decode-syseeprom -s) +{%- endif %} } # Obtain our platform as we will mount directories with these names in each docker @@ -60,6 +60,8 @@ start() { {%- if docker_container_name != "database" %} -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ {%- endif %} + --tmpfs /tmp \ + --tmpfs /var/tmp \ --name={{docker_container_name}} {{docker_image_name}}:latest postStartAction diff --git a/files/build_templates/router_advertiser.service.j2 b/files/build_templates/router_advertiser.service.j2 new file mode 100644 index 000000000000..12bdb371369d --- /dev/null +++ b/files/build_templates/router_advertiser.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=Router advertiser container +Requires=docker.service +After=swss.service + +[Service] +User={{ sonicadmin_user }} +ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start +ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStop=/usr/bin/{{ docker_container_name }}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index 08c41a52a5f7..0c1558ad64aa 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -4,7 +4,6 @@ Requires=database.service swss.service After=database.service swss.service [Service] -User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStart=/usr/bin/{{docker_container_name}}.sh attach ExecStop=/usr/bin/{{docker_container_name}}.sh stop diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 37fcfbc56fcb..a2bea7a6baa6 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -64,19 +64,25 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in # Install SONiC config engine Python package CONFIG_ENGINE_WHEEL_NAME=$(basename {{config_engine_wheel_path}}) sudo cp {{config_engine_wheel_path}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME -sudo LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHEEL_NAME +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME # Install Python client for Redis -sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis -sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis-dump-load +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install redis +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install redis-dump-load # Install SwSS SDK Python 2 package SWSSSDK_PY2_WHEEL_NAME=$(basename {{swsssdk_py2_wheel_path}}) sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME -sudo LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME +# Install sonic-platform-common Python 2 package +PLATFORM_COMMON_PY2_WHEEL_NAME=$(basename {{platform_common_py2_wheel_path}}) +sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $PLATFORM_COMMON_PY2_WHEEL_NAME +sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME + # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f @@ -89,6 +95,14 @@ sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-device-data_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install pam-tacplus and nss-tacplus +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libtac2_*.deb +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libpam-tacplus_*.deb +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libnss-tacplus_*.deb +# Disable tacplus by default +sudo LANG=C chroot $FILESYSTEM_ROOT pam-auth-update --remove tacplus +sudo sed -i -e '/^passwd/s/ tacplus//' $FILESYSTEM_ROOT/etc/nsswitch.conf + # Copy crontabs sudo cp -f $IMAGE_CONFIGS/cron.d/* $FILESYSTEM_ROOT/etc/cron.d/ @@ -120,6 +134,17 @@ sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/usr/share/sonic/template # Copy initial interfaces configuration file, will be overwritten on first boot sudo cp $IMAGE_CONFIGS/interfaces/init_interfaces $FILESYSTEM_ROOT/etc/network +# Copy hostcfgd files +sudo cp $IMAGE_CONFIGS/hostcfgd/hostcfgd.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostcfgd.service +sudo cp $IMAGE_CONFIGS/hostcfgd/hostcfgd $FILESYSTEM_ROOT/usr/bin/ +sudo cp $IMAGE_CONFIGS/hostcfgd/*.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/ + +# Copy hostname configuration scripts +sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service +sudo cp $IMAGE_CONFIGS/hostname/hostname-config.sh $FILESYSTEM_ROOT/usr/bin/ + # Copy updategraph script and service file sudo cp $IMAGE_CONFIGS/updategraph/updategraph.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable updategraph.service @@ -143,6 +168,12 @@ sudo cp $IMAGE_CONFIGS/asn/deployment_id_asn_map.yml $FILESYSTEM_ROOT/etc/sonic/ # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ +# Copy control plane ACL management daemon files +sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable caclmgrd.service +sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd-start.sh $FILESYSTEM_ROOT/usr/bin/ +sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd $FILESYSTEM_ROOT/usr/bin/ + ## Install package without starting service ## ref: https://wiki.debian.org/chroot sudo tee -a $FILESYSTEM_ROOT/usr/sbin/policy-rc.d > /dev/null < 0: + rule_cmd += " --tcp-flags " + + if tcp_flags & 0x01: + rule_cmd += "FIN," + if tcp_flags & 0x02: + rule_cmd += "SYN," + if tcp_flags & 0x04: + rule_cmd += "RST," + if tcp_flags & 0x08: + rule_cmd += "PSH," + if tcp_flags & 0x10: + rule_cmd += "ACK," + if tcp_flags & 0x20: + rule_cmd += "URG," + if tcp_flags & 0x40: + rule_cmd += "ECE," + if tcp_flags & 0x80: + rule_cmd += "CWR," + + # Delete the trailing comma + rule_cmd = rule_cmd[:-1] + + # Append the packet action as the jump target + rule_cmd += " -j {}".format(rule_props["PACKET_ACTION"]) + + iptables_cmds.append(rule_cmd) + + return iptables_cmds + + def update_control_plane_acls(self): + """ + Convenience wrapper which retrieves current ACL tables and rules from + Config DB, translates control plane ACLs into a list of iptables + commands and runs them. + """ + iptables_cmds = self.get_acl_rules_and_translate_to_iptables_commands() + + log_info("Issuing the following iptables commands:") + for cmd in iptables_cmds: + log_info(" " + cmd) + + self.run_commands(iptables_cmds) + + def notification_handler(self, key, data): + log_info("ACL configuration changed. Updating iptables rules for control plane ACLs...") + self.update_control_plane_acls() + + def run(self): + # Unconditionally update control plane ACLs once at start + self.update_control_plane_acls() + + # Subscribe to notifications when ACL tables or rules change + self.config_db.subscribe(self.ACL_TABLE, + lambda table, key, data: self.notification_handler(key, data)) + self.config_db.subscribe(self.ACL_RULE, + lambda table, key, data: self.notification_handler(key, data)) + + # Indefinitely listen for Config DB notifications + self.config_db.listen() + + +# ============================= Functions ============================= + +def main(): + log_info("Starting up...") + + if not os.geteuid() == 0: + log_error("Must be root to run this daemon") + print "Error: Must be root to run this daemon" + sys.exit(1) + + # Instantiate a ControlPlaneAclManager object + caclmgr = ControlPlaneAclManager() + caclmgr.run() + + +if __name__ == "__main__": + main() diff --git a/files/image_config/caclmgrd/caclmgrd-start.sh b/files/image_config/caclmgrd/caclmgrd-start.sh new file mode 100755 index 000000000000..3c7a2afbdf8b --- /dev/null +++ b/files/image_config/caclmgrd/caclmgrd-start.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Only start control plance ACL manager daemon if not an Arista platform. +# Arista devices will use their own service ACL manager daemon(s) instead. +if [ "$(sonic-cfggen -v "platform" | grep -c "arista")" -gt 0 ]; then + echo "Not starting caclmgrd - unsupported platform" + exit 0 +fi + +exec /usr/bin/caclmgrd diff --git a/files/image_config/caclmgrd/caclmgrd.service b/files/image_config/caclmgrd/caclmgrd.service new file mode 100644 index 000000000000..8e6cbb0c8e64 --- /dev/null +++ b/files/image_config/caclmgrd/caclmgrd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Control Plane ACL configuration daemon +Requires=database.service +After=database.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/caclmgrd-start.sh + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/hostcfgd/common-auth-sonic.j2 b/files/image_config/hostcfgd/common-auth-sonic.j2 new file mode 100644 index 000000000000..d91a02120f82 --- /dev/null +++ b/files/image_config/hostcfgd/common-auth-sonic.j2 @@ -0,0 +1,43 @@ +# THIS IS AN AUTO-GENERATED FILE +# +# /etc/pam.d/common-auth- authentication settings common to all services +# This file is included from other service-specific PAM config files, +# and should contain a list of the authentication modules that define +# the central authentication scheme for use on the system +# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the +# traditional Unix authentication mechanisms. +# +# here are the per-package modules (the "Primary" block) + +{% if auth['login'] == 'local' %} +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +{% elif auth['login'] == 'local,tacacs+' %} +auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_unix.so nullok try_first_pass +{% for server in servers | sub(0, -1) %} +auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_tacplus.so server={{ server.ip }}:{{ server.tcp_port }} secret={{ server.passkey }} login={{ server.auth_type }} timeout={{ server.timeout }} try_first_pass +{% endfor %} +{% if servers | count %} +{% set last_server = servers | last %} +auth [success=1 default=ignore] pam_tacplus.so server={{ last_server.ip }}:{{ last_server.tcp_port }} secret={{ last_server.passkey }} login={{ last_server.auth_type }} timeout={{ last_server.timeout }} try_first_pass + +{% endif %} +{% elif auth['login'] == 'tacacs+' or auth['login'] == 'tacacs+,local' %} +{% for server in servers %} +auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_tacplus.so server={{ server.ip }}:{{ server.tcp_port }} secret={{ server.passkey }} login={{ server.auth_type }} timeout={{ server.timeout }} try_first_pass +{% endfor %} +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +{% else %} +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +{% endif %} +# +# here's the fallback if no module succeeds +auth requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +auth required pam_permit.so +# and here are more per-package modules (the "Additional" block) + diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd new file mode 100755 index 000000000000..837c5351e0eb --- /dev/null +++ b/files/image_config/hostcfgd/hostcfgd @@ -0,0 +1,172 @@ +#!/usr/bin/python -u +# -*- coding: utf-8 -*- + +import os +import sys +import subprocess +import syslog +import jinja2 +from swsssdk import ConfigDBConnector + +# FILE +PAM_AUTH_CONF = "/etc/pam.d/common-auth-sonic" +PAM_AUTH_CONF_TEMPLATE = "/usr/share/sonic/templates/common-auth-sonic.j2" +NSS_TACPLUS_CONF = "/etc/tacplus_nss.conf" +NSS_TACPLUS_CONF_TEMPLATE = "/usr/share/sonic/templates/tacplus_nss.conf.j2" +NSS_CONF = "/etc/nsswitch.conf" + +# TACACS+ +TACPLUS_SERVER_PASSKEY_DEFAULT = "" +TACPLUS_SERVER_TIMEOUT_DEFAULT = "5" +TACPLUS_SERVER_AUTH_TYPE_DEFAULT = "pap" + + +def is_true(val): + if val == 'True' or val == 'true': + return True + else: + return False + + +def sub(l, start, end): + return l[start:end] + + +class AaaCfg(object): + def __init__(self): + self.auth_default = { + 'login': 'local', + 'failthrough': True, + 'fallback': True + } + self.tacplus_global_default = { + 'auth_type': TACPLUS_SERVER_AUTH_TYPE_DEFAULT, + 'timeout': TACPLUS_SERVER_TIMEOUT_DEFAULT, + 'passkey': TACPLUS_SERVER_PASSKEY_DEFAULT + } + self.auth = {} + self.tacplus_global = {} + self.tacplus_servers = {} + self.debug = False + + # Load conf from ConfigDb + def load(self, aaa_conf, tac_global_conf, tacplus_conf): + for row in aaa_conf: + self.aaa_update(row, aaa_conf[row], modify_conf=False) + for row in tac_global_conf: + self.tacacs_global_update(row, tac_global_conf[row], modify_conf=False) + for row in tacplus_conf: + self.tacacs_server_update(row, tacplus_conf[row], modify_conf=False) + self.modify_conf_file() + + def aaa_update(self, key, data, modify_conf=True): + if key == 'authentication': + self.auth = data + if 'failthrough' in data: + self.auth['failthrough'] = is_true(data['failthrough']) + if 'debug' in data: + self.debug = is_true(data['debug']) + if modify_conf: + self.modify_conf_file() + + def tacacs_global_update(self, key, data, modify_conf=True): + if key == 'global': + self.tacplus_global = data + if modify_conf: + self.modify_conf_file() + + def tacacs_server_update(self, key, data, modify_conf=True): + if data == {}: + if key in self.tacplus_servers: + del self.tacplus_servers[key] + else: + self.tacplus_servers[key] = data + + if modify_conf: + self.modify_conf_file() + + def modify_conf_file(self): + auth = self.auth_default.copy() + auth.update(self.auth) + tacplus_global = self.tacplus_global_default.copy() + tacplus_global.update(self.tacplus_global) + + servers_conf = [] + if self.tacplus_servers: + for addr in self.tacplus_servers: + server = tacplus_global.copy() + server['ip'] = addr + server.update(self.tacplus_servers[addr]) + servers_conf.append(server) + sorted(servers_conf, key=lambda t: t['priority'], reverse=True) + + template_file = os.path.abspath(PAM_AUTH_CONF_TEMPLATE) + env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) + env.filters['sub'] = sub + template = env.get_template(template_file) + pam_conf = template.render(auth=auth, servers=servers_conf) + with open(PAM_AUTH_CONF, 'w') as f: + f.write(pam_conf) + + # Modify common-auth include file in /etc/pam.d/login and sshd + if os.path.isfile(PAM_AUTH_CONF): + os.system("sed -i -e '/^@include/s/common-auth$/common-auth-sonic/' /etc/pam.d/sshd") + os.system("sed -i -e '/^@include/s/common-auth$/common-auth-sonic/' /etc/pam.d/login") + else: + os.system("sed -i -e '/^@include/s/common-auth-sonic$/common-auth/' /etc/pam.d/sshd") + os.system("sed -i -e '/^@include/s/common-auth-sonic$/common-auth/' /etc/pam.d/login") + + # Add tacplus in nsswitch.conf if TACACS+ enable + if 'tacacs+' in auth['login']: + if os.path.isfile(NSS_CONF): + os.system("sed -i -e '/tacplus/b' -e '/^passwd/s/compat/& tacplus/' /etc/nsswitch.conf") + else: + if os.path.isfile(NSS_CONF): + os.system("sed -i -e '/^passwd/s/ tacplus//' /etc/nsswitch.conf") + + # Set tacacs+ server in nss-tacplus conf + template_file = os.path.abspath(NSS_TACPLUS_CONF_TEMPLATE) + template = env.get_template(template_file) + nss_tacplus_conf = template.render(debug=self.debug, servers=servers_conf) + with open(NSS_TACPLUS_CONF, 'w') as f: + f.write(nss_tacplus_conf) + + +class HostConfigDaemon: + def __init__(self): + self.config_db = ConfigDBConnector() + self.config_db.connect(wait_for_init=True, retry_on=True) + syslog.syslog(syslog.LOG_INFO, 'ConfigDB connect success') + aaa = self.config_db.get_table('AAA') + tacacs_global = self.config_db.get_table('TACPLUS') + tacacs_server = self.config_db.get_table('TACPLUS_SERVER') + self.aaacfg = AaaCfg() + self.aaacfg.load(aaa, tacacs_global, tacacs_server) + + def aaa_handler(self, key, data): + syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + self.aaacfg.aaa_update(key, data) + + def tacacs_server_handler(self, key, data): + syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + self.aaacfg.tacacs_server_update(key, data) + + def tacacs_global_handler(self, key, data): + syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + self.aaacfg.tacacs_global_update(key, data) + + def start(self): + self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) + self.config_db.subscribe('TACPLUS_SERVER', lambda table, key, data: self.tacacs_server_handler(key, data)) + self.config_db.subscribe('TACPLUS', lambda table, key, data: self.tacacs_global_handler(key, data)) + self.config_db.listen() + + +def main(): + daemon = HostConfigDaemon() + daemon.start() + + +if __name__ == "__main__": + main() + diff --git a/files/image_config/hostcfgd/hostcfgd.service b/files/image_config/hostcfgd/hostcfgd.service new file mode 100644 index 000000000000..4f6151a471fe --- /dev/null +++ b/files/image_config/hostcfgd/hostcfgd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Host config enforcer daemon +Requires=database.service +After=database.service + +[Service] +Type=simple +ExecStart=/usr/bin/hostcfgd + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/hostcfgd/tacplus_nss.conf.j2 b/files/image_config/hostcfgd/tacplus_nss.conf.j2 new file mode 100644 index 000000000000..61ab905ecb84 --- /dev/null +++ b/files/image_config/hostcfgd/tacplus_nss.conf.j2 @@ -0,0 +1,25 @@ +onfiguration for libnss-tacplus + +# debug - If you want to open debug log, set it on +# Default: off +# debug=on +{% if debug %} +debug=on +{% endif %} + +# server - set ip address, tcp port, secret string and timeout for TACACS+ servers +# Default: None (no TACACS+ server) +# server=1.1.1.1:49,secret=test,timeout=3 +{% for server in servers %} +server={{ server.ip }}:{{ server.tcp_port }},secret={{ server.passkey }},timeout={{ server.timeout }} +{% endfor %} + +# user_priv - set the map between TACACS+ user privilege and local user's passwd +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash + +# many_to_one - create one local user for many TACACS+ users which has the same privilege +# Default: many_to_one=n +# many_to_one=y + diff --git a/files/image_config/hostname/hostname-config.service b/files/image_config/hostname/hostname-config.service new file mode 100644 index 000000000000..e6e8f489883f --- /dev/null +++ b/files/image_config/hostname/hostname-config.service @@ -0,0 +1,11 @@ +[Unit] +Description=Update hostname based on configdb +Requires=database.service +After=database.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/hostname-config.sh + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/hostname/hostname-config.sh b/files/image_config/hostname/hostname-config.sh new file mode 100755 index 000000000000..eec7c2f732dc --- /dev/null +++ b/files/image_config/hostname/hostname-config.sh @@ -0,0 +1,11 @@ +#!/bin/bash -e + +CURRENT_HOSTNAME=`hostname` +HOSTNAME=`sonic-cfggen -d -v DEVICE_METADATA[\'localhost\'][\'hostname\']` + +echo $HOSTNAME > /etc/hostname +hostname -F /etc/hostname + +sed -i "/\s$CURRENT_HOSTNAME$/d" /etc/hosts +echo "127.0.0.1 $HOSTNAME" >> /etc/hosts + diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 28396774bfa1..06174790f04a 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,19 +1,6 @@ #!/bin/bash -SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) -SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') - -# Align last byte of MAC if necessary -if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then - last_byte=$(python -c "print '$SYSTEM_MAC_ADDRESS'[-2:]") - aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix - SYSTEM_MAC_ADDRESS=$(python -c "print '$SYSTEM_MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC -fi - -sonic-cfggen -d -a '{"hwaddr":"'$SYSTEM_MAC_ADDRESS'"}' -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces - -# Also store the system mac to configDB switch table. User configured switch_mac is not supported for now. -/usr/bin/docker exec database redis-cli -n 4 hset SWITCH\|SWITCH_ATTR switch_mac $SYSTEM_MAC_ADDRESS +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 diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index a06ff91518a7..71e2d2514fa2 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -28,12 +28,14 @@ iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static ########## management network policy routing rules # management port up rules 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' }} route add {{ prefix | network }}/{{ prefix | prefixlen }} 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 {{ '-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' }} route delete {{ prefix | network }}/{{ prefix | prefixlen }} 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 @@ -50,7 +52,7 @@ iface eth0 inet dhcp {% for (name, prefix) in INTERFACE %} allow-hotplug {{ name }} iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - mtu 9100 + mtu {{ PORT[name]['mtu'] if PORT[name]['mtu'] else 9100 }} address {{ prefix | ip }} netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # @@ -76,7 +78,7 @@ iface {{ member }} inet manual {% for (name, prefix) in PORTCHANNEL_INTERFACE.keys() | sort %} allow-hotplug {{ name }} iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - mtu 9100 + mtu {{ PORTCHANNEL[name]['mtu'] if PORTCHANNEL[name]['mtu'] else 9100 }} address {{ prefix | ip }} netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # diff --git a/files/image_config/ntp/ntp-config.service b/files/image_config/ntp/ntp-config.service index 05e6211b9782..d41f1ba2ddca 100644 --- a/files/image_config/ntp/ntp-config.service +++ b/files/image_config/ntp/ntp-config.service @@ -1,6 +1,5 @@ [Unit] Description=Update NTP configuration -Before=ntp.service Requires=database.service After=database.service diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh index 7c79a16c0ef3..601b7bd421f0 100755 --- a/files/image_config/ntp/ntp-config.sh +++ b/files/image_config/ntp/ntp-config.sh @@ -1,3 +1,5 @@ #!/bin/bash sonic-cfggen -d -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf + +systemctl restart ntp diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index d3ecba7d8518..a78c07d93b4a 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -43,6 +43,15 @@ firsttime_exit() exit 0 } +test_config() +{ + if [ -d /host/old_config ] && ( [ -f /host/old_config/minigraph.xml ] || [ -f /host/old_config/config_db.json ] ); then + return 0 + fi + + return 1 +} + # Given a string of tuples of the form field=value, extract the value for a field # In : $string, $field # Out: $value @@ -70,26 +79,54 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then firsttime_exit fi + # setup initial switch mac + SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) + SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') + + # Align last byte of MAC if necessary + if [ "$SONIC_ASIC_TYPE" = "mellanox" ] || [ "$SONIC_ASIC_TYPE" = "centec" ]; then + last_byte=$(python -c "print '$SYSTEM_MAC_ADDRESS'[-2:]") + aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix + SYSTEM_MAC_ADDRESS=$(python -c "print '$SYSTEM_MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC + fi + + if [ -f /etc/sonic/init_cfg.json ]; then + sonic-cfggen -j /etc/sonic/init_cfg.json -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /tmp/init_cfg.json + mv /tmp/init_cfg.json /etc/sonic/init_cfg.json + else + sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json + fi + # Try to take old configuration saved during installation - if [ -d /host/old_config ]; then + if test_config; then rm -f /host/old_config/sonic_version.yml mv -f /host/old_config/* /etc/sonic/ + if [ ! -f /etc/sonic/config_db.json ]; then + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + fi elif [ -f /host/minigraph.xml ]; then mv /host/minigraph.xml /etc/sonic/ # Combine information in minigraph and init_cfg.json to form initiate config DB dump file. # TODO: After moving all information from minigraph to DB, sample config DB dump should be provide - if [ -f /etc/sonic/init_cfg.json ]; then - sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json - else - sonic-cfggen -m --print-data > /etc/sonic/config_db.json - fi + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json else + # Use default minigraph.xml cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ - if [ -f /etc/sonic/init_cfg.json ]; then - sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json - else - sonic-cfggen -m --print-data > /etc/sonic/config_db.json - fi + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + fi + + HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` + if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then + # merge qos configuration into init config file + sonic-cfggen -j /etc/sonic/config_db.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json + fi + + if [ -f /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 ]; then + # generate and merge buffers configuration into config file + sonic-cfggen -m -t /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 > /tmp/buffers.json + sonic-cfggen -j /etc/sonic/config_db.json -j /tmp/buffers.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json fi if [ -d /host/image-$sonic_version/platform/$platform ]; then diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 715a1979f1ab..317ace3bf99f 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -21,6 +21,7 @@ Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \ /usr/bin/docker images *, \ /usr/bin/docker exec -it snmp cat /etc/snmp/snmpd.conf, \ /usr/bin/docker exec -it bgp cat /etc/quagga/bgpd.conf, \ + /usr/bin/docker ps, \ /usr/bin/generate_dump, \ /usr/bin/lldpctl, \ /usr/bin/lldpshow, \ diff --git a/files/image_config/updategraph/updategraph.service b/files/image_config/updategraph/updategraph.service index c66e9be75702..0162754ab2db 100644 --- a/files/image_config/updategraph/updategraph.service +++ b/files/image_config/updategraph/updategraph.service @@ -1,5 +1,6 @@ [Unit] Description=download minigraph from graph service +After=rc-local.service Before=database.service [Service] diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index cea25bd39837..dfd2fc1d7407 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -87,6 +87,9 @@ fixup_flash_permissions() { # this allows the sonic admin user to have read access on the flash local flash_mnt="$1" chmod o+rx "$flash_mnt" + + # remove all the filesystem acls from the flash + setfacl -Rb "$flash_mnt" } # Extract kernel parameters diff --git a/files/initramfs-tools/mke2fs b/files/initramfs-tools/mke2fs index de529eb57059..a67162199cf1 100644 --- a/files/initramfs-tools/mke2fs +++ b/files/initramfs-tools/mke2fs @@ -21,7 +21,7 @@ copy_exec /sbin/mke2fs copy_exec /sbin/sfdisk copy_exec /sbin/fdisk -fstypes="ext4" +fstypes="ext4 ext3" for type in $fstypes; do prog="/sbin/mkfs.${type}" diff --git a/files/initramfs-tools/setfacl b/files/initramfs-tools/setfacl new file mode 100644 index 000000000000..96564e06b245 --- /dev/null +++ b/files/initramfs-tools/setfacl @@ -0,0 +1,20 @@ +#!/bin/sh +#Part of the code is revised based on initramfs-tools/hooks/fsck and initramfs-tool is under GPL v2. + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +prereqs) + prereqs + exit 0 + ;; +esac + +. /usr/share/initramfs-tools/hook-functions + +copy_exec /usr/bin/setfacl /sbin/setfacl diff --git a/dockers/docker-orchagent/arp_update b/files/scripts/arp_update similarity index 100% rename from dockers/docker-orchagent/arp_update rename to files/scripts/arp_update diff --git a/dockers/docker-database/configdb-load.sh b/files/scripts/configdb-load.sh similarity index 74% rename from dockers/docker-database/configdb-load.sh rename to files/scripts/configdb-load.sh index 2175e37d5a75..42bb9959bca8 100755 --- a/dockers/docker-database/configdb-load.sh +++ b/files/scripts/configdb-load.sh @@ -1,11 +1,8 @@ #!/usr/bin/env bash # Wait until redis starts -while true; do - if [ `redis-cli ping` == "PONG" ]; then - break - fi - sleep 1 +until [[ $(redis-cli ping | grep -c PONG) -gt 0 ]]; do + sleep 1; done # If there is a config db dump file, load it diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 358da41071b5..c7f184bf0242 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -455,9 +455,9 @@ if [ "$install_env" = "onie" ]; then cp /etc/machine.conf $demo_mnt # Store installation log in target file system - rm -f $onie_initrd_tmp/tmp/onie-support.tar.bz2 + rm -f $onie_initrd_tmp/tmp/onie-support*.tar.bz2 ${onie_bin} onie-support /tmp - mv $onie_initrd_tmp/tmp/onie-support.tar.bz2 $demo_mnt/$image_dir/ + mv $onie_initrd_tmp/tmp/onie-support*.tar.bz2 $demo_mnt/$image_dir/ if [ "$firmware" = "uefi" ] ; then demo_install_uefi_grub "$demo_mnt" "$blk_dev" @@ -551,7 +551,7 @@ menuentry '$demo_grub_entry' { insmod ext2 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 varlog_size=$VAR_LOG_SIZE $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX + apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $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 } diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 196a4d589a24..066973967450 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_BRCM)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/broadcom/docker-ptf-brcm.mk b/platform/broadcom/docker-ptf-brcm.mk index c57ce43dc905..7b78aa9ec316 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 6e422db6e799..772f98339cbf 100644 --- a/platform/broadcom/libsaithrift-dev.mk +++ b/platform/broadcom/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/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/one-aboot.mk b/platform/broadcom/one-aboot.mk index fde8e06ff787..d13ce392b425 100644 --- a/platform/broadcom/one-aboot.mk +++ b/platform/broadcom/one-aboot.mk @@ -3,6 +3,6 @@ SONIC_ONE_ABOOT_IMAGE = sonic-aboot-broadcom.swi $(SONIC_ONE_ABOOT_IMAGE)_MACHINE = broadcom $(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot -$(SONIC_ONE_ABOOT_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) $(ARISTA_PLATFORM_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) $(ARISTA_PLATFORM_MODULE) $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE) diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk old mode 100644 new mode 100755 index 60305c292b6b..2e54972dce3a --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -3,17 +3,22 @@ SONIC_ONE_IMAGE = sonic-broadcom.bin $(SONIC_ONE_IMAGE)_MACHINE = broadcom $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) -$(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ +$(SONIC_ONE_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELL_Z9100_PLATFORM_MODULE) \ $(DELL_S6100_PLATFORM_MODULE) \ $(INGRASYS_S8900_54XC_PLATFORM_MODULE) \ $(INGRASYS_S8900_64XC_PLATFORM_MODULE) \ $(INGRASYS_S9100_PLATFORM_MODULE) \ $(INGRASYS_S8810_32Q_PLATFORM_MODULE) \ + $(INGRASYS_S9200_64X_PLATFORM_MODULE) \ $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ + $(ACCTON_AS5712_54X_PLATFORM_MODULE) \ + $(ACCTON_AS7816_64X_PLATFORM_MODULE) \ + $(ACCTON_AS7716_32X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ - $(CEL_DX010_PLATFORM_MODULE) + $(CEL_DX010_PLATFORM_MODULE) \ + $(DELTA_AG9032V1_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk old mode 100644 new mode 100755 index e5357c5e9f14..08820e9a270a --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -1,11 +1,30 @@ # Accton Platform modules -ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION = 1.0 +ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION = 1.1 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION +export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION +export ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION +export ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton $(ACCTON_AS7712_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(ACCTON_AS7712_32X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7712_32x-r0 SONIC_DPKG_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) + +ACCTON_AS5712_54X_PLATFORM_MODULE = sonic-platform-accton-as5712-54x_$(ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS5712_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5712_54x-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5712_54X_PLATFORM_MODULE))) + +ACCTON_AS7816_64X_PLATFORM_MODULE = sonic-platform-accton-as7816-64x_$(ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7816_64X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7816_64x-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7816_64X_PLATFORM_MODULE))) + +ACCTON_AS7716_32X_PLATFORM_MODULE = sonic-platform-accton-as7716-32x_$(ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7716_32X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7716_32x-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7716_32X_PLATFORM_MODULE))) + diff --git a/platform/broadcom/platform-modules-delta.mk b/platform/broadcom/platform-modules-delta.mk new file mode 100644 index 000000000000..c73b128106a9 --- /dev/null +++ b/platform/broadcom/platform-modules-delta.mk @@ -0,0 +1,12 @@ +# Delta AG9032v1 Platform modules + +DELTA_AG9032V1_PLATFORM_MODULE_VERSION = 1.1 + +export DELTA_AG9032V1_PLATFORM_MODULE_VERSION + +DELTA_AG9032V1_PLATFORM_MODULE = platform-modules-ag9032v1_$(DELTA_AG9032V1_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELTA_AG9032V1_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-delta +$(DELTA_AG9032V1_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(DELTA_AG9032V1_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag9032v1-r0 +SONIC_DPKG_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) + diff --git a/platform/broadcom/platform-modules-ingrasys.mk b/platform/broadcom/platform-modules-ingrasys.mk index e5ef4021eff7..f402a7fed1c6 100644 --- a/platform/broadcom/platform-modules-ingrasys.mk +++ b/platform/broadcom/platform-modules-ingrasys.mk @@ -4,11 +4,13 @@ INGRASYS_S9100_PLATFORM_MODULE_VERSION = 1.1.0 INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION = 1.1.0 INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION = 1.1.0 INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION = 1.1.0 +INGRASYS_S9200_64X_PLATFORM_MODULE_VERSION = 1.1.0 export INGRASYS_S9100_PLATFORM_MODULE_VERSION export INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION export INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION export INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION +export INGRASYS_S9200_64X_PLATFORM_MODULE_VERSION INGRASYS_S9100_PLATFORM_MODULE = sonic-platform-ingrasys-s9100_$(INGRASYS_S9100_PLATFORM_MODULE_VERSION)_amd64.deb $(INGRASYS_S9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys @@ -25,6 +27,10 @@ $(INGRASYS_S8900_54XC_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8900_54xc-r0 INGRASYS_S8810_32Q_PLATFORM_MODULE = sonic-platform-ingrasys-s8810-32q_$(INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION)_amd64.deb $(INGRASYS_S8810_32Q_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8810_32q-r0 +INGRASYS_S9200_64X_PLATFORM_MODULE = sonic-platform-ingrasys-s9200-64x_$(INGRASYS_S9200_64X_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9200_64X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9200_64x-r0 + $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_64XC_PLATFORM_MODULE))) $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_54XC_PLATFORM_MODULE))) $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8810_32Q_PLATFORM_MODULE))) +$(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S9200_64X_PLATFORM_MODULE))) diff --git a/platform/broadcom/platform-modules-inventec.mk b/platform/broadcom/platform-modules-inventec.mk old mode 100755 new mode 100644 diff --git a/platform/broadcom/python-saithrift.mk b/platform/broadcom/python-saithrift.mk index 18bf77c3d009..11efddc36843 100644 --- a/platform/broadcom/python-saithrift.mk +++ b/platform/broadcom/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_BRCM = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_BRCM)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_BRCM = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_BRCM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/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/raw-image.mk b/platform/broadcom/raw-image.mk index ae93683c543d..2591d32c1be8 100644 --- a/platform/broadcom/raw-image.mk +++ b/platform/broadcom/raw-image.mk @@ -3,7 +3,7 @@ SONIC_RAW_IMAGE = sonic-broadcom.raw $(SONIC_RAW_IMAGE)_MACHINE = broadcom $(SONIC_RAW_IMAGE)_IMAGE_TYPE = raw -$(SONIC_RAW_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) -$(SONIC_RAW_IMAGE)_INSTALLS += $($(SONIC_ONE_IMAGE)_INSTALLS) +$(SONIC_RAW_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_RAW_IMAGE)_LAZY_INSTALLS += $($(SONIC_ONE_IMAGE)_LAZY_INSTALLS) $(SONIC_RAW_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_RAW_IMAGE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index b52118570251..8147aa31c20a 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -7,6 +7,7 @@ include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/platform-modules-inventec.mk include $(PLATFORM_PATH)/platform-modules-cel.mk +include $(PLATFORM_PATH)/platform-modules-delta.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk @@ -15,7 +16,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" @@ -29,7 +30,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ $(DOCKER_FPM) # Inject brcm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(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_SAI) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 5b66026f297f..46bde157cf11 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-10_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-10_amd64.deb?sv=2015-04-05&sr=b&sig=tByZ7QDBsYlJ4UHbapnzqHYrbA8rD92%2FQXEpupITTmM%3D&se=2031-07-06T19%3A19%3A32Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.3-3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.3-3_amd64.deb?sv=2015-04-05&sr=b&sig=A%2Bcq%2B8XL%2BZfhOV6zqwRWm1jQ31PN0t54H9abZSRwTVw%3D&se=2031-09-25T22%3A41%3A43Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-10_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.3-3_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_3.0.3.2-10_amd64.deb?sv=2015-04-05&sr=b&sig=T6U8sF%2BW8B%2FffBzPoUJ9peLcg2O9MunHBBKSu7SZOKo%3D&se=2031-07-06T19%3A19%3A52Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.3-3_amd64.deb?sv=2015-04-05&sr=b&sig=XT0v%2B25LZ5whTwH%2FE%2FykQLV8Kzn%2FoDyLNXjmqNuiFPo%3D&se=2031-09-25T22%3A41%3A21Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index aff0cf07fe5c..dbabf8aaba15 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3-2_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=RADtBDA9oZmwHnTzBY76ewajyJ8Af%2BchVCzNbe%2BPsbc%3D&se=2031-07-06T19%3A18%3A56Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.7-1_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=BJEFXfq2mgvSTIYZF8qF1Jj2ePkJaxBmA0HqhhAFPmQ%3D&se=2031-08-11T03%3A27%3A43Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index 99607d63220d..3f06d9f5864c 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit 99607d63220de336a61d81f6b4d1e64062761abe +Subproject commit 3f06d9f5864c9daae4b582d60307ccb6d21c6ceb diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index f985b188326e..e657481807db 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit f985b188326e480124ec49541b4fecc51a213889 +Subproject commit e657481807db53dd4b87fa346b157153e201a37d diff --git a/platform/broadcom/sonic-platform-modules-delta/LICENSE b/platform/broadcom/sonic-platform-modules-delta/LICENSE new file mode 100644 index 000000000000..ea87fe9caabe --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Delta Networks, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/cfg/ag9032v1-modules.conf b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/cfg/ag9032v1-modules.conf new file mode 100644 index 000000000000..552b4103ed02 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/cfg/ag9032v1-modules.conf @@ -0,0 +1,13 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +i2c-i801 +i2c-isch +i2c-ismt +i2c-dev +i2c-mux +i2c-smbus +i2c-mux-gpio +i2c-mux-pca954x diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile new file mode 100644 index 000000000000..69b3b48885d3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := at24.o dni_ag9032v1_psu.o dni_emc2305.o delta_ag9032v1_platform.o + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c new file mode 100644 index 000000000000..8e73691647d8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c @@ -0,0 +1,698 @@ +/* + * at24.c - handle most I2C EEPROMs + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + struct memory_accessor macc; + int use_smbus; + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + struct bin_attribute bin; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 32; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 32)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +static const struct i2c_device_id at24_ids[] = { + /* needs 8 addresses as A0-A2 are ignored */ + { "24c00", AT24_DEVICE_MAGIC(128 / 8, AT24_FLAG_TAKE8ADDR) }, + /* old variants can't be handled with this generic entry! */ + { "24c01", AT24_DEVICE_MAGIC(1024 / 8, 0) }, + { "24c02", AT24_DEVICE_MAGIC(2048 / 8, 0) }, + /* spd is a 24c02 in memory DIMMs */ + { "spd", AT24_DEVICE_MAGIC(2048 / 8, + AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, + { "24c04", AT24_DEVICE_MAGIC(4096 / 8, 0) }, + /* 24rf08 quirk is handled at i2c-core */ + { "24c08", AT24_DEVICE_MAGIC(8192 / 8, 0) }, + { "24c16", AT24_DEVICE_MAGIC(16384 / 8, 0) }, + { "24c32", AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16) }, + { "24c64", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, + { "24c128", AT24_DEVICE_MAGIC(131072 / 8, AT24_FLAG_ADDR16) }, + { "24c256", AT24_DEVICE_MAGIC(262144 / 8, AT24_FLAG_ADDR16) }, + { "24c512", AT24_DEVICE_MAGIC(524288 / 8, AT24_FLAG_ADDR16) }, + { "24c1024", AT24_DEVICE_MAGIC(1048576 / 8, AT24_FLAG_ADDR16) }, + { "at24", 0 }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned *offset) +{ + unsigned i; + + if (at24->chip.flags & AT24_FLAG_ADDR16) { + i = *offset >> 16; + *offset &= 0xffff; + } else { + i = *offset >> 8; + *offset &= 0xff; + } + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, + unsigned offset, size_t count) +{ + struct i2c_msg msg[2]; + u8 msgbuf[2]; + struct i2c_client *client; + unsigned long timeout, read_time; + int status, i; + + memset(msg, 0, sizeof(msg)); + + /* + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ + + /* + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + */ + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + switch (at24->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + /* Smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + break; + case I2C_SMBUS_WORD_DATA: + /* Check for odd length transaction */ + count = (count == 1) ? 1 : 2; + break; + case I2C_SMBUS_BYTE_DATA: + count = 1; + break; + default: + /* + * When we have a better choice than SMBus calls, use a + * combined I2C message. Write address; then read up to + * io_limit data bytes. Note that read page rollover helps us + * here (unlike writes). msgbuf is u8 and will cast to our + * needs. + */ + i = 0; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msgbuf[i++] = offset >> 8; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + } + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + read_time = jiffies; + switch (at24->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + status = i2c_smbus_read_i2c_block_data(client, offset, + count, buf); + break; + case I2C_SMBUS_WORD_DATA: + status = i2c_smbus_read_word_data(client, offset); + if (status >= 0) { + buf[0] = status & 0xff; + if (count == 2) + buf[1] = status >> 8; + status = count; + } + break; + case I2C_SMBUS_BYTE_DATA: + status = i2c_smbus_read_byte_data(client, offset); + if (status >= 0) { + buf[0] = status; + status = count; + } + break; + default: + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + } + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(read_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t at24_read(struct at24_data *at24, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) + return count; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + ssize_t status; + + status = at24_eeprom_read(at24, buf, off, count); + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&at24->lock); + + return retval; +} + +static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct at24_data *at24; + + at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return at24_read(at24, buf, off, count); +} + + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. This routine + * writes at most one page. + */ +static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf, + unsigned offset, size_t count) +{ + struct i2c_client *client; + struct i2c_msg msg; + ssize_t status; + unsigned long timeout, write_time; + unsigned next_page; + + /* Get corresponding I2C address and adjust offset */ + client = at24_translate_offset(at24, &offset); + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + /* If we'll use I2C calls for I/O, set up the message */ + if (!at24->use_smbus) { + int i = 0; + + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = at24->writebuf; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msg.buf[i++] = offset >> 8; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + } + + /* + * Writes fail if the previous one didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + write_time = jiffies; + if (at24->use_smbus) { + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + } else { + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + } + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(write_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, + size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) + return count; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + ssize_t status; + + status = at24_eeprom_write(at24, buf, off, count); + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&at24->lock); + + return retval; +} + +static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct at24_data *at24; + + if (unlikely(off >= attr->size)) + return -EFBIG; + + at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return at24_write(at24, buf, off, count); +} + +/*-------------------------------------------------------------------------*/ + +/* + * This lets other kernel code access the eeprom data. For example, it + * might hold a board's Ethernet address, or board-specific calibration + * data generated on the manufacturing floor. + */ + +static ssize_t at24_macc_read(struct memory_accessor *macc, char *buf, + off_t offset, size_t count) +{ + struct at24_data *at24 = container_of(macc, struct at24_data, macc); + + return at24_read(at24, buf, offset, count); +} + +static ssize_t at24_macc_write(struct memory_accessor *macc, const char *buf, + off_t offset, size_t count) +{ + struct at24_data *at24 = container_of(macc, struct at24_data, macc); + + return at24_write(at24, buf, offset, count); +} + +/*-------------------------------------------------------------------------*/ + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + bool writable; + int use_smbus = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + kernel_ulong_t magic; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (!id->driver_data) + return -ENODEV; + + magic = id->driver_data; + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + if (chip.flags & AT24_FLAG_ADDR16) + return -EPFNOSUPPORT; + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->chip = chip; + at24->num_addresses = num_addresses; + + /* + * Export the EEPROM bytes through sysfs, since that's convenient. + * By default, only root should see the data (maybe passwords etc) + */ + sysfs_bin_attr_init(&at24->bin); + at24->bin.attr.name = "eeprom"; + at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; + at24->bin.read = at24_bin_read; + at24->bin.size = chip.byte_len; + + at24->macc.read = at24_macc_read; + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + + unsigned write_max = chip.page_size; + + at24->macc.write = at24_macc_write; + + at24->bin.write = at24_bin_write; + at24->bin.attr.mode |= S_IWUSR; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + err = sysfs_create_bin_file(&client->dev.kobj, &at24->bin); + if (err) + goto err_clients; + + i2c_set_clientdata(client, at24); + + dev_info(&client->dev, "%zu byte %s EEPROM, %s, %u bytes/write\n", + at24->bin.size, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(&at24->macc, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + sysfs_remove_bin_file(&client->dev.kobj, &at24->bin); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_driver at24_driver = { + .driver = { + .name = "at24", + .owner = THIS_MODULE, + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ids, +}; + +static int __init at24_init(void) +{ + if (!io_limit) { + pr_err("at24: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + return i2c_add_driver(&at24_driver); +} +module_init(at24_init); + +static void __exit at24_exit(void) +{ + i2c_del_driver(&at24_driver); +} +module_exit(at24_exit); + +MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); +MODULE_AUTHOR("David Brownell and Wolfram Sang"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c new file mode 100644 index 000000000000..90454a5bdb4a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c @@ -0,0 +1,1530 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUS3_DEV_NUM 9 +#define BUS4_DEV_NUM 6 +#define BUS5_DEV_NUM 32 +#define DEFAULT_NUM 1 +#define BUS3_BASE_NUM 30 +#define BUS4_BASE_NUM 40 +#define BUS5_BASE_NUM 50 + +#define BUS3_MUX_REG 0x21 +#define BUS4_MUX_REG 0x21 +#define BUS5_MUX_REG 0x20 + +#define TEMP_FAN_VAL 0x06 +#define FANIO_CTL_VAL 0x07 +#define FAN_CTRL_VAL 0x05 +#define PSU1_VAL 0x00 +#define PSU2_VAL 0x20 +#define HOT_SWAP1_VAL 0x10 +#define HOT_SWAP2_VAL 0x30 +#define FAN_EEPROM1_VAL 0x00 +#define FAN_EEPROM2_VAL 0x01 +#define FAN_EEPROM3_VAL 0x02 +#define FAN_EEPROM4_VAL 0x03 +#define FAN_EEPROM5_VAL 0x04 + +#define SWPLD_REG 0x31 +#define SWPLD_SFP_MUX_REG 0x20 + +#define SYS_LED_REG 0x1C +#define FAN1_LED_REG 0x1D +#define FAN2_LED_REG 0x1E + +#define SFP_PRESENCE_1 0x38 +#define SFP_PRESENCE_2 0x39 +#define SFP_PRESENCE_3 0x3A +#define SFP_PRESENCE_4 0x3B + +#define SFP_LP_MODE_1 0x34 +#define SFP_LP_MODE_2 0x35 +#define SFP_LP_MODE_3 0x36 +#define SFP_LP_MODE_4 0x37 + +#define SFP_RESET_1 0x3C +#define SFP_RESET_2 0x3D +#define SFP_RESET_3 0x3E +#define SFP_RESET_4 0x3F + +#define SFP_RESPONSE_1 0x30 +#define SFP_RESPONSE_2 0x31 +#define SFP_RESPONSE_3 0x32 +#define SFP_RESPONSE_4 0x33 + +#define SFF8436_INFO(data) \ + .type = "sff8436", .addr = 0x50, .platform_data = (data) + +#define SFF_8346_PORT(eedata) \ + .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY + +#define ag9032v1_i2c_device_num(NUM){ \ + .name = "delta-ag9032v1-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &ag9032v1_i2c_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + +/*Define struct to get client of i2c_new_deivce */ +struct i2c_client * i2c_client_9547; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, +}; + +unsigned char reverse_8bits(unsigned char c) +{ + unsigned char s = 0; + int i; + for (i = 0; i < 8; ++i) { + s <<= 1; + s |= c & 1; + c >>= 1; + } + return s; +} +/*---------------- I2C device - start ------------- */ +static void device_release(struct device *dev) +{ + return; +} + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; +/* pca9547 - add 8 bus */ +static struct pca954x_platform_mode pca954x_mode[] = { + { .adap_id = 2, + .deselect_on_exit = 1, + }, + { .adap_id = 3, + .deselect_on_exit = 1, + }, + { .adap_id = 4, + .deselect_on_exit = 1, + }, + { .adap_id = 5, + .deselect_on_exit = 1, + }, + { .adap_id = 6, + .deselect_on_exit = 1, + }, + { .adap_id = 7, + .deselect_on_exit = 1, + }, + { .adap_id = 8, + .deselect_on_exit = 1, + }, + { .adap_id = 9, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data = { + .modes = pca954x_mode, + .num_modes = ARRAY_SIZE(pca954x_mode), +}; + +static struct i2c_board_info __initdata i2c_info_pca9547[] = +{ + { + I2C_BOARD_INFO("pca9547", 0x71), + .platform_data = &pca954x_data, + }, +}; + + +static struct sff_8436_platform_data sff_8436_port[] = { + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, +}; + +static struct i2c_device_platform_data ag9032v1_i2c_device_platform_data[] = { + { + /* tmp75 (0x4d) */ + .parent = 2, + .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, + .client = NULL, + }, + { + /* id eeprom (0x53) */ + .parent = 2, + .info = { I2C_BOARD_INFO("24c02", 0x53) }, + .client = NULL, + }, + { + /* tmp75 (0x4c) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4c) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x4e) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4e) }, + .client = NULL, + }, + { + /* tmp75 (0x4f) */ + .parent = 30, + .info = { I2C_BOARD_INFO("tmp75", 0x4f) }, + .client = NULL, + }, + { + /* FAN 1 Controller (0x2c) */ + .parent = 37, + .info = { I2C_BOARD_INFO("emc2305", 0x2c) }, + .client = NULL, + }, + { + /* FAN 2 Controller (0x2d) */ + .parent = 38, + .info = { I2C_BOARD_INFO("emc2305", 0x2d) }, + .client = NULL, + }, + { + /* psu 1 (0x58) */ + .parent = 40, + .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = 0 }, + .client = NULL, + }, + { + /* psu 2 (0x58) */ + .parent = 41, + .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = 1 }, + .client = NULL, + }, + { + /* hot-swap 1 (0x40) */ + .parent = 42, + .info = { .type = "ltc4215", .addr = 0x40, .platform_data = 0 }, + .client = NULL, + }, + { + /* hot-swap 2 (0x40) */ + .parent = 43, + .info = { .type = "ltc4215", .addr = 0x40, .platform_data = 1 }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 50, + .info = { SFF8436_INFO(&sff_8436_port[0]) }, + .client = NULL, + }, + { + /* qsfp 2 (0x50) */ + .parent = 51, + .info = { SFF8436_INFO(&sff_8436_port[1]) }, + .client = NULL, + }, + { + /* qsfp 3 (0x50) */ + .parent = 52, + .info = { SFF8436_INFO(&sff_8436_port[2]) }, + .client = NULL, + }, + { + /* qsfp 4 (0x50) */ + .parent = 53, + .info = { SFF8436_INFO(&sff_8436_port[3]) }, + .client = NULL, + }, + { + /* qsfp 5 (0x50) */ + .parent = 54, + .info = { SFF8436_INFO(&sff_8436_port[4]) }, + .client = NULL, + }, + { + /* qsfp 6 (0x50) */ + .parent = 55, + .info = { SFF8436_INFO(&sff_8436_port[5]) }, + .client = NULL, + }, + { + /* qsfp 7 (0x50) */ + .parent = 56, + .info = { SFF8436_INFO(&sff_8436_port[6]) }, + .client = NULL, + }, + { + /* qsfp 8 (0x50) */ + .parent = 57, + .info = { SFF8436_INFO(&sff_8436_port[7]) }, + .client = NULL, + }, + { + /* qsfp 9 (0x50) */ + .parent = 58, + .info = { SFF8436_INFO(&sff_8436_port[8]) }, + .client = NULL, + }, + { + /* qsfp 10 (0x50) */ + .parent = 59, + .info = { SFF8436_INFO(&sff_8436_port[9]) }, + .client = NULL, + }, + { + /* qsfp 11 (0x50) */ + .parent = 60, + .info = { SFF8436_INFO(&sff_8436_port[10]) }, + .client = NULL, + }, + { + /* qsfp 12 (0x50) */ + .parent = 61, + .info = { SFF8436_INFO(&sff_8436_port[11]) }, + .client = NULL, + }, + { + /* qsfp 13 (0x50) */ + .parent = 62, + .info = { SFF8436_INFO(&sff_8436_port[12]) }, + .client = NULL, + }, + { + /* qsfp 14 (0x50) */ + .parent = 63, + .info = { SFF8436_INFO(&sff_8436_port[13]) }, + .client = NULL, + }, + { + /* qsfp 15 (0x50) */ + .parent = 64, + .info = { SFF8436_INFO(&sff_8436_port[14]) }, + .client = NULL, + }, + { + /* qsfp 16 (0x50) */ + .parent = 65, + .info = { SFF8436_INFO(&sff_8436_port[15]) }, + .client = NULL, + }, + { + /* qsfp 17 (0x50) */ + .parent = 66, + .info = { SFF8436_INFO(&sff_8436_port[16]) }, + .client = NULL, + }, + { + /* qsfp 18 (0x50) */ + .parent = 67, + .info = { SFF8436_INFO(&sff_8436_port[17]) }, + .client = NULL, + }, + { + /* qsfp 19 (0x50) */ + .parent = 68, + .info = { SFF8436_INFO(&sff_8436_port[18]) }, + .client = NULL, + }, + { + /* qsfp 20 (0x50) */ + .parent = 69, + .info = { SFF8436_INFO(&sff_8436_port[19]) }, + .client = NULL, + }, + { + /* qsfp 21 (0x50) */ + .parent = 70, + .info = { SFF8436_INFO(&sff_8436_port[20]) }, + .client = NULL, + }, + { + /* qsfp 22 (0x50) */ + .parent = 71, + .info = { SFF8436_INFO(&sff_8436_port[21]) }, + .client = NULL, + }, + { + /* qsfp 23 (0x50) */ + .parent = 72, + .info = { SFF8436_INFO(&sff_8436_port[22]) }, + .client = NULL, + }, + { + /* qsfp 24 (0x50) */ + .parent = 73, + .info = { SFF8436_INFO(&sff_8436_port[23]) }, + .client = NULL, + }, + { + /* qsfp 25 (0x50) */ + .parent = 74, + .info = { SFF8436_INFO(&sff_8436_port[24]) }, + .client = NULL, + }, + { + /* qsfp 26 (0x50) */ + .parent = 75, + .info = { SFF8436_INFO(&sff_8436_port[25]) }, + .client = NULL, + }, + { + /* qsfp 27 (0x50) */ + .parent = 76, + .info = { SFF8436_INFO(&sff_8436_port[26]) }, + .client = NULL, + }, + { + /* qsfp 28 (0x50) */ + .parent = 77, + .info = { SFF8436_INFO(&sff_8436_port[27]) }, + .client = NULL, + }, + { + /* qsfp 29 (0x50) */ + .parent = 78, + .info = { SFF8436_INFO(&sff_8436_port[28]) }, + .client = NULL, + }, + { + /* qsfp 30 (0x50) */ + .parent = 79, + .info = { SFF8436_INFO(&sff_8436_port[29]) }, + .client = NULL, + }, + { + /* qsfp 31 (0x50) */ + .parent = 80, + .info = { SFF8436_INFO(&sff_8436_port[30]) }, + .client = NULL, + }, + { + /* qsfp 32 (0x50) */ + .parent = 81, + .info = { SFF8436_INFO(&sff_8436_port[31]) }, + .client = NULL, + }, +}; + + +static struct platform_device ag9032v1_i2c_device[] = { + ag9032v1_i2c_device_num(0), + ag9032v1_i2c_device_num(1), + ag9032v1_i2c_device_num(2), + ag9032v1_i2c_device_num(3), + ag9032v1_i2c_device_num(4), + ag9032v1_i2c_device_num(5), + ag9032v1_i2c_device_num(6), + ag9032v1_i2c_device_num(7), + ag9032v1_i2c_device_num(8), + ag9032v1_i2c_device_num(9), + ag9032v1_i2c_device_num(10), + ag9032v1_i2c_device_num(11), + ag9032v1_i2c_device_num(12), + ag9032v1_i2c_device_num(13), + ag9032v1_i2c_device_num(14), + ag9032v1_i2c_device_num(15), + ag9032v1_i2c_device_num(16), + ag9032v1_i2c_device_num(17), + ag9032v1_i2c_device_num(18), + ag9032v1_i2c_device_num(19), + ag9032v1_i2c_device_num(20), + ag9032v1_i2c_device_num(21), + ag9032v1_i2c_device_num(22), + ag9032v1_i2c_device_num(23), + ag9032v1_i2c_device_num(24), + ag9032v1_i2c_device_num(25), + ag9032v1_i2c_device_num(26), + ag9032v1_i2c_device_num(27), + ag9032v1_i2c_device_num(28), + ag9032v1_i2c_device_num(29), + ag9032v1_i2c_device_num(30), + ag9032v1_i2c_device_num(31), + ag9032v1_i2c_device_num(32), + ag9032v1_i2c_device_num(33), + ag9032v1_i2c_device_num(34), + ag9032v1_i2c_device_num(35), + ag9032v1_i2c_device_num(36), + ag9032v1_i2c_device_num(37), + ag9032v1_i2c_device_num(38), + ag9032v1_i2c_device_num(39), + ag9032v1_i2c_device_num(40), + ag9032v1_i2c_device_num(41), + ag9032v1_i2c_device_num(42), + ag9032v1_i2c_device_num(43), +}; + +/*---------------- I2C device - end ------------- */ + +/*---------------- I2C driver - start ------------- */ +static int __init i2c_device_probe(struct platform_device *pdev) +{ + struct i2c_device_platform_data *pdata; + struct i2c_adapter *parent; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (pdata->client) { + parent = i2c_get_adapter(pdata->parent); + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-i2c-device", + } +}; + +/*---------------- I2C driver - end ------------- */ + +/*---------------- CPLD - start ------------- */ + +/* CPLD -- device */ + +enum cpld_type { + system_cpld, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data ag9032v1_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = SWPLD_REG, + }, +}; + +static struct platform_device ag9032v1_cpld = { + .name = "delta-ag9032v1-cpld", + .id = 0, + .dev = { + .platform_data = ag9032v1_cpld_platform_data, + .release = device_release + }, +}; + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)reverse_8bits(ret) & 0xff; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2, (u8)(reverse_8bits(data >> 8) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3, (u8)(reverse_8bits(data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4, (u8)(reverse_8bits(data >> 24) & 0xff)); + + return count; +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_2, (u8)reverse_8bits((data >> 8)& 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_3, (u8)reverse_8bits((data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_4, (u8)reverse_8bits((data >> 24) & 0xff)); + + return count; +} + +static ssize_t get_response(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2, (u8)reverse_8bits((data >> 8)& 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3, (u8)reverse_8bits((data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4, (u8)reverse_8bits((data >> 24) & 0xff)); + + return count; +} + +struct platform_led_status{ + int reg_data; + char *led_status; + int led_id; +}; + +static struct platform_led_status led_info[] = { + { + .reg_data = 0x40, + .led_status = "pwr1_green", + .led_id = 0, + }, + { + .reg_data = 0x80, + .led_status = "pwr1_amber", + .led_id = 0, + }, + { + .reg_data = 0x00, + .led_status = "pwr1_off", + .led_id = 0, + }, + { + .reg_data = 0xc0, + .led_status = "pwr1_off", + .led_id = 0, + }, + { + .reg_data = 0x10, + .led_status = "pwr2_green", + .led_id = 1, + }, + { + .reg_data = 0x20, + .led_status = "pwr2_amber", + .led_id = 1, + }, + { + .reg_data = 0x00, + .led_status = "pwr2_off", + .led_id = 1, + }, + { + .reg_data = 0x30, + .led_status = "pwr2_off", + .led_id = 1, + }, + { + .reg_data = 0x04, + .led_status = "sys_green", + .led_id = 2, + }, + { + .reg_data = 0x08, + .led_status = "sys_blinking_green", + .led_id = 2, + }, + { + .reg_data = 0x0c, + .led_status = "sys_red", + .led_id = 2, + }, + { + .reg_data = 0x00, + .led_status = "sys_off", + .led_id = 2, + }, + { + .reg_data = 0x01, + .led_status = "fan_green", + .led_id = 3, + }, + { + .reg_data = 0x02, + .led_status = "fan_amber", + .led_id = 3, + }, + { + .reg_data = 0x00, + .led_status = "fan_off", + .led_id = 3, + }, + { + .reg_data = 0x03, + .led_status = "fan_off", + .led_id = 3, + }, + { + .reg_data = 0x40, + .led_status = "fan1_green", + .led_id = 4, + }, + { + .reg_data = 0x80, + .led_status = "fan1_red", + .led_id = 4, + }, + { + .reg_data = 0x00, + .led_status = "fan1_off", + .led_id = 4, + }, + { + .reg_data = 0x10, + .led_status = "fan2_green", + .led_id = 5, + }, + { + .reg_data = 0x20, + .led_status = "fan2_red", + .led_id = 5, + }, + { + .reg_data = 0x00, + .led_status = "fan2_off", + .led_id = 5, + }, + { + .reg_data = 0x04, + .led_status = "fan3_green", + .led_id = 6, + }, + { + .reg_data = 0x08, + .led_status = "fan3_red", + .led_id = 6, + }, + { + .reg_data = 0x00, + .led_status = "fan3_off", + .led_id = 6, + }, + { + .reg_data = 0x01, + .led_status = "fan4_green", + .led_id = 7, + }, + { + .reg_data = 0x02, + .led_status = "fan4_red", + .led_id = 7, + }, + { + .reg_data = 0x00, + .led_status = "fan4_off", + .led_id = 7, + }, + { + .reg_data = 0x40, + .led_status = "fan5_green", + .led_id = 8, + }, + { + .reg_data = 0x80, + .led_status = "fan5_red", + .led_id = 8, + }, + { + .reg_data = 0x00, + .led_status = "fan5_off", + .led_id = 8, + }, +}; + +struct platform_led_data{ + int reg_addr; + int mask; +}; + +static struct platform_led_data led_data[] = { + { + .reg_addr = SYS_LED_REG, + .mask = 0xc0, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x30, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x0c, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x03, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0xc0, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x30, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x0c, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x03, + }, + { + .reg_addr = FAN2_LED_REG, + .mask = 0xc0, + }, +}; + + +static ssize_t get_led_color(struct device *dev, struct device_attribute *devattr, char *buf) +{ + char str[9][20] = {0}; + int board_data; + int led_data_number; + int led_info_number; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + board_data = i2c_smbus_read_byte_data(pdata[system_cpld].client, led_data[led_data_number].reg_addr); + if(board_data >= 0){ + board_data &= led_data[led_data_number].mask; + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + if (led_data_number == led_info[led_info_number].led_id){ + if(board_data == led_info[led_info_number].reg_data){ + sprintf(str[led_data_number], "%s", led_info[led_info_number].led_status); + } + } + } + } + else + printk( KERN_ERR "Missing LED board data\n"); + } + return sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",str[0],str[1],str[2],str[3],str[4],str[5],str[6],str[7],str[8]); +} + +static ssize_t set_led_color(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int led_info_number; + int led_data_number; + int str_compar; + int led_reg_value; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + str_compar = strncmp(buf,led_info[led_info_number].led_status,strlen(led_info[led_info_number].led_status)); + if(str_compar == 0){ + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + if(led_info[led_info_number].led_id == led_data_number){ + led_reg_value = i2c_smbus_read_byte_data(pdata[system_cpld].client, led_data[led_data_number].reg_addr); + if(led_reg_value >= 0){ + led_reg_value &= (~led_data[led_data_number].mask); + led_reg_value |= led_info[led_info_number].reg_data; + i2c_smbus_write_byte_data(pdata[system_cpld].client, (u8)(led_data[led_data_number].reg_addr & 0xff), (u8)(led_reg_value & 0xff)); + } + else + printk( KERN_ERR "Missing LED reg. data\n"); + } + } + } + } + return count; +} + + +static DEVICE_ATTR(sfp_present, S_IRUGO, get_present, NULL ); +static DEVICE_ATTR(sfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode ); +static DEVICE_ATTR(sfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset ); +static DEVICE_ATTR(sfp_response, S_IWUSR | S_IRUGO, get_response, set_response ); +static DEVICE_ATTR(led_control, S_IRUGO | S_IWUSR, get_led_color, set_led_color); + +static struct attribute *ag9032v1_cpld_attrs[] = { + &dev_attr_sfp_response.attr, + &dev_attr_sfp_present.attr, + &dev_attr_sfp_lpmode.attr, + &dev_attr_sfp_reset.attr, + &dev_attr_led_control.attr, + NULL, +}; + +static struct attribute_group ag9032v1_cpld_attr_grp = { + .attrs = ag9032v1_cpld_attrs, +}; + +/* CPLD -- driver */ +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS6); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS6); + return -ENODEV; + } + + pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); + if (!pdata[system_cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); + goto error; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + i2c_unregister_device(pdata[system_cpld].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[system_cpld].client) { + if (!parent) { + parent = (pdata[system_cpld].client)->adapter; + } + i2c_unregister_device(pdata[system_cpld].client); + } + } + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-cpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + +/*---------------- MUX - start ------------- */ + +struct swpld_mux_platform_data { + int parent; + int base_nr; + int reg_addr; + struct i2c_client *cpld; +}; + +struct swpld_mux { + struct i2c_adapter *parent; + struct i2c_adapter **child; + struct swpld_mux_platform_data data; +}; +static struct swpld_mux_platform_data ag9032v1_swpld_mux_platform_data[] = { + { + .parent = BUS3, + .base_nr = BUS3_BASE_NUM, + .cpld = NULL, + .reg_addr = BUS3_MUX_REG ,// the i2c register address which for select mux TEMP(FAN) + }, + { + .parent = BUS4, + .base_nr = BUS4_BASE_NUM , + .cpld = NULL, + .reg_addr = BUS4_MUX_REG , + }, + { + .parent = BUS5, + .base_nr = BUS5_BASE_NUM , + .cpld = NULL, + .reg_addr = BUS5_MUX_REG , + }, +}; + +static struct platform_device ag9032v1_swpld_mux[] = { + { + .name = "delta-ag9032v1-swpld-mux", + .id = 0, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[0], + .release = device_release, + }, + }, + { + .name = "delta-ag9032v1-swpld-mux", + .id = 1, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[1], + .release = device_release, + }, + }, + { + .name = "delta-ag9032v1-swpld-mux", + .id = 2, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[2], + .release = device_release, + }, + }, +}; + +static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) +{ + union i2c_smbus_data data; + + data.byte = val; + return client->adapter->algo->smbus_xfer(client->adapter, client->addr, + client->flags, + I2C_SMBUS_WRITE, + regaddr, I2C_SMBUS_BYTE_DATA, &data); +} + +static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) +{ + struct swpld_mux *mux = data; + u8 swpld_mux_val=0; + + if ( mux->data.base_nr == BUS3_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = TEMP_FAN_VAL; + break; + case 1: + swpld_mux_val = FAN_EEPROM1_VAL; + break; + case 2: + swpld_mux_val = FAN_EEPROM2_VAL; + break; + case 3: + swpld_mux_val = FAN_EEPROM3_VAL; + break; + case 4: + swpld_mux_val = FAN_EEPROM4_VAL; + break; + case 5: + swpld_mux_val = FAN_EEPROM5_VAL; + break; + case 6: + swpld_mux_val = FANIO_CTL_VAL; + break; + case 7: + case 8: + swpld_mux_val = FAN_CTRL_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS4_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = PSU1_VAL; + break; + case 1: + swpld_mux_val = PSU2_VAL; + break; + case 2: + swpld_mux_val = HOT_SWAP1_VAL; + break; + case 3: + swpld_mux_val = HOT_SWAP2_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS5_BASE_NUM ){ + if (chan < 9){ + swpld_mux_val = (u8)(chan) + 0x01; + } + else if (8 < chan && chan < 19){ + swpld_mux_val = (u8)(chan - 9) + 0x10; + } + else if (18 < chan && chan < 29){ + swpld_mux_val = (u8)(chan - 19) + 0x20; + } + else if (28 < chan && chan < 39){ + swpld_mux_val = (u8)(chan - 29) + 0x30; + } + else{ + swpld_mux_val = 0x00; + } + } + else + { + swpld_mux_val = 0x00; + } + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); +} + +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS3: + dev_num = BUS3_DEV_NUM; + break; + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + case BUS5: + dev_num = BUS5_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for mux\n"); + goto alloc_failed; + } + + mux->parent = parent; + mux->data = *pdata; + mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); + if (!mux->child) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for device on mux\n"); + goto alloc_failed2; + } + + for (i = 0; i < dev_num; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, + nr, i, class, + swpld_mux_select, NULL); + if (!mux->child[i]) { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + platform_set_drvdata(pdev, mux); + return 0; + +add_adapter_failed: + for (; i > 0; i--) + i2c_del_mux_adapter(mux->child[i - 1]); + kfree(mux->child); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} + + +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + int i; + struct swpld_mux *mux = platform_get_drvdata(pdev); + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + switch (pdata->parent) { + case BUS3: + dev_num = BUS3_DEV_NUM; + break; + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + case BUS5: + dev_num = BUS5_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + for (i = 0; i < dev_num; i++) + i2c_del_mux_adapter(mux->child[i]); + + platform_set_drvdata(pdev, NULL); + i2c_put_adapter(mux->parent); + kfree(mux->child); + kfree(mux); + + return 0; +} + +static struct platform_driver swpld_mux_driver = { + .probe = swpld_mux_probe, + .remove = __exit_p(swpld_mux_remove), /* TODO */ + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-swpld-mux", + }, +}; +/*---------------- MUX - end ------------- */ + +/*---------------- module initialization ------------- */ +static void __init delta_ag9032v1_platform_init(void) +{ + struct i2c_client *client; + struct i2c_adapter *adapter; + struct cpld_platform_data *cpld_pdata; + struct swpld_mux_platform_data *swpld_pdata; + int ret,i = 0; + printk("ag9032v1_platform module initialization\n"); + + //Use pca9547 in i2c_mux_pca954x.c + adapter = i2c_get_adapter(BUS1); + //client = i2c_new_device(adapter, &i2c_info_pca9547[0]); + i2c_client_9547 = i2c_new_device(adapter, &i2c_info_pca9547[0]); + + i2c_put_adapter(adapter); + + // set the CPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + // register the mux prob which call the CPLD + ret = platform_driver_register(&swpld_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld mux driver\n"); + goto error_swpld_mux_driver; + } + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + // register the CPLD + ret = platform_device_register(&ag9032v1_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_ag9032v1_cpld; + } + // link the CPLD and the Mux + cpld_pdata = ag9032v1_cpld.dev.platform_data; + + for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) + { + swpld_pdata = ag9032v1_swpld_mux[i].dev.platform_data; + swpld_pdata->cpld = cpld_pdata[system_cpld].client; + ret = platform_device_register(&ag9032v1_swpld_mux[i]); + if (ret) { + printk(KERN_WARNING "Fail to create swpld mux %d\n", i); + goto error_ag9032v1_swpld_mux; + } + } + + for (i = 0; i < ARRAY_SIZE(ag9032v1_i2c_device); i++) + { + ret = platform_device_register(&ag9032v1_i2c_device[i]); + if (ret) { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_ag9032v1_i2c_device; + } + } + + if (ret) + goto error_ag9032v1_swpld_mux; + + return 0; + +error_ag9032v1_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9032v1_i2c_device[i]); + } + i = ARRAY_SIZE(ag9032v1_swpld_mux); +error_ag9032v1_swpld_mux: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9032v1_swpld_mux[i]); + } + platform_driver_unregister(&ag9032v1_cpld); +error_ag9032v1_cpld: + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + platform_driver_unregister(&swpld_mux_driver); +error_swpld_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit delta_ag9032v1_platform_exit(void) +{ + int i = 0; + + for ( i = 0; i < ARRAY_SIZE(ag9032v1_i2c_device); i++ ) { + platform_device_unregister(&ag9032v1_i2c_device[i]); + } + + for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) { + platform_device_unregister(&ag9032v1_swpld_mux[i]); + } + + platform_device_unregister(&ag9032v1_cpld); + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&cpld_driver); + platform_driver_unregister(&swpld_mux_driver); + + i2c_unregister_device(i2c_client_9547); +} + +module_init(delta_ag9032v1_platform_init); +module_exit(delta_ag9032v1_platform_exit); + +MODULE_DESCRIPTION("DNI ag9032v1 Platform Support"); +MODULE_AUTHOR("Neal Tai "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c new file mode 100644 index 000000000000..e47813af3e09 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c @@ -0,0 +1,549 @@ +/* + * An hwmon driver for delta AG9032v1 PSU + * dps_800ab_16_d.c - Support for DPS-800AB-16 D Power Supply Module + * + * Copyright (C) 2016 Delta Network Technology Corporation + * + * DNI + * + * Based on ym2651y.c + * Based on ad7414.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 +#define SWPLD_REG 0x31 +#define SWPLD_PSU_MUX_REG 0x21 +#define SELECT_PSU1_EEPROM 0x00 +#define SELECT_PSU2_EEPROM 0x20 + +u8 psu_member_data = 0x00; + +/* Address scanned */ +static const unsigned short normal_i2c[] = { 0x58, I2C_CLIENT_END }; + +/* This is additional data */ +struct dps_800ab_16_d_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; + unsigned long last_updated; /* In jiffies */ + + /* Registers value */ + u8 vout_mode; + u16 in1_input; + u16 in2_input; + u16 curr1_input; + u16 curr2_input; + u16 power1_input; + u16 power2_input; + u16 temp_input[2]; + u8 fan_target; + u16 fan_duty_cycle_input[2]; + u16 fan_speed_input[2]; + u8 mfr_model[16]; + u8 mfr_serial[16]; +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask); +static ssize_t set_fan_duty_cycle_input(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count); +static ssize_t for_linear_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static ssize_t for_fan_target(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static ssize_t for_vout_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static int dps_800ab_16_d_read_byte(struct i2c_client *client, u8 reg); +static int dps_800ab_16_d_read_word(struct i2c_client *client, u8 reg); +static int dps_800ab_16_d_write_word(struct i2c_client *client, u8 reg, \ + u16 value); +static int dps_800ab_16_d_read_block(struct i2c_client *client, u8 command, \ + u8 *data, int data_len); +static struct dps_800ab_16_d_data *dps_800ab_16_d_update_device( \ + struct device *dev); +static ssize_t for_ascii(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static ssize_t set_w_member_data(struct device *dev, struct device_attribute \ + *dev_att, const char *buf, size_t count); +static ssize_t for_r_member_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); + +enum dps_800ab_16_d_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, + PSU_MFR_MODEL, + PSU_MFR_SERIAL, + PSU_SELECT_MEMBER, +}; + +static ssize_t set_w_member_data(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + long data; + int error; + if (attr->index == PSU_SELECT_MEMBER) { + error = kstrtol(buf, 16, &data); + if (error) + return error; + if (SELECT_PSU1_EEPROM == data) { + psu_member_data = SELECT_PSU1_EEPROM; + } else if (SELECT_PSU2_EEPROM == data) { + psu_member_data = SELECT_PSU2_EEPROM; + } else { + return -EINVAL; + } + } + return count; +} + +static ssize_t for_r_member_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + return sprintf(buf, "0x%02X\n", psu_member_data); +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle_input(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct i2c_client *client = to_i2c_client(dev); + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + /* Select SWPLD PSU offset */ + + mutex_lock(&data->update_lock); + data->fan_duty_cycle_input[nr] = speed; + dps_800ab_16_d_write_word(client, 0x3B + nr, data->fan_duty_cycle_input[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t for_linear_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->in1_input; + break; + case PSU_I_IN: + value = data->curr1_input; + break; + case PSU_I_OUT: + value = data->curr2_input; + break; + case PSU_P_IN: + value = data->power1_input; + multiplier = 1000*1000; + break; + case PSU_P_OUT: + value = data->power2_input; + multiplier = 1000*1000; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle_input[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed_input[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", \ + (mantissa << exponent) * multiplier) : \ + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t for_fan_target(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_target >> shift); +} + +static ssize_t for_vout_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->in2_input; + + return (exponent > 0) ? sprintf(buf, "%d\n", \ + (mantissa * multiplier) / (1 << exponent)): \ + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t for_ascii(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + u8 *ptr = NULL; + + if (!data->valid) + return 0; + + switch (attr->index) { + case PSU_MFR_MODEL: + ptr = data->mfr_model + 1; + break; + case PSU_MFR_SERIAL: + ptr = data->mfr_serial + 1; + break; + default: + return 0; + } + return sprintf(buf, "%s\n", ptr); +} +static int dps_800ab_16_d_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int dps_800ab_16_d_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int dps_800ab_16_d_write_word(struct i2c_client *client, u8 reg, \ + u16 value) +{ + union i2c_smbus_data data; + data.word = value; + return i2c_smbus_xfer(client->adapter, client->addr, + client->flags |= I2C_CLIENT_PEC, + I2C_SMBUS_WRITE, reg, + I2C_SMBUS_WORD_DATA, &data); + +} + +static int dps_800ab_16_d_read_block(struct i2c_client *client, u8 command, \ + u8 *data, int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, + data); + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; +abort: + return result; + +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct dps_800ab_16_d_data *dps_800ab_16_d_update_device( \ + struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + /* Select SWPLD PSU offset */ + + if (time_after(jiffies, data->last_updated)) { + int i, status; + u8 command; + struct reg_data_byte regs_byte[] = { + {0x20, &data->vout_mode}, + {0x81, &data->fan_target} + }; + struct reg_data_word regs_word[] = { + {0x88, &data->in1_input}, + {0x8b, &data->in2_input}, + {0x89, &data->curr1_input}, + {0x8c, &data->curr2_input}, + {0x96, &data->power2_input}, + {0x97, &data->power1_input}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x3b, &(data->fan_duty_cycle_input[0])}, + {0x90, &(data->fan_speed_input[0])}, + }; + + dev_dbg(&client->dev, "start data update\n"); + + /* one milliseconds from now */ + data->last_updated = jiffies + HZ / 1000; + + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = dps_800ab_16_d_read_byte(client, + regs_byte[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + *(regs_byte[i].value) = 0; + } else { + *(regs_byte[i].value) = status; + } + } + + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = dps_800ab_16_d_read_word(client, + regs_word[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + *(regs_word[i].value) = 0; + } else { + *(regs_word[i].value) = status; + } + } + + command = 0x9a; /* PSU mfr_model */ + //data->mfr_model[1] = '\0'; + status = dps_800ab_16_d_read_block(client, command, + data->mfr_model, ARRAY_SIZE(data->mfr_model) - 1); + data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command,status); + data->mfr_model[1] = '\0'; + } + + command = 0x9e; /* PSU mfr_serial */ + //data->mfr_serial[1] = '\0'; + status = dps_800ab_16_d_read_block(client, command, + data->mfr_serial, ARRAY_SIZE(data->mfr_serial) - 1); + data->mfr_serial[ARRAY_SIZE(data->mfr_serial) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command,status); + data->mfr_serial[1] = '\0'; + } + + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; + +} + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, for_linear_data, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, for_vout_data, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, for_linear_data, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, for_linear_data, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, for_linear_data, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, for_linear_data, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(temp1_input, \ + S_IRUGO, for_linear_data, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_target, \ + S_IRUGO, for_fan_target, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUGO | S_IRUGO, \ + for_linear_data, set_fan_duty_cycle_input, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(fan1_input, \ + S_IRUGO, for_linear_data, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_mfr_model, \ + S_IRUGO, for_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, \ + S_IRUGO, for_ascii, NULL, PSU_MFR_SERIAL); +static SENSOR_DEVICE_ATTR(psu_select_member, S_IWUGO | S_IRUGO, \ + for_r_member_data, set_w_member_data, PSU_SELECT_MEMBER); + +static struct attribute *dps_800ab_16_d_attributes[] = { + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_target.dev_attr.attr, + &sensor_dev_attr_fan1_set_percentage.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, + &sensor_dev_attr_psu_select_member.dev_attr.attr, + NULL +}; + +static const struct attribute_group dps_800ab_16_d_group = { + .attrs = dps_800ab_16_d_attributes, +}; + +static int dps_800ab_16_d_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct dps_800ab_16_d_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "new chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &dps_800ab_16_d_group); + if (status) + goto exit_sysfs_create_group; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_hwmon_device_register; + } + + return 0; + +exit_hwmon_device_register: + sysfs_remove_group(&client->dev.kobj, &dps_800ab_16_d_group); +exit_sysfs_create_group: + kfree(data); +exit: + return status; +} + +static int dps_800ab_16_d_remove(struct i2c_client *client) +{ + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &dps_800ab_16_d_group); + kfree(data); + + return 0; +} + +enum id_name { + dni_ag9032v1_psu, + dps_800ab_16_d +}; + +static const struct i2c_device_id dps_800ab_16_d_id[] = { + { "dni_ag9032v1_psu", dni_ag9032v1_psu }, + { "dps_800ab_16_d", dps_800ab_16_d }, + {} +}; +MODULE_DEVICE_TABLE(i2c, dps_800ab_16_d_id); + +/* This is the driver that will be inserted */ +static struct i2c_driver dps_800ab_16_d_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "dps_800ab_16_d", + }, + .probe = dps_800ab_16_d_probe, + .remove = dps_800ab_16_d_remove, + .id_table = dps_800ab_16_d_id, + .address_list = normal_i2c, +}; + +static int __init dps_800ab_16_d_init(void) +{ + return i2c_add_driver(&dps_800ab_16_d_driver); +} + +static void __exit dps_800ab_16_d_exit(void) +{ + i2c_del_driver(&dps_800ab_16_d_driver); +} + + +MODULE_AUTHOR("Aries Lin "); +MODULE_DESCRIPTION("DPS_800AB_16_D Driver"); +MODULE_LICENSE("GPL"); + +module_init(dps_800ab_16_d_init); +module_exit(dps_800ab_16_d_exit); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c new file mode 100644 index 000000000000..73d9900af5b4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c @@ -0,0 +1,381 @@ +/* + * + * + * Copyright (C) 2017 Delta Networks, Inc. + * + * This program is free software; you can redistribute it + * and/or modify it under the terms ofthe GNU General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * + * + * + * + * A hwmon driver for the SMSC EMC2305 fan controller + * Complete datasheet is available (6/2013) at: + * http://www.smsc.com/media/Downloads_Public/Data_Sheets/2305.pdf + */ + +#include +#include +#include +#include +#include + + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf); +static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, + char *buf); +static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, + char *buf); +static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, 0x2F, 0x4C, + 0x4D, I2C_CLIENT_END + }; + + +#define EMC2305_REG_DEVICE 0xFD +#define EMC2305_REG_VENDOR 0xFE + +//#define FAN_MINIMUN 0x33 /*20%*/ +#define FAN_MINIMUN 0x0 /*0%*/ +#define FAN_RPM_BASED 0xAB + +#define EMC2305_REG_FAN_DRIVE(n) (0x30 + 0x10 * n) +#define EMC2305_REG_FAN_MIN_DRIVE(n) (0x38 + 0x10 * n) +#define EMC2305_REG_FAN_TACH(n) (0x3E + 0x10 * n) +#define EMC2305_REG_FAN_CONF(n) (0x32 + 0x10 * n) +#define EMC2305_REG_FAN_REAR_H_RPM(n) (0x3D + 0x10 * n) +#define EMC2305_REG_FAN_REAR_L_RPM(n) (0x3C + 0x10 * n) + +#define EMC2305_DEVICE 0x34 +#define EMC2305_VENDOR 0x5D +#define MAX_FAN_SPEED 23000 + +struct emc2305_data +{ + struct device *hwmon_dev; + struct attribute_group attrs; + struct mutex lock; +}; + +static int emc2305_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int emc2305_detect(struct i2c_client *client, + struct i2c_board_info *info); +static int emc2305_remove(struct i2c_client *client); + +static const struct i2c_device_id emc2305_id[] = +{ + { "emc2305", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, emc2305_id); + +static struct i2c_driver emc2305_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = { + .name = "emc2305", + }, + .probe = emc2305_probe, + .remove = emc2305_remove, + .id_table = emc2305_id, + .detect = emc2305_detect, + .address_list = normal_i2c, +}; + +static SENSOR_DEVICE_ATTR(fan1_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 3); +static SENSOR_DEVICE_ATTR(fan5_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 4); +static SENSOR_DEVICE_ATTR(fan1_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 0); +static SENSOR_DEVICE_ATTR(fan2_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 1); +static SENSOR_DEVICE_ATTR(fan3_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 2); +static SENSOR_DEVICE_ATTR(fan4_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 3); +static SENSOR_DEVICE_ATTR(fan5_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 4); +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 4); + +static struct attribute *emc2305_attr[] = +{ + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan1_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan2_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan3_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan4_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan5_input_percentage.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_pwm5.dev_attr.attr, + NULL +}; + +static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + mutex_lock(&data->lock); + val = i2c_smbus_read_word_swapped(client, + EMC2305_REG_FAN_TACH(attr->index)); + mutex_unlock(&data->lock); + /* Left shift 3 bits for showing correct RPM */ + val = val >> 3; + if ((int)(3932160 * 2 / (val > 0 ? val : 1) == 960))return sprintf(buf, "%d\n", 0); + return sprintf(buf, "%d\n", (int)(3932160 * 2 / (val > 0 ? val : 1) * 100 / MAX_FAN_SPEED)); +} + + +static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long hsb, lsb; + unsigned long tech; + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 100) + { + return -EINVAL; + } + + if (val <= 5) + { + hsb = 0xff; /*high bit*/ + lsb = 0xe0; /*low bit*/ + } + else + { + val = val * 230; + tech = (3932160 * 2) / (val > 0 ? val : 1); + hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); + lsb = (uint8_t)((tech << 3) & 0x0f8); + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); + mutex_unlock(&data->lock); + return count; +} + + +static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + + mutex_lock(&data->lock); + val = i2c_smbus_read_word_swapped(client, + EMC2305_REG_FAN_TACH(attr->index)); + mutex_unlock(&data->lock); + /* Left shift 3 bits for showing correct RPM */ + val = val >> 3; + return sprintf(buf, "%d\n", 3932160 * 2 / (val > 0 ? val : 1)); +} + +static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long hsb, lsb; + unsigned long tech; + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 23000) + { + return -EINVAL; + } + + if (val <= 960) + { + hsb = 0xff; /*high bit*/ + lsb = 0xe0; /*low bit*/ + } + else + { + tech = (3932160 * 2) / (val > 0 ? val : 1); + hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); + lsb = (uint8_t)((tech << 3) & 0x0f8); + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); + mutex_unlock(&data->lock); + return count; +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + mutex_lock(&data->lock); + val = i2c_smbus_read_byte_data(client, + EMC2305_REG_FAN_DRIVE(attr->index)); + mutex_unlock(&data->lock); + return sprintf(buf, "%d\n", val); +} + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 255) + { + return -EINVAL; + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, + EMC2305_REG_FAN_DRIVE(attr->index), + val); + mutex_unlock(&data->lock); + return count; +} + +static int emc2305_detect(struct i2c_client *client, + struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + int vendor, device; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + { + return -ENODEV; + } + + vendor = i2c_smbus_read_byte_data(client, EMC2305_REG_VENDOR); + if (vendor != EMC2305_VENDOR) + { + return -ENODEV; + } + + device = i2c_smbus_read_byte_data(client, EMC2305_REG_DEVICE); + if (device != EMC2305_DEVICE) + { + return -ENODEV; + } + + strlcpy(info->type, "emc2305", I2C_NAME_SIZE); + + return 0; +} + +static int emc2305_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct emc2305_data *data; + int err; + int i; + + data = devm_kzalloc(&client->dev, sizeof(struct emc2305_data), + GFP_KERNEL); + if (!data) + { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s chip found\n", client->name); + + data->attrs.attrs = emc2305_attr; + err = sysfs_create_group(&client->dev.kobj, &data->attrs); + if (err) + { + return err; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + err = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + for (i = 0; i < 5; i++) + { + /* set minimum drive to 0% */ + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_MIN_DRIVE(i), FAN_MINIMUN); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_CONF(i), FAN_RPM_BASED); + } + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &data->attrs); + return err; +} + +static int emc2305_remove(struct i2c_client *client) +{ + struct emc2305_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &data->attrs); + return 0; +} + +module_i2c_driver(emc2305_driver); + +MODULE_AUTHOR("Neal Tai"); +MODULE_DESCRIPTION("SMSC EMC2305 fan controller driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh new file mode 100755 index 000000000000..c5f897ff007f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +#platform init script for Delta ag9032v1 + +#fan speed monitol start +/usr/share/sonic/device/x86_64-delta_ag9032v1-r0/fancontrol.service /usr/share/sonic/device/x86_64-delta_ag9032v1-r0/fancontrol & + +exit 0 + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh new file mode 100755 index 000000000000..5685bd71f58c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh @@ -0,0 +1,225 @@ +#!/bin/bash + +FAN1_EEPROM="-y 31 0x51 0x0a" +FAN2_EEPROM="-y 32 0x52 0x0a" +FAN3_EEPROM="-y 33 0x53 0x0a" +FAN4_EEPROM="-y 34 0x54 0x0a" +FAN5_EEPROM="-y 35 0x55 0x0a" +LED_CONTROL="/sys/devices/platform/delta-ag9032v1-cpld.0/led_control" +FAN1_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan5_input" +FAN1_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan5_input" +FAN2_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan4_input" +FAN2_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan4_input" +FAN3_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan3_input" +FAN3_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan3_input" +FAN4_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan2_input" +FAN4_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan2_input" +FAN5_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan1_input" +FAN5_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan1_input" + +PSU1_EEPROM="-y 40 0x50 0x00" +PSU2_EEPROM="-y 41 0x50 0x00" +PSU1_FAN_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-4/i2c-40/40-0058/fan1_input" +PSU2_FAN_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-4/i2c-41/41-0058/fan1_input" + +catfaneeprom(){ + fan_eeprom_num=0 + i2cget $FAN1_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi + i2cget $FAN2_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num_num)) + fi + + i2cget $FAN3_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi + + i2cget $FAN4_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi + + i2cget $FAN5_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi +} + +catfanspeed(){ + fan_rpm_normal_num=0 + fan1_rpm_normal_num=0 + fan1_front_rpm=`cat $FAN1_FRONT_RPM` + fan1_rear_rpm=`cat $FAN1_REAR_RPM` + if [ "${fan1_front_rpm}" -ne "960" ] && [ "${fan1_rear_rpm}" -ne "960" ] && [ "${fan1_front_rpm}" -ne "0" ] && [ "${fan1_rear_rpm}" -ne "0" ]; then + fan1_rpm_normal_num=$((fan1_rpm_normal_num+1)) + elif [ "${fan1_front_rpm}" -eq "960" ] || [ "${fan1_rear_rpm}" -eq "960" ] || [ "${fan1_front_rpm}" -eq "0" ] || [ "${fan1_rear_rpm}" -eq "0" ]; then + fan1_rpm_normal_num=$((fan1_rpm_normal_num)) + fi + + fan2_rpm_normal_num=0 + fan2_front_rpm=`cat $FAN2_FRONT_RPM` + fan2_rear_rpm=`cat $FAN2_REAR_RPM` + if [ "${fan2_front_rpm}" -ne "960" ] && [ "${fan2_rear_rpm}" -ne "960" ] && [ "${fan2_front_rpm}" -ne "0" ] && [ "${fan2_rear_rpm}" -ne "0" ]; then + fan2_rpm_normal_num=$((fan2_rpm_normal_num+1)) + elif [ "${fan2_front_rpm}" -eq "960" ] || [ "${fan2_rear_rpm}" -eq "960" ] || [ "${fan2_front_rpm}" -eq "0" ] || [ "${fan2_rear_rpm}" -eq "0" ]; then + fan2_rpm_normal_num=$((fan2_rpm_normal_num)) + fi + + fan3_rpm_normal_num=0 + fan3_front_rpm=`cat $FAN3_FRONT_RPM` + fan3_rear_rpm=`cat $FAN3_REAR_RPM` + if [ "${fan3_front_rpm}" -ne "960" ] && [ "${fan3_rear_rpm}" -ne "960" ] && [ "${fan3_front_rpm}" -ne "0" ] && [ "${fan3_rear_rpm}" -ne "0" ]; then + fan3_rpm_normal_num=$((fan3_rpm_normal_num+1)) + elif [ "${fan3_front_rpm}" -eq "960" ] || [ "${fan3_rear_rpm}" -eq "960" ] || [ "${fan3_front_rpm}" -eq "0" ] || [ "${fan3_rear_rpm}" -eq "0" ]; then + fan3_rpm_normal_num=$((fan3_rpm_normal_num)) + fi + + fan4_rpm_normal_num=0 + fan4_front_rpm=`cat $FAN4_FRONT_RPM` + fan4_rear_rpm=`cat $FAN4_REAR_RPM` + if [ "${fan4_front_rpm}" -ne "960" ] && [ "${fan4_rear_rpm}" -ne "960" ] && [ "${fan4_front_rpm}" -ne "0" ] && [ "${fan4_rear_rpm}" -ne "0" ]; then + fan4_rpm_normal_num=$((fan4_rpm_normal_num+1)) + elif [ "${fan4_front_rpm}" -eq "960" ] || [ "${fan4_rear_rpm}" -eq "960" ] || [ "${fan4_front_rpm}" -eq "0" ] || [ "${fan4_rear_rpm}" -eq "0" ]; then + fan4_rpm_normal_num=$((fan4_rpm_normal_num)) + fi + + fan5_rpm_normal_num=0 + fan5_front_rpm=`cat $FAN5_FRONT_RPM` + fan5_rear_rpm=`cat $FAN5_REAR_RPM` + if [ "${fan5_front_rpm}" -ne "960" ] && [ "${fan5_rear_rpm}" -ne "960" ] && [ "${fan5_front_rpm}" -ne "0" ] && [ "${fan5_rear_rpm}" -ne "0" ]; then + fan5_rpm_normal_num=$((fan5_rpm_normal_num+1)) + elif [ "${fan5_front_rpm}" -eq "960" ] || [ "${fan5_rear_rpm}" -eq "960" ] || [ "${fan5_front_rpm}" -eq "0" ] || [ "${fan5_rear_rpm}" -eq "0" ]; then + fan5_rpm_normal_num=$((fan5_rpm_normal_num)) + fi + + fan_rpm_normal_num=$((fan1_rpm_normal_num+fan2_rpm_normal_num+fan3_rpm_normal_num+fan4_rpm_normal_num+fan5_rpm_normal_num)) + +} + +catpsueeprom(){ + psu1_eeprom_num=0 + i2cget $PSU1_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + psu1_eeprom_num=$((psu1_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + psu1_eeprom_num=$((psu1_eeprom_num)) + fi + + psu2_eeprom_num=0 + i2cget $PSU2_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + psu2_eeprom_num=$((psu2_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + psu2_eeprom_num=$((psu2_eeprom_num)) + fi +} + +catpsufanspeed(){ + + psu1_rpm_normal_num=0 + psu1_rpm=`cat $PSU1_FAN_RPM` + + if [ "${psu1_rpm}" -ne "960" ] && [ "${psu1_rpm}" -ne "0" ]; then + psu1_rpm_normal_num=$((psu1_rpm_normal_num+1)) + elif [ "${psu1_rpm}" -eq "960" ] || [ "${psu1_rpm}" -eq "0" ]; then + psu1_rpm_normal_num=$((psu1_rpm_normal_num)) + fi + + psu2_rpm_normal_num=0 + psu2_rpm=`cat $PSU2_FAN_RPM` + + if [ "${psu2_rpm}" -ne "960" ] && [ "${psu2_rpm}" -ne "0" ]; then + psu2_rpm_normal_num=$((psu2_rpm_normal_num+1)) + elif [ "${psu2_rpm}" -eq "960" ] || [ "${psu2_rpm}" -eq "0" ]; then + psu2_rpm_normal_num=$((psu2_rpm_normal_num)) + fi + +} + +setfanled(){ + if [ "${fan_eeprom_num}" -eq "5" ] && [ "${fan_rpm_normal_num}" -eq "5" ]; then + echo "fan_green" > $LED_CONTROL + elif [ "${fan_eeprom_num}" -lt "5" ] || [ "${fan_rpm_normal_num}" -lt "5" ]; then + echo "fan_amber" > $LED_CONTROL + fi +} + +setpsuled(){ + if [ "${psu1_eeprom_num}" -eq "1" ] && [ "${psu1_rpm_normal_num}" -eq "1" ]; then + echo "pwr1_green" > $LED_CONTROL + elif [ "${psu1_eeprom_num}" -eq "0" ] || [ "${psu1_rpm_normal_num}" -eq "0" ]; then + echo "pwr1_amber" > $LED_CONTROL + fi + + if [ "${psu2_eeprom_num}" -eq "1" ] && [ "${psu2_rpm_normal_num}" -eq "1" ]; then + echo "pwr2_green" > $LED_CONTROL + elif [ "${psu2_eeprom_num}" -eq "0" ] || [ "${psu2_rpm_normal_num}" -eq "0" ]; then + echo "pwr2_amber" > $LED_CONTROL + fi +} + +setfantrayled(){ + if [ "${fan1_rpm_normal_num}" -eq "1" ]; then + echo "fan1_green" > $LED_CONTROL + else + echo "fan1_red" > $LED_CONTROL + fi + + if [ "${fan2_rpm_normal_num}" -eq "1" ]; then + echo "fan2_green" > $LED_CONTROL + else + echo "fan2_red" > $LED_CONTROL + fi + + if [ "${fan3_rpm_normal_num}" -eq "1" ]; then + echo "fan3_green" > $LED_CONTROL + else + echo "fan3_red" > $LED_CONTROL + fi + + if [ "${fan4_rpm_normal_num}" -eq "1" ]; then + echo "fan4_green" > $LED_CONTROL + else + echo "fan4_red" > $LED_CONTROL + fi + + if [ "${fan5_rpm_normal_num}" -eq "1" ]; then + echo "fan5_green" > $LED_CONTROL + else + echo "fan5_red" > $LED_CONTROL + fi +} + +platformstatus(){ + + echo "sys_green" > $LED_CONTROL + catfaneeprom + catfanspeed + setfanled + setfantrayled + + catpsueeprom + catpsufanspeed + setpsuled +} + +while true +do + platformstatus + sleep 1 +done + diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/changelog b/platform/broadcom/sonic-platform-modules-delta/debian/changelog new file mode 100644 index 000000000000..ec8327e8ae7a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/changelog @@ -0,0 +1,5 @@ +sonic-delta-platform-modules (1.1) unstable; urgency=low + + * Initial release + + -- Neal Tai Fri, 21 APR 2017 11:11:11 -0800 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/compat b/platform/broadcom/sonic-platform-modules-delta/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control new file mode 100644 index 000000000000..7ad1550415be --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -0,0 +1,11 @@ +Source: sonic-delta-platform-modules +Section: main +Priority: extra +Maintainer: Neal Tai +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-ag9032v1 +Architecture: amd64 +Depends: linux-image-3.16.0-4-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/files b/platform/broadcom/sonic-platform-modules-delta/debian/files new file mode 100644 index 000000000000..ece02f8e80e2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/files @@ -0,0 +1 @@ +platform-modules-ag9032v1_1.1_amd64.deb main extra diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init new file mode 100755 index 000000000000..9b829652fd57 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init @@ -0,0 +1,49 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup ag9032v1 board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + depmod -a + rmmod i2c-i801 + rmmod i2c-ismt + modprobe i2c-dev + modprobe i2c-i801 + modprobe i2c-ismt + modprobe i2c-mux-pca954x + modprobe dni_ag9032v1_psu + modprobe dni_emc2305 + modprobe at24 + modprobe delta_ag9032v1_platform + + /usr/local/bin/ag9032v1_platform_init.sh + + echo "done." + ;; + +stop) + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-ag9032v1.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install new file mode 100644 index 000000000000..40f7e56d832d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install @@ -0,0 +1,3 @@ +ag9032v1/scripts/ag9032v1_platform_init.sh usr/local/bin +ag9032v1/scripts/led_status.sh usr/local/bin +ag9032v1/cfg/ag9032v1-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules new file mode 100755 index 000000000000..ae590626c817 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -0,0 +1,33 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= ag9032v1 + +%: + dh $@ + +override_dh_auto_build: + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + done) + +override_dh_auto_install: + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -pplatform-modules-$${mod} \ + $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ + debian/platform-modules-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + done) + +override_dh_usrlocal: + +override_dh_clean: + dh_clean + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ + done) + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index e66b8839da21..f2dc0aa6b96a 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit e66b8839da2180fd586aae040701faf180d59477 +Subproject commit f2dc0aa6b96ab293b4ae6ebf3a942851dd9324b7 diff --git a/platform/broadcom/sonic-platform-modules-s6000 b/platform/broadcom/sonic-platform-modules-s6000 index 1f6c70e7db89..952208ce52d8 160000 --- a/platform/broadcom/sonic-platform-modules-s6000 +++ b/platform/broadcom/sonic-platform-modules-s6000 @@ -1 +1 @@ -Subproject commit 1f6c70e7db890851510a36892b602c534e4f41a7 +Subproject commit 952208ce52d88095da9591cc548d1e013f363476 diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 57ebb2fd1534..a171a6c801d7 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_CAVM)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/cavium/libsaithrift-dev.mk b/platform/cavium/libsaithrift-dev.mk index 4a19fabffaf2..b7203d8d1077 100644 --- a/platform/cavium/libsaithrift-dev.mk +++ b/platform/cavium/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_CAVM = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_CAVM)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_CAVM = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_CAVM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_CAVM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(CAVM_LIBSAI) $(CAVM_SAI) $(LIBSAITHRIFT_DEV_CAVM)_RDEPENDS += $(LIBTHRIFT) $(CAVM_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_CAVM) diff --git a/platform/cavium/one-image.mk b/platform/cavium/one-image.mk index 33bcd92cc047..696578451990 100644 --- a/platform/cavium/one-image.mk +++ b/platform/cavium/one-image.mk @@ -3,7 +3,7 @@ SONIC_ONE_IMAGE = sonic-cavium.bin $(SONIC_ONE_IMAGE)_MACHINE = cavium $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(CAVM_PLATFORM_DEB) -$(SONIC_ONE_IMAGE)_DEPENDS += $(CAVM_XPNET_DEB) +$(SONIC_ONE_IMAGE)_INSTALLS += $(CAVM_PLATFORM_DEB) +$(SONIC_ONE_IMAGE)_INSTALLS += $(CAVM_XPNET_DEB) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/cavium/python-saithrift.mk b/platform/cavium/python-saithrift.mk index 91d00ebaebc0..22c38503a6b1 100644 --- a/platform/cavium/python-saithrift.mk +++ b/platform/cavium/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_CAVM = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_CAVM)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_CAVM = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_CAVM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_CAVM)_DEPENDS += $(CAVM_LIBSAI) $(CAVM_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_CAVM) diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index 695e481546b1..e1d7fd6cf0d6 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_CENTEC)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/centec/libsaithrift-dev.mk b/platform/centec/libsaithrift-dev.mk index b8fddbdf7731..7e148d9df00c 100644 --- a/platform/centec/libsaithrift-dev.mk +++ b/platform/centec/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_CENTEC = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_CENTEC)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_CENTEC = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_CENTEC)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_CENTEC)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(CENTEC_SAI) $(LIBSAITHRIFT_DEV_CENTEC)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_CENTEC) diff --git a/platform/centec/one-image.mk b/platform/centec/one-image.mk index 49c27aea4261..7ad205dce521 100644 --- a/platform/centec/one-image.mk +++ b/platform/centec/one-image.mk @@ -3,6 +3,6 @@ SONIC_ONE_IMAGE = sonic-centec.bin $(SONIC_ONE_IMAGE)_MACHINE = centec $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(CENTEC_SDK_KERNEL) +$(SONIC_ONE_IMAGE)_INSTALLS += $(CENTEC_SDK_KERNEL) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/centec/python-saithrift.mk b/platform/centec/python-saithrift.mk index 37d1e935c041..0d320cba5619 100644 --- a/platform/centec/python-saithrift.mk +++ b/platform/centec/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_CENTEC = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_CENTEC)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_CENTEC = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_CENTEC)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_CENTEC)_DEPENDS += $(CENTEC_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_CENTEC) diff --git a/platform/centec/sai.mk b/platform/centec/sai.mk index de8615ac132c..299b36a69ebf 100644 --- a/platform/centec/sai.mk +++ b/platform/centec/sai.mk @@ -1,5 +1,5 @@ # Centec SAI CENTEC_SAI = libsai_1.0.0_amd64.deb -$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_0.9.4/libsai_1.0.0_amd64.deb +$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.0/libsai_1.0.0_amd64.deb SONIC_ONLINE_DEBS += $(CENTEC_SAI) diff --git a/platform/centec/sdk.mk b/platform/centec/sdk.mk index ac1939122f47..e3ce05f6b742 100644 --- a/platform/centec/sdk.mk +++ b/platform/centec/sdk.mk @@ -1,4 +1,4 @@ CENTEC_SDK_KERNEL = centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb -$(CENTEC_SDK_KERNEL)_URL = "https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb" +$(CENTEC_SDK_KERNEL)_URL = "https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.0/centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb" SONIC_ONLINE_DEBS += $(CENTEC_SDK_KERNEL) diff --git a/platform/generic/aboot-image.mk b/platform/generic/aboot-image.mk index 7f5b4639e4e9..ecc91bba54c0 100644 --- a/platform/generic/aboot-image.mk +++ b/platform/generic/aboot-image.mk @@ -3,6 +3,6 @@ SONIC_GENERIC_ABOOT_IMAGE = sonic-aboot-generic.swi $(SONIC_GENERIC_ABOOT_IMAGE)_MACHINE = generic $(SONIC_GENERIC_ABOOT_IMAGE)_IMAGE_TYPE = aboot -$(SONIC_GENERIC_ABOOT_IMAGE)_DEPENDS = +$(SONIC_GENERIC_ABOOT_IMAGE)_INSTALLS = $(SONIC_GENERIC_ABOOT_IMAGE)_DOCKERS = SONIC_INSTALLERS += $(SONIC_GENERIC_ABOOT_IMAGE) diff --git a/platform/generic/onie-image.mk b/platform/generic/onie-image.mk index 67f8adba61e1..1a2ddb143505 100644 --- a/platform/generic/onie-image.mk +++ b/platform/generic/onie-image.mk @@ -3,6 +3,6 @@ SONIC_GENERIC_ONIE_IMAGE = sonic-generic.bin $(SONIC_GENERIC_ONIE_IMAGE)_MACHINE = generic $(SONIC_GENERIC_ONIE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_GENERIC_ONIE_IMAGE)_DEPENDS = +$(SONIC_GENERIC_ONIE_IMAGE)_INSTALLS = $(SONIC_GENERIC_ONIE_IMAGE)_DOCKERS = SONIC_INSTALLERS += $(SONIC_GENERIC_ONIE_IMAGE) diff --git a/platform/marvell/docker-orchagent-mrvl.mk b/platform/marvell/docker-orchagent-mrvl.mk index 9461cafe2e89..f2cb0c997d75 100644 --- a/platform/marvell/docker-orchagent-mrvl.mk +++ b/platform/marvell/docker-orchagent-mrvl.mk @@ -15,3 +15,4 @@ $(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_MRVL)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_MRVL)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/marvell/libsaithrift-dev.mk b/platform/marvell/libsaithrift-dev.mk index 443406e9c2fb..e5b30f412bfa 100644 --- a/platform/marvell/libsaithrift-dev.mk +++ b/platform/marvell/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_MRVL = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_MRVL)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_MRVL = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_MRVL)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_MRVL)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MRVL_FPA) $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL)_RDEPENDS += $(LIBTHRIFT) $(MRVL_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MRVL) diff --git a/platform/marvell/python-saithrift.mk b/platform/marvell/python-saithrift.mk index f7a63b19edb8..5830c982da99 100644 --- a/platform/marvell/python-saithrift.mk +++ b/platform/marvell/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_MRVL = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_MRVL)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_MRVL = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_MRVL)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_MRVL)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MRVL) diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 20aa38335361..6dda3c446b06 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_MLNX)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/mellanox/docker-ptf-mlnx.mk b/platform/mellanox/docker-ptf-mlnx.mk index 9f994f62de64..7f23dc715e32 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-rpc/ptf_nn_agent.conf b/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf index fa1ed0eb1622..cd6a7d4db75d 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf +++ b/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf @@ -1,5 +1,5 @@ [program:ptf_nn_agent] -command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-nn-rcv-buffer=109430400 --set-iface-rcv-buffer=109430400 --set-nn-snd-buffer=109430400 --set-iface-snd-buffer=109430400 process_name=ptf_nn_agent stdout_logfile=/tmp/ptf_nn_agent.out.log stderr_logfile=/tmp/ptf_nn_agent.err.log diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 8c40d46d9182..3eef7ca37b5f 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1400.0126 +MLNX_FW_VERSION = 13.1534.0164 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 39222be39cab..77c27aa7ab09 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/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 bba10132160d..1a73cb80a660 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = sonic1.9.1fixes-master -MLNX_SAI_REVISION = dc0e84b3762f847369524a917e271ceb2878b4d3 +MLNX_SAI_VERSION = SAIRel1.9.2-master +MLNX_SAI_REVISION = d098a2c89cd700d9c1278e448fd6bb047cbd59e2 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index db8826951ca8..6f478ba76a51 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -3,7 +3,7 @@ SONIC_ONE_IMAGE = sonic-mellanox.bin $(SONIC_ONE_IMAGE)_MACHINE = mellanox $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) +$(SONIC_ONE_IMAGE)_INSTALLS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) $(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW_FILE) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/mellanox/python-saithrift.mk b/platform/mellanox/python-saithrift.mk index 59685121e02c..a4485da0ca90 100644 --- a/platform/mellanox/python-saithrift.mk +++ b/platform/mellanox/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_MLNX = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_MLNX)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_MLNX = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_MLNX)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/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 d67401df245d..1651f4a66806 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -15,7 +15,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(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 7c517627c23d..5aaee09fdb1d 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,10 +1,10 @@ -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) \ +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/564703412781016766b248b98266bd6f2c161431/sdk +MLNX_SDK_VERSION = 4.2.6011 +MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) -MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_DEV) $(SX_ACL_RM_DEV) \ +MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_ACL_RM_DEV) \ $(SX_COMPLIB_DEV) $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) \ $(SX_GEN_UTILS_DEV) $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) \ $(SX_SDN_HAL_DEV) $(SX_SDN_HAL_DEV_STATIC) $(SXD_LIBS_DEV) \ @@ -14,9 +14,9 @@ APPLIBS = applibs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(APPLIBS)_DEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3) APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV))) -IPROUTE2 = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -IPROUTE2_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(IPROUTE2),$(IPROUTE2_DEV))) +IPROUTE2_MLNX = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +IPROUTE2_MLNX_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_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))) diff --git a/platform/nephos/docker-orchagent-nephos.mk b/platform/nephos/docker-orchagent-nephos.mk new file mode 100644 index 000000000000..b21e69d6cf87 --- /dev/null +++ b/platform/nephos/docker-orchagent-nephos.mk @@ -0,0 +1,19 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_NEPHOS = docker-orchagent-nephos.gz +$(DOCKER_ORCHAGENT_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_NEPHOS)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) + +$(DOCKER_ORCHAGENT_NEPHOS)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw + +$(DOCKER_ORCHAGENT_NEPHOS)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_NEPHOS)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/nephos/docker-ptf-nephos.mk b/platform/nephos/docker-ptf-nephos.mk new file mode 100644 index 000000000000..7fbbd271cf65 --- /dev/null +++ b/platform/nephos/docker-ptf-nephos.mk @@ -0,0 +1,7 @@ +# docker image for docker-ptf-nephos + +DOCKER_PTF_NEPHOS = docker-ptf-nephos.gz +$(DOCKER_PTF_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift +$(DOCKER_PTF_NEPHOS)_DEPENDS += $(PYTHON_SAITHRIFT_NEPHOS) +$(DOCKER_PTF_NEPHOS)_LOAD_DOCKERS += $(DOCKER_PTF) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_NEPHOS) diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk new file mode 100644 index 000000000000..e891d0b1a68d --- /dev/null +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -0,0 +1,17 @@ +# docker image for nephos syncd with rpc + +DOCKER_SYNCD_NEPHOS_RPC = docker-syncd-nephos-rpc.gz +$(DOCKER_SYNCD_NEPHOS_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-nephos-rpc +$(DOCKER_SYNCD_NEPHOS_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) +$(DOCKER_SYNCD_NEPHOS_RPC)_FILES += $(DSSERVE) $(NPX_DIAG) +$(DOCKER_SYNCD_NEPHOS_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_NEPHOS) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) +endif + +$(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 new file mode 100644 index 000000000000..9a01d4e1e001 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 @@ -0,0 +1,51 @@ +FROM docker-syncd-nephos + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY \ +{% for deb in docker_syncd_nephos_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -P syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_syncd_nephos_rpc_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/nephos/docker-syncd-nephos-rpc/ptf_nn_agent.conf b/platform/nephos/docker-syncd-nephos-rpc/ptf_nn_agent.conf new file mode 100644 index 000000000000..fa1ed0eb1622 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/nephos/docker-syncd-nephos.mk b/platform/nephos/docker-syncd-nephos.mk new file mode 100644 index 000000000000..a79c8524b890 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos.mk @@ -0,0 +1,19 @@ +# docker image for nephos syncd + +DOCKER_SYNCD_NEPHOS = docker-syncd-nephos.gz +$(DOCKER_SYNCD_NEPHOS)_PATH = $(PLATFORM_PATH)/docker-syncd-nephos +$(DOCKER_SYNCD_NEPHOS)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_NEPHOS)_FILES += $(DSSERVE) $(NPX_DIAG) +$(DOCKER_SYNCD_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS) +endif + +$(DOCKER_SYNCD_NEPHOS)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_SYNCD_NEPHOS)_BASE_IMAGE_FILES += npx_diag:/usr/bin/npx_diag diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 new file mode 100755 index 000000000000..e0248d460a12 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -0,0 +1,31 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY \ +{% for deb in docker_syncd_nephos_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_syncd_nephos_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +COPY ["files/dsserve", "files/npx_diag", "start.sh", "/usr/bin/"] +RUN chmod +x /usr/bin/dsserve /usr/bin/npx_diag + +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/nephos/docker-syncd-nephos/base_image_files/npx_diag b/platform/nephos/docker-syncd-nephos/base_image_files/npx_diag new file mode 100755 index 000000000000..876bc1816ecc --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/base_image_files/npx_diag @@ -0,0 +1,3 @@ +#!/bin/bash + +docker exec -i syncd npx_diag "$@" diff --git a/platform/nephos/docker-syncd-nephos/start.sh b/platform/nephos/docker-syncd-nephos/start.sh new file mode 100755 index 000000000000..623316050475 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/start.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start syncd diff --git a/platform/nephos/docker-syncd-nephos/supervisord.conf b/platform/nephos/docker-syncd-nephos/supervisord.conf new file mode 100644 index 000000000000..1af5d70a1d0c --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd_start.sh +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/nephos/libsaithrift-dev.mk b/platform/nephos/libsaithrift-dev.mk new file mode 100644 index 000000000000..44d92ef6db7b --- /dev/null +++ b/platform/nephos/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI +$(LIBSAITHRIFT_DEV_NEPHOS)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) +$(LIBSAITHRIFT_DEV_NEPHOS)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_NEPHOS) diff --git a/platform/nephos/one-image.mk b/platform/nephos/one-image.mk new file mode 100644 index 000000000000..8e9406dca89c --- /dev/null +++ b/platform/nephos/one-image.mk @@ -0,0 +1,10 @@ +# sonic nephos one image installer + +SONIC_ONE_IMAGE = sonic-nephos.bin +$(SONIC_ONE_IMAGE)_MACHINE = nephos +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_INSTALLS += $(NEPHOS_NPS_KERNEL) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) \ + $(INGRASYS_S9230_64X_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/nephos/platform-modules-ingrasys.mk b/platform/nephos/platform-modules-ingrasys.mk new file mode 100644 index 000000000000..dde33e0b8745 --- /dev/null +++ b/platform/nephos/platform-modules-ingrasys.mk @@ -0,0 +1,18 @@ +# Ingrasys S9130-32X and S9230-64X Platform modules + +INGRASYS_S9130_32X_PLATFORM_MODULE_VERSION = 1.0.0 +INGRASYS_S9230_64X_PLATFORM_MODULE_VERSION = 1.0.0 + +export INGRASYS_S9130_32X_PLATFORM_MODULE_VERSION +export INGRASYS_S9230_64X_PLATFORM_MODULE_VERSION + +INGRASYS_S9130_32X_PLATFORM_MODULE = sonic-platform-ingrasys-s9130-32x_$(INGRASYS_S9130_32X_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9130_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys +$(INGRASYS_S9130_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(INGRASYS_S9130_32X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9130_32x-r0 +SONIC_DPKG_DEBS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) + +INGRASYS_S9230_64X_PLATFORM_MODULE = sonic-platform-ingrasys-s9230-64x_$(INGRASYS_S9230_64X_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9230_64X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9230_64x-r0 + +$(eval $(call add_extra_package,$(INGRASYS_S9130_32X_PLATFORM_MODULE),$(INGRASYS_S9230_64X_PLATFORM_MODULE))) diff --git a/platform/nephos/platform.conf b/platform/nephos/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/python-saithrift.mk b/platform/nephos/python-saithrift.mk new file mode 100644 index 000000000000..e0c56f4053ec --- /dev/null +++ b/platform/nephos/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_NEPHOS = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI +$(PYTHON_SAITHRIFT_NEPHOS)_DEPENDS += $(NEPHOS_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_NEPHOS) diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk new file mode 100644 index 000000000000..96f39ef8aad1 --- /dev/null +++ b/platform/nephos/rules.mk @@ -0,0 +1,26 @@ +include $(PLATFORM_PATH)/sdk.mk +include $(PLATFORM_PATH)/sai.mk +include $(PLATFORM_PATH)/platform-modules-ingrasys.mk +include $(PLATFORM_PATH)/docker-orchagent-nephos.mk +include $(PLATFORM_PATH)/docker-syncd-nephos.mk +include $(PLATFORM_PATH)/docker-syncd-nephos-rpc.mk +include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk +include $(PLATFORM_PATH)/docker-ptf-nephos.mk + +NPX_DIAG = npx_diag +$(NPX_DIAG)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/npx_diag" + +DSSERVE = dsserve +$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/dsserve?sv=2015-04-05&sr=b&sig=gyNbgSL%2FvpMXDdpboVkIJcTKMRdGgEaOR9OukHhEsu8%3D&se=2030-03-31T23%3A06%3A35Z&sp=r" + +SONIC_ONLINE_FILES += $(NPX_DIAG) $(DSSERVE) + +SONIC_ALL += $(SONIC_ONE_IMAGE) $(DOCKER_FPM) + +# Inject nephos sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(LIBSAITHRIFT_DEV_NEPHOS) + +# Runtime dependency on nephos sai is set only for syncd +$(SYNCD)_RDEPENDS += $(NEPHOS_SAI) diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk new file mode 100644 index 000000000000..2da9e1f2c4fa --- /dev/null +++ b/platform/nephos/sai.mk @@ -0,0 +1,9 @@ +NEPHOS_SAI = libsainps_2.0.3a63-20180110_amd64.deb +$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3a63-20180110_amd64.deb" + +NEPHOS_SAI_DEV = libsainps-dev_2.0.3a63-20180110_amd64.deb +$(eval $(call add_derived_package,$(NEPHOS_SAI),$(NEPHOS_SAI_DEV))) +$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.3a63-20180110_amd64.deb" + +SONIC_ONLINE_DEBS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) +$(NEPHOS_SAI_DEV)_DEPENDS += $(NEPHOS_SAI) diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk new file mode 100644 index 000000000000..1bc7fe35c0d1 --- /dev/null +++ b/platform/nephos/sdk.mk @@ -0,0 +1,4 @@ +NEPHOS_NPS_KERNEL = nps-modules-3.16.0-4-amd64_2.0.3a63-20180110_amd64.deb +$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-4-amd64_2.0.3a63-20180110_amd64.deb" + +SONIC_ONLINE_DEBS += $(NEPHOS_NPS_KERNEL) diff --git a/platform/nephos/sonic-platform-modules-ingrasys b/platform/nephos/sonic-platform-modules-ingrasys new file mode 160000 index 000000000000..b03499ed1d72 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-ingrasys @@ -0,0 +1 @@ +Subproject commit b03499ed1d72a239ed386e40370b146c9a479eaa diff --git a/platform/p4/SAI-P4-BM b/platform/p4/SAI-P4-BM new file mode 160000 index 000000000000..c763924affd4 --- /dev/null +++ b/platform/p4/SAI-P4-BM @@ -0,0 +1 @@ +Subproject commit c763924affd416df9c4d3e40d4f8ac1cb2be5fff diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index a23284e50374..1cd15439fb77 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -2,15 +2,28 @@ DOCKER_SONIC_P4 = docker-sonic-p4.gz $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 -$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) +$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) \ + $(SYNCD) \ + $(P4_SWITCH) \ + $(REDIS_SERVER) \ + $(REDIS_TOOLS) \ + $(PYTHON_SWSSCOMMON) \ + $(LIBTEAMDCT) \ + $(LIBTEAM_UTILS) \ + $(SONIC_DEVICE_DATA) \ + $(SONIC_UTILS) \ + $(IPROUTE2) -ifeq ($(ROUTING_STACK), quagga) +# ifeq ($(ROUTING_STACK), quagga) $(DOCKER_SONIC_P4)_DEPENDS += $(QUAGGA) -else ifeq ($(ROUTING_STACK), frr) -$(DOCKER_SONIC_P4)_DEPENDS += $(FRR) -else -$(DOCKER_SONIC_P4)_DEPENDS += $(GOBGP) -endif +# else ifeq ($(ROUTING_STACK), frr) +# $(DOCKER_SONIC_P4)_DEPENDS += $(FRR) +# else +# $(DOCKER_SONIC_P4)_DEPENDS += $(GOBGP) +# endif -$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_SONIC_P4)_FILES += $(CONFIGDB_LOAD_SCRIPT) \ + $(ARP_UPDATE_SCRIPT) + +$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 1b8d1746b2bb..95ac5cc1646d 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -1,11 +1,47 @@ -FROM docker-base +FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +COPY ["sonic-dev.gpg.key", "/etc/apt/"] +RUN apt-key add /etc/apt/sonic-dev.gpg.key +RUN echo "deb http://packages.microsoft.com/repos/sonic-dev/ jessie main" >> /etc/apt/sources.list RUN apt-get update -RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 openssh-client openssh-server libc-ares2 iproute +RUN apt-get install -y net-tools \ + arping \ + ethtool \ + tcpdump \ + ifupdown \ + bridge-utils \ + python-ply \ + libqt5core5a \ + libqt5network5 \ + libboost-program-options1.55.0 \ + libboost-system1.55.0 \ + libboost-thread1.55.0 \ + libgmp10 \ + libjudydebian1 \ + libnanomsg0 \ + libdaemon0 \ + libjansson4 \ + libjemalloc1 \ + openssh-client \ + openssh-server \ + libc-ares2 \ + iproute \ + libpython2.7 \ + grub2-common \ + python-click-default-group \ + python-click \ + python-natsort \ + python-tabulate \ + bash-completion \ + libelf1 \ + libmnl0 + +RUN pip install setuptools +RUN pip install py2_ipaddress COPY \ {% for deb in docker_sonic_p4_debs.split(' ') -%} @@ -18,19 +54,26 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -ADD port_config.ini /port_config.ini -ADD startup.sh /scripts/startup.sh - -ADD rsyslog.conf /etc/rsyslog.conf - ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -RUN sed -ri 's/^daemonize yes$/daemonize no/; \ +RUN sed -ri 's/^(save .*$)/# \1/g; \ + s/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/ \ + s/^# unixsocket/unixsocket/; \ + s/notify-keyspace-events ""/notify-keyspace-events AKE/; \ + s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ ' /etc/redis/redis.conf -ENTRYPOINT /bin/bash +ADD port_config.ini /port_config.ini +ADD rsyslog.conf /etc/rsyslog.conf +COPY ["start.sh", "orchagent.sh", "config_bm.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/configdb-load.sh", "/usr/bin/"] +COPY ["files/arp_update", "/usr/bin"] +RUN echo "docker-sonic-p4" > /etc/hostname +RUN touch /etc/quagga/zebra.conf + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/platform/p4/docker-sonic-p4/config_bm.sh b/platform/p4/docker-sonic-p4/config_bm.sh new file mode 100755 index 000000000000..25de26b4da74 --- /dev/null +++ b/platform/p4/docker-sonic-p4/config_bm.sh @@ -0,0 +1,4 @@ +simple_switch_CLI --pre SimplePreLAG < /usr/share/p4-sai-bm/bridge_default_config.txt +simple_switch_CLI < /usr/share/p4-sai-bm/bridge_default_config_mirror.txt +simple_switch_CLI --pre SimplePreLAG --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config.txt +simple_switch_CLI --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config_mirror.txt \ No newline at end of file diff --git a/platform/p4/docker-sonic-p4/orchagent.sh b/platform/p4/docker-sonic-p4/orchagent.sh new file mode 100755 index 000000000000..7e250dfa20e9 --- /dev/null +++ b/platform/p4/docker-sonic-p4/orchagent.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` + +# Create a folder for SsWW record files +mkdir -p /var/log/swss +ORCHAGENT_ARGS="-d /var/log/swss " + +# Set orchagent pop batch size to 8192 +ORCHAGENT_ARGS+="-b 8192 " + +# Set mac address +ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + +exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/platform/p4/docker-sonic-p4/port_config.ini b/platform/p4/docker-sonic-p4/port_config.ini index 574f8f976ef9..2a88c4a7235b 100644 --- a/platform/p4/docker-sonic-p4/port_config.ini +++ b/platform/p4/docker-sonic-p4/port_config.ini @@ -1,5 +1,33 @@ -# alias lanes -Ethernet0 1 -Ethernet1 2 -Ethernet2 3 -Ethernet3 4 +# name lanes +Ethernet0 0 +Ethernet1 1 +Ethernet2 2 +Ethernet3 3 +Ethernet4 4 +Ethernet5 5 +Ethernet6 6 +Ethernet7 7 +Ethernet8 8 +Ethernet9 9 +Ethernet10 10 +Ethernet11 11 +Ethernet12 12 +Ethernet13 13 +Ethernet14 14 +Ethernet15 15 +Ethernet16 16 +Ethernet17 17 +Ethernet18 18 +Ethernet19 19 +Ethernet20 20 +Ethernet21 21 +Ethernet22 22 +Ethernet23 23 +Ethernet24 24 +Ethernet25 25 +Ethernet26 26 +Ethernet27 27 +Ethernet28 28 +Ethernet29 29 +Ethernet30 30 +Ethernet31 31 \ No newline at end of file diff --git a/platform/p4/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf index 3480e18f9998..79926a8b30c7 100644 --- a/platform/p4/docker-sonic-p4/rsyslog.conf +++ b/platform/p4/docker-sonic-p4/rsyslog.conf @@ -30,7 +30,9 @@ $ModLoad imuxsock # provides support for local system logging #### GLOBAL DIRECTIVES #### ########################### #Set remote syslog server -*.* @172.17.0.1:514 +#*.* @172.17.0.1:514 +#Set local syslog +*.* /var/log/messages # # Use traditional timestamp format. diff --git a/platform/p4/docker-sonic-p4/sonic-dev.gpg.key b/platform/p4/docker-sonic-p4/sonic-dev.gpg.key new file mode 100644 index 000000000000..fb9a37901bc7 --- /dev/null +++ b/platform/p4/docker-sonic-p4/sonic-dev.gpg.key @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk +xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX +UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA +LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH +B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT +c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8 +aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG +FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56 +LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V +/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4 +GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W +aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1 +af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m +J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam +aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP +++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR +eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86 +dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG +266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y +AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm +k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b +tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU +R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL +nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf +FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU= +=sb3d +-----END PGP PUBLIC KEY BLOCK----- diff --git a/platform/p4/docker-sonic-p4/start.sh b/platform/p4/docker-sonic-p4/start.sh new file mode 100755 index 000000000000..ae7bf4e5cf6f --- /dev/null +++ b/platform/p4/docker-sonic-p4/start.sh @@ -0,0 +1,97 @@ +#!/bin/bash -e + +# generate configuration +[ -d /etc/sonic ] || mkdir -p /etc/sonic + +if ! ip link show eth0 &> /dev/null; then + ip link add eth0 type dummy +fi + +SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') +sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json + +if [ -f /etc/sonic/config_db.json ]; then + sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json +else + sonic-cfggen -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json +fi + +mkdir -p /etc/swss/config.d/ + +# 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 -v platform` + +rm -f /var/run/rsyslogd.pid + +echo "Start rsyslogd" +supervisorctl start rsyslogd + +mkdir -p /var/run/redis + +echo "Start redis" +supervisorctl start redis-server + +echo "Veth Setup" +veth_setup.sh > /tmp/veth_setup.log + +echo "Start BM" +rm -rf bm_logs/bridge_log.* +rm -rf bm_logs/router_log.* +rm -rf log.txt +mkdir -p bm_logs +supervisorctl start bm_bridge +supervisorctl start bm_router + +sleep 10 +echo "BM Default config" +config_bm.sh > /tmp/config_bm.log + +/usr/bin/configdb-load.sh + +echo "Start syncd" +supervisorctl start syncd + +echo "Start orchagent" +supervisorctl start orchagent + +echo "Start portsyncd" +supervisorctl start portsyncd + +echo "Start intfsyncd" +supervisorctl start intfsyncd + +echo "Start neighsyncd" +supervisorctl start neighsyncd + +echo "Start teamsyncd" +supervisorctl start teamsyncd + +echo "Start fpmsyncd" +supervisorctl start fpmsyncd + +echo "Start intfmgrd" +supervisorctl start intfmgrd + +echo "Start vlanmgrd" +supervisorctl start vlanmgrd + +echo "Start zebra" +supervisorctl start zebra + +echo "Start bgpd" +supervisorctl start bgpd + +if [ -f /etc/swss/config.d/default_config.json ]; then + swssconfig /etc/swss/config.d/default_config.json +fi + +# Start arp_update when VLAN exists +VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` +if [ "$VLAN" != "" ]; then + echo "Start arp_update" + supervisorctl start arp_update +fi \ No newline at end of file diff --git a/platform/p4/docker-sonic-p4/startup.sh b/platform/p4/docker-sonic-p4/startup.sh deleted file mode 100755 index 18cd4716580b..000000000000 --- a/platform/p4/docker-sonic-p4/startup.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -echo "Set onie_platform to x86_64-barefoot_p4-r0" -export onie_platform=x86_64-barefoot_p4-r0 - -echo "Start rsyslog" -rm -f /var/run/rsyslogd.pid -service rsyslog start - -echo "Start redis server" -service redis-server start - -echo "Veth setup" -/usr/share/bmpd/tools/veth_setup.sh > /tmp/veth_setup.log 2>&1 - -echo "Disable IPv6" -/usr/share/bmpd/tools/veth_disable_ipv6.sh > /tmp/veth_disable.log 2>&1 - -echo "Start BMV2" -/run_bm.sh > /tmp/run_bm.log 2>&1 & -sleep 15 - -redis-cli -n 1 set LOGLEVEL DEBUG - -echo "Start Syncd" -syncd -N > /tmp/syncd.log 2>&1 & -sleep 10 - -echo "Start Orchagent" -orchagent $* > /tmp/orchagent.log 2>&1 & -sleep 10 - -echo "Start Portsyncd" -portsyncd -p /port_config.ini > /tmp/portsyncd.log 2>&1 & - -echo "Start Intfsync" -intfsyncd > /tmp/intfsyncd.log 2>&1 & - -echo "Start Neighsyncd" -neighsyncd > /tmp/neighsyncd.log 2>&1 & - -echo "Start Fpmsyncd" -fpmsyncd > /tmp/fpmsyncd.log 2>&1 & diff --git a/platform/p4/docker-sonic-p4/supervisord.conf b/platform/p4/docker-sonic-p4/supervisord.conf new file mode 100644 index 000000000000..f4b80ceb4eb7 --- /dev/null +++ b/platform/p4/docker-sonic-p4/supervisord.conf @@ -0,0 +1,141 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=false + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:bm_router] +command=ip netns exec sw_net simple_switch -i 0@router_port1 -i 250@router_cpu_port --thrift-port 9091 --log-file bm_logs/router_log --log-flush --notifications-addr ipc:///tmp/bmv2-router-notifications.ipc /usr/share/p4-sai-bm/sai_router.json +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:bm_bridge] +command=ip netns exec sw_net simple_switch -i 0@sw_port0 -i 1@sw_port1 -i 2@sw_port2 -i 3@sw_port3 -i 4@sw_port4 -i 5@sw_port5 -i 6@sw_port6 -i 7@sw_port7 -i 7@sw_port7 -i 8@sw_port8 -i 9@sw_port9 -i 10@sw_port10 -i 11@sw_port11 -i 12@sw_port12 -i 13@sw_port13 -i 14@sw_port14 -i 15@sw_port15 -i 16@sw_port16 -i 17@sw_port17 -i 18@sw_port18 -i 19@sw_port19 -i 20@sw_port20 -i 21@sw_port21 -i 22@sw_port22 -i 23@sw_port23 -i 24@sw_port24 -i 25@sw_port25 -i 26@sw_port26 -i 27@sw_port27 -i 28@sw_port28 -i 29@sw_port29 -i 30@sw_port30 -i 31@sw_port31 -i 250@cpu_port -i 251@router_port0 --log-file bm_logs/bridge_log --log-flush /usr/share/p4-sai-bm/sai_bridge.json & +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:redis-server] +command=/usr/bin/redis-server /etc/redis/redis.conf +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd -uN +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:orchagent] +command=/usr/bin/orchagent.sh +priority=5 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:portsyncd] +command=/usr/bin/portsyncd -p /port_config.ini +priority=6 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:intfsyncd] +command=/usr/bin/intfsyncd +priority=7 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:neighsyncd] +command=/usr/bin/neighsyncd +priority=8 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:teamsyncd] +command=/usr/bin/teamsyncd +priority=9 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:vlanmgrd] +command=/usr/bin/vlanmgrd +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:intfmgrd] +command=/usr/bin/intfmgrd +priority=11 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:zebra] +command=/usr/lib/quagga/zebra -A 127.0.0.1 +priority=12 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:bgpd] +command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F +priority=13 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:fpmsyncd] +command=/usr/bin/fpmsyncd +priority=14 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:arp_update] +command=bash -c "/usr/bin/arp_update; sleep 300" +priority=15 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog \ No newline at end of file diff --git a/platform/p4/p4-bmv.mk b/platform/p4/p4-bmv.mk index 6fe00d189eb7..affb0d5ac824 100644 --- a/platform/p4/p4-bmv.mk +++ b/platform/p4/p4-bmv.mk @@ -1,7 +1,7 @@ # p4 bmv package -P4_BMV = p4-bmv2_1.0.0_amd64.deb -$(P4_BMV)_DEPENDS += $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) +P4_BMV = sai-p4-bm_1.0.0_amd64.deb +$(P4_BMV)_DEPENDS += $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(P4C_BM) $(P4_BMV)_RDEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(THRIFT_COMPILER) -$(P4_BMV)_SRC_PATH = $(PLATFORM_PATH)/p4-bmv/behavioral-model +$(P4_BMV)_SRC_PATH = $(PLATFORM_PATH)/SAI-P4-BM/p4-switch SONIC_DPKG_DEBS += $(P4_BMV) diff --git a/platform/p4/p4-bmv/behavioral-model b/platform/p4/p4-bmv/behavioral-model deleted file mode 160000 index a6ccf267bc9c..000000000000 --- a/platform/p4/p4-bmv/behavioral-model +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a6ccf267bc9c5c31fd40fe5841893e38e03abeb4 diff --git a/platform/p4/p4-hlir.mk b/platform/p4/p4-hlir.mk index 2873275983a9..61307c7ff79a 100644 --- a/platform/p4/p4-hlir.mk +++ b/platform/p4/p4-hlir.mk @@ -1,5 +1,9 @@ # p4 bmv package +P4_HLIR_V1_1 = python-p4-hlir-v1-1_1.1.7-1_all.deb +$(P4_HLIR_V1_1)_SRC_PATH = $(PLATFORM_PATH)/p4-hlir/p4-hlir-v1.1 +SONIC_PYTHON_STDEB_DEBS += $(P4_HLIR_V1_1) + P4_HLIR = python-p4-hlir_0.9.36-1_all.deb $(P4_HLIR)_SRC_PATH = $(PLATFORM_PATH)/p4-hlir/p4-hlir SONIC_PYTHON_STDEB_DEBS += $(P4_HLIR) diff --git a/platform/p4/p4-hlir/p4-hlir-v1.1 b/platform/p4/p4-hlir/p4-hlir-v1.1 new file mode 160000 index 000000000000..fdee55e2567f --- /dev/null +++ b/platform/p4/p4-hlir/p4-hlir-v1.1 @@ -0,0 +1 @@ +Subproject commit fdee55e2567fe65463f328d70558b5079894b420 diff --git a/platform/p4/p4-switch.mk b/platform/p4/p4-switch.mk index 6fc07f908779..fb092fa2c5f3 100644 --- a/platform/p4/p4-switch.mk +++ b/platform/p4/p4-switch.mk @@ -1,7 +1,7 @@ -# p4 switch package +# p4 sai adapter package -P4_SWITCH = p4-switch_1.0.0_amd64.deb -$(P4_SWITCH)_DEPENDS += $(P4C_BM) $(P4_BMV) -$(P4_SWITCH)_RDEPENDS += $(P4C_BM) $(P4_BMV) -$(P4_SWITCH)_SRC_PATH = $(PLATFORM_PATH)/p4-switch -SONIC_MAKE_DEBS += $(P4_SWITCH) +P4_SWITCH = p4-sai-adapter_0.1-0_amd64.deb +$(P4_SWITCH)_DEPENDS += $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(P4_BMV) +$(P4_SWITCH)_RDEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(P4_BMV) +$(P4_SWITCH)_SRC_PATH = $(PLATFORM_PATH)/SAI-P4-BM/sai_adapter +SONIC_DPKG_DEBS += $(P4_SWITCH) diff --git a/platform/p4/p4-switch/Makefile b/platform/p4/p4-switch/Makefile deleted file mode 100644 index 57f6a05999a1..000000000000 --- a/platform/p4/p4-switch/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -SHELL = /bin/bash -.ONESHELL: - -MAIN_TARGET = p4-switch_1.0.0_amd64.deb - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - pushd switch - - mkdir -p p4-build/bmv2/switch - mkdir -p p4-build/bmv2/pd_thrift_gen - - ./autogen.sh - dpkg-buildpackage -us -uc -b -j4 - - popd - - mv $* $(DEST)/ diff --git a/platform/p4/p4-switch/switch b/platform/p4/p4-switch/switch deleted file mode 160000 index e934752f356d..000000000000 --- a/platform/p4/p4-switch/switch +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e934752f356d3ad48cbec99067f47c83795ddcec diff --git a/platform/p4/p4c-bm.mk b/platform/p4/p4c-bm.mk index f51595772c3a..1982ee359212 100644 --- a/platform/p4/p4c-bm.mk +++ b/platform/p4/p4c-bm.mk @@ -2,6 +2,6 @@ P4C_BM = python-p4c-bm_1.0.0-5415c416-1_all.deb $(P4C_BM)_SRC_PATH = $(PLATFORM_PATH)/p4c-bm/p4c-bm -$(P4C_BM)_DEPENDS += $(TENJIN) $(P4_HLIR) -$(P4C_BM)_RDEPENDS += $(TENJIN) $(P4_HLIR) +$(P4C_BM)_DEPENDS += $(TENJIN) $(P4_HLIR) $(P4_HLIR_V1_1) +$(P4C_BM)_RDEPENDS += $(TENJIN) $(P4_HLIR) $(P4_HLIR_V1_1) SONIC_PYTHON_STDEB_DEBS += $(P4C_BM) diff --git a/platform/p4/rules.mk b/platform/p4/rules.mk index 408a58041f56..20def91333c6 100644 --- a/platform/p4/rules.mk +++ b/platform/p4/rules.mk @@ -1,8 +1,10 @@ -include $(PLATFORM_PATH)/p4-switch.mk -include $(PLATFORM_PATH)/p4-bmv.mk +# include $(PLATFORM_PATH)/p4-softswitch.mk +include $(PLATFORM_PATH)/tenjin.mk include $(PLATFORM_PATH)/p4-hlir.mk include $(PLATFORM_PATH)/p4c-bm.mk -include $(PLATFORM_PATH)/tenjin.mk +# include $(PLATFORM_PATH)/p4-sai-bm.mk +include $(PLATFORM_PATH)/p4-bmv.mk +include $(PLATFORM_PATH)/p4-switch.mk include $(PLATFORM_PATH)/docker-sonic-p4.mk SONIC_ALL += $(DOCKER_SONIC_P4) diff --git a/platform/p4/tenjin/Makefile b/platform/p4/tenjin/Makefile index 3f36866fe0de..83b27d390abc 100644 --- a/platform/p4/tenjin/Makefile +++ b/platform/p4/tenjin/Makefile @@ -9,7 +9,7 @@ MAIN_TARGET = python-tenjin_$(TENJIN_VERSION_FULL)_all.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf Tenjin-$(TENJIN_VERSION) - wget -nc http://pypi.python.org/packages/source/T/Tenjin/Tenjin-$(TENJIN_VERSION).tar.gz + wget -nc https://pypi.python.org/packages/source/T/Tenjin/Tenjin-$(TENJIN_VERSION).tar.gz tar xzf Tenjin-$(TENJIN_VERSION).tar.gz pushd Tenjin-$(TENJIN_VERSION) diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index e9d23db493db..656c53644637 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -2,7 +2,16 @@ DOCKER_SONIC_VS = docker-sonic-vs.gz $(DOCKER_SONIC_VS)_PATH = $(PLATFORM_PATH)/docker-sonic-vs -$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) $(SYNCD_VS) $(REDIS_SERVER) $(REDIS_TOOLS) $(PYTHON_SWSSCOMMON) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA) +$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ + $(SYNCD_VS) \ + $(REDIS_SERVER) \ + $(REDIS_TOOLS) \ + $(PYTHON_SWSSCOMMON) \ + $(LIBTEAMDCT) \ + $(LIBTEAM_UTILS) \ + $(SONIC_DEVICE_DATA) \ + $(SONIC_UTILS) \ + $(IPROUTE2) ifeq ($(SONIC_ROUTING_STACK), quagga) $(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA) @@ -12,5 +21,8 @@ else $(DOCKER_SONIC_VS)_DEPENDS += $(GOBGP) endif +$(DOCKER_SONIC_VS)_FILES += $(CONFIGDB_LOAD_SCRIPT) \ + $(ARP_UPDATE_SCRIPT) + $(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_VS) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 32b91e8cf44a..7599059164cb 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -3,9 +3,13 @@ FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +COPY ["sonic-dev.gpg.key", "/etc/apt/"] +RUN apt-key add /etc/apt/sonic-dev.gpg.key +RUN echo "deb http://packages.microsoft.com/repos/sonic-dev/ jessie main" >> /etc/apt/sources.list RUN apt-get update RUN apt-get install -y net-tools \ + arping \ ethtool \ tcpdump \ ifupdown \ @@ -26,7 +30,18 @@ RUN apt-get install -y net-tools \ openssh-server \ libc-ares2 \ iproute \ - libpython2.7 + libpython2.7 \ + grub2-common \ + python-click-default-group \ + python-click \ + python-natsort \ + python-tabulate \ + bash-completion \ + libelf1 \ + libmnl0 + +RUN pip install setuptools +RUN pip install py2_ipaddress COPY \ {% for deb in docker_sonic_vs_debs.split(' ') -%} @@ -43,15 +58,25 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -RUN sed -ri 's/^daemonize yes$/daemonize no/; \ +RUN sed -ri 's/^(save .*$)/# \1/g; \ + s/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/ \ + s/^# unixsocket/unixsocket/; \ + s/notify-keyspace-events ""/notify-keyspace-events AKE/; \ + s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ ' /etc/redis/redis.conf COPY ["50-default.conf", "/etc/rsyslog.d/"] COPY ["start.sh", "orchagent.sh", "/usr/bin/"] COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] +COPY ["buffers.json.j2", "/usr/share/sonic/device/vswitch/"] +COPY ["pg_profile_lookup.ini", "/usr/share/sonic/device/vswitch/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/configdb-load.sh", "/usr/bin/"] +COPY ["files/arp_update", "/usr/bin"] + +RUN echo "docker-sonic-vs" > /etc/hostname +RUN touch /etc/quagga/zebra.conf ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/vs/docker-sonic-vs/buffers.json.j2 b/platform/vs/docker-sonic-vs/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/platform/vs/docker-sonic-vs/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/platform/vs/docker-sonic-vs/pg_profile_lookup.ini b/platform/vs/docker-sonic-vs/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/platform/vs/docker-sonic-vs/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/platform/vs/docker-sonic-vs/sonic-dev.gpg.key b/platform/vs/docker-sonic-vs/sonic-dev.gpg.key new file mode 100644 index 000000000000..fb9a37901bc7 --- /dev/null +++ b/platform/vs/docker-sonic-vs/sonic-dev.gpg.key @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk +xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX +UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA +LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH +B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT +c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8 +aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG +FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56 +LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V +/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4 +GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W +aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1 +af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m +J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam +aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP +++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR +eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86 +dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG +266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y +AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm +k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b +tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU +R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL +nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf +FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU= +=sb3d +-----END PGP PUBLIC KEY BLOCK----- diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 07d0fb7a0426..9df6f9f5ad36 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/bin/bash -e + +# generate configuration + +[ -d /etc/sonic ] || mkdir -p /etc/sonic + +SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') +sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json + +if [ -f /etc/sonic/config_db.json ]; then + sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json +else + # generate and merge buffers configuration into config file + sonic-cfggen -t /usr/share/sonic/device/vswitch/buffers.json.j2 > /tmp/buffers.json + sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json --print-data > /etc/sonic/config_db.json +fi mkdir -p /etc/swss/config.d/ @@ -16,6 +32,8 @@ mkdir -p /var/run/redis supervisorctl start redis-server +/usr/bin/configdb-load.sh + supervisorctl start syncd supervisorctl start orchagent @@ -28,8 +46,18 @@ supervisorctl start neighsyncd supervisorctl start teamsyncd +supervisorctl start fpmsyncd + +supervisorctl start intfmgrd + +supervisorctl start vlanmgrd + +supervisorctl start zebra + +supervisorctl start buffermgrd + # Start arp_update when VLAN exists -# VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` -# if [ "$VLAN" != "" ]; then -# supervisorctl start arp_update -# fi +VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` +if [ "$VLAN" != "" ]; then + supervisorctl start arp_update +fi diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index c6fefef1415a..fc425142db75 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -74,3 +74,59 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:vlanmgrd] +command=/usr/bin/vlanmgrd +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:intfmgrd] +command=/usr/bin/intfmgrd +priority=11 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:zebra] +command=/usr/lib/quagga/zebra -A 127.0.0.1 +priority=12 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:bgpd] +command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F +priority=13 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:fpmsyncd] +command=/usr/bin/fpmsyncd +priority=14 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:arp_update] +command=bash -c "/usr/bin/arp_update; sleep 300" +priority=15 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog + +[program:buffermgrd] +command=/usr/bin/buffermgrd -l /usr/share/sonic/device/vswitch/pg_profile_lookup.ini +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/rules/asyncsnmp-py3.mk b/rules/asyncsnmp-py3.mk index a5a078e15bc3..cc0af244d856 100644 --- a/rules/asyncsnmp-py3.mk +++ b/rules/asyncsnmp-py3.mk @@ -3,5 +3,6 @@ ASYNCSNMP_PY3 = asyncsnmp-2.1.0-py3-none-any.whl $(ASYNCSNMP_PY3)_SRC_PATH = $(SRC_PATH)/sonic-snmpagent $(ASYNCSNMP_PY3)_PYTHON_VERSION = 3 -$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) +# Depends on sonic-platform-common so it is possible to import sonic_psu +$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_PLATFORM_COMMON_PY3) SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3) diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 147b6538a098..ef77047e8431 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -12,3 +12,4 @@ $(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t $(DOCKER_DATABASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_DATABASE)_BASE_IMAGE_FILES += redis-cli:/usr/bin/redis-cli +$(DOCKER_DATABASE)_FILES += $(CONFIGDB_LOAD_SCRIPT) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 76e7dac4ab63..345e82f7b86f 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -3,6 +3,8 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_LEDD) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk new file mode 100644 index 000000000000..129246d8fa2d --- /dev/null +++ b/rules/docker-router-advertiser.mk @@ -0,0 +1,12 @@ +# Docker image for router advertiser + +DOCKER_ROUTER_ADVERTISER = docker-router-advertiser.gz +$(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/docker-router-advertiser +$(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) + + +$(DOCKER_ROUTER_ADVERTISER)_CONTAINER_NAME = radv +$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index 95fdcc25775c..1a5f68c9c032 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -12,3 +12,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) $(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp $(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t $(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +# mount Arista platform python libraries to support corresponding platforms SNMP power status query +$(DOCKER_SNMP_SV2)_RUN_OPT += -v /usr/lib/python3/dist-packages/arista:/usr/lib/python3/dist-packages/arista:ro diff --git a/rules/igb.mk b/rules/igb.mk index 654c4bd77037..9857c0517a0a 100644 --- a/rules/igb.mk +++ b/rules/igb.mk @@ -4,5 +4,6 @@ IGB_DRIVER_VERSION = 5.3.5.4 export IGB_DRIVER_VERSION IGB_DRIVER = igb.ko +$(IGB_DRIVER)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(IGB_DRIVER)_SRC_PATH = $(SRC_PATH)/igb SONIC_MAKE_DEBS += $(IGB_DRIVER) diff --git a/rules/iproute2.mk b/rules/iproute2.mk new file mode 100644 index 000000000000..10d8fe4cff3d --- /dev/null +++ b/rules/iproute2.mk @@ -0,0 +1,7 @@ +# iproute2 package + +IPROUTE2_VERSION = 4.9.0-1 + +IPROUTE2 = iproute2_$(IPROUTE2_VERSION)_amd64.deb +$(IPROUTE2)_SRC_PATH = $(SRC_PATH)/iproute2 +SONIC_MAKE_DEBS += $(IPROUTE2) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 82f5c3844c6f..7b7f69c6cfc6 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -1,6 +1,6 @@ # isc-dhcp packages -ISC_DHCP_VERSION = 4.3.1-6 +ISC_DHCP_VERSION = 4.3.3-6 export ISC_DHCP_VERSION diff --git a/rules/ixgbe.mk b/rules/ixgbe.mk new file mode 100644 index 000000000000..8819cd0018a3 --- /dev/null +++ b/rules/ixgbe.mk @@ -0,0 +1,9 @@ +# initramfs-tools package + +IXGBE_DRIVER_VERSION = 5.2.4 +export IXGBE_DRIVER_VERSION + +IXGBE_DRIVER = ixgbe.ko +$(IXGBE_DRIVER)_SRC_PATH = $(SRC_PATH)/ixgbe +$(IXGBE_DRIVER)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_MAKE_DEBS += $(IXGBE_DRIVER) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 228b48a9d34b..1e7fad0fd840 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -2,8 +2,8 @@ KVERSION_SHORT = 3.16.0-4 KVERSION = $(KVERSION_SHORT)-amd64 -KERNEL_VERSION = 3.16.36 -KERNEL_SUBVERSION = 1+deb8u2 +KERNEL_VERSION = 3.16.43 +KERNEL_SUBVERSION = 2+deb8u5 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/rules/sairedis.mk b/rules/sairedis.mk index 760d75c5a611..fc481e620cd7 100644 --- a/rules/sairedis.mk +++ b/rules/sairedis.mk @@ -4,6 +4,7 @@ LIBSAIREDIS = libsairedis_1.0.0_amd64.deb $(LIBSAIREDIS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis $(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV) $(LIBTHRIFT_DEV) $(LIBSAIREDIS)_RDEPENDS += $(LIBSWSSCOMMON) +$(LIBSAIREDIS)_DEB_BUILD_OPTIONS = nocheck SONIC_DPKG_DEBS += $(LIBSAIREDIS) LIBSAIREDIS_DEV = libsairedis-dev_1.0.0_amd64.deb diff --git a/rules/scripts.mk b/rules/scripts.mk new file mode 100644 index 000000000000..fbefdd68d2cd --- /dev/null +++ b/rules/scripts.mk @@ -0,0 +1,11 @@ + +ARP_UPDATE_SCRIPT = arp_update +$(ARP_UPDATE_SCRIPT)_PATH = files/scripts + +CONFIGDB_LOAD_SCRIPT = configdb-load.sh +$(CONFIGDB_LOAD_SCRIPT)_PATH = files/scripts + +SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \ + $(ARP_UPDATE_SCRIPT) + + diff --git a/rules/sonic-ledd.mk b/rules/sonic-ledd.mk index aa95b46cf478..056f0f6c9bd8 100644 --- a/rules/sonic-ledd.mk +++ b/rules/sonic-ledd.mk @@ -1,5 +1,5 @@ # sonic-ledd (SONiC Front-panel LED control daemon) Debian package -SONIC_LEDD = python-sonic-ledd_1.0-1_all.deb +SONIC_LEDD = python-sonic-ledd_1.1-1_all.deb $(SONIC_LEDD)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ledd SONIC_PYTHON_STDEB_DEBS += $(SONIC_LEDD) diff --git a/rules/sonic-platform-common.mk b/rules/sonic-platform-common.mk new file mode 100644 index 000000000000..95789354a4da --- /dev/null +++ b/rules/sonic-platform-common.mk @@ -0,0 +1,13 @@ +# sonic-platform-common package + +SONIC_PLATFORM_COMMON_PY2 = sonic_platform_common-1.0-py2-none-any.whl +$(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-common +$(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2 +SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) + +# Als build sonic-platform-common into python3 wheel, so we can use PSU code in SNMP docker +# Note: _DEPENDS macro is not defined +SONIC_PLATFORM_COMMON_PY3 = sonic_platform_common-1.0-py3-none-any.whl +$(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-common +$(SONIC_PLATFORM_COMMON_PY3)_PYTHON_VERSION = 3 +SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 7a935ba70ede..eba618d051dc 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -1,6 +1,16 @@ # sonic utilities package +# +# NOTE: sonic-config-engine is a build-time dependency of sonic-utilities +# due to unit tests which are run during the build. However, +# sonic-platform-common and swsssdk are runtime dependencies, and should be +# added here also. However, the current build system assumes all runtime +# dependencies are .deb packages. +# +# TODO: Create a way to specify both .deb and .whl runtime dependencies +# then add the aforementioned runtime dependencies here. +# -SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb +SONIC_UTILS = python-sonic-utilities_1.2-1_all.deb $(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities $(SONIC_UTILS)_WHEEL_DEPENDS = $(SONIC_CONFIG_ENGINE) SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) diff --git a/rules/supervisor.mk b/rules/supervisor.mk index cedacd96373e..7e7466bbad86 100644 --- a/rules/supervisor.mk +++ b/rules/supervisor.mk @@ -1,5 +1,9 @@ # supervisor package -SUPERVISOR = python-supervisor_3.3.2-1_all.deb +SUPERVISOR_VERSION = 3.3.2 + +export SUPERVISOR_VERSION + +SUPERVISOR = python-supervisor_$(SUPERVISOR_VERSION)-1_all.deb $(SUPERVISOR)_SRC_PATH = $(SRC_PATH)/supervisor SONIC_MAKE_DEBS += $(SUPERVISOR) diff --git a/rules/tacacs.mk b/rules/tacacs.mk new file mode 100644 index 000000000000..e31f52d9ab5d --- /dev/null +++ b/rules/tacacs.mk @@ -0,0 +1,29 @@ +# libpam-tacplus packages + +PAM_TACPLUS_VERSION = 1.4.1-1 + +export PAM_TACPLUS_VERSION + +LIBPAM_TACPLUS = libpam-tacplus_$(PAM_TACPLUS_VERSION)_amd64.deb +$(LIBPAM_TACPLUS)_RDEPENDS += $(LIBTAC2) +$(LIBPAM_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/pam +SONIC_MAKE_DEBS += $(LIBPAM_TACPLUS) + +LIBTAC_DEV = libtac-dev_$(PAM_TACPLUS_VERSION)_amd64.deb +$(LIBTAC_DEV)_DEPENDS += $(LIBTAC2) +$(eval $(call add_derived_package,$(LIBTAC2),$(LIBTAC_DEV))) + +LIBTAC2 = libtac2_$(PAM_TACPLUS_VERSION)_amd64.deb +$(eval $(call add_extra_package,$(LIBPAM_TACPLUS),$(LIBTAC2))) + + +# libnss-tacplus packages +NSS_TACPLUS_VERSION = 1.0.4-1 + +export NSS_TACPLUS_VERSION + +LIBNSS_TACPLUS = libnss-tacplus_$(NSS_TACPLUS_VERSION)_amd64.deb +$(LIBNSS_TACPLUS)_DEPENDS += $(LIBTAC_DEV) +$(LIBNSS_TACPLUS)_RDEPENDS += $(LIBTAC2) +$(LIBNSS_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/nss +SONIC_MAKE_DEBS += $(LIBNSS_TACPLUS) diff --git a/slave.mk b/slave.mk index 6f823cf98340..477fd2531611 100644 --- a/slave.mk +++ b/slave.mk @@ -74,7 +74,11 @@ ifeq ($(PASSWORD),) override PASSWORD := $(DEFAULT_PASSWORD) endif -MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) +ifeq ($(SONIC_BUILD_JOBS),) +override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) +endif + +MAKEFLAGS += -j $(SONIC_BUILD_JOBS) export SONIC_CONFIG_MAKE_JOBS ############################################################################### @@ -86,7 +90,7 @@ $(info ) $(info Build Configuration) $(info "CONFIGURED_PLATFORM" : "$(if $(PLATFORM),$(PLATFORM),$(CONFIGURED_PLATFORM))") $(info "SONIC_CONFIG_PRINT_DEPENDENCIES" : "$(SONIC_CONFIG_PRINT_DEPENDENCIES)") -$(info "SONIC_CONFIG_BUILD_JOBS" : "$(SONIC_CONFIG_BUILD_JOBS)") +$(info "SONIC_BUILD_JOBS" : "$(SONIC_BUILD_JOBS)") $(info "SONIC_CONFIG_MAKE_JOBS" : "$(SONIC_CONFIG_MAKE_JOBS)") $(info "DEFAULT_USERNAME" : "$(DEFAULT_USERNAME)") $(info "DEFAULT_PASSWORD" : "$(DEFAULT_PASSWORD)") @@ -96,6 +100,8 @@ $(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 "HTTP_PROXY" : "$(HTTP_PROXY)") +$(info "HTTPS_PROXY" : "$(HTTPS_PROXY)") $(info ) ############################################################################### @@ -204,8 +210,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) $(if $($*_DPKG_TARGET), - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) + DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), + DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) ) popd $(LOG) # Clean up @@ -229,6 +235,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platf 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) + rm -rf deb_dist/* $(LOG) python setup.py --command-packages=stdeb.command bdist_deb $(LOG) popd $(LOG) # Clean up @@ -306,7 +313,7 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA pushd $($*_SRC_PATH) $(LOG) # apply series of patches if exist if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi - python$($*_PYTHON_VERSION) setup.py test $(LOG) + [ "$($*_TEST)" = "n" ] || python$($*_PYTHON_VERSION) setup.py test $(LOG) python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) # clean up if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt pop -a -f; fi @@ -325,7 +332,7 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff # put a lock here to avoid race conditions while true; do if mkdir $(PYTHON_WHEELS_PATH)/pip_lock &> /dev/null; then - { sudo pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; } + { sudo -E pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; } fi done $(FOOTER) @@ -336,12 +343,20 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff # start docker daemon docker-start : - @sudo service docker start &> /dev/null && sleep 1 + @sudo sed -i '/http_proxy/d' /etc/default/docker + @sudo bash -c "echo \"export http_proxy=$$http_proxy\" >> /etc/default/docker" + @sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && sleep 1 ) # targets for building simple docker images that do not depend on any debian packages $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $(HEADER) - docker build --squash --no-cache --build-arg user=$(USER) --build-arg uid=$(UID) --build-arg guid=$(GUID) -t $* $($*.gz_PATH) $(LOG) + docker build --squash --no-cache \ + --build-arg http_proxy=$(HTTP_PROXY) \ + --build-arg https_proxy=$(HTTPS_PROXY) \ + --build-arg user=$(USER) \ + --build-arg uid=$(UID) \ + --build-arg guid=$(GUID) \ + -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) @@ -361,7 +376,13 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile - docker build --squash --no-cache --build-arg user=$(USER) --build-arg uid=$(UID) --build-arg guid=$(GUID) -t $* $($*.gz_PATH) $(LOG) + docker build --squash --no-cache \ + --build-arg http_proxy=$(HTTP_PROXY) \ + --build-arg https_proxy=$(HTTPS_PROXY) \ + --build-arg user=$(USER) \ + --build-arg uid=$(UID) \ + --build-arg guid=$(GUID) \ + -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) @@ -380,7 +401,24 @@ $(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)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ + .platform \ + onie-image.conf \ + $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) \ + $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) \ + $$(addprefix $(DEBS_PATH)/,$$($$*_LAZY_INSTALLS)) \ + $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ + $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) \ + $(LINUX_KERNEL) \ + $(IGB_DRIVER) \ + $(IXGBE_DRIVER) \ + $(SONIC_DEVICE_DATA) \ + $(SONIC_UTILS) \ + $(LIBPAM_TACPLUS) \ + $(LIBNSS_TACPLUS)) \ + $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \ + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2)) $(HEADER) # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -392,11 +430,12 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .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))" - export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" + export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_INSTALLS))" + export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" + export platform_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 603c3b6cb357..6e48a4ff7339 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -164,10 +164,11 @@ RUN apt-get update && apt-get install -y \ cppcheck \ clang \ pylint \ - python-pytest \ gcovr \ python-pytest=2.6.3* \ + python3-pytest=2.6.3* \ python-pytest-cov \ + python3-pytest-cov \ python-parse \ # For snmpd libmysqlclient-dev \ @@ -196,13 +197,27 @@ RUN apt-get update && apt-get install -y \ python-netaddr \ python-ipaddr \ python-yaml \ +# For sonic utilities + python3-netaddr \ # For lockfile procmail \ # For gtest libgtest-dev \ cmake \ +# For pam_tacplus build + autoconf-archive \ # For python-based swsscommon - swig3.0 + swig3.0 \ +# For iproute2 + cm-super-minimal \ + libatm1-dev \ + libelf-dev \ + libmnl-dev \ + libselinux1-dev \ + linuxdoc-tools \ + lynx \ + texlive-latex-extra \ + texlive-latex-recommended # For linux build RUN apt-get -y build-dep linux diff --git a/src/iproute2/Makefile b/src/iproute2/Makefile new file mode 100644 index 000000000000..0181c9ca6d31 --- /dev/null +++ b/src/iproute2/Makefile @@ -0,0 +1,20 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + +IPROUTE2_VERSION = 4.9.0 +IPROUTE2_VERSION_FULL = $(IPROUTE2_VERSION)-1 + +MAIN_TARGET = iproute2_$(IPROUTE2_VERSION_FULL)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + wget -O iproute2_$(IPROUTE2_VERSION).orig.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0.orig.tar.xz?sv=2015-04-05&sr=b&sig=9nvybd1xkXyRQbaG6Fy6wBazPA8IbZV0AO41GWXPEP8%3D&se=2154-10-23T11%3A59%3A00Z&sp=r" + wget -O iproute2_$(IPROUTE2_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.dsc?sv=2015-04-05&sr=b&sig=m6FcMH9dOh8ggipBgOsONiXvDxoi6bfUO%2BxvidsMNMQ%3D&se=2154-10-23T11%3A59%3A53Z&sp=r" + wget -O iproute2_$(IPROUTE2_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.debian.tar.xz?sv=2015-04-05&sr=b&sig=U5NFuwG5C3vZXlUUNvoPMnKDtMKk66zbweA9rQYbEVY%3D&se=2154-10-23T12%3A00%3A15Z&sp=r" + dpkg-source -x iproute2_$(IPROUTE2_VERSION_FULL).dsc + + pushd iproute2-$(IPROUTE2_VERSION) + dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + mv $* $(DEST)/ diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index d2304876d1cf..5b1cb8407005 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -12,14 +12,17 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Clone isc-dhcp repo git clone https://anonscm.debian.org/cgit/pkg-dhcp/isc-dhcp.git pushd ./isc-dhcp - git checkout -f debian/4.3.1-6 - popd - # Apply patch - patch -p1 < isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + git reset --hard debian/$(ISC_DHCP_VERSION) + + # Apply patches + stg init + stg import -s ../patch/series # Build source and Debian packages - pushd ./isc-dhcp dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd diff --git a/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch b/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch deleted file mode 100644 index 4dee30238acd..000000000000 --- a/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch +++ /dev/null @@ -1,442 +0,0 @@ -This patch adds the following functionality to dhcrelay in isc-dhcp v4.3.1-6: -* Add customizable Circuit ID and Remote ID fields -* Support for obtaining name of physical interfaces that are part of a bridge interface - -diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c ---- a/isc-dhcp/relay/dhcrelay.c 2017-10-03 01:46:19.811524700 +0000 -+++ b/isc-dhcp/relay/dhcrelay.c 2017-10-03 01:45:50.699524700 +0000 -@@ -73,6 +73,8 @@ - did not match any known circuit ID. */ - int missing_circuit_id = 0; /* Circuit ID option in matching RAI option - was missing. */ -+const char *agent_circuit_id_fmt = NULL; /* Circuit ID custom format string. */ -+const char *agent_remote_id_fmt = NULL; /* Remote ID custom format string. */ - int max_hop_count = 10; /* Maximum hop count */ - - #ifdef DHCPv6 -@@ -120,6 +122,14 @@ - char *dhcrelay_sub_id = NULL; - #endif - -+struct interface_name_alias_tuple { -+ char if_name[IFNAMSIZ + 1]; -+ char if_alias[IFNAMSIZ + 1]; -+}; -+ -+static struct interface_name_alias_tuple *g_interface_name_alias_map = NULL; -+static size_t g_interface_name_alias_map_size = 0; -+ - static void do_relay4(struct interface_info *, struct dhcp_packet *, - unsigned int, unsigned int, struct iaddr, - struct hardware *); -@@ -132,6 +142,10 @@ - struct interface_info **, - struct dhcp_packet *, unsigned); - -+static int load_interface_alias_map(const char *port_alias_map_file_path); -+static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); -+static void free_interface_alias_map(void); -+ - static const char copyright[] = - "Copyright 2004-2014 Internet Systems Consortium."; - static const char arr[] = "All rights reserved."; -@@ -140,28 +154,42 @@ - static const char url[] = - "For info, please visit https://www.isc.org/software/dhcp/"; - -+#define DHCRELAY_OPTION82_USAGE \ -+"circuit_id/remote_id interpreted sequences are:\n" \ -+"\n" \ -+" %%%% A single %%\n" \ -+" %%h Hostname of device\n" \ -+" %%p Alias of interface that generated the request\n" \ -+" %%P Hardware address of interface that generated the request\n" \ -+" %%C Client hardware address\n" \ -+" %%I DHCP relay agent IP Address\n" \ -+ - #ifdef DHCPv6 - #define DHCRELAY_USAGE \ --"Usage: dhcrelay [-4] [-d] [-q] [-a] [-D]\n"\ -+"Usage: dhcrelay [-4] [-d] [-q] [-a ] [-D]\n"\ - " [-A ] [-c ] [-p ]\n" \ - " [-pf ] [--no-pid]\n"\ - " [-m append|replace|forward|discard]\n" \ -+" [--name-alias-map-file ]\n" \ - " [-i interface0 [ ... -i interfaceN]\n" \ - " server0 [ ... serverN]\n\n" \ - " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ - " [-pf ] [--no-pid]\n" \ -+" [--name-alias-map-file ]\n" \ - " [-s ]\n" \ - " -l lower0 [ ... -l lowerN]\n" \ - " -u upper0 [ ... -u upperN]\n" \ - " lower (client link): [address%%]interface[#index]\n" \ --" upper (server link): [address%%]interface" -+" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE - #else - #define DHCRELAY_USAGE \ --"Usage: dhcrelay [-d] [-q] [-a] [-D] [-A ] [-c ] [-p ]\n" \ --" [-pf ] [--no-pid]\n" \ -+"Usage: dhcrelay [-d] [-q] [-a ] [-D]\n" \ -+" [-A ] [-c ] [-p ]\n" \ -+" [-pf ] [--no-pid]\n"\ - " [-m append|replace|forward|discard]\n" \ -+" [--name-alias-map-file ]\n" \ - " [-i interface0 [ ... -i interfaceN]\n" \ --" server0 [ ... serverN]\n\n" -+" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE - #endif - - static void usage() { -@@ -287,6 +315,15 @@ - local_family_set = 1; - local_family = AF_INET; - #endif -+ if (++i == argc) -+ usage(); -+ -+ if (argv[i] != NULL && argv[i][0] != '-') -+ agent_circuit_id_fmt = argv[i++]; -+ -+ if (argv[i] != NULL && argv[i][0] != '-') -+ agent_remote_id_fmt = argv[i]; -+ - add_agent_options = 1; - } else if (!strcmp(argv[i], "-A")) { - #ifdef DHCPv6 -@@ -383,6 +420,13 @@ - no_dhcrelay_pid = ISC_TRUE; - } else if (!strcmp(argv[i], "--no-pid")) { - no_pid_file = ISC_TRUE; -+ } else if (!strcmp(argv[i], "--name-alias-map-file")) { -+ if (++i == argc) -+ usage(); -+ if (load_interface_alias_map(argv[i]) != 0) -+ log_fatal("Failed to load interface name-alias map."); -+ path_dhcrelay_pid = argv[i]; -+ no_dhcrelay_pid = ISC_TRUE; - } else if (!strcmp(argv[i], "--version")) { - log_info("isc-dhcrelay-%s", PACKAGE_VERSION); - exit(0); -@@ -602,6 +646,8 @@ - dispatch(); - - /* In fact dispatch() never returns. */ -+ free_interface_alias_map(); -+ - return (0); - } - -@@ -690,10 +736,9 @@ - &to, htop) < 0) { - ++server_packet_errors; - } else { -- log_debug("Forwarded BOOTREPLY for %s to %s", -- print_hw_addr(packet->htype, packet->hlen, -- packet->chaddr), -- inet_ntoa(to.sin_addr)); -+ //log_debug("Forwarded BOOTREPLY for %s to %s", -+ // print_hw_addr(packet->htype, packet->hlen, packet->chaddr), -+ // inet_ntoa(to.sin_addr)); - - ++server_packets_relayed; - } -@@ -732,10 +777,10 @@ - &sp->to, NULL) < 0) { - ++client_packet_errors; - } else { -- log_debug("Forwarded BOOTREQUEST for %s to %s", -- print_hw_addr(packet->htype, packet->hlen, -- packet->chaddr), -- inet_ntoa(sp->to.sin_addr)); -+ //log_debug("Forwarded BOOTREQUEST for %s to %s", -+ // print_hw_addr(packet->htype, packet->hlen, packet->chaddr), -+ // inet_ntoa(sp->to.sin_addr)); -+ - ++client_packets_relayed; - } - } -@@ -937,6 +982,152 @@ - return (-1); - } - -+static int -+_bridgefdbquery(const char *hwAddr, char *interface, int *vlanid) { -+ -+#define xstr(s) str(s) -+#define str(s) #s -+#define FDB_STRING_LEN 100 -+#define FDB_BUFFER_LEN (FDB_STRING_LEN + 1) -+ -+/* -+ * Format for sscanf() to read the 1st, 3th, and 5th -+ * space-delimited fields -+ * -+ * bridge fdb show output -+ * 6c:64:1a:00:06:13 dev swp35 vlan 0 master bridge permanent -+ */ -+#define FDB_LINE_FORMAT "%" xstr(FDB_STRING_LEN) "s %*s " \ -+ "%" xstr(FDB_STRING_LEN) "s %*s %d %*s" -+ -+ char cmdstr[FDB_BUFFER_LEN]; -+ char buf[FDB_BUFFER_LEN]; -+ char macAddr[FDB_BUFFER_LEN]; -+ -+ if ((interface == NULL) || (vlanid == NULL)) { -+ return 0; -+ } -+ sprintf(cmdstr, "bridge fdb show | grep -m 1 %s", hwAddr); -+ FILE *cmd = popen(cmdstr, "r"); -+ -+ if (cmd != NULL) { -+ while (fgets(buf, sizeof(buf), cmd)) { -+ sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); -+ //log_debug("bridgefdbquery: macAddr:%s interface: %s vlanid %d", -+ // macAddr, interface, *vlanid); -+ } -+ pclose(cmd); -+ return 0; -+ } -+ -+ return -1; -+} -+ -+/* -+ * Format the message that will be used by circuit_id and remote_id -+ */ -+static int -+format_relay_agent_rfc3046_msg(struct interface_info *ip, struct dhcp_packet *packet, -+ const char *format, char *msg, size_t msgn) { -+ size_t len = 0; -+ char hostname[HOST_NAME_MAX + 1] = { 0 }; -+ char ifname[IFNAMSIZ + 1] = { 0 }; -+ char *buf = msg; -+ -+ for ( ; format && *format && len < msgn; ++format) { -+ size_t strn = 0; -+ const char *str = NULL; -+ -+ if (*format == '%') { -+ switch (*++format) { -+ case '\0': -+ --format; -+ break; -+ -+ case '%': /* A literal '%' */ -+ str = "%"; -+ break; -+ -+ case 'h': /* Hostname */ -+ gethostname(hostname, HOST_NAME_MAX); -+ str = hostname; -+ break; -+ -+ case 'p': /* Name of interface that we received the request from */ -+ /* -+ * Query FDB to identify the exact physical interface only when source MAC address -+ * is present and '20: DHCP relay agent IP address' (giaddr) is not present -+ */ -+ if (packet->htype && !packet->giaddr.s_addr) { -+ int ret = 0, vlanid = 0; -+ -+ ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), -+ ip->name, -+ &vlanid); -+ -+ if (ret < 0) { -+ //log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", -+ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), -+ // ip->name, -+ // vlanid); -+ -+ strncpy(ifname, ip->name, IFNAMSIZ); -+ } -+ else if (strlen(ip->name) > 0) { -+ // Translate SONiC interface name to vendor alias -+ if (get_interface_alias_by_name(ip->name, ifname) < 0) { -+ log_error("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ip->name); -+ strncpy(ifname, ip->name, IFNAMSIZ); -+ } -+ -+ //log_debug("Mapped interface name '%s' to alias '%s'", ip->name, ifname); -+ -+ //log_debug("Adding option 82 interface alias for MAC Address %s as '%s'", -+ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), -+ // ifname); -+ } -+ -+ str = ifname; -+ } -+ break; -+ -+ case 'P': /* Physical address of interface that we received the request from */ -+ str = print_hw_addr(ip->hw_address.hbuf[0], ip->hw_address.hlen - 1, &ip->hw_address.hbuf[1]); -+ break; -+ -+ case 'C': /* 24: Client hardware address */ -+ str = print_hw_addr(packet->htype, packet->hlen, packet->chaddr); -+ break; -+ -+ case 'I': /* 20: DHCP relay agent IP address */ -+ str = inet_ntoa(packet->giaddr); -+ break; -+ -+ default: -+ log_error("Option %%%c is unrecognized and will not be formatted!", *format); -+ continue; -+ } -+ -+ if (str) -+ strn = strlen(str); -+ } else { -+ str = format; -+ strn += 1; -+ } -+ -+ // Do we have room? -+ if ((strn+len) > msgn) { -+ return 0; -+ } -+ -+ memcpy(buf+len, str, strn); -+ len += strn; -+ } -+ -+ return len; -+} -+ -+ - /* - * Examine a packet to see if it's a candidate to have a Relay - * Agent Information option tacked onto its tail. If it is, tack -@@ -948,6 +1139,8 @@ - int is_dhcp = 0, mms; - unsigned optlen; - u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; -+ char circuit_id_buf[255] = { '\0', }; -+ char remote_id_buf[255] = { '\0', }; - - /* If we're not adding agent options to packets, we can skip - this. */ -@@ -1077,6 +1270,38 @@ - op = sp; - #endif - -+ /* option82: custom string for circuit_id */ -+ if (agent_circuit_id_fmt) { -+ size_t len = 0; -+ -+ len = format_relay_agent_rfc3046_msg(ip, packet, agent_circuit_id_fmt, -+ circuit_id_buf, sizeof(circuit_id_buf)); -+ -+ if (len > 0) { -+ ip->circuit_id = (uint8_t *)circuit_id_buf; -+ ip->circuit_id_len = len; -+ -+ //log_debug("Sending on %s option82:circuit_id='%s' (%d)", -+ // ip->name, (char *)ip->circuit_id, ip->circuit_id_len); -+ } -+ } -+ -+ /* option82: custom string for remote_id */ -+ if (agent_remote_id_fmt) { -+ size_t len = 0; -+ -+ len = format_relay_agent_rfc3046_msg(ip, packet, agent_remote_id_fmt, -+ remote_id_buf, sizeof(remote_id_buf)); -+ -+ if (len > 0) { -+ ip->remote_id = (uint8_t *)remote_id_buf; -+ ip->remote_id_len = len; -+ -+ //log_debug("Sending on %s option82:remote_id='%s' (%d)", -+ // ip->name, (char *)ip->remote_id, ip->remote_id_len); -+ } -+ } -+ - /* Sanity check. Had better not ever happen. */ - if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) - log_fatal("Circuit ID length %d out of range [1-255] on " -@@ -1102,7 +1327,7 @@ - * If not, forward without adding the option. - */ - if (max - sp >= optlen + 3) { -- log_debug("Adding %d-byte relay agent option", optlen + 3); -+ //log_debug("Adding %d-byte relay agent option", optlen + 3); - - /* Okay, cons up *our* Relay Agent Information option. */ - *sp++ = DHO_DHCP_AGENT_OPTIONS; -@@ -1726,3 +1951,73 @@ - - exit(0); - } -+ -+#define MAX_PORT_CONFIG_LINE_LEN 1024 -+ -+// Allocates and loads global map g_interface_name_alias_map -+// Also sets global g_interface_name_alias_map_size -+static int -+load_interface_alias_map(const char *port_alias_map_file_path) { -+ int i = 0; -+ FILE *fp = NULL; -+ char line[MAX_PORT_CONFIG_LINE_LEN] = { 0 }; -+ -+ fp = fopen(port_alias_map_file_path,"r"); -+ if (fp == NULL) { -+ log_error("Unable to open %s", port_alias_map_file_path); -+ return -1; -+ } -+ -+ g_interface_name_alias_map_size = 0; -+ -+ // Count the number of interfaces listed in the file -+ while (fgets(line, sizeof(line), fp)) { -+ g_interface_name_alias_map_size++; -+ } -+ -+ // Allocate our map accordingly -+ g_interface_name_alias_map = ((struct interface_name_alias_tuple *) -+ dmalloc((sizeof(struct interface_name_alias_tuple) * g_interface_name_alias_map_size), -+ MDL)); -+ -+ // Reset file position indicator to beginning of file -+ fseek(fp, 0, SEEK_SET); -+ -+ // Every line should contain exactly one name-alias pair -+ while (fgets(line, sizeof(line), fp)) { -+ // Each line should read as "" -+ sscanf(line, "%s %s", g_interface_name_alias_map[i].if_name, g_interface_name_alias_map[i].if_alias); -+ i++; -+ } -+ -+ fclose(fp); -+ -+ log_info("Loaded %d interface name-alias mappings", i); -+ -+ return 0; -+} -+ -+// Locates alias for port named if_name, copies alias into if_alias_out, up to a -+// max of IFNAMSIZ bytes. -+// Returns 0 on success, -1 on failure -+static int -+get_interface_alias_by_name(const char *if_name, char *if_alias_out) { -+ int i = 0; -+ -+ for (i = 0; i < g_interface_name_alias_map_size; i++) { -+ if (strncmp(if_name, g_interface_name_alias_map[i].if_name, IFNAMSIZ) == 0) { -+ strncpy(if_alias_out, g_interface_name_alias_map[i].if_alias, IFNAMSIZ); -+ return 0; -+ } -+ } -+ -+ return -1; -+} -+ -+// Frees global map g_interface_name_alias_map -+// Sets g_interface_name_alias_map_size to 0 -+static void -+free_interface_alias_map(void) { -+ free(g_interface_name_alias_map); -+ g_interface_name_alias_map_size = 0; -+} diff --git a/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch b/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch new file mode 100644 index 000000000000..22a8f7faedd1 --- /dev/null +++ b/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch @@ -0,0 +1,273 @@ +From 284c87ff4b3873d0215904273fe3c86b07b4ba94 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Mon, 11 Dec 2017 23:21:08 +0000 +Subject: [PATCH 1/3] Customizable Option 82 circuit ID and remote ID fields + +--- + relay/dhcrelay.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 152 insertions(+), 30 deletions(-) + +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index 15b4997..b9f8326 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -73,6 +73,8 @@ int bad_circuit_id = 0; /* Circuit ID option in matching RAI option + did not match any known circuit ID. */ + int missing_circuit_id = 0; /* Circuit ID option in matching RAI option + was missing. */ ++const char *agent_circuit_id_fmt = NULL; /* Circuit ID custom format string. */ ++const char *agent_remote_id_fmt = NULL; /* Remote ID custom format string. */ + int max_hop_count = 10; /* Maximum hop count */ + + #ifdef DHCPv6 +@@ -140,9 +142,19 @@ static const char message[] = + static const char url[] = + "For info, please visit https://www.isc.org/software/dhcp/"; + ++#define DHCRELAY_OPTION82_USAGE \ ++"circuit_id/remote_id interpreted sequences are:\n" \ ++"\n" \ ++" %%%% A single %%\n" \ ++" %%h Hostname of device\n" \ ++" %%p Name of interface that generated the request\n" \ ++" %%P Hardware address of interface that generated the request\n" \ ++" %%C Client hardware address\n" \ ++" %%I DHCP relay agent IP Address\n" \ ++ + #ifdef DHCPv6 + #define DHCRELAY_USAGE \ +-"Usage: dhcrelay [-4] [-d] [-q] [-a] [-D]\n"\ ++"Usage: dhcrelay [-4] [-d] [-q] [-a ] [-D]\n"\ + " [-A ] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ +@@ -154,14 +166,15 @@ static const char url[] = + " -l lower0 [ ... -l lowerN]\n" \ + " -u upper0 [ ... -u upperN]\n" \ + " lower (client link): [address%%]interface[#index]\n" \ +-" upper (server link): [address%%]interface" ++" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE + #else + #define DHCRELAY_USAGE \ +-"Usage: dhcrelay [-d] [-q] [-a] [-D] [-A ] [-c ] [-p ]\n" \ +-" [-pf ] [--no-pid]\n" \ ++"Usage: dhcrelay [-d] [-q] [-a ] [-D]\n" \ ++" [-A ] [-c ] [-p ]\n" \ ++" [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ +-" server0 [ ... serverN]\n\n" ++" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE + #endif + + static void usage() { +@@ -287,6 +300,15 @@ main(int argc, char **argv) { + local_family_set = 1; + local_family = AF_INET; + #endif ++ if (++i == argc) ++ usage(); ++ ++ if (argv[i] != NULL && argv[i][0] != '-') ++ agent_circuit_id_fmt = argv[i++]; ++ ++ if (argv[i] != NULL && argv[i][0] != '-') ++ agent_remote_id_fmt = argv[i]; ++ + add_agent_options = 1; + } else if (!strcmp(argv[i], "-A")) { + #ifdef DHCPv6 +@@ -938,6 +960,80 @@ find_interface_by_agent_option(struct dhcp_packet *packet, + } + + /* ++ * Format the message that will be used by circuit_id and remote_id ++ */ ++static int ++format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_packet *packet, ++ const char *format, char *msg, size_t msgn) { ++ size_t len = 0; ++ char hostname[HOST_NAME_MAX] = { 0 }; ++ char ifname[IFNAMSIZ] = { 0 }; ++ char *buf = msg; ++ ++ for ( ; format && *format && len < msgn; ++format) { ++ size_t strn = 0; ++ const char *str = NULL; ++ ++ if (*format == '%') { ++ switch (*++format) { ++ case '\0': ++ --format; ++ break; ++ ++ case '%': /* A literal '%' */ ++ str = "%"; ++ break; ++ ++ case 'h': /* Hostname */ ++ gethostname(hostname, HOST_NAME_MAX); ++ hostname[HOST_NAME_MAX - 1] = '\0'; ++ str = hostname; ++ break; ++ ++ case 'p': /* Name of interface that we received the request from */ ++ strncpy(ifname, ip->name, IFNAMSIZ); ++ str = ifname; ++ break; ++ ++ case 'P': /* Physical address of interface that we received the request from */ ++ str = print_hw_addr(ip->hw_address.hbuf[0], ip->hw_address.hlen - 1, &ip->hw_address.hbuf[1]); ++ break; ++ ++ case 'C': /* 24: Client hardware address */ ++ str = print_hw_addr(packet->htype, packet->hlen, packet->chaddr); ++ break; ++ ++ case 'I': /* 20: DHCP relay agent IP address */ ++ str = inet_ntoa(packet->giaddr); ++ break; ++ ++ default: ++ log_error("Option %%%c is unrecognized and will not be formatted!", *format); ++ continue; ++ } ++ ++ if (str) ++ strn = strlen(str); ++ } else { ++ str = format; ++ strn = 1; ++ } ++ ++ // Do we have room? ++ if ((strn+len) >= msgn) { ++ return 0; ++ } ++ ++ if (str && strn > 0) { ++ memcpy(buf+len, str, strn); ++ len += strn; ++ } ++ } ++ ++ return len; ++} ++ ++/* + * Examine a packet to see if it's a candidate to have a Relay + * Agent Information option tacked onto its tail. If it is, tack + * the option on. +@@ -946,8 +1042,11 @@ static int + add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + unsigned length, struct in_addr giaddr) { + int is_dhcp = 0, mms; +- unsigned optlen; ++ unsigned optlen = 0; + u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; ++ char circuit_id_buf[256] = { '\0' }; ++ char remote_id_buf[256] = { '\0' }; ++ size_t circuit_id_len = 0, remote_id_len = 0; + + /* If we're not adding agent options to packets, we can skip + this. */ +@@ -1077,24 +1176,47 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + op = sp; + #endif + +- /* Sanity check. Had better not ever happen. */ +- if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) +- log_fatal("Circuit ID length %d out of range [1-255] on " +- "%s\n", ip->circuit_id_len, ip->name); +- optlen = ip->circuit_id_len + 2; /* RAI_CIRCUIT_ID + len */ +- +- if (ip->remote_id) { +- if (ip->remote_id_len > 255 || ip->remote_id_len < 1) +- log_fatal("Remote ID length %d out of range [1-255] " +- "on %s\n", ip->circuit_id_len, ip->name); +- optlen += ip->remote_id_len + 2; /* RAI_REMOTE_ID + len */ +- } ++ /* option82: custom string for circuit_id */ ++ if (agent_circuit_id_fmt) { ++ circuit_id_len = format_relay_agent_rfc3046_msg(ip, packet, agent_circuit_id_fmt, ++ circuit_id_buf, sizeof(circuit_id_buf)); ++ ++ if (circuit_id_len == 0) { ++ strncpy(circuit_id_buf, ip->name, sizeof(ip->name)); ++ circuit_id_len = strlen(circuit_id_buf); ++ } ++ ++ /* Sanity check. Had better not ever happen. */ ++ if (circuit_id_len > 255 || circuit_id_len < 1) ++ log_fatal("Circuit ID length %d out of range [1-255] on %s\n", ++ (int)circuit_id_len, ip->name); ++ ++ optlen = circuit_id_len + 2; // RAI_CIRCUIT_ID + len ++ ++ //log_debug("Sending on %s option82:circuit_id='%s' (%d)", ++ // ip->name, circuit_id_buf, (int)circuit_id_len); ++ } ++ ++ /* option82: custom string for remote_id */ ++ if (agent_remote_id_fmt) { ++ remote_id_len = format_relay_agent_rfc3046_msg(ip, packet, agent_remote_id_fmt, ++ remote_id_buf, sizeof(remote_id_buf)); ++ ++ if (remote_id_len > 255 || remote_id_len < 1) ++ log_fatal("Remote ID length %d out of range [1-255] on %s\n", ++ (int)remote_id_len, ip->name); ++ ++ optlen += remote_id_len + 2; // RAI_REMOTE_ID + len ++ ++ //log_debug("Sending on %s option82:remote_id='%s' (%d)", ++ // ip->name, remote_id_buf, (int)remote_id_len); ++ } + +- /* We do not support relay option fragmenting(multiple options to +- * support an option data exceeding 255 bytes). ++ /* We do not support relay option fragmenting (multiple options to ++ * support an option data exceeding 255 bytes) + */ +- if ((optlen < 3) ||(optlen > 255)) +- log_fatal("Total agent option length(%u) out of range " ++ if (optlen < 3 || optlen > 255) ++ log_fatal("Total agent option length (%u) out of range " + "[3 - 255] on %s\n", optlen, ip->name); + + /* +@@ -1102,7 +1224,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + * If not, forward without adding the option. + */ + if (max - sp >= optlen + 3) { +- log_debug("Adding %d-byte relay agent option", optlen + 3); ++ //log_debug("Adding %d-byte relay agent option", optlen + 3); + + /* Okay, cons up *our* Relay Agent Information option. */ + *sp++ = DHO_DHCP_AGENT_OPTIONS; +@@ -1110,16 +1232,16 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + + /* Copy in the circuit id... */ + *sp++ = RAI_CIRCUIT_ID; +- *sp++ = ip->circuit_id_len; +- memcpy(sp, ip->circuit_id, ip->circuit_id_len); +- sp += ip->circuit_id_len; ++ *sp++ = circuit_id_len; ++ memcpy(sp, circuit_id_buf, circuit_id_len); ++ sp += circuit_id_len; + + /* Copy in remote ID... */ +- if (ip->remote_id) { ++ if (remote_id_len > 0) { + *sp++ = RAI_REMOTE_ID; +- *sp++ = ip->remote_id_len; +- memcpy(sp, ip->remote_id, ip->remote_id_len); +- sp += ip->remote_id_len; ++ *sp++ = remote_id_len; ++ memcpy(sp, remote_id_buf, remote_id_len); ++ sp += remote_id_len; + } + } else { + ++agent_option_errors; +-- +2.1.4 + diff --git a/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch b/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch new file mode 100644 index 000000000000..ee85a7736287 --- /dev/null +++ b/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch @@ -0,0 +1,114 @@ +From caad3e05c31c9fad8cda378ce95a1969def771a2 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Mon, 11 Dec 2017 23:39:10 +0000 +Subject: [PATCH 2/3] Support for obtaining name of physical interface that is + a member of a bridge interface + +--- + relay/dhcrelay.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 67 insertions(+), 2 deletions(-) + +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index b9f8326..8458ea9 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -758,6 +758,7 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, + print_hw_addr(packet->htype, packet->hlen, + packet->chaddr), + inet_ntoa(sp->to.sin_addr)); ++ + ++client_packets_relayed; + } + } +@@ -917,6 +918,7 @@ find_interface_by_agent_option(struct dhcp_packet *packet, + ++corrupt_agent_options; + return (-1); + } ++ + switch(buf[i]) { + /* Remember where the circuit ID is... */ + case RAI_CIRCUIT_ID: +@@ -959,6 +961,47 @@ find_interface_by_agent_option(struct dhcp_packet *packet, + return (-1); + } + ++static int ++_bridgefdbquery(const char *hwAddr, char *interface, int *vlanid) { ++ ++#define xstr(s) str(s) ++#define str(s) #s ++#define FDB_STRING_LEN 100 ++#define FDB_BUFFER_LEN (FDB_STRING_LEN + 1) ++ ++/* ++ * Format for sscanf() to read the 1st, 3th, and 5th ++ * space-delimited fields ++ * ++ * bridge fdb show output ++ * 6c:64:1a:00:06:13 dev swp35 vlan 0 master bridge permanent ++ */ ++#define FDB_LINE_FORMAT "%" xstr(FDB_STRING_LEN) "s %*s " \ ++ "%" xstr(FDB_STRING_LEN) "s %*s %d %*s" ++ ++ char cmdstr[FDB_BUFFER_LEN]; ++ char buf[FDB_BUFFER_LEN]; ++ char macAddr[FDB_BUFFER_LEN]; ++ ++ if ((interface == NULL) || (vlanid == NULL)) { ++ return 0; ++ } ++ sprintf(cmdstr, "bridge fdb show | grep -m 1 %s", hwAddr); ++ FILE *cmd = popen(cmdstr, "r"); ++ ++ if (cmd != NULL) { ++ while (fgets(buf, sizeof(buf), cmd)) { ++ sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); ++ //log_debug("bridgefdbquery: macAddr: %s interface: %s vlanid: %d", ++ // macAddr, interface, *vlanid); ++ } ++ pclose(cmd); ++ return 0; ++ } ++ ++ return -1; ++} ++ + /* + * Format the message that will be used by circuit_id and remote_id + */ +@@ -991,8 +1034,30 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack + break; + + case 'p': /* Name of interface that we received the request from */ +- strncpy(ifname, ip->name, IFNAMSIZ); +- str = ifname; ++ /* ++ * Query FDB to identify the exact physical interface only when source MAC address ++ * is present and '20: DHCP relay agent IP address' (giaddr) is not present ++ */ ++ if (packet->htype && !packet->giaddr.s_addr) { ++ int ret = 0, vlanid = 0; ++ ++ ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), ++ ifname, ++ &vlanid); ++ ++ // If we failed to find a physical interface using the source mac, default ++ // to the interface name we received it on. ++ if (ret < 0) { ++ //log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", ++ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ // ip->name, ++ // vlanid); ++ ++ strncpy(ifname, ip->name, IFNAMSIZ); ++ } ++ ++ str = ifname; ++ } + break; + + case 'P': /* Physical address of interface that we received the request from */ +-- +2.1.4 + diff --git a/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch b/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch new file mode 100644 index 000000000000..7411e1c4ff3e --- /dev/null +++ b/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch @@ -0,0 +1,187 @@ +From 3a42b497716375c9347b51c3a28c5e91e7cd4cf4 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Tue, 12 Dec 2017 00:49:09 +0000 +Subject: [PATCH 3/3] Support for loading port alias map file to replace port + name with alias in circuit id + +--- + relay/dhcrelay.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 105 insertions(+), 1 deletion(-) + +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index 8458ea9..15f0acf 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -122,6 +122,14 @@ static void setup_streams(void); + char *dhcrelay_sub_id = NULL; + #endif + ++struct interface_name_alias_tuple { ++ char if_name[IFNAMSIZ]; ++ char if_alias[IFNAMSIZ]; ++}; ++ ++static struct interface_name_alias_tuple *g_interface_name_alias_map = NULL; ++static size_t g_interface_name_alias_map_size = 0; ++ + static void do_relay4(struct interface_info *, struct dhcp_packet *, + unsigned int, unsigned int, struct iaddr, + struct hardware *); +@@ -134,6 +142,10 @@ static int strip_relay_agent_options(struct interface_info *, + struct interface_info **, + struct dhcp_packet *, unsigned); + ++static int load_interface_alias_map(const char *port_alias_map_file_path); ++static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); ++static void free_interface_alias_map(void); ++ + static const char copyright[] = + "Copyright 2004-2015 Internet Systems Consortium."; + static const char arr[] = "All rights reserved."; +@@ -147,7 +159,7 @@ static const char url[] = + "\n" \ + " %%%% A single %%\n" \ + " %%h Hostname of device\n" \ +-" %%p Name of interface that generated the request\n" \ ++" %%p Alias of interface that generated the request\n" \ + " %%P Hardware address of interface that generated the request\n" \ + " %%C Client hardware address\n" \ + " %%I DHCP relay agent IP Address\n" \ +@@ -158,10 +170,12 @@ static const char url[] = + " [-A ] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ ++" [--name-alias-map-file ]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ + " server0 [ ... serverN]\n\n" \ + " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n" \ ++" [--name-alias-map-file ]\n" \ + " [-s ]\n" \ + " -l lower0 [ ... -l lowerN]\n" \ + " -u upper0 [ ... -u upperN]\n" \ +@@ -405,6 +419,11 @@ main(int argc, char **argv) { + no_dhcrelay_pid = ISC_TRUE; + } else if (!strcmp(argv[i], "--no-pid")) { + no_pid_file = ISC_TRUE; ++ } else if (!strcmp(argv[i], "--name-alias-map-file")) { ++ if (++i == argc) ++ usage(); ++ if (load_interface_alias_map(argv[i]) != 0) ++ log_fatal("Failed to load interface name-alias map."); + } else if (!strcmp(argv[i], "--version")) { + log_info("isc-dhcrelay-%s", PACKAGE_VERSION); + exit(0); +@@ -624,6 +643,8 @@ main(int argc, char **argv) { + dispatch(); + + /* In fact dispatch() never returns. */ ++ free_interface_alias_map(); ++ + return (0); + } + +@@ -1040,6 +1061,7 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack + */ + if (packet->htype && !packet->giaddr.s_addr) { + int ret = 0, vlanid = 0; ++ char ifalias[IFNAMSIZ] = { 0 }; + + ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), + ifname, +@@ -1056,6 +1078,18 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack + strncpy(ifname, ip->name, IFNAMSIZ); + } + ++ // Attempt to translate SONiC interface name to vendor alias ++ ret = get_interface_alias_by_name(ifname, ifalias); ++ if (ret < 0) { ++ //log_debug("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ifname); ++ } ++ else { ++ //log_debug("Mapped interface name '%s' to alias '%s'. Adding as option 82 interface alias for MAC Address %s", ++ // ifname, ifalias, print_hw_addr (packet->htype, packet->hlen, packet->chaddr)); ++ ++ strncpy(ifname, ifalias, IFNAMSIZ); ++ } ++ + str = ifname; + } + break; +@@ -1922,3 +1956,73 @@ dhcp_set_control_state(control_object_state_t oldstate, + + exit(0); + } ++ ++#define MAX_PORT_CONFIG_LINE_LEN 1024 ++ ++// Allocates and loads global map g_interface_name_alias_map ++// Also sets global g_interface_name_alias_map_size ++static int ++load_interface_alias_map(const char *port_alias_map_file_path) { ++ int i = 0; ++ FILE *fp = NULL; ++ char line[MAX_PORT_CONFIG_LINE_LEN] = { 0 }; ++ ++ fp = fopen(port_alias_map_file_path,"r"); ++ if (fp == NULL) { ++ log_error("Unable to open %s", port_alias_map_file_path); ++ return -1; ++ } ++ ++ g_interface_name_alias_map_size = 0; ++ ++ // Count the number of interfaces listed in the file ++ while (fgets(line, sizeof(line), fp)) { ++ g_interface_name_alias_map_size++; ++ } ++ ++ // Allocate our map accordingly ++ g_interface_name_alias_map = ((struct interface_name_alias_tuple *) ++ dmalloc((sizeof(struct interface_name_alias_tuple) * g_interface_name_alias_map_size), ++ MDL)); ++ ++ // Reset file position indicator to beginning of file ++ fseek(fp, 0, SEEK_SET); ++ ++ // Every line should contain exactly one name-alias pair ++ while (fgets(line, sizeof(line), fp)) { ++ // Each line should read as "" ++ sscanf(line, "%s %s", g_interface_name_alias_map[i].if_name, g_interface_name_alias_map[i].if_alias); ++ i++; ++ } ++ ++ fclose(fp); ++ ++ log_info("Loaded %d interface name-alias mappings", i); ++ ++ return 0; ++} ++ ++// Locates alias for port named if_name, copies alias into if_alias_out, up to a ++// max of IFNAMSIZ bytes. ++// Returns 0 on success, -1 on failure ++static int ++get_interface_alias_by_name(const char *if_name, char *if_alias_out) { ++ int i = 0; ++ ++ for (i = 0; i < g_interface_name_alias_map_size; i++) { ++ if (strncmp(if_name, g_interface_name_alias_map[i].if_name, IFNAMSIZ) == 0) { ++ strncpy(if_alias_out, g_interface_name_alias_map[i].if_alias, IFNAMSIZ); ++ return 0; ++ } ++ } ++ ++ return -1; ++} ++ ++// Frees global map g_interface_name_alias_map ++// Sets g_interface_name_alias_map_size to 0 ++static void ++free_interface_alias_map(void) { ++ free(g_interface_name_alias_map); ++ g_interface_name_alias_map_size = 0; ++} +-- +2.1.4 + diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series new file mode 100644 index 000000000000..a896563077c2 --- /dev/null +++ b/src/isc-dhcp/patch/series @@ -0,0 +1,4 @@ +# This series applies on GIT commit ee3dffdda38a8cfc6ad2005d8d64a165d2a709ba +0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch +0002-Support-for-obtaining-name-of-physical-interface-tha.patch +0003-Support-for-loading-port-alias-map-file-to-replace-p.patch diff --git a/src/ixgbe/Makefile b/src/ixgbe/Makefile new file mode 100644 index 000000000000..133fc7db0570 --- /dev/null +++ b/src/ixgbe/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = ixgbe.ko + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf ./ixgbe-$(IXGBE_DRIVER_VERSION) + wget -O ixgbe-$(IXGBE_DRIVER_VERSION).tar.gz "https://sonicstorage.blob.core.windows.net/packages/ixgbe-5.2.4.tar.gz?sv=2015-04-05&sr=b&sig=AaqJHHaPiJRp8R3HKobi0GNDgHAVnqijk6hpahwJ0Mg%3D&se=2154-10-05T22%3A19%3A29Z&sp=r" + tar xzf ixgbe-$(IXGBE_DRIVER_VERSION).tar.gz + + # Patch + pushd ./ixgbe-$(IXGBE_DRIVER_VERSION) + + # Build the package + pushd src + export BUILD_KERNEL=3.16.0-4-amd64 + make + popd + + popd + mv ./ixgbe-$(IXGBE_DRIVER_VERSION)/src/$* $(DEST)/ diff --git a/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch b/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch new file mode 100644 index 000000000000..3139f83f33a4 --- /dev/null +++ b/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch @@ -0,0 +1,104 @@ +From ec966f9a0229bd7226e3abe15b56659b36af9d66 Mon Sep 17 00:00:00 2001 +From: Haiyang Zheng +Date: Fri, 15 Dec 2017 21:07:53 -0800 +Subject: [patch libteam] [libteam] Add fallback support for single-member-port + LAG + +Signed-off-by: Haiyang Zheng +--- + teamd/teamd_runner_lacp.c | 42 ++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 40 insertions(+), 2 deletions(-) + +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 9c77fae..a3646a6 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -138,6 +138,8 @@ struct lacp { + #define LACP_CFG_DFLT_SYS_PRIO 0xffff + bool fast_rate; + #define LACP_CFG_DFLT_FAST_RATE false ++ bool fallback; ++#define LACP_CFG_DFLT_FALLBACK false + int min_ports; + #define LACP_CFG_DFLT_MIN_PORTS 1 + enum lacp_agg_select_policy agg_select_policy; +@@ -272,6 +274,11 @@ static int lacp_load_config(struct teamd_context *ctx, struct lacp *lacp) + lacp->cfg.fast_rate = LACP_CFG_DFLT_FAST_RATE; + teamd_log_dbg("Using fast_rate \"%d\".", lacp->cfg.fast_rate); + ++ err = teamd_config_bool_get(ctx, &lacp->cfg.fallback, "$.runner.fallback"); ++ if (err) ++ lacp->cfg.fallback = LACP_CFG_DFLT_FALLBACK; ++ teamd_log_dbg("Using fallback \"%d\".", lacp->cfg.fallback); ++ + err = teamd_config_int_get(ctx, &tmp, "$.runner.min_ports"); + if (err) { + lacp->cfg.min_ports = LACP_CFG_DFLT_MIN_PORTS; +@@ -308,9 +315,24 @@ static bool lacp_port_loopback_free(struct lacp_port *lacp_port) + return true; + } + ++/* ++ * is_lacp_fallback_eligible - is lacp_port eligible to go into lacp fallback mode ++ * ++ * Return true if it is, false otherwise ++ */ ++static bool is_lacp_fallback_eligible(struct lacp_port *lacp_port) ++{ ++ teamd_log_dbg("%s fallback eligible state \"%d \" cfg \"%d\".", ++ lacp_port->tdport->ifname, lacp_port->state, ++ lacp_port->lacp->cfg.fallback); ++ return lacp_port->state == PORT_STATE_DEFAULTED && ++ lacp_port->lacp->cfg.fallback; ++} ++ + static bool lacp_port_selectable_state(struct lacp_port *lacp_port) + { +- if (lacp_port->state == PORT_STATE_CURRENT) ++ if (lacp_port->state == PORT_STATE_CURRENT || ++ is_lacp_fallback_eligible(lacp_port)) + return true; + return false; + } +@@ -318,7 +340,8 @@ static bool lacp_port_selectable_state(struct lacp_port *lacp_port) + static bool lacp_port_unselectable_state(struct lacp_port *lacp_port) + { + if (lacp_port->state == PORT_STATE_CURRENT || +- lacp_port->state == PORT_STATE_EXPIRED) ++ lacp_port->state == PORT_STATE_EXPIRED || ++ is_lacp_fallback_eligible(lacp_port)) + return false; + return true; + } +@@ -1452,6 +1475,16 @@ static int lacp_state_fast_rate_get(struct teamd_context *ctx, + return 0; + } + ++static int lacp_state_fallback_get(struct teamd_context *ctx, ++ struct team_state_gsc *gsc, ++ void *priv) ++{ ++ struct lacp *lacp = priv; ++ ++ gsc->data.bool_val = lacp->cfg.fallback; ++ return 0; ++} ++ + static int lacp_state_select_policy_get(struct teamd_context *ctx, + struct team_state_gsc *gsc, + void *priv) +@@ -1479,6 +1512,11 @@ static const struct teamd_state_val lacp_state_vals[] = { + .getter = lacp_state_fast_rate_get, + }, + { ++ .subpath = "fallback", ++ .type = TEAMD_STATE_ITEM_TYPE_BOOL, ++ .getter = lacp_state_fallback_get, ++ }, ++ { + .subpath = "select_policy", + .type = TEAMD_STATE_ITEM_TYPE_STRING, + .getter = lacp_state_select_policy_get, +-- +2.7.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index c84250749477..c96266a5c7fd 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -18,6 +18,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : 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 + git apply ../0004-libteam-Add-lacp-fallback-support-for-single-member-.patch popd # Obtain debian packaging diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 826997063349..23d02a363e47 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -148,7 +148,10 @@ 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] = {'members': pcmbr_list} + if pcintf.find(str(QName(ns, "Fallback"))) != None: + pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text} + else: + pcs[pcintfname] = {'members': pcmbr_list} vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlan_intfs = [] @@ -197,7 +200,16 @@ def parse_dpg(dpg, hname): acl_intfs = port_alias_map.values() break; if acl_intfs: - acls[aclname] = { 'policy_desc': aclname, 'ports': acl_intfs, 'type': 'MIRROR' if is_mirror else 'L3'} + acls[aclname] = {'policy_desc': aclname, + 'ports': acl_intfs, + 'type': 'MIRROR' if is_mirror else 'L3'} + else: + # This ACL has no interfaces to attach to -- consider this a control plane ACL + aclservice = aclintf.find(str(QName(ns, "Type"))).text + acls[aclname] = {'policy_desc': aclname, + 'ports': acl_intfs, + 'type': 'CTRLPLANE', + 'service': aclservice if aclservice is not None else 'UNKNOWN'} return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls return None, None, None, None, None, None, None @@ -298,7 +310,8 @@ 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 = {} + port_speeds = {} + port_descriptions = {} for device_info in meta.findall(str(QName(ns, "DeviceInfo"))): dev_sku = device_info.find(str(QName(ns, "HwSku"))).text if dev_sku == hwsku: @@ -306,8 +319,11 @@ def parse_deviceinfo(meta, hwsku): for interface in interfaces.findall(str(QName(ns1, "EthernetInterface"))): alias = interface.find(str(QName(ns, "InterfaceName"))).text speed = interface.find(str(QName(ns, "Speed"))).text - ethernet_interfaces[port_alias_map.get(alias, alias)] = speed - return ethernet_interfaces + desc = interface.find(str(QName(ns, "Description"))) + if desc != None: + port_descriptions[port_alias_map.get(alias, alias)] = desc.text + port_speeds[port_alias_map.get(alias, alias)] = speed + return port_speeds, port_descriptions def parse_xml(filename, platform=None, port_config_file=None): root = ET.parse(filename).getroot() @@ -330,6 +346,7 @@ def parse_xml(filename, platform=None, port_config_file=None): devices = None hostname = None port_speeds = {} + port_descriptions = {} syslog_servers = [] dhcp_servers = [] ntp_servers = [] @@ -360,7 +377,7 @@ 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")): - port_speeds = parse_deviceinfo(child, hwsku) + (port_speeds, port_descriptions) = parse_deviceinfo(child, hwsku) results = {} results['DEVICE_METADATA'] = {'localhost': { @@ -395,6 +412,9 @@ def parse_xml(filename, platform=None, port_config_file=None): for port_name in port_speeds: ports.setdefault(port_name, {})['speed'] = port_speeds[port_name] + for port_name in port_descriptions: + ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] + results['PORT'] = ports results['PORTCHANNEL'] = pcs results['VLAN'] = vlans diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 9f1323dab2eb..a5727d38b96f 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -135,6 +135,7 @@ def main(): parser.add_argument("-j", "--json", help="json file that contains additional variables", action='append', default=[]) parser.add_argument("-a", "--additional-data", help="addition data, in json string") parser.add_argument("-d", "--from-db", help="read config from configdb", action='store_true') + parser.add_argument("-s", "--redis-unix-sock-file", help="unix sock file for redis connection") group = parser.add_mutually_exclusive_group() group.add_argument("-t", "--template", help="render the data with the template file") group.add_argument("-v", "--var", help="print the value of a variable, support jinja2 expression") @@ -151,6 +152,10 @@ def main(): if platform_info != None: data['platform'] = platform_info + db_kwargs = {} + if args.redis_unix_sock_file != None: + db_kwargs['unix_socket_path'] = args.redis_unix_sock_file + if args.minigraph != None: minigraph = args.minigraph if data.has_key('platform'): @@ -180,7 +185,7 @@ def main(): deep_update(data, json.loads(args.additional_data)) if args.from_db: - configdb = ConfigDBConnector() + configdb = ConfigDBConnector(**db_kwargs) configdb.connect() deep_update(data, FormatConverter.db_to_output(configdb.get_config())) @@ -203,9 +208,9 @@ def main(): print json.dumps(FormatConverter.to_serialized(data[args.var_json]), indent=4, cls=minigraph_encoder) if args.write_to_db: - configdb = ConfigDBConnector() + configdb = ConfigDBConnector(**db_kwargs) configdb.connect(False) - configdb.set_config(FormatConverter.output_to_db(data)) + configdb.mod_config(FormatConverter.output_to_db(data)) if args.print_data: print json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder) diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index 2d54e6dabb3d..c8da2fee8f76 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -23,9 +23,11 @@ iface eth0 inet static ########## management network policy routing rules # management port up rules up ip -4 route add default via 10.0.0.1 dev eth0 table default + up ip -4 route add 10.0.0.0/24 dev eth0 table default up ip -4 rule add from 10.0.0.100/32 table default # management port down rules down ip -4 route delete default via 10.0.0.1 dev eth0 table default + down ip -4 route delete 10.0.0.0/24 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 @@ -33,9 +35,11 @@ iface eth0 inet6 static ########## 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 route add 2603:10e2:0:2902::/64 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 route delete 2603:10e2:0:2902::/64 dev eth0 table default down ip -6 rule delete from 2603:10e2:0:2902::8/128 table default # # The switch front panel interfaces diff --git a/src/sonic-config-engine/tests/sample_output/lldpd.conf b/src/sonic-config-engine/tests/sample_output/lldpd.conf index 0328385cf307..d906f909bc7d 100644 --- a/src/sonic-config-engine/tests/sample_output/lldpd.conf +++ b/src/sonic-config-engine/tests/sample_output/lldpd.conf @@ -1,3 +1,4 @@ +configure ports eth0 lldp portidsubtype local eth0 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 diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index c65ebb847d7b..2a878c95f2c5 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -1,341 +1,120 @@ -[ - { - "BUFFER_POOL_TABLE:ingress_lossy_pool": { - "size": "6422528", +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet8": "300m", + "Ethernet0": "300m", + "Ethernet4": "300m", + "Ethernet108": "300m", + "Ethernet100": "300m", + "Ethernet104": "300m", + "Ethernet68": "300m", + "Ethernet96": "300m", + "Ethernet124": "300m", + "Ethernet92": "300m", + "Ethernet120": "300m", + "Ethernet52": "300m", + "Ethernet56": "300m", + "Ethernet76": "300m", + "Ethernet72": "300m", + "Ethernet64": "300m", + "Ethernet32": "300m", + "Ethernet16": "300m", + "Ethernet36": "300m", + "Ethernet12": "300m", + "Ethernet88": "300m", + "Ethernet116": "300m", + "Ethernet80": "300m", + "Ethernet112": "300m", + "Ethernet84": "300m", + "Ethernet48": "300m", + "Ethernet44": "300m", + "Ethernet40": "300m", + "Ethernet28": "300m", + "Ethernet60": "300m", + "Ethernet20": "300m", + "Ethernet24": "300m" + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "2097152", "type": "ingress", "mode": "dynamic" }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossless_pool": { - "size": "7291456", - "type": "egress", + "ingress_lossy_pool": { + "size": "5242880", + "type": "ingress", "mode": "dynamic" }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossy_pool": { - "size": "8254464", + "egress_lossless_pool": { + "size": "16777152", "type": "egress", "mode": "dynamic" }, - "OP": "SET" + "egress_lossy_pool": { + "size": "5242880", + "type": "egress", + "mode": "dynamic" + } }, - { - "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"0" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"1518", + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", "dynamic_th":"7" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", "size":"4096", - "dynamic_th":"7" + "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:pg_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", "size":"0", "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"0", "dynamic_th":"7" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", "size":"0", - "dynamic_th":"1" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_INGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_EGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" - }, - "OP": "SET" - }, - - - - { - "BUFFER_PG_TABLE:Ethernet8:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet0:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet4:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet108:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet100:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet104:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet68:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet96:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet124:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet92:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet120:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet52:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet56:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet76:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet72:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet64:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet32:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet16:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet36:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet12:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet88:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet116:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet80:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet112:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet84:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet48:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet44:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet40:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet28:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet60:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet20:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet24:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - - { - "BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "xon":"18432", - "xoff":"75776", - "size":"94208", - "dynamic_th":"1" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "3881382", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" - }, - "OP": "SET" - }, - { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "PORT_QOS_MAP_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" - }, - "OP": "SET" + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } } -] +} diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json new file mode 100644 index 000000000000..6536c620f8cf --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -0,0 +1,30 @@ +[ + { + "PORT_TABLE:Ethernet8": { + "speed": "40000", + "description": "Interface description" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet0": { + "speed": "10000", + "description": "" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet4": { + "speed": "25000", + "description": "" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet12": { + "speed": "1000000", + "description": "Interface description" + }, + "OP": "SET" + } +] diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 89f53af83e41..d3bc25272282 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -243,6 +243,7 @@ 0 0 40000 + Interface description DeviceInterface @@ -256,6 +257,7 @@ 0 0 1000000 + Interface description true diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 47cc006f4662..2eee6fe331c8 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -138,4 +138,4 @@ def test_minigraph_deployment_id(self): def test_minigraph_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'speed': '40000'}") + self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '40000'}") diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index d1cc0d2a3296..5afd1149979f 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -9,6 +9,7 @@ class TestJ2Files(TestCase): def setUp(self): self.test_dir = os.path.dirname(os.path.realpath(__file__)) self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') + self.simple_minigraph = os.path.join(self.test_dir, 'simple-sample-graph.xml') self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml') self.pc_minigraph = os.path.join(self.test_dir, 'pc-test-graph.xml') self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') @@ -33,6 +34,12 @@ def test_alias_map(self): data = json.loads(output) self.assertEqual(data["Ethernet4"], "fortyGigE0/4") + def test_ports_json(self): + ports_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ports.json.j2') + argument = '-m ' + self.simple_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ports_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'ports.json'), self.output_file)) + 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 @@ -78,7 +85,7 @@ def test_ipinip(self): assert filecmp.cmp(sample_output_file, self.output_file) def test_msn27xx_32ports_buffers(self): - buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'msn27xx.32ports.buffers.json.j2') + buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'device', 'mellanox', 'x86_64-mlnx_msn2700-r0', 'ACS-MSN2700', 'buffers.json.j2') argument = '-m ' + self.t1_mlnx_minigraph + ' -p ' + self.mlnx_port_config + ' -t ' + buffer_file + ' > ' + self.output_file self.run_script(argument) @@ -86,7 +93,6 @@ def test_msn27xx_32ports_buffers(self): self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) - def tearDown(self): try: os.remove(self.output_file) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index b386d52bd68b..ff5a3b588cc7 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit b386d52bd68bdc5facbd837e265f49a8350e14a1 +Subproject commit ff5a3b588cc7dbd763fb13c1125710134c8cdd12 diff --git a/src/sonic-platform-common b/src/sonic-platform-common new file mode 160000 index 000000000000..0581611b7be5 --- /dev/null +++ b/src/sonic-platform-common @@ -0,0 +1 @@ +Subproject commit 0581611b7be5cc52aea2877199785fe72f759a58 diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index d1df4717627a..920f29b39186 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit d1df4717627acf9421861545b71e411acf3c5f32 +Subproject commit 920f29b3918635cce14a1e03749ffb1e76bf9abd diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 294f5406e971..cd4cb2784a9c 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 294f5406e971396352b06c3b4954a2f80dd8ba34 +Subproject commit cd4cb2784a9ccbb77d60575e2e2befa7a9cbe925 diff --git a/src/sonic-sairedis b/src/sonic-sairedis index f5d9c8364f5f..36752e19ae8f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit f5d9c8364f5fbcc487a5f1a3e3e6203ab2293a83 +Subproject commit 36752e19ae8f2709bd5d510d6e66ece73c16b71b diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 39f1e23cb834..9a7a70ca2a50 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 39f1e23cb834255955f5270234c8a72b14c11d6f +Subproject commit 9a7a70ca2a50907f30181209f666fc685973d592 diff --git a/src/sonic-swss b/src/sonic-swss index b641aeeac349..60a90d762876 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit b641aeeac349462dd3e3e370bfc55f16602c937f +Subproject commit 60a90d762876955116f6f4a0ec47b2ca2c6f57ed diff --git a/src/sonic-swss-common b/src/sonic-swss-common index adf7d4cb3c22..04b8b84ab6d6 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit adf7d4cb3c22061bf781ef6ce7b79964ce505730 +Subproject commit 04b8b84ab6d66c97d7d727ac80a431b7ba85cf57 diff --git a/src/sonic-utilities b/src/sonic-utilities index 1d37c9c199b7..71c696eaf7dd 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 1d37c9c199b7934653f907095bf11e685889df23 +Subproject commit 71c696eaf7dd0f974f64b69463dac4653db74cb8 diff --git a/src/supervisor/Makefile b/src/supervisor/Makefile index 778903194ffa..3f989c3d0173 100644 --- a/src/supervisor/Makefile +++ b/src/supervisor/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e -MAIN_TARGET = python-supervisor_3.3.2-1_all.deb +MAIN_TARGET = python-supervisor_$(SUPERVISOR_VERSION)-1_all.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files @@ -11,7 +11,15 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Clone supervisor repo git clone https://github.com/Supervisor/supervisor.git pushd ./supervisor - git checkout -f 3.3.2 + + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + git reset --hard $(SUPERVISOR_VERSION) + + # Apply patches + stg init + stg import -s ../patch/series # Build Python and Debian package python setup.py --command-packages=stdeb.command bdist_deb diff --git a/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch b/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch new file mode 100644 index 000000000000..c0263e9baf10 --- /dev/null +++ b/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch @@ -0,0 +1,83 @@ +From bac496af4c2051b3c15038e06533f9094b1c3604 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Tue, 16 Jan 2018 20:42:13 +0000 +Subject: [PATCH 1/2] Prevent excessive hanging/delays in process state + transitions if the system time rolls backward + +--- + supervisor/process.py | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +diff --git a/supervisor/process.py b/supervisor/process.py +index f9ddcd9..216372f 100644 +--- a/supervisor/process.py ++++ b/supervisor/process.py +@@ -357,6 +357,12 @@ class Subprocess: + """ Log a 'waiting for x to stop' message with throttling. """ + if self.state == ProcessStates.STOPPING: + now = time.time() ++ ++ # If the system clock has moved backward, reset ++ # self.laststopreport to current system time ++ if now < self.laststopreport: ++ self.laststopreport = now; ++ + if now > (self.laststopreport + 2): # every 2 seconds + self.config.options.logger.info( + 'waiting for %s to stop' % self.config.name) +@@ -604,12 +610,27 @@ class Subprocess: + # STOPPED -> STARTING + self.spawn() + elif state == ProcessStates.BACKOFF: ++ if self.delay > 0 and now < self.delay - self.backoff: ++ # The system clock appears to have moved backward ++ # Reset self.delay accordingly ++ self.delay = now + self.backoff ++ + if self.backoff <= self.config.startretries: + if now > self.delay: + # BACKOFF -> STARTING + self.spawn() + + if state == ProcessStates.STARTING: ++ if now < self.laststart: ++ # The system clock appears to have moved backward ++ # Reset self.laststart to current system time ++ self.laststart = now; ++ ++ if self.delay > 0 and now < self.delay - self.config.startsecs: ++ # The system clock appears to have moved backward ++ # Reset self.delay accordingly ++ self.delay = now + self.config.startsecs ++ + if now - self.laststart > self.config.startsecs: + # STARTING -> RUNNING if the proc has started + # successfully and it has stayed up for at least +@@ -633,6 +654,11 @@ class Subprocess: + logger.info('gave up: %s %s' % (self.config.name, msg)) + + elif state == ProcessStates.STOPPING: ++ if self.delay > 0 and now < self.delay - self.config.stopwaitsecs: ++ # The system clock appears to have moved backward ++ # Reset self.delay accordingly ++ self.delay = now + self.config.stopwaitsecs ++ + time_left = self.delay - now + if time_left <= 0: + # kill processes which are taking too long to stop with a final +@@ -805,6 +831,12 @@ class EventListenerPool(ProcessGroupBase): + if dispatch_capable: + if self.dispatch_throttle: + now = time.time() ++ ++ # If the system clock has moved backward, reset ++ # self.last_dispatch to current system time ++ if now < self.last_dispatch: ++ self.last_dispatch = now; ++ + if now - self.last_dispatch < self.dispatch_throttle: + return + self.dispatch() +-- +2.1.4 + diff --git a/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch b/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch new file mode 100644 index 000000000000..cb01665ba80b --- /dev/null +++ b/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch @@ -0,0 +1,184 @@ +From 43b6f3ee93593f666af2c6a7af897bf3b5ee762d Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Wed, 17 Jan 2018 22:27:56 +0000 +Subject: [PATCH 2/2] Add unit test cases to ensure state transitions work if + system time has rolled backward + +--- + supervisor/tests/test_process.py | 146 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 146 insertions(+) + +diff --git a/supervisor/tests/test_process.py b/supervisor/tests/test_process.py +index 7f9bab2..ea16315 100644 +--- a/supervisor/tests/test_process.py ++++ b/supervisor/tests/test_process.py +@@ -736,6 +736,40 @@ class SubprocessTests(unittest.TestCase): + instance.stop_report() + self.assertEqual(len(options.logger.data), 1) # throttled + ++ def test_stop_report_laststopreport_in_future(self): ++ future_time = time.time() + 3600 # 1 hour into the future ++ options = DummyOptions() ++ config = DummyPConfig(options, 'test', '/test') ++ instance = self._makeOne(config) ++ instance.pid = 11 ++ dispatcher = DummyDispatcher(writable=True) ++ instance.dispatchers = {'foo':dispatcher} ++ from supervisor.states import ProcessStates ++ instance.state = ProcessStates.STOPPING ++ instance.laststopreport = future_time ++ ++ # This iteration of stop_report() should reset instance.laststopreport ++ # to the current time ++ instance.stop_report() ++ ++ # No logging should have taken place ++ self.assertEqual(len(options.logger.data), 0) ++ ++ # Ensure instance.laststopreport has rolled backward ++ self.assertTrue(instance.laststopreport < future_time) ++ ++ # Sleep for 2 seconds ++ time.sleep(2) ++ ++ # This iteration of stop_report() should actaully trigger the report ++ instance.stop_report() ++ ++ self.assertEqual(len(options.logger.data), 1) ++ self.assertEqual(options.logger.data[0], 'waiting for test to stop') ++ self.assertNotEqual(instance.laststopreport, 0) ++ instance.stop_report() ++ self.assertEqual(len(options.logger.data), 1) # throttled ++ + def test_give_up(self): + options = DummyOptions() + config = DummyPConfig(options, 'test', '/test') +@@ -1402,6 +1436,92 @@ class SubprocessTests(unittest.TestCase): + event = L[0] + self.assertEqual(event.__class__, events.ProcessStateRunningEvent) + ++ def test_transition_starting_to_running_laststart_in_future(self): ++ from supervisor import events ++ L = [] ++ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) ++ from supervisor.states import ProcessStates ++ ++ future_time = time.time() + 3600 # 1 hour into the future ++ options = DummyOptions() ++ test_startsecs = 2 ++ ++ # this should go from STARTING to RUNNING via transition() ++ pconfig = DummyPConfig(options, 'process', 'process','/bin/process', ++ startsecs=test_startsecs) ++ process = self._makeOne(pconfig) ++ process.backoff = 1 ++ process.delay = 1 ++ process.system_stop = False ++ process.laststart = future_time ++ process.pid = 1 ++ process.stdout_buffer = 'abc' ++ process.stderr_buffer = 'def' ++ process.state = ProcessStates.STARTING ++ ++ # This iteration of transition() should reset process.laststart ++ # to the current time ++ process.transition() ++ ++ # Process state should still be STARTING ++ self.assertEqual(process.state, ProcessStates.STARTING) ++ ++ # Ensure process.laststart has rolled backward ++ self.assertTrue(process.laststart < future_time) ++ ++ # Sleep for (startsecs + 1) ++ time.sleep(test_startsecs + 1) ++ ++ # This iteration of transition() should actaully trigger the state ++ # transition to RUNNING ++ process.transition() ++ ++ # this implies RUNNING ++ self.assertEqual(process.backoff, 0) ++ self.assertEqual(process.delay, 0) ++ self.assertFalse(process.system_stop) ++ self.assertEqual(process.state, ProcessStates.RUNNING) ++ self.assertEqual(options.logger.data[0], ++ 'success: process entered RUNNING state, process has ' ++ 'stayed up for > than {} seconds (startsecs)'.format(test_startsecs)) ++ self.assertEqual(len(L), 1) ++ event = L[0] ++ self.assertEqual(event.__class__, events.ProcessStateRunningEvent) ++ ++ def test_transition_backoff_to_starting_delay_in_future(self): ++ from supervisor import events ++ L = [] ++ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) ++ from supervisor.states import ProcessStates, SupervisorStates ++ ++ future_time = time.time() + 3600 # 1 hour into the future ++ options = DummyOptions() ++ ++ pconfig = DummyPConfig(options, 'process', 'process','/bin/process') ++ process = self._makeOne(pconfig) ++ process.laststart = 1 ++ process.delay = future_time ++ process.backoff = 0 ++ process.state = ProcessStates.BACKOFF ++ ++ # This iteration of transition() should reset process.delay ++ # to the current time ++ process.transition() ++ ++ # Process state should still be BACKOFF ++ self.assertEqual(process.state, ProcessStates.BACKOFF) ++ ++ # Ensure process.delay has rolled backward ++ self.assertTrue(process.delay < future_time) ++ ++ # This iteration of transition() should actaully trigger the state ++ # transition to STARTING ++ process.transition() ++ ++ self.assertEqual(process.state, ProcessStates.STARTING) ++ self.assertEqual(len(L), 1) ++ self.assertEqual(L[0].__class__, events.ProcessStateStartingEvent) ++ + def test_transition_backoff_to_fatal(self): + from supervisor import events + L = [] +@@ -2033,6 +2153,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): + self.assertEqual(process1.listener_state, EventListenerStates.BUSY) + self.assertEqual(process1.event, event) + ++ def test_transition_event_proc_running_with_dispatch_throttle_last_dispatch_in_future(self): ++ future_time = time.time() + 3600 # 1 hour into the future ++ options = DummyOptions() ++ from supervisor.states import ProcessStates ++ pconfig1 = DummyPConfig(options, 'process1', 'process1','/bin/process1') ++ process1 = DummyProcess(pconfig1, state=ProcessStates.RUNNING) ++ gconfig = DummyPGroupConfig(options, pconfigs=[pconfig1]) ++ pool = self._makeOne(gconfig) ++ pool.dispatch_throttle = 5 ++ pool.last_dispatch = future_time ++ pool.processes = {'process1': process1} ++ event = DummyEvent() ++ from supervisor.states import EventListenerStates ++ process1.listener_state = EventListenerStates.READY ++ class DummyGroup: ++ config = gconfig ++ process1.group = DummyGroup ++ pool._acceptEvent(event) ++ pool.transition() ++ ++ self.assertEqual(process1.transitioned, True) ++ self.assertEqual(pool.event_buffer, [event]) # not popped ++ ++ # Ensure pool.last_dispatch has been rolled backward ++ self.assertTrue(pool.last_dispatch < future_time) ++ + def test__dispatchEvent_notready(self): + options = DummyOptions() + from supervisor.states import ProcessStates +-- +2.1.4 + diff --git a/src/supervisor/patch/series b/src/supervisor/patch/series new file mode 100644 index 000000000000..d141fddf3301 --- /dev/null +++ b/src/supervisor/patch/series @@ -0,0 +1,2 @@ +0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch +0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch diff --git a/src/tacacs/nss/0001-Modify-user-map-profile.patch b/src/tacacs/nss/0001-Modify-user-map-profile.patch new file mode 100644 index 000000000000..75d037977de4 --- /dev/null +++ b/src/tacacs/nss/0001-Modify-user-map-profile.patch @@ -0,0 +1,1459 @@ +From 43096cf9813d6def1d1f8f1d8a0c122466c8c06b Mon Sep 17 00:00:00 2001 +From: Liuqu +Date: Mon, 9 Oct 2017 02:44:37 -0700 +Subject: [PATCH] Modify user map profile + +* Removed dependence from libtacplus_map and libaudit +* Removed NSS entry point for getpwuid() +* Modified user map profile, create local user account for each TACACS+ user + which not found in local. +* Added "many_to_one" mode, create one local user for many TACACS+ users which + has the same privilege. +* Modified configuration parse and file to adapt to the new user map profile. +--- + Makefile.am | 4 +- + Makefile.in | 2 +- + configure.ac | 2 +- + debian/changelog | 11 + + debian/control | 11 +- + debian/libnss-tacplus.symbols | 1 - + nss_tacplus.c | 1004 +++++++++++++++++++---------------------- + tacplus_nss.conf | 91 ++-- + 8 files changed, 518 insertions(+), 608 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 293951e..b33c455 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -19,7 +19,7 @@ nss_tacplus.h + libnss_tacplus_la_CFLAGS = $(AM_CFLAGS) + # Version 2.0 because that's the NSS module version, and they must match + libnss_tacplus_la_LDFLAGS = -module -version-info 2:0:0 -shared +-libnss_tacplus_la_LIBADD = -ltacplus_map -ltac -laudit ++libnss_tacplus_la_LIBADD = -ltac + + + EXTRA_DIST = tacplus_nss.conf README ChangeLog +@@ -52,7 +52,7 @@ install-data-hook: + rm -f $(DESTDIR)$(libdir)/libnss_tacplus.so $(DESTDIR)$(libdir)/libnss_tacplus.so.2.0.0 + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(sysconfdir) + cd .libs && $(INSTALL_PROGRAM) libnss_tacplus.so $(DESTDIR)$(libdir)/$(NSS_TACPLUS_LIBC_VERSIONED) +- $(STRIP) --keep-symbol=_nss_tacplus_getpwnam_r --keep-symbol=_nss_tacplus_getpwuid_r $(DESTDIR)$(libdir)/$(NSS_TACPLUS_LIBC_VERSIONED) ++ $(STRIP) --keep-symbol=_nss_tacplus_getpwnam_r $(DESTDIR)$(libdir)/$(NSS_TACPLUS_LIBC_VERSIONED) + cd $(DESTDIR)$(libdir); ln -sf $(NSS_TACPLUS_LIBC_VERSIONED) $(NSS_TACPLUS_NSS_VERSIONED) + ${INSTALL} -m 644 tacplus_nss.conf $(DESTDIR)$(sysconfdir) + +diff --git a/Makefile.in b/Makefile.in +index 0d18ce7..5159b37 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -273,7 +273,7 @@ nss_tacplus.h + libnss_tacplus_la_CFLAGS = $(AM_CFLAGS) + # Version 2.0 because that's the NSS module version, and they must match + libnss_tacplus_la_LDFLAGS = -module -version-info 2:0:0 -shared +-libnss_tacplus_la_LIBADD = -ltacplus_map -ltac -laudit ++libnss_tacplus_la_LIBADD = -ltac + EXTRA_DIST = tacplus_nss.conf README ChangeLog + MAINTAINERCLEANFILES = Makefile.in config.h.in configure aclocal.m4 \ + config/config.guess config/config.sub config/depcomp \ +diff --git a/configure.ac b/configure.ac +index 42fb8f9..8c04668 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -53,7 +53,7 @@ dnl -------------------------------------------------------------------- + dnl Checks for header files. + AC_HEADER_STDC + AC_CHECK_HEADERS([nss.h fcntl.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h]) +-AC_CHECK_HEADERS([tacplus/libtac.h]) ++AC_CHECK_HEADERS([libtac/libtac.h]) + + dnl -------------------------------------------------------------------- + dnl Checks for typedefs, structures, and compiler characteristics. +diff --git a/debian/changelog b/debian/changelog +index b24ac24..d4103ed 100644 +--- a/debian/changelog ++++ b/debian/changelog +@@ -1,3 +1,14 @@ ++libnss-tacplus (1.0.4-1) unstable; urgency=low ++ * Removed dependence from libtacplus_map and libaudit ++ * Removed NSS entry point for getpwuid() ++ * Modified user map profile, create local user account for each TACACS+ user ++ which not found in local. ++ * Added "many_to_one" mode, create one local user for many TACACS+ users which ++ has the same privilege. ++ * Modified configuration parse and file to adapt to the new user map profile. ++ ++ -- Chenchen Qi Tue, 10 Oct 2017 14:23:44 +0800 ++ + libnss-tacplus (1.0.3-2) unstable; urgency=low + * Fixed package remove to clean up plugin entries in nsswitch.conf + * New Disabled: added user_homedir config variable to allow per-user +diff --git a/debian/control b/debian/control +index ea65d0b..bdc888f 100644 +--- a/debian/control ++++ b/debian/control +@@ -1,17 +1,14 @@ + Source: libnss-tacplus + Priority: optional + Maintainer: Dave Olson +-Build-Depends: debhelper (>= 9), autotools-dev, libtac-dev (>= 1.4.1~), +- libtacplus-map-dev, libaudit-dev, autoconf, libpam-tacplus-dev, +- dpkg-dev (>= 1.16.1), git ++Build-Depends: debhelper (>= 9), autotools-dev, libtac-dev (>= 1.4.1~) + Section: libs + Standards-Version: 3.9.6 + Homepage: http://www.cumulusnetworks.com + + Package: libnss-tacplus + Architecture: any +-Depends: ${shlibs:Depends}, ${misc:Depends}, libtac2 (>= 1.4.1~), +- libtacplus-map1, libaudit1 ++Depends: ${shlibs:Depends}, ${misc:Depends}, libtac2 (>= 1.4.1~) + Description: NSS module for TACACS+ authentication without local passwd entry +- Performs getpwname and getpwuid lookups via NSS for users logged in via +- tacacs authentication, and mapping done with libtacplus_map ++ Performs getpwname lookups via NSS for users logged in via ++ tacacs authentication +diff --git a/debian/libnss-tacplus.symbols b/debian/libnss-tacplus.symbols +index 2bf9b88..f476e7d 100644 +--- a/debian/libnss-tacplus.symbols ++++ b/debian/libnss-tacplus.symbols +@@ -1,3 +1,2 @@ + libnss_tacplus.so.2 libnss-tacplus #MINVER# + _nss_tacplus_getpwnam_r@Base 1.0.1 +- _nss_tacplus_getpwuid_r@Base 1.0.1 +diff --git a/nss_tacplus.c b/nss_tacplus.c +index 79e62b9..ecfa0b0 100644 +--- a/nss_tacplus.c ++++ b/nss_tacplus.c +@@ -1,7 +1,9 @@ + /* +- * Copyright (C) 2014, 2015, 2016, 2017 Cumulus Networks, Inc. ++ * Copyright (C) 2014, 2015, 2016 Cumulus Networks, Inc. ++ * Copyright (C) 2017 Chenchen Qi + * All rights reserved. + * Author: Dave Olson ++ * Chenchen Qi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -18,15 +20,9 @@ + */ + + /* +- * This plugin implements getpwnam_r for NSS over TACACS+ +- * and implements getpwuid_r for UIDs if and only if a mapped +- * TACACS+ user is currently logged in (libtacplus_map) +- * This means that if you do, e.g.: ls -ld ~tacacs15, you will +- * sometimes get a mapped username, and other times get tacacs15, +- * depending on whether a mapped user is logged in or not. ++ * This plugin implements getpwnam_r for NSS over TACACS+. + */ + +- + #include + #include + #include +@@ -35,18 +31,18 @@ + #include + #include + #include ++#include + #include +-#include +-#include +-#include + +-#include +-#include ++#include + +-#include "nss_tacplus.h" ++#define MIN_TACACS_USER_PRIV (1) ++#define MAX_TACACS_USER_PRIV (15) + + static const char *nssname = "nss_tacplus"; /* for syslogs */ + static const char *config_file = "/etc/tacplus_nss.conf"; ++static const char *user_conf = "/etc/tacplus_user"; ++static const char *user_conf_tmp = "/tmp/tacplus_user_tmp"; + + /* + * pwbuf is used to reduce number of arguments passed around; the strings in +@@ -63,255 +59,239 @@ struct pwbuf { + typedef struct { + struct addrinfo *addr; + char *key; +-} tacplus_server_t; ++ int timeout; ++}tacplus_server_t; ++ ++typedef struct { ++ char *info; ++ int gid; ++ char *secondary_grp; ++ char *shell; ++}useradd_info_t; + + /* set from configuration file parsing */ + static tacplus_server_t tac_srv[TAC_PLUS_MAXSERVERS]; +-static int tac_srv_no, tac_key_no; +-static char tac_service[] = "shell"; +-static char tac_protocol[] = "ssh"; +-static char tac_rhost[INET6_ADDRSTRLEN]; +-static char vrfname[64]; +-static char *exclude_users; +-static uid_t min_uid = ~0U; /* largest possible */ +-static int debug; +-uint16_t use_tachome; +-static int conf_parsed = 0; +- +-static void get_remote_addr(void); +- +-#define MAX_INCL 8 /* max config level nesting */ +- +-/* reset all config variables when we are going to re-parse */ +-static void +-reset_config(void) +-{ +- int i, nservers; ++static int tac_srv_no; ++static useradd_info_t useradd_grp_list[MAX_TACACS_USER_PRIV + 1]; + +- /* reset the config variables that we use, freeing memory where needed */ +- nservers = tac_srv_no; +- tac_srv_no = 0; +- tac_key_no = 0; +- vrfname[0] = '\0'; +- if(exclude_users) { +- (void)free(exclude_users); +- exclude_users = NULL; +- } +- debug = 0; +- use_tachome = 0; +- tac_timeout = 0; +- min_uid = ~0U; +- +- for(i = 0; i < nservers; i++) { +- if(tac_srv[i].key) { +- free(tac_srv[i].key); +- tac_srv[i].key = NULL; +- } +- tac_srv[i].addr = NULL; +- } +-} ++static char *tac_service = "shell"; ++static char *tac_protocol = "ssh"; ++static bool debug = false; ++static bool many_to_one = false; + +-static int nss_tacplus_config(int *errnop, const char *cfile, int top) ++static int parse_tac_server(char *srv_buf) + { +- FILE *conf; +- char lbuf[256]; +- static struct stat lastconf[MAX_INCL]; +- static char *cfilelist[MAX_INCL]; +- struct stat st, *lst; +- +- if(top > MAX_INCL) { +- syslog(LOG_NOTICE, "%s: Config file include depth > %d, ignoring %s", +- nssname, MAX_INCL, cfile); +- return 1; +- } +- +- lst = &lastconf[top-1]; +- if(conf_parsed && top == 1) { +- /* +- * check to see if the config file(s) have changed since last time, +- * in case we are part of a long-lived daemon. If any changed, +- * reparse. If not, return the appropriate status (err or OK) +- * This is somewhat complicated by the include file mechanism. +- * When we have nested includes, we have to check all the config +- * files we saw previously, not just the top level config file. +- */ +- int i; +- for(i=0; i < MAX_INCL; i++) { +- struct stat *cst; +- cst = &lastconf[i]; +- if(!cst->st_ino || !cfilelist[i]) /* end of files */ +- return conf_parsed == 2 ? 0 : 1; +- if (stat(cfilelist[i], &st) || st.st_ino != cst->st_ino || +- st.st_mtime != cst->st_mtime || st.st_ctime != cst->st_ctime) +- break; /* found removed or different file, so re-parse */ +- } +- reset_config(); +- syslog(LOG_NOTICE, "%s: Configuration file(s) have changed, re-initializing", +- nssname); +- } +- +- /* don't check for failures, we'll just skip, don't want to error out */ +- cfilelist[top-1] = strdup(cfile); +- conf = fopen(cfile, "r"); +- if(conf == NULL) { +- *errnop = errno; +- if(!conf_parsed && debug) /* debug because privileges may not allow */ +- syslog(LOG_DEBUG, "%s: can't open config file %s: %m", +- nssname, cfile); +- return 1; +- } +- if (fstat(fileno(conf), lst) != 0) +- memset(lst, 0, sizeof *lst); /* avoid stale data, no warning */ +- +- while(fgets(lbuf, sizeof lbuf, conf)) { +- if(*lbuf == '#' || isspace(*lbuf)) +- continue; /* skip comments, white space lines, etc. */ +- strtok(lbuf, " \t\n\r\f"); /* terminate buffer at first whitespace */ +- if(!strncmp(lbuf, "include=", 8)) { +- /* +- * allow include files, useful for centralizing tacacs +- * server IP address and secret. When running non-privileged, +- * may not be able to read one or more config files. +- */ +- if(lbuf[8]) +- (void)nss_tacplus_config(errnop, &lbuf[8], top+1); +- } +- else if(!strncmp(lbuf, "debug=", 6)) +- debug = strtoul(lbuf+6, NULL, 0); +- else if (!strncmp (lbuf, "user_homedir=", 13)) +- use_tachome = (uint16_t)strtoul(lbuf+13, NULL, 0); +- else if (!strncmp (lbuf, "timeout=", 8)) { +- tac_timeout = (int)strtoul(lbuf+8, NULL, 0); +- if (tac_timeout < 0) /* explict neg values disable poll() use */ +- tac_timeout = 0; +- else /* poll() only used if timeout is explictly set */ +- tac_readtimeout_enable = 1; +- } +- /* +- * This next group is here to prevent a warning in the +- * final "else" case. We don't need them, but if there +- * is a common included file, we might see them. +- */ +- else if(!strncmp(lbuf, "service=", 8) || +- !strncmp(lbuf, "protocol=", 9) || +- !strncmp(lbuf, "login=", 6)) +- ; +- else if(!strncmp(lbuf, "secret=", 7)) { +- int i; +- /* no need to complain if too many on this one */ +- if(tac_key_no < TAC_PLUS_MAXSERVERS) { +- if((tac_srv[tac_key_no].key = strdup(lbuf+7))) +- tac_key_no++; +- else +- syslog(LOG_ERR, "%s: unable to copy server secret %s", +- nssname, lbuf+7); +- } +- /* handle case where 'secret=' was given after a 'server=' +- * parameter, fill in the current secret */ +- for(i = tac_srv_no-1; i >= 0; i--) { +- if (tac_srv[i].key) +- continue; +- tac_srv[i].key = strdup(lbuf+7); +- } +- } +- else if(!strncmp(lbuf, "exclude_users=", 14)) { +- /* +- * Don't lookup users in this comma-separated list for both +- * robustness and performnce. Typically root and other commonly +- * used local users. If set, we also look up the uids +- * locally, and won't do remote lookup on those uids either. +- */ +- exclude_users = strdup(lbuf+14); +- } +- else if(!strncmp(lbuf, "min_uid=", 8)) { +- /* +- * Don't lookup uids that are local, typically set to either +- * 0 or smallest always local user's uid +- */ +- unsigned long uid; +- char *valid; +- uid = strtoul(lbuf+8, &valid, 0); +- if (valid > (lbuf+8)) +- min_uid = (uid_t)uid; +- } +- else if(!strncmp(lbuf, "vrf=", 4)) +- strncpy(vrfname, lbuf + 4, sizeof(vrfname)); +- else if(!strncmp(lbuf, "server=", 7)) { +- if(tac_srv_no < TAC_PLUS_MAXSERVERS) { +- struct addrinfo hints, *servers, *server; ++ char *token; ++ char delim[] = " ,\t\n\r\f"; ++ ++ token = strsep(&srv_buf, delim); ++ while(token) { ++ if('\0' != token) { ++ if(!strncmp(token, "server=", 7)) { ++ struct addrinfo hints, *server; + int rv; +- char *port, server_buf[sizeof lbuf]; ++ char *srv, *port; + + memset(&hints, 0, sizeof hints); +- hints.ai_family = AF_UNSPEC; /* use IPv4 or IPv6, whichever */ ++ hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + +- strcpy(server_buf, lbuf + 7); +- +- port = strchr(server_buf, ':'); +- if(port != NULL) { ++ srv = token + 7; ++ port = strchr(srv, ':'); ++ if(port) { + *port = '\0'; +- port++; ++ port++; + } +- if((rv = getaddrinfo(server_buf, (port == NULL) ? +- "49" : port, &hints, &servers)) == 0) { +- for(server = servers; server != NULL && +- tac_srv_no < TAC_PLUS_MAXSERVERS; +- server = server->ai_next) { ++ ++ if((rv = getaddrinfo(srv, (port == NULL) ? "49" : port, &hints, ++ &server)) == 0) { ++ if(server) { ++ if(tac_srv[tac_srv_no].addr) ++ freeaddrinfo(tac_srv[tac_srv_no].addr); ++ if(tac_srv[tac_srv_no].key) ++ free(tac_srv[tac_srv_no].key); ++ memset(tac_srv + tac_srv_no, 0, sizeof(tacplus_server_t)); ++ + tac_srv[tac_srv_no].addr = server; +- /* use current key, if our index not yet set */ +- if(tac_key_no && !tac_srv[tac_srv_no].key) +- tac_srv[tac_srv_no].key = +- strdup(tac_srv[tac_key_no-1].key); +- tac_srv_no++; ++ } ++ else { ++ syslog(LOG_ERR, "%s: server NULL", nssname); + } + } + else { +- syslog(LOG_ERR, +- "%s: skip invalid server: %s (getaddrinfo: %s)", +- nssname, server_buf, gai_strerror(rv)); ++ syslog(LOG_ERR, "%s: invalid server: %s (getaddrinfo: %s)", ++ nssname, srv, gai_strerror(rv)); ++ return -1; ++ } ++ } ++ else if(!strncmp(token, "secret=", 7)) { ++ if(tac_srv[tac_srv_no].key) ++ free(tac_srv[tac_srv_no].key); ++ tac_srv[tac_srv_no].key = strdup(token + 7); ++ } ++ else if(!strncmp(token, "timeout=", 8)) { ++ tac_srv[tac_srv_no].timeout = (int)strtoul(token + 8, NULL, 0); ++ if(tac_srv[tac_srv_no].timeout < 0) ++ tac_srv[tac_srv_no].timeout = 0; ++ /* Limit timeout to make sure upper application not wait ++ * for a long time*/ ++ if(tac_srv[tac_srv_no].timeout > 5) ++ tac_srv[tac_srv_no].timeout = 5; ++ } ++ } ++ token = strsep(&srv_buf, delim); ++ } ++ ++ return 0; ++} ++ ++static int parse_user_priv(char *buf) ++{ ++ char *token; ++ char delim[] = ";\n\r"; ++ int priv = 0; ++ int gid = 0; ++ char *info = NULL; ++ char *group = NULL; ++ char *shell = NULL; ++ ++ token = strsep(&buf, delim); ++ while(token) { ++ if('\0' != token) { ++ if(!strncmp(token, "user_priv=", 10)) { ++ priv = (int)strtoul(token + 10, NULL, 0); ++ if(priv > MAX_TACACS_USER_PRIV || priv < MIN_TACACS_USER_PRIV) ++ { ++ priv = 0; ++ syslog(LOG_WARNING, "%s: user_priv %d out of range", ++ nssname, priv); + } + } +- else { +- syslog(LOG_WARNING, "%s: maximum number of servers (%d) " +- "exceeded, skipping", nssname, TAC_PLUS_MAXSERVERS); ++ else if(!strncmp(token, "pw_info=", 8)) { ++ if(!info) ++ info = strdup(token + 8); ++ } ++ else if(!strncmp(token, "gid=", 4)) { ++ gid = (int)strtoul(token + 4, NULL, 0); ++ } ++ else if(!strncmp(token, "group=", 6)) { ++ if(!group) ++ group = strdup(token + 6); ++ } ++ else if(!strncmp(token, "shell=", 6)) { ++ if(!shell) ++ shell = strdup(token + 6); + } + } +- else if(debug) /* ignore unrecognized lines, unless debug on */ +- syslog(LOG_WARNING, "%s: unrecognized parameter: %s", +- nssname, lbuf); ++ token = strsep(&buf, delim); + } +- fclose(conf); + ++ if(priv && gid && info && group && shell) { ++ useradd_info_t *user = &useradd_grp_list[priv]; ++ if(user->info) ++ free(user->info); ++ if(user->secondary_grp) ++ free(user->secondary_grp); ++ if(user->shell) ++ free(user->shell); ++ ++ user->gid = gid; ++ user->info = info; ++ user->secondary_grp = group; ++ user->shell = shell; ++ syslog(LOG_DEBUG, "%s: user_priv=%d info=%s gid=%d group=%s shell=%s", ++ nssname, priv, info, gid, group, shell); ++ } ++ else { ++ if(info) ++ free(info); ++ if(group) ++ free(group); ++ if(shell) ++ free(shell); ++ } + + return 0; + } + +-/* +- * Separate function so we can print first time we try to connect, +- * rather than during config. +- * Don't print at config, because often the uid lookup is one we +- * skip due to min_uid, so no reason to clutter the log. +- */ +-static void print_servers(void) ++static void init_useradd_info() + { +- static int printed = 0; +- int n; +- +- if (printed || !debug) +- return; +- printed = 1; +- +- if(tac_srv_no == 0) +- syslog(LOG_DEBUG, "%s:%s: no TACACS %s in config (or no perm)," +- " giving up", +- nssname, __FUNCTION__, tac_srv_no ? "service" : +- (*tac_service ? "server" : "service and no server")); +- +- for(n = 0; n < tac_srv_no; n++) +- syslog(LOG_DEBUG, "%s: server[%d] { addr=%s, key='%s' }", nssname, +- n, tac_srv[n].addr ? tac_ntop(tac_srv[n].addr->ai_addr) +- : "unknown", tac_srv[n].key); ++ useradd_info_t *user; ++ ++ user = &useradd_grp_list[MIN_TACACS_USER_PRIV]; ++ user->gid = 999; ++ user->info = strdup("remote_user"); ++ user->secondary_grp = strdup("docker"); ++ user->shell = strdup("/bin/bash"); ++ ++ user = &useradd_grp_list[MAX_TACACS_USER_PRIV]; ++ user->gid = 1000; ++ user->info = strdup("remote_user_su"); ++ user->secondary_grp = strdup("sudo,docker"); ++ user->shell = strdup("/bin/bash"); ++} ++ ++static int parse_config(const char *file) ++{ ++ FILE *fp; ++ char buf[512] = {0}; ++ ++ init_useradd_info(); ++ fp = fopen(file, "r"); ++ if(!fp) { ++ syslog(LOG_ERR, "%s: %s fopen failed", nssname, file); ++ return NSS_STATUS_UNAVAIL; ++ } ++ ++ debug = false; ++ tac_srv_no = 0; ++ while(fgets(buf, sizeof buf, fp)) { ++ if('#' == *buf || isspace(*buf)) ++ continue; ++ ++ if(!strncmp(buf, "debug=on", 8)) { ++ debug = true; ++ } ++ else if(!strncmp(buf, "many_to_one=y", 13)) { ++ many_to_one = true; ++ } ++ else if(!strncmp(buf, "user_priv=", 10)) { ++ parse_user_priv(buf); ++ } ++ else if(!strncmp(buf, "server=", 7)) { ++ if(TAC_PLUS_MAXSERVERS <= tac_srv_no) { ++ syslog(LOG_ERR, "%s: tac server num is more than %d", ++ nssname, TAC_PLUS_MAXSERVERS); ++ } ++ else if(0 == parse_tac_server(buf)) ++ ++tac_srv_no; ++ } ++ } ++ fclose(fp); ++ ++ if(debug) { ++ int n; ++ useradd_info_t *user; ++ ++ for(n = 0; n < tac_srv_no; n++) { ++ syslog(LOG_DEBUG, "%s: server[%d] { addr=%s, key=%s, timeout=%d }", ++ nssname, n, tac_ntop(tac_srv[n].addr->ai_addr), ++ tac_srv[n].key, tac_srv[n].timeout); ++ } ++ syslog(LOG_DEBUG, "%s: many_to_one %s", nssname, 1 == many_to_one ++ ? "enable" : "disable"); ++ for(n = MIN_TACACS_USER_PRIV; n <= MAX_TACACS_USER_PRIV; n++) { ++ user = &useradd_grp_list[n]; ++ if(user) { ++ syslog(LOG_DEBUG, "%s: user_priv[%d] { gid=%d, info=%s, group=%s, shell=%s }", ++ nssname, n, user->gid, NULL == user->info ? "NULL" : user->info, ++ NULL == user->secondary_grp ? "NULL" : user->secondary_grp, ++ NULL == user->shell ? "NULL" : user->shell); ++ } ++ } ++ } ++ ++ return 0; + } + + /* +@@ -324,15 +304,13 @@ static void print_servers(void) + */ + static int + pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw, +- const char *usename, uint16_t tachome) ++ const char *usename) + { +- int needlen, cnt, origlen = len; +- char *shell; ++ size_t needlen; ++ int cnt; + +- if(!usename) { ++ if(!usename) + usename = srcpw->pw_name; +- tachome = 0; /* early lookups; no tachome */ +- } + + needlen = usename ? strlen(usename) + 1 : 1 + + srcpw->pw_dir ? strlen(srcpw->pw_dir) + 1 : 1 + +@@ -341,8 +319,8 @@ pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw, + srcpw->pw_passwd ? strlen(srcpw->pw_passwd) + 1 : 1; + if(needlen > len) { + if(debug) +- syslog(LOG_DEBUG, "%s provided password buffer too small (%ld<%d)", +- nssname, (long)len, needlen); ++ syslog(LOG_DEBUG, "%s provided password buffer too small (%ld<%ld)", ++ nssname, (long)len, (long)needlen); + return 1; + } + +@@ -354,21 +332,14 @@ pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw, + cnt++; /* allow for null byte also */ + buf += cnt; + len -= cnt; +- cnt = snprintf(buf, len, "%s", srcpw->pw_passwd ? srcpw->pw_passwd : ""); ++ /* If many-to-one mapping, set pw_passwd "a" for pam_account success */ ++ cnt = snprintf(buf, len, "%s", 0 == many_to_one ? "x" : "a"); + destpw->pw_passwd = buf; + cnt++; + buf += cnt; + len -= cnt; + cnt = snprintf(buf, len, "%s", srcpw->pw_shell ? srcpw->pw_shell : ""); + destpw->pw_shell = buf; +- shell = strrchr(buf, '/'); +- shell = shell ? shell+1 : buf; +- if (tachome && *shell == 'r') { +- tachome = 0; +- if(debug > 1) +- syslog(LOG_DEBUG, "%s tacacs login %s with user_homedir not allowed; " +- "shell is %s", nssname, srcpw->pw_name, buf); +- } + cnt++; + buf += cnt; + len -= cnt; +@@ -377,148 +348,227 @@ pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw, + cnt++; + buf += cnt; + len -= cnt; +- if (tachome && usename) { +- char *slash, dbuf[strlen(srcpw->pw_dir) + strlen(usename)]; +- snprintf(dbuf, sizeof dbuf, "%s", srcpw->pw_dir ? srcpw->pw_dir : ""); +- slash = strrchr(dbuf, '/'); +- if (slash) { +- slash++; +- snprintf(slash, sizeof dbuf - (slash-dbuf), "%s", usename); +- } +- cnt = snprintf(buf, len, "%s", dbuf); +- } +- else +- cnt = snprintf(buf, len, "%s", srcpw->pw_dir ? srcpw->pw_dir : ""); ++ cnt = snprintf(buf, len, "%s", srcpw->pw_dir ? srcpw->pw_dir : ""); + destpw->pw_dir = buf; + cnt++; + buf += cnt; + len -= cnt; +- if(len < 0) { +- if(debug) +- syslog(LOG_DEBUG, "%s provided password buffer too small (%ld<%d)", +- nssname, (long)origlen, origlen-(int)len); +- return 1; +- } + + return 0; + } + + /* +- * Find the username or the matching tacacs privilege user in /etc/passwd +- * We use fgetpwent() so we can check the local file, always. +- * This could cause problems if somebody is using local users, ldap, and tacacs, +- * but we just require that the mapped user always be a local user. Since the +- * local user password isn't supposed to be used, that should be OK. +- * +- * We shouldn't normally find the username, because tacacs lookup should be +- * configured to follow local in nsswitch.conf, but somebody may configure the +- * other way, so we look for both the given user, and our "matching" user name +- * based on the tacacs authorization level. +- * +- * If not found, then try to map to a localuser tacacsN where N <= to the +- * TACACS+ privilege level, using the APIs in libtacplus_map.so +- * algorithm in update_mapuser() +- * Returns 0 on success, else 1 ++ * If useradd finished, user name should be deleted in conf. + */ +-static int +-find_pw_userpriv(unsigned priv, struct pwbuf *pb) ++static int delete_conf_line(const char *name) + { +- FILE *pwfile; +- struct passwd upw, tpw, *ent; +- int matches, ret, retu, rett; +- unsigned origpriv = priv; +- char ubuf[pb->buflen], tbuf[pb->buflen]; +- char tacuser[9]; /* "tacacs" followed by 1-2 digits */ +- +- tacuser[0] = '\0'; +- +- pwfile = fopen("/etc/passwd", "r"); +- if(!pwfile) { +- syslog(LOG_WARNING, "%s: failed to open /etc/passwd: %m", nssname); +- return 1; ++ FILE *fp, *fp_tmp; ++ char line[128]; ++ char del_line[128]; ++ int len = strlen(name); ++ ++ if(len >= 126) { ++ syslog(LOG_ERR, "%s: user name %s out of range 128", nssname, name); ++ return -1; ++ } ++ else { ++ snprintf(del_line, 128, "%s\n", name); + } + +-recheck: +- snprintf(tacuser, sizeof tacuser, "tacacs%u", priv); +- tpw.pw_name = upw.pw_name = NULL; +- retu = 0, rett = 0; +- for(matches=0; matches < 2 && (ent = fgetpwent(pwfile)); ) { +- if(!ent->pw_name) +- continue; /* shouldn't happen */ +- if(!strcmp(ent->pw_name, pb->name)) { +- retu = pwcopy(ubuf, sizeof(ubuf), ent, &upw, NULL, use_tachome); +- matches++; +- } +- else if(!strcmp(ent->pw_name, tacuser)) { +- rett = pwcopy(tbuf, sizeof(tbuf), ent, &tpw, NULL, use_tachome); +- matches++; ++ fp = fopen(user_conf, "r"); ++ if(!fp) { ++ syslog(LOG_ERR, "%s: %s fopen failed", nssname, user_conf); ++ return NSS_STATUS_UNAVAIL; ++ } ++ fp_tmp = fopen(user_conf_tmp, "w"); ++ if(!fp_tmp) { ++ syslog(LOG_ERR, "%s: %s fopen failed", nssname, user_conf_tmp); ++ fclose(fp); ++ return NSS_STATUS_UNAVAIL; ++ } ++ ++ while(fgets(line, sizeof line, fp)) { ++ if(strcmp(line, del_line)) { ++ fprintf(fp_tmp, "%s", line); + } + } +- if(!matches && priv > 0) { +- priv--; +- rewind(pwfile); +- goto recheck; +- } +- ret = 1; +- fclose(pwfile); +- if(matches) { +- if(priv != origpriv && debug) +- syslog(LOG_DEBUG, "%s: local user not found at privilege=%u," +- " using %s", nssname, origpriv, tacuser); +- if(upw.pw_name && !retu) +- ret = pwcopy(pb->buf, pb->buflen, &upw, pb->pw, pb->name, +- use_tachome); +- else if(tpw.pw_name && !rett) +- ret = pwcopy(pb->buf, pb->buflen, &tpw, pb->pw, pb->name, +- use_tachome); +- } +- if(ret) +- *pb->errnop = ERANGE; ++ fclose(fp_tmp); ++ fclose(fp); + +- return ret; ++ if(0 != remove(user_conf) || 0 != rename(user_conf_tmp, user_conf)) { ++ syslog(LOG_ERR, "%s: %s rewrite failed", nssname, user_conf); ++ return -1; ++ } ++ ++ return 0; + } + + /* +- * This is similar to find_pw_userpriv(), but passes in a fixed +- * name for UID lookups, where we have the mapped name from the +- * map file, so trying multiple tacacsN users would be wrong. +- * Some commonality, but ugly to factor +- * Only applies to mapped users +- * returns 0 on success ++ * If not found in local, look up in tacacs user conf. If user name is not in ++ * conf, it will be written in conf and created by command 'useradd'. When ++ * useradd command use getpwnam(), it will return when username found in conf. + */ +-static int +-find_pw_user(const char *logname, const char *tacuser, struct pwbuf *pb, +- uint16_t usetachome) ++static int create_local_user(const char *name, int level) + { +- FILE *pwfile; +- struct passwd *ent; +- int ret = 1; ++ FILE *fp; ++ useradd_info_t *user; ++ char buf[512]; ++ int len = 512; ++ int lvl, cnt; ++ bool found = false; ++ ++ fp = fopen(user_conf, "ab+"); ++ if(!fp) { ++ syslog(LOG_ERR, "%s: %s fopen failed", nssname, user_conf); ++ return -1; ++ } + +- if(!tacuser) { ++ while(fgets(buf, sizeof buf, fp)) { ++ if('#' == *buf || isspace(*buf)) ++ continue; ++ // Delete line break ++ cnt = strlen(buf); ++ buf[cnt - 1] = '\0'; ++ if(!strcmp(buf, name)) { ++ found = true; ++ break; ++ } ++ } ++ ++ /* ++ * If user is found in user_conf, it means that getpwnam is called by ++ * useradd in this NSS module. ++ */ ++ if(found) { + if(debug) +- syslog(LOG_DEBUG, "%s: passed null username, failing", nssname); ++ syslog(LOG_DEBUG, "%s: %s found in %s", nssname, name, user_conf); ++ fclose(fp); + return 1; + } + +- pwfile = fopen("/etc/passwd", "r"); +- if(!pwfile) { +- syslog(LOG_WARNING, "%s: failed to open /etc/passwd: %m", +- nssname); +- return 1; ++ snprintf(buf, len, "%s\n", name); ++ if(EOF == fputs(buf, fp)) { ++ syslog(LOG_ERR, "%s: %s write local user failed", nssname, name); ++ fclose(fp); ++ return -1; ++ } ++ fclose(fp); ++ ++ lvl = level; ++ while(lvl >= MIN_TACACS_USER_PRIV) { ++ user = &useradd_grp_list[lvl]; ++ if(user->info && user->secondary_grp && user->shell) { ++ snprintf(buf, len, "useradd -G %s \"%s\" -g %d -c \"%s\" -d /home/%s -m -s %s", ++ user->secondary_grp, name, user->gid, user->info, name, user->shell); ++ fp = popen(buf, "r"); ++ if(!fp || -1 == pclose(fp)) { ++ syslog(LOG_ERR, "%s: useradd popen failed errno=%d %s", ++ nssname, errno, strerror(errno)); ++ delete_conf_line(name); ++ return -1; ++ } ++ if(debug) ++ syslog(LOG_DEBUG, "%s: create local user %s success", nssname, name); ++ delete_conf_line(name); ++ return 0; ++ } ++ lvl--; ++ } ++ ++ return -1; ++} ++ ++/* ++ * Lookup user in /etc/passwd, and fill up passwd info if found. ++ */ ++static int lookup_pw_local(char* username, struct pwbuf *pb, bool *found) ++{ ++ FILE *fp; ++ struct passwd *pw = NULL; ++ int ret = 0; ++ ++ if(!username) { ++ syslog(LOG_ERR, "%s: username invalid in check passwd", nssname); ++ return -1; + } + +- pb->pw->pw_name = NULL; /* be paranoid */ +- for(ret = 1; ret && (ent = fgetpwent(pwfile)); ) { +- if(!ent->pw_name) +- continue; /* shouldn't happen */ +- if(!strcmp(ent->pw_name, tacuser)) { +- ret = pwcopy(pb->buf, pb->buflen, ent, pb->pw, logname, usetachome); ++ fp = fopen("/etc/passwd", "r"); ++ if(!fp) { ++ syslog(LOG_ERR, "%s: /etc/passwd fopen failed", nssname); ++ return -1; ++ } ++ ++ while(0 != (pw = fgetpwent(fp))) { ++ if(!strcmp(pw->pw_name, username)) { ++ *found = true; ++ ret = pwcopy(pb->buf, pb->buflen, pw, pb->pw, username); ++ if(ret) ++ *pb->errnop = ERANGE; + break; + } + } +- fclose(pwfile); +- if(ret) +- *pb->errnop = ERANGE; ++ fclose(fp); ++ return ret; ++} ++ ++/* ++ * Lookup local user passwd info for TACACS+ user. If not found, local user will ++ * be created by user mapping strategy. ++ */ ++static int lookup_user_pw(struct pwbuf *pb, int level) ++{ ++ char *username = NULL; ++ char buf[128]; ++ int len = 128; ++ bool found = false; ++ int ret = 0; ++ ++ if(level < MIN_TACACS_USER_PRIV || level > MAX_TACACS_USER_PRIV) { ++ syslog(LOG_ERR, "%s: TACACS+ user %s privilege %d invalid", nssname, pb->name, level); ++ return -1; ++ } ++ ++ /* ++ * If many-to-one user mapping disable, create local user for each TACACS+ user ++ * The username of local user and TACACS+ user is the same. If many-to-one enable, ++ * look up the mapped local user name and passwd info. ++ */ ++ if(0 == many_to_one) { ++ username = pb->name; ++ } ++ else { ++ int lvl = level; ++ useradd_info_t *user; ++ ++ while(lvl >= MIN_TACACS_USER_PRIV) { ++ user = &useradd_grp_list[lvl]; ++ if(user->info && user->secondary_grp && user->shell) { ++ snprintf(buf, len, "%s", user->info); ++ username = buf; ++ if(debug) ++ syslog(LOG_DEBUG, "%s: %s mapping local user %s", nssname, ++ pb->name, username); ++ break; ++ } ++ lvl--; ++ } ++ } ++ ++ ret = lookup_pw_local(username, pb, &found); ++ if(debug) ++ syslog(LOG_DEBUG, "%s: %s passwd %s found in local", nssname, username, ++ found ? "is" : "isn't"); ++ if(0 != ret || found) ++ return ret; ++ ++ if(0 != create_local_user(username, level)) ++ return -1; ++ ++ ret = lookup_pw_local(username, pb, &found); ++ if(0 == ret && !found) { ++ syslog(LOG_ERR, "%s: %s not found in local after useradd", nssname, pb->name); ++ ret = -1; ++ } + + return ret; + } +@@ -532,6 +582,7 @@ static int + got_tacacs_user(struct tac_attrib *attr, struct pwbuf *pb) + { + unsigned long priv_level = 0; ++ int ret; + + while(attr != NULL) { + /* we are looking for the privilege attribute, can be in several forms, +@@ -550,14 +601,20 @@ got_tacacs_user(struct tac_attrib *attr, struct pwbuf *pb) + /* if this fails, we leave priv_level at 0, which is + * least privileged, so that's OK, but at least report it + */ +- if(ok == val && debug) +- syslog(LOG_WARNING, "%s: non-numeric privilege for %s, (%s)", +- nssname, pb->name, attr->attr); ++ if(debug) ++ syslog(LOG_DEBUG, "%s: privilege for %s, (%lu)", ++ nssname, pb->name, priv_level); + } + attr = attr->next; + } + +- return find_pw_userpriv(priv_level, pb); ++ ret = lookup_user_pw(pb, priv_level); ++ if(!ret && debug) ++ syslog(LOG_DEBUG, "%s: pw_name=%s, pw_passwd=%s, pw_shell=%s, dir=%s", ++ nssname, pb->pw->pw_name, pb->pw->pw_passwd, pb->pw->pw_shell, ++ pb->pw->pw_dir); ++ ++ return ret; + } + + /* +@@ -570,9 +627,13 @@ connect_tacacs(struct tac_attrib **attr, int srvr) + { + int fd; + ++ if(!*tac_service) /* reported at config file processing */ ++ return -1; ++ + fd = tac_connect_single(tac_srv[srvr].addr, tac_srv[srvr].key, NULL, +- vrfname[0]?vrfname:NULL); ++ tac_srv[srvr].timeout); + if(fd >= 0) { ++ *attr = NULL; /* so tac_add_attr() allocates memory */ + tac_add_attrib(attr, "service", tac_service); + if(tac_protocol[0]) + tac_add_attrib(attr, "protocol", tac_protocol); +@@ -598,34 +659,9 @@ lookup_tacacs_user(struct pwbuf *pb) + { + struct areply arep; + int ret = 1, done = 0; +- struct tac_attrib *attr = NULL; ++ struct tac_attrib *attr; + int tac_fd, srvr; + +- if (exclude_users) { +- char *user, *list; +- list = strdup(exclude_users); +- if (list) { +- static const char *delim = ", \t\n"; +- bool islocal = 0; +- user = strtok(list, delim); +- list = NULL; +- while (user) { +- if(!strcmp(user, pb->name)) { +- islocal = 1; +- break; +- } +- user = strtok(NULL, delim); +- } +- free(list); +- if (islocal) +- return 2; +- } +- } +- +- if(!*tac_service) /* reported at config file processing */ +- return ret; +- print_servers(); +- + for(srvr=0; srvr < tac_srv_no && !done; srvr++) { + arep.msg = NULL; + arep.attr = NULL; +@@ -636,14 +672,13 @@ lookup_tacacs_user(struct pwbuf *pb) + syslog(LOG_WARNING, "%s: failed to connect TACACS+ server %s," + " ret=%d: %m", nssname, tac_srv[srvr].addr ? + tac_ntop(tac_srv[srvr].addr->ai_addr) : "unknown", tac_fd); +- tac_free_attrib(&attr); + continue; + } +- ret = tac_author_send(tac_fd, pb->name, "", tac_rhost, attr); ++ ret = tac_author_send(tac_fd, pb->name, "", "", attr); + if(ret < 0) { + if(debug) +- syslog(LOG_WARNING, "%s: TACACS+ server %s authorization failed (%d) " +- " user (%s)", nssname, tac_srv[srvr].addr ? ++ syslog(LOG_WARNING, "%s: TACACS+ server %s send failed (%d) for" ++ " user %s: %m", nssname, tac_srv[srvr].addr ? + tac_ntop(tac_srv[srvr].addr->ai_addr) : "unknown", ret, + pb->name); + } +@@ -668,14 +703,11 @@ lookup_tacacs_user(struct pwbuf *pb) + if(arep.status == AUTHOR_STATUS_PASS_ADD || + arep.status == AUTHOR_STATUS_PASS_REPL) { + ret = got_tacacs_user(arep.attr, pb); +- if(debug>1) ++ if(debug) + syslog(LOG_DEBUG, "%s: TACACS+ server %s successful for user %s." + " local lookup %s", nssname, + tac_ntop(tac_srv[srvr].addr->ai_addr), pb->name, +- ret?"OK":"no match"); +- else if(debug) +- syslog(LOG_DEBUG, "%s: TACACS+ server %s successful for user %s", +- nssname, tac_ntop(tac_srv[srvr].addr->ai_addr), pb->name); ++ ret == 0?"OK":"no match"); + done = 1; /* break out of loop after arep cleanup */ + } + else { +@@ -692,30 +724,12 @@ lookup_tacacs_user(struct pwbuf *pb) + tac_free_attrib(&arep.attr); + } + +- return ret < 0? 1 : ret; +-} +- +-static int +-lookup_mapped_uid(struct pwbuf *pb, uid_t uid, uid_t auid, int session) +-{ +- char *loginname, mappedname[256]; +- uint16_t flag; +- +- mappedname[0] = '\0'; +- loginname = lookup_mapuid(uid, auid, session, +- mappedname, sizeof mappedname, &flag); +- if(loginname) +- return find_pw_user(loginname, mappedname, pb, flag & MAP_USERHOMEDIR); +- return 1; ++ return ret; + } + + /* + * This is an NSS entry point. +- * We implement getpwnam(), because we remap from the tacacs login +- * to the local tacacs0 ... tacacs15 users for all other info, and so +- * the normal order of "passwd tacplus" (possibly with ldap or anything +- * else prior to tacplus) will mean we only get used when there isn't +- * a local user to be found. ++ * We implement getpwnam(), because we remap from the tacacs. + * + * We try the lookup to the tacacs server first. If we can't make a + * connection to the server for some reason, we also try looking up +@@ -730,20 +744,25 @@ enum nss_status _nss_tacplus_getpwnam_r(const char *name, struct passwd *pw, + int result; + struct pwbuf pbuf; + +- result = nss_tacplus_config(errnop, config_file, 1); +- conf_parsed = result == 0 ? 2 : 1; ++ /* ++ * When filename completion is used with the tab key in bash, getpwnam ++ * is invoked. And the parameter "name" is '*'. In order not to connect to ++ * TACACS+ server frequently, check user name whether is valid. ++ */ ++ if(!strcmp(name, "*")) ++ return NSS_STATUS_NOTFOUND; + +- get_remote_addr(); ++ result = parse_config(config_file); + +- if(result) { /* no config file, no servers, etc. */ +- /* this is a debug because privileges may not allow access */ +- if(debug) +- syslog(LOG_DEBUG, "%s: bad config or server line for nss_tacplus", ++ if(result) { ++ syslog(LOG_ERR, "%s: bad config or server line for nss_tacplus", ++ nssname); ++ } ++ else if(0 == tac_srv_no) { ++ syslog(LOG_WARNING, "%s: no tacacs server in config for nss_tacplus", + nssname); + } + else { +- int lookup; +- + /* marshal the args for the lower level functions */ + pbuf.name = (char *)name; + pbuf.pw = pw; +@@ -751,126 +770,13 @@ enum nss_status _nss_tacplus_getpwnam_r(const char *name, struct passwd *pw, + pbuf.buflen = buflen; + pbuf.errnop = errnop; + +- lookup = lookup_tacacs_user(&pbuf); +- if(!lookup) ++ if(0 == lookup_tacacs_user(&pbuf)) { + status = NSS_STATUS_SUCCESS; +- else if(lookup == 1) { /* 2 means exclude_users match */ +- uint16_t flag; +- /* +- * If we can't contact a tacacs server (either not configured, or +- * more likely, we aren't running as root and the config for the +- * server is not readable by our uid for security reasons), see if +- * we can find the user via the mapping database, and if so, use +- * that. This will work for non-root users as long as the requested +- * name is in use (that is, logged in), which will be the most +- * common case of wanting to use the original login name by non-root +- * users. +- */ +- char *mapname = lookup_mapname(name, -1, -1, NULL, &flag); +- if(mapname != name && !find_pw_user(name, mapname, &pbuf, +- flag & MAP_USERHOMEDIR)) +- status = NSS_STATUS_SUCCESS; ++ if(debug) ++ syslog(LOG_DEBUG, "%s: name=%s, pw_name=%s, pw_passwd=%s, pw_shell=%s", ++ nssname, name, pw->pw_name, pw->pw_passwd, pw->pw_shell); + } + } +- return status; +-} + +-/* +- * This is an NSS entry point. +- * We implement getpwuid(), for anything that wants to get the original +- * login name from the uid. +- * If it matches an entry in the map, we use that data to replace +- * the data from the local passwd file (not via NSS). +- * locally from the map. +- * +- * This can be made to work 2 different ways, and we need to choose +- * one, or make it configurable. +- * +- * 1) Given a valid auid and a session id, and a mapped user logged in, +- * we'll match only that user. That is, we can only do the lookup +- * successfully for child processes of the mapped tacacs login, and +- * only while still logged in (map entry is valid). +- * +- * 2) Use auid/session wildcards, and and always match on the first valid +- * tacacs map file entry. This means if two tacacs users are logged in +- * at the same privilege level at the same time, uid lookups for ps, ls, +- * etc. will return the first (in the map file, not necessarily first +- * logged in) mapped name. +- * +- * For now, if auid and session are set, I try them, and if that lookup +- * fails, try the wildcard. +- * +- * Only works while the UID is in use for a mapped user, and only +- * for processes invoked from that session. Other callers will +- * just get the files, ldap, or nis entry for the UID +- * Only works while the UID is in use for a mapped user, and returns +- * the first match from the mapped users. +- */ +-enum nss_status _nss_tacplus_getpwuid_r(uid_t uid, struct passwd *pw, +- char *buffer, size_t buflen, int *errnop) +-{ +- struct pwbuf pb; +- enum nss_status status = NSS_STATUS_NOTFOUND; +- int session, ret; +- uid_t auid; +- +- ret = nss_tacplus_config(errnop, config_file, 1); +- conf_parsed = ret == 0 ? 2 : 1; +- +- if (min_uid != ~0U && uid < min_uid) { +- if(debug > 1) +- syslog(LOG_DEBUG, "%s: uid %u < min_uid %u, don't lookup", +- nssname, uid, min_uid); +- return status; +- } +- +- auid = audit_getloginuid(); /* audit_setloginuid not called */ +- session = map_get_sessionid(); +- +- /* marshal the args for the lower level functions */ +- pb.pw = pw; +- pb.buf = buffer; +- pb.buflen = buflen; +- pb.errnop = errnop; +- pb.name = NULL; +- +- /* +- * the else case will only be called if we don't have an auid or valid +- * sessionid, since otherwise the first call will be using wildcards, +- * since the getloginuid and get_sessionid calls will "fail". +- */ +- if(!lookup_mapped_uid(&pb, uid, auid, session)) +- status = NSS_STATUS_SUCCESS; +- else if((auid != (uid_t)-1 || session != ~0U) && +- !lookup_mapped_uid(&pb, uid, (uid_t)-1, ~0)) +- status = NSS_STATUS_SUCCESS; + return status; + } +- +-static void get_remote_addr(void) +-{ +- struct sockaddr_storage addr; +- socklen_t len = sizeof addr; +- char ipstr[INET6_ADDRSTRLEN]; +- +- /* This is so we can fill in the rhost field when we talk to the +- * TACACS+ server, when it's an ssh connection, so sites that refuse +- * authorization unless from specific IP addresses will get that +- * information. It's pretty much of a hack, but it works. +- */ +- if (getpeername(0, (struct sockaddr*)&addr, &len) == -1) +- return; +- +- *ipstr = 0; +- if (addr.ss_family == AF_INET) { +- struct sockaddr_in *s = (struct sockaddr_in *)&addr; +- inet_ntop(AF_INET, &s->sin_addr, ipstr, sizeof ipstr); +- } else { +- struct sockaddr_in6 *s = (struct sockaddr_in6 *)&addr; +- inet_ntop(AF_INET6, &s->sin6_addr, ipstr, sizeof ipstr); +- } +- +- snprintf(tac_rhost, sizeof tac_rhost, "%s", ipstr); +- if(debug > 1 && tac_rhost[0]) +- syslog(LOG_DEBUG, "%s: rhost=%s", nssname, tac_rhost); +-} +diff --git a/tacplus_nss.conf b/tacplus_nss.conf +index bb4eb1e..7cb756f 100644 +--- a/tacplus_nss.conf ++++ b/tacplus_nss.conf +@@ -1,53 +1,50 @@ +-#%NSS_TACPLUS-1.0 +-# Install this file as /etc/tacplus_nss.conf +-# Edit /etc/nsswitch.conf to add tacplus to the passwd lookup, similar to this +-# where tacplus precede compat (or files), and depending on local policy can +-# follow or precede ldap, nis, etc. +-# passwd: tacplus compat +-# +-# Servers are tried in the order listed, and once a server +-# replies, no other servers are attempted in a given process instantiation +-# +-# This configuration is similar to the libpam_tacplus configuration, but +-# is maintained as a configuration file, since nsswitch.conf doesn't +-# support passing parameters. Parameters must start in the first +-# column, and parsing stops at the first whitespace +- +-# if set, errors and other issues are logged with syslog +-# debug=1 ++# Configuration for libnss-tacplus + +-# min_uid is the minimum uid to lookup via tacacs. Setting this to 0 +-# means uid 0 (root) is never looked up, good for robustness and performance +-# Cumulus Linux ships with it set to 1001, so we never lookup our standard +-# local users, including the cumulus uid of 1000. Should not be greater +-# than the local tacacs{0..15} uids +-min_uid=1001 ++# debug - If you want to open debug log, set it on ++# ++# Default: off ++# debug=on + +-# This is a comma separated list of usernames that are never sent to +-# a tacacs server, they cause an early not found return. ++# src_ip - set source address of TACACS+ protocl packets + # +-# "*" is not a wild card. While it's not a legal username, it turns out +-# that during pathname completion, bash can do an NSS lookup on "*" +-# To avoid server round trip delays, or worse, unreachable server delays +-# on filename completion, we include "*" in the exclusion list. +-exclude_users=root,cumulus,quagga,sshd,ntp,* ++# Default: None (it means the ip address of out port) ++# src_ip=2.2.2.2 + +-# The include keyword allows centralizing the tacacs+ server information +-# including the IP address and shared secret +-include=/etc/tacplus_servers ++# server - set ip address, tcp port, secret string and timeout for TACACS+ servers ++# The maximum number of servers is 8. If there is no TACACS+ server, libnss-tacplus ++# will always return pwname not found. ++# ++# Default: None (no TACACS+ server) ++# server=1.1.1.1:49,secret=test,timeout=3 + +-# The server IP address can be optionally followed by a ':' and a port +-# number (server=1.1.1.1:49). It is strongly recommended that you NOT +-# add secret keys to this file, because it is world readable. +-#secret=SECRET1 +-#server=1.1.1.1 ++# user_priv - set the map between TACACS+ user privilege and local user's passwd ++# If TACACS+ user validate ok, it will get passwd info from local user which is ++# specially created for TACACS+ user in libnss-tacplus. This configuration is provided ++# to create local user. There is two user privilege map by default. ++# If the TACACS+ user's privilege value is in [1, 14], the config of user_priv 1 is ++# used to create local user. If user_priv 7 is added, the TACACS+ user which privilege ++# value is in [1, 6] will get the config of user_priv 1, and the value in [7, 14] will ++# get user_priv 7. ++# ++# If the passwd info of mapped local user is modified, like gid and shell, the new TACACS+ ++# user will create local user by the new config. But the old TACACS+ user which has logged ++# will not modify its mapped local user's passwd info. So it's better to keep this ++# configuration unchanged, not to modified at the running time. Or simply delete the old ++# mapped local user after modified. ++# ++# NOTE: If many_to_one enables, 'pw_info' is used for mapped local user name. So note the ++# naming rule for Linux user name when you set 'pw_info', and keep it different from other ++# 'pw_info'. ++# ++# Default: ++# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash ++# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash + +-# The connection timeout for an NSS library should be short, since it is +-# invoked for many programs and daemons, and a failure is usually not +-# catastrophic. Not set or set to a negative value disables use of poll(). +-# This follows the include of tacplus_servers, so it can override any +-# timeout value set in that file. +-# It's important to have this set in this file, even if the same value +-# as in tacplus_servers, since tacplus_servers should not be readable +-# by users other than root. +-timeout=5 ++# many_to_one - create one local user for many TACACS+ users which has the same privilege ++# The parameter 'pw_info' in 'user_priv' is used for the mapped local user name. ++# The default config is one to one mapping. It will create local user for each TACACS+ user ++# which has different username. The user mapping strategy should be set before enables ++# TACACS+, and keep constant at the running time. ++# ++# Default: many_to_one=n ++# many_to_one=y +-- +2.7.4 + diff --git a/src/tacacs/nss/Makefile b/src/tacacs/nss/Makefile new file mode 100644 index 000000000000..4f1a337b34b4 --- /dev/null +++ b/src/tacacs/nss/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = libnss-tacplus_$(NSS_TACPLUS_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtain libnss-tacplus + rm -rf ./libnss-tacplus + git clone https://github.com/daveolson53/libnss-tacplus.git + pushd ./libnss-tacplus + git checkout -f 19008ab + + # Apply patch + git apply ../0001-Modify-user-map-profile.patch + + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/tacacs/pam/0001-Don-t-init-declarations-in-a-for-loop.patch b/src/tacacs/pam/0001-Don-t-init-declarations-in-a-for-loop.patch new file mode 100644 index 000000000000..f9a9c29eb93f --- /dev/null +++ b/src/tacacs/pam/0001-Don-t-init-declarations-in-a-for-loop.patch @@ -0,0 +1,45 @@ +From f293353127c504490f8d892afe39766ec94137bf Mon Sep 17 00:00:00 2001 +From: Liuqu +Date: Sun, 8 Oct 2017 07:32:11 -0700 +Subject: [PATCH 1/2] Don't init declarations in a for loop + +* It comes from the commit "3299028... Don't init declarations in + a for loop", and modified source format to resolve conflict in + v1.4.1 +--- + libtac/lib/author_r.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/libtac/lib/author_r.c b/libtac/lib/author_r.c +index a028144..f3b544e 100644 +--- a/libtac/lib/author_r.c ++++ b/libtac/lib/author_r.c +@@ -47,6 +47,7 @@ int tac_author_read(int fd, struct areply *re) { + char *msg = NULL; + int timeleft; + re->msg = NULL; ++ unsigned int r = 0; + + bzero(re, sizeof(struct areply)); + if (tac_readtimeout_enable && +@@ -132,7 +133,7 @@ int tac_author_read(int fd, struct areply *re) { + pktp = (u_char *) tb + TAC_AUTHOR_REPLY_FIXED_FIELDS_SIZE; + + /* cycle through the arguments supplied in the packet */ +- for (unsigned int r = 0; r < tb->arg_cnt && r < TAC_PLUS_MAX_ARGCOUNT; r++) { ++ for (r = 0; r < tb->arg_cnt && r < TAC_PLUS_MAX_ARGCOUNT; r++) { + if (len_from_body > packet_read || ((void *)pktp - (void *) tb) > packet_read) { + TACSYSLOG((LOG_ERR,\ + "%s: arguments supplied in packet seem to exceed its size",\ +@@ -205,7 +206,7 @@ int tac_author_read(int fd, struct areply *re) { + TACSYSLOG((LOG_DEBUG, "Args cnt %d", tb->arg_cnt)); + /* argp points to current argument string + pktp points to current argument length */ +- for (unsigned int r = 0; r < tb->arg_cnt && r < TAC_PLUS_MAX_ARGCOUNT; ++ for (r = 0; r < tb->arg_cnt && r < TAC_PLUS_MAX_ARGCOUNT; + r++) { + unsigned char buff[256]; + unsigned char *sep; +-- +2.7.4 + diff --git a/src/tacacs/pam/0002-Fix-libtac2-bin-install-directory-error.patch b/src/tacacs/pam/0002-Fix-libtac2-bin-install-directory-error.patch new file mode 100644 index 000000000000..28518b3d2449 --- /dev/null +++ b/src/tacacs/pam/0002-Fix-libtac2-bin-install-directory-error.patch @@ -0,0 +1,19 @@ +From 85bae6b84d93c4b243d29ee08ff7030376bf80cb Mon Sep 17 00:00:00 2001 +From: Liuqu +Date: Sun, 8 Oct 2017 19:39:23 -0700 +Subject: [PATCH 2/2] Fix libtac2-bin install directory error + +--- + debian/libtac2-bin.install | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/debian/libtac2-bin.install b/debian/libtac2-bin.install +index 236670a..1df36c6 100644 +--- a/debian/libtac2-bin.install ++++ b/debian/libtac2-bin.install +@@ -1 +1 @@ +-usr/sbin ++usr/bin/* +-- +2.7.4 + diff --git a/src/tacacs/pam/Makefile b/src/tacacs/pam/Makefile new file mode 100644 index 000000000000..707668791402 --- /dev/null +++ b/src/tacacs/pam/Makefile @@ -0,0 +1,25 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = libpam-tacplus_$(PAM_TACPLUS_VERSION)_amd64.deb +DERIVED_TARGETS = libtac2_$(PAM_TACPLUS_VERSION)_amd64.deb \ + libtac-dev_$(PAM_TACPLUS_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtain pam_tacplus + rm -rf ./pam_tacplus + git clone https://github.com/jeroennijhof/pam_tacplus.git + pushd ./pam_tacplus + git checkout -f v1.4.1 + + # Apply patch + git apply ../0001-Don-t-init-declarations-in-a-for-loop.patch + git apply ../0002-Fix-libtac2-bin-install-directory-error.patch + + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)