From eec49a2e09538b7b0dc93ef6aab72c1e6c5e0a67 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Sun, 6 Mar 2022 22:04:18 -0800 Subject: [PATCH 01/54] [yang] support acl MIRROR_ACTION (#10100) Why I did it ACL doesn't have mirror related action How I did it Add 'MIRROR_INGRESS_ACTION' and 'MIRROR_EGRESS_ACTION' to sonic-acl.yang.j2 How to verify it Run the YANG model unit tests --- .../tests/files/sample_config_db.json | 15 ++++ .../tests/yang_model_tests/tests/acl.json | 7 ++ .../yang_model_tests/tests_config/acl.json | 70 +++++++++++++++++++ .../yang-templates/sonic-acl.yang.j2 | 16 +++++ 4 files changed, 108 insertions(+) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index e7b03092efac..89b27eb5f5c2 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -282,6 +282,11 @@ "SRC_IPV6": "::/0", "PRIORITY": "990000", "DST_IPV6": "::/0" + }, + "EVERFLOW_DSCP|RULE_1": { + "MIRROR_INGRESS_ACTION": "erspan", + "DSCP": "10", + "PRIORITY": "9999" } }, "DEVICE_METADATA": { @@ -750,7 +755,17 @@ "Ethernet25", "Ethernet24" ] + }, + "EVERFLOW_DSCP": { + "type": "MIRROR_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "Ethernet14", + "Ethernet24" + ], + "stage": "ingress" } + }, "PBH_HASH_FIELD": { "inner_ip_proto": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json index 8c307c30f294..980622cbd3e8 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json @@ -105,5 +105,12 @@ }, "ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": { "desc": "Configure CTRLPLANE with proper action ACCEPT." + }, + "ACL_RULE_WITH_INVALID_MIRROR_INGRESS_ACTION": { + "desc": "Configure ACL_RULE with invalid mirror action.", + "eStrKey" : "LeafRef" + }, + "ACL_RULE_WITH_VALID_MIRROR_INGRESS_ACTION": { + "desc": "Configure ACL_RULE with valid mirror action." } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json index 98acc17a63a4..b2aa6b3fb15d 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json @@ -820,5 +820,75 @@ ] } } + }, + "ACL_RULE_WITH_INVALID_MIRROR_INGRESS_ACTION": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "MIRROR_INGRESS_ACTION": "mirror_session_dscp", + "PRIORITY": 9999, + "RULE_NAME": "Rule_20", + "DSCP": "10" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "" + ], + "stage": "ingress", + "type": "MIRROR_DSCP" + } + ] + } + } + }, + "ACL_RULE_WITH_VALID_MIRROR_INGRESS_ACTION": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "MIRROR_INGRESS_ACTION": "mirror_session_dscp", + "PRIORITY": 9999, + "RULE_NAME": "Rule_20", + "DSCP": "10" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "" + ], + "stage": "ingress", + "type": "MIRROR_DSCP" + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "sonic-mirror-session:MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name":"mirror_session_dscp", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } } } diff --git a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 index f38844d09fe8..d007f82e0964 100644 --- a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 @@ -33,6 +33,10 @@ module sonic-acl { prefix lag; } + import sonic-mirror-session { + prefix sms; + } + description "ACL YANG Module for SONiC OS"; revision 2019-07-01 { @@ -65,6 +69,18 @@ module sonic-acl { type stypes:packet_action; } + leaf MIRROR_INGRESS_ACTION { + type leafref { + path "/sms:sonic-mirror-session/sms:MIRROR_SESSION/sms:MIRROR_SESSION_LIST/sms:name"; + } + } + + leaf MIRROR_EGRESS_ACTION { + type leafref { + path "/sms:sonic-mirror-session/sms:MIRROR_SESSION/sms:MIRROR_SESSION_LIST/sms:name"; + } + } + leaf IP_TYPE { type stypes:ip_type; } From 78e867a79403efd80915e66ff51ebe1733d72a2a Mon Sep 17 00:00:00 2001 From: ganglv <88995770+ganglyu@users.noreply.github.com> Date: Mon, 7 Mar 2022 15:54:05 +0800 Subject: [PATCH 02/54] [YANG]: Update port Yang models to support multi-asic platform (#10113) Why I did it Multi-asic platform add aisc_port_name and role to PORT table, and port_index range is changed. How I did it Update sonic-port.yang, add asic_port_name and role, and remove range limitation. How to verify it Run UT for sonic-yang-models. Signed-off-by: Gang Lv ganglv@microsoft.com --- .../tests/files/sample_config_db.json | 5 +- .../tests/yang_model_tests/tests/port.json | 8 +++ .../yang_model_tests/tests_config/port.json | 71 +++++++++++++++++++ .../yang-models/sonic-port.yang | 15 +++- 4 files changed, 96 insertions(+), 3 deletions(-) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 89b27eb5f5c2..6dbffce671e9 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -420,7 +420,10 @@ "description": "", "speed": "11100", "tpid": "0x8100", - "admin_status": "up" + "admin_status": "up", + "index": "0", + "asic_port_name": "Eth0-ASIC1", + "role": "Ext" }, "Ethernet1": { "alias": "Eth1/2", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json index f936d7a0b80d..b3aa253c2e72 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json @@ -73,5 +73,13 @@ "PORT_INVALID_MUX_CABLE_TEST": { "desc": "PORT_INVALID_MUX_CABLE_TEST non-boolean values, expect fail", "eStrKey": "InvalidValue" + }, + "PORT_VALID_MULTIASIC_TEST": { + "desc": "PORT_VALID_MULTIASIC_TEST no failure." + }, + "PORT_INVALID_MULTIASIC_TEST": { + "desc": "PORT_INVALID_MULTIASIC_TEST invalid role pattern, expect fail", + "eStrKey": "Pattern" } + } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json index 5d7fff2cd878..e1549261cb92 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json @@ -314,5 +314,76 @@ ] } } + }, + + "PORT_VALID_MULTIASIC_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 50000, + "index": "0", + "asic_port_name": "Eth8-ASIC1", + "role": "Ext" + }, + { + "name": "Ethernet9", + "alias": "eth9", + "lanes": "66", + "speed": 50000, + "index": "1", + "asic_port_name": "Eth9-ASIC1" + }, + { + "name": "Ethernet10", + "alias": "eth10", + "lanes": "67", + "speed": 50000, + "index": "2", + "asic_port_name": "Eth10-ASIC1", + "role": "Int" + }, + { + "name": "Ethernet11", + "alias": "eth11", + "lanes": "68", + "speed": 50000, + "index": "3", + "asic_port_name": "Eth11-ASIC1", + "role": "Inb" + }, + { + "name": "Ethernet12", + "alias": "eth12", + "lanes": "69", + "speed": 50000, + "index": "4", + "asic_port_name": "Eth12-ASIC1", + "role": "Rec" + } + ] + } + } + }, + + "PORT_INVALID_MULTIASIC_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 50000, + "index": "0", + "asic_port_name": "Eth8-ASIC1", + "role": "Invalid" + } + ] + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index b2031688af75..d296eaa05c39 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -110,9 +110,20 @@ module sonic-port{ } leaf index { - type uint16 { - range 0..256; + type uint16; + } + + leaf asic_port_name { + type string; + description "port name in asic and asic name, e.g Eth0-ASIC1"; + } + + leaf role { + type string { + pattern "Ext|Int|Inb|Rec"; } + description "Internal port or External port for multi-asic platform"; + default "Ext"; } leaf admin_status { From fe0a7693f4dd502c2d9f86d08227be1c92ae09d2 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Tue, 8 Mar 2022 01:39:33 +0800 Subject: [PATCH 03/54] [smartmontools] Install smartmontools with apt-get and upgrade it to 7.2-1 (#10087) Why I did it Smartmontools 6.6 has an issue with reading SMART info of nvme SSD Smartmontools can be installed with apt-get, no need to build and install How I did it Use apt-get to install smartmontools 7.2-1 Remove previous make files for smartmontools 6.6 How to verify it verify with "smartctl" can read out correct SMART info on NVME ssd. verify "show platform ssdhealth" can still work Signed-off-by: Kebo Liu --- .../build_templates/sonic_debian_extension.j2 | 2 +- slave.mk | 1 - sonic-slave-bullseye/Dockerfile.j2 | 3 --- sonic-slave-buster/Dockerfile.j2 | 3 --- sonic-slave-stretch/Dockerfile.j2 | 6 ------ src/smartmontools/.gitignore | 3 --- src/smartmontools/Makefile | 19 ------------------- 7 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 src/smartmontools/.gitignore delete mode 100644 src/smartmontools/Makefile diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 3efb5ae0690b..0a2b5536232b 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -328,7 +328,7 @@ sudo cp $IMAGE_CONFIGS/monit/restart_service $FILESYSTEM_ROOT/usr/bin/ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/restart_service # Install custom-built smartmontools -sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/smartmontools_*.deb +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install smartmontools=7.2-1 # Install custom-built openssh sshd sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_*.deb diff --git a/slave.mk b/slave.mk index 1b879350b734..66831571aa7d 100644 --- a/slave.mk +++ b/slave.mk @@ -974,7 +974,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(LIBNSS_TACPLUS) \ $(MONIT) \ $(OPENSSH_SERVER) \ - $(SMARTMONTOOLS) \ $(PYTHON_SWSSCOMMON) \ $(PYTHON3_SWSSCOMMON) \ $(SONIC_UTILITIES_DATA) \ diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index c0a23c59624b..dc6ba779e264 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -279,9 +279,6 @@ RUN apt-get update && apt-get install -y \ librrd8 \ librrd-dev \ rrdtool \ -# For smartmontools 6.6-1 - automake1.11 \ - libselinux1-dev \ # For kdump-tools liblzo2-dev \ # For iptables diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 0f5c6414a196..715ad8e19057 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -291,9 +291,6 @@ RUN apt-get update && apt-get install -y \ librrd8 \ librrd-dev \ rrdtool \ -# For smartmontools 6.6-1 - automake1.11 \ - libselinux1-dev \ # For kdump-tools liblzo2-dev \ # For iptables diff --git a/sonic-slave-stretch/Dockerfile.j2 b/sonic-slave-stretch/Dockerfile.j2 index 93c6d21d41e4..d9528f67d02a 100644 --- a/sonic-slave-stretch/Dockerfile.j2 +++ b/sonic-slave-stretch/Dockerfile.j2 @@ -272,9 +272,6 @@ RUN apt-get update && apt-get install -y \ librrd8 \ librrd-dev \ rrdtool \ -# For smartmontools 6.6-1 - automake1.11 \ - libselinux1-dev \ # For kdump-tools liblzo2-dev \ # For iptables @@ -315,9 +312,6 @@ RUN sudo augtool --autosave "set /files/etc/dpkg/dpkg.cfg/force-confdef" ## do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix RUN sudo augtool --autosave "set /files/etc/dpkg/dpkg.cfg/force-confold" -# For smartmontools 6.6-1 -RUN apt-get -t stretch-backports install -y debhelper - # For linux build RUN apt-get -y build-dep linux diff --git a/src/smartmontools/.gitignore b/src/smartmontools/.gitignore deleted file mode 100644 index a0991ff4402b..000000000000 --- a/src/smartmontools/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.gitignore -!Makefile diff --git a/src/smartmontools/Makefile b/src/smartmontools/Makefile deleted file mode 100644 index 8f0f0695659f..000000000000 --- a/src/smartmontools/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -SHELL = /bin/bash -.ONESHELL: -.SHELLFLAGS += -e - - -MAIN_TARGET = smartmontools_$(SMARTMONTOOLS_VERSION_FULL)_$(CONFIGURED_ARCH).deb - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - rm -rf smartmontools-$(SMARTMONTOOLS_VERSION_MAJOR) - wget -O smartmontools_$(SMARTMONTOOLS_VERSION_MAJOR).orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_MAJOR).orig.tar.gz?sv=2015-04-05&sr=b&sig=JZx4qiLuO36T0rsGqk4V2RDuWjRw6NztsLK7vlBYAkg%3D&se=2046-08-20T23%3A47%3A13Z&sp=r" - wget -O smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc?sv=2015-04-05&sr=b&sig=IS7FKUN%2Bvq0T55f4X2hGAViB70Y%2FgzjGgvzpUJLyUfA%3D&se=2046-08-20T23%3A46%3A57Z&sp=r" - wget -O smartmontools_$(SMARTMONTOOLS_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_FULL).debian.tar.xz?sv=2015-04-05&sr=b&sig=H0RFeC41MCvhTQCln85DuPLn5v2goozwz%2FB9sA9p5eQ%3D&se=2046-08-20T23%3A46%3A02Z&sp=r" - dpkg-source -x smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc - - pushd smartmontools-$(SMARTMONTOOLS_VERSION_MAJOR) - dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) - popd - - mv $* $(DEST)/ From d9a61b07a7b8e2aa699da5c1ee7b0eb111d219c6 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Mon, 7 Mar 2022 15:01:31 -0800 Subject: [PATCH 04/54] send log to /var/log/syslog; Add user info the message (#10033) Why I did it Desired the log message destination to be syslog and it misses the critical info. How I did it Non logical code changes only. Logging update, just for one message only a) The log message is directed to /var/log/syslog, instead of /var/log/auth.log b) Include user alias in the message How to verify it Pick a user alias that has not logged into the switch yet Add this alias to /etc/tacplus_user Attempt to login as that user Look for the error message in /var/log/syslog e.g. "Feb 18 19:16:41.592191 sonic ERR sshd[5233]: auth fail: Password incorrect. user: user_xyz" --- .../pam/0010-handle-bad-password-set-by-sshd.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tacacs/pam/0010-handle-bad-password-set-by-sshd.patch b/src/tacacs/pam/0010-handle-bad-password-set-by-sshd.patch index 07134fd6fd5d..c4355d9a85da 100644 --- a/src/tacacs/pam/0010-handle-bad-password-set-by-sshd.patch +++ b/src/tacacs/pam/0010-handle-bad-password-set-by-sshd.patch @@ -1,6 +1,6 @@ -From 36f67d58c39a5aceeec3182e381735c8a4a0a657 Mon Sep 17 00:00:00 2001 +From ed8b0366d3dbe137752fbb37a4b9fd1d46402d5b Mon Sep 17 00:00:00 2001 From: Renuka Manavalan -Date: Fri, 5 Nov 2021 17:43:10 +0000 +Date: Fri, 18 Feb 2022 22:27:39 +0000 Subject: [PATCH] handle bad password set by sshd --- @@ -11,7 +11,7 @@ Subject: [PATCH] handle bad password set by sshd 4 files changed, 50 insertions(+), 5 deletions(-) diff --git a/pam_tacplus.c b/pam_tacplus.c -index d57657a..eb53c94 100644 +index d57657a..38b6ee3 100644 --- a/pam_tacplus.c +++ b/pam_tacplus.c @@ -248,6 +248,13 @@ int pam_sm_authenticate (pam_handle_t * pamh, int flags, @@ -19,7 +19,7 @@ index d57657a..eb53c94 100644 } + if (validate_not_sshd_bad_pass(pass) != PAM_SUCCESS) { -+ syslog(LOG_ERR, "auth fail: Password incorrect"); ++ syslog(LOG_LOCAL0|LOG_ERR, "auth fail: Password incorrect. user: %s", user); + memset(pass, 0, strlen (pass)); + free(pass); + return PAM_AUTH_ERR; @@ -47,10 +47,10 @@ index d57657a..eb53c94 100644 pass = NULL; } diff --git a/support.c b/support.c -index 1ea2e30..8a7dfbb 100644 +index f056ec4..81f3466 100644 --- a/support.c +++ b/support.c -@@ -114,6 +114,43 @@ int converse(pam_handle_t * pamh, int nargs, const struct pam_message *message, +@@ -117,6 +117,43 @@ int converse(pam_handle_t * pamh, int nargs, const struct pam_message *message, return retval; } @@ -94,7 +94,7 @@ index 1ea2e30..8a7dfbb 100644 /* stolen from pam_stress */ int tacacs_get_password (pam_handle_t * pamh, int flags ,int ctrl, char **password) { -@@ -436,4 +473,4 @@ int _pam_parse (int argc, const char **argv) { +@@ -459,4 +496,4 @@ int _pam_parse (int argc, const char **argv) { } return ctrl; From 14921e39d1ec077d7c2ce9f8eb3853e6f6c68afc Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 8 Mar 2022 10:15:52 +0800 Subject: [PATCH 05/54] [Build][Ci]: Support to use the cisco sai packages built by azp (#10102) Why I did it Support to use the cisco sai packages built by azp --- .../official-build-cisco-8000.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.azure-pipelines/official-build-cisco-8000.yml b/.azure-pipelines/official-build-cisco-8000.yml index aeec64a848a1..61b6b03171e3 100644 --- a/.azure-pipelines/official-build-cisco-8000.yml +++ b/.azure-pipelines/official-build-cisco-8000.yml @@ -22,6 +22,11 @@ resources: name: Cisco-8000-sonic/platform-cisco-8000 endpoint: cisco-connection +variables: +- group: SONIC-AKV-STROAGE-1 +- name: StorageSASKey + value: $(sonicstorage-SasToken) + stages: - stage: Build pool: sonic @@ -29,6 +34,7 @@ stages: CACHE_MODE: wcache SKIP_CHECKOUT: true TERM: '' + PACKAGE_URL: "https://sonicstorage.blob.core.windows.net/packages" jobs: - template: azure-pipelines-build.yml @@ -60,5 +66,29 @@ stages: make PLATFORM=cisco-8000 platform/cisco-8000 tar xfz $(System.ArtifactsDirectory)/artifactory-*.tar.gz -C platform/cisco-8000 displayName: 'Setup cisco artifacts' + - script: | + set -ex + filename=$(find platform/cisco-8000/artifactory/sonic -name cisco-* -type f | head -n 1) + if [ -z "$filename" ]; then + echo "Cisco sai package not found" 1>&2 + exit 1 + fi + cd $(dirname $filename) + echo "PWD=$(pwd)" + ls -l *.deb + while read -r package; do + # Cisco version format: -sai--- + # The may contain several values in one build, the part is skipped when publishing to storage + # See https://github.com/Cisco-8000-sonic/sdk/blob/master/azure-pipelines.yml + # The $PACKAGE_URL is only accessible for AZP + version=$(echo $package | awk -F_ '{print $(NF-1)}' | cut -d- -f1,2,4,5) + package_url="$PACKAGE_URL/sai/ciscosai/master/$version/$package" + echo "Override package $package from $package_url" + wget "$package_url$StorageSASKey" -O "$package" + done < <(ls *.deb) + env: + StorageSASKey: $(StorageSASKey) + condition: ne(variables['Build.Reason'], 'PullRequest') + displayName: "Override cisco sai packages" jobGroups: - name: cisco-8000 From 29f6b01be634b731970b6b88f459721e168b4610 Mon Sep 17 00:00:00 2001 From: ganglv <88995770+ganglyu@users.noreply.github.com> Date: Tue, 8 Mar 2022 15:48:04 +0800 Subject: [PATCH 06/54] [sonic-cfggen]: Fix generated deployment_id (#10154) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why I did it Config db schema generated by minigraph can’t pass yang validation, deployment_id can’t be none for yang validation. How I did it Update minigraph.py, skip deployment_id with None value How to verify it Run UT for sonic-config-enginue. Run command 'sonic-cfggen -m tests/multi_npu_data/sample-minigraph-noportchannel.xml -p tests/multi_npu_data/sample_port_config-3.ini -n asic3 --print-data'. Signed-off-by: Gang Lv ganglv@microsoft.com --- src/sonic-config-engine/minigraph.py | 4 +- .../tests/t0-sample-deployment-id.xml | 347 ++++++++++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 6 + 3 files changed, 356 insertions(+), 1 deletion(-) create mode 100644 src/sonic-config-engine/tests/t0-sample-deployment-id.xml diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2d0e9ac0b66c..b4f1f3acbd7a 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1282,7 +1282,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results = {} results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn, - 'deployment_id': deployment_id, 'region': region, 'cloudtype': cloudtype, 'docker_routing_config_mode': docker_routing_config_mode, @@ -1293,6 +1292,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw } } + if deployment_id is not None: + results['DEVICE_METADATA']['localhost']['deployment_id'] = deployment_id + cluster = [devices[key] for key in devices if key.lower() == hostname.lower()][0].get('cluster', "") if cluster: results['DEVICE_METADATA']['localhost']['cluster'] = cluster diff --git a/src/sonic-config-engine/tests/t0-sample-deployment-id.xml b/src/sonic-config-engine/tests/t0-sample-deployment-id.xml new file mode 100644 index 000000000000..b6b47d979102 --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-deployment-id.xml @@ -0,0 +1,347 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 180 + 60 + + + switch-t0 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 180 + 60 + + + switch-t0 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ +
10.1.0.32
+ BGPSLBPassive + 10.10.10.10/26;100.100.100.100/26 +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/112 + + + + PortChannel02 + fortyGigE0/116 + + + + PortChannel03 + fortyGigE0/120 + + + + PortChannel04 + fortyGigE0/124 + + + + + + Vlan1000 + fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96 + False + 0.0.0.0/0 + + 192.0.0.1;192.0.0.2 + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + PortChannel02 + 10.0.0.58/31 + + + + PortChannel02 + FC00::75/126 + + + + PortChannel03 + 10.0.0.60/31 + + + + PortChannel03 + FC00::79/126 + + + + PortChannel04 + 10.0.0.62/31 + + + + PortChannel04 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + + + PortChannel01;PortChannel02;PortChannel03;PortChannel04 + DataAcl + DataPlane + + + SNMP + SNMP_ACL + SNMP + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1/1 + switch-t0 + fortyGigE0/112 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1/1 + switch-t0 + fortyGigE0/116 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1/1 + switch-t0 + fortyGigE0/120 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1/1 + switch-t0 + fortyGigE0/124 + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + switch-t0 + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index bf1221cab9ee..c75c53b7f626 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -23,6 +23,7 @@ def setUp(self): self.sample_graph_metadata = os.path.join(self.test_dir, 'simple-sample-graph-metadata.xml') self.sample_graph_pc_test = os.path.join(self.test_dir, 'pc-test-graph.xml') self.sample_graph_bgp_speaker = os.path.join(self.test_dir, 't0-sample-bgp-speaker.xml') + self.sample_graph_deployment_id = os.path.join(self.test_dir, 't0-sample-deployment-id.xml') self.sample_graph_voq = os.path.join(self.test_dir, 'sample-voq-graph.xml') self.sample_device_desc = os.path.join(self.test_dir, 'device.xml') self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') @@ -498,6 +499,11 @@ def test_minigraph_deployment_id(self): output = self.run_script(argument) self.assertEqual(output.strip(), "1") + def test_minigraph_deployment_id_null(self): + argument = '-m "' + self.sample_graph_deployment_id + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\']"' + output = self.run_script(argument) + self.assertNotIn('deployment_id', output.strip()) + def test_minigraph_ethernet_interfaces(self, **kwargs): graph_file = kwargs.get('graph_file', self.sample_graph_simple) argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' From f1d6d7ccce50ff2ea25307752ddaf44b2da9e082 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 8 Mar 2022 21:15:43 +0800 Subject: [PATCH 07/54] [Build]: Fix the bin image generated from raw image issue (#10083) Why I did it It is to fix the issue #10048 When building .raw image, for instance, target/sonic-broadcom.raw, it will generate a .bin image, target/sonic-broadcom.bin, as the intermediate file. The intermediate file is a build target which may contains different dependencies with the raw one. --- build_image.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build_image.sh b/build_image.sh index 871ba839a901..71351dbfe7e0 100755 --- a/build_image.sh +++ b/build_image.sh @@ -68,6 +68,8 @@ generate_kvm_image() generate_onie_installer_image() { + output_file=$OUTPUT_ONIE_IMAGE + [ -n "$1" ] && output_file=$1 # Copy platform-specific ONIE installer config files where onie-mk-demo.sh expects them rm -rf ./installer/x86_64/platforms/ mkdir -p ./installer/x86_64/platforms/ @@ -83,7 +85,7 @@ generate_onie_installer_image() ## Generate an ONIE installer image ## Note: Don't leave blank between lines. It is single line command. ./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ - installer platform/$TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \ + installer platform/$TARGET_MACHINE/platform.conf $output_file OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \ $ONIE_INSTALLER_PAYLOAD } @@ -119,12 +121,13 @@ if [ "$IMAGE_TYPE" = "onie" ]; then elif [ "$IMAGE_TYPE" = "raw" ]; then echo "Build RAW image" + tmp_output_onie_image=${OUTPUT_ONIE_IMAGE}.tmp mkdir -p `dirname $OUTPUT_RAW_IMAGE` sudo rm -f $OUTPUT_RAW_IMAGE generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic" - generate_onie_installer_image + generate_onie_installer_image "$tmp_output_onie_image" echo "Creating SONiC raw partition : $OUTPUT_RAW_IMAGE of size $RAW_IMAGE_DISK_SIZE MB" fallocate -l "$RAW_IMAGE_DISK_SIZE"M $OUTPUT_RAW_IMAGE @@ -135,8 +138,9 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then ## Generate a partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer ## Run the installer ## The 'build' install mode of the installer is used to generate this dump. - sudo chmod a+x $OUTPUT_ONIE_IMAGE - sudo ./$OUTPUT_ONIE_IMAGE + sudo chmod a+x $tmp_output_onie_image + sudo ./$tmp_output_onie_image + rm $tmp_output_onie_image [ -r $OUTPUT_RAW_IMAGE ] || { echo "Error : $OUTPUT_RAW_IMAGE not generated!" From d112e7cca9087d02892ada9d70bddcc5d5616c24 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Tue, 8 Mar 2022 05:56:42 -0800 Subject: [PATCH 08/54] [submodule] Update sonic-utilities (#10163) 47c243e [show][muxcable] fix the sudo access error for show muxcable metrics (#2083) f872516 [muxcable][show] enhance show mux status to show last switchover time (#2067) d440df7 [warmboot] Migrate 10G ports during warm-reboot on s6100 (#2064) 494c6d7 [counterpoll] Display the correct default poll interval for watermark counters (#2082) 499988e [show][config] add muxcable command line support for retrieve / reset ICMP packet loss data (#2046) 8b01d3e Remove the warning message appear when there are no ports on CONFIG DB (#2050) ed6e66e [GCU] Supporting Groupings during path-xpath translation (#2044) 25b3455 [ci] Use official build debian pkg instead and parameterize source branch (#2079) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index a9bbaf227316..47c243eb7e9c 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit a9bbaf2273169ed9f4c764cc39e97708995e0fa3 +Subproject commit 47c243eb7e9cbe6ebd3479290a98183071cf2124 From bf5f9c29184d57070181bec8dd811f35277f63e0 Mon Sep 17 00:00:00 2001 From: Kostiantyn Yarovyi Date: Wed, 9 Mar 2022 06:27:08 +0200 Subject: [PATCH 09/54] [BFN] Update configuration files (#9913) * [Barefoot] update switch-tna-sai.conf file * remove deprecated conf files * [Barefoot] update switch-tna-sai.conf file for Accton wedge100bf_32qs platform * pdated switch-tna-sai.conf --- .../montara/switch-tna-sai.conf | 21 ++++++------ .../Arista-7170-32C-C32/switch-sai.conf | 33 ------------------ .../Arista-7170-32C-C32/switch-tna-sai.conf | 17 +++++----- .../Arista-7170-32CD-C32/switch-sai.conf | 33 ------------------ .../Arista-7170-32CD-C32/switch-tna-sai.conf | 17 +++++----- .../Arista-7170-64C/switch-sai.conf | 33 ------------------ .../Arista-7170-64C/switch-tna-sai.conf | 17 +++++----- .../Arista-7170-Q59S20/switch-sai.conf | 33 ------------------ .../Arista-7170-Q59S20/switch-tna-sai.conf | 17 +++++----- .../newport/switch-tna-sai.conf | 27 +++++++-------- .../montara/switch-sai.conf | 34 ------------------- .../montara/switch-tna-sai.conf | 21 ++++++------ .../mavericks/switch-sai.conf | 34 ------------------- .../mavericks/switch-tna-sai.conf | 21 ++++++------ .../INGRASYS-S9180-32X/switch-tna-sai.conf | 21 ++++++------ .../INGRASYS-S9280-64X/switch-tna-sai.conf | 21 ++++++------ .../OSW1800-48x6q/switch-tna-sai.conf | 21 ++++++------ 17 files changed, 105 insertions(+), 316 deletions(-) delete mode 100644 device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-sai.conf delete mode 100644 device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-sai.conf delete mode 100644 device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf delete mode 100644 device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf delete mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf delete mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/switch-tna-sai.conf b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/switch-tna-sai.conf index 4a4d41f38066..8c34ef9d6a9a 100644 --- a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/switch-tna-sai.conf +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-sai.conf b/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-sai.conf deleted file mode 100644 index 0a807b1c9ea7..000000000000 --- a/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-sai.conf +++ /dev/null @@ -1,33 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", - "pcie_domain": 0, - "pcie_bus": 7, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-tna-sai.conf index ece3fcbe6a90..dc8c82ce2546 100644 --- a/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-tna-sai.conf +++ b/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-tna-sai.conf @@ -1,16 +1,8 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, "sds_fw_path": "share/tofino_sds_fw/avago/firmware" } ], @@ -27,7 +19,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -35,5 +26,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-sai.conf b/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-sai.conf deleted file mode 100644 index 0a807b1c9ea7..000000000000 --- a/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-sai.conf +++ /dev/null @@ -1,33 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", - "pcie_domain": 0, - "pcie_bus": 7, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-tna-sai.conf index ece3fcbe6a90..dc8c82ce2546 100644 --- a/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-tna-sai.conf +++ b/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-tna-sai.conf @@ -1,16 +1,8 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, "sds_fw_path": "share/tofino_sds_fw/avago/firmware" } ], @@ -27,7 +19,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -35,5 +26,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf deleted file mode 100644 index 0a807b1c9ea7..000000000000 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf +++ /dev/null @@ -1,33 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", - "pcie_domain": 0, - "pcie_bus": 7, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf index ece3fcbe6a90..dc8c82ce2546 100644 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf @@ -1,16 +1,8 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, "sds_fw_path": "share/tofino_sds_fw/avago/firmware" } ], @@ -27,7 +19,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -35,5 +26,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf deleted file mode 100644 index 0a807b1c9ea7..000000000000 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf +++ /dev/null @@ -1,33 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", - "pcie_domain": 0, - "pcie_bus": 7, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf index ece3fcbe6a90..dc8c82ce2546 100644 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf @@ -1,16 +1,8 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, "sds_fw_path": "share/tofino_sds_fw/avago/firmware" } ], @@ -27,7 +19,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -35,5 +26,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf index cf6e445dba1a..2789eb0e2c0d 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino2", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -20,21 +12,28 @@ "agent0": "lib/platform/x86_64-accton_as9516bf_32d-r0/libpltfm_mgr.so", "p4_programs": [ { + "program-name": "switch", + "bfrt-config": "share/switch/bf-rt.json", "p4_pipelines": [ { "p4_pipeline_name": "pipe", "config": "share/switch/pipe/tofino2.bin", "context": "share/switch/pipe/context.json" } - ], - "program-name": "switch", - "sai": "lib/libsai.so", - "bfrt-config": "share/switch/bf-rt.json", + ], "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, "non_default_port_ppgs": 5 } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf deleted file mode 100644 index fc224c9602e4..000000000000 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf +++ /dev/null @@ -1,34 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "agent0": "lib/platform/x86_64-accton_wedge100bf_32x-r0/libpltfm_mgr.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-tna-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-tna-sai.conf index 085a1b8dcdfc..dc6f78e0b1e7 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-tna-sai.conf +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf deleted file mode 100644 index 81a7d7bc28c3..000000000000 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf +++ /dev/null @@ -1,34 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "agent0": "lib/platform/x86_64-accton_wedge100bf_65x-r0/libpltfm_mgr.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-tna-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-tna-sai.conf index ddcb9d4ba287..e07192619af0 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-tna-sai.conf +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf index 9fbf9d3cdb69..193dcde96bcf 100644 --- a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf index 4895ac901ff6..2425102e2319 100644 --- a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf index 7cb3ddc48fc9..03b0924d4339 100644 --- a/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf +++ b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } From 3fa18d18d4c06fe38164ebfefdc3187820fc7496 Mon Sep 17 00:00:00 2001 From: Oleksandr Kozodoi Date: Wed, 9 Mar 2022 06:28:01 +0200 Subject: [PATCH 10/54] Add necessary changes for python3 virtual environment of sonic-mgmt docker container (#9277) This PR includes necessary changes for the setup of the Python3 virtual environment in the sonic-mgmt docker container. How to activate Python3 virtual environment? Connect to the sonic-mgmt container $ docker exec -ti sonic-mgmt bash Activate the virtual environment $ source /var/user/env-python3/bin/activate Why I did it Migration of sonic-mgmt codebase from Python 2 to Python 3 How I did it Added all necessary dependencies to the env-python3 virtual environment. Signed-off-by: Oleksandr Kozodoi --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 67 ++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 67486f74bbb5..e2054ae81ba1 100755 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -177,7 +177,6 @@ RUN python -m virtualenv --system-site-packages env-201811 RUN env-201811/bin/pip install cryptography==3.3.2 ansible==2.0.0.2 RUN python3 -m venv env-python3 -RUN env-python3/bin/pip3 install cryptography==3.3.2 azure-kusto-data azure-kusto-ingest defusedxml pytest aiohttp # NOTE: There is an ordering dependency for pycryptodome. Leaving this at # the end until we figure that out. @@ -186,3 +185,69 @@ RUN pip install pycryptodome==3.9.8 # Install allure-pytest library RUN pip install --upgrade setuptools \ && pip install allure-pytest==2.8.22 + +# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD. +ENV VIRTUAL_ENV=env-python3 +ARG BACKUP_OF_PATH="$PATH" +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8 + +RUN python3 -m pip install --upgrade --ignore-installed pip setuptools==58.4.0 + +RUN python3 -m pip install setuptools-rust \ + aiohttp \ + defusedxml \ + azure-kusto-ingest \ + azure-kusto-data \ + cffi \ + contextlib2==0.6.0.post1 \ + cryptography==3.3.2 \ + "future>=0.16.0" \ + gitpython \ + ipaddr \ + ipython==5.4.1 \ + ixnetwork-restpy==1.0.64 \ + ixnetwork-open-traffic-generator==0.0.79 \ + snappi[ixnetwork,convergence]==0.5.11 \ + jinja2==2.7.2 \ + jsonpatch \ + lxml \ + natsort \ + netaddr \ + netmiko==2.4.2 \ + paramiko==2.7.1 \ + passlib \ + pexpect \ + prettytable \ + psutil \ + pyasn1==0.4.8 \ + pyfiglet \ + pylint==1.8.1 \ + pyro4 \ + pysnmp==4.4.12 \ + pytest-repeat \ + pytest-html \ + pytest-xdist==1.28.0 \ + pytest \ + redis \ + requests \ + rpyc \ + six \ + tabulate \ + textfsm \ + virtualenv \ + wheel==0.33.6 \ + pysubnettree \ + nnpy \ + dpkt \ + pycryptodome==3.9.8 \ + ansible==2.8.12 \ + pytest-ansible \ + allure-pytest==2.8.22 \ + retry \ + thrift==0.11.0 \ + ptf + +# Deactivating a virtualenv. +ENV PATH="$BACKUP_OF_PATH" From 01798447ab878ee3343fb0be8ad44a47758bbc4d Mon Sep 17 00:00:00 2001 From: Song Yuan <64041228+ysmanman@users.noreply.github.com> Date: Wed, 9 Mar 2022 16:04:36 -0800 Subject: [PATCH 11/54] [Chassis][QoS template] Skip configuring buffer and QoS config on recirc ports (#7869) * Added test case to verify the template changes. --- files/build_templates/buffers_config.j2 | 4 +- files/build_templates/qos_config.j2 | 4 +- ...le-arista-7800r3-48cq2-lc-t2-minigraph.xml | 2786 +++++++++++++++++ .../py2/buffer-arista7800r3-48cq2-lc.json | 590 ++++ .../py2/qos-arista7800r3-48cq2-lc.json | 1487 +++++++++ .../py3/buffer-arista7800r3-48cq2-lc.json | 590 ++++ .../py3/qos-arista7800r3-48cq2-lc.json | 1487 +++++++++ src/sonic-config-engine/tests/test_j2files.py | 25 + 8 files changed, 6971 insertions(+), 2 deletions(-) create mode 100644 src/sonic-config-engine/tests/sample-arista-7800r3-48cq2-lc-t2-minigraph.xml create mode 100644 src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json create mode 100644 src/sonic-config-engine/tests/sample_output/py2/qos-arista7800r3-48cq2-lc.json create mode 100644 src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json create mode 100644 src/sonic-config-engine/tests/sample_output/py3/qos-arista7800r3-48cq2-lc.json diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index cb64cd3d4335..a67316af5f3d 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -101,7 +101,9 @@ def {%- endif %} {%- else %} {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{%- endif %} + {%- if not port.startswith('Ethernet-Rec') and not port.startswith('Ethernet-IB') %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endif %} {%- endfor %} {%- endif %} diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 6748cd99be9d..2a01e470fde8 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -1,6 +1,8 @@ {%- set PORT_ALL = [] %} {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{% endif %} + {%- if not port.startswith('Ethernet-Rec') and not port.startswith('Ethernet-IB') %} + {%- if PORT_ALL.append(port) %}{% endif %} + {%- endif %} {%- endfor %} {%- if PORT_ALL | sort_by_port_index %}{% endif %} diff --git a/src/sonic-config-engine/tests/sample-arista-7800r3-48cq2-lc-t2-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7800r3-48cq2-lc-t2-minigraph.xml new file mode 100644 index 000000000000..f2332c5cacd5 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-arista-7800r3-48cq2-lc-t2-minigraph.xml @@ -0,0 +1,2786 @@ + + + + + + dut-lc4 + 1.1.1.3 + dut-lc3 + 1.1.1.1 + true + + + dut-lc5 + 1.1.1.5 + dut-lc3 + 1.1.1.1 + true + + + + + 65001 + dut-lc4 + + + + + + 65001 + dut-lc5 + + + + + + 65001 + dut-lc3 + + +
1.1.1.1
+ + +
+ +
1.1.1.1
+ + +
+
+ +
+
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.1/32 + + 10.1.0.1/32 + + + HostIP + Loopback0 + + FC00:10::1/128 + + FC00:10::1/128 + + + + + ManagementIP1 + eth0 + 10.240.76.57/25 + + + ManagementIP2 + eth0 + fdfd:5c41:712d:e049::af0:4c39/64 + + + + + Ethernet-IB0 + port + 1.1.1.1/32 + + + Ethernet-IB0 + port + fc00:3000::1/128 + + + + + + dut-lc3 + + + + + + + IPInterface + + Ethernet1/1 + 10.0.0.2/31 + + + IPInterface + + Ethernet10/1 + 10.0.0.4/31 + + + IPInterface + + Ethernet11/1 + 10.0.0.6/31 + + + IPInterface + + Ethernet12/1 + 10.0.0.8/31 + + + IPInterface + + Ethernet13/1 + 10.0.0.10/31 + + + IPInterface + + Ethernet14/1 + 10.0.0.12/31 + + + IPInterface + + Ethernet15/1 + 10.0.0.14/31 + + + IPInterface + + Ethernet16/1 + 10.0.0.16/31 + + + IPInterface + + Ethernet17/1 + 10.0.0.18/31 + + + IPInterface + + Ethernet18/1 + 10.0.0.20/31 + + + IPInterface + + Ethernet19/1 + 10.0.0.22/31 + + + IPInterface + + Ethernet2/1 + 10.0.0.24/31 + + + IPInterface + + Ethernet20/1 + 10.0.0.26/31 + + + IPInterface + + Ethernet21/1 + 10.0.0.28/31 + + + IPInterface + + Ethernet22/1 + 10.0.0.30/31 + + + IPInterface + + Ethernet23/1 + 10.0.0.32/31 + + + IPInterface + + Ethernet24/1 + 10.0.0.34/31 + + + IPInterface + + Ethernet25/1 + 10.0.0.36/31 + + + IPInterface + + Ethernet26/1 + 10.0.0.38/31 + + + IPInterface + + Ethernet27/1 + 10.0.0.40/31 + + + IPInterface + + Ethernet28/1 + 10.0.0.42/31 + + + IPInterface + + Ethernet29/1 + 10.0.0.44/31 + + + IPInterface + + Ethernet3/1 + 10.0.0.46/31 + + + IPInterface + + Ethernet30/1 + 10.0.0.48/31 + + + IPInterface + + Ethernet31/1 + 10.0.0.50/31 + + + IPInterface + + Ethernet32/1 + 10.0.0.52/31 + + + IPInterface + + Ethernet33/1 + 10.0.0.54/31 + + + IPInterface + + Ethernet34/1 + 10.0.0.56/31 + + + IPInterface + + Ethernet35/1 + 10.0.0.58/31 + + + IPInterface + + Ethernet36/1 + 10.0.0.60/31 + + + IPInterface + + Ethernet37/1 + 10.0.0.62/31 + + + IPInterface + + Ethernet38/1 + 10.0.0.64/31 + + + IPInterface + + Ethernet39/1 + 10.0.0.66/31 + + + IPInterface + + Ethernet4/1 + 10.0.0.68/31 + + + IPInterface + + Ethernet40/1 + 10.0.0.70/31 + + + IPInterface + + Ethernet42/1 + 10.0.0.72/31 + + + IPInterface + + Ethernet45/1 + 10.0.0.74/31 + + + IPInterface + + Ethernet46/1 + 10.0.0.76/31 + + + IPInterface + + Ethernet47/1 + 10.0.0.78/31 + + + IPInterface + + Ethernet48/1 + 10.0.0.80/31 + + + IPInterface + + Ethernet5/1 + 10.0.0.82/31 + + + IPInterface + + Ethernet6/1 + 10.0.0.84/31 + + + IPInterface + + Ethernet7/1 + 10.0.0.86/31 + + + IPInterface + + Ethernet8/1 + 10.0.0.88/31 + + + IPInterface + + Ethernet9/1 + 10.0.0.90/31 + + + IPInterface + + Ethernet-Rec0 + 10.0.0.92/31 + + + IPInterface + + Ethernet-IB0 + 1.1.1.1/32 + + + + + + + + + + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet180 + dut-lc3 + Ethernet0 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet20 + dut-lc3 + Ethernet36 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet24 + dut-lc3 + Ethernet40 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet28 + dut-lc3 + Ethernet44 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet32 + dut-lc3 + Ethernet48 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet40 + dut-lc3 + Ethernet52 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet36 + dut-lc3 + Ethernet56 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet44 + dut-lc3 + Ethernet60 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet132 + dut-lc3 + Ethernet64 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet128 + dut-lc3 + Ethernet68 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet136 + dut-lc3 + Ethernet72 + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet176 + dut-lc3 + Ethernet4 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet140 + dut-lc3 + Ethernet76 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet144 + dut-lc3 + Ethernet80 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet148 + dut-lc3 + Ethernet84 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet152 + dut-lc3 + Ethernet88 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet156 + dut-lc3 + Ethernet92 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet64 + dut-lc3 + Ethernet96 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet68 + dut-lc3 + Ethernet100 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet72 + dut-lc3 + Ethernet104 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet76 + dut-lc3 + Ethernet108 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet80 + dut-lc3 + Ethernet112 + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet188 + dut-lc3 + Ethernet8 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet84 + dut-lc3 + Ethernet116 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet88 + dut-lc3 + Ethernet120 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet92 + dut-lc3 + Ethernet124 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet96 + dut-lc3 + Ethernet128 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet100 + dut-lc3 + Ethernet132 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet104 + dut-lc3 + Ethernet136 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet108 + dut-lc3 + Ethernet140 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet240 + dut-lc3 + Ethernet144 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet244 + dut-lc3 + Ethernet148 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet248 + dut-lc3 + Ethernet152 + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet184 + dut-lc3 + Ethernet12 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet252 + dut-lc3 + Ethernet156 + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet192 + dut-lc3 + Ethernet164 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet112 + dut-lc3 + Ethernet176 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet116 + dut-lc3 + Ethernet180 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet120 + dut-lc3 + Ethernet184 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet124 + dut-lc3 + Ethernet188 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet0 + dut-lc3 + Ethernet16 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet4 + dut-lc3 + Ethernet20 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet8 + dut-lc3 + Ethernet24 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet12 + dut-lc3 + Ethernet28 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet16 + dut-lc3 + Ethernet32 + + + + + dut-lc3 + Arista-7800R3-48CQ2-C48 + + + + + + + dut-lc3 + + + ForcedMgmtRoutes + + 172.16.0.0/12;10.80.0.0/12;10.64.0.0/14;10.240.0.0/13 + + ForcedMgmtRoutes + + FD7A:629F:52A4::/48;FDFD:5C41:712D::/48 + + + SwitchId + + 0 + + + NtpResources + time.aristanetworks.com + + + SwitchType + + voq + + + MaxCores + + 16 + + + SubRole + + + + + + + + + + + Arista-7800R3-48CQ2-C48 + + + Ethernet1/1 + eth1/1-connected-to-nvm473@eth46/1 + 100000 + rs + + + Ethernet10/1 + eth10/1-connected-to-nv338@eth6/1 + 100000 + rs + + + Ethernet11/1 + eth11/1-connected-to-nv338@eth7/1 + 100000 + rs + + + Ethernet12/1 + eth12/1-connected-to-nv338@eth8/1 + 100000 + rs + + + Ethernet13/1 + eth13/1-connected-to-nv338@eth9/1 + 100000 + rs + + + Ethernet14/1 + eth14/1-connected-to-nv338@eth11/1 + 100000 + rs + + + Ethernet15/1 + eth15/1-connected-to-nv338@eth10/1 + 100000 + rs + + + Ethernet16/1 + eth16/1-connected-to-nv338@eth12/1 + 100000 + rs + + + Ethernet17/1 + eth17/1-connected-to-nv338@eth34/1 + 100000 + rs + + + Ethernet18/1 + eth18/1-connected-to-nv338@eth33/1 + 100000 + rs + + + Ethernet19/1 + eth19/1-connected-to-nv338@eth35/1 + 100000 + rs + + + Ethernet2/1 + eth2/1-connected-to-nvm473@eth45/1 + 100000 + rs + + + Ethernet20/1 + eth20/1-connected-to-nv338@eth36/1 + 100000 + rs + + + Ethernet21/1 + eth21/1-connected-to-nv338@eth37/1 + 100000 + rs + + + Ethernet22/1 + eth22/1-connected-to-nv338@eth38/1 + 100000 + none + + + Ethernet23/1 + eth23/1-connected-to-nv338@eth39/1 + 100000 + none + + + Ethernet24/1 + eth24/1-connected-to-nv338@eth40/1 + 100000 + none + + + Ethernet25/1 + eth25/1-connected-to-nv338@eth17/1 + 100000 + none + + + Ethernet26/1 + eth26/1-connected-to-nv338@eth18/1 + 100000 + none + + + Ethernet27/1 + eth27/1-connected-to-nv338@eth19/1 + 100000 + none + + + Ethernet28/1 + eth28/1-connected-to-nv338@eth20/1 + 100000 + rs + + + Ethernet29/1 + eth29/1-connected-to-nv338@eth21/1 + 100000 + rs + + + Ethernet3/1 + eth3/1-connected-to-nvm473@eth48/1 + 100000 + rs + + + Ethernet30/1 + eth30/1-connected-to-nv338@eth22/1 + 100000 + rs + + + Ethernet31/1 + eth31/1-connected-to-nv338@eth23/1 + 100000 + rs + + + Ethernet32/1 + eth32/1-connected-to-nv338@eth24/1 + 100000 + rs + + + Ethernet33/1 + eth33/1-connected-to-nv338@eth25/1 + 100000 + rs + + + Ethernet34/1 + eth34/1-connected-to-nv338@eth26/1 + 100000 + rs + + + Ethernet35/1 + eth35/1-connected-to-nv338@eth27/1 + 100000 + rs + + + Ethernet36/1 + eth36/1-connected-to-nv338@eth28/1 + 100000 + rs + + + Ethernet37/1 + eth37/1-connected-to-nv338@eth61/1 + 100000 + rs + + + Ethernet38/1 + eth38/1-connected-to-nv338@eth62/1 + 100000 + rs + + + Ethernet39/1 + eth39/1-connected-to-nv338@eth63/1 + 100000 + rs + + + Ethernet4/1 + eth4/1-connected-to-nvm473@eth47/1 + 100000 + rs + + + Ethernet40/1 + eth40/1-connected-to-nv338@eth64/1 + 100000 + rs + + + Ethernet42/1 + eth42/1-connected-to-nvm473@eth49/1 + 100000 + rs + + + Ethernet45/1 + eth45/1-connected-to-nv338@eth29/1 + 100000 + rs + + + Ethernet46/1 + eth46/1-connected-to-nv338@eth30/1 + 100000 + rs + + + Ethernet47/1 + eth47/1-connected-to-nv338@eth31/1 + 100000 + rs + + + Ethernet48/1 + eth48/1-connected-to-nv338@eth32/1 + 100000 + rs + + + Ethernet5/1 + eth5/1-connected-to-nv338@eth1/1 + 100000 + rs + + + Ethernet6/1 + eth6/1-connected-to-nv338@eth2/1 + 100000 + rs + + + Ethernet7/1 + eth7/1-connected-to-nv338@eth3/1 + 100000 + rs + + + Ethernet8/1 + eth8/1-connected-to-nv338@eth4/1 + 100000 + rs + + + Ethernet9/1 + eth9/1-connected-to-nv338@eth5/1 + 100000 + rs + + + + + eth0 + eth0 + 1000 + + + eth0 + eth0 + 1000 + + + + + Cpu0 + dut-lc3 + Asic0 + 10000 + 1 + 0 + 0 + 0 + 8 + + + Ethernet0 + dut-lc3 + Asic0 + 100000 + 2 + 0 + 0 + 1 + 8 + + + Ethernet4 + dut-lc3 + Asic0 + 100000 + 3 + 0 + 0 + 2 + 8 + + + Ethernet8 + dut-lc3 + Asic0 + 100000 + 4 + 0 + 0 + 3 + 8 + + + Ethernet12 + dut-lc3 + Asic0 + 100000 + 5 + 0 + 0 + 4 + 8 + + + Ethernet16 + dut-lc3 + Asic0 + 100000 + 6 + 0 + 0 + 5 + 8 + + + Ethernet20 + dut-lc3 + Asic0 + 100000 + 7 + 0 + 0 + 6 + 8 + + + Ethernet24 + dut-lc3 + Asic0 + 100000 + 8 + 0 + 0 + 7 + 8 + + + Ethernet28 + dut-lc3 + Asic0 + 100000 + 9 + 0 + 0 + 8 + 8 + + + Ethernet32 + dut-lc3 + Asic0 + 100000 + 10 + 0 + 0 + 9 + 8 + + + Ethernet36 + dut-lc3 + Asic0 + 100000 + 11 + 0 + 0 + 10 + 8 + + + Ethernet40 + dut-lc3 + Asic0 + 100000 + 12 + 0 + 0 + 11 + 8 + + + Ethernet44 + dut-lc3 + Asic0 + 100000 + 13 + 0 + 0 + 12 + 8 + + + Ethernet48 + dut-lc3 + Asic0 + 100000 + 14 + 0 + 0 + 13 + 8 + + + Ethernet52 + dut-lc3 + Asic0 + 100000 + 15 + 0 + 0 + 14 + 8 + + + Ethernet56 + dut-lc3 + Asic0 + 100000 + 16 + 0 + 0 + 15 + 8 + + + Ethernet60 + dut-lc3 + Asic0 + 100000 + 17 + 0 + 0 + 16 + 8 + + + Ethernet64 + dut-lc3 + Asic0 + 100000 + 18 + 0 + 0 + 17 + 8 + + + Ethernet68 + dut-lc3 + Asic0 + 100000 + 19 + 0 + 0 + 18 + 8 + + + Ethernet72 + dut-lc3 + Asic0 + 100000 + 20 + 0 + 0 + 19 + 8 + + + Ethernet76 + dut-lc3 + Asic0 + 100000 + 21 + 0 + 0 + 20 + 8 + + + Ethernet80 + dut-lc3 + Asic0 + 100000 + 22 + 0 + 0 + 21 + 8 + + + Ethernet84 + dut-lc3 + Asic0 + 100000 + 23 + 0 + 0 + 22 + 8 + + + Ethernet88 + dut-lc3 + Asic0 + 100000 + 24 + 0 + 0 + 23 + 8 + + + Ethernet92 + dut-lc3 + Asic0 + 100000 + 25 + 0 + 0 + 24 + 8 + + + Ethernet96 + dut-lc3 + Asic0 + 100000 + 26 + 0 + 1 + 25 + 8 + + + Ethernet100 + dut-lc3 + Asic0 + 100000 + 27 + 0 + 1 + 26 + 8 + + + Ethernet104 + dut-lc3 + Asic0 + 100000 + 28 + 0 + 1 + 27 + 8 + + + Ethernet108 + dut-lc3 + Asic0 + 100000 + 29 + 0 + 1 + 28 + 8 + + + Ethernet112 + dut-lc3 + Asic0 + 100000 + 30 + 0 + 1 + 29 + 8 + + + Ethernet116 + dut-lc3 + Asic0 + 100000 + 31 + 0 + 1 + 30 + 8 + + + Ethernet120 + dut-lc3 + Asic0 + 100000 + 32 + 0 + 1 + 31 + 8 + + + Ethernet124 + dut-lc3 + Asic0 + 100000 + 33 + 0 + 1 + 32 + 8 + + + Ethernet128 + dut-lc3 + Asic0 + 100000 + 34 + 0 + 1 + 33 + 8 + + + Ethernet132 + dut-lc3 + Asic0 + 100000 + 35 + 0 + 1 + 34 + 8 + + + Ethernet136 + dut-lc3 + Asic0 + 100000 + 36 + 0 + 1 + 35 + 8 + + + Ethernet140 + dut-lc3 + Asic0 + 100000 + 37 + 0 + 1 + 36 + 8 + + + Ethernet144 + dut-lc3 + Asic0 + 100000 + 38 + 0 + 1 + 37 + 8 + + + Ethernet148 + dut-lc3 + Asic0 + 100000 + 39 + 0 + 1 + 38 + 8 + + + Ethernet152 + dut-lc3 + Asic0 + 100000 + 40 + 0 + 1 + 39 + 8 + + + Ethernet156 + dut-lc3 + Asic0 + 100000 + 41 + 0 + 1 + 40 + 8 + + + Ethernet160 + dut-lc3 + Asic0 + 100000 + 42 + 0 + 1 + 41 + 8 + + + Ethernet164 + dut-lc3 + Asic0 + 100000 + 43 + 0 + 1 + 42 + 8 + + + Ethernet168 + dut-lc3 + Asic0 + 100000 + 44 + 0 + 1 + 43 + 8 + + + Ethernet172 + dut-lc3 + Asic0 + 100000 + 45 + 0 + 1 + 44 + 8 + + + Ethernet176 + dut-lc3 + Asic0 + 100000 + 46 + 0 + 1 + 45 + 8 + + + Ethernet180 + dut-lc3 + Asic0 + 100000 + 47 + 0 + 1 + 46 + 8 + + + Ethernet184 + dut-lc3 + Asic0 + 100000 + 48 + 0 + 1 + 47 + 8 + + + Ethernet188 + dut-lc3 + Asic0 + 100000 + 49 + 0 + 1 + 48 + 8 + + + Ethernet-Rec0 + dut-lc3 + Asic0 + 400000 + 50 + 0 + 0 + 221 + 8 + + + Ethernet-IB0 + dut-lc3 + Asic0 + 400000 + 51 + 0 + 1 + 222 + 8 + + + Cpu0 + dut-lc4 + Asic0 + 10000 + 52 + 2 + 0 + 0 + 8 + + + Ethernet0 + dut-lc4 + Asic0 + 100000 + 53 + 2 + 0 + 1 + 8 + + + Ethernet4 + dut-lc4 + Asic0 + 100000 + 54 + 2 + 0 + 2 + 8 + + + Ethernet8 + dut-lc4 + Asic0 + 100000 + 55 + 2 + 0 + 3 + 8 + + + Ethernet12 + dut-lc4 + Asic0 + 100000 + 56 + 2 + 0 + 4 + 8 + + + Ethernet16 + dut-lc4 + Asic0 + 100000 + 57 + 2 + 0 + 5 + 8 + + + Ethernet20 + dut-lc4 + Asic0 + 100000 + 58 + 2 + 0 + 6 + 8 + + + Ethernet24 + dut-lc4 + Asic0 + 100000 + 59 + 2 + 0 + 7 + 8 + + + Ethernet28 + dut-lc4 + Asic0 + 100000 + 60 + 2 + 0 + 8 + 8 + + + Ethernet32 + dut-lc4 + Asic0 + 100000 + 61 + 2 + 0 + 9 + 8 + + + Ethernet36 + dut-lc4 + Asic0 + 100000 + 62 + 2 + 0 + 10 + 8 + + + Ethernet40 + dut-lc4 + Asic0 + 100000 + 63 + 2 + 0 + 11 + 8 + + + Ethernet44 + dut-lc4 + Asic0 + 100000 + 64 + 2 + 0 + 12 + 8 + + + Ethernet48 + dut-lc4 + Asic0 + 100000 + 65 + 2 + 0 + 13 + 8 + + + Ethernet52 + dut-lc4 + Asic0 + 100000 + 66 + 2 + 0 + 14 + 8 + + + Ethernet56 + dut-lc4 + Asic0 + 100000 + 67 + 2 + 0 + 15 + 8 + + + Ethernet60 + dut-lc4 + Asic0 + 100000 + 68 + 2 + 0 + 16 + 8 + + + Ethernet64 + dut-lc4 + Asic0 + 100000 + 69 + 2 + 0 + 17 + 8 + + + Ethernet68 + dut-lc4 + Asic0 + 100000 + 70 + 2 + 0 + 18 + 8 + + + Ethernet72 + dut-lc4 + Asic0 + 100000 + 71 + 2 + 0 + 19 + 8 + + + Ethernet76 + dut-lc4 + Asic0 + 100000 + 72 + 2 + 0 + 20 + 8 + + + Ethernet80 + dut-lc4 + Asic0 + 100000 + 73 + 2 + 0 + 21 + 8 + + + Ethernet84 + dut-lc4 + Asic0 + 100000 + 74 + 2 + 0 + 22 + 8 + + + Ethernet88 + dut-lc4 + Asic0 + 100000 + 75 + 2 + 0 + 23 + 8 + + + Ethernet92 + dut-lc4 + Asic0 + 100000 + 76 + 2 + 0 + 24 + 8 + + + Ethernet96 + dut-lc4 + Asic0 + 100000 + 77 + 2 + 1 + 25 + 8 + + + Ethernet100 + dut-lc4 + Asic0 + 100000 + 78 + 2 + 1 + 26 + 8 + + + Ethernet104 + dut-lc4 + Asic0 + 100000 + 79 + 2 + 1 + 27 + 8 + + + Ethernet108 + dut-lc4 + Asic0 + 100000 + 80 + 2 + 1 + 28 + 8 + + + Ethernet112 + dut-lc4 + Asic0 + 100000 + 81 + 2 + 1 + 29 + 8 + + + Ethernet116 + dut-lc4 + Asic0 + 100000 + 82 + 2 + 1 + 30 + 8 + + + Ethernet120 + dut-lc4 + Asic0 + 100000 + 83 + 2 + 1 + 31 + 8 + + + Ethernet124 + dut-lc4 + Asic0 + 100000 + 84 + 2 + 1 + 32 + 8 + + + Ethernet128 + dut-lc4 + Asic0 + 100000 + 85 + 2 + 1 + 33 + 8 + + + Ethernet132 + dut-lc4 + Asic0 + 100000 + 86 + 2 + 1 + 34 + 8 + + + Ethernet136 + dut-lc4 + Asic0 + 100000 + 87 + 2 + 1 + 35 + 8 + + + Ethernet140 + dut-lc4 + Asic0 + 100000 + 88 + 2 + 1 + 36 + 8 + + + Ethernet144 + dut-lc4 + Asic0 + 100000 + 89 + 2 + 1 + 37 + 8 + + + Ethernet148 + dut-lc4 + Asic0 + 100000 + 90 + 2 + 1 + 38 + 8 + + + Ethernet152 + dut-lc4 + Asic0 + 100000 + 91 + 2 + 1 + 39 + 8 + + + Ethernet156 + dut-lc4 + Asic0 + 100000 + 92 + 2 + 1 + 40 + 8 + + + Ethernet160 + dut-lc4 + Asic0 + 100000 + 93 + 2 + 1 + 41 + 8 + + + Ethernet164 + dut-lc4 + Asic0 + 100000 + 94 + 2 + 1 + 42 + 8 + + + Ethernet168 + dut-lc4 + Asic0 + 100000 + 95 + 2 + 1 + 43 + 8 + + + Ethernet172 + dut-lc4 + Asic0 + 100000 + 96 + 2 + 1 + 44 + 8 + + + Ethernet176 + dut-lc4 + Asic0 + 100000 + 97 + 2 + 1 + 45 + 8 + + + Ethernet180 + dut-lc4 + Asic0 + 100000 + 98 + 2 + 1 + 46 + 8 + + + Ethernet184 + dut-lc4 + Asic0 + 100000 + 99 + 2 + 1 + 47 + 8 + + + Ethernet188 + dut-lc4 + Asic0 + 100000 + 100 + 2 + 1 + 48 + 8 + + + Ethernet-Rec0 + dut-lc4 + Asic0 + 400000 + 101 + 2 + 0 + 221 + 8 + + + Ethernet-IB0 + dut-lc4 + Asic0 + 400000 + 102 + 2 + 1 + 222 + 8 + + + Cpu0 + dut-lc5 + Asic0 + 10000 + 103 + 4 + 0 + 0 + 8 + + + Ethernet0 + dut-lc5 + Asic0 + 100000 + 104 + 4 + 0 + 1 + 8 + + + Ethernet4 + dut-lc5 + Asic0 + 100000 + 105 + 4 + 0 + 2 + 8 + + + Ethernet8 + dut-lc5 + Asic0 + 100000 + 106 + 4 + 0 + 3 + 8 + + + Ethernet12 + dut-lc5 + Asic0 + 100000 + 107 + 4 + 0 + 4 + 8 + + + Ethernet16 + dut-lc5 + Asic0 + 100000 + 108 + 4 + 0 + 5 + 8 + + + Ethernet20 + dut-lc5 + Asic0 + 100000 + 109 + 4 + 0 + 6 + 8 + + + Ethernet24 + dut-lc5 + Asic0 + 100000 + 110 + 4 + 0 + 7 + 8 + + + Ethernet28 + dut-lc5 + Asic0 + 100000 + 111 + 4 + 0 + 8 + 8 + + + Ethernet32 + dut-lc5 + Asic0 + 100000 + 112 + 4 + 0 + 9 + 8 + + + Ethernet36 + dut-lc5 + Asic0 + 100000 + 113 + 4 + 0 + 10 + 8 + + + Ethernet40 + dut-lc5 + Asic0 + 100000 + 114 + 4 + 0 + 11 + 8 + + + Ethernet44 + dut-lc5 + Asic0 + 100000 + 115 + 4 + 0 + 12 + 8 + + + Ethernet48 + dut-lc5 + Asic0 + 100000 + 116 + 4 + 0 + 13 + 8 + + + Ethernet52 + dut-lc5 + Asic0 + 100000 + 117 + 4 + 0 + 14 + 8 + + + Ethernet56 + dut-lc5 + Asic0 + 100000 + 118 + 4 + 0 + 15 + 8 + + + Ethernet60 + dut-lc5 + Asic0 + 100000 + 119 + 4 + 0 + 16 + 8 + + + Ethernet64 + dut-lc5 + Asic0 + 100000 + 120 + 4 + 0 + 17 + 8 + + + Ethernet68 + dut-lc5 + Asic0 + 100000 + 121 + 4 + 0 + 18 + 8 + + + Ethernet72 + dut-lc5 + Asic0 + 100000 + 122 + 4 + 0 + 19 + 8 + + + Ethernet76 + dut-lc5 + Asic0 + 100000 + 123 + 4 + 0 + 20 + 8 + + + Ethernet80 + dut-lc5 + Asic0 + 100000 + 124 + 4 + 0 + 21 + 8 + + + Ethernet84 + dut-lc5 + Asic0 + 100000 + 125 + 4 + 0 + 22 + 8 + + + Ethernet88 + dut-lc5 + Asic0 + 100000 + 126 + 4 + 0 + 23 + 8 + + + Ethernet92 + dut-lc5 + Asic0 + 100000 + 127 + 4 + 0 + 24 + 8 + + + Ethernet96 + dut-lc5 + Asic0 + 100000 + 128 + 4 + 1 + 25 + 8 + + + Ethernet100 + dut-lc5 + Asic0 + 100000 + 129 + 4 + 1 + 26 + 8 + + + Ethernet104 + dut-lc5 + Asic0 + 100000 + 130 + 4 + 1 + 27 + 8 + + + Ethernet108 + dut-lc5 + Asic0 + 100000 + 131 + 4 + 1 + 28 + 8 + + + Ethernet112 + dut-lc5 + Asic0 + 100000 + 132 + 4 + 1 + 29 + 8 + + + Ethernet116 + dut-lc5 + Asic0 + 100000 + 133 + 4 + 1 + 30 + 8 + + + Ethernet120 + dut-lc5 + Asic0 + 100000 + 134 + 4 + 1 + 31 + 8 + + + Ethernet124 + dut-lc5 + Asic0 + 100000 + 135 + 4 + 1 + 32 + 8 + + + Ethernet128 + dut-lc5 + Asic0 + 100000 + 136 + 4 + 1 + 33 + 8 + + + Ethernet132 + dut-lc5 + Asic0 + 100000 + 137 + 4 + 1 + 34 + 8 + + + Ethernet136 + dut-lc5 + Asic0 + 100000 + 138 + 4 + 1 + 35 + 8 + + + Ethernet140 + dut-lc5 + Asic0 + 100000 + 139 + 4 + 1 + 36 + 8 + + + Ethernet144 + dut-lc5 + Asic0 + 100000 + 140 + 4 + 1 + 37 + 8 + + + Ethernet148 + dut-lc5 + Asic0 + 100000 + 141 + 4 + 1 + 38 + 8 + + + Ethernet152 + dut-lc5 + Asic0 + 100000 + 142 + 4 + 1 + 39 + 8 + + + Ethernet156 + dut-lc5 + Asic0 + 100000 + 143 + 4 + 1 + 40 + 8 + + + Ethernet160 + dut-lc5 + Asic0 + 100000 + 144 + 4 + 1 + 41 + 8 + + + Ethernet164 + dut-lc5 + Asic0 + 100000 + 145 + 4 + 1 + 42 + 8 + + + Ethernet168 + dut-lc5 + Asic0 + 100000 + 146 + 4 + 1 + 43 + 8 + + + Ethernet172 + dut-lc5 + Asic0 + 100000 + 147 + 4 + 1 + 44 + 8 + + + Ethernet176 + dut-lc5 + Asic0 + 100000 + 148 + 4 + 1 + 45 + 8 + + + Ethernet180 + dut-lc5 + Asic0 + 100000 + 149 + 4 + 1 + 46 + 8 + + + Ethernet184 + dut-lc5 + Asic0 + 100000 + 150 + 4 + 1 + 47 + 8 + + + Ethernet188 + dut-lc5 + Asic0 + 100000 + 151 + 4 + 1 + 48 + 8 + + + Ethernet-Rec0 + dut-lc5 + Asic0 + 400000 + 152 + 4 + 0 + 221 + 8 + + + Ethernet-IB0 + dut-lc5 + Asic0 + 400000 + 153 + 4 + 1 + 222 + 8 + + + + + dut-lc3 + Arista-7800R3-48CQ2-C48 +
diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json new file mode 100644 index 000000000000..c05eca81eaaa --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json @@ -0,0 +1,590 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet180": "5m", + "Ethernet8": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet0": "5m", + "Ethernet4": "5m", + "Ethernet108": "5m", + "Ethernet100": "5m", + "Ethernet128": "5m", + "Ethernet104": "5m", + "Ethernet68": "5m", + "Ethernet96": "5m", + "Ethernet124": "5m", + "Ethernet148": "5m", + "Ethernet92": "5m", + "Ethernet120": "5m", + "Ethernet144": "5m", + "Ethernet52": "5m", + "Ethernet160": "5m", + "Ethernet140": "5m", + "Ethernet56": "5m", + "Ethernet164": "5m", + "Ethernet76": "5m", + "Ethernet72": "5m", + "Ethernet64": "5m", + "Ethernet32": "5m", + "Ethernet16": "5m", + "Ethernet36": "5m", + "Ethernet12": "5m", + "Ethernet168": "5m", + "Ethernet116": "5m", + "Ethernet80": "5m", + "Ethernet112": "5m", + "Ethernet84": "5m", + "Ethernet152": "5m", + "Ethernet136": "5m", + "Ethernet156": "5m", + "Ethernet132": "5m", + "Ethernet48": "5m", + "Ethernet172": "5m", + "Ethernet44": "5m", + "Ethernet176": "5m", + "Ethernet40": "5m", + "Ethernet28": "5m", + "Ethernet88": "5m", + "Ethernet60": "5m", + "Ethernet20": "5m", + "Ethernet24": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "3220805000", + "type": "both", + "mode": "dynamic", + "xoff": "2102272" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"1280", + "dynamic_th":"-2", + "xon_offset":"2560", + "xon":"0", + "xoff":"66048" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "xon_offset":"0", + "static_th":"30535680" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"-1" + } + }, + "BUFFER_PG": { + "Ethernet180|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet180|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet8|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet184|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet188|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet0|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet4|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet108|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet100|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet128|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet104|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet68|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet96|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet124|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet148|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet92|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet120|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet144|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet52|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet140|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet56|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet164|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet76|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet72|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet64|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet32|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet16|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet36|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet12|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet88|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet116|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet80|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet112|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet84|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet152|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet136|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet156|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet132|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet48|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet44|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet176|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet40|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet28|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet60|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet20|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet24|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet180|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet8|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet184|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet188|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet0|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet4|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet108|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet100|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet128|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet104|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet68|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet96|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet124|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet148|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet92|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet120|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet144|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet52|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet140|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet56|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet164|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet76|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet72|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet64|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet32|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet16|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet36|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet12|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet88|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet116|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet80|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet112|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet84|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet152|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet136|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet156|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet132|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet48|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet44|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet176|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet40|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet28|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet60|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet20|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet24|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet180|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet8|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet184|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet188|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet0|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet4|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet108|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet100|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet128|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet104|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet68|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet96|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet124|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet148|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet92|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet120|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet144|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet52|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet140|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet56|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet164|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet76|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet72|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet64|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet32|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet16|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet36|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet12|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet88|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet116|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet80|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet112|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet84|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet152|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet136|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet156|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet132|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet48|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet44|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet176|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet40|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet28|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet60|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet20|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet24|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py2/qos-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py2/qos-arista7800r3-48cq2-lc.json new file mode 100644 index 000000000000..3044749a2776 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/qos-arista7800r3-48cq2-lc.json @@ -0,0 +1,1487 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet4": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet12": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet20": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet28": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet36": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet40": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet44": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet52": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet56": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet60": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet68": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet72": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet76": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet84": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet88": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet92": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet96": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet100": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet104": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet108": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet112": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet116": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet120": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet124": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet128": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet132": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet136": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet140": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet144": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet148": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet152": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet156": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet164": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet176": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet180": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet184": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet188": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet12|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet28|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet36|0": { + "scheduler": "scheduler.0" + }, + "Ethernet40|0": { + "scheduler": "scheduler.0" + }, + "Ethernet44|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet52|0": { + "scheduler": "scheduler.0" + }, + "Ethernet56|0": { + "scheduler": "scheduler.0" + }, + "Ethernet60|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet68|0": { + "scheduler": "scheduler.0" + }, + "Ethernet72|0": { + "scheduler": "scheduler.0" + }, + "Ethernet76|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet84|0": { + "scheduler": "scheduler.0" + }, + "Ethernet88|0": { + "scheduler": "scheduler.0" + }, + "Ethernet92|0": { + "scheduler": "scheduler.0" + }, + "Ethernet96|0": { + "scheduler": "scheduler.0" + }, + "Ethernet100|0": { + "scheduler": "scheduler.0" + }, + "Ethernet104|0": { + "scheduler": "scheduler.0" + }, + "Ethernet108|0": { + "scheduler": "scheduler.0" + }, + "Ethernet112|0": { + "scheduler": "scheduler.0" + }, + "Ethernet116|0": { + "scheduler": "scheduler.0" + }, + "Ethernet120|0": { + "scheduler": "scheduler.0" + }, + "Ethernet124|0": { + "scheduler": "scheduler.0" + }, + "Ethernet128|0": { + "scheduler": "scheduler.0" + }, + "Ethernet132|0": { + "scheduler": "scheduler.0" + }, + "Ethernet136|0": { + "scheduler": "scheduler.0" + }, + "Ethernet140|0": { + "scheduler": "scheduler.0" + }, + "Ethernet144|0": { + "scheduler": "scheduler.0" + }, + "Ethernet148|0": { + "scheduler": "scheduler.0" + }, + "Ethernet152|0": { + "scheduler": "scheduler.0" + }, + "Ethernet156|0": { + "scheduler": "scheduler.0" + }, + "Ethernet164|0": { + "scheduler": "scheduler.0" + }, + "Ethernet176|0": { + "scheduler": "scheduler.0" + }, + "Ethernet180|0": { + "scheduler": "scheduler.0" + }, + "Ethernet184|0": { + "scheduler": "scheduler.0" + }, + "Ethernet188|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet12|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet28|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet36|1": { + "scheduler": "scheduler.0" + }, + "Ethernet40|1": { + "scheduler": "scheduler.0" + }, + "Ethernet44|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet52|1": { + "scheduler": "scheduler.0" + }, + "Ethernet56|1": { + "scheduler": "scheduler.0" + }, + "Ethernet60|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet68|1": { + "scheduler": "scheduler.0" + }, + "Ethernet72|1": { + "scheduler": "scheduler.0" + }, + "Ethernet76|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet84|1": { + "scheduler": "scheduler.0" + }, + "Ethernet88|1": { + "scheduler": "scheduler.0" + }, + "Ethernet92|1": { + "scheduler": "scheduler.0" + }, + "Ethernet96|1": { + "scheduler": "scheduler.0" + }, + "Ethernet100|1": { + "scheduler": "scheduler.0" + }, + "Ethernet104|1": { + "scheduler": "scheduler.0" + }, + "Ethernet108|1": { + "scheduler": "scheduler.0" + }, + "Ethernet112|1": { + "scheduler": "scheduler.0" + }, + "Ethernet116|1": { + "scheduler": "scheduler.0" + }, + "Ethernet120|1": { + "scheduler": "scheduler.0" + }, + "Ethernet124|1": { + "scheduler": "scheduler.0" + }, + "Ethernet128|1": { + "scheduler": "scheduler.0" + }, + "Ethernet132|1": { + "scheduler": "scheduler.0" + }, + "Ethernet136|1": { + "scheduler": "scheduler.0" + }, + "Ethernet140|1": { + "scheduler": "scheduler.0" + }, + "Ethernet144|1": { + "scheduler": "scheduler.0" + }, + "Ethernet148|1": { + "scheduler": "scheduler.0" + }, + "Ethernet152|1": { + "scheduler": "scheduler.0" + }, + "Ethernet156|1": { + "scheduler": "scheduler.0" + }, + "Ethernet164|1": { + "scheduler": "scheduler.0" + }, + "Ethernet176|1": { + "scheduler": "scheduler.0" + }, + "Ethernet180|1": { + "scheduler": "scheduler.0" + }, + "Ethernet184|1": { + "scheduler": "scheduler.0" + }, + "Ethernet188|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet12|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet28|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet36|2": { + "scheduler": "scheduler.0" + }, + "Ethernet40|2": { + "scheduler": "scheduler.0" + }, + "Ethernet44|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet52|2": { + "scheduler": "scheduler.0" + }, + "Ethernet56|2": { + "scheduler": "scheduler.0" + }, + "Ethernet60|2": { + "scheduler": "scheduler.0" + }, + "Ethernet64|2": { + "scheduler": "scheduler.0" + }, + "Ethernet68|2": { + "scheduler": "scheduler.0" + }, + "Ethernet72|2": { + "scheduler": "scheduler.0" + }, + "Ethernet76|2": { + "scheduler": "scheduler.0" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet84|2": { + "scheduler": "scheduler.0" + }, + "Ethernet88|2": { + "scheduler": "scheduler.0" + }, + "Ethernet92|2": { + "scheduler": "scheduler.0" + }, + "Ethernet96|2": { + "scheduler": "scheduler.0" + }, + "Ethernet100|2": { + "scheduler": "scheduler.0" + }, + "Ethernet104|2": { + "scheduler": "scheduler.0" + }, + "Ethernet108|2": { + "scheduler": "scheduler.0" + }, + "Ethernet112|2": { + "scheduler": "scheduler.0" + }, + "Ethernet116|2": { + "scheduler": "scheduler.0" + }, + "Ethernet120|2": { + "scheduler": "scheduler.0" + }, + "Ethernet124|2": { + "scheduler": "scheduler.0" + }, + "Ethernet128|2": { + "scheduler": "scheduler.0" + }, + "Ethernet132|2": { + "scheduler": "scheduler.0" + }, + "Ethernet136|2": { + "scheduler": "scheduler.0" + }, + "Ethernet140|2": { + "scheduler": "scheduler.0" + }, + "Ethernet144|2": { + "scheduler": "scheduler.0" + }, + "Ethernet148|2": { + "scheduler": "scheduler.0" + }, + "Ethernet152|2": { + "scheduler": "scheduler.0" + }, + "Ethernet156|2": { + "scheduler": "scheduler.0" + }, + "Ethernet164|2": { + "scheduler": "scheduler.0" + }, + "Ethernet176|2": { + "scheduler": "scheduler.0" + }, + "Ethernet180|2": { + "scheduler": "scheduler.0" + }, + "Ethernet184|2": { + "scheduler": "scheduler.0" + }, + "Ethernet188|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet12|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet28|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet36|5": { + "scheduler": "scheduler.0" + }, + "Ethernet40|5": { + "scheduler": "scheduler.0" + }, + "Ethernet44|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet52|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet60|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet68|5": { + "scheduler": "scheduler.0" + }, + "Ethernet72|5": { + "scheduler": "scheduler.0" + }, + "Ethernet76|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet84|5": { + "scheduler": "scheduler.0" + }, + "Ethernet88|5": { + "scheduler": "scheduler.0" + }, + "Ethernet92|5": { + "scheduler": "scheduler.0" + }, + "Ethernet96|5": { + "scheduler": "scheduler.0" + }, + "Ethernet100|5": { + "scheduler": "scheduler.0" + }, + "Ethernet104|5": { + "scheduler": "scheduler.0" + }, + "Ethernet108|5": { + "scheduler": "scheduler.0" + }, + "Ethernet112|5": { + "scheduler": "scheduler.0" + }, + "Ethernet116|5": { + "scheduler": "scheduler.0" + }, + "Ethernet120|5": { + "scheduler": "scheduler.0" + }, + "Ethernet124|5": { + "scheduler": "scheduler.0" + }, + "Ethernet128|5": { + "scheduler": "scheduler.0" + }, + "Ethernet132|5": { + "scheduler": "scheduler.0" + }, + "Ethernet136|5": { + "scheduler": "scheduler.0" + }, + "Ethernet140|5": { + "scheduler": "scheduler.0" + }, + "Ethernet144|5": { + "scheduler": "scheduler.0" + }, + "Ethernet148|5": { + "scheduler": "scheduler.0" + }, + "Ethernet152|5": { + "scheduler": "scheduler.0" + }, + "Ethernet156|5": { + "scheduler": "scheduler.0" + }, + "Ethernet164|5": { + "scheduler": "scheduler.0" + }, + "Ethernet176|5": { + "scheduler": "scheduler.0" + }, + "Ethernet180|5": { + "scheduler": "scheduler.0" + }, + "Ethernet184|5": { + "scheduler": "scheduler.0" + }, + "Ethernet188|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet12|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet28|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet36|6": { + "scheduler": "scheduler.0" + }, + "Ethernet40|6": { + "scheduler": "scheduler.0" + }, + "Ethernet44|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet52|6": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + }, + "Ethernet60|6": { + "scheduler": "scheduler.0" + }, + "Ethernet64|6": { + "scheduler": "scheduler.0" + }, + "Ethernet68|6": { + "scheduler": "scheduler.0" + }, + "Ethernet72|6": { + "scheduler": "scheduler.0" + }, + "Ethernet76|6": { + "scheduler": "scheduler.0" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet84|6": { + "scheduler": "scheduler.0" + }, + "Ethernet88|6": { + "scheduler": "scheduler.0" + }, + "Ethernet92|6": { + "scheduler": "scheduler.0" + }, + "Ethernet96|6": { + "scheduler": "scheduler.0" + }, + "Ethernet100|6": { + "scheduler": "scheduler.0" + }, + "Ethernet104|6": { + "scheduler": "scheduler.0" + }, + "Ethernet108|6": { + "scheduler": "scheduler.0" + }, + "Ethernet112|6": { + "scheduler": "scheduler.0" + }, + "Ethernet116|6": { + "scheduler": "scheduler.0" + }, + "Ethernet120|6": { + "scheduler": "scheduler.0" + }, + "Ethernet124|6": { + "scheduler": "scheduler.0" + }, + "Ethernet128|6": { + "scheduler": "scheduler.0" + }, + "Ethernet132|6": { + "scheduler": "scheduler.0" + }, + "Ethernet136|6": { + "scheduler": "scheduler.0" + }, + "Ethernet140|6": { + "scheduler": "scheduler.0" + }, + "Ethernet144|6": { + "scheduler": "scheduler.0" + }, + "Ethernet148|6": { + "scheduler": "scheduler.0" + }, + "Ethernet152|6": { + "scheduler": "scheduler.0" + }, + "Ethernet156|6": { + "scheduler": "scheduler.0" + }, + "Ethernet164|6": { + "scheduler": "scheduler.0" + }, + "Ethernet176|6": { + "scheduler": "scheduler.0" + }, + "Ethernet180|6": { + "scheduler": "scheduler.0" + }, + "Ethernet184|6": { + "scheduler": "scheduler.0" + }, + "Ethernet188|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json new file mode 100644 index 000000000000..56538fd0935b --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json @@ -0,0 +1,590 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet4": "5m", + "Ethernet8": "5m", + "Ethernet12": "5m", + "Ethernet16": "5m", + "Ethernet20": "5m", + "Ethernet24": "5m", + "Ethernet28": "5m", + "Ethernet32": "5m", + "Ethernet36": "5m", + "Ethernet40": "5m", + "Ethernet44": "5m", + "Ethernet48": "5m", + "Ethernet52": "5m", + "Ethernet56": "5m", + "Ethernet60": "5m", + "Ethernet64": "5m", + "Ethernet68": "5m", + "Ethernet72": "5m", + "Ethernet76": "5m", + "Ethernet80": "5m", + "Ethernet84": "5m", + "Ethernet88": "5m", + "Ethernet92": "5m", + "Ethernet96": "5m", + "Ethernet100": "5m", + "Ethernet104": "5m", + "Ethernet108": "5m", + "Ethernet112": "5m", + "Ethernet116": "5m", + "Ethernet120": "5m", + "Ethernet124": "5m", + "Ethernet128": "5m", + "Ethernet132": "5m", + "Ethernet136": "5m", + "Ethernet140": "5m", + "Ethernet144": "5m", + "Ethernet148": "5m", + "Ethernet152": "5m", + "Ethernet156": "5m", + "Ethernet160": "5m", + "Ethernet164": "5m", + "Ethernet168": "5m", + "Ethernet172": "5m", + "Ethernet176": "5m", + "Ethernet180": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "3220805000", + "type": "both", + "mode": "dynamic", + "xoff": "2102272" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"1280", + "dynamic_th":"-2", + "xon_offset":"2560", + "xon":"0", + "xoff":"66048" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "xon_offset":"0", + "static_th":"30535680" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"-1" + } + }, + "BUFFER_PG": { + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet0|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet36|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet40|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet44|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet48|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet52|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet56|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet60|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet64|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet68|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet72|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet4|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet76|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet80|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet84|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet88|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet92|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet96|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet100|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet104|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet108|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet112|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet8|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet116|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet120|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet124|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet128|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet132|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet136|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet140|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet144|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet148|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet152|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet12|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet156|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet164|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet176|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet180|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet184|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet188|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet16|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet20|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet24|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet28|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet32|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet0|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet36|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet40|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet44|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet48|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet52|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet56|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet60|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet64|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet68|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet72|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet4|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet76|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet80|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet84|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet88|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet92|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet96|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet100|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet104|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet108|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet112|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet8|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet116|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet120|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet124|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet128|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet132|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet136|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet140|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet144|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet148|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet152|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet12|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet156|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet164|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet176|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet180|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet184|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet188|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet16|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet20|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet24|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet28|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet32|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet0|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet36|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet40|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet44|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet48|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet52|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet56|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet60|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet64|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet68|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet72|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet4|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet76|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet80|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet84|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet88|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet92|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet96|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet100|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet104|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet108|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet112|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet8|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet116|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet120|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet124|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet128|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet132|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet136|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet140|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet144|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet148|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet152|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet12|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet156|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet164|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet176|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet180|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet184|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet188|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet16|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet20|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet24|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet28|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet32|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7800r3-48cq2-lc.json new file mode 100644 index 000000000000..3044749a2776 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7800r3-48cq2-lc.json @@ -0,0 +1,1487 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet4": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet12": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet20": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet28": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet36": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet40": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet44": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet52": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet56": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet60": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet68": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet72": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet76": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet84": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet88": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet92": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet96": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet100": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet104": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet108": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet112": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet116": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet120": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet124": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet128": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet132": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet136": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet140": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet144": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet148": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet152": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet156": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet164": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet176": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet180": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet184": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + }, + "Ethernet188": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet12|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet28|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet36|0": { + "scheduler": "scheduler.0" + }, + "Ethernet40|0": { + "scheduler": "scheduler.0" + }, + "Ethernet44|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet52|0": { + "scheduler": "scheduler.0" + }, + "Ethernet56|0": { + "scheduler": "scheduler.0" + }, + "Ethernet60|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet68|0": { + "scheduler": "scheduler.0" + }, + "Ethernet72|0": { + "scheduler": "scheduler.0" + }, + "Ethernet76|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet84|0": { + "scheduler": "scheduler.0" + }, + "Ethernet88|0": { + "scheduler": "scheduler.0" + }, + "Ethernet92|0": { + "scheduler": "scheduler.0" + }, + "Ethernet96|0": { + "scheduler": "scheduler.0" + }, + "Ethernet100|0": { + "scheduler": "scheduler.0" + }, + "Ethernet104|0": { + "scheduler": "scheduler.0" + }, + "Ethernet108|0": { + "scheduler": "scheduler.0" + }, + "Ethernet112|0": { + "scheduler": "scheduler.0" + }, + "Ethernet116|0": { + "scheduler": "scheduler.0" + }, + "Ethernet120|0": { + "scheduler": "scheduler.0" + }, + "Ethernet124|0": { + "scheduler": "scheduler.0" + }, + "Ethernet128|0": { + "scheduler": "scheduler.0" + }, + "Ethernet132|0": { + "scheduler": "scheduler.0" + }, + "Ethernet136|0": { + "scheduler": "scheduler.0" + }, + "Ethernet140|0": { + "scheduler": "scheduler.0" + }, + "Ethernet144|0": { + "scheduler": "scheduler.0" + }, + "Ethernet148|0": { + "scheduler": "scheduler.0" + }, + "Ethernet152|0": { + "scheduler": "scheduler.0" + }, + "Ethernet156|0": { + "scheduler": "scheduler.0" + }, + "Ethernet164|0": { + "scheduler": "scheduler.0" + }, + "Ethernet176|0": { + "scheduler": "scheduler.0" + }, + "Ethernet180|0": { + "scheduler": "scheduler.0" + }, + "Ethernet184|0": { + "scheduler": "scheduler.0" + }, + "Ethernet188|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet12|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet28|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet36|1": { + "scheduler": "scheduler.0" + }, + "Ethernet40|1": { + "scheduler": "scheduler.0" + }, + "Ethernet44|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet52|1": { + "scheduler": "scheduler.0" + }, + "Ethernet56|1": { + "scheduler": "scheduler.0" + }, + "Ethernet60|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet68|1": { + "scheduler": "scheduler.0" + }, + "Ethernet72|1": { + "scheduler": "scheduler.0" + }, + "Ethernet76|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet84|1": { + "scheduler": "scheduler.0" + }, + "Ethernet88|1": { + "scheduler": "scheduler.0" + }, + "Ethernet92|1": { + "scheduler": "scheduler.0" + }, + "Ethernet96|1": { + "scheduler": "scheduler.0" + }, + "Ethernet100|1": { + "scheduler": "scheduler.0" + }, + "Ethernet104|1": { + "scheduler": "scheduler.0" + }, + "Ethernet108|1": { + "scheduler": "scheduler.0" + }, + "Ethernet112|1": { + "scheduler": "scheduler.0" + }, + "Ethernet116|1": { + "scheduler": "scheduler.0" + }, + "Ethernet120|1": { + "scheduler": "scheduler.0" + }, + "Ethernet124|1": { + "scheduler": "scheduler.0" + }, + "Ethernet128|1": { + "scheduler": "scheduler.0" + }, + "Ethernet132|1": { + "scheduler": "scheduler.0" + }, + "Ethernet136|1": { + "scheduler": "scheduler.0" + }, + "Ethernet140|1": { + "scheduler": "scheduler.0" + }, + "Ethernet144|1": { + "scheduler": "scheduler.0" + }, + "Ethernet148|1": { + "scheduler": "scheduler.0" + }, + "Ethernet152|1": { + "scheduler": "scheduler.0" + }, + "Ethernet156|1": { + "scheduler": "scheduler.0" + }, + "Ethernet164|1": { + "scheduler": "scheduler.0" + }, + "Ethernet176|1": { + "scheduler": "scheduler.0" + }, + "Ethernet180|1": { + "scheduler": "scheduler.0" + }, + "Ethernet184|1": { + "scheduler": "scheduler.0" + }, + "Ethernet188|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet12|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet28|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet36|2": { + "scheduler": "scheduler.0" + }, + "Ethernet40|2": { + "scheduler": "scheduler.0" + }, + "Ethernet44|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet52|2": { + "scheduler": "scheduler.0" + }, + "Ethernet56|2": { + "scheduler": "scheduler.0" + }, + "Ethernet60|2": { + "scheduler": "scheduler.0" + }, + "Ethernet64|2": { + "scheduler": "scheduler.0" + }, + "Ethernet68|2": { + "scheduler": "scheduler.0" + }, + "Ethernet72|2": { + "scheduler": "scheduler.0" + }, + "Ethernet76|2": { + "scheduler": "scheduler.0" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet84|2": { + "scheduler": "scheduler.0" + }, + "Ethernet88|2": { + "scheduler": "scheduler.0" + }, + "Ethernet92|2": { + "scheduler": "scheduler.0" + }, + "Ethernet96|2": { + "scheduler": "scheduler.0" + }, + "Ethernet100|2": { + "scheduler": "scheduler.0" + }, + "Ethernet104|2": { + "scheduler": "scheduler.0" + }, + "Ethernet108|2": { + "scheduler": "scheduler.0" + }, + "Ethernet112|2": { + "scheduler": "scheduler.0" + }, + "Ethernet116|2": { + "scheduler": "scheduler.0" + }, + "Ethernet120|2": { + "scheduler": "scheduler.0" + }, + "Ethernet124|2": { + "scheduler": "scheduler.0" + }, + "Ethernet128|2": { + "scheduler": "scheduler.0" + }, + "Ethernet132|2": { + "scheduler": "scheduler.0" + }, + "Ethernet136|2": { + "scheduler": "scheduler.0" + }, + "Ethernet140|2": { + "scheduler": "scheduler.0" + }, + "Ethernet144|2": { + "scheduler": "scheduler.0" + }, + "Ethernet148|2": { + "scheduler": "scheduler.0" + }, + "Ethernet152|2": { + "scheduler": "scheduler.0" + }, + "Ethernet156|2": { + "scheduler": "scheduler.0" + }, + "Ethernet164|2": { + "scheduler": "scheduler.0" + }, + "Ethernet176|2": { + "scheduler": "scheduler.0" + }, + "Ethernet180|2": { + "scheduler": "scheduler.0" + }, + "Ethernet184|2": { + "scheduler": "scheduler.0" + }, + "Ethernet188|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet12|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet28|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet36|5": { + "scheduler": "scheduler.0" + }, + "Ethernet40|5": { + "scheduler": "scheduler.0" + }, + "Ethernet44|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet52|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet60|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet68|5": { + "scheduler": "scheduler.0" + }, + "Ethernet72|5": { + "scheduler": "scheduler.0" + }, + "Ethernet76|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet84|5": { + "scheduler": "scheduler.0" + }, + "Ethernet88|5": { + "scheduler": "scheduler.0" + }, + "Ethernet92|5": { + "scheduler": "scheduler.0" + }, + "Ethernet96|5": { + "scheduler": "scheduler.0" + }, + "Ethernet100|5": { + "scheduler": "scheduler.0" + }, + "Ethernet104|5": { + "scheduler": "scheduler.0" + }, + "Ethernet108|5": { + "scheduler": "scheduler.0" + }, + "Ethernet112|5": { + "scheduler": "scheduler.0" + }, + "Ethernet116|5": { + "scheduler": "scheduler.0" + }, + "Ethernet120|5": { + "scheduler": "scheduler.0" + }, + "Ethernet124|5": { + "scheduler": "scheduler.0" + }, + "Ethernet128|5": { + "scheduler": "scheduler.0" + }, + "Ethernet132|5": { + "scheduler": "scheduler.0" + }, + "Ethernet136|5": { + "scheduler": "scheduler.0" + }, + "Ethernet140|5": { + "scheduler": "scheduler.0" + }, + "Ethernet144|5": { + "scheduler": "scheduler.0" + }, + "Ethernet148|5": { + "scheduler": "scheduler.0" + }, + "Ethernet152|5": { + "scheduler": "scheduler.0" + }, + "Ethernet156|5": { + "scheduler": "scheduler.0" + }, + "Ethernet164|5": { + "scheduler": "scheduler.0" + }, + "Ethernet176|5": { + "scheduler": "scheduler.0" + }, + "Ethernet180|5": { + "scheduler": "scheduler.0" + }, + "Ethernet184|5": { + "scheduler": "scheduler.0" + }, + "Ethernet188|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet12|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet28|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet36|6": { + "scheduler": "scheduler.0" + }, + "Ethernet40|6": { + "scheduler": "scheduler.0" + }, + "Ethernet44|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet52|6": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + }, + "Ethernet60|6": { + "scheduler": "scheduler.0" + }, + "Ethernet64|6": { + "scheduler": "scheduler.0" + }, + "Ethernet68|6": { + "scheduler": "scheduler.0" + }, + "Ethernet72|6": { + "scheduler": "scheduler.0" + }, + "Ethernet76|6": { + "scheduler": "scheduler.0" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet84|6": { + "scheduler": "scheduler.0" + }, + "Ethernet88|6": { + "scheduler": "scheduler.0" + }, + "Ethernet92|6": { + "scheduler": "scheduler.0" + }, + "Ethernet96|6": { + "scheduler": "scheduler.0" + }, + "Ethernet100|6": { + "scheduler": "scheduler.0" + }, + "Ethernet104|6": { + "scheduler": "scheduler.0" + }, + "Ethernet108|6": { + "scheduler": "scheduler.0" + }, + "Ethernet112|6": { + "scheduler": "scheduler.0" + }, + "Ethernet116|6": { + "scheduler": "scheduler.0" + }, + "Ethernet120|6": { + "scheduler": "scheduler.0" + }, + "Ethernet124|6": { + "scheduler": "scheduler.0" + }, + "Ethernet128|6": { + "scheduler": "scheduler.0" + }, + "Ethernet132|6": { + "scheduler": "scheduler.0" + }, + "Ethernet136|6": { + "scheduler": "scheduler.0" + }, + "Ethernet140|6": { + "scheduler": "scheduler.0" + }, + "Ethernet144|6": { + "scheduler": "scheduler.0" + }, + "Ethernet148|6": { + "scheduler": "scheduler.0" + }, + "Ethernet152|6": { + "scheduler": "scheduler.0" + }, + "Ethernet156|6": { + "scheduler": "scheduler.0" + }, + "Ethernet164|6": { + "scheduler": "scheduler.0" + }, + "Ethernet176|6": { + "scheduler": "scheduler.0" + }, + "Ethernet180|6": { + "scheduler": "scheduler.0" + }, + "Ethernet184|6": { + "scheduler": "scheduler.0" + }, + "Ethernet188|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index b0bfbe9f3727..eb002720d98d 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -23,6 +23,7 @@ def setUp(self): self.mlnx_port_config = os.path.join(self.test_dir, 'sample-port-config-mlnx.ini') self.dell6100_t0_minigraph = os.path.join(self.test_dir, 'sample-dell-6100-t0-minigraph.xml') self.arista7050_t0_minigraph = os.path.join(self.test_dir, 'sample-arista-7050-t0-minigraph.xml') + self.arista7800r3_48cq2_lc_t2_minigraph = os.path.join(self.test_dir, 'sample-arista-7800r3-48cq2-lc-t2-minigraph.xml') self.multi_asic_minigraph = os.path.join(self.test_dir, 'multi_npu_data', 'sample-minigraph.xml') self.multi_asic_port_config = os.path.join(self.test_dir, 'multi_npu_data', 'sample_port_config-0.ini') self.dell9332_t1_minigraph = os.path.join(self.test_dir, 'sample-dell-9332-t1-minigraph.xml') @@ -212,6 +213,30 @@ def test_qos_arista7050_render_template(self): sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-arista7050.json') assert utils.cmp(sample_output_file, self.output_file) + def test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self): + arista_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'arista', 'x86_64-arista_7800r3_48cq2_lc', 'Arista-7800R3-48CQ2-C48') + qos_file = os.path.join(arista_dir_path, 'qos.json.j2') + buffer_file = os.path.join(arista_dir_path, 'buffers.json.j2') + port_config_ini_file = os.path.join(arista_dir_path, 'port_config.ini') + + # copy qos_config.j2 and buffer_config.j2 to the Arista 7800r3_48cq2_lc directory to have all templates in one directory + qos_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'qos_config.j2') + shutil.copy2(qos_config_file, arista_dir_path) + buffer_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'buffers_config.j2') + shutil.copy2(buffer_config_file, arista_dir_path) + + for template_file, cfg_file, sample_output_file in [(qos_file, 'qos_config.j2', 'qos-arista7800r3-48cq2-lc.json'), + (buffer_file, 'buffers_config.j2', 'buffer-arista7800r3-48cq2-lc.json') ]: + argument = '-m ' + self.arista7800r3_48cq2_lc_t2_minigraph + ' -p ' + port_config_ini_file + ' -t ' + template_file + ' > ' + self.output_file + self.run_script(argument) + + # cleanup + cfg_file_new = os.path.join(arista_dir_path, cfg_file) + os.remove(cfg_file_new) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, sample_output_file) + assert filecmp.cmp(sample_output_file, self.output_file) + def test_qos_dell9332_render_template(self): dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dellemc_z9332f_d1508-r0', 'DellEMC-Z9332f-O32') qos_file = os.path.join(dell_dir_path, 'qos.json.j2') From 86017096b2139420a7b2b5f2e4a57987a4747cd5 Mon Sep 17 00:00:00 2001 From: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com> Date: Thu, 10 Mar 2022 08:54:33 +0800 Subject: [PATCH 12/54] [bgpcfgd] to support removal part of configuration of bgp allowed prefix list (#10165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix allow list issue Signed-off-by: stormliang * add the ipaddress in the install list * add unit test Co-authored-by: Ubuntu Why I did it Failed to remove part of configuration of bgp allowed prefix list. The details in #10141 How I did it There are two issues: In FRR, ipv6 default route is ::/0, but in the configuration, it is 0::/0, string comparison would be false, but why ipv4 failed to remove the allowed prefix list, ipv6 works? Looks into next one for the answer. The current managers_allow_list doesn’t support removal part of the prefix list. But why IPv6 works in 1? It is because the bug for the IPv6 default route comparison, it would do the update no matter what is the operation (the code will compare the prefix list in the FRR and configuration db, if all configurations in db are presented in FRR, it do nothing, otherwise it will update the prefix list based on the configuration from db). How to verify it Follow the step in #10141 --- .../bgpcfgd/managers_allow_list.py | 49 ++++-- src/sonic-bgpcfgd/setup.py | 1 + src/sonic-bgpcfgd/tests/test_allow_list.py | 155 +++++++++++++----- 3 files changed, 153 insertions(+), 52 deletions(-) diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_allow_list.py b/src/sonic-bgpcfgd/bgpcfgd/managers_allow_list.py index 435be91d20d2..e03bb19c163f 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_allow_list.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_allow_list.py @@ -2,6 +2,7 @@ Implementation of "allow-list" feature """ import re +import ipaddress from .log import log_debug, log_info, log_err, log_warn from .template import TemplateFabric @@ -19,6 +20,7 @@ class BGPAllowListMgr(Manager): ROUTE_MAP_ENTRY_WITH_COMMUNITY_END = 29990 ROUTE_MAP_ENTRY_WITHOUT_COMMUNITY_START = 30000 ROUTE_MAP_ENTRY_WITHOUT_COMMUNITY_END = 65530 + PREFIX_LIST_POS = 1 # the position of the ip prefix in the permit string. V4 = "v4" # constant for af enum: V4 V6 = "v6" # constant for af enum: V6 @@ -228,6 +230,12 @@ def __update_prefix_list(self, af, pl_name, allow_list): constant_list = self.__get_constant_list(af) allow_list = self.__to_prefix_list(af, allow_list) log_debug("BGPAllowListMgr::__update_prefix_list. af='%s' prefix-list name=%s" % (af, pl_name)) + ''' + Need to check exist and equality of the allowed prefix list. + A. If exist and equal, no operation needed. + B. If exist but not equal, first delete then add prefix based on the data from condig db and constants. + C. If non-exist, directly add prefix based on the data from condig db and constants. + ''' exist, correct = self.__is_prefix_list_valid(af, pl_name, allow_list, constant_list) if correct: log_debug("BGPAllowListMgr::__update_prefix_list. the prefix-list '%s' exists and correct" % pl_name) @@ -237,7 +245,7 @@ def __update_prefix_list(self, af, pl_name, allow_list): seq_no = 10 if exist: cmds.append('no %s prefix-list %s' % (family, pl_name)) - for entry in constant_list + allow_list: + for entry in self.__normalize_ipnetwork(af, constant_list + allow_list): cmds.append('%s prefix-list %s seq %d %s' % (family, pl_name, seq_no, entry)) seq_no += 10 return cmds @@ -258,6 +266,24 @@ def __remove_prefix_list(self, af, pl_name): family = self.__af_to_family(af) return ["no %s prefix-list %s" % (family, pl_name)] + def __normalize_ipnetwork(self, af, allow_prefix_list): + ''' + Normalize IPv6 addresses + for example: + 2001:cdba:0000:0000:0000:0000:3257:9652 + 2001:cdba:0:0:0:0:3257:9652 + 2001:cdba::3257:9652 + after normalize, all would be normalized to + 2001:cdba::3257:9652 + ''' + normalize_list = [] + for allow_item in allow_prefix_list: + tmp_list = allow_item.split(' ') + if af == self.V6: + tmp_list[self.PREFIX_LIST_POS] = str(ipaddress.IPv6Network(tmp_list[self.PREFIX_LIST_POS])) + normalize_list.append(' '.join(tmp_list)) + return normalize_list + def __is_prefix_list_valid(self, af, pl_name, allow_list, constant_list): """ Check that a prefix list exists and it has valid entries @@ -266,7 +292,8 @@ def __is_prefix_list_valid(self, af, pl_name, allow_list, constant_list): :param allow_list: a prefix-list which must be a part of the valid prefix list :param constant_list: a constant list which must be on top of each "allow" prefix list on the device :return: a tuple. The first element of the tuple has True if the prefix-list exists, False otherwise, - The second element of the tuple has True if the prefix-list contains correct entries, False if not + The second element of the tuple has True if allow prefix list in running configuraiton is + equal with ones in config db + constants, False if not """ assert af == self.V4 or af == self.V6 family = self.__af_to_family(af) @@ -274,20 +301,18 @@ def __is_prefix_list_valid(self, af, pl_name, allow_list, constant_list): conf = self.cfg_mgr.get_text() if not any(line.strip().startswith(match_string) for line in conf): return False, False # if the prefix list is not exists, it is not correct - constant_set = set(constant_list) - allow_set = set(allow_list) + expect_set = set(self.__normalize_ipnetwork(af, constant_list)) + expect_set.update(set(self.__normalize_ipnetwork(af, allow_list))) + + config_list = [] for line in conf: if line.startswith(match_string): found = line[len(match_string):].strip().split(' ') rule = " ".join(found[1:]) - if rule in constant_set: - constant_set.discard(rule) - elif rule in allow_set: - if constant_set: - return True, False # Not everything from constant set is presented - else: - allow_set.discard(rule) - return True, len(allow_set) == 0 # allow_set should be presented all + config_list.append(rule) + + # Return double Ture, when running configuraiton is identical with config db + constants. + return True, expect_set == set(self.__normalize_ipnetwork(af, config_list)) def __update_community(self, community_name, community_value): """ diff --git a/src/sonic-bgpcfgd/setup.py b/src/sonic-bgpcfgd/setup.py index ab86ca20ec19..b451accb9792 100755 --- a/src/sonic-bgpcfgd/setup.py +++ b/src/sonic-bgpcfgd/setup.py @@ -18,6 +18,7 @@ 'jinja2>=2.10', 'netaddr==0.8.0', 'pyyaml==5.4.1', + 'ipaddress==1.0.23' ], setup_requires = [ 'pytest-runner', diff --git a/src/sonic-bgpcfgd/tests/test_allow_list.py b/src/sonic-bgpcfgd/tests/test_allow_list.py index cb0896982a39..5207c6283462 100644 --- a/src/sonic-bgpcfgd/tests/test_allow_list.py +++ b/src/sonic-bgpcfgd/tests/test_allow_list.py @@ -79,8 +79,8 @@ def test_set_handler_with_community(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -110,8 +110,8 @@ def test_set_handler_with_community_and_permit_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -142,8 +142,8 @@ def test_set_handler_with_community_and_deny_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -178,8 +178,8 @@ def test_set_handler_no_community(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -206,8 +206,8 @@ def test_set_handler_no_community_with_permit_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -234,8 +234,8 @@ def test_set_handler_no_community_with_deny_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -257,8 +257,8 @@ def test_del_handler_with_community(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -292,8 +292,8 @@ def test_del_handler_with_exiting_community_deny_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -331,8 +331,8 @@ def test_del_handler_with_exiting_community_permit_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -365,8 +365,8 @@ def test_del_handler_with_exiting_community_deny_action_global_deny(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -401,8 +401,8 @@ def test_del_handler_with_exiting_community_permit_action_global_deny(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -441,8 +441,8 @@ def test_del_handler_no_community(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 ge 65', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -470,8 +470,8 @@ def test_del_handler_with_no_community_deny_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 ge 65', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -503,8 +503,8 @@ def test_del_handler_with_no_community_permit_action_global_deny(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 ge 65', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -543,8 +543,8 @@ def test_set_handler_with_community_data_is_already_presented(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -572,8 +572,8 @@ def test_set_handler_no_community_data_is_already_presented(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -636,8 +636,8 @@ def test_set_handler_with_community_update_prefixes_add(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -660,8 +660,8 @@ def test_set_handler_with_community_update_prefixes_add(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 40 permit 80.90.0.0/16 le 32', 'no ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 50 permit fc02::/64 le 128', @@ -679,8 +679,8 @@ def test_set_handler_no_community_update_prefixes_add(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -700,14 +700,89 @@ def test_set_handler_no_community_update_prefixes_add(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 40 permit 80.90.0.0/16 le 32', 'no ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 50 permit fc02::/64 le 128', ] ) +def test_set_handler_with_community_update_prefixes_remove(): + set_del_test( + "SET", + ("DEPLOYMENT_ID|5|1010:2020", { + "prefixes_v4": "10.20.30.0/24", + "prefixes_v6": "fc00:20::/64", + }), + [ + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', + 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 10', + ' match ip address prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4', + ' match community COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 10', + ' match ipv6 address prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6', + ' match community COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 65535', + ' set community 123:123 additive', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 65535', + ' set community 123:123 additive', + "" + ], + [ + 'no ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', + 'no ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', + ] + ) + +def test_set_handler_no_community_update_prefixes_remove(): + set_del_test( + "SET", + ("DEPLOYMENT_ID|5", { + "prefixes_v4": "20.20.30.0/24", + "prefixes_v6": "fc01:20::/64", + }), + [ + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', + ' match ip address prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 30000', + ' match ipv6 address prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 65535', + ' set community 123:123 additive', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 65535', + ' set community 123:123 additive', + "" + ], + [ + 'no ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', + 'no ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', + ] + ) + @patch.dict("sys.modules", swsscommon=swsscommon_module_mock) def test___set_handler_validate(): from bgpcfgd.managers_allow_list import BGPAllowListMgr From c8db7a2d529df3bbb622dfe7e5df939423c98c2c Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Thu, 10 Mar 2022 13:15:44 +0800 Subject: [PATCH 13/54] [Mellanox][SAISERVER] Support Mellanox saiserverv1 and saiserverv2 docker (#9686) * support saiserverv1 and saiserverv2 docker * add saiserver into buster and revert some changes * update thrift version --- platform/mellanox/docker-saiserver-mlnx.mk | 9 ++++---- .../docker-saiserver-mlnx/Dockerfile.j2 | 19 +++++++-------- .../docker-saiserver-mlnx/supervisord.conf | 2 +- platform/mellanox/libsaithrift-dev.mk | 23 +++++++++++++------ 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/platform/mellanox/docker-saiserver-mlnx.mk b/platform/mellanox/docker-saiserver-mlnx.mk index da74234bbf71..b765b338eddd 100644 --- a/platform/mellanox/docker-saiserver-mlnx.mk +++ b/platform/mellanox/docker-saiserver-mlnx.mk @@ -16,15 +16,16 @@ # # docker image for mlnx saiserver -DOCKER_SAISERVER_MLNX = docker-saiserver-mlnx.gz +DOCKER_SAISERVER_MLNX = docker-saiserver$(SAITHRIFT_VER)-mlnx.gz $(DOCKER_SAISERVER_MLNX)_PATH = $(PLATFORM_PATH)/docker-saiserver-mlnx $(DOCKER_SAISERVER_MLNX)_DEPENDS += $(SAISERVER) $(PYTHON_SDK_API) $(DOCKER_SAISERVER_MLNX)_PYTHON_DEBS += $(MLNX_SFPD) -$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) +$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MLNX) -SONIC_STRETCH_DOCKERS += $(DOCKER_SAISERVER_MLNX) +SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_MLNX) + +$(DOCKER_SAISERVER_MLNX)_CONTAINER_NAME = saiserver$(SAITHRIFT_VER) -$(DOCKER_SAISERVER_MLNX)_CONTAINER_NAME = saiserver $(DOCKER_SAISERVER_MLNX)_RUN_OPT += --privileged -t $(DOCKER_SAISERVER_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SAISERVER_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 index 1444c7a24d62..d5b5e92ea81c 100644 --- a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 @@ -14,7 +14,8 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## -FROM docker-config-engine-stretch +{% from "dockers/dockerfile-macros.j2" import install_debian_packages %} +FROM docker-config-engine-buster ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf @@ -22,7 +23,11 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + gdb \ + libboost-atomic1.71.0 COPY \ {% for deb in docker_saiserver_mlnx_debs.split(' ') -%} @@ -38,15 +43,7 @@ debs/ RUN apt-get install -y --no-install-recommends libxml2 iptables libbsd0 protobuf-c-compiler protobuf-compiler python-protobuf libprotobuf-c1 python-future python-ipaddr libnet1 pkg-config asciidoc xmlto -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ -{% for deb in docker_saiserver_mlnx_debs.split(' ') -%} -dpkg_apt debs/{{ deb }}{{'; '}} -{%- endfor %} - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ -{% for deb in docker_saiserver_mlnx_pydebs.split(' ') -%} -dpkg_apt debs/{{ deb }}{{'; '}} -{%- endfor %} +{{ install_debian_packages(docker_saiserver_mlnx_debs.split(' ')) }} COPY ["start.sh", "/usr/bin/"] diff --git a/platform/mellanox/docker-saiserver-mlnx/supervisord.conf b/platform/mellanox/docker-saiserver-mlnx/supervisord.conf index cb67a0fc9a47..e90e41645042 100644 --- a/platform/mellanox/docker-saiserver-mlnx/supervisord.conf +++ b/platform/mellanox/docker-saiserver-mlnx/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:saiserver] -command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +command=/usr/sbin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini priority=3 autostart=false autorestart=false diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index 03daf65fac84..d50311976cfe 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -18,19 +18,28 @@ SAI_VER = 0.9.4 -LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_amd64.deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV) -$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) +ifeq ($(SAITHRIFT_V2),y) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1) +$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SAITHRIFT_VER=v2 +else +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) +endif +$(LIBSAITHRIFT_DEV)_DEPENDS += $(MLNX_SAI) $(MLNX_SAI_DEV) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(MLNX_SAI) + SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) -PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +PYTHON_SAITHRIFT = python-saithrift$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) -SAISERVER = saiserver_$(SAI_VER)_amd64.deb -$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) +SAISERVER = saiserver$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb +$(SAISERVER)_RDEPENDS += $(LIBSAITHRIFT_DEV) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) -SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +SAISERVER_DBG = saiserver$(SAITHRIFT_VER)-dbg_$(SAI_VER)_amd64.deb $(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) From a89f294fd5e1cdd1074922e48d507b65bf180b98 Mon Sep 17 00:00:00 2001 From: Taras Keryk Date: Thu, 10 Mar 2022 12:55:06 +0200 Subject: [PATCH 14/54] [BFN] Implementation API for platform component (#10180) * [BFN] Implementation API for platform component SONiC has a concept of "platform components" this may include - CPLD, FPGA, BIOS, BMC, etc. These changes are needed to read the version of the BIOS and BMC component. What I did Create components.py module Add funcion for reading componet version to thrift interface How I did it The previous implementaion didn't have platform components API, so fwutil return an empty list. After implementation of the platform component API, we have actual list of platform components and firmware versions How to verify it Run manually 'fwutil show status' or run unit tests Previous command output Chassis Module Component Version Description ------------------------ -------- ----------- --------- ------------- New command output Chassis Module Component Version Description ------------------------ -------- ----------- --------- ------------- Chassis1 N/A BIOS 1.2.3 Chassis BIOS BMC 5.1 Chassis BMC Signed-off-by: Taras Keryk * [BFN] Implementation API for platform component SONiC has a concept of "platform components" this may include - CPLD, FPGA, BIOS, BMC, etc. These changes are needed to read the version of the BIOS and BMC component. What I did Create components.py module Add funcion for reading componet version to thrift interface How I did it The previous implementaion didn't have platform components API, so fwutil return an empty list. After implementation of the platform component API, we have actual list of platform components and firmware versions How to verify it Run manually 'fwutil show status' or run unit tests Previous command output Chassis Module Component Version Description ------------------------ -------- ----------- --------- ------------- New command output Chassis Module Component Version Description ------------------------ -------- ----------- --------- ------------- Chassis1 N/A BIOS 1.2.3 Chassis BIOS BMC 5.1 Chassis BMC Signed-off-by: Taras Keryk * [BFN] Implementation API for platform component get chassis name from json * [BFN] Implementation API for platform component Updated platform and platrom_components json * [BFN] Implementation API for platform component Fixed spaces in component.py * [BFN] Implementation API for platform component Fixed exception in component.py * Update chassis.py * [BFN] Implementation API for platform component Fixed spaces in component.py, chassis.py * [BFN] Implementation API for platform component: Fixed spaces in component.py, chassis.py * Fixed exception in get_bios_version --- .../x86_64-accton_as9516_32d-r0/platform.json | 8 + .../platform_components.json | 16 +- .../platform.json | 8 + .../platform_components.json | 16 +- .../sonic_platform/chassis.py | 8 + .../sonic_platform/component.py | 314 ++++++ .../pltfm_mgr_rpc/pltfm_mgr_rpc.py | 910 +++++++++++++++--- .../sonic_platform/pltfm_mgr_rpc/ttypes.py | 83 +- 8 files changed, 1172 insertions(+), 191 deletions(-) create mode 100644 platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json b/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json index b92b929fb997..115dd194b725 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json @@ -1,6 +1,14 @@ { "chassis": { "name": "Newport", + "components": [ + { + "name": "BIOS" + }, + { + "name": "BMC" + } + ], "fans": [ { "name": "counter-rotating-fan-1" diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/platform_components.json b/device/barefoot/x86_64-accton_as9516_32d-r0/platform_components.json index 43874566a3ad..118079de4696 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/platform_components.json +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/platform_components.json @@ -1,8 +1,10 @@ -{ - "chassis": { - "Newport": { - "component": { - } - } - } +{ + "chassis": { + "Newport": { + "component": { + "BIOS": { }, + "BMC": { } + } + } + } } \ No newline at end of file diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json index 769386a14ce0..ea18a031344e 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json @@ -1,6 +1,14 @@ { "chassis": { "name": "Wedge100BF-32X-O-AC-F-BF", + "components": [ + { + "name": "BIOS" + }, + { + "name": "BMC" + } + ], "fans": [ { "name": "counter-rotating-fan-1" diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_components.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_components.json index df77fa3e1bf9..30befc827a9e 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_components.json +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_components.json @@ -1,8 +1,10 @@ -{ - "chassis": { - "Wedge100BF-32X-O-AC-F-BF": { - "component": { - } - } - } +{ + "chassis": { + "Wedge100BF-32X-O-AC-F-BF": { + "component": { + "BIOS": { }, + "BMC": { } + } + } + } } \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py index fac75ae518a9..64536abbb532 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py @@ -19,6 +19,7 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") +NUM_COMPONENT = 2 class Chassis(ChassisBase): """ Platform-specific Chassis class @@ -44,6 +45,7 @@ def __init__(self): self.ready = False self.phy_port_cur_state = {} self.qsfp_interval = self.QSFP_CHECK_INTERVAL + self.__initialize_components() @property def _eeprom(self): @@ -128,6 +130,12 @@ def qsfp_max_port_get(client): self.PORT_END = self.QSFP_PORT_END self.PORTS_IN_BLOCK = self.QSFP_PORT_END + def __initialize_components(self): + from sonic_platform.component import Components + for index in range(0, NUM_COMPONENT): + component = Components(index) + self._component_list.append(component) + def get_name(self): """ Retrieves the name of the chassis diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py new file mode 100644 index 000000000000..5e72bb63e343 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py @@ -0,0 +1,314 @@ +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from platform_thrift_client import thrift_try + import json + from collections import OrderedDict + from sonic_py_common import device_info + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +def get_bios_version(): + """ + Retrieves the firmware version of the BIOS + Returns: + A string containing the firmware version of the BIOS + """ + try: + return subprocess.check_output(['dmidecode', '-s', 'bios-version']).strip().decode() + except subprocess.CalledProcessError as e: + raise RuntimeError("Failed to getget BIOS version") + +def get_bmc_version(): + """ + Retrieves the firmware version of the BMC + Returns: + A string containing the firmware version of the BMC + """ + ver = "N/A" + def bmc_get(client): + return client.pltfm_mgr.pltfm_mgr_chss_mgmt_bmc_ver_get() + try: + ver = thrift_try(bmc_get) + except Exception: + pass + + return ver + +class BFPlatformComponentsParser(object): + """ + BFPlatformComponentsParser + """ + CHASSIS_KEY = "chassis" + MODULE_KEY = "module" + COMPONENT_KEY = "component" + FIRMWARE_KEY = "firmware" + + def __init__(self, platform_components_path): + self.__chassis_component_map = OrderedDict() + self.__component_list = [] + self.__bf_model = "" + self.__parse_platform_components(platform_components_path) + + def __is_str(self, obj): + return isinstance(obj, str) + + def __is_dict(self, obj): + return isinstance(obj, dict) + + def __parser_fail(self, msg): + raise RuntimeError("Failed to parse \"{}\": {}".format(PLATFORM_COMPONENTS_FILE, msg)) + + def __parser_platform_fail(self, msg): + self.__parser_fail("invalid platform schema: {}".format(msg)) + + def __parser_chassis_fail(self, msg): + self.__parser_fail("invalid chassis schema: {}".format(msg)) + + def __parser_component_fail(self, msg): + self.__parser_fail("invalid component schema: {}".format(msg)) + + def __parse_component_section(self, section, component, is_module_component=False): + if not self.__is_dict(component): + self.__parser_component_fail("dictionary is expected: key={}".format(self.COMPONENT_KEY)) + + if not component: + return + + missing_key = None + + for key1, value1 in component.items(): + if not self.__is_dict(value1): + self.__parser_component_fail("dictionary is expected: key={}".format(key1)) + + self.__chassis_component_map[section][key1] = OrderedDict() + + if value1: + if len(value1) < 1 or len(value1) > 3: + self.__parser_component_fail("unexpected number of records: key={}".format(key1)) + + if self.FIRMWARE_KEY not in value1: + missing_key = self.FIRMWARE_KEY + break + + for key2, value2 in value1.items(): + if not self.__is_str(value2): + self.__parser_component_fail("string is expected: key={}".format(key2)) + + self.__chassis_component_map[section][key1] = value1 + + if missing_key is not None: + self.__parser_component_fail("\"{}\" key hasn't been found".format(missing_key)) + + def __parse_chassis_section(self, chassis): + self.__chassis_component_map = OrderedDict() + + if not self.__is_dict(chassis): + self.__parser_chassis_fail("dictionary is expected: key={}".format(self.CHASSIS_KEY)) + + if not chassis: + self.__parser_chassis_fail("dictionary is empty: key={}".format(self.CHASSIS_KEY)) + + if len(chassis) != 1: + self.__parser_chassis_fail("unexpected number of records: key={}".format(self.CHASSIS_KEY)) + + for key, value in chassis.items(): + if not self.__is_dict(value): + self.__parser_chassis_fail("dictionary is expected: key={}".format(key)) + + if not value: + self.__parser_chassis_fail("dictionary is empty: key={}".format(key)) + + if self.COMPONENT_KEY not in value: + self.__parser_chassis_fail("\"{}\" key hasn't been found".format(self.COMPONENT_KEY)) + + if len(value) != 1: + self.__parser_chassis_fail("unexpected number of records: key={}".format(key)) + + self.__chassis_component_map[key] = OrderedDict() + self.__parse_component_section(key, value[self.COMPONENT_KEY]) + + def get_components_list(self): + self.__component_list = [] + for key, value in self.__chassis_component_map[self.__bf_model].items(): + self.__component_list.append(key) + + return self.__component_list + + def get_chassis_component_map(self): + return self.__chassis_component_map + + def __parse_platform_components(self, platform_components_path): + with open(platform_components_path) as platform_components: + data = json.load(platform_components) + kkey, val = list(data[self.CHASSIS_KEY].items())[0] + self.__bf_model = kkey + + if not self.__is_dict(data): + self.__parser_platform_fail("dictionary is expected: key=root") + + if not data: + self.__parser_platform_fail("dictionary is empty: key=root") + + if self.CHASSIS_KEY not in data: + self.__parser_platform_fail("\"{}\" key hasn't been found".format(self.CHASSIS_KEY)) + + if len(data) != 1: + self.__parser_platform_fail("unexpected number of records: key=root") + + self.__parse_chassis_section(data[self.CHASSIS_KEY]) + + chassis_component_map = property(fget=get_chassis_component_map) + +class Components(ComponentBase): + """BFN Montara Platform-specific Component class""" + bf_platform = device_info.get_path_to_platform_dir() + bf_platform_json = "{}/platform_components.json".format(bf_platform.strip()) + bpcp = BFPlatformComponentsParser(bf_platform_json) + + def __init__(self, component_index=0): + try: + self.index = component_index + self.name = "N/A" + self.version = "N/A" + self.description = "N/A" + self.name = self.bpcp.get_components_list()[self.index] + except IndexError as e: + print("Error: No components found in plaform_components.json") + + if (self.name == "BMC"): + self.version = get_bmc_version() + self.description = "Chassis BMC" + elif (self.name == "BIOS"): + self.version = get_bios_version() + self.description = "Chassis BIOS" + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + if not self.name: + return "N/A" + return self.name + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + Returns: + A string containing the firmware version of the component + """ + return self.version + + def install_firmware(self, image_path): + """ + Installs firmware to the component + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install was successful, False if not + """ + return False + + def get_presence(self): + """ + Retrieves the presence of the component + Returns: + bool: True if component is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the component + Returns: + string: Model/part number of component + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the component + Returns: + string: Serial number of component + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the component + Returns: + A boolean value, True if component is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this component is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def get_available_firmware_version(self, image_path): + return 'None' + + def get_firmware_update_notification(self, image_path): + """ + Retrieves a notification on what should be done in order to complete + the component firmware update + + Args: + image_path: A string, path to firmware image + + Returns: + A string containing the component firmware update notification if required. + By default 'None' value will be used, which indicates that no actions are required + """ + return 'None' + + def update_firmware(self, image_path): + """ + Updates firmware of the component + + This API performs firmware update: it assumes firmware installation and loading in a single call. + In case platform component requires some extra steps (apart from calling Low Level Utility) + to load the installed firmware (e.g, reboot, power cycle, etc.) - this will be done automatically by API + + Args: + image_path: A string, path to firmware image + + Raises: + RuntimeError: update failed + """ + return False + + def auto_update_firmware(self, image_path, boot_action): + """ + Default handling of attempted automatic update for a component + Will skip the installation if the boot_action is 'warm' or 'fast' and will call update_firmware() + if boot_action is fast. + """ + return 1 diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py index 419ac57ebb22..25ab556b3758 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.13.0) +# Autogenerated by Thrift Compiler (0.14.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -74,6 +74,26 @@ def pltfm_mgr_fan_info_get(self, fan_num): """ pass + def pltfm_mgr_qsfp_cached_num_bytes_get(self, port_num, page, offset, length): + """ + Parameters: + - port_num + - page + - offset + - length + + """ + pass + + def pltfm_mgr_qsfp_cached_page_get(self, port_num, page): + """ + Parameters: + - port_num + - page + + """ + pass + def pltfm_mgr_qsfp_presence_get(self, port_num): """ Parameters: @@ -284,6 +304,9 @@ def pltfm_mgr_sensor_info_get(self, options): """ pass + def pltfm_mgr_chss_mgmt_bmc_get(self): + pass + class Client(Iface): def __init__(self, iprot, oprot=None): @@ -552,6 +575,82 @@ def recv_pltfm_mgr_fan_info_get(self): raise result.ouch raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_fan_info_get failed: unknown result") + def pltfm_mgr_qsfp_cached_num_bytes_get(self, port_num, page, offset, length): + """ + Parameters: + - port_num + - page + - offset + - length + + """ + self.send_pltfm_mgr_qsfp_cached_num_bytes_get(port_num, page, offset, length) + return self.recv_pltfm_mgr_qsfp_cached_num_bytes_get() + + def send_pltfm_mgr_qsfp_cached_num_bytes_get(self, port_num, page, offset, length): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_cached_num_bytes_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_cached_num_bytes_get_args() + args.port_num = port_num + args.page = page + args.offset = offset + args.length = length + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_cached_num_bytes_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_cached_num_bytes_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_cached_num_bytes_get failed: unknown result") + + def pltfm_mgr_qsfp_cached_page_get(self, port_num, page): + """ + Parameters: + - port_num + - page + + """ + self.send_pltfm_mgr_qsfp_cached_page_get(port_num, page) + return self.recv_pltfm_mgr_qsfp_cached_page_get() + + def send_pltfm_mgr_qsfp_cached_page_get(self, port_num, page): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_cached_page_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_cached_page_get_args() + args.port_num = port_num + args.page = page + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_cached_page_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_cached_page_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_cached_page_get failed: unknown result") + def pltfm_mgr_qsfp_presence_get(self, port_num): """ Parameters: @@ -1444,6 +1543,34 @@ def recv_pltfm_mgr_sensor_info_get(self): raise result.ouch raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_sensor_info_get failed: unknown result") + def pltfm_mgr_chss_mgmt_bmc_get(self): + self.send_pltfm_mgr_chss_mgmt_bmc_get() + return self.recv_pltfm_mgr_chss_mgmt_bmc_get() + + def send_pltfm_mgr_chss_mgmt_bmc_get(self): + self._oprot.writeMessageBegin('pltfm_mgr_chss_mgmt_bmc_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_chss_mgmt_bmc_get_args() + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_chss_mgmt_bmc_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_chss_mgmt_bmc_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_chss_mgmt_bmc_get failed: unknown result") + class Processor(Iface, TProcessor): def __init__(self, handler): @@ -1457,6 +1584,8 @@ def __init__(self, handler): self._processMap["pltfm_mgr_pwr_rail_info_get"] = Processor.process_pltfm_mgr_pwr_rail_info_get self._processMap["pltfm_mgr_fan_speed_set"] = Processor.process_pltfm_mgr_fan_speed_set self._processMap["pltfm_mgr_fan_info_get"] = Processor.process_pltfm_mgr_fan_info_get + self._processMap["pltfm_mgr_qsfp_cached_num_bytes_get"] = Processor.process_pltfm_mgr_qsfp_cached_num_bytes_get + self._processMap["pltfm_mgr_qsfp_cached_page_get"] = Processor.process_pltfm_mgr_qsfp_cached_page_get self._processMap["pltfm_mgr_qsfp_presence_get"] = Processor.process_pltfm_mgr_qsfp_presence_get self._processMap["pltfm_mgr_qsfp_detect_transceiver"] = Processor.process_pltfm_mgr_qsfp_detect_transceiver self._processMap["pltfm_mgr_qsfp_info_get"] = Processor.process_pltfm_mgr_qsfp_info_get @@ -1483,6 +1612,7 @@ def __init__(self, handler): self._processMap["pltfm_mgr_qsfp_pwr_override_set"] = Processor.process_pltfm_mgr_qsfp_pwr_override_set self._processMap["pltfm_mgr_qsfp_lpmode_set"] = Processor.process_pltfm_mgr_qsfp_lpmode_set self._processMap["pltfm_mgr_sensor_info_get"] = Processor.process_pltfm_mgr_sensor_info_get + self._processMap["pltfm_mgr_chss_mgmt_bmc_get"] = Processor.process_pltfm_mgr_chss_mgmt_bmc_get self._on_message_begin = None def on_message_begin(self, func): @@ -1710,6 +1840,58 @@ def process_pltfm_mgr_fan_info_get(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_pltfm_mgr_qsfp_cached_num_bytes_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_cached_num_bytes_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_cached_num_bytes_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_cached_num_bytes_get(args.port_num, args.page, args.offset, args.length) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_cached_num_bytes_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_cached_page_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_cached_page_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_cached_page_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_cached_page_get(args.port_num, args.page) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_cached_page_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_pltfm_mgr_qsfp_presence_get(self, seqid, iprot, oprot): args = pltfm_mgr_qsfp_presence_get_args() args.read(iprot) @@ -2386,6 +2568,32 @@ def process_pltfm_mgr_sensor_info_get(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_pltfm_mgr_chss_mgmt_bmc_get(self, seqid, iprot, oprot): + args = pltfm_mgr_chss_mgmt_bmc_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_chss_mgmt_bmc_get_result() + try: + result.success = self._handler.pltfm_mgr_chss_mgmt_bmc_get() + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_chss_mgmt_bmc_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + # HELPER FUNCTIONS AND STRUCTURES @@ -2585,8 +2793,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2703,8 +2910,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2839,8 +3045,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2942,11 +3147,295 @@ def __ne__(self, other): all_structs.append(pltfm_mgr_pwr_supply_info_get_args) pltfm_mgr_pwr_supply_info_get_args.thrift_spec = ( None, # 0 - (1, TType.I16, 'ps_num', None, None, ), # 1 + (1, TType.I16, 'ps_num', None, None, ), # 1 +) + + +class pltfm_mgr_pwr_supply_info_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = pltfm_mgr_pwr_supply_info_t() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_supply_info_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_supply_info_get_result) +pltfm_mgr_pwr_supply_info_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_pwr_supply_info_t, None], None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_pwr_rail_info_get_args(object): + """ + Attributes: + - ps_num + + """ + + + def __init__(self, ps_num=None,): + self.ps_num = ps_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I16: + self.ps_num = iprot.readI16() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_get_args') + if self.ps_num is not None: + oprot.writeFieldBegin('ps_num', TType.I16, 1) + oprot.writeI16(self.ps_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_rail_info_get_args) +pltfm_mgr_pwr_rail_info_get_args.thrift_spec = ( + None, # 0 + (1, TType.I16, 'ps_num', None, None, ), # 1 +) + + +class pltfm_mgr_pwr_rail_info_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = pltfm_mgr_pwr_rail_info_t() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_rail_info_get_result) +pltfm_mgr_pwr_rail_info_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_pwr_rail_info_t, None], None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_fan_speed_set_args(object): + """ + Attributes: + - fan_num + - percent + + """ + + + def __init__(self, fan_num=None, percent=None,): + self.fan_num = fan_num + self.percent = percent + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.fan_num = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.percent = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_fan_speed_set_args') + if self.fan_num is not None: + oprot.writeFieldBegin('fan_num', TType.I32, 1) + oprot.writeI32(self.fan_num) + oprot.writeFieldEnd() + if self.percent is not None: + oprot.writeFieldBegin('percent', TType.I32, 2) + oprot.writeI32(self.percent) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_fan_speed_set_args) +pltfm_mgr_fan_speed_set_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'fan_num', None, None, ), # 1 + (2, TType.I32, 'percent', None, None, ), # 2 ) -class pltfm_mgr_pwr_supply_info_get_result(object): +class pltfm_mgr_fan_speed_set_result(object): """ Attributes: - success @@ -2969,15 +3458,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRUCT: - self.success = pltfm_mgr_pwr_supply_info_t() - self.success.read(iprot) + if ftype == TType.I32: + self.success = iprot.readI32() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2989,10 +3476,10 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_supply_info_get_result') + oprot.writeStructBegin('pltfm_mgr_fan_speed_set_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -3014,23 +3501,23 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_pwr_supply_info_get_result) -pltfm_mgr_pwr_supply_info_get_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [pltfm_mgr_pwr_supply_info_t, None], None, ), # 0 +all_structs.append(pltfm_mgr_fan_speed_set_result) +pltfm_mgr_fan_speed_set_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 ) -class pltfm_mgr_pwr_rail_info_get_args(object): +class pltfm_mgr_fan_info_get_args(object): """ Attributes: - - ps_num + - fan_num """ - def __init__(self, ps_num=None,): - self.ps_num = ps_num + def __init__(self, fan_num=None,): + self.fan_num = fan_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -3042,8 +3529,8 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 1: - if ftype == TType.I16: - self.ps_num = iprot.readI16() + if ftype == TType.I32: + self.fan_num = iprot.readI32() else: iprot.skip(ftype) else: @@ -3055,10 +3542,10 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_get_args') - if self.ps_num is not None: - oprot.writeFieldBegin('ps_num', TType.I16, 1) - oprot.writeI16(self.ps_num) + oprot.writeStructBegin('pltfm_mgr_fan_info_get_args') + if self.fan_num is not None: + oprot.writeFieldBegin('fan_num', TType.I32, 1) + oprot.writeI32(self.fan_num) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -3076,14 +3563,14 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_pwr_rail_info_get_args) -pltfm_mgr_pwr_rail_info_get_args.thrift_spec = ( +all_structs.append(pltfm_mgr_fan_info_get_args) +pltfm_mgr_fan_info_get_args.thrift_spec = ( None, # 0 - (1, TType.I16, 'ps_num', None, None, ), # 1 + (1, TType.I32, 'fan_num', None, None, ), # 1 ) -class pltfm_mgr_pwr_rail_info_get_result(object): +class pltfm_mgr_fan_info_get_result(object): """ Attributes: - success @@ -3107,14 +3594,13 @@ def read(self, iprot): break if fid == 0: if ftype == TType.STRUCT: - self.success = pltfm_mgr_pwr_rail_info_t() + self.success = pltfm_mgr_fan_info_t() self.success.read(iprot) else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -3126,7 +3612,7 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_get_result') + oprot.writeStructBegin('pltfm_mgr_fan_info_get_result') if self.success is not None: oprot.writeFieldBegin('success', TType.STRUCT, 0) self.success.write(oprot) @@ -3151,25 +3637,29 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_pwr_rail_info_get_result) -pltfm_mgr_pwr_rail_info_get_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [pltfm_mgr_pwr_rail_info_t, None], None, ), # 0 +all_structs.append(pltfm_mgr_fan_info_get_result) +pltfm_mgr_fan_info_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_fan_info_t, None], None, ), # 0 (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 ) -class pltfm_mgr_fan_speed_set_args(object): +class pltfm_mgr_qsfp_cached_num_bytes_get_args(object): """ Attributes: - - fan_num - - percent + - port_num + - page + - offset + - length """ - def __init__(self, fan_num=None, percent=None,): - self.fan_num = fan_num - self.percent = percent + def __init__(self, port_num=None, page=None, offset=None, length=None,): + self.port_num = port_num + self.page = page + self.offset = offset + self.length = length def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -3182,12 +3672,22 @@ def read(self, iprot): break if fid == 1: if ftype == TType.I32: - self.fan_num = iprot.readI32() + self.port_num = iprot.readI32() else: iprot.skip(ftype) elif fid == 2: if ftype == TType.I32: - self.percent = iprot.readI32() + self.page = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.offset = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.length = iprot.readI32() else: iprot.skip(ftype) else: @@ -3199,14 +3699,22 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_fan_speed_set_args') - if self.fan_num is not None: - oprot.writeFieldBegin('fan_num', TType.I32, 1) - oprot.writeI32(self.fan_num) + oprot.writeStructBegin('pltfm_mgr_qsfp_cached_num_bytes_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) oprot.writeFieldEnd() - if self.percent is not None: - oprot.writeFieldBegin('percent', TType.I32, 2) - oprot.writeI32(self.percent) + if self.page is not None: + oprot.writeFieldBegin('page', TType.I32, 2) + oprot.writeI32(self.page) + oprot.writeFieldEnd() + if self.offset is not None: + oprot.writeFieldBegin('offset', TType.I32, 3) + oprot.writeI32(self.offset) + oprot.writeFieldEnd() + if self.length is not None: + oprot.writeFieldBegin('length', TType.I32, 4) + oprot.writeI32(self.length) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -3224,15 +3732,17 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_fan_speed_set_args) -pltfm_mgr_fan_speed_set_args.thrift_spec = ( +all_structs.append(pltfm_mgr_qsfp_cached_num_bytes_get_args) +pltfm_mgr_qsfp_cached_num_bytes_get_args.thrift_spec = ( None, # 0 - (1, TType.I32, 'fan_num', None, None, ), # 1 - (2, TType.I32, 'percent', None, None, ), # 2 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.I32, 'page', None, None, ), # 2 + (3, TType.I32, 'offset', None, None, ), # 3 + (4, TType.I32, 'length', None, None, ), # 4 ) -class pltfm_mgr_fan_speed_set_result(object): +class pltfm_mgr_qsfp_cached_num_bytes_get_result(object): """ Attributes: - success @@ -3255,14 +3765,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.I32: - self.success = iprot.readI32() + if ftype == TType.STRING: + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -3274,10 +3783,10 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_fan_speed_set_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_cached_num_bytes_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -3299,23 +3808,25 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_fan_speed_set_result) -pltfm_mgr_fan_speed_set_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 +all_structs.append(pltfm_mgr_qsfp_cached_num_bytes_get_result) +pltfm_mgr_qsfp_cached_num_bytes_get_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 ) -class pltfm_mgr_fan_info_get_args(object): +class pltfm_mgr_qsfp_cached_page_get_args(object): """ Attributes: - - fan_num + - port_num + - page """ - def __init__(self, fan_num=None,): - self.fan_num = fan_num + def __init__(self, port_num=None, page=None,): + self.port_num = port_num + self.page = page def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -3328,7 +3839,12 @@ def read(self, iprot): break if fid == 1: if ftype == TType.I32: - self.fan_num = iprot.readI32() + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.page = iprot.readI32() else: iprot.skip(ftype) else: @@ -3340,10 +3856,14 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_fan_info_get_args') - if self.fan_num is not None: - oprot.writeFieldBegin('fan_num', TType.I32, 1) - oprot.writeI32(self.fan_num) + oprot.writeStructBegin('pltfm_mgr_qsfp_cached_page_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + if self.page is not None: + oprot.writeFieldBegin('page', TType.I32, 2) + oprot.writeI32(self.page) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -3361,14 +3881,15 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_fan_info_get_args) -pltfm_mgr_fan_info_get_args.thrift_spec = ( +all_structs.append(pltfm_mgr_qsfp_cached_page_get_args) +pltfm_mgr_qsfp_cached_page_get_args.thrift_spec = ( None, # 0 - (1, TType.I32, 'fan_num', None, None, ), # 1 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.I32, 'page', None, None, ), # 2 ) -class pltfm_mgr_fan_info_get_result(object): +class pltfm_mgr_qsfp_cached_page_get_result(object): """ Attributes: - success @@ -3391,15 +3912,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRUCT: - self.success = pltfm_mgr_fan_info_t() - self.success.read(iprot) + if ftype == TType.STRING: + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -3411,10 +3930,10 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_fan_info_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_cached_page_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -3436,9 +3955,9 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_fan_info_get_result) -pltfm_mgr_fan_info_get_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [pltfm_mgr_fan_info_t, None], None, ), # 0 +all_structs.append(pltfm_mgr_qsfp_cached_page_get_result) +pltfm_mgr_qsfp_cached_page_get_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 ) @@ -3534,8 +4053,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -3670,8 +4188,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -3801,13 +4318,12 @@ def read(self, iprot): break if fid == 0: if ftype == TType.STRING: - self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -3923,8 +4439,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -4071,8 +4586,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -4207,8 +4721,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -4367,8 +4880,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -4503,8 +5015,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -4644,8 +5155,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -4788,8 +5298,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -4932,8 +5441,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -5077,8 +5585,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -5222,8 +5729,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -5367,8 +5873,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -5511,8 +6016,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -5655,8 +6159,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -5799,8 +6302,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -5938,8 +6440,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -6074,8 +6575,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -6211,8 +6711,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -6359,8 +6858,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -6495,8 +6993,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -6631,8 +7128,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -6791,8 +7287,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -6939,8 +7434,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -7006,7 +7500,7 @@ def read(self, iprot): break if fid == 1: if ftype == TType.STRING: - self.options = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.options = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) else: @@ -7070,13 +7564,12 @@ def read(self, iprot): break if fid == 0: if ftype == TType.STRING: - self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -7118,6 +7611,121 @@ def __ne__(self, other): (0, TType.STRING, 'success', 'UTF8', None, ), # 0 (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 ) + + +class pltfm_mgr_chss_mgmt_bmc_get_args(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_chss_mgmt_bmc_get_args') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_chss_mgmt_bmc_get_args) +pltfm_mgr_chss_mgmt_bmc_get_args.thrift_spec = ( +) + + +class pltfm_mgr_chss_mgmt_bmc_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_chss_mgmt_bmc_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_chss_mgmt_bmc_get_result) +pltfm_mgr_chss_mgmt_bmc_get_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) fix_spec(all_structs) del all_structs - diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/ttypes.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/ttypes.py index da4a62d4eeff..501596941664 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/ttypes.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.13.0) +# Autogenerated by Thrift Compiler (0.14.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -16,6 +16,24 @@ all_structs = [] +class qsfp_eeprom_page_t(object): + PAGE0_LOWER = 0 + PAGE0_UPPER = 1 + PAGE3 = 2 + + _VALUES_TO_NAMES = { + 0: "PAGE0_LOWER", + 1: "PAGE0_UPPER", + 2: "PAGE3", + } + + _NAMES_TO_VALUES = { + "PAGE0_LOWER": 0, + "PAGE0_UPPER": 1, + "PAGE3": 2, + } + + class pltfm_mgr_sys_tmp_t(object): """ Attributes: @@ -241,37 +259,37 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 2: if ftype == TType.STRING: - self.prod_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.prod_name = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 3: if ftype == TType.STRING: - self.prod_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.prod_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 4: if ftype == TType.STRING: - self.sys_asm_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.sys_asm_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 5: if ftype == TType.STRING: - self.bfn_pcba_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.bfn_pcba_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 6: if ftype == TType.STRING: - self.bfn_pcbb_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.bfn_pcbb_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 7: if ftype == TType.STRING: - self.odm_pcba_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.odm_pcba_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 8: if ftype == TType.STRING: - self.odm_pcba_ser_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.odm_pcba_ser_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 9: @@ -291,42 +309,42 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 12: if ftype == TType.STRING: - self.prod_ser_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.prod_ser_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 13: if ftype == TType.STRING: - self.prod_ast_tag = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.prod_ast_tag = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 14: if ftype == TType.STRING: - self.sys_mfger = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.sys_mfger = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 15: if ftype == TType.STRING: - self.sys_mfg_date = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.sys_mfg_date = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 16: if ftype == TType.STRING: - self.pcb_mfger = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.pcb_mfger = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 17: if ftype == TType.STRING: - self.assembled_at = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.assembled_at = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 18: if ftype == TType.STRING: - self.loc_mac_addr = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.loc_mac_addr = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 19: if ftype == TType.STRING: - self.ext_mac_addr = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.ext_mac_addr = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 20: @@ -336,7 +354,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 21: if ftype == TType.STRING: - self.location = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.location = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 22: @@ -535,17 +553,17 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 8: if ftype == TType.STRING: - self.model = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.model = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 9: if ftype == TType.STRING: - self.serial = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.serial = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 10: if ftype == TType.STRING: - self.rev = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.rev = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) else: @@ -1278,26 +1296,39 @@ class InvalidPltfmMgrOperation(TException): def __init__(self, code=None,): - self.code = code + super(InvalidPltfmMgrOperation, self).__setattr__('code', code) - def read(self, iprot): - if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) - return + def __setattr__(self, *args): + raise TypeError("can't modify immutable instance") + + def __delattr__(self, *args): + raise TypeError("can't modify immutable instance") + + def __hash__(self): + return hash(self.__class__) ^ hash((self.code, )) + + @classmethod + def read(cls, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and cls.thrift_spec is not None: + return iprot._fast_decode(None, iprot, [cls, cls.thrift_spec]) iprot.readStructBegin() + code = None while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 1: if ftype == TType.I32: - self.code = iprot.readI32() + code = iprot.readI32() else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() + return cls( + code=code, + ) def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: From 861ea26d1887354033f4568059e1f3f79c4b62e3 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Thu, 10 Mar 2022 14:42:43 -0800 Subject: [PATCH 15/54] [yang]: Update DEVICE_METADATA yang models to support 'sub_role' (#10161) #### Why I did it Fix https://github.com/Azure/sonic-buildimage/issues/9591 #### How I did it Add 'sub_role' to device_metadata yang models. #### How to verify it Run UT for sonc-yang-models. --- src/sonic-yang-models/tests/files/sample_config_db.json | 3 ++- .../tests/yang_model_tests/tests/device_metadata.json | 5 ++++- .../yang_model_tests/tests_config/device_metadata.json | 9 +++++++++ .../yang-models/sonic-device_metadata.yang | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 6dbffce671e9..920181646c46 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -302,7 +302,8 @@ "asic_name": "Asic0", "switch_id": "2", "switch_type": "voq", - "max_cores": "8" + "max_cores": "8", + "sub_role": "FrondEnd" } }, "VLAN": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index ca26e24cd329..ecfff6f69a6f 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -100,6 +100,9 @@ }, "DEVICE_METADATA_CORRECT_VOQ_CONFIG": { "desc": "Verifying VOQ configuration." - } + }, + "DEVICE_METADATA_VALID_SUB_ROLE_CONFIG": { + "desc": "Verifying valid sub_role configuration." + } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index bfc9c080b758..de0d4e15dcee 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -274,5 +274,14 @@ } } } + }, + "DEVICE_METADATA_VALID_SUB_ROLE_CONFIG": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "sub_role": "FrontEnd" + } + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 0dc88f436d8f..87170850d895 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -127,6 +127,11 @@ module sonic-device_metadata { type string; } + leaf sub_role { + type string; + description "sub_role indicates if ASIC is FrondEnd or BackEnd."; + } + leaf downstream_subrole { type string; } From 560c0d989ad8426903eb1b4b665e718649629692 Mon Sep 17 00:00:00 2001 From: pavannaregundi <92989231+pavannaregundi@users.noreply.github.com> Date: Fri, 11 Mar 2022 04:53:21 +0530 Subject: [PATCH 16/54] Adding libubootenv-tool into bullseye image (#10146) Why I did it uboot env get and set commands fw_printenv/fw_setenv are not available in bullseye sonic image. Some platforms using them where failing. Ex: sonic-installer commands in marvell-armhf. In case of buster, u-boot-tools was providing these commands. How I did it Added libubootenv-tool which provides these tools along with other uboot tools in build_debian.sh. How to verify it root@localhost:# fw_printenv serverip serverip=10.4.50.39 root@localhost:# fw_setenv serverip 10.4.50.38 root@localhost:~# fw_printenv serverip serverip=10.4.50.38 Change-Id: I558f8737f41d83d3e8527ce340391ae8f978b6d8 Signed-off-by: Pavan Naregundi --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 73984cb6cc51..fb0d45263d64 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -190,7 +190,7 @@ if [ -f platform/$CONFIGURED_PLATFORM/modules ]; then fi ## Add mtd and uboot firmware tools package -sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install u-boot-tools mtd-utils device-tree-compiler +sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install u-boot-tools libubootenv-tool mtd-utils device-tree-compiler ## Install docker echo '[INFO] Install docker' From f34b5e601d8e5cfa8af70718edf04374f25abf13 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Fri, 11 Mar 2022 09:21:35 +0800 Subject: [PATCH 17/54] [Submodule]: Update submodule for sonic-telemetry (#10124) e56e9b4 Fix CVE-2021-3121 warning (#96) bf1be4f [ci]: Support code diff coverage threshold 50% (#94) 64e516c Ported Marvell armhf build on x86 for debian buster to use cross-compilation instead of qemu emulation (#80) e426388 [ci]: Support azp code coverage (#87) --- src/sonic-telemetry | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-telemetry b/src/sonic-telemetry index 0443e6605025..e56e9b44e4a7 160000 --- a/src/sonic-telemetry +++ b/src/sonic-telemetry @@ -1 +1 @@ -Subproject commit 0443e66050256a87f8e92db7cd3c36cc139ebe14 +Subproject commit e56e9b44e4a7e3b211f070c298041951c543885b From 9cdf81230b3819c45a5680ea0970474869da3569 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Fri, 11 Mar 2022 09:23:37 +0800 Subject: [PATCH 18/54] [Build]: Fix /proc not mounted issue (#10164) [Build]: Fix /proc not mounted issue --- build_debian.sh | 3 +++ files/build_templates/sonic_debian_extension.j2 | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index fb0d45263d64..41741d6c5f8a 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -67,6 +67,9 @@ mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime +## ensure proc is mounted +sudo mount proc /proc -t proc || true + ## make / as a mountpoint in chroot env, needed by dockerd pushd $FILESYSTEM_ROOT sudo mount --bind . . diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0a2b5536232b..991b838a6d23 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -648,10 +648,7 @@ if [ $MULTIARCH_QEMU_ENVIRON == y ]; then fi {% if installer_images.strip() -%} -clean_proc() { - sudo umount /proc || true -} -trap_push clean_proc +## ensure proc is mounted sudo mount proc /proc -t proc || true sudo mkdir $FILESYSTEM_ROOT/target sudo mount --bind target $FILESYSTEM_ROOT/target @@ -732,7 +729,6 @@ if [ $MULTIARCH_QEMU_ENVIRON == y ]; then else sudo chroot $FILESYSTEM_ROOT $DOCKER_CTL_SCRIPT stop fi -sudo umount /proc || true sudo bash -c "echo { > $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_names.json" {% for entry in feature_vs_image_names.split(' ') -%} From 759172dc8b50180800082c125796c2d3aaa9a33a Mon Sep 17 00:00:00 2001 From: Taras Keryk Date: Fri, 11 Mar 2022 11:31:27 +0200 Subject: [PATCH 19/54] [BFN] Regenerated pltfm_mgr_rpc.py to the latest version (#10180) (#10208) Signed-off-by: Taras Keryk Why I did it The previous implementaion of API for platform component didn't have the new thrift files How I did it Add the new thrift-generated: pltfm_mgr_rpc.py, ttypes.py How to verify it Run manually 'fwutil show status' or run unit tests Previous command output had no information about components New command output Chassis Module Component Version Description ------------------------ -------- ----------- --------- ------------- Chassis1 N/A BIOS 1.2.3 Chassis BIOS BMC 5.1 Chassis BMC --- .../pltfm_mgr_rpc/pltfm_mgr_rpc.py | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py index 25ab556b3758..0fa03d58b31a 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py @@ -304,7 +304,7 @@ def pltfm_mgr_sensor_info_get(self, options): """ pass - def pltfm_mgr_chss_mgmt_bmc_get(self): + def pltfm_mgr_chss_mgmt_bmc_ver_get(self): pass @@ -1543,18 +1543,18 @@ def recv_pltfm_mgr_sensor_info_get(self): raise result.ouch raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_sensor_info_get failed: unknown result") - def pltfm_mgr_chss_mgmt_bmc_get(self): - self.send_pltfm_mgr_chss_mgmt_bmc_get() - return self.recv_pltfm_mgr_chss_mgmt_bmc_get() + def pltfm_mgr_chss_mgmt_bmc_ver_get(self): + self.send_pltfm_mgr_chss_mgmt_bmc_ver_get() + return self.recv_pltfm_mgr_chss_mgmt_bmc_ver_get() - def send_pltfm_mgr_chss_mgmt_bmc_get(self): - self._oprot.writeMessageBegin('pltfm_mgr_chss_mgmt_bmc_get', TMessageType.CALL, self._seqid) - args = pltfm_mgr_chss_mgmt_bmc_get_args() + def send_pltfm_mgr_chss_mgmt_bmc_ver_get(self): + self._oprot.writeMessageBegin('pltfm_mgr_chss_mgmt_bmc_ver_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_chss_mgmt_bmc_ver_get_args() args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_pltfm_mgr_chss_mgmt_bmc_get(self): + def recv_pltfm_mgr_chss_mgmt_bmc_ver_get(self): iprot = self._iprot (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: @@ -1562,14 +1562,14 @@ def recv_pltfm_mgr_chss_mgmt_bmc_get(self): x.read(iprot) iprot.readMessageEnd() raise x - result = pltfm_mgr_chss_mgmt_bmc_get_result() + result = pltfm_mgr_chss_mgmt_bmc_ver_get_result() result.read(iprot) iprot.readMessageEnd() if result.success is not None: return result.success if result.ouch is not None: raise result.ouch - raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_chss_mgmt_bmc_get failed: unknown result") + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_chss_mgmt_bmc_ver_get failed: unknown result") class Processor(Iface, TProcessor): @@ -1612,7 +1612,7 @@ def __init__(self, handler): self._processMap["pltfm_mgr_qsfp_pwr_override_set"] = Processor.process_pltfm_mgr_qsfp_pwr_override_set self._processMap["pltfm_mgr_qsfp_lpmode_set"] = Processor.process_pltfm_mgr_qsfp_lpmode_set self._processMap["pltfm_mgr_sensor_info_get"] = Processor.process_pltfm_mgr_sensor_info_get - self._processMap["pltfm_mgr_chss_mgmt_bmc_get"] = Processor.process_pltfm_mgr_chss_mgmt_bmc_get + self._processMap["pltfm_mgr_chss_mgmt_bmc_ver_get"] = Processor.process_pltfm_mgr_chss_mgmt_bmc_ver_get self._on_message_begin = None def on_message_begin(self, func): @@ -2568,13 +2568,13 @@ def process_pltfm_mgr_sensor_info_get(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() - def process_pltfm_mgr_chss_mgmt_bmc_get(self, seqid, iprot, oprot): - args = pltfm_mgr_chss_mgmt_bmc_get_args() + def process_pltfm_mgr_chss_mgmt_bmc_ver_get(self, seqid, iprot, oprot): + args = pltfm_mgr_chss_mgmt_bmc_ver_get_args() args.read(iprot) iprot.readMessageEnd() - result = pltfm_mgr_chss_mgmt_bmc_get_result() + result = pltfm_mgr_chss_mgmt_bmc_ver_get_result() try: - result.success = self._handler.pltfm_mgr_chss_mgmt_bmc_get() + result.success = self._handler.pltfm_mgr_chss_mgmt_bmc_ver_get() msg_type = TMessageType.REPLY except TTransport.TTransportException: raise @@ -2589,7 +2589,7 @@ def process_pltfm_mgr_chss_mgmt_bmc_get(self, seqid, iprot, oprot): logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_chss_mgmt_bmc_get", msg_type, seqid) + oprot.writeMessageBegin("pltfm_mgr_chss_mgmt_bmc_ver_get", msg_type, seqid) result.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() @@ -7613,7 +7613,7 @@ def __ne__(self, other): ) -class pltfm_mgr_chss_mgmt_bmc_get_args(object): +class pltfm_mgr_chss_mgmt_bmc_ver_get_args(object): def read(self, iprot): @@ -7634,7 +7634,7 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_chss_mgmt_bmc_get_args') + oprot.writeStructBegin('pltfm_mgr_chss_mgmt_bmc_ver_get_args') oprot.writeFieldStop() oprot.writeStructEnd() @@ -7651,12 +7651,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_chss_mgmt_bmc_get_args) -pltfm_mgr_chss_mgmt_bmc_get_args.thrift_spec = ( +all_structs.append(pltfm_mgr_chss_mgmt_bmc_ver_get_args) +pltfm_mgr_chss_mgmt_bmc_ver_get_args.thrift_spec = ( ) -class pltfm_mgr_chss_mgmt_bmc_get_result(object): +class pltfm_mgr_chss_mgmt_bmc_ver_get_result(object): """ Attributes: - success @@ -7697,7 +7697,7 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_chss_mgmt_bmc_get_result') + oprot.writeStructBegin('pltfm_mgr_chss_mgmt_bmc_ver_get_result') if self.success is not None: oprot.writeFieldBegin('success', TType.STRING, 0) oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) @@ -7722,8 +7722,8 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(pltfm_mgr_chss_mgmt_bmc_get_result) -pltfm_mgr_chss_mgmt_bmc_get_result.thrift_spec = ( +all_structs.append(pltfm_mgr_chss_mgmt_bmc_ver_get_result) +pltfm_mgr_chss_mgmt_bmc_ver_get_result.thrift_spec = ( (0, TType.STRING, 'success', 'UTF8', None, ), # 0 (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 ) From a29ba9cf22c4145bad119a2578cbb88eb8d31f37 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Fri, 11 Mar 2022 17:35:17 +0800 Subject: [PATCH 20/54] Correct thrift 0141 typo fix (#10199) Correct libsaithrift dependency package name from LIBTHRIFT_DEV_0_14_1 THRIFT_COMPILER_0_14_1 to LIBTHRIFT_0_14_1_DEV THRIFT_0_14_1_COMPILER How I did it How to verify it Test Done: make BLDENV=buster SAITHRIFT_V2=y -f Makefile.work target/debs/buster/saiserverv2_0.9.4_amd64.deb --- platform/broadcom/libsaithrift-dev.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/libsaithrift-dev.mk b/platform/broadcom/libsaithrift-dev.mk index 1e4d0da13bbe..c1bd9b90de13 100644 --- a/platform/broadcom/libsaithrift-dev.mk +++ b/platform/broadcom/libsaithrift-dev.mk @@ -6,7 +6,7 @@ LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_amd64.deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI #Support two different versions of thrift ifeq ($(SAITHRIFT_V2),y) -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_DEV_0_14_1) $(PYTHON3_THRIFT_0_14_1) $(THRIFT_COMPILER_0_14_1) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) $(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1) $(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SAITHRIFT_VER=v2 else From 8d419ca2c59b0f75c24ba4ed73fbdc7df7812260 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 11 Mar 2022 08:09:07 -0800 Subject: [PATCH 21/54] [Arista] Remove arista.log from rsyslog default logrotate (#9731) Why I did it In parallel of this change Arista added a custom logrotate configuration as part of its driver library. Having 2 logrotate configuration for the same log file triggers an issue. Fixes aristanetworks/sonic#38 How I did it Arista merged a few changes in sonic-buildimage which added a logrotate configuration aristanetworks/sonic@e43c797 It is therefore the right path to remove the arista.log line from the logrotate.d/rsyslog configuration. How to verify it Logrotate works without any error message, arista log rotation happens and arista daemons still append logs once file was truncated. --- files/image_config/logrotate/rsyslog.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/files/image_config/logrotate/rsyslog.j2 b/files/image_config/logrotate/rsyslog.j2 index 1a5c92c33828..28a7d9dd2ee0 100644 --- a/files/image_config/logrotate/rsyslog.j2 +++ b/files/image_config/logrotate/rsyslog.j2 @@ -24,7 +24,6 @@ } /var/log/auth.log -/var/log/arista.log /var/log/cron.log /var/log/syslog /var/log/teamd.log From 092b0b2ba10a791bd703794a6e7a813380c412d4 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Sat, 12 Mar 2022 19:07:10 +0800 Subject: [PATCH 22/54] [Build]: fix some version info missing in version control files issue (#10211) [Build]: fix some version info missing in version control files issue --- build_debian.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 41741d6c5f8a..6ffa2eb62fdc 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -562,6 +562,9 @@ if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then fi fi +# Collect host image version files before cleanup +scripts/collect_host_image_version_files.sh $TARGET_PATH $FILESYSTEM_ROOT + # Remove GCC sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc @@ -593,7 +596,6 @@ sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS ## Note: -x to skip directories on different file systems, such as /proc sudo du -hsx $FILESYSTEM_ROOT sudo mkdir -p $FILESYSTEM_ROOT/var/lib/docker -scripts/collect_host_image_version_files.sh $TARGET_PATH $FILESYSTEM_ROOT sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -comp zstd -b 1M -e boot -e var/lib/docker -e $PLATFORM_DIR # Ensure admin gid is 1000 From ebe2d19623a00656181503f512908b8b2f5ded09 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Sat, 12 Mar 2022 19:08:21 +0800 Subject: [PATCH 23/54] [Build]: Clean up pip cache (#10143) [Build]: Clean up pip cache --- build_debian.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index 6ffa2eb62fdc..62de5a8218fb 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -577,6 +577,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'rm -rf /usr/share/doc/* /usr/share/ ## Clean up proxy [ -n "$http_proxy" ] && sudo rm -f $FILESYSTEM_ROOT/etc/apt/apt.conf.d/01proxy +## Clean up pip cache +sudo LANG=C chroot $FILESYSTEM_ROOT pip3 cache purge + ## Umount all echo '[INFO] Umount all' ## Display all process details access /proc From b73da484c4d834f17a8563f39556e617fbc6869c Mon Sep 17 00:00:00 2001 From: xwjiang2021 <96218837+xwjiang2021@users.noreply.github.com> Date: Sat, 12 Mar 2022 20:18:12 +0800 Subject: [PATCH 24/54] Install the allure-pytest package globally in sonic-mgmt docker (#10216) Why I did it This fix is to address issue: Azure/sonic-mgmt#5280 In the sonic-mgmt Dockerfile, python package allure-pytest is installed after ENV USER $user. Consequently the package is installed to path /home/$user/.local and is only available to the $user account. If we use root account in sonic-mgmt docker container to run tests, any script importing the allure package will fail with ImportError. We need to install the allure-pytest package to global directory instead of user local directory. How I did it Update the sonic-mgmt Dockerfile to ensure that the allure-pytest package is installed to global directory How to verify it Build a new sonic-mgmt docker image based on the changes. Use sonic-mgmt docker container of the newly built image to run test scripts that depend on the allure-pytest package. No ImportError is raised. --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index e2054ae81ba1..8349df8e439f 100755 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -21,7 +21,6 @@ RUN apt-get update && apt-get install -y build-essential \ python \ python-dev \ python-scapy \ - python-setuptools \ python-pip \ python3-pip \ python3-venv \ @@ -33,6 +32,7 @@ RUN apt-get update && apt-get install -y build-essential \ telnet \ vim +RUN pip install setuptools==44.1.1 RUN pip install cffi==1.10.0 \ contextlib2==0.6.0.post1 \ cryptography==3.3.2 \ @@ -74,6 +74,7 @@ RUN pip install cffi==1.10.0 \ virtualenv \ retry \ thrift==0.11.0 \ + allure-pytest==2.8.22 \ && git clone https://github.com/p4lang/scapy-vxlan.git \ && cd scapy-vxlan \ && python setup.py install \ @@ -182,10 +183,6 @@ RUN python3 -m venv env-python3 # the end until we figure that out. RUN pip install pycryptodome==3.9.8 -# Install allure-pytest library -RUN pip install --upgrade setuptools \ - && pip install allure-pytest==2.8.22 - # Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD. ENV VIRTUAL_ENV=env-python3 ARG BACKUP_OF_PATH="$PATH" From 7178c668dd69c551fd58f5ebaf584f75ae765961 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Mon, 14 Mar 2022 11:20:20 +0800 Subject: [PATCH 25/54] [Build]: Fix installing dpkg packages in parallel issue (#10175) Why I did it Fix the debian packages installing in parallel issue. Add apt hook command to support apt to print no version control info. --- src/sonic-build-hooks/hooks/apt | 5 ++ src/sonic-build-hooks/hooks/apt-get | 39 ++++------ .../scripts/buildinfo_base.sh | 74 +++++++++++++++++++ 3 files changed, 92 insertions(+), 26 deletions(-) create mode 100755 src/sonic-build-hooks/hooks/apt diff --git a/src/sonic-build-hooks/hooks/apt b/src/sonic-build-hooks/hooks/apt new file mode 100755 index 000000000000..f4b0f97287b1 --- /dev/null +++ b/src/sonic-build-hooks/hooks/apt @@ -0,0 +1,5 @@ +#!/bin/bash + +. /usr/local/share/buildinfo/scripts/buildinfo_base.sh + +APT_REAL_COMMAND=$(get_command apt) $(dirname "$0")/apt-get "$@" diff --git a/src/sonic-build-hooks/hooks/apt-get b/src/sonic-build-hooks/hooks/apt-get index 9ae50a118650..f1f789542b7a 100755 --- a/src/sonic-build-hooks/hooks/apt-get +++ b/src/sonic-build-hooks/hooks/apt-get @@ -3,36 +3,23 @@ INSTALL= . /usr/local/share/buildinfo/scripts/buildinfo_base.sh -REAL_COMMAND=$(get_command apt-get) +REAL_COMMAND=$APT_REAL_COMMAND +[ -z "$REAL_COMMAND" ] && REAL_COMMAND=$(get_command apt-get) if [ -z "$REAL_COMMAND" ]; then echo "The command apt-get does not exist." 1>&2 exit 1 fi -VERSION_FILE="/usr/local/share/buildinfo/versions/versions-deb" -if [ "$ENABLE_VERSION_CONTROL_DEB" == "y" ]; then - for para in $@ - do - if [[ "$para" != -* ]]; then - continue - fi - if [ ! -z "$INSTALL" ]; then - if [[ "$para" == *=* ]]; then - continue - elif [[ "$para" == *=* ]]; then - continue - else - package=$para - if ! grep -q "^${package}=" $VERSION_FILE; then - echo "The version of the package ${package} is not specified." - exit 1 - fi - fi - elif [[ "$para" == "install" ]]; then - INSTALL=y - fi - done +INSTALL=$(check_apt_install) +COMMAND_INFO="Locked by command: $REAL_COMMAND $@" +if [ "$INSTALL" == y ]; then + check_apt_version + lock_result=$(acquire_apt_installation_lock "$COMMAND_INFO" ) + $REAL_COMMAND "$@" + command_result=$? + [ "$lock_result" == y ] && release_apt_installation_lock + exit $command_result +else + $REAL_COMMAND "$@" fi - -$REAL_COMMAND "$@" diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index d46ffec18330..22ab3da4e9ae 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -12,6 +12,7 @@ VERSION_DEB_PREFERENCE=$BUILDINFO_PATH/versions/01-versions-deb WEB_VERSION_FILE=$VERSION_PATH/versions-web BUILD_WEB_VERSION_FILE=$BUILD_VERSION_PATH/versions-web REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/debian' +DPKG_INSTALLTION_LOCK_FILE=/tmp/.dpkg_installation.lock . $BUILDINFO_PATH/config/buildinfo.config @@ -182,6 +183,79 @@ run_pip_command() return $result } +# Check if the command is to install the debian packages +# The apt/apt-get command format: apt/apt-get [options] {update|install} +check_apt_install() +{ + for para in "$@" + do + if [[ "$para" == -* ]]; then + continue + fi + + if [[ "$para" == "install" ]]; then + echo y + fi + + break + done +} + +# Print warning message if a debian package version not specified when debian version control enabled. +check_apt_version() +{ + VERSION_FILE="/usr/local/share/buildinfo/versions/versions-deb" + local install=$(check_apt_install "$@") + if [ "$ENABLE_VERSION_CONTROL_DEB" == "y" ] && [ "$install" == "y" ]; then + for para in "$@" + do + if [[ "$para" == -* ]]; then + continue + fi + + if [[ "$para" == *=* ]]; then + continue + else + package=$para + if ! grep -q "^${package}=" $VERSION_FILE; then + echo "Warning: the version of the package ${package} is not specified." 1>&2 + fi + fi + done + fi +} + +acquire_apt_installation_lock() +{ + local result=n + local wait_in_second=10 + local count=60 + local info="$1" + for ((i=1; i<=$count; i++)); do + if [ -f $DPKG_INSTALLTION_LOCK_FILE ]; then + local lock_info=$(cat $DPKG_INSTALLTION_LOCK_FILE || true) + echo "Waiting dpkg lock for $wait_in_second, $i/$count, info: $lock_info" 1>&2 + sleep $wait_in_second + else + # Create file in an atomic operation + if (set -o noclobber; echo "$info">$DPKG_INSTALLTION_LOCK_FILE) &>/dev/null; then + result=y + break + else + echo "Failed to creat lock, Waiting dpkg lock for $wait_in_second, $i/$count, info: $lock_info" 1>&2 + sleep $wait_in_second + fi + fi + done + + echo $result +} + +release_apt_installation_lock() +{ + rm -f $DPKG_INSTALLTION_LOCK_FILE +} + ENABLE_VERSION_CONTROL_DEB=$(check_version_control "deb") ENABLE_VERSION_CONTROL_PY2=$(check_version_control "py2") ENABLE_VERSION_CONTROL_PY3=$(check_version_control "py3") From eea3cc7ad167d2f53bee0a1e5d301f62802cbd12 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Mon, 14 Mar 2022 13:41:37 +0800 Subject: [PATCH 26/54] [Build]: only install grpc in amd64 (#10212) [Build]: only install grpc in amd64 Unblock marvell-armhf build. --- files/build_templates/sonic_debian_extension.j2 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 991b838a6d23..6cafa76014d1 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -131,8 +131,10 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install psutil sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install ipaddr # Install Python module for grpcio and grpcio-toole -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio==1.39.0" -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio-tools==1.39.0" +if [[ $CONFIGURED_ARCH == amd64 ]]; then + sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio==1.39.0" + sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio-tools==1.39.0" +fi # Install SwSS SDK Python 3 package # Note: the scripts will be overwritten by corresponding Python 2 package From 3fa627f290bf1d04a11aa13118bbbff57058bea3 Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Mon, 14 Mar 2022 18:09:20 +0800 Subject: [PATCH 27/54] Add a config variable to override default container registry instead of dockerhub. (#10166) * Add variable to reset default docker registry * fix bug in docker version control --- Makefile.work | 9 +++++++-- dockers/docker-base-bullseye/Dockerfile.j2 | 7 ++++--- dockers/docker-base-buster/Dockerfile.j2 | 7 ++++--- dockers/docker-base-stretch/Dockerfile.j2 | 7 ++++--- dockers/docker-base/Dockerfile.j2 | 7 ++++--- dockers/docker-ptf/Dockerfile.j2 | 7 ++++--- dockers/docker-sonic-mgmt/Dockerfile.j2 | 3 ++- rules/config | 3 +++ scripts/docker_version_control.sh | 6 ++++-- slave.mk | 3 +++ sonic-slave-bullseye/Dockerfile.j2 | 11 ++++++----- sonic-slave-buster/Dockerfile.j2 | 9 +++++---- sonic-slave-jessie/Dockerfile.j2 | 7 ++++--- sonic-slave-stretch/Dockerfile.j2 | 7 ++++--- 14 files changed, 58 insertions(+), 35 deletions(-) diff --git a/Makefile.work b/Makefile.work index 39879110d4e8..8042de7d198b 100644 --- a/Makefile.work +++ b/Makefile.work @@ -115,6 +115,10 @@ rules/config.user: include rules/config -include rules/config.user +ifneq ($(DEFAULT_CONTAINER_REGISTRY),) +override DEFAULT_CONTAINER_REGISTRY := $(DEFAULT_CONTAINER_REGISTRY)/ +endif + ifeq ($(ENABLE_DOCKER_BASE_PULL),) override ENABLE_DOCKER_BASE_PULL = n endif @@ -139,9 +143,9 @@ $(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ scripts/generate_buildinfo_config.sh) # Generate the slave Dockerfile, and prepare build info for it -$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile) +$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile) $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user) -$(shell BUILD_SLAVE=y scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV)) +$(shell BUILD_SLAVE=y DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV)) # Add the versions in the tag, if the version change, need to rebuild the slave SLAVE_BASE_TAG = $(shell cat $(SLAVE_DIR)/Dockerfile $(SLAVE_DIR)/buildinfo/versions/versions-* src/sonic-build-hooks/hooks/* | sha1sum | awk '{print substr($$1,0,11);}') @@ -291,6 +295,7 @@ SONIC_BUILD_INSTRUCTION := make \ EXTRA_DOCKER_TARGETS=$(EXTRA_DOCKER_TARGETS) \ BUILD_LOG_TIMESTAMP=$(BUILD_LOG_TIMESTAMP) \ SONIC_ENABLE_IMAGE_SIGNATURE=$(ENABLE_IMAGE_SIGNATURE) \ + SONIC_DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ ENABLE_HOST_SERVICE_ON_START=$(ENABLE_HOST_SERVICE_ON_START) \ SLAVE_DIR=$(SLAVE_DIR) \ ENABLE_AUTO_TECH_SUPPORT=$(ENABLE_AUTO_TECH_SUPPORT) \ diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 index 3ac14a4841c4..1b33003ce0a9 100644 --- a/dockers/docker-base-bullseye/Dockerfile.j2 +++ b/dockers/docker-base-bullseye/Dockerfile.j2 @@ -1,10 +1,11 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-bullseye +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-bullseye {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-bullseye +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-bullseye {% else %} -FROM {{DOCKER_BASE_ARCH}}/debian:bullseye +FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:bullseye {% endif %} # Clean documentation in FROM image diff --git a/dockers/docker-base-buster/Dockerfile.j2 b/dockers/docker-base-buster/Dockerfile.j2 index ac3fd7743e77..e16a0f677b07 100644 --- a/dockers/docker-base-buster/Dockerfile.j2 +++ b/dockers/docker-base-buster/Dockerfile.j2 @@ -1,10 +1,11 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-buster +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-buster {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-buster +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-buster {% else %} -FROM {{DOCKER_BASE_ARCH}}/debian:buster +FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:buster {% endif %} # Clean documentation in FROM image diff --git a/dockers/docker-base-stretch/Dockerfile.j2 b/dockers/docker-base-stretch/Dockerfile.j2 index b77814bb2820..5603dc502792 100644 --- a/dockers/docker-base-stretch/Dockerfile.j2 +++ b/dockers/docker-base-stretch/Dockerfile.j2 @@ -1,10 +1,11 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-stretch {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch {% else %} -FROM {{DOCKER_BASE_ARCH}}/debian:stretch +FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:stretch {% endif %} # Clean documentation in FROM image diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 616a4cde7aff..15df3fe8a754 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -1,9 +1,10 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-jessie +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-jessie {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-jessie +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-jessie {% else %} -FROM {{DOCKER_BASE_ARCH}}/debian:jessie +FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:jessie {% endif %} ## Remove retired jessie-updates repo diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index b152e94e99b0..d999d01e0026 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -1,9 +1,10 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-stretch {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch {% else %} -FROM debian:buster +FROM {{ prefix }}debian:buster {% endif %} MAINTAINER Pavel Shirshov diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 8349df8e439f..df26f2ccf38c 100755 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -1,4 +1,5 @@ -FROM ubuntu:18.04 +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} +FROM {{ prefix }}ubuntu:18.04 ENV DEBIAN_FRONTEND=noninteractive diff --git a/rules/config b/rules/config index c7ffbcaa4510..fe5d7ac3e991 100644 --- a/rules/config +++ b/rules/config @@ -211,3 +211,6 @@ INCLUDE_MUX = y # ENABLE_ASAN - enable address sanitizer ENABLE_ASAN ?= n + +# reset default container registry from dockerhub to other +DEFAULT_CONTAINER_REGISTRY ?= diff --git a/scripts/docker_version_control.sh b/scripts/docker_version_control.sh index 595477c859c6..da8cd0484f49 100755 --- a/scripts/docker_version_control.sh +++ b/scripts/docker_version_control.sh @@ -16,6 +16,8 @@ mkdir -p target/versions/default . src/sonic-build-hooks/buildinfo/config/buildinfo.config image_tag=`grep "^FROM " $DOCKERFILE | awk '{print$2}'` +image_tag_noprefix=$image_tag +[ -n "$DEFAULT_CONTAINER_REGISTRY" ] && image_tag_noprefix=$(echo $image_tag | sed "s#$DEFAULT_CONTAINER_REGISTRY##") image=`echo $image_tag | cut -f1 -d:` tag=`echo $image_tag | cut -f2 -d:` @@ -25,7 +27,7 @@ if [[ ",$SONIC_VERSION_CONTROL_COMPONENTS," == *,all,* ]] || [[ ",$SONIC_VERSION exit 0 fi if [ -f $version_file ];then - hash_value=`grep "${ARCH}:${image_tag}" $version_file | awk -F== '{print$2}'` + hash_value=`grep "${ARCH}:${image_tag_noprefix}" $version_file | awk -F== '{print$2}'` fi if [ -z $hash_value ];then hash_value=unknown @@ -43,5 +45,5 @@ else fi fi if [[ "$hash_value" != "unknown" ]];then - echo -e "${ARCH}:${image_tag}==$hash_value" >> $new_version_file + echo -e "${ARCH}:${image_tag_noprefix}==$hash_value" >> $new_version_file fi diff --git a/slave.mk b/slave.mk index 66831571aa7d..0bd81ff371a7 100644 --- a/slave.mk +++ b/slave.mk @@ -130,6 +130,8 @@ include $(RULES_PATH)/config export PACKAGE_URL_PREFIX export TRUSTED_GPG_URLS export SONIC_VERSION_CONTROL_COMPONENTS +DEFAULT_CONTAINER_REGISTRY := $(SONIC_DEFAULT_CONTAINER_REGISTRY) +export DEFAULT_CONTAINER_REGISTRY ifeq ($(SONIC_ENABLE_PFCWD_ON_START),y) ENABLE_PFCWD_ON_START = y @@ -326,6 +328,7 @@ $(info "PDDF_SUPPORT" : "$(PDDF_SUPPORT)") $(info "MULTIARCH_QEMU_ENVIRON" : "$(MULTIARCH_QEMU_ENVIRON)") $(info "SONIC_VERSION_CONTROL_COMPONENTS": "$(SONIC_VERSION_CONTROL_COMPONENTS)") $(info "ENABLE_ASAN" : "$(ENABLE_ASAN)") +$(info "DEFAULT_CONTAINER_REGISTRY" : "$(SONIC_DEFAULT_CONTAINER_REGISTRY)") ifeq ($(CONFIGURED_PLATFORM),vs) $(info "BUILD_MULTIASIC_KVM" : "$(BUILD_MULTIASIC_KVM)") endif diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index dc6ba779e264..a75cef0b680e 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -1,13 +1,14 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {%- if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/qemu-user-static:x86_64-arm-6.1.0-8 as qemu -FROM multiarch/debian-debootstrap:armhf-bullseye +FROM {{ prefix }}multiarch/qemu-user-static:x86_64-arm-6.1.0-8 as qemu +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-bullseye COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin {%- elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/qemu-user-static:x86_64-aarch64-6.1.0-8 as qemu -FROM multiarch/debian-debootstrap:arm64-bullseye +FROM {{ prefix }}multiarch/qemu-user-static:x86_64-aarch64-6.1.0-8 as qemu +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-bullseye COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin {%- else -%} -FROM debian:bullseye +FROM {{ prefix }}debian:bullseye {%- endif %} MAINTAINER gulv@microsoft.com diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 715ad8e19057..fa8ac44f1b9e 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -1,11 +1,12 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {%- if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/qemu-user-static:x86_64-arm-5.0.0-2 as qemu -FROM multiarch/debian-debootstrap:armhf-buster +FROM {{ prefix }}multiarch/qemu-user-static:x86_64-arm-5.0.0-2 as qemu +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-buster COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin {%- elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-buster +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-buster {%- else -%} -FROM debian:buster +FROM {{ prefix }}debian:buster {%- endif %} MAINTAINER gulv@microsoft.com diff --git a/sonic-slave-jessie/Dockerfile.j2 b/sonic-slave-jessie/Dockerfile.j2 index 2eaa306cdce4..1d98e6d9b6c5 100644 --- a/sonic-slave-jessie/Dockerfile.j2 +++ b/sonic-slave-jessie/Dockerfile.j2 @@ -1,9 +1,10 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {%- if CONFIGURED_ARCH == "armhf" -%} -FROM multiarch/debian-debootstrap:armhf-jessie +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-jessie {%- elif CONFIGURED_ARCH == "arm64" -%} -FROM multiarch/debian-debootstrap:arm64-jessie +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-jessie {%- else -%} -FROM debian:jessie +FROM {{ prefix }}debian:jessie {%- endif %} MAINTAINER johnar@microsoft.com diff --git a/sonic-slave-stretch/Dockerfile.j2 b/sonic-slave-stretch/Dockerfile.j2 index d9528f67d02a..ad13ed0c124a 100644 --- a/sonic-slave-stretch/Dockerfile.j2 +++ b/sonic-slave-stretch/Dockerfile.j2 @@ -1,9 +1,10 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {%- if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-stretch {%- elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch {%- else -%} -FROM debian:stretch +FROM {{ prefix }}debian:stretch {%- endif %} MAINTAINER gulv@microsoft.com From 2919b4820f95bd49ceb579986f5c58b4e3532c6e Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Mon, 14 Mar 2022 13:45:27 +0200 Subject: [PATCH 28/54] [hostcfgd] record feature state in STATE DB (#9842) - Why I did it To implement blocking feature state change. - How I did it Record the actual feature state in STATE DB from hostcfg. - How to verify it UT + verification by running on the switch and checking STATE DB. Signed-off-by: Stepan Blyschak --- files/image_config/monit/container_checker | 13 +++---- src/sonic-host-services/scripts/hostcfgd | 39 ++++++++++++++----- .../tests/hostcfgd/hostcfgd_radius_test.py | 1 + .../tests/hostcfgd/hostcfgd_tacacs_test.py | 3 +- .../tests/hostcfgd/hostcfgd_test.py | 24 ++++++++++-- 5 files changed, 59 insertions(+), 21 deletions(-) diff --git a/files/image_config/monit/container_checker b/files/image_config/monit/container_checker index 197e4f04a499..a67a96a0c18c 100755 --- a/files/image_config/monit/container_checker +++ b/files/image_config/monit/container_checker @@ -32,7 +32,7 @@ def get_expected_running_containers(): value of field 'has_global_scope', the number of ASICs and the value of field 'has_per_asic_scope'. If the device has single ASIC, the container name was put into the list. - @return: A set which contains the expected running containers and a set that has + @return: A set which contains the expected running containers and a set that has containers marked as "always_enabled". """ config_db = swsssdk.ConfigDBConnector() @@ -82,7 +82,7 @@ def get_current_running_from_DB(always_running_containers): state_db = swsscommon.DBConnector("STATE_DB", 0) tbl = swsscommon.Table(state_db, "FEATURE") if not tbl.getKeys(): - return False, None + return running_containers for name in tbl.getKeys(): data = dict(tbl.get(name)[1]) @@ -101,7 +101,7 @@ def get_current_running_from_DB(always_running_containers): print("Failed to get container '{}'. Error: '{}'".format(name, err)) pass - return True, running_containers + return running_containers def get_current_running_from_dockers(): @@ -128,13 +128,12 @@ def get_current_running_containers(always_running_containers): """ @summary: This function will get the list of currently running containers. If available in STATE-DB, get from DB else from list of dockers. - + @return: A set of currently running containers. """ - ret, current_running_containers = get_current_running_from_DB(always_running_containers) - if not ret: - current_running_containers = get_current_running_from_dockers() + current_running_containers = get_current_running_from_DB(always_running_containers) + current_running_containers.update(get_current_running_from_dockers()) return current_running_containers diff --git a/src/sonic-host-services/scripts/hostcfgd b/src/sonic-host-services/scripts/hostcfgd index 9b39fb5eb807..be8317259e38 100755 --- a/src/sonic-host-services/scripts/hostcfgd +++ b/src/sonic-host-services/scripts/hostcfgd @@ -12,7 +12,7 @@ import signal import jinja2 from sonic_py_common import device_info from swsscommon.swsscommon import SubscriberStateTable, DBConnector, Select -from swsscommon.swsscommon import ConfigDBConnector, TableConsumable +from swsscommon.swsscommon import ConfigDBConnector, TableConsumable, Table # FILE PAM_AUTH_CONF = "/etc/pam.d/common-auth-sonic" @@ -41,6 +41,7 @@ RADIUS_PAM_AUTH_CONF_DIR = "/etc/pam_radius_auth.d/" # MISC Constants CFG_DB = "CONFIG_DB" +STATE_DB = "STATE_DB" HOSTCFGD_MAX_PRI = 10 # Used to enforce ordering b/w daemons under Hostcfgd DEFAULT_SELECT_TIMEOUT = 1000 @@ -166,16 +167,23 @@ class FeatureHandler(object): SYSTEMD_SYSTEM_DIR = '/etc/systemd/system/' SYSTEMD_SERVICE_CONF_DIR = os.path.join(SYSTEMD_SYSTEM_DIR, '{}.service.d/') - def __init__(self, config_db, device_config): + # Feature state constants + FEATURE_STATE_ENABLED = "enabled" + FEATURE_STATE_DISABLED = "disabled" + FEATURE_STATE_FAILED = "failed" + + def __init__(self, config_db, feature_state_table, device_config): self._config_db = config_db + self._feature_state_table = feature_state_table self._device_config = device_config self._cached_config = {} self.is_multi_npu = device_info.is_multi_npu() def handle(self, feature_name, op, feature_cfg): if not feature_cfg: - self._cached_config.pop(feature_name) syslog.syslog(syslog.LOG_INFO, "Deregistering feature {}".format(feature_name)) + self._cached_config.pop(feature_name) + self._feature_state_table._del(feature_name) return feature = Feature(feature_name, feature_cfg, self._device_config) @@ -253,7 +261,6 @@ class FeatureHandler(object): return True def update_feature_auto_restart(self, feature, feature_name): - dir_name = self.SYSTEMD_SERVICE_CONF_DIR.format(feature_name) auto_restart_conf = os.path.join(dir_name, 'auto_restart.conf') @@ -341,8 +348,11 @@ class FeatureHandler(object): except Exception as err: syslog.syslog(syslog.LOG_ERR, "Feature '{}.{}' failed to be enabled and started" .format(feature.name, feature_suffixes[-1])) + self.set_feature_state(feature, self.FEATURE_STATE_FAILED) return + self.set_feature_state(feature, self.FEATURE_STATE_ENABLED) + def disable_feature(self, feature): cmds = [] feature_names, feature_suffixes = self.get_feature_attribute(feature) @@ -363,11 +373,17 @@ class FeatureHandler(object): except Exception as err: syslog.syslog(syslog.LOG_ERR, "Feature '{}.{}' failed to be stopped and disabled" .format(feature.name, feature_suffixes[-1])) + self.set_feature_state(feature, self.FEATURE_STATE_FAILED) return + self.set_feature_state(feature, self.FEATURE_STATE_DISABLED) + def resync_feature_state(self, feature): self._config_db.mod_entry('FEATURE', feature.name, {'state': feature.state}) + def set_feature_state(self, feature, state): + self._feature_state_table.set(feature.name, [('state', state)]) + class Iptables(object): def __init__(self): @@ -914,14 +930,14 @@ class NtpCfg(object): new_src = data.get('src_intf', '') new_src_set = set(new_src.split(";")) new_vrf = data.get('vrf', '') - + # Update the Local Cache self.ntp_global = data # check if ntp server configured, if not, do nothing if not self.ntp_servers: syslog.syslog(syslog.LOG_INFO, "No ntp server when global config change, do nothing") - return + return if orig_src_set != new_src_set: syslog.syslog(syslog.LOG_INFO, "ntp global update for source intf old {} new {}, restarting ntp-config" @@ -957,6 +973,7 @@ class HostConfigDaemon: self.config_db = ConfigDBConnector() self.config_db.connect(wait_for_init=True, retry_on=True) self.dbconn = DBConnector(CFG_DB, 0) + self.state_db_conn = DBConnector(STATE_DB, 0) self.selector = Select() syslog.syslog(syslog.LOG_INFO, 'ConfigDB connect success') @@ -964,6 +981,8 @@ class HostConfigDaemon: self.callbacks = dict() self.subscriber_map = dict() + feature_state_table = Table(self.state_db_conn, 'FEATURE') + # Load DEVICE metadata configurations self.device_config = {} self.device_config['DEVICE_METADATA'] = self.config_db.get_table('DEVICE_METADATA') @@ -976,7 +995,7 @@ class HostConfigDaemon: self.iptables = Iptables() # Intialize Feature Handler - self.feature_handler = FeatureHandler(self.config_db, self.device_config) + self.feature_handler = FeatureHandler(self.config_db, feature_state_table, self.device_config) self.feature_handler.sync_state_field() # Initialize Ntp Config Handler @@ -987,7 +1006,7 @@ class HostConfigDaemon: # Initialize AAACfg self.hostname_cache="" self.aaacfg = AaaCfg() - + def load(self): aaa = self.config_db.get_table('AAA') @@ -1004,7 +1023,7 @@ class HostConfigDaemon: self.hostname_cache = dev_meta['localhost']['hostname'] except Exception as e: pass - + # Update AAA with the hostname self.aaacfg.hostname_update(self.hostname_cache) @@ -1130,7 +1149,7 @@ class HostConfigDaemon: self.subscribe('VLAN_SUB_INTERFACE', lambda table, key, op, data: self.vlan_sub_intf_handler(key, op, data), HOSTCFGD_MAX_PRI-5) self.subscribe('PORTCHANNEL_INTERFACE', lambda table, key, op, data: self.portchannel_intf_handler(key, op, data), HOSTCFGD_MAX_PRI-5) self.subscribe('INTERFACE', lambda table, key, op, data: self.phy_intf_handler(key, op, data), HOSTCFGD_MAX_PRI-5) - + syslog.syslog(syslog.LOG_INFO, "Waiting for systemctl to finish initialization") self.wait_till_system_init_done() diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py index 4e3d18648100..9738f16852e5 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py @@ -36,6 +36,7 @@ hostcfgd.SubscriberStateTable = MockSubscriberStateTable hostcfgd.Select = MockSelect hostcfgd.DBConnector = MockDBConnector +hostcfgd.Table = mock.Mock() class TestHostcfgdRADIUS(TestCase): diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py index 3cc3504d606b..18bf5c17e6c2 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py @@ -35,6 +35,7 @@ hostcfgd.SubscriberStateTable = MockSubscriberStateTable hostcfgd.Select = MockSelect hostcfgd.DBConnector = MockDBConnector +hostcfgd.Table = mock.Mock() class TestHostcfgdTACACS(TestCase): """ @@ -44,7 +45,7 @@ def run_diff(self, file1, file2): return subprocess.check_output('diff -uR {} {} || true'.format(file1, file2), shell=True) """ - Check different config + Check different config """ def check_config(self, test_name, test_data, config_name): t_path = templates_path diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py index bbce866e2331..db9a35075a02 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py @@ -27,20 +27,23 @@ hostcfgd.SubscriberStateTable = MockSubscriberStateTable hostcfgd.Select = MockSelect hostcfgd.DBConnector = MockDBConnector +hostcfgd.Table = mock.Mock() class TestHostcfgd(TestCase): """ Test hostcfd daemon - feature """ - def __verify_table(self, table, expected_table): + def __verify_table(self, table, feature_state_table, expected_table): """ verify config db tables - Compares Config DB table (FEATURE) with expected output table + Compares Config DB table (FEATURE) with expected output table. + Verifies that State DB table (FEATURE) is updated. Args: table(dict): Current Config Db table + feature_state_table(Mock): Mocked State DB FEATURE table expected_table(dict): Expected Config Db table Returns: @@ -48,6 +51,19 @@ def __verify_table(self, table, expected_table): """ ddiff = DeepDiff(table, expected_table, ignore_order=True) print('DIFF:', ddiff) + + def get_state(cfg_state): + """ Translates CONFIG DB state field into STATE DB state field """ + if cfg_state == 'always_disabled': + return 'disabled' + elif cfg_state == 'always_enabled': + return 'enabled' + else: + return cfg_state + + feature_state_table.set.assert_has_calls([ + mock.call(feature, [('state', get_state(table[feature]['state']))]) for feature in table + ]) return True if not ddiff else False def __verify_fs(self, table): @@ -93,6 +109,7 @@ def test_hostcfgd_feature_handler(self, test_name, test_data, fs): fs.add_real_paths(swsscommon_package.__path__) # add real path of swsscommon for database_config.json fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR) MockConfigDb.set_config_db(test_data['config_db']) + feature_state_table_mock = mock.Mock() with mock.patch('hostcfgd.subprocess') as mocked_subprocess: popen_mock = mock.Mock() attrs = test_data['popen_attributes'] @@ -102,7 +119,7 @@ def test_hostcfgd_feature_handler(self, test_name, test_data, fs): # Initialize Feature Handler device_config = {} device_config['DEVICE_METADATA'] = MockConfigDb.CONFIG_DB['DEVICE_METADATA'] - feature_handler = hostcfgd.FeatureHandler(MockConfigDb(), device_config) + feature_handler = hostcfgd.FeatureHandler(MockConfigDb(), feature_state_table_mock, device_config) # sync the state field and Handle Feature Updates feature_handler.sync_state_field() @@ -113,6 +130,7 @@ def test_hostcfgd_feature_handler(self, test_name, test_data, fs): # Verify if the updates are properly updated assert self.__verify_table( MockConfigDb.get_config_db()['FEATURE'], + feature_state_table_mock, test_data['expected_config_db']['FEATURE'] ), 'Test failed for test data: {0}'.format(test_data) mocked_subprocess.check_call.assert_has_calls(test_data['expected_subprocess_calls'], any_order=True) From 330eb8dda9e4ce276e50e9d3d3fcf8cb90d89fb0 Mon Sep 17 00:00:00 2001 From: Song Yuan <64041228+ysmanman@users.noreply.github.com> Date: Mon, 14 Mar 2022 11:24:26 -0700 Subject: [PATCH 29/54] update submodule sonic-py-swsssdk (#10220) --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 7cd7e0c1580d..24366480c213 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 7cd7e0c1580d15c341160c68b73fd7d948e9fd24 +Subproject commit 24366480c213893388766a3b0dd3c492b9c04b8f From d7c3ce00454682cc9c5b6b7a5d56dd82384f4536 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Mon, 14 Mar 2022 11:34:02 -0700 Subject: [PATCH 30/54] Specify the filesystem type when mounting to /host (#10169) When mounting the partition that contains `/host` during initramfs, the mount binary available there (coming from busybox) tries each filesystem in `/proc/filesystems` and sees which one succeeds. During this time, there may be some error messages logged into dmesg because some of the incorrect filesystems failed to mount the partition. Specify the filesystem type explicitly so that initramfs knows it's that type, and we know what filesystem will always get used there. Fixes #9998 Signed-off-by: Saikrishna Arcot --- files/initramfs-tools/union-mount.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index c680e69300d1..7a64f71d70bb 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -132,7 +132,7 @@ case "${ROOT}" in ;; *) ## Mount the raw partition again - mount ${ROOT} ${rootmnt}/host + mount -t ext4 ${ROOT} ${rootmnt}/host ;; esac From 0243ed95387792635edcde3800633f610df35204 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 15 Mar 2022 10:03:54 +0800 Subject: [PATCH 31/54] [build]: Fix marvell-armhf build hung issue (#10156) (#10229) Why I did it The marvel-armhf build is hung, it does not exit after waiting for a long time. It is caused by the process /etc/entropy.py which is started by the postinst script in target/debs/buster/sonic-platform-nokia-7215_1.0_armhf.deb --- files/build_templates/sonic_debian_extension.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 6cafa76014d1..455179c08029 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -652,6 +652,11 @@ fi {% if installer_images.strip() -%} ## ensure proc is mounted sudo mount proc /proc -t proc || true +if [[ $CONFIGURED_ARCH == armhf ]]; then + # A workaround to fix the armhf build hung issue, caused by sonic-platform-nokia-7215_1.0_armhf.deb post installation script + ps -eo pid,cmd | grep python | grep "/etc/entropy.py" | awk '{print $1}' | xargs sudo kill -9 2>/dev/null || true +fi + sudo mkdir $FILESYSTEM_ROOT/target sudo mount --bind target $FILESYSTEM_ROOT/target sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT docker info From 286ff289f56835117e8890014e41f5cc16f27e4d Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Tue, 15 Mar 2022 14:47:36 +0800 Subject: [PATCH 32/54] [sonic-config-engine] Add failure details in sonic-config-engine unit test. (#10210) --- src/sonic-config-engine/tests/test_j2files.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index eb002720d98d..b922ae45dbcf 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -1,4 +1,3 @@ -import filecmp import json import os import shutil @@ -110,7 +109,7 @@ def test_ipinip(self): self.run_script(argument) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'ipinip.json') - assert utils.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_l2switch_template(self): argument = '-k Mellanox-SN2700 --preset l2 -p ' + self.t0_port_config @@ -211,7 +210,7 @@ def test_qos_arista7050_render_template(self): os.remove(qos_config_file_new) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-arista7050.json') - assert utils.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self): arista_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'arista', 'x86_64-arista_7800r3_48cq2_lc', 'Arista-7800R3-48CQ2-C48') @@ -235,7 +234,7 @@ def test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self): os.remove(cfg_file_new) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, sample_output_file) - assert filecmp.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_qos_dell9332_render_template(self): dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dellemc_z9332f_d1508-r0', 'DellEMC-Z9332f-O32') @@ -254,7 +253,7 @@ def test_qos_dell9332_render_template(self): os.remove(qos_config_file_new) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-dell9332.json') - assert utils.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_qos_dell6100_render_template(self): dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') @@ -273,7 +272,7 @@ def test_qos_dell6100_render_template(self): os.remove(qos_config_file_new) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-dell6100.json') - assert utils.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer_template, expected): dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', vendor, platform, sku) @@ -293,7 +292,7 @@ def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer os.remove(buffers_config_file_new) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, expected) - assert utils.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_buffers_dell6100_render_template(self): self._test_buffers_render_template('dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100', 'sample-dell-6100-t0-minigraph.xml', 'buffers.json.j2', 'buffers-dell6100.json') @@ -313,7 +312,7 @@ def test_ipinip_multi_asic(self): print(argument) self.run_script(argument) sample_output_file = os.path.join(self.test_dir, 'multi_npu_data', utils.PYvX_DIR, 'ipinip.json') - assert utils.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_swss_switch_render_template(self): switch_template = os.path.join( @@ -342,7 +341,7 @@ def test_swss_switch_render_template(self): self.test_dir, 'sample_output', v["output"] ) self.run_script(argument) - assert utils.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_swss_switch_render_template_multi_asic(self): # verify the ECMP hash seed changes per namespace @@ -374,7 +373,7 @@ def test_swss_switch_render_template_multi_asic(self): self.test_dir, 'sample_output', v["output"] ) self.run_script(argument) - assert utils.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) os.environ["NAMESPACE_ID"] = "" def test_ndppd_conf(self): From 18d00dfbe70d1dba75e2c534585879944b4e9230 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Tue, 15 Mar 2022 09:20:36 +0200 Subject: [PATCH 33/54] [teamd.sh] kill teamd docker on warm shutdown for faster shutdown (#10219) This can save 6 sec for teamd LAG restoration - the time between: ``` Mar 9 13:51:10.467757 r-panther-13 WARNING teamd#teamd_PortChannel1[28]: Got SIGUSR1. Mar 9 13:52:33.310707 r-panther-13 INFO teamd#teamd_PortChannel1[27]: carrier changed to UP ``` - Why I did it Optimize warm boot. Specifically reduce the time needed for LAG restoration. - How I did it Kill teamd docker after graceful shutdown of teamd processes. - How to verify it Run warm reboot. Signed-off-by: Stepan Blyschak --- files/scripts/teamd.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/scripts/teamd.sh b/files/scripts/teamd.sh index 57b70913e917..4de3f25c4dbd 100755 --- a/files/scripts/teamd.sh +++ b/files/scripts/teamd.sh @@ -93,13 +93,17 @@ stop() { # We call `docker kill teamd` to ensure the container stops as quickly as possible, # Note: teamd must be killed before syncd, because it will send the last packet through CPU port docker exec -i ${SERVICE}$DEV pkill -USR2 -f ${TEAMD_CMD} || [ $? == 1 ] + fi + + if [[ x"$WARM_BOOT" == x"true" ]] || [[ x"$FAST_BOOT" == x"true" ]]; then while docker exec -i ${SERVICE}$DEV pgrep -f ${TEAMD_CMD} > /dev/null; do sleep 0.05 done docker kill ${SERVICE}$DEV &> /dev/null || debug "Docker ${SERVICE}$DEV is not running ($?) ..." + else + /usr/bin/${SERVICE}.sh stop $DEV fi - /usr/bin/${SERVICE}.sh stop $DEV debug "Stopped ${SERVICE}$DEV service..." } From d08add5523096bd40a880724dded9fe2d0e923ed Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Tue, 15 Mar 2022 21:40:55 +0800 Subject: [PATCH 34/54] [submodule] Update sonic-swss submodule pointer (#10209) Update sonic-swss with the following changes: 29d5d8da Use abort instead of exit in case calling SAI API failure (#2170) 12f980c8 Fix issue config qos reload causing orchagent aborted via tracking dependencies among QoS tables (#2116) 6e5ed1c0 [chassis][syncd][sai] Adjusting response timeout during syncd init (#2159) 0a99f546 Try get port operational speed from STATE DB (#2119) 828cccfe [crm] Use sai_object_type_get_availability() API to get counters (#2098) 18c73a19 Allow IPv4 link-local nexthops (#1903) Signed-off-by: Stephen Sun --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 7d2942f7ef4a..00266891a9f4 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 7d2942f7ef4ac01209582c02d142bd131208b2a4 +Subproject commit 00266891a9f41e5bd37100b05237e865cde429b2 From 5a531f4eb24edf0caca47edcf0d5a2c73e0e63d4 Mon Sep 17 00:00:00 2001 From: "Marty Y. Lok" <76118573+mlok-nokia@users.noreply.github.com> Date: Tue, 15 Mar 2022 12:21:50 -0400 Subject: [PATCH 35/54] [Nokia][VoQ] The role of the Inband port should be "Inb" and recycle port (#9950) Signed-off-by: mlok --- .../Nokia-IXR7250E-36x400G/0/port_config.ini | 3 ++- .../Nokia-IXR7250E-36x400G/1/port_config.ini | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini index 8d017026081c..3633842330f8 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini @@ -17,4 +17,5 @@ Ethernet14 24,25,26,27,28,29,30,31 Ethernet14 15 Eth14 Ethernet15 16,17,18,19,20,21,22,23 Ethernet15 16 Eth15-ASIC0 Ext 400000 0 16 8 Ethernet16 8,9,10,11,12,13,14,15 Ethernet16 17 Eth16-ASIC0 Ext 400000 0 17 8 Ethernet17 0,1,2,3,4,5,6,7 Ethernet17 18 Eth17-ASIC0 Ext 400000 0 18 8 -Ethernet-IB0 115 Ethernet-IB0 37 Rcy-ASIC0 Int 10000 0 19 8 +Ethernet-IB0 115 Ethernet-IB0 37 Rcy1-ASIC0 Inb 10000 0 19 8 +Ethernet-Rec0 116 Ethernet-Rec0 39 Rcy2-ASIC0 Rec 10000 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini index 76fd968fec28..90376150d657 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini @@ -17,4 +17,5 @@ Ethernet32 24,25,26,27,28,29,30,31 Ethernet32 33 Eth14 Ethernet33 16,17,18,19,20,21,22,23 Ethernet33 34 Eth15-ASIC1 Ext 400000 0 16 8 Ethernet34 8,9,10,11,12,13,14,15 Ethernet34 35 Eth16-ASIC1 Ext 400000 0 17 8 Ethernet35 0,1,2,3,4,5,6,7 Ethernet35 36 Eth17-ASIC1 Ext 400000 0 18 8 -Ethernet-IB1 115 Ethernet-IB1 38 Rcy-ASIC1 Int 10000 0 19 8 +Ethernet-IB1 115 Ethernet-IB1 38 Rcy1-ASIC1 Inb 10000 0 19 8 +Ethernet-Rec1 116 Ethernet-Rec1 40 Rcy2-ASIC1 Rec 10000 1 20 8 From 28f6a51d26af0a744ab5194bd8a8101953ce1304 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Tue, 15 Mar 2022 10:26:36 -0700 Subject: [PATCH 36/54] [doc] Moving Configuration.md from swss to sonic-yang-models folder (#10078) #### Why I did it Moved Configuration.md from swss to yang folder. The configuration schema should be present along with yang models and when users add yang model they could update configuration document as well. --- src/sonic-yang-models/doc/Configuration.md | 1540 ++++++++++++++++++++ 1 file changed, 1540 insertions(+) create mode 100644 src/sonic-yang-models/doc/Configuration.md diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md new file mode 100644 index 000000000000..b5890681ce41 --- /dev/null +++ b/src/sonic-yang-models/doc/Configuration.md @@ -0,0 +1,1540 @@ +# SONiC Configuration Database Manual + +Table of Contents +================= + + * [Introduction](#introduction) + * [Configuration](#configuration) + * [Config Load and Save](#config-load-and-save) + * [Incremental Configuration](#incremental-configuration) + * [Redis and Json Schema](#redis-and-json-schema) + * [ACL and Mirroring](#acl-and-mirroring) + * [BGP Sessions](#bgp-sessions) + * [BUFFER_PG](#buffer_pg) + * [Buffer pool](#buffer-pool) + * [Buffer profile](#buffer-profile) + * [Buffer queue](#buffer-queue) + * [Buffer port ingress profile list](#buffer-port-ingress-profile-list) + * [Buffer port egress profile list](#buffer-port-egress-profile-list) + * [Cable length](#cable-length) + * [COPP_TABLE](#copp_table) + * [CRM](#crm) + * [Data Plane L3 Interfaces](#data-plane-l3-interfaces) + * [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER) + * [Device Metadata](#device-metadata) + * [Device neighbor metada](#device-neighbor-metada) + * [DSCP_TO_TC_MAP](#dscp_to_tc_map) + * [FLEX_COUNTER_TABLE](#flex_counter_table) + * [L2 Neighbors](#l2-neighbors) + * [Loopback Interface](#loopback-interface) + * [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN) + * [Management Interface](#management-interface) + * [Management port](#management-port) + * [Management VRF](#management-vrf) + * [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue) + * [NTP Global Configuration](#ntp-global-configuration) + * [NTP and SYSLOG servers](#ntp-and-syslog-servers) + * [Policer](#policer) + * [Port](#port) + * [Port Channel](#port-channel) + * [Portchannel member](#portchannel-member) + * [Scheduler](#scheduler) + * [Port QoS Map](#port-qos-map) + * [Queue](#queue) + * [Tacplus Server](#tacplus-server) + * [TC to Priority group map](#tc-to-priority-group-map) + * [TC to Queue map](#tc-to-queue-map) + * [Versions](#versions) + * [VLAN](#vlan) + * [VLAN_MEMBER](#vlan_member) + * [Virtual router](#virtual-router) + * [WRED_PROFILE](#wred_profile) + * [For Developers](#for-developers) + * [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template) + * [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb) + + + +# Introduction +This document lists the configuration commands schema applied in the SONiC eco system. All these commands find relevance in collecting system information, analysis and even for trouble shooting. All the commands are categorized under relevant topics with corresponding examples. + +# Configuration + +SONiC is managing configuration in a single source of truth - a redisDB +instance that we refer as ConfigDB. Applications subscribe to ConfigDB +and generate their running configuration correspondingly. + +(Before Sep 2017, we were using an XML file named minigraph.xml to +configure SONiC devices. For historical documentation, please refer to +[Configuration with +Minigraph](https://github.com/Azure/SONiC/wiki/Configuration-with-Minigraph-(~Sep-2017))) + +# **Config Load and Save** + +In current version of SONiC, ConfigDB is implemented as database 4 of +local redis. When system boots, configurations will be loaded from +/etc/sonic/config_db.json file into redis. Please note that ConfigDB +content won't be written back into /etc/sonic/config_db.json file +automatically. In order to do that, a config save command need to be +manually executed from CLI. Similarly, config load will trigger a force +load of json file into DB. Generally, content in +/etc/sonic/config_db.json can be considered as starting config, and +content in redisDB running config. + +We keep a way to load configuration from minigraph and write into +ConfigDB for backward compatibility. To do that, run `config +load_minigraph`. + +### Incremental Configuration + +The design of ConfigDB supports incremental configuration - application +could subscribe to changes in ConfigDB and response correspondingly. +However, this feature is not implemented by all applications yet. By Sep +2017 now, the only application that supports incremental configuration +is BGP (docker-fpm-quagga). For other applications, a manual restart is +required after configuration changes in ConfigDB. + +# **Redis and Json Schema** + +ConfigDB uses a table-object schema that is similar with +[AppDB](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md), +and `config_db.json` is a straight-forward serialization of DB. As an +example, the following fragments could be BGP-related configuration in +redis and json, correspondingly: + + +***Redis format*** +``` +127.0.0.1:6379[4]> keys BGP_NEIGHBOR:* + +1) "BGP_NEIGHBOR:10.0.0.31" +2) "BGP_NEIGHBOR:10.0.0.39" +3) "BGP_NEIGHBOR:10.0.0.11" +4) "BGP_NEIGHBOR:10.0.0.7" + +... + +127.0.0.1:6379[4]> hgetall BGP_NEIGHBOR:10.0.0.3 + +1) "admin_status" +2) "up" +3) "peer_addr" +4) "10.0.0.2" +5) "asn" +6) "65200" +7) "name" +8) "ARISTA07T2" +``` + +***Json format*** +``` +"BGP_NEIGHBOR": { + "10.0.0.57": { + "rrclient": "0", + "name": "ARISTA01T1", + "local_addr": "10.0.0.56", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + }, + "10.0.0.59": { + "rrclient": "0", + "name": "ARISTA02T1", + "local_addr": "10.0.0.58", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + }, +} +``` + +Full sample config_db.json files are availables at +[here](https://github.com/Azure/SONiC/blob/gh-pages/doc/config_db.json) +and +[here](https://github.com/Azure/SONiC/blob/gh-pages/doc/config_db_t0.json). + + +### ACL and Mirroring + +ACL and mirroring related configuration are defined in +**MIRROR_SESSION**, **ACL_TABLE** and **ACL_RULE** tables. Those +tables are in progress of migrating from APPDB. Please refer to their +schema in APPDB +[here](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md) +and migration plan +[here](https://github.com/Azure/SONiC/wiki/ACL-Configuration-Requirement-Description). + +``` +{ +"MIRROR_SESSION": { + "everflow0": { + "src_ip": "10.1.0.32", + "dst_ip": "2.2.2.2" + } + }, + +"ACL_TABLE": { + "DATAACL": { + "policy_desc" : "data_acl", + "type": "l3", + "ports": [ + "Ethernet0", + "Ethernet4", + "Ethernet8", + "Ethernet12" + ] + } + } +} +``` + +***Below ACL table added as per the mail*** +``` +{ +"ACL_TABLE": { + "aaa": { + "type": "L3", + "ports": "Ethernet0" + } + }, +"ACL_RULE": { + "aaa|rule_0": { + "PRIORITY": "55", + "PACKET_ACTION": "DROP", + "L4_SRC_PORT": "0" + }, + "aaa|rule_1": { + "PRIORITY": "55", + "PACKET_ACTION": "DROP", + "L4_SRC_PORT": "1" + } + } +} +``` + +***Below ACL table added by comparig minigraph.xml & config_db.json*** + +``` +{ +"ACL_TABLE": { + "EVERFLOW": { + "type": "MIRROR", + "policy_desc": "EVERFLOW", + "ports": [ + "PortChannel0001", + "PortChannel0002", + "PortChannel0003", + "PortChannel0004" + ] + }, + "EVERFLOWV6": { + "type": "MIRRORV6", + "policy_desc": "EVERFLOWV6", + "ports": [ + "PortChannel0001", + "PortChannel0002", + "PortChannel0003", + "PortChannel0004" + ] + }, + "SNMP_ACL": { + "services": [ + "SNMP" + ], + "type": "CTRLPLANE", + "policy_desc": "SNMP_ACL" + }, + "SSH_ONLY": { + "services": [ + "SSH" + ], + "type": "CTRLPLANE", + "policy_desc": "SSH_ONLY" + } + }, + +"ACL_RULE": { + "SNMP_ACL|DEFAULT_RULE": { + "PRIORITY": "1", + "PACKET_ACTION": "DROP", + "ETHER_TYPE": "2048" + }, + "SNMP_ACL|RULE_1": { + "PRIORITY": "9999", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "1.1.1.1/32", + "IP_PROTOCOL": "17" + }, + "SNMP_ACL|RULE_2": { + "PRIORITY": "9998", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "2.2.2.2/32", + "IP_PROTOCOL": "17" + }, + "SSH_ONLY|DEFAULT_RULE": { + "PRIORITY": "1", + "PACKET_ACTION": "DROP", + "ETHER_TYPE": "2048" + }, + "SSH_ONLY|RULE_1": { + "PRIORITY": "9999", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "4.4.4.4/8", + "IP_PROTOCOL": "6" + } + } +} + +``` + +***ACL table type configuration example*** +``` +{ + "ACL_TABLE_TYPE": { + "CUSTOM_L3": { + "MATCHES": [ + "IN_PORTS", + "OUT_PORTS", + "SRC_IP" + ], + "ACTIONS": [ + "PACKET_ACTION", + "MIRROR_INGRESS_ACTION" + ], + "BIND_POINTS": [ + "PORT", + "LAG" + ] + } + }, + "ACL_TABLE": { + "DATAACL": { + "STAGE": "INGRESS", + "TYPE": "CUSTOM_L3", + "PORTS": [ + "Ethernet0", + "PortChannel1" + ] + } + }, + "ACL_RULE": { + "DATAACL|RULE0": { + "PRIORITY": "999", + "PACKET_ACTION": "DROP", + "SRC_IP": "1.1.1.1/32", + } + } +} +``` + +### BGP Sessions + +BGP session configuration is defined in **BGP_NEIGHBOR** table. BGP +neighbor address is used as key of bgp neighbor objects. Object +attributes include remote AS number, neighbor router name, and local +peering address. Dynamic neighbor is also supported by defining peer +group name and IP ranges in **BGP_PEER_RANGE** table. + +``` +{ +"BGP_NEIGHBOR": { + "10.0.0.61": { + "local_addr": "10.0.0.60", + "asn": 64015, + "name": "ARISTA15T0" + }, + "10.0.0.49": { + "local_addr": "10.0.0.48", + "asn": 64009, + "name": "ARISTA09T0" + }, + + "10.0.0.63": { + "rrclient": "0", + "name": "ARISTA04T1", + "local_addr": "10.0.0.62", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + } + +"BGP_PEER_RANGE": { + "BGPSLBPassive": { + "name": "BGPSLBPassive", + "ip_range": [ + "10.250.0.0/27" + ] + }, + "BGPVac": { + "name": "BGPVac", + "ip_range": [ + "10.2.0.0/16" + ] + } + } +} +``` + +### BUFFER_PG + +When the system is running in traditional buffer model, profiles needs to explicitly configured: + +``` +{ +"BUFFER_PG": { + "Ethernet0|3-4": { + "profile": "pg_lossless_40000_5m_profile" + }, + "Ethernet1|3-4": { + "profile": "pg_lossless_40000_5m_profile" + }, + "Ethernet2|3-4": { + "profile": "pg_lossless_40000_5m_profile" + } + } +} + +``` + +When the system is running in dynamic buffer model, profiles can be: + + - either calculated dynamically according to ports' configuration and just configured as "NULL"; + - or configured explicitly. + +``` +{ +"BUFFER_PG": { + "Ethernet0|3-4": { + "profile": "NULL" + }, + "Ethernet1|3-4": { + "profile": "NULL" + }, + "Ethernet2|3-4": { + "profile": "static_profile" + } + } +} + +``` + +### Buffer pool + +When the system is running in traditional buffer model, the size of all of the buffer pools and xoff of ingress_lossless_pool need to be configured explicitly. + +``` +{ +"BUFFER_POOL": { + "egress_lossless_pool": { + "type": "egress", + "mode": "static", + "size": "15982720" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic", + "size": "9243812" + }, + "ingress_lossless_pool": { + "xoff": "4194112", + "type": "ingress", + "mode": "dynamic", + "size": "10875072" + } + } +} + +``` + +When the system is running in dynamic buffer model, the size of some of the buffer pools can be omitted and will be dynamically calculated. + +``` +{ +"BUFFER_POOL": { + "egress_lossless_pool": { + "type": "egress", + "mode": "static", + "size": "15982720" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic", + }, + "ingress_lossless_pool": { + "type": "ingress", + "mode": "dynamic", + } + } +} + +``` + + +### Buffer profile + +``` +{ +"BUFFER_PROFILE": { + "egress_lossless_profile": { + "static_th": "3995680", + "pool": "egress_lossless_pool", + "size": "1518" + }, + "egress_lossy_profile": { + "dynamic_th": "3", + "pool": "egress_lossy_pool", + "size": "1518" + }, + "ingress_lossy_profile": { + "dynamic_th": "3", + "pool": "ingress_lossless_pool", + "size": "0" + }, + "pg_lossless_40000_5m_profile": { + "xon_offset": "2288", + "dynamic_th": "-3", + "xon": "2288", + "xoff": "66560", + "pool": "ingress_lossless_pool", + "size": "1248" + }, + "pg_lossless_40000_40m_profile": { + "xon_offset": "2288", + "dynamic_th": "-3", + "xon": "2288", + "xoff": "71552", + "pool": "ingress_lossless_pool", + "size": "1248" + } + } +} + +``` + +When the system is running in dynamic buffer model and the headroom_type is dynamic, only dynamic_th needs to be configured and rest of fields can be omitted. +This kind of profiles will be handled by buffer manager and won't be applied to SAI. + +``` +{ + { + "non_default_dynamic_th_profile": { + "dynamic_th": 1, + "headroom_type": "dynamic" + } + } +} +``` + +### Buffer queue + +``` +{ +"BUFFER_QUEUE": { + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|0-2": { + "profile": "egress_lossy_profile" + }, + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|3-4": { + "profile": "egress_lossless_profile" + }, + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|5-6": { + "profile": "egress_lossy_profile" + } + } +} + +``` + +### Buffer port ingress profile list + +``` +{ +"BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet50": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + }, + "Ethernet52": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + }, + "Ethernet56": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + } + } +} + +``` + +### Buffer port egress profile list + +``` +{ +"BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet50": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + }, + "Ethernet52": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + }, + "Ethernet56": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + } + } +} + +``` + +### Cable length + +``` +{ +"CABLE_LENGTH": { + "AZURE": { + "Ethernet8": "5m", + "Ethernet9": "5m", + "Ethernet2": "5m", + "Ethernet58": "5m", + "Ethernet59": "5m", + "Ethernet50": "40m", + "Ethernet51": "5m", + "Ethernet52": "40m", + "Ethernet53": "5m", + "Ethernet54": "40m", + "Ethernet55": "5m", + "Ethernet56": "40m" + } + } +} + +``` + +### COPP_TABLE + +``` +{ +"COPP_TABLE": { + "default": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "0", + "red_action": "drop" + }, + + "trap.group.arp": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "4", + "red_action": "drop", + "trap_action": "trap", + "trap_ids": "arp_req,arp_resp,neigh_discovery", + "trap_priority": "4" + }, + + "trap.group.lldp.dhcp.udld": { + "queue": "4", + "trap_action": "trap", + "trap_ids": "lldp,dhcp,udld", + "trap_priority": "4" + }, + + "trap.group.bgp.lacp": { + "queue": "4", + "trap_action": "trap", + "trap_ids": "bgp,bgpv6,lacp", + "trap_priority": "4" + }, + + "trap.group.ip2me": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "1", + "red_action": "drop", + "trap_action": "trap", + "trap_ids": "ip2me", + "trap_priority": "1" + } + } +} +``` + +### CRM + +``` +{ +"CRM": { + "Config": { + "acl_table_threshold_type": "percentage", + "nexthop_group_threshold_type": "percentage", + "fdb_entry_high_threshold": "85", + "acl_entry_threshold_type": "percentage", + "ipv6_neighbor_low_threshold": "70", + "nexthop_group_member_low_threshold": "70", + "acl_group_high_threshold": "85", + "ipv4_route_high_threshold": "85", + "acl_counter_high_threshold": "85", + "ipv4_route_low_threshold": "70", + "ipv4_route_threshold_type": "percentage", + "ipv4_neighbor_low_threshold": "70", + "acl_group_threshold_type": "percentage", + "ipv4_nexthop_high_threshold": "85", + "ipv6_route_threshold_type": "percentage", + "snat_entry_threshold_type": "percentage", + "snat_entry_high_threshold": "85", + "snat_entry_low_threshold": "70", + "dnat_entry_threshold_type": "percentage", + "dnat_entry_high_threshold": "85", + "dnat_entry_low_threshold": "70", + "ipmc_entry_threshold_type": "percentage", + "ipmc_entry_high_threshold": "85", + "ipmc_entry_low_threshold": "70" + } + } +} + +``` + +### Data Plane L3 Interfaces + +IP configuration for data plane are defined in **INTERFACE**, +**PORTCHANNEL_INTERFACE**, and **VLAN_INTERFACE** table. The objects +in all three tables have the interface (could be physical port, port +channel, or vlan) that IP address is attached to as first-level key, and +IP prefix as second-level key. IP interface objects don't have any +attributes. + +``` +{ +"INTERFACE": { + "Ethernet0|10.0.0.0/31": {}, + "Ethernet4|10.0.0.2/31": {}, + "Ethernet8|10.0.0.4/31": {} + ... + }, + +"PORTCHANNEL_INTERFACE": { + "PortChannel01|10.0.0.56/31": {}, + "PortChannel01|FC00::71/126": {}, + "PortChannel02|10.0.0.58/31": {}, + "PortChannel02|FC00::75/126": {} + ... + }, +"VLAN_INTERFACE": { + "Vlan1000|192.168.0.1/27": {} + } +} + +``` + + +### DEFAULT_LOSSLESS_BUFFER_PARAMETER + +This table stores the default lossless buffer parameters for dynamic buffer calculation. + +``` +{ + "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0", + "over_subscribe_ratio": "2" + } + } +} +``` + +### Device Metadata + +The **DEVICE_METADATA** table contains only one object named +*localhost*. In this table the device metadata such as hostname, hwsku, +deployment envionment id and deployment type are specified. BGP local AS +number is also specified in this table as current only single BGP +instance is supported in SONiC. + +``` +{ +"DEVICE_METADATA": { + "localhost": { + "hwsku": "Force10-S6100", + "default_bgp_status": "up", + "docker_routing_config_mode": "unified", + "hostname": "sonic-s6100-01", + "platform": "x86_64-dell_s6100_c2538-r0", + "mac": "4c:76:25:f4:70:82", + "default_pfcwd_status": "disable", + "bgp_asn": "65100", + "deployment_id": "1", + "type": "ToRRouter", + "buffer_model": "traditional" + } + } +} + +``` + + +### Device neighbor metada + +``` +{ +"DEVICE_NEIGHBOR_METADATA": { + "ARISTA01T1": { + "lo_addr": "None", + "mgmt_addr": "10.11.150.45", + "hwsku": "Arista-VM", + "type": "LeafRouter" + }, + "ARISTA02T1": { + "lo_addr": "None", + "mgmt_addr": "10.11.150.46", + "hwsku": "Arista-VM", + "type": "LeafRouter" + } + } +} + +``` + + +### DSCP_TO_TC_MAP +``` +{ +"DSCP_TO_TC_MAP": { + "AZURE": { + "1": "1", + "0": "1", + "3": "3", + "2": "1", + "5": "2", + "4": "4", + "7": "1", + "6": "1", + "9": "1", + "8": "0" + } + } +} + +``` + + +### MPLS_TC_TO_TC_MAP +``` +{ +"MPLS_TC_TO_TC_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "2", + "5": "3", + "6": "3", + "7": "4" + } + } +} + +``` + +### FLEX_COUNTER_TABLE + +``` +{ +"FLEX_COUNTER_TABLE": { + "PFCWD": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable" + } + } +} + +``` + + +### L2 Neighbors + +The L2 neighbor and connection information can be configured in +**DEVICE_NEIGHBOR** table. Those information are used mainly for LLDP. +While mandatory fields include neighbor name acting as object key and +remote port / local port information in attributes, optional information +about neighbor device such as device type, hwsku, management address and +loopback address can also be defined. + +``` +{ +"DEVICE_NEIGHBOR": { + "ARISTA04T1": { + "mgmt_addr": "10.20.0.163", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet124", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA03T1": { + "mgmt_addr": "10.20.0.162", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet120", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA02T1": { + "mgmt_addr": "10.20.0.161", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet116", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA01T1": { + "mgmt_addr": "10.20.0.160", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet112", + "type": "LeafRouter", + "port": "Ethernet1" + } + } +} +``` + +### Loopback Interface + +Loopback interface configuration lies in **LOOPBACK_INTERFACE** table +and has similar schema with data plane interfaces. The loopback device +name and loopback IP prefix act as multi-level key for loopback +interface objects. + +``` +{ +"LOOPBACK_INTERFACE": { + "Loopback0|10.1.0.32/32": {}, + "Loopback0|FC00:1::32/128": {} + } +} + +``` + +### LOSSLESS_TRAFFIC_PATTERN + +The LOSSLESS_TRAFFIC_PATTERN table stores parameters related to +lossless traffic for dynamic buffer calculation + +``` +{ + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1024", + "small_packet_percentage": "100" + } + } +} +``` + +### Management Interface + +Management interfaces are defined in **MGMT_INTERFACE** table. Object +key is composed of management interface name and IP prefix. Attribute +***gwaddr*** specify the gateway address of the prefix. +***forced_mgmt_routes*** attribute can be used to specify addresses / +prefixes traffic to which are forced to go through management network +instead of data network. + +``` +{ +"MGMT_INTERFACE": { + "eth0|10.11.150.11/16": { + "gwaddr": "10.11.0.1" + }, + "eth0|FC00:2::32/64": { + "forced_mgmt_routes": [ + "10.0.0.100/31", + "10.250.0.8", + "10.255.0.0/28" + ], + "gwaddr": "fc00:2::1" + } + } +} + +``` + +### Management port + +``` +{ +"MGMT_PORT": { + "eth0": { + "alias": "eth0", + "admin_status": "up" + } + } +} + +``` + + +### Management VRF + +``` +{ +"MGMT_VRF_CONFIG": { + "vrf_global": { + "mgmtVrfEnabled": "true" + } + } +} +``` + +### MAP_PFC_PRIORITY_TO_QUEUE + +``` +{ +"MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` +### NTP Global Configuration + +These configuration options are used to modify the way that +ntp binds to the ports on the switch and which port it uses to +make ntp update requests from. + +***NTP VRF*** + +If this option is set to `default` then ntp will run within the default vrf +**when the management vrf is enabled**. If the mgmt vrf is enabled and this value is +not set to default then ntp will run within the mgmt vrf. + +This option **has no effect** if the mgmt vrf is not enabled. + +``` +{ +"NTP": { + "global": { + "vrf": "default" + } + } +} +``` + + +***NTP Source Port*** + +This option sets the port which ntp will choose to send time update requests from by. + +NOTE: If a Loopback interface is defined on the switch ntp will choose this by default, so this setting +is **required** if the switch has a Loopback interface and the ntp peer does not have defined routes +for that address. + +``` +{ +"NTP": { + "global": { + "src_intf": "Ethernet1" + } + } +} +``` + +### NTP and SYSLOG servers + +These information are configured in individual tables. Domain name or IP +address of the server is used as object key. Currently there are no +attributes in those objects. + +***NTP server*** +``` +{ +"NTP_SERVER": { + "2.debian.pool.ntp.org": {}, + "1.debian.pool.ntp.org": {}, + "3.debian.pool.ntp.org": {}, + "0.debian.pool.ntp.org": {} + }, + +"NTP_SERVER": { + "23.92.29.245": {}, + "204.2.134.164": {} + } +} +``` + +***Syslogserver*** +``` +{ +"SYSLOG_SERVER": { + "10.0.0.5": {}, + "10.0.0.6": {}, + "10.11.150.5": {} + } +} +``` + +### Policer + +Below is an example of the policer table configuration. +``` +{ + "POLICER": { + "everflow_static_policer": { + "meter_type": "bytes", + "mode": "sr_tcm", + "cir": "12500000", + "cbs": "12500000", + "pir": "17500000", + "pbs": "17500000", + "color": "aware", + "red_packet_action": "drop", + "yellow_packet_action": "drop" + "green_packet_action": "forward" + } + } +} + +``` +Key to the table defines policer name Below are the fields +- meter_type - Mandatory field. Defines how the metering is done. values - bytes, packets +- mode - Mandatory field. Defines one of the three modes support. values - sr_tcm, tr_tcm, storm +- cir - Committed information rate bytes/sec or packets/sec based on meter_type +- cbs - Committed burst size in bytes or packets based on meter_type +- pir - Peak information rate in bytes/sec or packets/sec based on meter_type +- pbs - Peak burst size in bytes or packets based on meter_type +- color - Defines the color source for the policer. values - aware, blind +- red_packet_action - Defines the action to be taken for red color packets +- yellow_packet_action - Defines the action to be taken for yellow color packets +- green_packet_action - Defines the action to be taken for green color packets. + +The packet action could be: + +- 'drop' +- 'forward' +- 'copy' +- 'copy_cancel' +- 'trap' +- 'log' +- 'deny' +- 'transit' +### Port + +In this table the physical port configurations are defined. Each object +will have port name as its key, and port name alias and port speed as +optional attributes. + +``` +{ +"PORT": { + "Ethernet0": { + "index": "0", + "lanes": "101,102", + "description": "fortyGigE1/1/1", + "mtu": "9100", + "alias": "fortyGigE1/1/1", + "speed": "40000" + }, + "Ethernet1": { + "index": "1", + "lanes": "103,104", + "description": "fortyGigE1/1/2", + "mtu": "9100", + "alias": "fortyGigE1/1/2", + "admin_status": "up", + "speed": "40000" + }, + "Ethernet63": { + "index": "63", + "lanes": "87,88", + "description": "fortyGigE1/4/16", + "mtu": "9100", + "alias": "fortyGigE1/4/16", + "speed": "40000" + } + } +} + +``` + +### Port Channel + +Port channels are defined in **PORTCHANNEL** table with port channel +name as object key and member list as attribute. + +``` +{ +"PORTCHANNEL": { + "PortChannel0003": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet54" + ], + "mtu": "9100" + }, + "PortChannel0004": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet56" + ], + "mtu": "9100" + } + } +} +``` + + +### Portchannel member + +``` +{ +"PORTCHANNEL_MEMBER": { + "PortChannel0001|Ethernet50": {}, + "PortChannel0002|Ethernet52": {}, + "PortChannel0003|Ethernet54": {}, + "PortChannel0004|Ethernet56": {} + } +} + +``` +### Scheduler + +``` +{ +"SCHEDULER": { + "scheduler.0": { + "type": "STRICT" + }, + "scheduler.1": { + "type": "WRR" + "weight": "1", + "meter_type": "bytes", + "pir": "1250000000", + "pbs": "8192" + }, + "scheduler.port": { + "meter_type": "bytes", + "pir": "1000000000", + "pbs": "8192" + } + } +} +``` + +### Port QoS Map + +``` +{ +"PORT_QOS_MAP": { + "Ethernet50,Ethernet52,Ethernet54,Ethernet56": { + "tc_to_pg_map": "AZURE", + "tc_to_queue_map": "AZURE", + "pfc_enable": "3,4", + "pfc_to_queue_map": "AZURE", + "dscp_to_tc_map": "AZURE", + "dscp_to_fc_map": "AZURE", + "exp_to_fc_map": "AZURE", + "scheduler": "scheduler.port" + } + } +} +``` + +### Queue +``` +{ +"QUEUE": { + "Ethernet56|4": { + "wred_profile": "AZURE_LOSSLESS", + "scheduler": "scheduler.1" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + } + } +} +``` + + +### Tacplus Server + +``` +{ +"TACPLUS_SERVER": { + "10.0.0.8": { + "priority": "1", + "tcp_port": "49" + }, + "10.0.0.9": { + "priority": "1", + "tcp_port": "49" + } + } +} +``` + + +### TC to Priority group map + +``` +{ +"TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` + +### TC to Queue map + +``` +{ +"TC_TO_QUEUE_MAP": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` + +### Versions + +This table is where the curret version of the software is recorded. +``` +{ + "VERSIONS": { + "DATABASE": { + "VERSION": "version_1_0_1" + } + } +} +``` + +### VLAN + +This table is where VLANs are defined. VLAN name is used as object key, +and member list as well as an integer id are defined as attributes. If a +DHCP relay is required for this VLAN, a dhcp_servers attribute must be +specified for that VLAN, the value of which is a list that must contain +the domain name or IP address of one or more DHCP servers. + +``` +{ +"VLAN": { + "Vlan1000": { + "dhcp_servers": [ + "192.0.0.1", + "192.0.0.2", + "192.0.0.3", + "192.0.0.4" + ], + "members": [ + "Ethernet0", + "Ethernet4", + "Ethernet8", + "Ethernet12" + ], + "vlanid": "1000" + } + } +} +``` + +### VLAN_MEMBER + +VLAN member table has Vlan name together with physical port or port +channel name as object key, and tagging mode as attributes. + +``` +{ +"VLAN_MEMBER": { + "Vlan1000|PortChannel47": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet8": { + "tagging_mode": "untagged" + }, + "Vlan2000|PortChannel47": { + "tagging_mode": "tagged" + } + } +} +``` + +### Virtual router + +The virtual router table allows to insert or update a new virtual router +instance. The key of the instance is its name. The attributes in the +table allow to change properties of a virtual router. Attributes: + +- 'v4' contains boolean value 'true' or 'false'. Enable or + disable IPv4 in the virtual router +- 'v6' contains boolean value 'true' or 'false'. Enable or + disable IPv6 in the virtual router +- 'src_mac' contains MAC address. What source MAC address will be + used for packets egressing from the virtual router +- 'ttl_action' contains packet action. Defines the action for + packets with TTL == 0 or TTL == 1 +- 'ip_opt_action' contains packet action. Defines the action for + packets with IP options +- 'l3_mc_action' contains packet action. Defines the action for + unknown L3 multicast packets + +The packet action could be: + +- 'drop' +- 'forward' +- 'copy' +- 'copy_cancel' +- 'trap' +- 'log' +- 'deny' +- 'transit' + + +***TBD*** +``` +'VRF:rid1': { + 'v4': 'true', + 'v6': 'false', + 'src_mac': '02:04:05:06:07:08', + 'ttl_action': 'copy', + 'ip_opt_action': 'deny', + 'l3_mc_action': 'drop' +} +``` + + +### WRED_PROFILE + +``` +{ +"WRED_PROFILE": { + "AZURE_LOSSLESS": { + "red_max_threshold": "2097152", + "wred_green_enable": "true", + "ecn": "ecn_all", + "green_min_threshold": "1048576", + "red_min_threshold": "1048576", + "wred_yellow_enable": "true", + "yellow_min_threshold": "1048576", + "green_max_threshold": "2097152", + "green_drop_probability": "5", + "yellow_max_threshold": "2097152", + "wred_red_enable": "true", + "yellow_drop_probability": "5", + "red_drop_probability": "5" + } + } +} +``` + +### BREAKOUT_CFG + +This table is introduced as part of Dynamic Port Breakout(DPB) feature. +It shows the current breakout mode of all ports(root ports). +The list of root ports, all possible breakout modes, and default breakout modes + are obtained/derived from platform.json and hwsku.json files. + +``` +"BREAKOUT_CFG": { + "Ethernet0": { + "brkout_mode": "4x25G[10G]" + }, + "Ethernet4": { + "brkout_mode": "4x25G[10G]" + }, + "Ethernet8": { + "brkout_mode": "4x25G[10G]" + }, + + ...... + + "Ethernet116": { + "brkout_mode": "2x50G" + }, + "Ethernet120": { + "brkout_mode": "2x50G" + }, + "Ethernet124": { + "brkout_mode": "2x50G" + } +} +``` + +### AAA + +The AAA table defined the method SONiC used for Authentication, Authorization and Accounting. +The method could be: +- default +- local +- tacacs+ +- radius + +``` +"AAA": { + "authentication": { + "login": "local" + }, + "authorization": { + "login": "local" + }, + "accounting": { + "login": "local" + } +} +``` + +For Developers +============== + +Generating Application Config by Jinja2 Template +------------------------------------------------ + +To be added. + +Incremental Configuration by Subscribing to ConfigDB +---------------------------------------------------- + +Detail instruction to be added. A sample could be found in this +[PR](https://github.com/Azure/sonic-buildimage/pull/861) that +implemented dynamic configuration for BGP. From 004dc699104a898c2ac5d5938661e2efeff47954 Mon Sep 17 00:00:00 2001 From: gechiang <62408185+gechiang@users.noreply.github.com> Date: Tue, 15 Mar 2022 11:50:33 -0700 Subject: [PATCH 37/54] [BRCM SAI 6.0.0.13-3] Fix Warmreboot issue (#10225) --- platform/broadcom/sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ce3470e6635c..e23515a1f5ea 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,4 +1,4 @@ -LIBSAIBCM_VERSION = 6.0.0.13-1 +LIBSAIBCM_VERSION = 6.0.0.13-3 LIBSAIBCM_BRANCH_NAME = REL_6.0 LIBSAIBCM_URL_PREFIX = "https://sonicstorage.blob.core.windows.net/public/sai/bcmsai/$(LIBSAIBCM_BRANCH_NAME)/$(LIBSAIBCM_VERSION)" From 98cfec29823720d3410a06d66f17597bb07891d8 Mon Sep 17 00:00:00 2001 From: FuzailBrcm <51665572+FuzailBrcm@users.noreply.github.com> Date: Wed, 16 Mar 2022 06:35:34 +0530 Subject: [PATCH 38/54] Using SFP refactoring framework in PDDF sfp class (#10047) * Using SFP refactoring framework in PDDF sfp class * Fixing a typo error --- .../sonic_platform_pddf_base/pddf_sfp.py | 1237 +---------------- 1 file changed, 66 insertions(+), 1171 deletions(-) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py index cf77986aba64..f11acf1a209b 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py @@ -5,164 +5,21 @@ ############################################################################# try: - import time - from ctypes import create_string_buffer - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sffbase - from sonic_platform_base.sonic_sfp.inf8628 import inf8628InterfaceId + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -# definitions of the offset and width for values in XCVR info eeprom -XCVR_INTFACE_BULK_OFFSET = 0 -XCVR_INTFACE_BULK_WIDTH_QSFP = 20 -XCVR_INTFACE_BULK_WIDTH_SFP = 21 -XCVR_TYPE_OFFSET = 0 -XCVR_TYPE_WIDTH = 1 -XCVR_EXT_TYPE_OFFSET = 1 -XCVR_EXT_TYPE_WIDTH = 1 -XCVR_CONNECTOR_OFFSET = 2 -XCVR_CONNECTOR_WIDTH = 1 -XCVR_COMPLIANCE_CODE_OFFSET = 3 -XCVR_COMPLIANCE_CODE_WIDTH = 8 -XCVR_ENCODING_OFFSET = 11 -XCVR_ENCODING_WIDTH = 1 -XCVR_NBR_OFFSET = 12 -XCVR_NBR_WIDTH = 1 -XCVR_EXT_RATE_SEL_OFFSET = 13 -XCVR_EXT_RATE_SEL_WIDTH = 1 -XCVR_CABLE_LENGTH_OFFSET = 14 -XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 -XCVR_CABLE_LENGTH_WIDTH_SFP = 6 -XCVR_VENDOR_NAME_OFFSET = 20 -XCVR_VENDOR_NAME_WIDTH = 16 -XCVR_VENDOR_OUI_OFFSET = 37 -XCVR_VENDOR_OUI_WIDTH = 3 -XCVR_VENDOR_PN_OFFSET = 40 -XCVR_VENDOR_PN_WIDTH = 16 -XCVR_HW_REV_OFFSET = 56 -XCVR_HW_REV_WIDTH_OSFP = 2 -XCVR_HW_REV_WIDTH_QSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_VENDOR_SN_OFFSET = 68 -XCVR_VENDOR_SN_WIDTH = 16 -XCVR_VENDOR_DATE_OFFSET = 84 -XCVR_VENDOR_DATE_WIDTH = 8 -XCVR_DOM_CAPABILITY_OFFSET = 92 -XCVR_DOM_CAPABILITY_WIDTH = 1 -# definitions of the offset for values in OSFP info eeprom -OSFP_TYPE_OFFSET = 0 -OSFP_VENDOR_NAME_OFFSET = 129 -OSFP_VENDOR_PN_OFFSET = 148 -OSFP_HW_REV_OFFSET = 164 -OSFP_VENDOR_SN_OFFSET = 166 - -# definitions of the offset and width for values in DOM info eeprom -QSFP_DOM_REV_OFFSET = 1 -QSFP_DOM_REV_WIDTH = 1 -QSFP_TEMPE_OFFSET = 22 -QSFP_TEMPE_WIDTH = 2 -QSFP_VOLT_OFFSET = 26 -QSFP_VOLT_WIDTH = 2 -QSFP_CHANNL_MON_OFFSET = 34 -QSFP_CHANNL_MON_WIDTH = 16 -QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 -QSFP_CONTROL_OFFSET = 86 -QSFP_CONTROL_WIDTH = 8 -QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 -QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 -QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 -QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 -QSFP_POWEROVERRIDE_OFFSET = 93 -QSFP_POWEROVERRIDE_WIDTH = 1 -QSFP_MODULE_THRESHOLD_OFFSET = 128 -QSFP_MODULE_THRESHOLD_WIDTH = 24 -QSFP_CHANNEL_THRESHOLD_OFFSET = 176 -QSFP_CHANNEL_THRESHOLD_WIDTH = 24 - - -SFP_TEMPE_OFFSET = 96 -SFP_TEMPE_WIDTH = 2 -SFP_VOLT_OFFSET = 98 -SFP_VOLT_WIDTH = 2 -SFP_CHANNL_MON_OFFSET = 100 -SFP_CHANNL_MON_WIDTH = 6 -SFP_MODULE_THRESHOLD_OFFSET = 0 -SFP_MODULE_THRESHOLD_WIDTH = 40 -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 1 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', - 'Length OM2(m)', 'Length OM1(m)', - 'Length Cable Assembly(m)') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', - 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', 'Fibre Channel Speed') - -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -INFO_OFFSET = 128 -DOM_OFFSET = 0 -DOM_OFFSET1 = 384 - - -class PddfSfp(SfpBase): +class PddfSfp(SfpOptoeBase): """ PDDF generic Sfp class """ pddf_obj = {} plugin_data = {} - _port_to_eeprom_mapping = {} _port_start = 0 _port_end = 0 - _port_to_type_mapping = {} - _qsfp_ports = [] - _sfp_ports = [] - - # Read out any bytes from any offset - def __read_eeprom_specific_bytes(self, offset, num_bytes): - sysfsfile_eeprom = None - eeprom_raw = [] - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - try: - sysfsfile_eeprom = open(self.eeprom_path, mode="rb", buffering=0) - sysfsfile_eeprom.seek(offset) - raw = sysfsfile_eeprom.read(num_bytes) - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - except Exception as e: - print("Error: Unable to open eeprom_path: %s" % (str(e))) - finally: - if sysfsfile_eeprom: - sysfsfile_eeprom.close() - - return eeprom_raw def __init__(self, index, pddf_data=None, pddf_plugin_data=None): if not pddf_data or not pddf_plugin_data: @@ -183,492 +40,49 @@ def __init__(self, index, pddf_data=None, pddf_plugin_data=None): self.port_index = index+1 self.device = 'PORT{}'.format(self.port_index) self.sfp_type = self.pddf_obj.get_device_type(self.device) - self.is_qsfp_port = True if (self.sfp_type == 'QSFP' or self.sfp_type == 'QSFP28') else False - self.is_osfp_port = True if (self.sfp_type == 'OSFP' or self.sfp_type == 'QSFP-DD') else False self.eeprom_path = self.pddf_obj.get_path(self.device, 'eeprom') - self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', - 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', - 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', - 'application_advertisement'] - - self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', - 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] - - self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] - - SfpBase.__init__(self) - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - type |1*255VCHAR |type of SFP - vendor_rev |1*255VCHAR |vendor revision of SFP - serial |1*255VCHAR |serial number of the SFP - manufacturer |1*255VCHAR |SFP vendor name - model |1*255VCHAR |SFP model name - connector |1*255VCHAR |connector information - encoding |1*255VCHAR |encoding information - ext_identifier |1*255VCHAR |extend identifier - ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance - cable_length |INT |cable length in m - nominal_bit_rate |INT |nominal bit rate by 100Mbs - specification_compliance |1*255VCHAR |specification compliance - vendor_date |1*255VCHAR |vendor date - vendor_oui |1*255VCHAR |vendor OUI - application_advertisement |1*255VCHAR |supported applications advertisement - ======================================================================== - """ - # check present status - if not self.get_presence(): - return None - - if self.is_osfp_port: - sfpi_obj = inf8628InterfaceId() - offset = 0 - type_offset = OSFP_TYPE_OFFSET - vendor_rev_width = XCVR_HW_REV_WIDTH_OSFP - hw_rev_offset = OSFP_HW_REV_OFFSET - vendor_name_offset = OSFP_VENDOR_NAME_OFFSET - vendor_pn_offset = OSFP_VENDOR_PN_OFFSET - vendor_sn_offset = OSFP_VENDOR_SN_OFFSET - interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP - sfp_type = 'OSFP' - - elif self.is_qsfp_port: - sfpi_obj = sff8436InterfaceId() - offset = 128 - type_offset = XCVR_TYPE_OFFSET - vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP - hw_rev_offset = XCVR_HW_REV_OFFSET - vendor_name_offset = XCVR_VENDOR_NAME_OFFSET - vendor_pn_offset = XCVR_VENDOR_PN_OFFSET - vendor_sn_offset = XCVR_VENDOR_SN_OFFSET - interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP - sfp_type = 'QSFP' - else: - sfpi_obj = sff8472InterfaceId() - offset = 0 - type_offset = XCVR_TYPE_OFFSET - vendor_rev_width = XCVR_HW_REV_WIDTH_SFP - hw_rev_offset = XCVR_HW_REV_OFFSET - vendor_name_offset = XCVR_VENDOR_NAME_OFFSET - vendor_pn_offset = XCVR_VENDOR_PN_OFFSET - vendor_sn_offset = XCVR_VENDOR_SN_OFFSET - interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_SFP - sfp_type = 'SFP' - - if sfpi_obj is None: - return None - - if self.is_osfp_port: - sfp_type_raw = self.__read_eeprom_specific_bytes((offset + type_offset), XCVR_TYPE_WIDTH) - if sfp_type_raw is not None: - sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) - sfp_type_abbrv_name = sfpi_obj.parse_sfp_type_abbrv_name(sfp_typ_raw, 0) - else: - sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_INTFACE_BULK_OFFSET), interface_info_bulk_width) - if sfp_interface_bulk_raw is not None: - sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk(sfp_interface_bulk_raw, 0) - - sfp_vendor_oui_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) - if sfp_vendor_oui_raw is not None: - sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_vendor_oui_raw, 0) - - sfp_vendor_date_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_DATE_OFFSET), XCVR_VENDOR_DATE_WIDTH) - if sfp_vendor_date_raw is not None: - sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_vendor_date_raw, 0) - - sfp_vendor_name_raw = self.__read_eeprom_specific_bytes( - (offset + vendor_name_offset), XCVR_VENDOR_NAME_WIDTH) - sfp_vendor_name_data = sfpi_obj.parse_vendor_name( - sfp_vendor_name_raw, 0) - - sfp_vendor_pn_raw = self.__read_eeprom_specific_bytes( - (offset + vendor_pn_offset), XCVR_VENDOR_PN_WIDTH) - sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( - sfp_vendor_pn_raw, 0) - - sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( - (offset + hw_rev_offset), vendor_rev_width) - sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( - sfp_vendor_rev_raw, 0) - - sfp_vendor_sn_raw = self.__read_eeprom_specific_bytes( - (offset + vendor_sn_offset), XCVR_VENDOR_SN_WIDTH) - sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( - sfp_vendor_sn_raw, 0) - - xcvr_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') - compliance_code_dict = dict() - - if sfp_interface_bulk_data: - xcvr_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] - xcvr_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] - xcvr_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] - xcvr_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] - xcvr_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] - xcvr_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] - else: - xcvr_info_dict['type'] = sfp_type_data['data']['type']['value'] if sfp_type_data else 'N/A' - xcvr_info_dict['type_abbrv_name'] = sfp_type_abbrv_name['data']['type_abbrv_name']['value'] \ - if sfp_type_abbrv_name else 'N/A' - - xcvr_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] \ - if sfp_vendor_name_data else 'N/A' - xcvr_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - xcvr_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] \ - if sfp_vendor_rev_data else 'N/A' - xcvr_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' - xcvr_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] \ - if sfp_vendor_oui_data else 'N/A' - xcvr_info_dict['vendor_date'] = sfp_vendor_date_data['data'][ - 'VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' - xcvr_info_dict['cable_type'] = "Unknown" - xcvr_info_dict['cable_length'] = "Unknown" - - if sfp_type == 'QSFP': - for key in qsfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - xcvr_info_dict['cable_type'] = key - xcvr_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) + SfpOptoeBase.__init__(self) - for key in qsfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance'][ - 'value'][key]['value'] - xcvr_info_dict['specification_compliance'] = str(compliance_code_dict) + def get_eeprom_path(self): + return self.eeprom_path - nkey = 'Nominal Bit Rate(100Mbs)' - if nkey in sfp_interface_bulk_data['data']: - xcvr_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) - else: - xcvr_info_dict['nominal_bit_rate'] = 'N/A' - elif sfp_type == 'OSFP': - pass - else: - for key in sfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - xcvr_info_dict['cable_type'] = key - xcvr_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) - - for key in sfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance'][ - 'value'][key]['value'] - xcvr_info_dict['specification_compliance'] = str(compliance_code_dict) - - xcvr_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - - return xcvr_info_dict - - def get_transceiver_bulk_status(self): + def get_name(self): """ - Retrieves transceiver bulk status of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. - tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. - reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. - lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. - tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. - tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 - | |to channel 3. - temperature |INT |module temperature in Celsius - voltage |INT |supply voltage in mV - txbias |INT |TX Bias Current in mA, n is the channel number, - | |for example, tx2bias stands for tx bias of channel 2. - rxpower |INT |received optical power in mW, n is the channel number, - | |for example, rx2power stands for rx power of channel 2. - txpower |INT |TX output power in mW, n is the channel number, - | |for example, tx2power stands for tx power of channel 2. - ======================================================================== + Retrieves the name of the device + Returns: + string: The name of the device """ - # check present status - if not self.get_presence(): - return None - - xcvr_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - - if self.is_osfp_port: - # Below part is added to avoid fail xcvrd, shall be implemented later - pass - elif self.is_qsfp_port: - # QSFPs - offset = 0 - offset_xcvr = 128 - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - sfpi_obj = sff8436InterfaceId() - if sfpi_obj is None: - return None - - qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - qspf_dom_capability_data = sfpi_obj.parse_dom_capability( - qsfp_dom_capability_raw, 0) - else: - return None - - dom_temperature_raw = self.__read_eeprom_specific_bytes((offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) - else: - return None - - dom_voltage_raw = self.__read_eeprom_specific_bytes((offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - else: - return None - - qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes((offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) - if qsfp_dom_rev_raw is not None: - qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) - else: - return None - - xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - dom_channel_monitor_data = {} - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['tx1power'] = 'N/A' - xcvr_dom_info_dict['tx2power'] = 'N/A' - xcvr_dom_info_dict['tx3power'] = 'N/A' - xcvr_dom_info_dict['tx4power'] = 'N/A' - else: - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( - dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] - xcvr_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] - xcvr_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] - xcvr_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] - - if dom_channel_monitor_raw: - xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] - xcvr_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] - xcvr_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] - xcvr_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] - xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] - xcvr_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] - xcvr_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] - xcvr_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] - - else: - # SFPs - offset = 256 - - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None - - dom_temperature_raw = self.__read_eeprom_specific_bytes((offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) - else: - return None - - dom_voltage_raw = self.__read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - else: - return None - - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value'] - xcvr_dom_info_dict['rx2power'] = 'N/A' - xcvr_dom_info_dict['rx3power'] = 'N/A' - xcvr_dom_info_dict['rx4power'] = 'N/A' - xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] - xcvr_dom_info_dict['tx2bias'] = 'N/A' - xcvr_dom_info_dict['tx3bias'] = 'N/A' - xcvr_dom_info_dict['tx4bias'] = 'N/A' - xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] - xcvr_dom_info_dict['tx2power'] = 'N/A' - xcvr_dom_info_dict['tx3power'] = 'N/A' - xcvr_dom_info_dict['tx4power'] = 'N/A' - - xcvr_dom_info_dict['rx_los'] = self.get_rx_los() - xcvr_dom_info_dict['tx_fault'] = self.get_tx_fault() - xcvr_dom_info_dict['reset_status'] = self.get_reset_status() - xcvr_dom_info_dict['lp_mode'] = self.get_lpmode() - - return xcvr_dom_info_dict + # Name of the port/sfp ? + return 'PORT{}'.format(self.port_index) - def get_transceiver_threshold_info(self): + def get_presence(self): """ - Retrieves transceiver threshold info of this SFP + Retrieves the presence of the PSU Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. - templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. - temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. - templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. - vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. - vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. - vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. - vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. - rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. - rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. - rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. - rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. - txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. - txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. - txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. - txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. - txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. - txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. - txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. - txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. - ======================================================================== + bool: True if PSU is present, False if not """ - # check present status - if not self.get_presence(): - return None - - xcvr_dom_threshold_info_dict = dict.fromkeys(self.threshold_dict_keys, 'N/A') - - if self.is_osfp_port: - # Below part is added to avoid fail xcvrd, shall be implemented later - pass - elif self.is_qsfp_port: - # QSFPs - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - offset = 384 - dom_thres_raw = self.__read_eeprom_specific_bytes( - (offset+QSFP_MODULE_THRESHOLD_OFFSET), QSFP_MODULE_THRESHOLD_WIDTH) - if dom_thres_raw: - module_threshold_values = sfpd_obj.parse_module_threshold_values( - dom_thres_raw, 0) - module_threshold_data = module_threshold_values.get('data') - if module_threshold_data: - xcvr_dom_threshold_info_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] - xcvr_dom_threshold_info_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] - xcvr_dom_threshold_info_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] - xcvr_dom_threshold_info_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] - xcvr_dom_threshold_info_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] - xcvr_dom_threshold_info_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] - xcvr_dom_threshold_info_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] - xcvr_dom_threshold_info_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] - - dom_thres_raw = self.__read_eeprom_specific_bytes((offset + QSFP_CHANNEL_THRESHOLD_OFFSET), - QSFP_CHANNEL_THRESHOLD_WIDTH) - if dom_thres_raw: - channel_threshold_values = sfpd_obj.parse_channel_threshold_values( - dom_thres_raw, 0) - ch_th_data = channel_threshold_values.get('data') - if ch_th_data: - xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = ch_th_data['RxPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = ch_th_data['RxPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = ch_th_data['RxPowerHighWarning']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = ch_th_data['RxPowerLowWarning']['value'] - xcvr_dom_threshold_info_dict['txpowerhighalarm'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txpowerlowalarm'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txpowerhighwarning'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txpowerlowwarning'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txbiashighalarm'] = ch_th_data['TxBiasHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiaslowalarm'] = ch_th_data['TxBiasLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiashighwarning'] = ch_th_data['TxBiasHighWarning']['value'] - xcvr_dom_threshold_info_dict['txbiaslowwarning'] = ch_th_data['TxBiasLowWarning']['value'] + output = self.pddf_obj.get_attr_name_output(self.device, 'xcvr_present') + if not output: + return False + mode = output['mode'] + modpres = output['status'].rstrip() + if 'XCVR' in self.plugin_data: + if 'xcvr_present' in self.plugin_data['XCVR']: + ptype = self.sfp_type + vtype = 'valmap-'+ptype + if vtype in self.plugin_data['XCVR']['xcvr_present'][mode]: + vmap = self.plugin_data['XCVR']['xcvr_present'][mode][vtype] + if modpres in vmap: + return vmap[modpres] + else: + return False + # if self.plugin_data doesn't specify anything regarding Transceivers + if modpres == '1': + return True else: - # SFPs - sfpd_obj = sff8472Dom() - offset = 256 - eeprom_ifraw = self.__read_eeprom_specific_bytes(0, offset) - sfpi_obj = sff8472InterfaceId(eeprom_ifraw) - cal_type = sfpi_obj.get_calibration_type() - sfpd_obj._calibration_type = cal_type - - dom_module_threshold_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) - if dom_module_threshold_raw is not None: - dom_mod_th_data = sfpd_obj.parse_alarm_warning_threshold( - dom_module_threshold_raw, 0) - - xcvr_dom_threshold_info_dict['temphighalarm'] = dom_mod_th_data['data']['TempHighAlarm']['value'] - xcvr_dom_threshold_info_dict['templowalarm'] = dom_mod_th_data['data']['TempLowAlarm']['value'] - xcvr_dom_threshold_info_dict['temphighwarning'] = dom_mod_th_data['data']['TempHighWarning']['value'] - xcvr_dom_threshold_info_dict['templowwarning'] = dom_mod_th_data['data']['TempLowWarning']['value'] - xcvr_dom_threshold_info_dict['vcchighalarm'] = dom_mod_th_data['data']['VoltageHighAlarm']['value'] - xcvr_dom_threshold_info_dict['vcclowalarm'] = dom_mod_th_data['data']['VoltageLowAlarm']['value'] - xcvr_dom_threshold_info_dict['vcchighwarning'] = dom_mod_th_data[ - 'data']['VoltageHighWarning']['value'] - xcvr_dom_threshold_info_dict['vcclowwarning'] = dom_mod_th_data['data']['VoltageLowWarning']['value'] - xcvr_dom_threshold_info_dict['txbiashighalarm'] = dom_mod_th_data['data']['BiasHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiaslowalarm'] = dom_mod_th_data['data']['BiasLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiashighwarning'] = dom_mod_th_data['data']['BiasHighWarning']['value'] - xcvr_dom_threshold_info_dict['txbiaslowwarning'] = dom_mod_th_data['data']['BiasLowWarning']['value'] - xcvr_dom_threshold_info_dict['txpowerhighalarm'] = dom_mod_th_data['data']['TXPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txpowerlowalarm'] = dom_mod_th_data['data']['TXPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txpowerhighwarning'] = dom_mod_th_data['data']['TXPowerHighWarning'][ - 'value'] - xcvr_dom_threshold_info_dict['txpowerlowwarning'] = dom_mod_th_data['data']['TXPowerLowWarning'][ - 'value'] - xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = dom_mod_th_data['data']['RXPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = dom_mod_th_data['data']['RXPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = dom_mod_th_data['data']['RXPowerHighWarning'][ - 'value'] - xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = dom_mod_th_data['data']['RXPowerLowWarning'][ - 'value'] - - return xcvr_dom_threshold_info_dict + return False def get_reset_status(self): """ @@ -677,20 +91,16 @@ def get_reset_status(self): A Boolean, True if reset enabled, False if disabled """ reset_status = None - if not self.get_presence(): - return reset_status - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_reset') - if not output: - return False - status = int(output['status'].rstrip()) + if output: + status = int(output['status'].rstrip()) - if status == 1: - reset_status = True - else: - reset_status = False + if status == 1: + reset_status = True + else: + reset_status = False return reset_status @@ -702,42 +112,19 @@ def get_rx_los(self): Note : RX LOS status is latched until a call to get_rx_los or a reset. """ rx_los = None - if not self.get_presence(): - return rx_los - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_rxlos') - if not output: - # read the values from EEPROM - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - rx_los_list = [] - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None - if dom_channel_monitor_raw is not None: - rx_los_data = int(dom_channel_monitor_raw[0], 16) - rx_los_list.append(rx_los_data & 0x01 != 0) - rx_los_list.append(rx_los_data & 0x02 != 0) - rx_los_list.append(rx_los_data & 0x04 != 0) - rx_los_list.append(rx_los_data & 0x08 != 0) - rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] - else: - # SFP ports - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw: - data = int(status_control_raw[0], 16) - rx_los = (sffbase().test_bit(data, 1) != 0) - - else: + if output: status = int(output['status'].rstrip()) if status == 1: rx_los = True else: rx_los = False + else: + # Use common SfpOptoeBase implementation for get_rx_los + rx_los = super().get_rx_los() return rx_los @@ -749,42 +136,19 @@ def get_tx_fault(self): Note : TX fault status is lached until a call to get_tx_fault or a reset. """ tx_fault = None - if not self.get_presence(): - return tx_fault - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_txfault') - if not output: - # read the values from EEPROM - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - tx_fault_list = [] - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) \ - if self.get_presence() else None - if dom_channel_monitor_raw is not None: - tx_fault_data = int(dom_channel_monitor_raw[0], 16) - tx_fault_list.append(tx_fault_data & 0x01 != 0) - tx_fault_list.append(tx_fault_data & 0x02 != 0) - tx_fault_list.append(tx_fault_data & 0x04 != 0) - tx_fault_list.append(tx_fault_data & 0x08 != 0) - tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] - else: - # SFP - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw: - data = int(status_control_raw[0], 16) - tx_fault = (sffbase().test_bit(data, 2) != 0) - else: + if output: status = int(output['status'].rstrip()) if status == 1: tx_fault = True else: tx_fault = False + else: + # Use common SfpOptoeBase implementation for get_tx_fault + tx_fault = super().get_tx_fault() return tx_fault @@ -795,86 +159,22 @@ def get_tx_disable(self): A Boolean, True if tx_disable is enabled, False if disabled """ tx_disable = False - if not self.get_presence(): - return tx_disable - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_txdisable') - if not output: - # read the values from EEPROM - if self.is_osfp_port: - return tx_disable - elif self.is_qsfp_port: - tx_disable_list = [] - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX1Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX2Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX3Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX4Disable']['value']) - - return tx_disable_list - else: - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw: - data = int(status_control_raw[0], 16) - tx_disable_hard = (sffbase().test_bit( - data, SFP_TX_DISABLE_HARD_BIT) != 0) - tx_disable_soft = (sffbase().test_bit( - data, SFP_TX_DISABLE_SOFT_BIT) != 0) - tx_disable = tx_disable_hard | tx_disable_soft - - return tx_disable - else: + if output: status = int(output['status'].rstrip()) if status == 1: tx_disable = True else: tx_disable = False + else: + # Use common SfpOptoeBase implementation for get_tx_disable + tx_disable = super().get_tx_disable() return tx_disable - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - Returns: - A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent - TX channels which have been disabled in this SFP. - As an example, a returned value of 0x5 indicates that channel 0 - and channel 2 have been disabled. - """ - if not self.get_presence(): - return 0 - - if self.is_osfp_port: - return 0 - elif self.is_qsfp_port: - tx_disable_list = self.get_tx_disable() - if tx_disable_list is None: - return 0 - tx_disabled = 0 - for i in range(len(tx_disable_list)): - if tx_disable_list[i]: - tx_disabled |= 1 << i - return tx_disabled - else: - # SFP doesnt support this - return 0 - def get_lpmode(self): """ Retrieves the lpmode (low power mode) status of this SFP @@ -882,162 +182,21 @@ def get_lpmode(self): A Boolean, True if lpmode is enabled, False if disabled """ lpmode = False - if not self.get_presence(): - return lpmode - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_lpmode') - if not output: - # Read from EEPROM - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - try: - eeprom = None - ctype = self.get_connector_type() - if ctype in ['Copper pigtail', 'No separable connector']: - return False - - eeprom = open(self.eeprom_path, "rb") - eeprom.seek(93) - status = ord(eeprom.read(1)) - - if ((status & 0x3) == 0x3): - # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1 - lpmode = True - else: - # High Power Mode if one of the following conditions is matched: - # 1. "Power override" bit is 0 - # 2. "Power override" bit is 1 and "Power set" bit is 0 - lpmode = False - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom is not None: - eeprom.close() - time.sleep(0.01) - else: - # SFP - pass - else: + if output: status = int(output['status'].rstrip()) if status == 1: lpmode = True else: lpmode = False - - return lpmode - - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - Returns: - A Boolean, True if power-override is enabled, False if disabled - """ - power_override = False - if not self.get_presence(): - return power_override - - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) - power_override = ('On' == dom_control_data['data']['PowerOverride']['value']) - else: - # SFP doesnt suppor this - pass - - return power_override - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - Returns: - An integer number of current temperature in Celsius - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - if transceiver_dom_info_dict is not None: - # returns None if temperature is not found in the dictionary - return transceiver_dom_info_dict.get("temperature") - else: - return None - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - Returns: - An integer number of supply voltage in mV - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - # returns None if voltage is not found in the dictionary - if transceiver_dom_info_dict is not None: - return transceiver_dom_info_dict.get("voltage") else: - return None + # Use common SfpOptoeBase implementation for get_lpmode + lpmode = super().get_lpmode() - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - Returns: - A list of four integer numbers, representing TX bias in mA - for channel 0 to channel 4. - Ex. ['110.09', '111.12', '108.21', '112.09'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - if transceiver_dom_info_dict is not None: - tx1_bs = transceiver_dom_info_dict.get("tx1bias", "N/A") - tx2_bs = transceiver_dom_info_dict.get("tx2bias", "N/A") - tx3_bs = transceiver_dom_info_dict.get("tx3bias", "N/A") - tx4_bs = transceiver_dom_info_dict.get("tx4bias", "N/A") - return [tx1_bs, tx2_bs, tx3_bs, tx4_bs] if transceiver_dom_info_dict else [] - else: - return None - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - Returns: - A list of four integer numbers, representing received optical - power in mW for channel 0 to channel 4. - Ex. ['1.77', '1.71', '1.68', '1.70'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - if transceiver_dom_info_dict is not None: - rx1_pw = transceiver_dom_info_dict.get("rx1power", "N/A") - rx2_pw = transceiver_dom_info_dict.get("rx2power", "N/A") - rx3_pw = transceiver_dom_info_dict.get("rx3power", "N/A") - rx4_pw = transceiver_dom_info_dict.get("rx4power", "N/A") - return [rx1_pw, rx2_pw, rx3_pw, rx4_pw] if transceiver_dom_info_dict else [] - else: - return None - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - Returns: - A list of four integer numbers, representing TX power in mW - for channel 0 to channel 4. - Ex. ['1.86', '1.86', '1.86', '1.86'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - if transceiver_dom_info_dict is not None: - tx1_pw = transceiver_dom_info_dict.get("tx1power", "N/A") - tx2_pw = transceiver_dom_info_dict.get("tx2power", "N/A") - tx3_pw = transceiver_dom_info_dict.get("tx3power", "N/A") - tx4_pw = transceiver_dom_info_dict.get("tx4power", "N/A") - return [tx1_pw, tx2_pw, tx3_pw, tx4_pw] - else: - return None + return lpmode def get_intr_status(self): """ @@ -1068,17 +227,10 @@ def reset(self): A boolean, True if successful, False if not """ status = False - if not self.get_presence(): - return status - device = 'PORT{}'.format(self.port_index) - # TODO: Implement a wrapper set function to write the sequence path = self.pddf_obj.get_path(device, 'xcvr_reset') - # TODO: put the optic based reset logic using EEPROM - if path is None: - pass - else: + if path: try: f = open(path, 'r+') except IOError as e: @@ -1095,6 +247,9 @@ def reset(self): status = True except IOError as e: status = False + else: + # Use common SfpOptoeBase implementation for reset + status = super().reset() return status @@ -1109,61 +264,11 @@ def tx_disable(self, tx_disable): """ # find out a generic implementation of tx_disable for SFP, QSFP and OSFP status = False - if not self.get_presence(): - return tx_disable - device = 'PORT{}'.format(self.port_index) path = self.pddf_obj.get_path(device, 'xcvr_txdisable') # TODO: put the optic based reset logic using EEPROM - if path is None: - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - eeprom_f = None - try: - txdisable_ctl = 0xf if tx_disable else 0x0 - buf = create_string_buffer(1) - buf[0] = bytes([txdisable_ctl]) - # Write to eeprom - eeprom_f = open(self.eeprom_path, "r+b") - eeprom_f.seek(QSFP_CONTROL_OFFSET) - eeprom_f.write(buf[0]) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom_f is not None: - eeprom_f.close() - time.sleep(0.01) - - status = True - else: - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw is not None: - # Set bit 6 for Soft TX Disable Select - # 01000000 = 64 and 10111111 = 191 - txdisable_bit = 64 if tx_disable else 191 - status_control = int(status_control_raw[0], 16) - txdisable_ctl = (status_control | txdisable_bit) if tx_disable else ( - status_control & txdisable_bit) - try: - eeprom_f = open(self.eeprom_path, mode="r+b", buffering=0) - buf = create_string_buffer(1) - buf[0] = bytes([txdisable_ctl]) - # Write to eeprom - eeprom_f.seek(SFP_STATUS_CONTROL_OFFSET) - eeprom_f.write(buf[0]) - except Exception as e: - print(("Error: unable to open file: %s" % str(e))) - return False - finally: - if eeprom_f: - eeprom_f.close() - time.sleep(0.01) - status = True - else: + if path: try: f = open(path, 'r+') except IOError as e: @@ -1178,48 +283,10 @@ def tx_disable(self, tx_disable): status = True except IOError as e: status = False - - return status - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - Args: - channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, - e.g. 0x5 for channel 0 and channel 2. - disable : A boolean, True to disable TX channels specified in channel, - False to enable - Returns: - A boolean, True if successful, False if not - """ - # TODO: find a implementation - status = False - if not self.get_presence(): - return status - - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - eeprom_f = None - try: - channel_state = self.get_tx_disable_channel() - txdisable_ctl = (channel_state | channel) if disable else (channel_state & ~channel) - buf = create_string_buffer(1) - buf[0] = bytes([txdisable_ctl]) - # Write to eeprom - eeprom_f = open(self.eeprom_path, "r+b") - eeprom_f.seek(QSFP_CONTROL_OFFSET) - eeprom_f.write(buf[0]) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom_f is not None: - eeprom_f.close() - time.sleep(0.01) - status = True else: - pass + # Use common SfpOptoeBase implementation for tx_disable + status = super().tx_disable(tx_disable) + return status @@ -1233,44 +300,10 @@ def set_lpmode(self, lpmode): A boolean, True if lpmode is set successfully, False if not """ status = False - if not self.get_presence(): - return status - device = 'PORT{}'.format(self.port_index) path = self.pddf_obj.get_path(device, 'xcvr_lpmode') - # TODO: put the optic based reset logic using EEPROM - if path is None: - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - try: - eeprom_f = None - ctype = self.get_connector_type() - if ctype in ['Copper pigtail', 'No separable connector']: - return False - - # Fill in write buffer - regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode - buffer = create_string_buffer(1) - buffer[0] = bytes([regval]) - - # Write to eeprom - eeprom_f = open(self.eeprom_path, "r+b") - eeprom_f.seek(93) - eeprom_f.write(buffer[0]) - return True - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom_f is not None: - eeprom_f.close() - time.sleep(0.01) - else: - pass - - else: + if path: try: f = open(path, 'r+') except IOError as e: @@ -1286,149 +319,11 @@ def set_lpmode(self, lpmode): status = True except IOError as e: status = False - - return status - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - Args: - power_override : - A Boolean, True to override set_lpmode and use power_set - to control SFP power, False to disable SFP power control - through power_override/power_set and use set_lpmode - to control SFP power. - power_set : - Only valid when power_override is True. - A Boolean, True to set SFP to low power mode, False to set - SFP to high power mode. - Returns: - A boolean, True if power-override and power_set are set successfully, - False if not - """ - status = False - if not self.get_presence(): - return status - - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - try: - power_override_bit = 0 - if power_override: - power_override_bit |= 1 << 0 - - power_set_bit = 0 - if power_set: - power_set_bit |= 1 << 1 - - buffer = create_string_buffer(1) - buffer[0] = bytes([power_override_bit | power_set_bit]) - # Write to eeprom - eeprom_f = open(self.eeprom_path, "r+b") - eeprom_f.seek(QSFP_POWEROVERRIDE_OFFSET) - eeprom_f.write(buffer[0]) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom_f is not None: - eeprom_f.close() - time.sleep(0.01) - return True else: - pass + # Use common SfpOptoeBase implementation for set_lpmode + status = super().set_lpmode(lpmode) return status - def get_name(self): - """ - Retrieves the name of the device - Returns: - string: The name of the device - """ - # Name of the port/sfp ? - return 'PORT{}'.format(self.port_index) - - def get_presence(self): - """ - Retrieves the presence of the PSU - Returns: - bool: True if PSU is present, False if not - """ - output = self.pddf_obj.get_attr_name_output(self.device, 'xcvr_present') - if not output: - return False - - mode = output['mode'] - modpres = output['status'].rstrip() - if 'XCVR' in self.plugin_data: - if 'xcvr_present' in self.plugin_data['XCVR']: - ptype = self.sfp_type - vtype = 'valmap-'+ptype - if vtype in self.plugin_data['XCVR']['xcvr_present'][mode]: - vmap = self.plugin_data['XCVR']['xcvr_present'][mode][vtype] - if modpres in vmap: - return vmap[modpres] - else: - return False - # if self.plugin_data doesn't specify anything regarding Transceivers - if modpres == '1': - return True - else: - return False - - def get_model(self): - """ - Retrieves the model number (or part number) of the device - Returns: - string: Model/part number of device - """ - transceiver_dom_info_dict = self.get_transceiver_info() - if transceiver_dom_info_dict is not None: - return transceiver_dom_info_dict.get("model", "N/A") - else: - return None - - def get_serial(self): - """ - Retrieves the serial number of the device - Returns: - string: Serial number of device - """ - transceiver_dom_info_dict = self.get_transceiver_info() - if transceiver_dom_info_dict is not None: - return transceiver_dom_info_dict.get("serial", "N/A") - else: - return None - - def get_status(self): - """ - Retrieves the operational status of the device - Returns: - A boolean value, True if device is operating properly, False if not - """ - return self.get_presence() and self.get_transceiver_bulk_status() - - def get_connector_type(self): - """ - Retrieves the device connector type - Returns: - enum: connector_code - """ - transceiver_dom_info_dict = self.get_transceiver_info() - if transceiver_dom_info_dict is not None: - return transceiver_dom_info_dict.get("connector", "N/A") - else: - return None - - def get_transceiver_change_event(self): - """ - TODO: This function need to be implemented - when decide to support monitoring SFP(Xcvrd) - on this platform. - """ - raise NotImplementedError - def dump_sysfs(self): return self.pddf_obj.cli_dump_dsysfs('xcvr') From 5617b1ae3efc6cee52b875651135ada67898ebf0 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Tue, 15 Mar 2022 18:12:49 -0700 Subject: [PATCH 39/54] Image disk space reduction (#10172) # Why I did it Reduce the disk space taken up during bootup and runtime. # How I did it 1. Remove python package cache from the base image and from the containers. 2. During bootup, if logs are to be stored in memory, then don't create the `var-log.ext4` file just to delete it later during bootup. 3. For the partition containing `/host`, don't reserve any blocks for just the root user. This just makes sure all disk space is available for all users, if needed during upgrades (for example). * Remove pip2 and pip3 caches from some containers Only containers which appeared to have a significant pip cache size are included here. Signed-off-by: Saikrishna Arcot * Don't create var-log.ext4 if we're storing logs in memory Signed-off-by: Saikrishna Arcot * Run tune2fs on the device containing /host to not reserve any blocks for just the root user Signed-off-by: Saikrishna Arcot --- dockers/docker-base-bullseye/Dockerfile.j2 | 2 +- dockers/docker-base-buster/Dockerfile.j2 | 2 +- dockers/docker-config-engine-bullseye/Dockerfile.j2 | 2 +- dockers/docker-config-engine-buster/Dockerfile.j2 | 2 +- dockers/docker-orchagent/Dockerfile.j2 | 2 +- dockers/docker-sonic-mgmt-framework/Dockerfile.j2 | 2 +- files/Aboot/boot0.j2 | 7 ++++++- files/initramfs-tools/varlog | 10 ++++++++++ installer/arm64/install.sh | 5 +++++ installer/armhf/install.sh | 5 +++++ installer/x86_64/install.sh | 11 +++++++++++ 11 files changed, 43 insertions(+), 7 deletions(-) diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 index 1b33003ce0a9..cae555174174 100644 --- a/dockers/docker-base-bullseye/Dockerfile.j2 +++ b/dockers/docker-base-bullseye/Dockerfile.j2 @@ -102,7 +102,7 @@ RUN apt-get -y purge \ RUN apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ - rm -rf /var/lib/apt/lists/* /tmp/* + rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] diff --git a/dockers/docker-base-buster/Dockerfile.j2 b/dockers/docker-base-buster/Dockerfile.j2 index e16a0f677b07..52c784e9a7fe 100644 --- a/dockers/docker-base-buster/Dockerfile.j2 +++ b/dockers/docker-base-buster/Dockerfile.j2 @@ -121,7 +121,7 @@ RUN apt-get -y purge \ RUN apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ - rm -rf /var/lib/apt/lists/* /tmp/* + rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache/ COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] diff --git a/dockers/docker-config-engine-bullseye/Dockerfile.j2 b/dockers/docker-config-engine-bullseye/Dockerfile.j2 index 84785d0669f1..9d0ca97c7604 100644 --- a/dockers/docker-config-engine-bullseye/Dockerfile.j2 +++ b/dockers/docker-config-engine-bullseye/Dockerfile.j2 @@ -49,4 +49,4 @@ RUN apt-get purge -y \ apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ - rm -rf /debs /python-wheels + rm -rf /debs /python-wheels ~/.cache diff --git a/dockers/docker-config-engine-buster/Dockerfile.j2 b/dockers/docker-config-engine-buster/Dockerfile.j2 index 3022546a068c..1e7a64bfcd36 100644 --- a/dockers/docker-config-engine-buster/Dockerfile.j2 +++ b/dockers/docker-config-engine-buster/Dockerfile.j2 @@ -49,4 +49,4 @@ RUN apt-get purge -y \ apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ - rm -rf /debs /python-wheels + rm -rf /debs /python-wheels ~/.cache diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 5e403213c1d4..f71f31cfc0ac 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -64,7 +64,7 @@ RUN apt-get purge -y \ apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ - rm -rf /debs + rm -rf /debs ~/.cache COPY ["files/arp_update", "/usr/bin"] COPY ["arp_update.conf", "files/arp_update_vars.j2", "/usr/share/sonic/templates/"] diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index d727ac449d46..937c5368483a 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -34,6 +34,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] RUN apt-get remove -y g++ python3-dev RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +RUN rm -rf /debs ~/.cache ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 38eb8b5fe78a..7306c36cfc0c 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -351,7 +351,12 @@ extract_image() { unzip -oq "$swipath" -x boot0 "$dockerfs" -d "$image_path" ## detect rootfs type - rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3` + local mountstr="$(grep " $target_path " /proc/mounts)" + local rootdev="$(echo $mountstr | cut -f1 -d' ')" + rootfs_type="$(echo $mountstr | cut -d' ' -f3)" + + ## Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $rootdev info "Extracting $dockerfs from swi" ## Unpacking dockerfs delayed diff --git a/files/initramfs-tools/varlog b/files/initramfs-tools/varlog index e8063e41a59c..980b24523452 100644 --- a/files/initramfs-tools/varlog +++ b/files/initramfs-tools/varlog @@ -11,17 +11,27 @@ case $1 in ;; esac +logs_inram=false + # Extract kernel parameters set -- $(cat /proc/cmdline) for x in "$@"; do case "$x" in varlog_size=*) varlog_size="${x#varlog_size=}" + ;; + logs_inram=on) + logs_inram=true + ;; esac done [ -z "$varlog_size" ] && exit 0 +# If logs are being stored in memory, then don't bother +# creating the log file just to have it deleted afterwards. +$logs_inram && exit 0 + # exit when the var_log.ext4 exists and the size matches if [ -e "${rootmnt}/host/disk-img/var-log.ext4" ]; then cur_varlog_size=$(ls -l ${rootmnt}/host/disk-img/var-log.ext4 | awk '{print $5}') diff --git a/installer/arm64/install.sh b/installer/arm64/install.sh index dee3ceec9038..249c5b521700 100755 --- a/installer/arm64/install.sh +++ b/installer/arm64/install.sh @@ -139,6 +139,11 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done + + demo_dev=$(findmnt -n -o SOURCE --target /host) + + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev fi # Create target directory or clean it up if exists diff --git a/installer/armhf/install.sh b/installer/armhf/install.sh index 9ade40d5149e..8cffa755734f 100755 --- a/installer/armhf/install.sh +++ b/installer/armhf/install.sh @@ -139,6 +139,11 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done + + demo_dev=$(findmnt -n -o SOURCE --target /host) + + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev fi # Create target directory or clean it up if exists diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index dbab4d54ab72..950d765d2418 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -477,6 +477,9 @@ if [ "$install_env" = "onie" ]; then # Make filesystem mkfs.ext4 -L $demo_volume_label $demo_dev + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev + # Mount demo filesystem demo_mnt=$(${onie_bin} mktemp -d) || { echo "Error: Unable to create file system mount point" @@ -509,12 +512,20 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done + + demo_dev=$(findmnt -n -o SOURCE --target /host) + + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev else demo_mnt="build_raw_image_mnt" demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" mkfs.ext4 -L $demo_volume_label $demo_dev + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev + echo "Mounting $demo_dev on $demo_mnt..." mkdir $demo_mnt mount -t auto -o loop $demo_dev $demo_mnt From c5849c9650f099428f10207992b58623445db314 Mon Sep 17 00:00:00 2001 From: Oleksandr Kozodoi Date: Wed, 16 Mar 2022 06:00:51 +0200 Subject: [PATCH 40/54] Add scapy support for python3 virtual environment in the sonic-mgmt docker container (#10234) Why I did it Migration of sonic-mgmt codebase from Python 2 to Python 3 How I did it Added scapy dependencies to the env-python3 virtual environment. How to verify it Run test case: py.test --testbed=testbed-t0 --inventory=../ansible/lab --testbed_file=../ansible/testbed.csv --host-pattern=testbed-t0 -- module-path=../ansible/library lldp Signed-off-by: Oleksandr Kozodoi --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index df26f2ccf38c..99ad9fa8fb80 100755 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -245,7 +245,8 @@ RUN python3 -m pip install setuptools-rust \ allure-pytest==2.8.22 \ retry \ thrift==0.11.0 \ - ptf + ptf \ + scapy==2.4.5 # Deactivating a virtualenv. ENV PATH="$BACKUP_OF_PATH" From 5c7aa50463512e16fefe564c80eb8838a49a3ee2 Mon Sep 17 00:00:00 2001 From: Arun Saravanan Balachandran <52521751+ArunSaravananBalachandran@users.noreply.github.com> Date: Thu, 17 Mar 2022 02:46:26 +0530 Subject: [PATCH 41/54] DellEMC: Z9332f - Component API Fixes (#10187) --- .../common/ipmihelper.py | 5 ++- .../common/onie_stage_fwpkg | 2 +- .../common/sonic_platform/hwaccess.py | 5 ++- .../z9332f/sonic_platform/component.py | 38 +++++++++++++++---- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/common/ipmihelper.py b/platform/broadcom/sonic-platform-modules-dell/common/ipmihelper.py index d95329c40de2..3908f90bdad4 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/ipmihelper.py +++ b/platform/broadcom/sonic-platform-modules-dell/common/ipmihelper.py @@ -90,7 +90,10 @@ def get_twos_complement(val, bits): R_exp = get_twos_complement((factors[6] & 0xF0) >> 4, 4) B_exp = get_twos_complement(factors[6] & 0x0F, 4) - converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp + if R_exp < 0: + converted_reading = ((M * raw_value) + (B * 10**B_exp)) / 10**(-R_exp) + else: + converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp return True, converted_reading diff --git a/platform/broadcom/sonic-platform-modules-dell/common/onie_stage_fwpkg b/platform/broadcom/sonic-platform-modules-dell/common/onie_stage_fwpkg index 1ceaf32fe8c1..dcc74a09a91e 100755 --- a/platform/broadcom/sonic-platform-modules-dell/common/onie_stage_fwpkg +++ b/platform/broadcom/sonic-platform-modules-dell/common/onie_stage_fwpkg @@ -45,7 +45,7 @@ function show_help_and_exit() echo " " echo " Available options:" echo " -h, -? : getting this help" - echo " -o [fwpkg] : stages the firmware update package" + echo " -a [fwpkg] : stages the firmware update package" exit 0 } diff --git a/platform/broadcom/sonic-platform-modules-dell/common/sonic_platform/hwaccess.py b/platform/broadcom/sonic-platform-modules-dell/common/sonic_platform/hwaccess.py index 373f71bdd5bf..642a6ddc6fc8 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/sonic_platform/hwaccess.py +++ b/platform/broadcom/sonic-platform-modules-dell/common/sonic_platform/hwaccess.py @@ -39,7 +39,10 @@ def pci_set_value(resource, val, offset): # Read I2C device def i2c_get(bus, i2caddr, ofs): - return int(subprocess.check_output(['/usr/sbin/i2cget', '-y', str(bus), str(i2caddr), str(ofs)]), 16) + try: + return int(subprocess.check_output(['/usr/sbin/i2cget', '-y', str(bus), str(i2caddr), str(ofs)]), 16) + except (FileNotFoundError, subprocess.CalledProcessError): + return -1 def io_reg_read(io_resource, offset): fd = os.open(io_resource, os.O_RDONLY) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py index f652c2eccf85..214467f8c35d 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py @@ -23,20 +23,36 @@ def get_bios_version(): - return subprocess.check_output( - ['dmidecode', '-s', 'bios-version']).decode('utf-8').strip() + try: + return subprocess.check_output(['dmidecode', '-s', 'bios-version'], + text=True).strip() + except (FileNotFoundError, subprocess.CalledProcessError): + return 'NA' def get_fpga_version(): val = hwaccess.pci_get_value('/sys/bus/pci/devices/0000:09:00.0/resource0', 0) return '{}.{}'.format((val >> 16) & 0xffff, val & 0xffff) def get_bmc_version(): - return subprocess.check_output( - ['cat', '/sys/class/ipmi/ipmi0/device/bmc/firmware_revision'] - ).decode('utf-8').strip() + val = 'NA' + try: + bmc_ver = subprocess.check_output(['ipmitool', 'mc', 'info'], + stderr=subprocess.STDOUT, text=True) + except (FileNotFoundError, subprocess.CalledProcessError): + pass + else: + version = re.search(r'Firmware Revision\s*:\s(.*)', bmc_ver) + if version: + val = version.group(1).strip() + + return val def get_cpld_version(bus, i2caddr): - return '{}'.format(hwaccess.i2c_get(bus, i2caddr, 0)) + val = hwaccess.i2c_get(bus, i2caddr, 0) + if val != -1: + return '{:x}.{:x}'.format((val >> 4) & 0xf, val & 0xf) + else: + return 'NA' def get_cpld0_version(): return get_cpld_version(5, 0x0d) @@ -69,7 +85,7 @@ def get_pciephy_version(): except (FileNotFoundError, subprocess.CalledProcessError): pass else: - version = re.search(r'PCIe FW loader version:\s(.*)', pcie_ver) + version = re.search(r'PCIe FW version:\s(.*)', pcie_ver) if version: val = version.group(1).strip() @@ -158,6 +174,14 @@ def _get_available_firmware_version(image_path): ver_info = ver_info.get("x86_64-dellemc_z9332f_d1508-r0") if ver_info: + components = list(ver_info.keys()) + for component in components: + if "CPLD" in component and ver_info[component].get('version'): + val = ver_info.pop(component) + ver = int(val['version'], 16) + val['version'] = "{:x}.{:x}".format((ver >> 4) & 0xf, ver & 0xf) + ver_info[component.replace("-", " ")] = val + return True, ver_info else: return False, "ERROR: Version info not available" From e1f57db81863ab1fc63b5204d3e75195eafbb7b7 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Fri, 18 Mar 2022 01:16:43 +0800 Subject: [PATCH 42/54] [Submodule]: Update sonic-restapi (#10257) #### Why I did it ``` Update submodule sonic-restapi bd97dfe Fix urllib3 CVE-2021-33503 issue (#104) f159bfa Upgrade the containers to be based on Debian Buster (#103) a1830c1 (origin/201911) Fix OpenAPI spec to be readable by autorest (#101) ``` --- src/sonic-restapi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-restapi b/src/sonic-restapi index 94805a39ac07..bd97dfeb4b45 160000 --- a/src/sonic-restapi +++ b/src/sonic-restapi @@ -1 +1 @@ -Subproject commit 94805a39ac0712219f7dc08faa2cfdbf371dd177 +Subproject commit bd97dfeb4b4564defbc10e521ee05bbfe0638315 From 52c2a3ad230ddef314418cd2906d889da375f5ec Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Thu, 17 Mar 2022 10:26:03 -0700 Subject: [PATCH 43/54] [yang] Fixing Ethertype field regex in acl rule yang to accept decimal values (#10108) #### Why I did it Fixing issue https://github.com/Azure/sonic-buildimage/issues/9991 The ACL RULE table field ETHER_TYPE can accept both hex as well as decimal values. However yang model didn't allow decimal values. Fixed it to allow decimal values (same pattern as in hex (1536-65535) #### How I did it Updated yang model to handle decimal values #### How to verify it Added UT to verify it. --- .../tests/files/sample_config_db.json | 3 +- .../tests/yang_model_tests/tests/acl.json | 9 ++- .../yang_model_tests/tests_config/acl.json | 60 ++++++++++++++++++- .../yang-templates/sonic-acl.yang.j2 | 2 +- 4 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 920181646c46..ae0cc60da648 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -150,7 +150,8 @@ "V4-ACL-TABLE|DEFAULT_DENY": { "PACKET_ACTION": "DROP", "IP_TYPE": "IPv4ANY", - "PRIORITY": "0" + "PRIORITY": "0", + "ETHER_TYPE": "2048" }, "V4-ACL-TABLE|Rule_20": { "PACKET_ACTION": "FORWARD", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json index 980622cbd3e8..243554d60f9a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json @@ -100,7 +100,14 @@ "eStrKey" : "Pattern" }, "ACL_RULE_L2_INVALID_ETHER": { - "desc": "Configure invalid MAC address format.", + "desc": "Configure invalid ethertype.", + "eStrKey" : "Pattern" + }, + "ACL_RULE_L2_VALID_ETHER_IN_DECIMAL": { + "desc": "Configure valid ethertype in decimal format." + }, + "ACL_RULE_L2_INVALID_ETHER_IN_DECIMAL": { + "desc": "Configure invalid ethertype in decimal format.", "eStrKey" : "Pattern" }, "ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json index b2aa6b3fb15d..4829eb3971dc 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json @@ -768,8 +768,8 @@ "ACL_RULE_LIST": [ { "ACL_TABLE_NAME": "L2ACL_INVALID_ETHER", - "SRC_MAC": "00.00.AB.CD.EF.00/FF.FF.FF.00.00.00", - "DST_MAC": "00.00.AB.CD.EF.FF/FF.FF.FF.FF.FF.FF", + "SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00", + "DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF", "ETHER_TYPE": "64", "PACKET_ACTION": "FORWARD", "PRIORITY": 999980, @@ -790,6 +790,62 @@ } } }, + "ACL_RULE_L2_VALID_ETHER_IN_DECIMAL": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_VALID_ETHER_DECIMAL", + "SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00", + "DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF", + "ETHER_TYPE": "2048", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_VALID_ETHER_DECIMAL", + "policy_desc": "L2ACL Test", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L2" + } + ] + } + } + }, + "ACL_RULE_L2_INVALID_ETHER_IN_DECIMAL": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_INVALID_ETHER_DECIMAL", + "SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00", + "DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF", + "ETHER_TYPE": "66789", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_INVALID_ETHER_DECIMAL", + "policy_desc": "L2ACL Test", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L2" + } + ] + } + } + }, "ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": { "sonic-acl:sonic-acl": { "sonic-acl:ACL_RULE": { diff --git a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 index d007f82e0964..9fd442297c9f 100644 --- a/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 @@ -168,7 +168,7 @@ module sonic-acl { leaf ETHER_TYPE { type string { - pattern "0x0[6-9a-fA-F][0-9a-fA-F]{2}|0x[1-9a-fA-F][0-9a-fA-F]{3}"; + pattern "0x0[6-9a-fA-F][0-9a-fA-F]{2}|0x[1-9a-fA-F][0-9a-fA-F]{3}|153[6-9]|15[4-9][0-9]|1[6-9][0-9][0-9]|[2-9][0-9]{3}|[1-5][0-9]{4}|6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}"; } } From ad6200029f3176eef4d08d519aac7f5ef76f0ac8 Mon Sep 17 00:00:00 2001 From: Jeff Henning <94179951+jeffhtgt@users.noreply.github.com> Date: Thu, 17 Mar 2022 19:47:08 -0500 Subject: [PATCH 44/54] Edgecore 4630/5835/7326/7816 API2.0 platform support (#10053) * Initial pass of EdgeCore platform changes. * Remove libevent dependency from lldpd. * Remove python2 dependencies python3.7 force from platform install script. * Include usbmount support changes. * Add missing 4630 install file. * Update a few file permissions. Add umask line to Makefile. Specify python3.9 in install script. * Misc platform updates: - Add missing fan drawer component to sonic_platform - Remove kernel version specification from Makefile - Update to 4630 utility * - Fix file permissions on source files - Fix compile issue with 4630 driver modules (set_fs, get_fs, no longer supported in kernel 5.10) * Fix missing/extra parens in 4630 util script. * Fix indentation in fanutil.py. * Integrate deltas from Edgecore to ec_platform branch. * Installer update from Edgecore to resolve smbus serial console errors. * Update stable_size for warm boot. * Fix SFP dictionary key to match xcvrd. * - Add missing define in event.py files needed for xcvrd - Fix SFP info dict key for 7xxx switches * 5835 platform file updates including installer and 5835 utility. * 5835 fix for DMAR errors on serial console. * Don't skip starting thermalctld in the pmon container. * Revert several changes that were not related to platform. * Run thermalctld in pmon container. * Don't disable thermalctld in the pmon container. * Fix prints/parens in 7816 install utility. * - Incorporate 7816 changes from Edgecore - Fix 7326 driver file using old kernel function * Update kernel modules to use kernel_read(). * Fix compile errors with 7816 and 7326 driver modules. * Fix some indents preventing platform files from loading. * Update 7816 platform sfp dictionary to match field names in xcvrd. * Add missing service and util files for 7816. * Update file names, etc. based on full SKU for 7816. * Delete pddf files not needed. These were causing conflicts with API2.0 implementation. * Remove pddf files suggested by Edgecore that were preventing API2.0 support from starting. * Install API2.0 file instead of pddf. * Update 7326 mac service file to not use pddf. Fix syntax errors in 7326 utility script. * Fix sonic_platform setup file for 7326. * Fix syntax errors in python scripts. * Updates to 7326 platform files. * Fix some tab errors pulled down from master merge. * Remove pddf files that were added from previous merge. * Updates for 5835. * Fix missing command byte for 5835 psu status. * Fix permission bits on 4630 service files. * Update platforms to use new SFP refactoring. * Fix unused var warnings. --- .../hx5-as4630-48x1G+4x25G+2x100G.bcm | 2 +- .../pddf/pd-plugin.json | 66 - .../x86_64-accton_as4630_54pe-r0/pddf_support | 0 .../sonic_platform/__init__.py | 2 + .../sonic_platform/chassis.py | 255 ++ .../sonic_platform/component.py | 172 + .../sonic_platform/eeprom.py | 134 + .../sonic_platform/event.py | 63 + .../sonic_platform/fan.py | 284 ++ .../sonic_platform/fan_drawer.py | 90 + .../sonic_platform/helper.py | 117 + .../sonic_platform/platform.py | 21 + .../sonic_platform/psu.py | 269 ++ .../sonic_platform/sfp.py | 484 +++ .../sonic_platform/thermal.py | 236 ++ .../installer.conf | 1 - .../plugins/sfputil.py | 2 +- .../pmon_daemon_control.json | 2 +- .../sonic_platform/__init__.py | 2 +- .../sonic_platform/chassis.py | 94 +- .../sonic_platform/component.py | 58 +- .../sonic_platform/eeprom.py | 7 +- .../sonic_platform/event.py | 47 +- .../sonic_platform/fan.py | 95 +- .../sonic_platform/fan_drawer.py | 90 + .../sonic_platform/helper.py | 2 +- .../sonic_platform/psu.py | 23 +- .../sonic_platform/sfp.py | 730 +---- .../sonic_platform/thermal.py | 131 +- .../system_health_monitoring_config.json | 15 + .../pddf/pd-plugin.json | 67 - .../pddf/pddf-device.json | 2916 ----------------- .../x86_64-accton_as7326_56x-r0/pddf_support | 0 .../plugins/eeprom.py | 7 +- .../pmon_daemon_control.json | 2 +- .../sonic_platform/__init__.py | 2 + .../sonic_platform/chassis.py | 264 ++ .../sonic_platform/component.py | 161 + .../sonic_platform/eeprom.py | 139 + .../sonic_platform/event.py | 60 + .../sonic_platform/fan.py | 270 ++ .../sonic_platform/fan_drawer.py | 90 + .../sonic_platform/platform.py | 21 + .../sonic_platform/psu.py | 264 ++ .../sonic_platform/sfp.py | 626 ++++ .../sonic_platform/thermal.py | 232 ++ .../system_health_monitoring_config.json | 15 + .../pddf/pd-plugin.json | 64 - .../x86_64-accton_as7816_64x-r0/pddf_support | 0 .../pmon_daemon_control.json | 3 +- .../sonic_platform/__init__.py | 2 + .../sonic_platform/chassis.py | 250 ++ .../sonic_platform/component.py | 177 + .../sonic_platform/eeprom.py | 134 + .../sonic_platform/event.py | 62 + .../sonic_platform/fan.py | 263 ++ .../sonic_platform/fan_drawer.py | 90 + .../sonic_platform/helper.py | 117 + .../sonic_platform/platform.py | 21 + .../sonic_platform/psu.py | 283 ++ .../sonic_platform/sfp.py | 506 +++ .../sonic_platform/thermal.py | 236 ++ .../system_health_monitoring_config.json | 15 + .../as4630-54pe/modules/Makefile | 5 +- .../modules/x86-64-accton-as4630-54pe-cpld.c | 1 - .../modules/x86-64-accton-as4630-54pe-leds.c | 30 +- .../modules/x86-64-accton-as4630-54pe-psu.c | 0 .../as4630-54pe-pddf-platform-monitor.service | 16 - ...4pe-platform-handle-mgmt-interface.service | 11 + .../service/pddf-platform-init.service | 1 - .../as4630-54pe/sonic_platform_setup.py | 13 +- .../utils/accton_as4630_54pe_util.py | 70 +- .../utils/handle_mgmt_interface.sh | 9 + .../as5835-54x/classes/fanutil.py | 15 +- .../as5835-54x/classes/thermalutil.py | 89 +- .../utils/accton_as5835_54x_monitor.py | 4 +- .../utils/accton_as5835_54x_util.py | 40 +- .../as7326-56x/classes/fanutil.py | 4 +- .../modules/accton_as7326_56x_leds.c | 2 +- .../as7326-56x-pddf-platform-monitor.service | 16 - .../as7326-platform-handle_mac.service | 2 +- .../service/pddf-platform-init.service | 1 - .../as7326-56x/sonic_platform_setup.py | 9 +- .../as7326-56x/utils/accton_as7326_monitor.py | 12 +- .../as7326-56x/utils/accton_as7326_util.py | 339 +- .../as7816-64x/classes/fanutil.py | 4 +- .../as7816-64x/classes/thermalutil.py | 4 +- .../service/as7816-64x-platform-init.service | 17 + ...ce => as7816-64x-platform-monitor.service} | 5 +- .../service/as7816-platform-init.service | 13 - .../service/pddf-platform-init.service | 1 - .../as7816-64x/sonic_platform_setup.py | 11 +- ...onitor.py => accton_as7816_64x_monitor.py} | 2 +- ...7816_util.py => accton_as7816_64x_util.py} | 74 +- .../common/modules/ym2651y.c | 90 +- .../sonic-platform-accton-as4630-54pe.install | 2 +- ...sonic-platform-accton-as4630-54pe.postinst | 8 - .../sonic-platform-accton-as7326-56x.install | 3 +- .../sonic-platform-accton-as7816-64x.install | 3 +- 99 files changed, 7422 insertions(+), 4357 deletions(-) delete mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json delete mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/pddf_support create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/__init__.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/eeprom.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/event.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan_drawer.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/platform.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/psu.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/thermal.py create mode 100644 device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py create mode 100644 device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json delete mode 100644 device/accton/x86_64-accton_as7326_56x-r0/pddf/pd-plugin.json delete mode 100644 device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json delete mode 100644 device/accton/x86_64-accton_as7326_56x-r0/pddf_support create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json delete mode 100644 device/accton/x86_64-accton_as7816_64x-r0/pddf/pd-plugin.json delete mode 100644 device/accton/x86_64-accton_as7816_64x-r0/pddf_support create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/__init__.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/eeprom.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/event.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan_drawer.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/platform.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/psu.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/thermal.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/system_health_monitoring_config.json mode change 100755 => 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile mode change 100755 => 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c mode change 100755 => 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-psu.c delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-pddf-platform-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-handle-mgmt-interface.service delete mode 120000 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/handle_mgmt_interface.sh delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-56x-pddf-platform-monitor.service delete mode 120000 platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/pddf-platform-init.service create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-init.service rename platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/{as7816-pddf-platform-monitor.service => as7816-64x-platform-monitor.service} (64%) delete mode 100755 platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service delete mode 120000 platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/pddf-platform-init.service rename platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/{accton_as7816_monitor.py => accton_as7816_64x_monitor.py} (99%) rename platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/{accton_as7816_util.py => accton_as7816_64x_util.py} (80%) delete mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/Accton-AS4630-54PE/hx5-as4630-48x1G+4x25G+2x100G.bcm b/device/accton/x86_64-accton_as4630_54pe-r0/Accton-AS4630-54PE/hx5-as4630-48x1G+4x25G+2x100G.bcm index 331f6d002647..a5e7903abf24 100755 --- a/device/accton/x86_64-accton_as4630_54pe-r0/Accton-AS4630-54PE/hx5-as4630-48x1G+4x25G+2x100G.bcm +++ b/device/accton/x86_64-accton_as4630_54pe-r0/Accton-AS4630-54PE/hx5-as4630-48x1G+4x25G+2x100G.bcm @@ -1,4 +1,4 @@ -stable_size=71303168 +stable_size=76303168 #polarity/lanemap is using TH2 style. core_clock_frequency=893 diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json deleted file mode 100644 index 0abf66aab7a5..000000000000 --- a/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "XCVR": - { - "xcvr_present": - { - "i2c": - { - "valmap-SFP28": {"1":true, "0":false }, - "valmap-QSFP28": {"1":true, "0":false} - } - } - }, - - "PSU": - { - "psu_present": - { - "i2c": - { - "valmap": { "1":true, "0":false } - } - }, - - "psu_power_good": - { - "i2c": - { - "valmap": { "1": true, "0":false } - } - }, - - "psu_fan_dir": - { - "i2c": - { - "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } - } - }, - - "PSU_FAN_MAX_SPEED":"18000" - }, - - "FAN": - { - "direction": - { - "i2c": - { - "valmap": {"1":"EXHAUST", "0":"INTAKE"} - } - }, - - "present": - { - "i2c": - { - "valmap": {"1":true, "0":false} - } - }, - - "duty_cycle_to_pwm": "lambda dc: ((dc*100.0)/625)", - - "pwm_to_duty_cycle": "lambda pwm: ((pwm*625.0)/100)" - } - -} diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pddf_support b/device/accton/x86_64-accton_as4630_54pe-r0/pddf_support deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/__init__.py new file mode 100644 index 000000000000..73a7720e8979 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] +from . import platform diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py new file mode 100644 index 000000000000..310d0433d8bc --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py @@ -0,0 +1,255 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import os +import sys + +try: + from sonic_platform_base.chassis_base import ChassisBase + from .helper import APIHelper + from .event import SfpEvent +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 3 +NUM_FAN = 2 +NUM_PSU = 2 +NUM_THERMAL = 3 +PORT_START = 49 +PORT_END = 54 +NUM_COMPONENT = 2 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +SYSLED_FNODE = "/sys/class/leds/diag/brightness" +SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", + "1" : "STATUS_LED_COLOR_GREEN", + "2" : "STATUS_LED_COLOR_AMBER", + "5" : "STATUS_LED_COLOR_GREEN_BLINK" +} + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + ChassisBase.__init__(self) + self._api_helper = APIHelper() + self.is_host = self._api_helper.is_host() + + self.config_data = {} + + self.__initialize_fan() + self.__initialize_psu() + self.__initialize_thermals() + self.__initialize_components() + self.__initialize_sfp() + self.__initialize_eeprom() + + def __initialize_sfp(self): + from sonic_platform.sfp import Sfp + for index in range(0, PORT_END): + sfp = Sfp(index) + self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) + self.sfp_module_initialized = True + + def __initialize_fan(self): + from sonic_platform.fan_drawer import FanDrawer + for fant_index in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(fant_index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + def __initialize_psu(self): + from sonic_platform.psu import Psu + for index in range(0, NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + def __initialize_thermals(self): + from sonic_platform.thermal import Thermal + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + def __initialize_eeprom(self): + from sonic_platform.eeprom import Tlv + self._eeprom = Tlv() + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(0, NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + def __initialize_watchdog(self): + from sonic_platform.watchdog import Watchdog + self._watchdog = Watchdog() + + + def __is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + + return self._eeprom.get_product_name() + + def get_presence(self): + """ + Retrieves the presence of the Chassis + Returns: + bool: True if Chassis is present, False if not + """ + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.get_mac() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.get_serial() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_eeprom() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + + def get_change_event(self, timeout=0): + # SFP event + if not self.sfp_module_initialized: + self.__initialize_sfp() + + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + if not self.sfp_module_initialized: + self.__initialize_sfp() + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + def initizalize_system_led(self): + return True + + def get_status_led(self): + val = self._api_helper.read_txt_file(SYSLED_FNODE) + return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" + + def set_status_led(self, color): + mode = None + for key, val in SYSLED_MODES.items(): + if val == color: + mode = key + break + if mode is None: + return False + else: + return self._api_helper.write_txt_file(SYSLED_FNODE, mode) + diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py new file mode 100644 index 000000000000..53a01c1f1475 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py @@ -0,0 +1,172 @@ +############################################################################# +# Edgecore +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +import shlex +import subprocess + + +try: + from sonic_platform_base.component_base import ComponentBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "CPLD1": "3-0060" +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("CPLD1", "CPLD 1"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self._api_helper=APIHelper() + ComponentBase.__init__(self) + self.index = component_index + self.name = self.get_name() + + def __run_command(self, command): + # Run bash command and print output to stdout + try: + process = subprocess.Popen( + shlex.split(command), stdout=subprocess.PIPE) + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + rc = process.poll() + if rc != 0: + return False + except Exception: + return False + return True + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + try: + cpld_path = "{}{}{}".format(SYSFS_PATH, CPLD_ADDR_MAPPING[cpld_name], '/version') + cpld_version_raw= self._api_helper.read_txt_file(cpld_path) + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + except Exception as e: + print('Get exception when read cpld') + cpld_version[cpld_name] = 'None' + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/eeprom.py new file mode 100644 index 000000000000..64a484faf5cf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/eeprom.py @@ -0,0 +1,134 @@ +try: + import os + import sys + import re + if sys.version_info[0] >= 3: + from io import StringIO + else: + from cStringIO import StringIO + + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' +NULL = 'N/A' + +class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self._eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + super(Tlv, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + try: + match = re.search( + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + + _eeprom_info_dict[idx] = value + except Exception: + pass + + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + try: + self.read_eeprom_db() + except Exception: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if 'ok' not in status: + return False + + if not os.path.exists(CACHE_ROOT): + try: + os.makedirs(CACHE_ROOT) + except Exception: + pass + + # + # only the eeprom classes that inherit from eeprom_base + # support caching. Others will work normally + # + try: + self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) + except Exception: + pass + + e = self.read_eeprom() + if e is None: + return 0 + + try: + self.update_cache(e) + except Exception: + pass + + self.decode_eeprom(e) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(e) + if not is_valid: + return False + + return self.__parse_output(decode_output) + + def _valid_tlv(self, eeprom_data): + tlvinfo_type_codes_list = [ + self._TLV_CODE_PRODUCT_NAME, + self._TLV_CODE_PART_NUMBER, + self._TLV_CODE_SERIAL_NUMBER, + self._TLV_CODE_MAC_BASE, + self._TLV_CODE_MANUF_DATE, + self._TLV_CODE_DEVICE_VERSION, + self._TLV_CODE_LABEL_REVISION, + self._TLV_CODE_PLATFORM_NAME, + self._TLV_CODE_ONIE_VERSION, + self._TLV_CODE_MAC_SIZE, + self._TLV_CODE_MANUF_NAME, + self._TLV_CODE_MANUF_COUNTRY, + self._TLV_CODE_VENDOR_NAME, + self._TLV_CODE_DIAG_VERSION, + self._TLV_CODE_SERVICE_TAG, + self._TLV_CODE_VENDOR_EXT, + self._TLV_CODE_CRC_32 + ] + + for code in tlvinfo_type_codes_list: + code_str = "0x{:X}".format(code) + eeprom_data[code_str] = eeprom_data.get(code_str, NULL) + return eeprom_data + + def get_eeprom(self): + return self._valid_tlv(self._eeprom) + + def get_pn(self): + return self._eeprom.get('0x22', NULL) + + def get_serial(self): + return self._eeprom.get('0x23', NULL) + + def get_mac(self): + return self._eeprom.get('0x24', NULL) + + def get_product_name(self): + return self._eeprom.get('0x21', NULL) diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/event.py new file mode 100644 index 000000000000..96f853402abb --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/event.py @@ -0,0 +1,63 @@ +try: + import time + from .helper import APIHelper + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._api_helper = APIHelper() + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.port_num-1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + #now = time.time() + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.port_num-1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan.py new file mode 100644 index 000000000000..eb9d526217bb --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan.py @@ -0,0 +1,284 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + + + +try: + from sonic_platform_base.fan_base import FanBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_FAN_MAX_RPM = 26688 +SPEED_TOLERANCE = 15 +CPLD_FAN_I2C_PATH = "/sys/bus/i2c/devices/3-0060/fan_" +I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "50" + }, + 1: { + "num": 11, + "addr": "51" + }, +} + + +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R"] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + self._api_helper=APIHelper() + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + self.is_psu_fan = is_psu_fan + + if self.is_psu_fan: + self.psu_index = psu_index + self.psu_i2c_num = PSU_HWMON_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr'] + self.psu_hwmon_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr'] + self.psu_cpld_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + FanBase.__init__(self) + + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + if not self.is_psu_fan: + dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'direction_', self.fan_tray_index+1) + val=self._api_helper.read_txt_file(dir_str) + if val is not None: + if int(val, 10)==0:#F2B + direction=self.FAN_DIRECTION_EXHAUST + else: + direction=self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + else: #For PSU + dir_str = "{}{}".format(self.psu_hwmon_path,'psu_fan_dir') + val=self._api_helper.read_txt_file(dir_str) + if val is not None: + if val=='F2B': + direction=self.FAN_DIRECTION_EXHAUST + else: + direction=self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + """ + speed = 0 + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_speed_rpm') + fan_speed_rpm = self._api_helper.read_txt_file(psu_fan_path) + if fan_speed_rpm is not None: + speed = (int(fan_speed_rpm,10))*100/26688 + if speed > 100: + speed=100 + else: + return 0 + elif self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage') + speed=self._api_helper.read_txt_file(speed_path) + if speed is None: + return 0 + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + Note: + speed_pc = pwm_target/255*100 + + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return SPEED_TOLERANCE + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + + """ + + if not self.is_psu_fan and self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage') + return self._api_helper.write_txt_file(speed_path, int(speed)) + + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False #Not supported + + def get_status_led(self): + """ + Gets the state of the fan status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_presence() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if FAN is present, False if not + """ + + + if self.is_psu_fan: + present_path="{}{}".format(self.psu_cpld_path, 'psu_present') + else: + present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'present_', self.fan_tray_index+1) + + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') + val=self._api_helper.read_txt_file(psu_fan_path) + if val is not None: + return int(val, 10)==0 + else: + return False + else: + path = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'fault_', self.fan_tray_index+1) + val=self._api_helper.read_txt_file(path) + if val is not None: + return int(val, 10)==0 + else: + return False + + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True if not self.is_psu_fan else False + diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..17d339ee55f6 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan_drawer.py @@ -0,0 +1,90 @@ +######################################################################## +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 0-based in platforms + self.fantrayindex = fantray_index + self.__initialize_fan_drawer() + + + def __initialize_fan_drawer(self): + from sonic_platform.fan import Fan + for i in range(FANS_PER_FANTRAY): + self._fan_list.append(Fan(self.fantrayindex, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex+1) + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return self._fan_list[0].get_presence() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fantrayindex+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py new file mode 100644 index 000000000000..b124ca29f0df --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py @@ -0,0 +1,117 @@ +import os +import struct +import subprocess +from mmap import * +from sonic_py_common import device_info + +HOST_CHK_CMD = "docker > /dev/null 2>&1" +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def run_command(self, cmd): + status = True + result = "" + try: + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + except Exception: + status = False + return status, result + + def run_interactive_command(self, cmd): + try: + os.system(cmd) + except Exception: + return False + return True + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except IOError: + return False + return True + + def ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + cmd = "ipmitool fru print {}".format(str( + id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) + + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/platform.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/platform.py new file mode 100644 index 000000000000..2f2c2a447fcf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/platform.py @@ -0,0 +1,21 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..6f21de491b38 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/psu.py @@ -0,0 +1,269 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +#import sonic_platform + +try: + from sonic_platform_base.psu_base import PsuBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +I2C_PATH ="/sys/bus/i2c/devices/{0}-00{1}/" + +PSU_NAME_LIST = ["PSU-1", "PSU-2"] +PSU_NUM_FAN = [1, 1] +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "50" + }, + 1: { + "num": 11, + "addr": "51" + }, +} + +class Psu(PsuBase): + """Platform-specific Psu class""" + + def __init__(self, psu_index=0): + PsuBase.__init__(self) + self.index = psu_index + self._api_helper = APIHelper() + + self.i2c_num = PSU_HWMON_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] + self.hwmon_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + + self.i2c_num = PSU_CPLD_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + self.__initialize_fan() + + def __initialize_fan(self): + from sonic_platform.fan import Fan + for fan_index in range(0, PSU_NUM_FAN[self.index]): + fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) + self._fan_list.append(fan) + + def get_voltage(self): + """ + Retrieves current PSU voltage output + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') + val=self._api_helper.read_txt_file(iout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') + val=self._api_helper.read_txt_file(pout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + return self.get_status() + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + + return False #Controlled by HW + + def get_status_led(self): + """ + Gets the state of the PSU status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_status() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_path = "{}{}".format(self.hwmon_path, 'psu_temp1_input') + val=self._api_helper.read_txt_file(temp_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return False #Not supported + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_max') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_min') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return PSU_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + presence_path="{}{}".format(self.cpld_path, 'psu_present') + val=self._api_helper.read_txt_file(presence_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + power_path="{}{}".format(self.cpld_path, 'psu_power_good') + val=self._api_helper.read_txt_file(power_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + model_path="{}{}".format(self.cpld_path, 'psu_model_name') + model=self._api_helper.read_txt_file(model_path) + if model is None: + return "N/A" + + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + serial_path="{}{}".format(self.cpld_path, 'psu_serial_number') + serial=self._api_helper.read_txt_file(serial_path) + if serial is None: + return "N/A" + return serial + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py new file mode 100644 index 000000000000..c421761025cf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py @@ -0,0 +1,484 @@ +############################################################################# +# Edgecore +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import sys + +from ctypes import create_string_buffer + +try: + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_I2C_PATH = "/sys/bus/i2c/devices/3-0060/" + +class Sfp(SfpOptoeBase): + """Platform-specific Sfp class""" + + # Port number + PORT_START = 49 + PORT_END = 54 + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + + PLATFORM = "x86_64-accton_as4630_54pe-r0" + HWSKU = "Accton-AS4630-54PE" + + _port_to_i2c_mapping = { + 49: 18, + 50: 19, + 51: 20, + 52: 21, + 53: 22, + 54: 23, + } + + def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) + self._api_helper=APIHelper() + # Init index + self.index = sfp_index + self.port_num = self.index + 1 + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + for x in range(self.PORT_START, self.PORT_END + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) + + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join([platform_path, self.HWSKU] + ) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + if sys.version_info[0] >= 3: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + if self.port_num < 53: #Copper port and sfp ports are suported. + return False + + reset_path="{}{}{}".format(CPLD_I2C_PATH , "module_reset_" , str(self.port_num)) + val = self._api_helper.read_txt_file(reset_path) + + if val is not None: + return int(val, 10) == 1 + else: + return False + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + rx_los = False + + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + rx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_rx_los_', self.port_num) + rx_los=self._api_helper.read_txt_file(rx_path) + if rx_los is None: + return False + else: + rx_los_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] + return rx_los + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + tx_fault = False + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_fault_', self.port_num) + tx_fault=self._api_helper.read_txt_file(tx_path) + if tx_fault is None: + return False + else: + tx_fault_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] + + return tx_fault + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_disable = False + + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) + tx_disable=self._api_helper.read_txt_file(tx_path) + + if tx_disable is not None: + return tx_disable + else: + return False + + else: + tx_disable_list = [] + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX1Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX2Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX3Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX4Disable']['value']) + + return tx_disable_list + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + if self.port_num < 53: + # SFP doesn't support this feature + return False + else: + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + if self.port_num < 53: + # SFP doesn't support this feature + return False + else: + power_set=self.get_power_set() + power_override = self.get_power_override() + return power_set and power_override + + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + # Check for invalid port_num + if self.port_num < 53: #Copper port and sfp ports are not supported. + return False + + reset_path = "{}{}{}".format(CPLD_I2C_PATH, 'module_reset_', self.port_num) + ret = self._api_helper.write_txt_file(reset_path, 1) + if ret is not True: + return ret + + time.sleep(0.01) + ret = self._api_helper.write_txt_file(reset_path, 0) + time.sleep(0.2) + + return ret + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) + ret = self._api_helper.write_txt_file(tx_path, 1 if tx_disable else 0) + if ret is not None: + time.sleep(0.01) + return ret + else: + return False + + else: + if not self.get_presence(): + return False + sysfsfile_eeprom = None + try: + tx_disable_ctl = 0xf if tx_disable else 0x0 + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = tx_disable_ctl + else: + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ',str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + + for i in range(4): + channel_mask = (1 << i) + if not (channel & channel_mask): + continue + + if disable: + channel_state |= channel_mask + else: + channel_state &= ~channel_mask + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = channel_state + else: + buffer[0] = chr(channel_state) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ', str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if lpmode is True: + self.set_power_override(True, True) + else: + self.set_power_override(False, False) + + return True + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + try: + power_override_bit = (1 << 0) if power_override else 0 + power_set_bit = (1 << 1) if power_set else (1 << 3) + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = (power_override_bit | power_set_bit) + else: + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + with open(self.port_to_eeprom_mapping[self.port_num], "r+b") as fd: + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + except IOError as e: + print ('Error: unable to open file: ', str(e)) + return False + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + name = None + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + name = sfputil_helper.logical[self.index] or "Unknown" + return name + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + present_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_present_', self.port_num) + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.port_num + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/thermal.py new file mode 100644 index 000000000000..938afca80e9e --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/thermal.py @@ -0,0 +1,236 @@ +############################################################################# +# Edgecore +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path +import glob + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "50" + }, + 1: { + "num": 11, + "addr": "51" + }, +} + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + PSU_THERMAL_NAME_LIST = [] + SYSFS_PATH = "/sys/bus/i2c/devices" + + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): + self.index = thermal_index + self.is_psu = is_psu + self.psu_index = psu_index + + if self.is_psu: + psu_i2c_bus = PSU_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + # Add thermal name + self.THERMAL_NAME_LIST.append("Temp sensor 1") + self.THERMAL_NAME_LIST.append("Temp sensor 2") + self.THERMAL_NAME_LIST.append("Temp sensor 3") + self.PSU_THERMAL_NAME_LIST.append("PSU-1 temp sensor 1") + self.PSU_THERMAL_NAME_LIST.append("PSU-2 temp sensor 1") + + # Set hwmon path + i2c_path = { + 0: "14-0048/hwmon/hwmon*/", + 1: "24-004b/hwmon/hwmon*/", + 2: "25-004a/hwmon/hwmon*/" + }.get(self.index, None) + + self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) + self.ss_key = self.THERMAL_NAME_LIST[self.index] + self.ss_index = 1 + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: + with open(filename, 'r') as fd: + data =fd.readline().rstrip() + return data + except IOError as e: + pass + + return None + + def __get_temp(self, temp_file): + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file + raw_temp = self.__read_txt_file(temp_file_path) + if raw_temp is not None: + return float(raw_temp)/1000 + else: + return 0 + + def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True + temp_file_path = os.path.join(self.hwmon_path, file_name) + for filename in glob.glob(temp_file_path): + try: + with open(filename, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError as e: + print("IOError") + + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.is_psu: + return 0 + + temp_file = "temp{}_max".format(self.ss_index) + return self.__get_temp(temp_file) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + temp_file = "temp{}_max".format(self.ss_index) + temperature = temperature *1000 + self.__set_threshold(temp_file, temperature) + + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + if self.is_psu: + return self.PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the Thermal + Returns: + bool: True if Thermal is present, False if not + """ + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) + if raw_txt is not None: + return True + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + return self.get_presence() and (not int( + self.__read_txt_file(temp_file))) + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False + else: + return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False diff --git a/device/accton/x86_64-accton_as5835_54x-r0/installer.conf b/device/accton/x86_64-accton_as5835_54x-r0/installer.conf index a0944fd0e30f..735fa7992dbc 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/installer.conf +++ b/device/accton/x86_64-accton_as5835_54x-r0/installer.conf @@ -2,4 +2,3 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 CONSOLE_SPEED=115200 ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801" - diff --git a/device/accton/x86_64-accton_as5835_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5835_54x-r0/plugins/sfputil.py index b18b15f3e68c..0c815452a7a4 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/plugins/sfputil.py @@ -148,7 +148,7 @@ def get_cage_num(self, port_num): cage_num = port_num if (port_num >= self.QSFP_PORT_START): cage_num = (port_num - self.QSFP_PORT_START)/4 - cage_num = cage_num + self.QSFP_PORT_START + cage_num = int(cage_num + self.QSFP_PORT_START) return cage_num diff --git a/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/__init__.py index 43435472a423..73a7720e8979 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/__init__.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/__init__.py @@ -1,2 +1,2 @@ -__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan'] +__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] from . import platform diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py index 49805d6d7858..dce9f3c150cd 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py @@ -28,7 +28,14 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +SYSLED_FNODE= "/sys/class/leds/as5835_54x_led::diag/brightness" + +SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", + "1" : "STATUS_LED_COLOR_GREEN", + "3" : "STATUS_LED_COLOR_AMBER" +} class Chassis(ChassisBase): @@ -37,7 +44,6 @@ class Chassis(ChassisBase): def __init__(self): ChassisBase.__init__(self) self._api_helper = APIHelper() - self._api_helper = APIHelper() self.is_host = self._api_helper.is_host() self.config_data = {} @@ -54,15 +60,16 @@ def __initialize_sfp(self): for index in range(0, PORT_END): sfp = Sfp(index) self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) self.sfp_module_initialized = True def __initialize_fan(self): - from sonic_platform.fan import Fan - for fant_index in range(0, NUM_FAN_TRAY): - for fan_index in range(0, NUM_FAN): - fan = Fan(fant_index, fan_index) - self._fan_list.append(fan) - + from sonic_platform.fan_drawer import FanDrawer + for fant_index in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(fant_index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + def __initialize_psu(self): from sonic_platform.psu import Psu for index in range(0, NUM_PSU): @@ -84,12 +91,12 @@ def __initialize_components(self): for index in range(0, NUM_COMPONENT): component = Component(index) self._component_list.append(component) - + def __initialize_watchdog(self): from sonic_platform.watchdog import Watchdog self._watchdog = Watchdog() - + def __is_host(self): return os.system(HOST_CHK_CMD) == 0 @@ -101,23 +108,14 @@ def __read_txt_file(self, file_path): except IOError: pass return None - - def get_model(self): - """ - Retrieves the model number (or part number) of the device - Returns: - string: Model/part number of device - """ - return self._eeprom.get_pn() - + def get_name(self): """ Retrieves the name of the device Returns: string: The name of the device """ - - return self._api_helper.hwsku + return self._eeprom.get_product_name() def get_presence(self): """ @@ -144,7 +142,15 @@ def get_base_mac(self): """ return self._eeprom.get_mac() - def get_serial_number(self): + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): """ Retrieves the hardware serial number for the chassis Returns: @@ -173,7 +179,7 @@ def get_reboot_cause(self): is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used to pass a description of the reboot cause. """ - + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) sw_reboot_cause = self._api_helper.read_txt_file( reboot_cause_path) or "Unknown" @@ -185,10 +191,7 @@ def get_change_event(self, timeout=0): # SFP event if not self.sfp_module_initialized: self.__initialize_sfp() - - status, sfp_event = SfpEvent(self._sfp_list).get_sfp_event(timeout) - - return status, sfp_event + return self._sfpevent.get_sfp_event(timeout) def get_sfp(self, index): """ @@ -212,3 +215,40 @@ def get_sfp(self, index): sys.stderr.write("SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list))) return sfp + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + def initizalize_system_led(self): + return True + + def get_status_led(self): + val = self._api_helper.read_txt_file(SYSLED_FNODE) + return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" + + def set_status_led(self, color): + mode = None + for key, val in SYSLED_MODES.items(): + if val == color: + mode = key + break + if mode is None: + return False + else: + return self._api_helper.write_txt_file(SYSLED_FNODE, mode) + diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py index deebd5936d0d..f3c9b3cee754 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py @@ -1,5 +1,5 @@ ############################################################################# -# Celestica +# Edgecore # # Component contains an implementation of SONiC Platform Base API and # provides the components firmware management function @@ -67,14 +67,14 @@ def __get_bios_version(self): with open(BIOS_VERSION_PATH, 'r') as fd: bios_version = fd.read() return bios_version.strip() - except Exception as e: + except Exception as e: print('Get exception when read bios') return None def __get_cpld_version(self): # Retrieves the CPLD firmware version cpld_version = dict() - for cpld_name in CPLD_ADDR_MAPPING: + for cpld_name in CPLD_ADDR_MAPPING: try: cpld_path = "{}{}{}".format(SYSFS_PATH, CPLD_ADDR_MAPPING[cpld_name], '/version') cpld_version_raw= self._api_helper.read_txt_file(cpld_path) @@ -126,3 +126,55 @@ def install_firmware(self, image_path): A boolean, True if install successfully, False if not """ raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/eeprom.py index f3bdcbccad3f..bc9041d56b53 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/eeprom.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/eeprom.py @@ -20,7 +20,7 @@ class Tlv(eeprom_tlvinfo.TlvInfoDecoder): EEPROM_DECODE_HEADLINES = 6 def __init__(self): - self._eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + self._eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" super(Tlv, self).__init__(self._eeprom_path, 0, '', True) self._eeprom = self._load_eeprom() @@ -123,9 +123,12 @@ def get_eeprom(self): def get_pn(self): return self._eeprom.get('0x22', NULL) - + def get_serial(self): return self._eeprom.get('0x23', NULL) def get_mac(self): return self._eeprom.get('0x24', NULL) + + def get_product_name(self): + return self._eeprom.get('0x21', NULL) diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/event.py index d77ee8c29dc5..7ce2598732e2 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/event.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/event.py @@ -1,42 +1,49 @@ try: import time - from .helper import APIHelper from sonic_py_common.logger import Logger except ImportError as e: raise ImportError(repr(e) + " - required module not found") +POLL_INTERVAL_IN_SEC = 1 class SfpEvent: ''' Listen to insert/remove sfp events ''' def __init__(self, sfp_list): - self._api_helper = APIHelper() self._sfp_list = sfp_list self._logger = Logger() + self._sfp_change_event_data = {'present': 0} - sfp_change_event_data = {'valid': 0, 'last': 0, 'present': 0} - def get_sfp_event(self, timeout=2000): - now = time.time() - port_dict = {} - change_dict = {} - change_dict['sfp'] = port_dict - - if timeout < 1000: - timeout = 1000 - timeout = timeout / float(1000) # Convert to secs - - if now < (self.sfp_change_event_data['last'] + timeout) and self.sfp_change_event_data['valid']: - return True, change_dict - + def get_presence_bitmap(self): bitmap = 0 for sfp in self._sfp_list: modpres = sfp.get_presence() i=sfp.port_num-1 if modpres: bitmap = bitmap | (1 << i) + return bitmap - changed_ports = self.sfp_change_event_data['present'] ^ bitmap - if changed_ports: + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: for sfp in self._sfp_list: i=sfp.port_num-1 if (changed_ports & (1 << i)): @@ -47,9 +54,7 @@ def get_sfp_event(self, timeout=2000): # Update the cache dict - self.sfp_change_event_data['present'] = bitmap - self.sfp_change_event_data['last'] = now - self.sfp_change_event_data['valid'] = 1 + self._sfp_change_event_data['present'] = bitmap return True, change_dict else: return True, change_dict diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py index cf698bf6d014..8cb1c17fdf72 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py @@ -15,9 +15,10 @@ raise ImportError(str(e) + "- required module not found") PSU_FAN_MAX_RPM = 26688 -CPLD_I2C_PATH = "/sys/bus/i2c/devices/3-0063/fan" -PSU_HWMON_I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" -PSU_I2C_MAPPING = { +SPEED_TOLERANCE = 15 +CPLD_FAN_I2C_PATH = "/sys/bus/i2c/devices/3-0063/fan" +I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { 0: { "num": 11, "addr": "58" @@ -28,6 +29,20 @@ }, } + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 11, + "addr": "50" + }, + 1: { + "num": 12, + "addr": "53" + }, +} + + + FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", "FAN-5F", "FAN-5R"] @@ -42,13 +57,18 @@ def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): self.is_psu_fan = is_psu_fan if self.is_psu_fan: self.psu_index = psu_index - self.psu_i2c_num = PSU_I2C_MAPPING[self.psu_index]['num'] - self.psu_i2c_addr = PSU_I2C_MAPPING[self.psu_index]['addr'] - self.psu_hwmon_path = PSU_HWMON_I2C_PATH.format( + self.psu_i2c_num = PSU_HWMON_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr'] + self.psu_hwmon_path = I2C_PATH.format( self.psu_i2c_num, self.psu_i2c_addr) + self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr'] + self.psu_cpld_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + FanBase.__init__(self) - + def get_direction(self): """ @@ -60,9 +80,9 @@ def get_direction(self): if not self.is_psu_fan: - dir_str = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index+1, '_direction') + dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_direction') val=self._api_helper.read_txt_file(dir_str) - if val is not None: + if val is not None: if int(val, 10)==0: direction=self.FAN_DIRECTION_EXHAUST else: @@ -90,26 +110,26 @@ def get_speed(self): Returns: An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) - + """ speed = 0 if self.is_psu_fan: psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_speed_rpm') fan_speed_rpm = self._api_helper.read_txt_file(psu_fan_path) if fan_speed_rpm is not None: - speed = (int(fan_speed_rpm,10))*100/26688 + speed = (int(fan_speed_rpm,10))*100/26688 if speed > 100: speed=100 else: return 0 elif self.get_presence(): - speed_path = "{}{}".format(CPLD_I2C_PATH, '_duty_cycle_percentage') + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') speed=self._api_helper.read_txt_file(speed_path) if speed is None: return 0 return int(speed) - + def get_target_speed(self): """ Retrieves the target (expected) speed of the fan @@ -123,7 +143,7 @@ def get_target_speed(self): 0 : when PWM mode is use pwm : when pwm mode is not use """ - return False #Not supported + return self.get_speed() def get_speed_tolerance(self): """ @@ -132,7 +152,7 @@ def get_speed_tolerance(self): An integer, the percentage of variance from target speed which is considered tolerable """ - return False #Not supported + return SPEED_TOLERANCE def set_speed(self, speed): """ @@ -146,7 +166,7 @@ def set_speed(self, speed): """ if not self.is_psu_fan and self.get_presence(): - speed_path = "{}{}".format(CPLD_I2C_PATH, '_duty_cycle_percentage') + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') return self._api_helper.write_txt_file(speed_path, int(speed)) return False @@ -195,17 +215,18 @@ def get_presence(self): Returns: bool: True if FAN is present, False if not """ - present_path = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index+1, '_present') + + + if self.is_psu_fan: + present_path="{}{}".format(self.psu_cpld_path, 'psu_present') + else: + present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_present') + val=self._api_helper.read_txt_file(present_path) - - if not self.is_psu_fan: - if val is not None: - return int(val, 10)==1 - else: - return False - + if val is not None: + return int(val, 10)==1 else: - return True + return False def get_status(self): """ @@ -221,7 +242,7 @@ def get_status(self): else: return False else: - path = "{}{}{}".format(CPLD_I2C_PATH, self.fan_index+1, '_fault') + path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_fault') val=self._api_helper.read_txt_file(path) if val is not None: return int(val, 10)==0 @@ -245,3 +266,25 @@ def get_serial(self): string: Serial number of device """ return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True if not self.is_psu_fan else False + diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..17d339ee55f6 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py @@ -0,0 +1,90 @@ +######################################################################## +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 0-based in platforms + self.fantrayindex = fantray_index + self.__initialize_fan_drawer() + + + def __initialize_fan_drawer(self): + from sonic_platform.fan import Fan + for i in range(FANS_PER_FANTRAY): + self._fan_list.append(Fan(self.fantrayindex, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex+1) + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return self._fan_list[0].get_presence() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fantrayindex+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py index 4cd60ac90611..b124ca29f0df 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py @@ -51,7 +51,7 @@ def run_interactive_command(self, cmd): def read_txt_file(self, file_path): try: - with open(file_path, 'r') as fd: + with open(file_path, 'r', errors='replace') as fd: data = fd.read() return data.strip() except IOError: diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py index dd6058920667..c2baa2ebf26a 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py @@ -10,7 +10,7 @@ try: from sonic_platform_base.psu_base import PsuBase - #from sonic_platform.fan import Fan + from sonic_platform.thermal import Thermal from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -64,6 +64,8 @@ def __initialize_fan(self): for fan_index in range(0, PSU_NUM_FAN[self.index]): fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) self._fan_list.append(fan) + + self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) def get_voltage(self): """ @@ -154,7 +156,7 @@ def get_temperature(self): return float(val)/1000 else: return 0 - + def get_temperature_high_threshold(self): """ Retrieves the high threshold temperature of PSU @@ -251,3 +253,20 @@ def get_serial(self): if serial is None: return "N/A" return serial + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py index f8f87532f085..ec16e80568f4 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py @@ -13,108 +13,14 @@ from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - #from sonic_platform_base.sonic_sfp.sff8472 import sffbase - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") CPLD_I2C_PATH = "/sys/bus/i2c/devices/" -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 - -SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -XCVR_INTFACE_BULK_OFFSET = 0 -XCVR_INTFACE_BULK_WIDTH_QSFP = 20 -XCVR_INTFACE_BULK_WIDTH_SFP = 21 -XCVR_HW_REV_WIDTH_QSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 -XCVR_VENDOR_NAME_OFFSET = 20 -XCVR_VENDOR_NAME_WIDTH = 16 -XCVR_VENDOR_OUI_OFFSET = 37 -XCVR_VENDOR_OUI_WIDTH = 3 -XCVR_VENDOR_PN_OFFSET = 40 -XCVR_VENDOR_PN_WIDTH = 16 -XCVR_HW_REV_OFFSET = 56 -XCVR_HW_REV_WIDTH_OSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_VENDOR_SN_OFFSET = 68 -XCVR_VENDOR_SN_WIDTH = 16 -XCVR_VENDOR_DATE_OFFSET = 84 -XCVR_VENDOR_DATE_WIDTH = 8 -XCVR_DOM_CAPABILITY_OFFSET = 92 -XCVR_DOM_CAPABILITY_WIDTH = 1 - -# Offset for values in QSFP eeprom -QSFP_DOM_REV_OFFSET = 1 -QSFP_DOM_REV_WIDTH = 1 -QSFP_TEMPE_OFFSET = 22 -QSFP_TEMPE_WIDTH = 2 -QSFP_VOLT_OFFSET = 26 -QSFP_VOLT_WIDTH = 2 -QSFP_CHANNL_MON_OFFSET = 34 -QSFP_CHANNL_MON_WIDTH = 16 -QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 -QSFP_CONTROL_OFFSET = 86 -QSFP_CONTROL_WIDTH = 8 -QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 -QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 -QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 -QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 -QSFP_POWEROVERRIDE_OFFSET = 93 -QSFP_POWEROVERRIDE_WIDTH = 1 -QSFP_MODULE_THRESHOLD_OFFSET = 128 -QSFP_MODULE_THRESHOLD_WIDTH = 24 -QSFP_CHANNEL_THRESHOLD_OFFSET = 176 -QSFP_CHANNEL_THRESHOLD_WIDTH = 16 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', - 'Length OM2(m)', 'Length OM1(m)', - 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', - 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', 'Fibre Channel Speed') - - -# Offset for values in SFP eeprom -SFP_TEMPE_OFFSET = 96 -SFP_TEMPE_WIDTH = 2 -SFP_VOLT_OFFSET = 98 -SFP_VOLT_WIDTH = 2 -SFP_CHANNL_MON_OFFSET = 100 -SFP_CHANNL_MON_WIDTH = 6 -SFP_MODULE_THRESHOLD_OFFSET = 0 -SFP_MODULE_THRESHOLD_WIDTH = 40 -SFP_CHANNL_THRESHOLD_OFFSET = 112 -SFP_CHANNL_THRESHOLD_WIDTH = 2 -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 1 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - - -class Sfp(SfpBase): +class Sfp(SfpOptoeBase): """Platform-specific Sfp class""" # Port number @@ -125,7 +31,7 @@ class Sfp(SfpBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" PLATFORM = "x86_64-accton_as5835_54x-r0" HWSKU = "Accton-AS5835-54X" @@ -194,6 +100,7 @@ class Sfp(SfpBase): } def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) self._api_helper=APIHelper() # Init index self.index = sfp_index @@ -204,44 +111,15 @@ def __init__(self, sfp_index=0): self.port_to_eeprom_mapping = {} for x in range(self.PORT_START, self.PORT_END + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) - - self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', - 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', - 'application_advertisement', 'type_abbrv_name'] - - self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', - 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] - - self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] - SfpBase.__init__(self) - + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] + # For cage 1~38 are at cpld2, others are at cpld3. def __get_cpld_num(self, port_num): return 1 if (port_num < 39) else 2 - def _convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - def __is_host(self): return os.system(self.HOST_CHK_CMD) == 0 @@ -277,422 +155,6 @@ def __read_eeprom_specific_bytes(self, offset, num_bytes): return eeprom_raw - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - type |1*255VCHAR |type of SFP - vendor_rev |1*255VCHAR |vendor revision of SFP - serial |1*255VCHAR |serial number of the SFP - manufacturer |1*255VCHAR |SFP vendor name - model |1*255VCHAR |SFP model name - connector |1*255VCHAR |connector information - encoding |1*255VCHAR |encoding information - ext_identifier |1*255VCHAR |extend identifier - ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance - cable_length |INT |cable length in m - nominal_bit_rate |INT |nominal bit rate by 100Mbs - specification_compliance |1*255VCHAR |specification compliance - vendor_date |1*255VCHAR |vendor date - vendor_oui |1*255VCHAR |vendor OUI - application_advertisement |1*255VCHAR |supported applications advertisement - ======================================================================== - """ - # check present status - if self.port_num < 49: - sfpi_obj = sff8472InterfaceId() #SFP - else: - sfpi_obj = sff8436InterfaceId() #QSFP - if not self.get_presence() or not sfpi_obj: - return {} - - if self.port_num < 49: - offset = SFP_INFO_OFFSET - sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_SFP) - else: - offset = QSFP_INFO_OFFSET - sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_QSFP) - - sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk( - sfp_interface_bulk_raw, 0) - - sfp_vendor_name_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) - sfp_vendor_name_data = sfpi_obj.parse_vendor_name( - sfp_vendor_name_raw, 0) - - sfp_vendor_pn_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) - sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( - sfp_vendor_pn_raw, 0) - - if self.port_num < 49: - sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_SFP) - else: - sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_QSFP) - - sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( - sfp_vendor_rev_raw, 0) - - sfp_vendor_sn_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) - sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( - sfp_vendor_sn_raw, 0) - - sfp_vendor_oui_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) - if sfp_vendor_oui_raw is not None: - sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui( - sfp_vendor_oui_raw, 0) - - sfp_vendor_date_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_DATE_OFFSET), XCVR_VENDOR_DATE_WIDTH) - sfp_vendor_date_data = sfpi_obj.parse_vendor_date( - sfp_vendor_date_raw, 0) - - transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') - compliance_code_dict = dict() - - if sfp_interface_bulk_data: - transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] - transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] - transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] - transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] - transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] - transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] - - transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ - 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' - transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' - transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' - transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' - transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ - 'data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' - transceiver_info_dict['cable_type'] = "Unknown" - transceiver_info_dict['cable_length'] = "Unknown" - - if self.port_num < 49: - for key in sfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - transceiver_info_dict['cable_type'] = key - transceiver_info_dict['cable_length'] = str( - sfp_interface_bulk_data['data'][key]['value']) - - for key in sfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] - - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - else: - for key in qsfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - transceiver_info_dict['cable_type'] = key - transceiver_info_dict['cable_length'] = str( - sfp_interface_bulk_data['data'][key]['value']) - - for key in qsfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] - - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) - - - return transceiver_info_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. - tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. - reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. - lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. - tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. - tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 - | |to channel 3. - temperature |INT |module temperature in Celsius - voltage |INT |supply voltage in mV - txbias |INT |TX Bias Current in mA, n is the channel number, - | |for example, tx2bias stands for tx bias of channel 2. - rxpower |INT |received optical power in mW, n is the channel number, - | |for example, rx2power stands for rx power of channel 2. - txpower |INT |TX output power in mW, n is the channel number, - | |for example, tx2power stands for tx power of channel 2. - ======================================================================== - """ - # check present status - if self.port_num < 49: #SFP case - sfpd_obj = sff8472Dom() - if not self.get_presence() or not sfpd_obj: - return {} - - eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) - sfpi_obj = sff8472InterfaceId(eeprom_ifraw) - cal_type = sfpi_obj.get_calibration_type() - sfpd_obj._calibration_type = cal_type - - offset = SFP_DOM_OFFSET - transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - dom_temperature_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) - - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature( - dom_temperature_raw, 0) - transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - - dom_voltage_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_voltage_data = sfpd_obj.parse_channel_monitor_params( - dom_channel_monitor_raw, 0) - transceiver_dom_info_dict['tx1power'] = dom_voltage_data['data']['TXPower']['value'] - transceiver_dom_info_dict['rx1power'] = dom_voltage_data['data']['RXPower']['value'] - transceiver_dom_info_dict['tx1bias'] = dom_voltage_data['data']['TXBias']['value'] - - else: #QSFP case - sfpd_obj = sff8436Dom() - sfpi_obj = sff8436InterfaceId() - - if not self.get_presence() or not sfpi_obj or not sfpd_obj: - return {} - - transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - offset = QSFP_DOM_OFFSET - offset_xcvr = QSFP_INFO_OFFSET - - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - qspf_dom_capability_data = sfpi_obj.parse_dom_capability( - qsfp_dom_capability_raw, 0) - else: - return None - - dom_temperature_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature( - dom_temperature_raw, 0) - transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - - dom_voltage_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - - qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) - if qsfp_dom_rev_raw is not None: - qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - dom_channel_monitor_data = {} - dom_channel_monitor_raw = None - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( - dom_channel_monitor_raw, 0) - - else: - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( - dom_channel_monitor_raw, 0) - transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] - transceiver_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] - transceiver_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] - transceiver_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] - - if dom_channel_monitor_raw: - transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] - transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] - transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] - transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] - transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] - transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] - transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] - transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] - #End of else - - - for key in transceiver_dom_info_dict: - transceiver_dom_info_dict[key] = self._convert_string_to_num( - transceiver_dom_info_dict[key]) - - transceiver_dom_info_dict['rx_los'] = self.get_rx_los() - transceiver_dom_info_dict['tx_fault'] = self.get_tx_fault() - transceiver_dom_info_dict['reset_status'] = self.get_reset_status() - transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() - - return transceiver_dom_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. - templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. - temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. - templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. - vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. - vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. - vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. - vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. - rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. - rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. - rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. - rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. - txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. - txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. - txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. - txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. - txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. - txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. - txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. - txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. - ======================================================================== - """ - # check present status - if self.port_num < 49: - sfpd_obj = sff8472Dom() - - if not self.get_presence() and not sfpd_obj: - return {} - - eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) - sfpi_obj = sff8472InterfaceId(eeprom_ifraw) - cal_type = sfpi_obj.get_calibration_type() - sfpd_obj._calibration_type = cal_type - - offset = SFP_DOM_OFFSET - transceiver_dom_threshold_info_dict = dict.fromkeys( - self.threshold_dict_keys, 'N/A') - dom_module_threshold_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) - if dom_module_threshold_raw is not None: - dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold( - dom_module_threshold_raw, 0) - - transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data[ - 'data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] - - for key in transceiver_dom_threshold_info_dict: - transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num( - transceiver_dom_threshold_info_dict[key]) - - return transceiver_dom_threshold_info_dict - - - else: - sfpd_obj = sff8436Dom() - - if not self.get_presence() or not sfpd_obj: - return {} - - transceiver_dom_threshold_dict = dict.fromkeys( - self.threshold_dict_keys, 'N/A') - dom_thres_raw = self.__read_eeprom_specific_bytes( - QSFP_MODULE_THRESHOLD_OFFSET, QSFP_MODULE_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None - - if dom_thres_raw: - module_threshold_values = sfpd_obj.parse_module_threshold_values( - dom_thres_raw, 0) - module_threshold_data = module_threshold_values.get('data') - if module_threshold_data: - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] - - dom_thres_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNEL_THRESHOLD_OFFSET, QSFP_CHANNEL_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None - channel_threshold_values = sfpd_obj.parse_channel_threshold_values( - dom_thres_raw, 0) - channel_threshold_data = channel_threshold_values.get('data') - if channel_threshold_data: - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerlowalarm'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerhighwarning'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerlowwarning'] = "0.0dBm" - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] - - for key in transceiver_dom_threshold_dict: - transceiver_dom_threshold_dict[key] = self._convert_string_to_num( - transceiver_dom_threshold_dict[key]) - - return transceiver_dom_threshold_dict - def get_reset_status(self): """ Retrieves the reset status of SFP @@ -725,8 +187,10 @@ def get_rx_los(self): rx_path = "{}{}{}{}".format(CPLD_I2C_PATH, cpld_path, '/module_rx_los_', self.port_num) rx_los=self._api_helper.read_txt_file(rx_path) - if rx_los is None: - return False + if int(rx_los, 10) == 1: + return [True] + else: + return [False] #status_control_raw = self.__read_eeprom_specific_bytes( # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) #if status_control_raw: @@ -743,15 +207,18 @@ def get_rx_los(self): rx_los_list.append(rx_los_data & 0x02 != 0) rx_los_list.append(rx_los_data & 0x04 != 0) rx_los_list.append(rx_los_data & 0x08 != 0) - rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] - - return rx_los + return rx_los_list + else: + return [False]*4 def get_tx_fault(self): """ Retrieves the TX fault status of SFP Returns: - A Boolean, True if SFP has TX fault, False if not + A list of boolean values, representing the TX fault status + of each available channel, value is True if SFP channel + has TX fault, False if not. + E.g., for a tranceiver with four channels: [False, False, True, False] Note : TX fault status is lached until a call to get_tx_fault or a reset. """ tx_fault = False @@ -761,8 +228,10 @@ def get_tx_fault(self): tx_path = "{}{}{}{}".format(CPLD_I2C_PATH, cpld_path, '/module_tx_fault_', self.port_num) tx_fault=self._api_helper.read_txt_file(tx_path) - if tx_fault is None: - return False + if int(tx_fault, 10) == 1: + return [True] + else: + return [False] #status_control_raw = self.__read_eeprom_specific_bytes( # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) #if status_control_raw: @@ -778,15 +247,19 @@ def get_tx_fault(self): tx_fault_list.append(tx_fault_data & 0x02 != 0) tx_fault_list.append(tx_fault_data & 0x04 != 0) tx_fault_list.append(tx_fault_data & 0x08 != 0) - tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] + return tx_fault_list + else: + return [False]*4 - return tx_fault def get_tx_disable(self): """ Retrieves the tx_disable status of this SFP Returns: - A Boolean, True if tx_disable is enabled, False if disabled + A list of boolean values, representing the TX disable status + of each available channel, value is True if SFP channel + is TX disabled, False if not. + E.g., for a tranceiver with four channels: [False, False, True, False] """ if self.port_num < 49: tx_disable = False @@ -806,10 +279,11 @@ def get_tx_disable(self): # tx_disable_soft = (sffbase().test_bit( # data, SFP_TX_DISABLE_SOFT_BIT) != 0) # tx_disable = tx_disable_hard | tx_disable_soft - if tx_disable is not None: - return tx_disable + if int(tx_disable, 10)==0: + return [False] else: - return False + return [True] + else: tx_disable_list = [] @@ -829,8 +303,9 @@ def get_tx_disable(self): 'On' == dom_control_data['data']['TX3Disable']['value']) tx_disable_list.append( 'On' == dom_control_data['data']['TX4Disable']['value']) - - return tx_disable_list + return tx_disable_list + else: + return [False]*4 def get_tx_disable_channel(self): """ @@ -841,18 +316,14 @@ def get_tx_disable_channel(self): As an example, a returned value of 0x5 indicates that channel 0 and channel 2 have been disabled. """ - if self.port_num < 49: - # SFP doesn't support this feature - return False - else: - tx_disable_list = self.get_tx_disable() - if tx_disable_list is None: - return 0 - tx_disabled = 0 - for i in range(len(tx_disable_list)): - if tx_disable_list[i]: - tx_disabled |= 1 << i - return tx_disabled + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled def get_lpmode(self): """ @@ -915,78 +386,6 @@ def get_power_override(self): return power_override - def get_temperature(self): - """ - Retrieves the temperature of this SFP - Returns: - An integer number of current temperature in Celsius - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - return transceiver_dom_info_dict.get("temperature", "N/A") - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - Returns: - An integer number of supply voltage in mV - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - return transceiver_dom_info_dict.get("voltage", "N/A") - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - Returns: - A list of four integer numbers, representing TX bias in mA - for channel 0 to channel 4. - Ex. ['110.09', '111.12', '108.21', '112.09'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - - tx1_bs = transceiver_dom_info_dict.get("tx1bias", "N/A") - if self.port_num < 49: - return [tx1_bs, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - - tx2_bs = transceiver_dom_info_dict.get("tx2bias", "N/A") - tx3_bs = transceiver_dom_info_dict.get("tx3bias", "N/A") - tx4_bs = transceiver_dom_info_dict.get("tx4bias", "N/A") - return [tx1_bs, tx2_bs, tx3_bs, tx4_bs] if transceiver_dom_info_dict else [] - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - Returns: - A list of four integer numbers, representing received optical - power in mW for channel 0 to channel 4. - Ex. ['1.77', '1.71', '1.68', '1.70'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - - rx1_pw = transceiver_dom_info_dict.get("rx1power", "N/A") - if self.port_num < 49: - return [rx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - rx2_pw = transceiver_dom_info_dict.get("rx2power", "N/A") - rx3_pw = transceiver_dom_info_dict.get("rx3power", "N/A") - rx4_pw = transceiver_dom_info_dict.get("rx4power", "N/A") - return [rx1_pw, rx2_pw, rx3_pw, rx4_pw] if transceiver_dom_info_dict else [] - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - Returns: - A list of four integer numbers, representing TX power in mW - for channel 0 to channel 4. - Ex. ['1.86', '1.86', '1.86', '1.86'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - tx1_pw = transceiver_dom_info_dict.get("tx1power", "N/A") - if self.port_num < 49: - return [tx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - tx2_pw = transceiver_dom_info_dict.get("tx2power", "N/A") - tx3_pw = transceiver_dom_info_dict.get("tx3power", "N/A") - tx4_pw = transceiver_dom_info_dict.get("tx4power", "N/A") - return [tx1_pw, tx2_pw, tx3_pw, tx4_pw] - def reset(self): """ Reset SFP and return all user module settings to their default srate. @@ -1000,15 +399,15 @@ def reset(self): cpld_path = self._cpld_mapping[cpld_i] reset_path = "{}{}{}{}".format(CPLD_I2C_PATH, cpld_path, '/module_reset_', self.port_num) ret = self._api_helper.write_txt_file(reset_path, 1) - + if ret is not True: - time.sleep(0.01) - ret = self.self._api_helper.write_txt_file(reset_path, 0) - time.sleep(0.2) return ret - else: - return False + time.sleep(0.01) + ret = self._api_helper.write_txt_file(reset_path, 0) + time.sleep(0.2) + + return ret def tx_disable(self, tx_disable): """ @@ -1120,7 +519,7 @@ def set_lpmode(self, lpmode): if self.port_num < 49: return False # SFP doesn't support this feature else: - if lpmode is True: + if lpmode: self.set_power_override(True, True) else: self.set_power_override(False, False) @@ -1195,28 +594,27 @@ def get_presence(self): else: return False - def get_model(self): + def get_status(self): """ - Retrieves the model number (or part number) of the device + Retrieves the operational status of the device Returns: - string: Model/part number of device + A boolean value, True if device is operating properly, False if not """ - transceiver_dom_info_dict = self.get_transceiver_info() - return transceiver_dom_info_dict.get("model", "N/A") + return self.get_presence() - def get_serial(self): + def get_position_in_parent(self): """ - Retrieves the serial number of the device + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned Returns: - string: Serial number of device + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position """ - transceiver_dom_info_dict = self.get_transceiver_info() - return transceiver_dom_info_dict.get("serial", "N/A") + return self.port_num - def get_status(self): + def is_replaceable(self): """ - Retrieves the operational status of the device + Indicate whether this device is replaceable. Returns: - A boolean value, True if device is operating properly, False if not + bool: True if it is replaceable. """ - return self.get_presence() and self.get_transceiver_bulk_status() + return True diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/thermal.py index 46458d02a118..4d06ad170cba 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/thermal.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/thermal.py @@ -15,22 +15,53 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 11, + "addr": "58" + }, + 1: { + "num": 12, + "addr": "5b" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 11, + "addr": "50" + }, + 1: { + "num": 12, + "addr": "53" + }, +} + +THERMAL_NAME_LIST = ["Temp sensor 1", "Temp sensor 2", + "Temp sensor 3", "Temp sensor 4"] + +PSU_THERMAL_NAME_LIST = ["PSU-1 temp sensor 1", "PSU-2 temp sensor 2"] + +SYSFS_PATH = "/sys/bus/i2c/devices" class Thermal(ThermalBase): """Platform-specific Thermal class""" - THERMAL_NAME_LIST = [] - SYSFS_PATH = "/sys/bus/i2c/devices" - - def __init__(self, thermal_index=0): + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): self.index = thermal_index - - # Add thermal name - self.THERMAL_NAME_LIST.append("Temp sensor 1") - self.THERMAL_NAME_LIST.append("Temp sensor 2") - self.THERMAL_NAME_LIST.append("Temp sensor 3") - self.THERMAL_NAME_LIST.append("Temp sensor 4") - + self.is_psu = is_psu + self.psu_index = psu_index + + if self.is_psu: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + # Set hwmon path i2c_path = { 0: "18-004b/hwmon/hwmon*/", @@ -38,9 +69,9 @@ def __init__(self, thermal_index=0): 2: "20-0049/hwmon/hwmon*/", 3: "21-004a/hwmon/hwmon*/" }.get(self.index, None) - - self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) - self.ss_key = self.THERMAL_NAME_LIST[self.index] + + self.hwmon_path = "{}/{}".format(SYSFS_PATH, i2c_path) + self.ss_key = THERMAL_NAME_LIST[self.index] self.ss_index = 1 def __read_txt_file(self, file_path): @@ -51,20 +82,23 @@ def __read_txt_file(self, file_path): return data except IOError as e: pass - + return None - def __get_temp(self, temp_file): - temp_file_path = os.path.join(self.hwmon_path, temp_file) + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file raw_temp = self.__read_txt_file(temp_file_path) if raw_temp is not None: return float(raw_temp)/1000 else: - return 0 - + return 0 def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True temp_file_path = os.path.join(self.hwmon_path, file_name) for filename in glob.glob(temp_file_path): try: @@ -73,6 +107,8 @@ def __set_threshold(self, file_name, temperature): return True except IOError as e: print("IOError") + return False + def get_temperature(self): @@ -82,7 +118,11 @@ def get_temperature(self): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - temp_file = "temp{}_input".format(self.ss_index) + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + return self.__get_temp(temp_file) def get_high_threshold(self): @@ -92,6 +132,9 @@ def get_high_threshold(self): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ + if self.is_psu: + return 80 + temp_file = "temp{}_max".format(self.ss_index) return self.__get_temp(temp_file) @@ -116,7 +159,10 @@ def get_name(self): Returns: string: The name of the thermal device """ - return self.THERMAL_NAME_LIST[self.index] + if self.is_psu: + return PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return THERMAL_NAME_LIST[self.index] def get_presence(self): """ @@ -124,6 +170,9 @@ def get_presence(self): Returns: bool: True if Thermal is present, False if not """ + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 temp_file = "temp{}_input".format(self.ss_index) temp_file_path = os.path.join(self.hwmon_path, temp_file) raw_txt = self.__read_txt_file(temp_file_path) @@ -138,11 +187,49 @@ def get_status(self): Returns: A boolean value, True if device is operating properly, False if not """ + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + return self.get_presence() and (not int( + self.__read_txt_file(temp_file))) file_str = "temp{}_input".format(self.ss_index) file_path = os.path.join(self.hwmon_path, file_str) raw_txt = self.__read_txt_file(file_path) if raw_txt is None: return False - else: + else: return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False diff --git a/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..5f3b3b07e73f --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json @@ -0,0 +1,15 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.temperature" + + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_AMBER", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN" + } +} diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as7326_56x-r0/pddf/pd-plugin.json deleted file mode 100644 index 317cf23b7362..000000000000 --- a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pd-plugin.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - - "XCVR": - { - "xcvr_present": - { - "i2c": - { - "valmap-SFP": {"1":true, "0":false }, - "valmap-SFP28": {"1":true, "0":false }, - "valmap-QSFP28": {"1":true, "0":false} - } - } - }, - "PSU": - { - "psu_present": - { - "i2c": - { - "valmap": { "1":true, "0":false } - } - }, - - "psu_power_good": - { - "i2c": - { - "valmap": { "1": true, "0":false } - } - }, - - "psu_fan_dir": - { - "i2c": - { - "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } - } - }, - - "PSU_FAN_MAX_SPEED":"18000" - }, - - "FAN": - { - "direction": - { - "i2c": - { - "valmap": {"1":"INTAKE", "0":"EXHAUST"} - } - }, - - "present": - { - "i2c": - { - "valmap": {"1":true, "0":false} - } - }, - - "duty_cycle_to_pwm": "lambda dc: ((dc*100)/625 -1)", - - "pwm_to_duty_cycle": "lambda pwm: (((pwm+1)*625+75)/100)" - } - -} diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json deleted file mode 100644 index 78be7f2b61c9..000000000000 --- a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json +++ /dev/null @@ -1,2916 +0,0 @@ -{ - "PLATFORM": - { - "num_psus":2, - "num_fantrays":6, - "num_fans_pertray":2, - "num_ports":58, - "num_temps": 4, - "pddf_dev_types": - { - "description":"AS7326-56X - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo > /new_device' method", - "CPLD": - [ - "i2c_cpld" - ], - "PSU": - [ - "psu_eeprom", - "psu_pmbus" - ], - "FAN": - [ - "fan_ctrl", - "fan_eeprom" - ], - "PORT_MODULE": - [ - "pddf_xcvr" - ] - }, - "std_kos": - [ - "i2c-i801", - "i2c_dev", - "i2c_mux_pca954x", - "optoe" - ], - "pddf_kos": - [ - "pddf_client_module", - "pddf_cpld_module", - "pddf_cpld_driver", - "pddf_mux_module", - "pddf_xcvr_module", - "pddf_xcvr_driver_module", - "pddf_psu_driver_module", - "pddf_psu_module", - "pddf_fan_driver_module", - "pddf_fan_module", - "pddf_led_module", - "pddf_sysstatus_module" - ] - }, - - "SYSTEM": - { - "dev_info": {"device_type":"CPU", "device_name":"ROOT_COMPLEX", "device_parent":null}, - "i2c": - { - "CONTROLLERS": - [ - { "dev_name":"i2c-0", "dev":"SMBUS0" } - ] - } - }, - - "SMBUS0": - { - "dev_info": {"device_type": "SMBUS", "device_name": "SMBUS0", "device_parent": "SYSTEM"}, - "i2c": - { - "topo_info": {"dev_addr": "0x0"}, - "DEVICES": - [ - {"dev": "EEPROM1"}, - {"dev": "CPU_CPLD"}, - {"dev": "MUX1"} - ] - } - }, - - "EEPROM1": - { - "dev_info": {"device_type": "EEPROM", "device_name": "EEPROM1", "device_parent": "SMBUS0"}, - "i2c": - { - "topo_info": {"parent_bus": "0x0", "dev_addr": "0x56", "dev_type": "24c04"}, - "dev_attr": {"access_mode": "BLOCK"}, - "attr_list": [ - {"attr_name": "eeprom"} - ] - } - }, - - "CPU_CPLD": - { - "dev_info": { "device_type":"CPLD", "device_name":"CPU_CPLD", "device_parent":"SMBUS0"}, - "i2c": - { - "topo_info": { "parent_bus":"0x0", "dev_addr":"0x65", "dev_type":"i2c_cpld"}, - "dev_attr": { } - } - }, - - "MUX1": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX1", "device_parent":"SMBUS0"}, - "i2c": - { - "topo_info": { "parent_bus":"0x0", "dev_addr":"0x77", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x1"}, - "channel": - [ - { "chn":"0", "dev":"MUX2" }, - { "chn":"0", "dev":"MUX3" }, - { "chn":"1", "dev":"MUX4" } - - ] - } - }, - "MUX2": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX2", "device_parent":"MUX1"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1", "dev_addr":"0x70", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x9"}, - "channel": - [ - { "chn":"2", "dev":"FAN-CTRL" }, - { "chn":"3", "dev":"CPLD2" }, - { "chn":"4", "dev":"PSU2" } , - { "chn":"6", "dev":"TEMP1" }, - { "chn":"6", "dev":"TEMP2" }, - { "chn":"6", "dev":"TEMP3" }, - { "chn":"6", "dev":"TEMP4" } - ] - } - }, - "MUX3": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX3", "device_parent":"MUX1"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1", "dev_addr":"0x71", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x11"}, - "channel": - [ - { "chn":"0", "dev":"PSU1" }, - { "chn":"1", "dev":"CPLD1" }, - { "chn":"2", "dev":"CPLD3" }, - { "chn":"5", "dev":"PORT57" }, - { "chn":"6", "dev":"PORT58" }, - { "chn":"7", "dev":"MUX11" } - ] - } - }, - "MUX4": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX4", "device_parent":"MUX1"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2", "dev_addr":"0x70", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x21"}, - "channel": - [ - { "chn":"0", "dev":"MUX5" }, - { "chn":"1", "dev":"MUX6" }, - { "chn":"2", "dev":"MUX7" }, - { "chn":"3", "dev":"MUX8" }, - { "chn":"4", "dev":"MUX9" }, - { "chn":"5", "dev":"MUX10" } - ] - } - }, - "PSU2": - { - "dev_info": { "device_type":"PSU", "device_name":"PSU2", "device_parent":"MUX2" }, - "dev_attr": { "dev_idx":"2", "num_psu_fans":"1"}, - "i2c": - { - "interface": - [ - { "itf":"pmbus", "dev":"PSU2-PMBUS"} - ] - } - }, - - "PSU2-PMBUS": - { - "dev_info": {"device_type":"PSU-PMBUS", "device_name":"PSU2-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU2"}, - "i2c": - { - "topo_info": { "parent_bus":"0xd", "dev_addr":"0x5b", "dev_type":"psu_pmbus"}, - "attr_list": - [ - { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_serial_num", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, - { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} - ] - } - }, - - "PSU1": - { - "dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX3" }, - "dev_attr": { "dev_idx":"1", "num_psu_fans":"1"}, - "i2c": - { - "interface": - [ - { "itf":"pmbus", "dev":"PSU1-PMBUS"} - ] - } - }, - - "PSU1-PMBUS": - { - "dev_info": {"device_type":"PSU-PMBUS", "device_name":"PSU1-PMBUS", "device_parent":"MUX3", "virt_parent":"PSU1"}, - "i2c": - { - "topo_info": { "parent_bus":"0x11", "dev_addr":"0x59", "dev_type":"psu_pmbus"}, - "attr_list": - [ - { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"psu_model_name", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_serial_num", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, - { "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} - ] - } - }, - - "CPLD1": - { - "dev_info": { "device_type":"CPLD", "device_name":"CPLD1", "device_parent":"MUX3"}, - "i2c": - { - "topo_info": { "parent_bus":"0x12", "dev_addr":"0x60", "dev_type":"i2c_cpld"}, - "dev_attr":{} - } - }, - "CPLD2": - { - "dev_info": { "device_type":"CPLD", "device_name":"CPLD2", "device_parent":"MUX2"}, - "i2c": - { - "topo_info": { "parent_bus":"0xc", "dev_addr":"0x62", "dev_type":"i2c_cpld"}, - "dev_attr":{} - } - }, - "CPLD3": - { - "dev_info": { "device_type":"CPLD", "device_name":"CPLD3", "device_parent":"MUX3"}, - "i2c": - { - "topo_info": { "parent_bus":"0x13", "dev_addr":"0x64", "dev_type":"i2c_cpld"}, - "dev_attr":{} - } - }, - "TEMP1" : - { - "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX2"}, - "i2c": - { - "topo_info": { "parent_bus":"0xf", "dev_addr":"0x48", "dev_type":"lm75"}, - "attr_list": - [ - { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, - { "attr_name": "temp1_max_hyst"}, - { "attr_name": "temp1_input"} - ] - } - }, - "TEMP2" : - { - "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX2"}, - "i2c": - { - "topo_info": { "parent_bus":"0xf", "dev_addr":"0x49", "dev_type":"lm75"}, - "attr_list": - [ - { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, - { "attr_name": "temp1_max_hyst"}, - { "attr_name": "temp1_input"} - ] - } - }, - "TEMP3" : - { - "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX2"}, - "i2c": - { - "topo_info": { "parent_bus":"0xf", "dev_addr":"0x4A", "dev_type":"lm75"}, - "attr_list": - [ - { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, - { "attr_name": "temp1_max_hyst"}, - { "attr_name": "temp1_input"} - ] - } - }, - "TEMP4" : - { - "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX2"}, - "i2c": - { - "topo_info": { "parent_bus":"0xf", "dev_addr":"0x4B", "dev_type":"lm75"}, - "attr_list": - [ - { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, - { "attr_name": "temp1_max_hyst"}, - { "attr_name": "temp1_input"} - ] - } - }, - "FAN-CTRL": - { - "dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL", "device_parent":"MUX2"}, - "i2c": - { - "topo_info": { "parent_bus":"0xb", "dev_addr":"0x66", "dev_type":"fan_ctrl"}, - "dev_attr": { "num_fantrays":"5"}, - "attr_list": - [ - { "attr_name":"fan1_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan2_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan3_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan4_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan5_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan6_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan7_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x8", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan8_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x8", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan9_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan10_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan11_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x20", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan12_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0f", "attr_mask":"0x20", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"fan1_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"fan2_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"fan3_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x2", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"fan4_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x2", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"fan5_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"fan6_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"fan7_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"fan8_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"fan9_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x10", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"fan10_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x10", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"fan11_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x20", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"fan12_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x20", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"fan1_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x12", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, - { "attr_name":"fan2_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x22", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, - { "attr_name":"fan3_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x13", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, - { "attr_name":"fan4_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x23", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, - { "attr_name":"fan5_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x14", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, - { "attr_name":"fan6_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x24", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, - { "attr_name":"fan7_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x15", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, - { "attr_name":"fan8_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x25", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, - { "attr_name":"fan9_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x16", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, - { "attr_name":"fan10_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x26", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, - { "attr_name":"fan11_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x17", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, - { "attr_name":"fan12_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x27", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, - { "attr_name":"fan1_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan2_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan3_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan4_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan5_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan6_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan7_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan8_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan9_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan10_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan11_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" }, - { "attr_name":"fan12_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0xF", "attr_len":"1" } - ] - } - }, - "PORT57": - { - "dev_info": { "device_type":"SFP", "device_name":"PORT57", "device_parent":"MUX3"}, - "dev_attr": { "dev_idx":"57"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT57-EEPROM" }, - { "itf":"control", "dev":"PORT57-CTRL" } - ] - } - }, - "PORT57-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT57-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT57"}, - "i2c": - { - "topo_info": { "parent_bus":"0x16", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT57-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT57-CTRL", "device_parent":"MUX3", "virt_parent":"PORT57"}, - "i2c": - { - "topo_info": { "parent_bus":"0x16", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1c", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x16", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x19", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} - ] - } - }, - "PORT58": - { - "dev_info": { "device_type":"SFP", "device_name":"PORT58", "device_parent":"MUX3"}, - "dev_attr": { "dev_idx":"58"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT58-EEPROM" }, - { "itf":"control", "dev":"PORT58-CTRL" } - ] - } - }, - "PORT58-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT58-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT58"}, - "i2c": - { - "topo_info": { "parent_bus":"0x17", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT58-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT58-CTRL", "device_parent":"MUX3", "virt_parent":"PORT58"}, - "i2c": - { - "topo_info": { "parent_bus":"0x17", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1c", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x16", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x19", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} - ] - } - }, - "MUX5": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX5", "device_parent":"MUX4"}, - "i2c": - { - "topo_info": { "parent_bus":"0x21", "dev_addr":"0x71", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x29"}, - "channel": - [ - { "chn":"0", "dev":"PORT2" }, - { "chn":"1", "dev":"PORT1" }, - { "chn":"2", "dev":"PORT4" }, - { "chn":"3", "dev":"PORT3" }, - { "chn":"4", "dev":"PORT6" }, - { "chn":"5", "dev":"PORT7" }, - { "chn":"6", "dev":"PORT5" }, - { "chn":"7", "dev":"PORT9" } - ] - } - }, - "MUX6": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX6", "device_parent":"MUX4"}, - "i2c": - { - "topo_info": { "parent_bus":"0x22", "dev_addr":"0x72", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x31"}, - "channel": - [ - { "chn":"0", "dev":"PORT10" }, - { "chn":"1", "dev":"PORT8" }, - { "chn":"2", "dev":"PORT12" }, - { "chn":"3", "dev":"PORT11" }, - { "chn":"4", "dev":"PORT13" }, - { "chn":"5", "dev":"PORT16" }, - { "chn":"6", "dev":"PORT15" }, - { "chn":"7", "dev":"PORT14" } - ] - } - }, - "MUX7": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX7", "device_parent":"MUX4"}, - "i2c": - { - "topo_info": { "parent_bus":"0x23", "dev_addr":"0x73", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x39"}, - "channel": - [ - { "chn":"0", "dev":"PORT18" }, - { "chn":"1", "dev":"PORT17" }, - { "chn":"2", "dev":"PORT20" }, - { "chn":"3", "dev":"PORT19" }, - { "chn":"4", "dev":"PORT21" }, - { "chn":"5", "dev":"PORT23" }, - { "chn":"6", "dev":"PORT22" }, - { "chn":"7", "dev":"PORT24" } - ] - } - }, - "MUX8": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX8", "device_parent":"MUX4"}, - "i2c": - { - "topo_info": { "parent_bus":"0x24", "dev_addr":"0x74", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x41"}, - "channel": - [ - { "chn":"0", "dev":"PORT27" }, - { "chn":"1", "dev":"PORT25" }, - { "chn":"2", "dev":"PORT28" }, - { "chn":"3", "dev":"PORT26" }, - { "chn":"4", "dev":"PORT29" }, - { "chn":"5", "dev":"PORT32" }, - { "chn":"6", "dev":"PORT30" }, - { "chn":"7", "dev":"PORT31" } - ] - } - }, - "MUX9": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX9", "device_parent":"MUX4"}, - "i2c": - { - "topo_info": { "parent_bus":"0x25", "dev_addr":"0x75", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x49"}, - "channel": - [ - { "chn":"0", "dev":"PORT34" }, - { "chn":"1", "dev":"PORT33" }, - { "chn":"2", "dev":"PORT36" }, - { "chn":"3", "dev":"PORT35" }, - { "chn":"4", "dev":"PORT37" }, - { "chn":"5", "dev":"PORT39" }, - { "chn":"6", "dev":"PORT38" }, - { "chn":"7", "dev":"PORT40" } - ] - } - }, - "MUX10": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX10", "device_parent":"MUX4"}, - "i2c": - { - "topo_info": { "parent_bus":"0x26", "dev_addr":"0x76", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x51"}, - "channel": - [ - { "chn":"0", "dev":"PORT41" }, - { "chn":"1", "dev":"PORT42" }, - { "chn":"2", "dev":"PORT45" }, - { "chn":"3", "dev":"PORT43" }, - { "chn":"4", "dev":"PORT44" }, - { "chn":"5", "dev":"PORT48" }, - { "chn":"6", "dev":"PORT46" }, - { "chn":"7", "dev":"PORT47" } - ] - } - }, - "MUX11": - { - "dev_info": { "device_type":"MUX", "device_name":"MUX11", "device_parent":"MUX3"}, - "i2c": - { - "topo_info": { "parent_bus":"0x18", "dev_addr":"0x72", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x19"}, - "channel": - [ - { "chn":"0", "dev":"PORT49" }, - { "chn":"1", "dev":"PORT50" }, - { "chn":"2", "dev":"PORT51" }, - { "chn":"3", "dev":"PORT52" }, - { "chn":"4", "dev":"PORT53" }, - { "chn":"5", "dev":"PORT54" }, - { "chn":"6", "dev":"PORT55" }, - { "chn":"7", "dev":"PORT56" } - ] - } - }, - - - - "PORT2": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT2", "device_parent":"MUX5"}, - "dev_attr": { "dev_idx":"2"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT2-EEPROM" }, - { "itf":"control", "dev":"PORT2-CTRL" } - ] - } - }, - "PORT2-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT2-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT2"}, - "i2c": - { - "topo_info": { "parent_bus":"0x29", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT2-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT2-CTRL", "device_parent":"MUX5", "virt_parent":"PORT2"}, - "i2c": - { - "topo_info": { "parent_bus":"0x29", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xb", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} - ] - } - }, - "PORT1": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT1", "device_parent":"MUX5"}, - "dev_attr": { "dev_idx":"1"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT1-EEPROM" }, - { "itf":"control", "dev":"PORT1-CTRL" } - ] - } - }, - "PORT1-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT1-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT1"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2a", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT1-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT1-CTRL", "device_parent":"MUX5", "virt_parent":"PORT1"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xb", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} - ] - } - }, - "PORT4": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT4", "device_parent":"MUX5"}, - "dev_attr": { "dev_idx":"4"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT4-EEPROM" }, - { "itf":"control", "dev":"PORT4-CTRL" } - ] - } - }, - "PORT4-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT4-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT4"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2b", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT4-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT4-CTRL", "device_parent":"MUX5", "virt_parent":"PORT4"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xB", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} - ] - } - }, - "PORT3": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT3", "device_parent":"MUX5"}, - "dev_attr": { "dev_idx":"3"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT3-EEPROM" }, - { "itf":"control", "dev":"PORT3-CTRL" } - ] - } - }, - "PORT3-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT3-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT3"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2c", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT3-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT3-CTRL", "device_parent":"MUX5", "virt_parent":"PORT3"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xB", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} - ] - } - }, - "PORT6": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT6", "device_parent":"MUX5"}, - "dev_attr": { "dev_idx":"6"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT6-EEPROM" }, - { "itf":"control", "dev":"PORT6-CTRL" } - ] - } - }, - "PORT6-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT6-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT6"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2d", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT6-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT6-CTRL", "device_parent":"MUX5", "virt_parent":"PORT6"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xB", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} - ] - } - }, - "PORT7": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT7", "device_parent":"MUX5"}, - "dev_attr": { "dev_idx":"7"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT7-EEPROM" }, - { "itf":"control", "dev":"PORT7-CTRL" } - ] - } - }, - "PORT7-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT7-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT7"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2e", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT7-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT7-CTRL", "device_parent":"MUX5", "virt_parent":"PORT7"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xB", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} - ] - } - }, - "PORT5": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT5", "device_parent":"MUX5"}, - "dev_attr": { "dev_idx":"5"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT5-EEPROM" }, - { "itf":"control", "dev":"PORT5-CTRL" } - ] - } - }, - "PORT5-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT5-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT5"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2f", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT5-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT5-CTRL", "device_parent":"MUX5", "virt_parent":"PORT5"}, - "i2c": - { - "topo_info": { "parent_bus":"0x2f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_offset":"0xB", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} - ] - } - }, - "PORT9": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT9", "device_parent":"MUX5"}, - "dev_attr": { "dev_idx":"9"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT9-EEPROM" }, - { "itf":"control", "dev":"PORT9-CTRL" } - ] - } - }, - "PORT9-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT9-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT9"}, - "i2c": - { - "topo_info": { "parent_bus":"0x30", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT9-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT9-CTRL", "device_parent":"MUX5", "virt_parent":"PORT9"}, - "i2c": - { - "topo_info": { "parent_bus":"0x30", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_offset":"0xC", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} - ] - } - }, - "PORT10": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT10", "device_parent":"MUX6"}, - "dev_attr": { "dev_idx":"10"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT10-EEPROM" }, - { "itf":"control", "dev":"PORT10-CTRL" } - ] - } - }, - "PORT10-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT10-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT10"}, - "i2c": - { - "topo_info": { "parent_bus":"0x31", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT10-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT10-CTRL", "device_parent":"MUX6", "virt_parent":"PORT10"}, - "i2c": - { - "topo_info": { "parent_bus":"0x31", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xC", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} - ] - } - }, - "PORT8": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT8", "device_parent":"MUX6"}, - "dev_attr": { "dev_idx":"8"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT8-EEPROM" }, - { "itf":"control", "dev":"PORT8-CTRL" } - ] - } - }, - "PORT8-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT8-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT8"}, - "i2c": - { - "topo_info": { "parent_bus":"0x32", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT8-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT8-CTRL", "device_parent":"MUX6", "virt_parent":"PORT8"}, - "i2c": - { - "topo_info": { "parent_bus":"0x32", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xB", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} - ] - } - }, - "PORT12": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT12", "device_parent":"MUX6"}, - "dev_attr": { "dev_idx":"12"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT12-EEPROM" }, - { "itf":"control", "dev":"PORT12-CTRL" } - ] - } - }, - "PORT12-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT12-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT12"}, - "i2c": - { - "topo_info": { "parent_bus":"0x33", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT12-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT12-CTRL", "device_parent":"MUX6", "virt_parent":"PORT12"}, - "i2c": - { - "topo_info": { "parent_bus":"0x33", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xC", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} - ] - } - }, - "PORT11": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT11", "device_parent":"MUX6"}, - "dev_attr": { "dev_idx":"11"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT11-EEPROM" }, - { "itf":"control", "dev":"PORT11-CTRL" } - ] - } - }, - "PORT11-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT11-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT11"}, - "i2c": - { - "topo_info": { "parent_bus":"0x34", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT11-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT11-CTRL", "device_parent":"MUX6", "virt_parent":"PORT11"}, - "i2c": - { - "topo_info": { "parent_bus":"0x34", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xC", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} - ] - } - }, - "PORT13": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT13", "device_parent":"MUX6"}, - "dev_attr": { "dev_idx":"13"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT13-EEPROM" }, - { "itf":"control", "dev":"PORT13-CTRL" } - ] - } - }, - "PORT13-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT13-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT13"}, - "i2c": - { - "topo_info": { "parent_bus":"0x35", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT13-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT13-CTRL", "device_parent":"MUX6", "virt_parent":"PORT13"}, - "i2c": - { - "topo_info": { "parent_bus":"0x35", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xC", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} - ] - } - }, - "PORT16": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT16", "device_parent":"MUX6"}, - "dev_attr": { "dev_idx":"16"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT16-EEPROM" }, - { "itf":"control", "dev":"PORT16-CTRL" } - ] - } - }, - "PORT16-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT16-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT16"}, - "i2c": - { - "topo_info": { "parent_bus":"0x36", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT16-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT16-CTRL", "device_parent":"MUX6", "virt_parent":"PORT16"}, - "i2c": - { - "topo_info": { "parent_bus":"0x36", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xC", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} - ] - } - }, - "PORT15": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT15", "device_parent":"MUX6"}, - "dev_attr": { "dev_idx":"15"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT15-EEPROM" }, - { "itf":"control", "dev":"PORT15-CTRL" } - ] - } - }, - "PORT15-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT15-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT15"}, - "i2c": - { - "topo_info": { "parent_bus":"0x37", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT15-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT15-CTRL", "device_parent":"MUX6", "virt_parent":"PORT15"}, - "i2c": - { - "topo_info": { "parent_bus":"0x37", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xC", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} - ] - } - }, - "PORT14": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT14", "device_parent":"MUX6"}, - "dev_attr": { "dev_idx":"14"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT14-EEPROM" }, - { "itf":"control", "dev":"PORT14-CTRL" } - ] - } - }, - "PORT14-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT14-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT14"}, - "i2c": - { - "topo_info": { "parent_bus":"0x38", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT14-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT14-CTRL", "device_parent":"MUX6", "virt_parent":"PORT14"}, - "i2c": - { - "topo_info": { "parent_bus":"0x38", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xC", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} - ] - } - }, - "PORT18": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT18", "device_parent":"MUX7"}, - "dev_attr": { "dev_idx":"18"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT18-EEPROM" }, - { "itf":"control", "dev":"PORT18-CTRL" } - ] - } - }, - "PORT18-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT18-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT18"}, - "i2c": - { - "topo_info": { "parent_bus":"0x39", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT18-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT18-CTRL", "device_parent":"MUX7", "virt_parent":"PORT18"}, - "i2c": - { - "topo_info": { "parent_bus":"0x39", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x5", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x9", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xD", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} - ] - } - }, - - "PORT17": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT17", "device_parent":"MUX7"}, - "dev_attr": { "dev_idx":"17"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT17-EEPROM" }, - { "itf":"control", "dev":"PORT17-CTRL" } - ] - } - }, - "PORT17-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT17-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT17"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3a", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT17-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT17-CTRL", "device_parent":"MUX7", "virt_parent":"PORT17"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x5", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x9", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xD", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} - ] - } - }, - - "PORT20": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT20", "device_parent":"MUX7"}, - "dev_attr": { "dev_idx":"20"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT20-EEPROM" }, - { "itf":"control", "dev":"PORT20-CTRL" } - ] - } - }, - "PORT20-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT20-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT20"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3b", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT20-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT20-CTRL", "device_parent":"MUX7", "virt_parent":"PORT20"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x5", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x9", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xD", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} - ] - } - }, - - "PORT19": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT19", "device_parent":"MUX7"}, - "dev_attr": { "dev_idx":"19"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT19-EEPROM" }, - { "itf":"control", "dev":"PORT19-CTRL" } - ] - } - }, - "PORT19-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT19-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT19"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3c", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT19-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT19-CTRL", "device_parent":"MUX7", "virt_parent":"PORT19"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x5", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x9", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xD", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} - ] - } - }, - - "PORT21": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT21", "device_parent":"MUX7"}, - "dev_attr": { "dev_idx":"21"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT21-EEPROM" }, - { "itf":"control", "dev":"PORT21-CTRL" } - ] - } - }, - "PORT21-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT21-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT21"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3d", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT21-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT21-CTRL", "device_parent":"MUX7", "virt_parent":"PORT21"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x5", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x9", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xD", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} - ] - } - }, - - "PORT23": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT23", "device_parent":"MUX7"}, - "dev_attr": { "dev_idx":"23"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT23-EEPROM" }, - { "itf":"control", "dev":"PORT23-CTRL" } - ] - } - }, - "PORT23-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT23-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT23"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3e", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT23-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT23-CTRL", "device_parent":"MUX7", "virt_parent":"PORT23"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x5", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x9", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xD", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} - ] - } - }, - - "PORT22": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT22", "device_parent":"MUX7"}, - "dev_attr": { "dev_idx":"22"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT22-EEPROM" }, - { "itf":"control", "dev":"PORT22-CTRL" } - ] - } - }, - "PORT22-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT22-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT22"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3f", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT22-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT22-CTRL", "device_parent":"MUX7", "virt_parent":"PORT22"}, - "i2c": - { - "topo_info": { "parent_bus":"0x3f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x5", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x9", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xD", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} - ] - } - }, - "PORT24": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT24", "device_parent":"MUX7"}, - "dev_attr": { "dev_idx":"24"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT24-EEPROM" }, - { "itf":"control", "dev":"PORT24-CTRL" } - ] - } - }, - "PORT24-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT24-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT24"}, - "i2c": - { - "topo_info": { "parent_bus":"0x40", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT24-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT24-CTRL", "device_parent":"MUX7", "virt_parent":"PORT24"}, - "i2c": - { - "topo_info": { "parent_bus":"0x40", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x5", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x9", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xD", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} - ] - } - }, - "PORT27": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT27", "device_parent":"MUX8"}, - "dev_attr": { "dev_idx":"27"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT27-EEPROM" }, - { "itf":"control", "dev":"PORT27-CTRL" } - ] - } - }, - "PORT27-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT27-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT27"}, - "i2c": - { - "topo_info": { "parent_bus":"0x41", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT27-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT27-CTRL", "device_parent":"MUX8", "virt_parent":"PORT27"}, - "i2c": - { - "topo_info": { "parent_bus":"0x41", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x6", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xA", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xE", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} - ] - } - }, - "PORT25": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT25", "device_parent":"MUX8"}, - "dev_attr": { "dev_idx":"25"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT25-EEPROM" }, - { "itf":"control", "dev":"PORT25-CTRL" } - ] - } - }, - "PORT25-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT25-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT25"}, - "i2c": - { - "topo_info": { "parent_bus":"0x42", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT25-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT25-CTRL", "device_parent":"MUX8", "virt_parent":"PORT25"}, - "i2c": - { - "topo_info": { "parent_bus":"0x42", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x6", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xA", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xE", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} - ] - } - }, - - "PORT28": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT28", "device_parent":"MUX8"}, - "dev_attr": { "dev_idx":"28"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT28-EEPROM" }, - { "itf":"control", "dev":"PORT28-CTRL" } - ] - } - }, - "PORT28-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT28-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT28"}, - "i2c": - { - "topo_info": { "parent_bus":"0x43", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT28-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT28-CTRL", "device_parent":"MUX8", "virt_parent":"PORT28"}, - "i2c": - { - "topo_info": { "parent_bus":"0x43", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x6", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xA", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xE", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} - ] - } - }, - "PORT26": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT26", "device_parent":"MUX8"}, - "dev_attr": { "dev_idx":"26"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT26-EEPROM" }, - { "itf":"control", "dev":"PORT26-CTRL" } - ] - } - }, - "PORT26-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT26-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT26"}, - "i2c": - { - "topo_info": { "parent_bus":"0x44", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT26-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT26-CTRL", "device_parent":"MUX8", "virt_parent":"PORT26"}, - "i2c": - { - "topo_info": { "parent_bus":"0x44", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x6", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xA", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xE", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} - ] - } - }, - "PORT29": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT29", "device_parent":"MUX8"}, - "dev_attr": { "dev_idx":"29"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT29-EEPROM" }, - { "itf":"control", "dev":"PORT29-CTRL" } - ] - } - }, - "PORT29-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT29-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT29"}, - "i2c": - { - "topo_info": { "parent_bus":"0x45", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT29-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT29-CTRL", "device_parent":"MUX8", "virt_parent":"PORT29"}, - "i2c": - { - "topo_info": { "parent_bus":"0x45", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x6", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xA", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xE", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} - ] - } - }, - - "PORT32": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT32", "device_parent":"MUX8"}, - "dev_attr": { "dev_idx":"32"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT32-EEPROM" }, - { "itf":"control", "dev":"PORT32-CTRL" } - ] - } - }, - "PORT32-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT32-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT32"}, - "i2c": - { - "topo_info": { "parent_bus":"0x46", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT32-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT32-CTRL", "device_parent":"MUX8", "virt_parent":"PORT32"}, - "i2c": - { - "topo_info": { "parent_bus":"0x46", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1A", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x14", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x17", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} - ] - } - }, - "PORT30": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT30", "device_parent":"MUX8"}, - "dev_attr": { "dev_idx":"30"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT30-EEPROM" }, - { "itf":"control", "dev":"PORT30-CTRL" } - ] - } - }, - "PORT30-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT30-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT30"}, - "i2c": - { - "topo_info": { "parent_bus":"0x47", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT30-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT30-CTRL", "device_parent":"MUX8", "virt_parent":"PORT30"}, - "i2c": - { - "topo_info": { "parent_bus":"0x47", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x6", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xA", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xE", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} - ] - } - }, - - "PORT31": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT31", "device_parent":"MUX8"}, - "dev_attr": { "dev_idx":"31"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT31-EEPROM" }, - { "itf":"control", "dev":"PORT31-CTRL" } - ] - } - }, - "PORT31-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT31-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT31"}, - "i2c": - { - "topo_info": { "parent_bus":"0x48", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT31-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT31-CTRL", "device_parent":"MUX8", "virt_parent":"PORT31"}, - "i2c": - { - "topo_info": { "parent_bus":"0x48", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1A", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x14", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x17", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} - ] - } - }, - - "PORT34": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT34", "device_parent":"MUX9"}, - "dev_attr": { "dev_idx":"34"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT34-EEPROM" }, - { "itf":"control", "dev":"PORT34-CTRL" } - ] - } - }, - "PORT34-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT34-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT34"}, - "i2c": - { - "topo_info": { "parent_bus":"0x49", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT34-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT34-CTRL", "device_parent":"MUX9", "virt_parent":"PORT34"}, - "i2c": - { - "topo_info": { "parent_bus":"0x49", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1A", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x14", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x17", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} - ] - } - }, - - "PORT33": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT33", "device_parent":"MUX9"}, - "dev_attr": { "dev_idx":"33"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT33-EEPROM" }, - { "itf":"control", "dev":"PORT33-CTRL" } - ] - } - }, - "PORT33-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT33-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT33"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4a", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT33-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT33-CTRL", "device_parent":"MUX9", "virt_parent":"PORT33"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1A", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x14", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x17", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} - ] - } - }, - - "PORT36": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT36", "device_parent":"MUX9"}, - "dev_attr": { "dev_idx":"36"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT36-EEPROM" }, - { "itf":"control", "dev":"PORT36-CTRL" } - ] - } - }, - "PORT36-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT36-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT36"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4b", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT36-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT36-CTRL", "device_parent":"MUX9", "virt_parent":"PORT36"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1A", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x14", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x17", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} - ] - } - }, - - "PORT35": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT35", "device_parent":"MUX9"}, - "dev_attr": { "dev_idx":"35"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT35-EEPROM" }, - { "itf":"control", "dev":"PORT35-CTRL" } - ] - } - }, - "PORT35-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT35-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT35"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4c", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT35-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT35-CTRL", "device_parent":"MUX9", "virt_parent":"PORT35"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1A", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x14", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x17", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} - ] - } - }, - - "PORT37": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT37", "device_parent":"MUX9"}, - "dev_attr": { "dev_idx":"37"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT37-EEPROM" }, - { "itf":"control", "dev":"PORT37-CTRL" } - ] - } - }, - "PORT37-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT37-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT37"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4d", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT37-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT37-CTRL", "device_parent":"MUX9", "virt_parent":"PORT37"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1A", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x14", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x17", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} - ] - } - }, - - "PORT39": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT39", "device_parent":"MUX9"}, - "dev_attr": { "dev_idx":"39"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT39-EEPROM" }, - { "itf":"control", "dev":"PORT39-CTRL" } - ] - } - }, - "PORT39-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT39-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT39"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4e", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT39-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT39-CTRL", "device_parent":"MUX9", "virt_parent":"PORT39"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} - ] - } - }, - - "PORT38": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT38", "device_parent":"MUX9"}, - "dev_attr": { "dev_idx":"38"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT38-EEPROM" }, - { "itf":"control", "dev":"PORT38-CTRL" } - ] - } - }, - "PORT38-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT38-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT38"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4f", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT38-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT38-CTRL", "device_parent":"MUX9", "virt_parent":"PORT38"}, - "i2c": - { - "topo_info": { "parent_bus":"0x4f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1A", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x14", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x17", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} - ] - } - }, - - "PORT40": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT40", "device_parent":"MUX9"}, - "dev_attr": { "dev_idx":"40"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT40-EEPROM" }, - { "itf":"control", "dev":"PORT40-CTRL" } - ] - } - }, - "PORT40-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT40-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT40"}, - "i2c": - { - "topo_info": { "parent_bus":"0x50", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT40-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT40-CTRL", "device_parent":"MUX9", "virt_parent":"PORT40"}, - "i2c": - { - "topo_info": { "parent_bus":"0x50", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} - ] - } - }, - "PORT41": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT41", "device_parent":"MUX10"}, - "dev_attr": { "dev_idx":"41"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT41-EEPROM" }, - { "itf":"control", "dev":"PORT41-CTRL" } - ] - } - }, - "PORT41-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT41-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT41"}, - "i2c": - { - "topo_info": { "parent_bus":"0x51", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT41-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT41-CTRL", "device_parent":"MUX10", "virt_parent":"PORT41"}, - "i2c": - { - "topo_info": { "parent_bus":"0x51", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} - ] - } - }, - "PORT42": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT42", "device_parent":"MUX10"}, - "dev_attr": { "dev_idx":"42"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT42-EEPROM" }, - { "itf":"control", "dev":"PORT42-CTRL" } - ] - } - }, - "PORT42-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT42-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT42"}, - "i2c": - { - "topo_info": { "parent_bus":"0x52", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT42-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT42-CTRL", "device_parent":"MUX10", "virt_parent":"PORT42"}, - "i2c": - { - "topo_info": { "parent_bus":"0x52", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} - ] - } - }, - "PORT45": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT45", "device_parent":"MUX10"}, - "dev_attr": { "dev_idx":"45"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT45-EEPROM" }, - { "itf":"control", "dev":"PORT45-CTRL" } - ] - } - }, - "PORT45-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT45-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT45"}, - "i2c": - { - "topo_info": { "parent_bus":"0x53", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT45-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT45-CTRL", "device_parent":"MUX10", "virt_parent":"PORT45"}, - "i2c": - { - "topo_info": { "parent_bus":"0x53", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} - ] - } - }, - "PORT43": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT43", "device_parent":"MUX10"}, - "dev_attr": { "dev_idx":"43"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT43-EEPROM" }, - { "itf":"control", "dev":"PORT43-CTRL" } - ] - } - }, - "PORT43-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT43-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT43"}, - "i2c": - { - "topo_info": { "parent_bus":"0x54", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT43-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT43-CTRL", "device_parent":"MUX10", "virt_parent":"PORT43"}, - "i2c": - { - "topo_info": { "parent_bus":"0x54", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_devname":"CPLD1", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B","attr_devname":"CPLD1", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_devname":"CPLD1", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_devname":"CPLD1","attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} - ] - } - }, - "PORT44": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT44", "device_parent":"MUX10"}, - "dev_attr": { "dev_idx":"44"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT44-EEPROM" }, - { "itf":"control", "dev":"PORT44-CTRL" } - ] - } - }, - "PORT44-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT44-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT44"}, - "i2c": - { - "topo_info": { "parent_bus":"0x55", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT44-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT44-CTRL", "device_parent":"MUX10", "virt_parent":"PORT44"}, - "i2c": - { - "topo_info": { "parent_bus":"0x55", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} - ] - } - }, - "PORT48": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT48", "device_parent":"MUX10"}, - "dev_attr": { "dev_idx":"48"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT48-EEPROM" }, - { "itf":"control", "dev":"PORT48-CTRL" } - ] - } - }, - "PORT48-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT48-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT48"}, - "i2c": - { - "topo_info": { "parent_bus":"0x56", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT48-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT48-CTRL", "device_parent":"MUX10", "virt_parent":"PORT48"}, - "i2c": - { - "topo_info": { "parent_bus":"0x56", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1","attr_offset":"0x1C", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x16", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x19", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} - ] - } - }, - "PORT46": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT46", "device_parent":"MUX10"}, - "dev_attr": { "dev_idx":"46"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT46-EEPROM" }, - { "itf":"control", "dev":"PORT46-CTRL" } - ] - } - }, - "PORT46-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT46-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT46"}, - "i2c": - { - "topo_info": { "parent_bus":"0x57", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT46-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT46-CTRL", "device_parent":"MUX10", "virt_parent":"PORT46"}, - "i2c": - { - "topo_info": { "parent_bus":"0x57", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1","attr_offset":"0x1B", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1","attr_offset":"0x18", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} - ] - } - }, - "PORT47": - { - "dev_info": { "device_type":"SFP28", "device_name":"PORT47", "device_parent":"MUX10"}, - "dev_attr": { "dev_idx":"47"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT47-EEPROM" }, - { "itf":"control", "dev":"PORT47-CTRL" } - ] - } - }, - "PORT47-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT47-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT47"}, - "i2c": - { - "topo_info": { "parent_bus":"0x58", "dev_addr":"0x50", "dev_type":"optoe2"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT47-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT47-CTRL", "device_parent":"MUX10", "virt_parent":"PORT47"}, - "i2c": - { - "topo_info": { "parent_bus":"0x58", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1C", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x16", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x19", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} - ] - } - }, - - "PORT49": - { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT49", "device_parent":"MUX11"}, - "dev_attr": { "dev_idx":"49"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT49-EEPROM" }, - { "itf":"control", "dev":"PORT49-CTRL" } - ] - } - }, - "PORT49-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT49-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT49"}, - "i2c": - { - "topo_info": { "parent_bus":"0x19", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT49-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT49-CTRL", "device_parent":"MUX11", "virt_parent":"PORT49"}, - "i2c": - { - "topo_info": { "parent_bus":"0x19", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0xA", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"} - - ] - } - }, - - "PORT50": - { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT50", "device_parent":"MUX11"}, - "dev_attr": { "dev_idx":"50"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT50-EEPROM" }, - { "itf":"control", "dev":"PORT50-CTRL" } - ] - } - }, - "PORT50-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT50-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT50"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1a", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT50-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT50-CTRL", "device_parent":"MUX11", "virt_parent":"PORT50"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0xA", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"} - - ] - } - }, - - "PORT51": - { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT51", "device_parent":"MUX11"}, - "dev_attr": { "dev_idx":"51"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT51-EEPROM" }, - { "itf":"control", "dev":"PORT51-CTRL" } - ] - } - }, - "PORT51-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT51-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT51"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1b", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT51-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT51-CTRL", "device_parent":"MUX11", "virt_parent":"PORT51"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0xA", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} - - ] - } - }, - - "PORT52": - { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT52", "device_parent":"MUX11"}, - "dev_attr": { "dev_idx":"52"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT52-EEPROM" }, - { "itf":"control", "dev":"PORT52-CTRL" } - ] - } - }, - "PORT52-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT52-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT52"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1c", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT52-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT52-CTRL", "device_parent":"MUX11", "virt_parent":"PORT52"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0xA", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"} - - ] - } - }, - - "PORT53": - { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT53", "device_parent":"MUX11"}, - "dev_attr": { "dev_idx":"53"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT53-EEPROM" }, - { "itf":"control", "dev":"PORT53-CTRL" } - ] - } - }, - "PORT53-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT53-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT53"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1d", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT53-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT53-CTRL", "device_parent":"MUX11", "virt_parent":"PORT53"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0xA", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"} - - ] - } - }, - - "PORT54": - { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT54", "device_parent":"MUX11"}, - "dev_attr": { "dev_idx":"54"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT54-EEPROM" }, - { "itf":"control", "dev":"PORT54-CTRL" } - ] - } - }, - "PORT54-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT54-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT54"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1e", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT54-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT54-CTRL", "device_parent":"MUX11", "virt_parent":"PORT54"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0xA", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"} - - ] - } - }, - - "PORT55": - { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT55", "device_parent":"MUX11"}, - "dev_attr": { "dev_idx":"55"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT55-EEPROM" }, - { "itf":"control", "dev":"PORT55-CTRL" } - ] - } - }, - "PORT55-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT55-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT55"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1f", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT55-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT55-CTRL", "device_parent":"MUX11", "virt_parent":"PORT55"}, - "i2c": - { - "topo_info": { "parent_bus":"0x1f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0xA", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} - - ] - } - }, - - "PORT56": - { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT56", "device_parent":"MUX11"}, - "dev_attr": { "dev_idx":"56"}, - "i2c": - { - "interface": - [ - { "itf":"eeprom", "dev":"PORT56-EEPROM" }, - { "itf":"control", "dev":"PORT56-CTRL" } - ] - } - }, - "PORT56-EEPROM": - { - "dev_info": { "device_type":"", "device_name":"PORT56-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT56"}, - "i2c": - { - "topo_info": { "parent_bus":"0x20", "dev_addr":"0x50", "dev_type":"optoe1"}, - "attr_list": - [ - { "attr_name":"eeprom"} - ] - } - }, - "PORT56-CTRL": - { - "dev_info": { "device_type":"", "device_name":"PORT56-CTRL", "device_parent":"MUX11", "virt_parent":"PORT56"}, - "i2c": - { - "topo_info": { "parent_bus":"0x20", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, - "attr_list": - [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0xA", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"} - - ] - } - }, - "LOC_LED": - { - "dev_info": { "device_type":"LED", "device_name":"LOC_LED"}, - "dev_attr": { "index":"0"}, - "i2c" : - { - "attr_list": - [ - {"attr_name":"STATUS_LED_COLOR_BLUE_BLINK", "descr": "" , "bits" : "5:0", "value" : "0x27", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "descr": "" , "bits" : "5:0", "value" : "0x17", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_AMBER_BLINK", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_BLUE", "descr": "" , "bits" : "5:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_GREEN", "descr": "" , "bits" : "5:0", "value" : "0x5", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_AMBER", "descr": "" , "bits" : "5:0", "value" : "0x6", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_OFF", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"} - ] - } - }, - "DIAG_LED": - { - "dev_info": { "device_type":"LED", "device_name":"DIAG_LED"}, - "dev_attr": { "index":"0"}, - "i2c" : - { - "attr_list": - [ - {"attr_name":"STATUS_LED_COLOR_BLUE_BLINK", "descr": "" , "bits" : "5:0", "value" : "0x27", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "descr": "" , "bits" : "5:0", "value" : "0x17", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_AMBER_BLINK", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_BLUE", "descr": "" , "bits" : "5:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_GREEN", "descr": "" , "bits" : "5:0", "value" : "0x5", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_AMBER", "descr": "" , "bits" : "5:0", "value" : "0x6", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_OFF", "descr": "" , "bits" : "5:0", "value" : "0x7", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"} - - ] - } - } -} diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pddf_support b/device/accton/x86_64-accton_as7326_56x-r0/pddf_support deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py index 4241483d68eb..8139f856f973 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py +++ b/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py @@ -16,5 +16,10 @@ 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" + exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') + if (exists is True): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + else: + self.eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py new file mode 100644 index 000000000000..73a7720e8979 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] +from . import platform diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py new file mode 100644 index 000000000000..f32f381b7c21 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py @@ -0,0 +1,264 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import os +import sys + +try: + from sonic_platform_base.chassis_base import ChassisBase + from .event import SfpEvent + from sonic_py_common import device_info + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 6 +NUM_PSU = 2 +NUM_THERMAL = 4 +NUM_PORT = 58 +NUM_COMPONENT = 4 + +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +SYSLED_FNODE= "/sys/class/leds/accton_as7326_56x_led::diag/brightness" +SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", + "1" : "STATUS_LED_COLOR_GREEN", + "3" : "STATUS_LED_COLOR_RED", + "5" : "STATUS_LED_COLOR_GREEN_BLINK" +} + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + ChassisBase.__init__(self) + self.config_data = {} + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + self.__initialize_fan() + self.__initialize_psu() + self.__initialize_thermals() + self.__initialize_components() + self.__initialize_sfp() + self.__initialize_eeprom() + + def __initialize_sfp(self): + from sonic_platform.sfp import Sfp + for index in range(NUM_PORT): + sfp = Sfp(index) + self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) + self.sfp_module_initialized = True + + def __initialize_fan(self): + from sonic_platform.fan_drawer import FanDrawer + for fant_index in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(fant_index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + def __initialize_psu(self): + from sonic_platform.psu import Psu + for index in range(NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + def __initialize_thermals(self): + from sonic_platform.thermal import Thermal + for index in range(NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + def __initialize_eeprom(self): + from sonic_platform.eeprom import Tlv + self._eeprom = Tlv() + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + def __initialize_watchdog(self): + self._watchdog = Watchdog() + + def __is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return None + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except Exception: + return False + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self._eeprom.get_product_name() + + def get_presence(self): + """ + Retrieves the presence of the Chassis + Returns: + bool: True if Chassis is present, False if not + """ + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.get_mac() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.get_serial() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_eeprom() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + description = 'None' + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) if self.__is_host( + ) else (PMON_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + prev_reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + PREV_REBOOT_CAUSE_FILE) if self.__is_host( + ) else (PMON_REBOOT_CAUSE_PATH + PREV_REBOOT_CAUSE_FILE) + + sw_reboot_cause = self.__read_txt_file(reboot_cause_path) or "Unknown" + prev_sw_reboot_cause = self.__read_txt_file(prev_reboot_cause_path) or "Unknown" + + if sw_reboot_cause != "Unknown": + reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE + description = sw_reboot_cause + elif prev_reboot_cause_path != "Unknown": + reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE + description = prev_sw_reboot_cause + + return (reboot_cause, description) + + def get_change_event(self, timeout=0): + # SFP event + if not self.sfp_module_initialized: + self.__initialize_sfp() + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + if not self.sfp_module_initialized: + self.__initialize_sfp() + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + def initizalize_system_led(self): + return True + + def get_status_led(self): + val = self.__read_txt_file(SYSLED_FNODE) + return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" + + def set_status_led(self, color): + mode = None + for key, val in SYSLED_MODES.items(): + if val == color: + mode = key + break + if mode is None: + return False + else: + return self.__write_txt_file(SYSLED_FNODE, mode) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py new file mode 100644 index 000000000000..75c2d3b918d4 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py @@ -0,0 +1,161 @@ +############################################################################# +# Edgecore +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +try: + from sonic_platform_base.component_base import ComponentBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "CPLD-1": "18-0060", + "CPLD-2": "12-0062", + "CPLD-3": "19-0064", +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_NAME_LIST = ["CPLD-1", "CPLD-2", "CPLD-3", "BIOS"] +COMPONENT_DES_LIST = [ + "CPLD-1", "CPLD-2", "CPLD-3", "Basic Input/Output System" +] + + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + ComponentBase.__init__(self) + self.index = component_index + self.name = self.get_name() + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_sysfs_value(self, addr, name): + # Retrieves the cpld register value + try: + with open(SYSFS_PATH + addr + '/' + name, 'r') as fd: + return fd.read().strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + try: + cpld_addr = CPLD_ADDR_MAPPING[cpld_name] + cpld_version_raw = self.__get_sysfs_value(cpld_addr, "version") + cpld_version[cpld_name] = "{}".format( + int(cpld_version_raw, 16)) + except Exception as e: + cpld_version[cpld_name] = 'None' + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_NAME_LIST[self.index] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_DES_LIST[self.index] + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py new file mode 100644 index 000000000000..d0bffe53a279 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py @@ -0,0 +1,139 @@ +try: + import os + import sys + import re + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo + if sys.version_info[0] >= 3: + from io import StringIO + else: + from cStringIO import StringIO +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' +NULL = 'N/A' + +class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + #self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') + if (exists is True): + self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + else: + self._eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + + super(Tlv, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + try: + match = re.search('(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', + line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + + _eeprom_info_dict[idx] = value + except Exception: + pass + + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + try: + self.read_eeprom_db() + except Exception: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if 'ok' not in status: + return False + + if not os.path.exists(CACHE_ROOT): + try: + os.makedirs(CACHE_ROOT) + except Exception: + pass + + # + # only the eeprom classes that inherit from eeprom_base + # support caching. Others will work normally + # + try: + self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) + except Exception: + pass + + e = self.read_eeprom() + if e is None: + return 0 + + try: + self.update_cache(e) + except Exception: + pass + + self.decode_eeprom(e) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(e) + if not is_valid: + return False + + return self.__parse_output(decode_output) + + def _valid_tlv(self, eeprom_data): + tlvinfo_type_codes_list = [ + self._TLV_CODE_PRODUCT_NAME, + self._TLV_CODE_PART_NUMBER, + self._TLV_CODE_SERIAL_NUMBER, + self._TLV_CODE_MAC_BASE, + self._TLV_CODE_MANUF_DATE, + self._TLV_CODE_DEVICE_VERSION, + self._TLV_CODE_LABEL_REVISION, + self._TLV_CODE_PLATFORM_NAME, + self._TLV_CODE_ONIE_VERSION, + self._TLV_CODE_MAC_SIZE, + self._TLV_CODE_MANUF_NAME, + self._TLV_CODE_MANUF_COUNTRY, + self._TLV_CODE_VENDOR_NAME, + self._TLV_CODE_DIAG_VERSION, + self._TLV_CODE_SERVICE_TAG, + self._TLV_CODE_VENDOR_EXT, + self._TLV_CODE_CRC_32 + ] + + for code in tlvinfo_type_codes_list: + code_str = "0x{:X}".format(code) + eeprom_data[code_str] = eeprom_data.get(code_str, NULL) + return eeprom_data + + def get_eeprom(self): + return self._valid_tlv(self._eeprom) + + def get_pn(self): + return self._eeprom.get('0x22', NULL) + + def get_serial(self): + return self._eeprom.get('0x23', NULL) + + def get_mac(self): + return self._eeprom.get('0x24', NULL) + + def get_product_name(self): + return self._eeprom.get('0x21', NULL) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py new file mode 100644 index 000000000000..3d6f81518a26 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py @@ -0,0 +1,60 @@ +try: + import time + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.port_num-1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.port_num-1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py new file mode 100644 index 000000000000..c64d953b758b --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py @@ -0,0 +1,270 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN_MAX_RPM = 25500 +PSU_FAN_MAX_RPM = 25500 +SPEED_TOLERANCE = 15 +CPLD_I2C_PATH = "/sys/bus/i2c/devices/11-0066/fan" +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "59" + }, + 1: { + "bus": 13, + "addr": "5b" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "51" + }, + 1: { + "bus": 13, + "addr": "53" + }, +} + +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", + "FAN-5F", "FAN-5R", "FAN-6F", "FAN-6R"] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, + fan_tray_index, + fan_index=0, + is_psu_fan=False, + psu_index=0): + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + self.is_psu_fan = is_psu_fan + self.psu_index = psu_index + + if self.is_psu_fan: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["bus"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["bus"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + + FanBase.__init__(self) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return "" + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except Exception: + return False + return True + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + if not self.is_psu_fan: + val = self.__read_txt_file( + CPLD_I2C_PATH + str(self.fan_tray_index+1) + "_direction") + direction = self.FAN_DIRECTION_EXHAUST if ( + val == "0") else self.FAN_DIRECTION_INTAKE + else: + val = self.__read_txt_file(self.psu_hwmon_path + "psu_fan_dir") + direction = self.FAN_DIRECTION_EXHAUST if ( + val == "F2B") else self.FAN_DIRECTION_INTAKE + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + speed = 0 + if self.is_psu_fan: + speed = self.__read_txt_file( + self.psu_hwmon_path + "psu_fan1_speed_rpm") + speed = (int(speed, 10)) * 100 / PSU_FAN_MAX_RPM + speed = 100 if (speed > 100) else speed + elif self.get_presence(): + speed = self.__read_txt_file(CPLD_I2C_PATH + str( + self.fan_index * 10 + self.fan_tray_index + 1) + "_input") + speed = (int(speed, 10)) * 100 / FAN_MAX_RPM + speed = 100 if (speed > 100) else speed + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + Note: + speed_pc = pwm_target/255*100 + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return SPEED_TOLERANCE + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + """ + + if not self.is_psu_fan and self.get_presence(): + return self.__write_txt_file( + CPLD_I2C_PATH + "_duty_cycle_percentage", int(speed)) + + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False #Not supported + + def get_status_led(self): + """ + Gets the state of the fan status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_presence() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + if self.is_psu_fan: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 + + val = self.__read_txt_file( + CPLD_I2C_PATH + str(self.fan_tray_index + 1) + "_present") + return int(val, 10)==1 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') + val=self.__read_txt_file(psu_fan_path) + if val is not None: + return int(val, 10)==0 + else: + return False + else: + path = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index+1, '_fault') + val=self.__read_txt_file(path) + if val is not None: + return int(val, 10)==0 + else: + return False + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True if not self.is_psu_fan else False diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..e21163c106c1 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py @@ -0,0 +1,90 @@ +######################################################################## +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 0-based in platforms + self.fantrayindex = fantray_index + self.__initialize_fan_drawer() + + + def __initialize_fan_drawer(self): + from sonic_platform.fan import Fan + for i in range(FANS_PER_FANTRAY): + self._fan_list.append(Fan(self.fantrayindex, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex+1) + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return self._fan_list[0].get_presence() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fantrayindex+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py new file mode 100644 index 000000000000..2f2c2a447fcf --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py @@ -0,0 +1,21 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..44566aba1f3c --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py @@ -0,0 +1,264 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +#import sonic_platform + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.thermal import Thermal +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" + +PSU_NAME_LIST = ["PSU-1", "PSU-2"] +PSU_NUM_FAN = [1, 1] +PSU_HWMON_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "59" + }, + 1: { + "bus": 13, + "addr": "5b" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "51" + }, + 1: { + "bus": 13, + "addr": "53" + }, +} + +NUM_FAN_TRAY = 6 + + +class Psu(PsuBase): + """Platform-specific Psu class""" + + def __init__(self, psu_index=0): + PsuBase.__init__(self) + self.index = psu_index + + bus = PSU_HWMON_I2C_MAPPING[self.index]["bus"] + addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] + self.hwmon_path = I2C_PATH.format(bus, addr) + + bus = PSU_CPLD_I2C_MAPPING[self.index]["bus"] + addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(bus, addr) + self.__initialize_fan() + + def __initialize_fan(self): + from sonic_platform.fan import Fan + self._fan_list.append( + Fan(NUM_FAN_TRAY + self.index, + is_psu_fan=True, + psu_index=self.index)) + self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return None + + def get_voltage(self): + """ + Retrieves current PSU voltage output + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_v_out") + if val is not None: + return float(val)/ 1000 + else: + return 0 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_i_out") + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_p_out") + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + return self.get_status() + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + + return False #Controlled by HW + + def get_status_led(self): + """ + Gets the state of the PSU status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_status() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + return self._thermal_list[0].get_temperature() + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return False #Not supported + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_mfr_vout_max") + if val is not None: + return float(val)/ 1000 + else: + return 0 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_mfr_vout_min") + if val is not None: + return float(val)/ 1000 + else: + return 0 + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return PSU_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + val = self.__read_txt_file(self.cpld_path + "psu_present") + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + val = self.__read_txt_file(self.cpld_path + "psu_power_good") + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + model = self.__read_txt_file(self.cpld_path + "psu_model_name") + if model is None: + return "N/A" + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + serial = self.__read_txt_file(self.cpld_path + "psu_serial_number") + if serial is None: + return "N/A" + return serial + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py new file mode 100644 index 000000000000..95a54e554a01 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py @@ -0,0 +1,626 @@ +############################################################################# +# Edgecore +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import sys + +from ctypes import create_string_buffer + +try: + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + 0: { + "bus": 18, + "addr": "60" + }, # port 31-56 + 1: { + "bus": 12, + "addr": "62" + }, # port 1-30 +} +CPLD_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" + +class Sfp(SfpOptoeBase): + """Platform-specific Sfp class""" + + # Port number + PORT_START = 1 + PORT_END = 58 + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + + PLATFORM = "x86_64-accton_as7326_56x-r0" + HWSKU = "Accton-AS7326-56X" + + _port_to_i2c_mapping = { + 1: [42], + 2: [41], + 3: [44], + 4: [43], + 5: [47], + 6: [45], + 7: [46], + 8: [50], + 9: [48], + 10: [49], + 11: [52], + 12: [51], + 13: [53], + 14: [56], + 15: [55], + 16: [54], + 17: [58], + 18: [57], + 19: [60], + 20: [59], + 21: [61], + 22: [63], + 23: [62], + 24: [64], + 25: [66], + 26: [68], + 27: [65], + 28: [67], + 29: [69], + 30: [71], + 31: [72], + 32: [70], + 33: [74], + 34: [73], + 35: [76], + 36: [75], + 37: [77], + 38: [79], + 39: [78], + 40: [80], + 41: [81], + 42: [82], + 43: [84], + 44: [85], + 45: [83], + 46: [87], + 47: [88], + 48: [86], + 49: [25], + 50: [26], + 51: [27], + 52: [28], + 53: [29], + 54: [30], + 55: [31], + 56: [32], + 57: [22], + 58: [23] + } + + def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) + # Init index + self.index = sfp_index + self.port_num = self.index + 1 + + cpld_idx = 0 if self.port_num > 30 else 1 + bus = CPLD_ADDR_MAPPING[cpld_idx]["bus"] + addr = CPLD_ADDR_MAPPING[cpld_idx]["addr"] + self.cpld_path = CPLD_I2C_PATH.format(bus, addr) + + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + for x in range(self.PORT_START, self.PORT_END + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][0]) + + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return "" + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except Exception: + return False + return True + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join( + [platform_path, + self.HWSKU]) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[ + self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + for n in range(0, num_bytes): + if sys.version_info[0] >= 3: + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + else: + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + if self.port_num <= 48 or self.port_num >=57: + return False # SPF port doesn't support this feature + + val = self.__read_txt_file( + self.cpld_path + "module_reset_" + str(self.port_num)) + return int(val, 10) == 1 + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + if self.port_num <= 48 or self.port_num >=57: + rx_los = self.__read_txt_file( + self.cpld_path + "module_rx_los_" + str(self.port_num)) + if int(rx_los, 10) == 1: + return [True] + else: + return [False] + #status_control_raw = self.__read_eeprom_specific_bytes( + # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + #if status_control_raw: + # data = int(status_control_raw[0], 16) + # rx_los = (sffbase().test_bit(data, 1) != 0) + else: + rx_los_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_RX_LOS_STATUS_OFFSET, + QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence( + ) else None + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + return rx_los_list + else: + return [False]*4 + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + + Returns: + A list of boolean values, representing the TX fault status + of each available channel, value is True if SFP channel + has TX fault, False if not. + E.g., for a tranceiver with four channels: [False, False, True, False] + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + tx_fault = False + if self.port_num <= 48 or self.port_num >=57: + tx_fault = self.__read_txt_file( + self.cpld_path + "module_tx_fault_" + str(self.port_num)) + if int(tx_fault, 10) == 1: + return [True] + else: + return [False] + #status_control_raw = self.__read_eeprom_specific_bytes( + # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + #if status_control_raw: + # data = int(status_control_raw[0], 16) + # tx_fault = (sffbase().test_bit(data, 2) != 0) + else: + tx_fault_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, + QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence( + ) else None + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + return tx_fault_list + else: + return [False]*4 + + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A list of boolean values, representing the TX disable status + of each available channel, value is True if SFP channel + is TX disabled, False if not. + E.g., for a tranceiver with four channels: [False, False, True, False] + """ + if self.port_num <= 48 or self.port_num >=57: + tx_disable = False + + status_control_raw = self.__read_eeprom_specific_bytes( + SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + if status_control_raw: + cpld_val = self.__read_txt_file( + self.cpld_path + "module_tx_disable_" + str(self.port_num)) + tx_disable_hard = (int(cpld_val, 10) == 1) + data = int(status_control_raw[0], 16) + #tx_disable_hard = (sffbase().test_bit( + # data, SFP_TX_DISABLE_HARD_BIT) != 0) + tx_disable_soft = (sffbase().test_bit( + data, SFP_TX_DISABLE_SOFT_BIT) != 0) + tx_disable = tx_disable_hard | tx_disable_soft + if tx_disable==0: + return [False] + else: + return [True] + + else: + return [False] + + else: + tx_disable_list = [] + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return [False] + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, + QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes( + dom_control_raw, 0) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX1Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX2Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX3Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX4Disable']['value']) + return tx_disable_list + else: + return [False]*4 + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + if self.port_num <= 48 or self.port_num >= 57: + # SFP doesn't support this feature + return False + + power_set = self.get_power_set() + power_override = self.get_power_override() + return power_set and power_override + + def get_power_set(self): + + if self.port_num <= 48 or self.port_num >= 57: + # SFP doesn't support this feature + return False + else: + power_set = False + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, + QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes( + dom_control_raw, 0) + power_set = ( + 'On' == dom_control_data['data']['PowerSet']['value']) + + return power_set + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + if self.port_num <= 48 or self.port_num >= 57: + return False # SFP doesn't support this feature + else: + power_override = False + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, + QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes( + dom_control_raw, 0) + power_override = ( + 'On' == dom_control_data['data']['PowerOverride']['value']) + + return power_override + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + # Check for invalid port_num + if self.port_num <= 48 or self.port_num >=57: + return False # SFP doesn't support this feature + + ret = self.__write_txt_file( + self.cpld_path + "module_reset_" + str(self.port_num), 1) + if ret is not True: + return ret + + time.sleep(0.01) + ret = self.__write_txt_file( + self.cpld_path + "module_reset_" + str(self.port_num), 0) + time.sleep(0.2) + return ret + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.port_num <= 48 or self.port_num >=57: + ret = self.__write_txt_file( + self.cpld_path + "module_tx_disable_" + str(self.port_num), 1 + if tx_disable else 0) + time.sleep(0.01) + return ret + else: + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + tx_disable_ctl = 0xf if tx_disable else 0x0 + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = tx_disable_ctl + else: + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + + if self.port_num <= 48 or self.port_num >=57: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + + for i in range(4): + channel_mask = (1 << i) + if not (channel & channel_mask): + continue + + if disable: + channel_state |= channel_mask + else: + channel_state &= ~channel_mask + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = channel_state + else: + buffer[0] = chr(channel_state) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if self.port_num <= 48 or self.port_num >=57: + return False # SFP doesn't support this feature + + if lpmode: + return self.set_power_override(True, True) + else: + return self.set_power_override(True, False) + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + if self.port_num <= 48 or self.port_num >=57: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + try: + power_override_bit = (1 << 0) if power_override else 0 + power_set_bit = (1 << 1) if power_set else (1 << 3) + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = (power_override_bit | power_set_bit) + else: + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + with open(self.port_to_eeprom_mapping[self.port_num], + "r+b") as fd: + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + except Exception: + print("Error: unable to open file: %s" % str(e)) + return False + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + name = sfputil_helper.logical[self.index] or "Unknown" + return name + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + val = self.__read_txt_file( + self.cpld_path + "module_present_" + str(self.port_num)) + return val == '1' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.port_num + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py new file mode 100644 index 000000000000..b2233e7b5a72 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py @@ -0,0 +1,232 @@ +############################################################################# +# Edgecore +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path +import glob + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "59" + }, + 1: { + "bus": 13, + "addr": "5b" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "51" + }, + 1: { + "bus": 13, + "addr": "53" + }, +} + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + PSU_THERMAL_NAME_LIST = [] + SYSFS_PATH = "/sys/bus/i2c/devices" + + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): + self.index = thermal_index + self.is_psu = is_psu + self.psu_index = psu_index + + if self.is_psu: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["bus"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["bus"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + + # Add thermal name + self.THERMAL_NAME_LIST.append("Temp sensor 1") + self.THERMAL_NAME_LIST.append("Temp sensor 2") + self.THERMAL_NAME_LIST.append("Temp sensor 3") + self.THERMAL_NAME_LIST.append("Temp sensor 4") + self.PSU_THERMAL_NAME_LIST.append("PSU-1 temp sensor 1") + self.PSU_THERMAL_NAME_LIST.append("PSU-2 temp sensor 1") + + # Set hwmon path + i2c_path = { + 0: "15-0048/hwmon/hwmon*/", + 1: "15-0049/hwmon/hwmon*/", + 2: "15-004a/hwmon/hwmon*/", + 3: "15-004b/hwmon/hwmon*/" + }.get(self.index, None) + + self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) + self.ss_key = self.THERMAL_NAME_LIST[self.index] + self.ss_index = 1 + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: + with open(filename, 'r') as fd: + return fd.readline().rstrip() + except IOError as e: + pass + + def __get_temp(self, temp_file): + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file + + raw_temp = self.__read_txt_file(temp_file_path) + return float(raw_temp) / 1000 + + def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True + + temp_file_path = os.path.join(self.hwmon_path, file_name) + try: + with open(temp_file_path, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError: + return False + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.is_psu: + return 0 + + temp_file = "temp{}_max".format(self.ss_index) + return self.__get_temp(temp_file) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + temp_file = "temp{}_max".format(self.ss_index) + temperature = temperature *1000 + self.__set_threshold(temp_file, temperature) + + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + if self.is_psu: + return self.PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 + + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) + return raw_txt != None + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + return self.get_presence() and (not int( + self.__read_txt_file(temp_file))) + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False + else: + return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False diff --git a/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..18d47b22a9d3 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json @@ -0,0 +1,15 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.temperature" + + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_RED", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN_BLINK" + } +} diff --git a/device/accton/x86_64-accton_as7816_64x-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as7816_64x-r0/pddf/pd-plugin.json deleted file mode 100644 index eae22f99e394..000000000000 --- a/device/accton/x86_64-accton_as7816_64x-r0/pddf/pd-plugin.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - - "XCVR": - { - "xcvr_present": - { - "i2c": - { - "valmap-QSFP28": {"1":true, "0":false} - } - } - }, - "PSU": - { - "psu_present": - { - "i2c": - { - "valmap": { "1":true, "0":false } - } - }, - - "psu_power_good": - { - "i2c": - { - "valmap": { "1": true, "0":false } - } - }, - - "psu_fan_dir": - { - "i2c": - { - "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } - } - }, - - "PSU_FAN_MAX_SPEED":"18000" - }, - - "FAN": - { - "direction": - { - "i2c": - { - "valmap": {"1":"INTAKE", "0":"EXHAUST"} - } - }, - - "present": - { - "i2c": - { - "valmap": {"1":true, "0":false} - } - }, - - "duty_cycle_to_pwm": "lambda dc: ((dc - 10) / 6)", - "pwm_to_duty_cycle": "lambda pwm: ( (pwm * 6) + 10)" - } - -} diff --git a/device/accton/x86_64-accton_as7816_64x-r0/pddf_support b/device/accton/x86_64-accton_as7816_64x-r0/pddf_support deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as7816_64x-r0/pmon_daemon_control.json index 0d3f1fb4561d..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as7816_64x-r0/pmon_daemon_control.json @@ -1,6 +1,5 @@ { "skip_ledd": true, - "skip_pcied": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/__init__.py new file mode 100644 index 000000000000..73a7720e8979 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] +from . import platform diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py new file mode 100644 index 000000000000..44a759045b6b --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py @@ -0,0 +1,250 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import os +import sys + +try: + from sonic_platform_base.chassis_base import ChassisBase + from .helper import APIHelper + from .event import SfpEvent +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 4 +NUM_FAN = 2 +NUM_PSU = 2 +NUM_THERMAL = 6 +NUM_PORT = 64 +NUM_COMPONENT = 5 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +SYSLED_FNODE = "/sys/class/leds/as7816_64x_led::diag/brightness" +SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", + "16" : "STATUS_LED_COLOR_GREEN", + "10" : "STATUS_LED_COLOR_RED" + +} + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + ChassisBase.__init__(self) + self._api_helper = APIHelper() + self.is_host = self._api_helper.is_host() + + self.config_data = {} + + self.__initialize_fan() + self.__initialize_psu() + self.__initialize_thermals() + self.__initialize_components() + self.__initialize_sfp() + self.__initialize_eeprom() + + def __initialize_sfp(self): + from sonic_platform.sfp import Sfp + for index in range(0, NUM_PORT): + sfp = Sfp(index) + self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) + self.sfp_module_initialized = True + + def __initialize_fan(self): + from sonic_platform.fan_drawer import FanDrawer + for fant_index in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(fant_index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + def __initialize_psu(self): + from sonic_platform.psu import Psu + for index in range(0, NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + def __initialize_thermals(self): + from sonic_platform.thermal import Thermal + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + def __initialize_eeprom(self): + from sonic_platform.eeprom import Tlv + self._eeprom = Tlv() + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(0, NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + def __initialize_watchdog(self): + from sonic_platform.watchdog import Watchdog + self._watchdog = Watchdog() + + + def __is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self._eeprom.get_product_name() + + def get_presence(self): + """ + Retrieves the presence of the Chassis + Returns: + bool: True if Chassis is present, False if not + """ + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.get_mac() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.get_serial() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_eeprom() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + + def get_change_event(self, timeout=0): + # SFP event + if not self.sfp_module_initialized: + self.__initialize_sfp() + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + if not self.sfp_module_initialized: + self.__initialize_sfp() + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + def initizalize_system_led(self): + return True + + def get_status_led(self): + val = self._api_helper.read_txt_file(SYSLED_FNODE) + return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" + + def set_status_led(self, color): + mode = None + for key, val in SYSLED_MODES.items(): + if val == color: + mode = key + break + if mode is None: + return False + else: + return self._api_helper.write_txt_file(SYSLED_FNODE, mode) diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py new file mode 100644 index 000000000000..6af2f6008e72 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py @@ -0,0 +1,177 @@ +############################################################################# +# Edgecore +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +import shlex +import subprocess + +try: + from sonic_platform_base.component_base import ComponentBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "CPLD1": "19-0060", + "CPLD2": "20-0062", + "CPLD3": "21-0064", + "CPLD4": "22-0066", +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("CPLD1", "CPLD 1"), + ("CPLD2", "CPLD 2"), + ("CPLD3", "CPLD 3"), + ("CPLD4", "CPLD 4"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self._api_helper=APIHelper() + ComponentBase.__init__(self) + self.index = component_index + self.name = self.get_name() + + def __run_command(self, command): + # Run bash command and print output to stdout + try: + process = subprocess.Popen( + shlex.split(command), stdout=subprocess.PIPE) + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + rc = process.poll() + if rc != 0: + return False + except Exception: + return False + return True + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + try: + cpld_path = "{}{}{}".format(SYSFS_PATH, CPLD_ADDR_MAPPING[cpld_name], '/version') + cpld_version_raw= self._api_helper.read_txt_file(cpld_path) + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + except Exception as e: + print('Get exception when read cpld') + cpld_version[cpld_name] = 'None' + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/eeprom.py new file mode 100644 index 000000000000..c87f01c50a52 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/eeprom.py @@ -0,0 +1,134 @@ +try: + import os + import sys + import re + if sys.version_info[0] >= 3: + from io import StringIO + else: + from cStringIO import StringIO + + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' +NULL = 'N/A' + +class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(Tlv, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + try: + match = re.search( + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + + _eeprom_info_dict[idx] = value + except Exception: + pass + + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + try: + self.read_eeprom_db() + except Exception: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if 'ok' not in status: + return False + + if not os.path.exists(CACHE_ROOT): + try: + os.makedirs(CACHE_ROOT) + except Exception: + pass + + # + # only the eeprom classes that inherit from eeprom_base + # support caching. Others will work normally + # + try: + self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) + except Exception: + pass + + e = self.read_eeprom() + if e is None: + return 0 + + try: + self.update_cache(e) + except Exception: + pass + + self.decode_eeprom(e) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(e) + if not is_valid: + return False + + return self.__parse_output(decode_output) + + def _valid_tlv(self, eeprom_data): + tlvinfo_type_codes_list = [ + self._TLV_CODE_PRODUCT_NAME, + self._TLV_CODE_PART_NUMBER, + self._TLV_CODE_SERIAL_NUMBER, + self._TLV_CODE_MAC_BASE, + self._TLV_CODE_MANUF_DATE, + self._TLV_CODE_DEVICE_VERSION, + self._TLV_CODE_LABEL_REVISION, + self._TLV_CODE_PLATFORM_NAME, + self._TLV_CODE_ONIE_VERSION, + self._TLV_CODE_MAC_SIZE, + self._TLV_CODE_MANUF_NAME, + self._TLV_CODE_MANUF_COUNTRY, + self._TLV_CODE_VENDOR_NAME, + self._TLV_CODE_DIAG_VERSION, + self._TLV_CODE_SERVICE_TAG, + self._TLV_CODE_VENDOR_EXT, + self._TLV_CODE_CRC_32 + ] + + for code in tlvinfo_type_codes_list: + code_str = "0x{:X}".format(code) + eeprom_data[code_str] = eeprom_data.get(code_str, NULL) + return eeprom_data + + def get_eeprom(self): + return self._valid_tlv(self._eeprom) + + def get_pn(self): + return self._eeprom.get('0x22', NULL) + + def get_serial(self): + return self._eeprom.get('0x23', NULL) + + def get_mac(self): + return self._eeprom.get('0x24', NULL) + + def get_product_name(self): + return self._eeprom.get('0x21', NULL) diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/event.py new file mode 100644 index 000000000000..eb845c7e4aad --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/event.py @@ -0,0 +1,62 @@ +try: + import time + from .helper import APIHelper + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._api_helper = APIHelper() + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.port_num-1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.port_num-1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan.py new file mode 100644 index 000000000000..0ec1fc3962f9 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan.py @@ -0,0 +1,263 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.fan_base import FanBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +SPEED_TOLERANCE = 15 +CPLD_FAN_I2C_PATH = "/sys/bus/i2c/devices/17-0068/fan" +I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "5b" + }, + 1: { + "num": 9, + "addr": "58" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "53" + }, + 1: { + "num": 9, + "addr": "50" + }, +} + +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R"] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + self._api_helper=APIHelper() + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + self.is_psu_fan = is_psu_fan + + + if self.is_psu_fan: + self.psu_index = psu_index + self.psu_i2c_num = PSU_HWMON_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr'] + self.psu_hwmon_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr'] + self.psu_cpld_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + FanBase.__init__(self) + + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + if not self.is_psu_fan: + dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_direction') + val=self._api_helper.read_txt_file(dir_str) + if val is not None: #F2B is FAN_DIRECTION_EXHAUST + direction = self.FAN_DIRECTION_EXHAUST if ( + val == "0") else self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + else: #For PSU + direction=self.FAN_DIRECTION_EXHAUST + + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + speed = 0 + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_speed_rpm') + fan_speed_rpm = self._api_helper.read_txt_file(psu_fan_path) + if fan_speed_rpm is not None: + speed = (int(fan_speed_rpm,10))*100/26688 + if speed > 100: + speed=100 + else: + return 0 + elif self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') + speed=self._api_helper.read_txt_file(speed_path) + if speed is None: + return 0 + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + Note: + speed_pc = pwm_target/255*100 + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return SPEED_TOLERANCE + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + """ + + if not self.is_psu_fan and self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') + return self._api_helper.write_txt_file(speed_path, int(speed)) + + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False #Not supported + + def get_status_led(self): + """ + Gets the state of the fan status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_presence() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if FAN is present, False if not + """ + present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_present') + val=self._api_helper.read_txt_file(present_path) + if not self.is_psu_fan: + if val is not None: + return int(val, 10)==1 + else: + return False + else: + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') + val=self._api_helper.read_txt_file(psu_fan_path) + if val is not None: + return int(val, 10)==0 + else: + return False + else: + path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_fault') + val=self._api_helper.read_txt_file(path) + if val is not None: + return int(val, 10)==0 + else: + return False + + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True if not self.is_psu_fan else False diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..17d339ee55f6 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan_drawer.py @@ -0,0 +1,90 @@ +######################################################################## +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 0-based in platforms + self.fantrayindex = fantray_index + self.__initialize_fan_drawer() + + + def __initialize_fan_drawer(self): + from sonic_platform.fan import Fan + for i in range(FANS_PER_FANTRAY): + self._fan_list.append(Fan(self.fantrayindex, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex+1) + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return self._fan_list[0].get_presence() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fantrayindex+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py new file mode 100644 index 000000000000..b124ca29f0df --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py @@ -0,0 +1,117 @@ +import os +import struct +import subprocess +from mmap import * +from sonic_py_common import device_info + +HOST_CHK_CMD = "docker > /dev/null 2>&1" +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def run_command(self, cmd): + status = True + result = "" + try: + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + except Exception: + status = False + return status, result + + def run_interactive_command(self, cmd): + try: + os.system(cmd) + except Exception: + return False + return True + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except IOError: + return False + return True + + def ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + cmd = "ipmitool fru print {}".format(str( + id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) + + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/platform.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/platform.py new file mode 100644 index 000000000000..2f2c2a447fcf --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/platform.py @@ -0,0 +1,21 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..53dd058bbac7 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/psu.py @@ -0,0 +1,283 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.thermal import Thermal + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +I2C_PATH ="/sys/bus/i2c/devices/{0}-00{1}/" + +PSU_NAME_LIST = ["PSU-1", "PSU-2"] +PSU_NUM_FAN = [1, 1] +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "53" + }, + 1: { + "num": 9, + "addr": "50" + }, +} + +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "5b" + }, + 1: { + "num": 9, + "addr": "58" + }, +} + +NUM_FAN_TRAY = 4 + +class Psu(PsuBase): + """Platform-specific Psu class""" + def __init__(self, psu_index=0): + PsuBase.__init__(self) + self.index = psu_index + self._api_helper = APIHelper() + + self.i2c_num = PSU_HWMON_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] + self.hwmon_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + + self.i2c_num = PSU_CPLD_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + + self.__initialize_fan() + + def __initialize_fan(self): + from sonic_platform.fan import Fan + self._fan_list.append( + Fan(NUM_FAN_TRAY + self.index, + is_psu_fan=True, + psu_index=self.index)) + self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return None + + def get_voltage(self): + """ + Retrieves current PSU voltage output + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') + vout_val=self._api_helper.read_txt_file(vout_path) + + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') + val=self._api_helper.read_txt_file(iout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') + val=self._api_helper.read_txt_file(pout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + return self.get_status() + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + + return False #Controlled by HW + + def get_status_led(self): + """ + Gets the state of the PSU status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_status() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_path = "{}{}".format(self.hwmon_path, 'psu_temp1_input') + val=self._api_helper.read_txt_file(temp_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return False #Not supported + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_max') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_min') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return PSU_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + presence_path="{}{}".format(self.cpld_path, 'psu_present') + val=self._api_helper.read_txt_file(presence_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + power_path="{}{}".format(self.cpld_path, 'psu_power_good') + val=self._api_helper.read_txt_file(power_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + model_path="{}{}".format(self.hwmon_path, 'psu_mfr_model') + val=self._api_helper.read_txt_file(model_path) + if val is None: + return "N/A" + model=val[1:] + + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + serial_path="{}{}".format(self.hwmon_path, 'psu_mfr_serial') + val=self._api_helper.read_txt_file(serial_path) + if val is None: + return "N/A" + serial=val[1:] + + return serial + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py new file mode 100644 index 000000000000..01e568ef3e78 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py @@ -0,0 +1,506 @@ +############################################################################# +# Edgecore +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import sys + +from ctypes import create_string_buffer + +try: + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_I2C_PATH = "/sys/bus/i2c/devices/19-0060/" + + +class Sfp(SfpOptoeBase): + """Platform-specific Sfp class""" + + # Port number + PORT_START = 1 + PORT_END = 64 + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + + PLATFORM = "x86_64-accton_as7816_64x-r0" + HWSKU = "Accton-AS7816-64X" + + _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 + } + + def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) + self._api_helper=APIHelper() + # Init index + self.index = sfp_index + self.port_num = self.index + 1 + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + for x in range(self.PORT_START, self.PORT_END + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) + + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join([platform_path, self.HWSKU] + ) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + if sys.version_info[0] >= 3: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + reset_path="{}{}{}".format(CPLD_I2C_PATH , "module_reset_" , str(self.port_num)) + val = self._api_helper.read_txt_file(reset_path) + + if val is not None: + return int(val, 10) == 1 + else: + return False + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + + rx_los_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + return rx_los_list + else: + return [False]*4 + + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + tx_fault_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + return tx_fault_list + else: + return [False]*4 + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + + tx_disable_list = [] + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX1Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX2Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX3Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX4Disable']['value']) + return tx_disable_list + else: + return [False]*4 + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + + power_set=self.get_power_set() + power_override = self.get_power_override() + return power_set and power_override + + def get_power_set(self): + power_set = False + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + power_set = ( + 'On' == dom_control_data['data']['PowerSet']['value']) + + return power_set + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + power_override = False + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + power_override = ( + 'On' == dom_control_data['data']['PowerOverride']['value']) + + return power_override + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + reset_path = "{}{}{}".format(CPLD_I2C_PATH , 'module_reset_' , self.port_num) + ret = self._api_helper.write_txt_file(reset_path, 1) + if ret is not True: + return ret + + time.sleep(0.01) + ret = self._api_helper.write_txt_file(reset_path, 0) + time.sleep(0.2) + + return ret + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if not self.get_presence(): + return False + sysfsfile_eeprom = None + try: + tx_disable_ctl = 0xf if tx_disable else 0x0 + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = tx_disable_ctl + else: + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ',str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + + return True + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + for i in range(4): + channel_mask = (1 << i) + if not (channel & channel_mask): + continue + + if disable: + channel_state |= channel_mask + else: + channel_state &= ~channel_mask + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = channel_state + else: + buffer[0] = chr(channel_state) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ', str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + + return True + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if lpmode: + self.set_power_override(True, True) + else: + self.set_power_override(False, False) + + return True + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + + if not self.get_presence(): + return False + try: + power_override_bit = (1 << 0) if power_override else 0 + power_set_bit = (1 << 1) if power_set else (1 << 3) + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = (power_override_bit | power_set_bit) + else: + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + with open(self.port_to_eeprom_mapping[self.port_num], "r+b") as fd: + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + except Exception: + print ('Error: unable to open file: ', str(e)) + return False + + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + name = sfputil_helper.logical[self.index] or "Unknown" + return name + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + present_path = "{}{}{}".format(CPLD_I2C_PATH , '/module_present_' , self.port_num) + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.port_num + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/thermal.py new file mode 100644 index 000000000000..34256bf8c244 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/thermal.py @@ -0,0 +1,236 @@ +############################################################################# +# Edgecore +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path +import glob + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" + +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "5b" + }, + 1: { + "num": 9, + "addr": "58" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "53" + }, + 1: { + "num": 9, + "addr": "50" + }, +} + +THERMAL_NAME_LIST = ["Temp sensor 1", "Temp sensor 2", "Temp sensor 3", + "Temp sensor 4", "Temp sensor 5", "Temp sensor 6"] + +PSU_THERMAL_NAME_LIST = ["PSU-1 temp sensor 1", "PSU-2 temp sensor 2"] + +SYSFS_PATH = "/sys/bus/i2c/devices" + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): + self.index = thermal_index + self.is_psu = is_psu + self.psu_index = psu_index + + if self.is_psu: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + + # Set hwmon path + i2c_path = { + 0: "18-0048/hwmon/hwmon*/", + 1: "18-0049/hwmon/hwmon*/", + 2: "18-004a/hwmon/hwmon*/", + 3: "18-004b/hwmon/hwmon*/", + 4: "17-004d/hwmon/hwmon*/", + 5: "17-004d/hwmon/hwmon*/" + }.get(self.index, None) + + self.hwmon_path = "{}/{}".format(SYSFS_PATH, i2c_path) + self.ss_key = THERMAL_NAME_LIST[self.index] + self.ss_index = 1 + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: + with open(filename, 'r') as fd: + data =fd.readline().rstrip() + return data + except IOError as e: + pass + + return None + + def __get_temp(self, temp_file): + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file + raw_temp = self.__read_txt_file(temp_file_path) + if raw_temp is not None: + return float(raw_temp)/1000 + else: + return 0 + + def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True + temp_file_path = os.path.join(self.hwmon_path, file_name) + for filename in glob.glob(temp_file_path): + try: + with open(filename, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError as e: + print("IOError") + return False + + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.is_psu: + return 80 + + temp_file = "temp{}_max".format(self.ss_index) + return self.__get_temp(temp_file) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + temp_file = "temp{}_max".format(self.ss_index) + temperature = temperature *1000 + self.__set_threshold(temp_file, temperature) + + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + if self.is_psu: + return PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the Thermal + Returns: + bool: True if Thermal is present, False if not + """ + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) + if raw_txt is not None: + return True + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + return self.get_presence() and (not int( + self.__read_txt_file(temp_file))) + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False + else: + return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False diff --git a/device/accton/x86_64-accton_as7816_64x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as7816_64x-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..92be29dfdea6 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/system_health_monitoring_config.json @@ -0,0 +1,15 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.temperature" + + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_RED", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN" + } +} diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile old mode 100755 new mode 100644 index f845f2e17d86..41953f866b6c --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile @@ -4,10 +4,7 @@ obj-m:= x86-64-accton-as4630-54pe-cpld.o x86-64-accton-as4630-54pe-psu.o \ else ifeq (,$(KERNEL_SRC)) -#$(error KERNEL_SRC is not defined) -KVERSION=3.16.0-8-amd64 -KERNEL_DIR = /usr/src/linux-headers-$(KVERSION)/ -KERNELDIR:=$(KERNEL_DIR) +$(error KERNEL_SRC is not defined) else KERNELDIR:=$(KERNEL_SRC) endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c old mode 100755 new mode 100644 index 3a3c594f9fa8..0e9fc11aca81 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c @@ -598,7 +598,6 @@ static u8 is_fan_fault(struct as4630_54pe_cpld_data *data, enum fan_id id) return ret; } - static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) { diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-leds.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-leds.c index 34c22fd82aa1..e758dd5cc47b 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-leds.c +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-leds.c @@ -64,7 +64,7 @@ static struct accton_as4630_54pe_led_data *ledctl = NULL; #define LED_TYPE_POE_REG_MASK (0x2|0x1) #define LED_MODE_POE_GREEN_VALUE 0x1 #define LED_MODE_POE_AMBER_VALUE 0x2 -#define LED_MODE_POE_OFF_VALUE 0x0 +#define LED_MODE_POE_OFF_VALUE 0x3 #define LED_TYPE_STK1_REG_MASK 0x20 #define LED_MODE_STK1_GREEN_VALUE 0x0 @@ -74,20 +74,20 @@ static struct accton_as4630_54pe_led_data *ledctl = NULL; #define LED_MODE_STK2_GREEN_VALUE 0x0 #define LED_MODE_STK2_OFF_VALUE 0x10 -#define LED_TYPE_FAN_REG_MASK (0x20|0x10) -#define LED_MODE_FAN_AMBER_VALUE 0x20 -#define LED_MODE_FAN_GREEN_VALUE 0x10 -#define LED_MODE_FAN_OFF_VALUE (0x0) +#define LED_TYPE_FAN_REG_MASK (0x8|0x4) +#define LED_MODE_FAN_AMBER_VALUE 0x8 +#define LED_MODE_FAN_GREEN_VALUE 0x4 +#define LED_MODE_FAN_OFF_VALUE (0xC) -#define LED_TYPE_PSU2_REG_MASK (0x8|0x4) -#define LED_MODE_PSU2_AMBER_VALUE 0x8 -#define LED_MODE_PSU2_GREEN_VALUE 0x4 -#define LED_MODE_PSU2_OFF_VALUE (0x0) +#define LED_TYPE_PSU2_REG_MASK (0x80|0x40) +#define LED_MODE_PSU2_AMBER_VALUE 0x80 +#define LED_MODE_PSU2_GREEN_VALUE 0x40 +#define LED_MODE_PSU2_OFF_VALUE (0xC0) #define LED_TYPE_PSU1_REG_MASK (0x2|0x1) #define LED_MODE_PSU1_AMBER_VALUE 0x2 #define LED_MODE_PSU1_GREEN_VALUE 0x1 -#define LED_MODE_PSU1_OFF_VALUE (0x0) +#define LED_MODE_PSU1_OFF_VALUE (0x3) enum led_type { LED_TYPE_DIAG, @@ -106,8 +106,8 @@ struct led_reg { }; static const struct led_reg led_reg_map[] = { - {(1<reg_val[0]); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[1]); } static void accton_as4630_54pe_led_psu1_set(struct led_classdev *led_cdev, @@ -395,7 +395,7 @@ static void accton_as4630_54pe_led_psu2_set(struct led_classdev *led_cdev, static enum led_brightness accton_as4630_54pe_led_psu2_get(struct led_classdev *cdev) { accton_as4630_54pe_led_update(); - return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[0]); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[1]); } static struct led_classdev accton_as4630_54pe_leds[] = { @@ -405,7 +405,7 @@ static struct led_classdev accton_as4630_54pe_leds[] = { .brightness_set = accton_as4630_54pe_led_diag_set, .brightness_get = accton_as4630_54pe_led_diag_get, .flags = LED_CORE_SUSPENDRESUME, - .max_brightness = LED_MODE_GREEN, + .max_brightness = LED_MODE_GREEN_BLINK, }, [LED_TYPE_PRI] = { .name = "pri", diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-psu.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-psu.c old mode 100755 new mode 100644 diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-pddf-platform-monitor.service deleted file mode 100644 index 99bca2684f4d..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-pddf-platform-monitor.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Accton AS4630-54PE Platform Monitoring service -Before=pmon.service -After=pddf-platform-init.service -DefaultDependencies=no - -[Service] -ExecStart=/usr/local/bin/accton_as4630_54pe_pddf_monitor.py -KillSignal=SIGKILL -SuccessExitStatus=SIGKILL - -# Resource Limitations -LimitCORE=infinity - -[Install] -WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-handle-mgmt-interface.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-handle-mgmt-interface.service new file mode 100644 index 000000000000..d978b1fe6845 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-handle-mgmt-interface.service @@ -0,0 +1,11 @@ +[Unit] +Description=Accton AS4630-54PE Platform handle management interface service +After=sysinit.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/local/bin/handle_mgmt_interface.sh + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service deleted file mode 120000 index 0fd9f25b6c5e..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service +++ /dev/null @@ -1 +0,0 @@ -../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py index 59dad237f3b4..553325484a92 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py @@ -1,14 +1,23 @@ from setuptools import setup +DEVICE_NAME = 'accton' +HW_SKU = 'x86_64-accton_as4630_54pe-r0' + setup( name='sonic-platform', version='1.0', - description='SONiC platform API implementation on Accton Platforms using PDDF', + description='SONiC platform API implementation on Accton Platforms', license='Apache 2.0', author='SONiC Team', author_email='linuxnetdev@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - packages=['sonic_platform'], + maintainer='Jostar Yang', + maintainer_email='jostar_yang@edge-core.com', + packages=[ + 'sonic_platform', + ], + package_dir={ + 'sonic_platform': '../../../../device/{}/{}/sonic_platform'.format(DEVICE_NAME, HW_SKU)}, classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: Plugins', diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py index 66599ad88ad6..b954da8726d2 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py @@ -30,6 +30,7 @@ import sys import logging import time +import os PROJECT_NAME = 'as4630_54pe' version = '0.0.1' @@ -88,8 +89,8 @@ if DEBUG == True: - print((sys.argv[0])) - print(('ARGV :', sys.argv[1:])) + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -107,7 +108,7 @@ def main(): if DEBUG == True: print(options) print(args) - print((len(sys.argv))) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -124,6 +125,10 @@ def main(): do_install() elif arg == 'clean': do_uninstall() + elif arg == 'api': + do_sonic_platform_install() + elif arg == 'api_clean': + do_sonic_platform_clean() else: show_help() @@ -131,12 +136,12 @@ def main(): return 0 def show_help(): - print(( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]})) + print( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def my_log(txt): if DEBUG == True: - print(("[ACCTON DBG]: ",txt)) + print("[ACCTON DBG]: ",txt) return def log_os_system(cmd, show): @@ -150,7 +155,7 @@ def log_os_system(cmd, show): if status: logging.info('Failed :'+cmd) if show: - print(('Failed :'+cmd)) + print('Failed :'+cmd) return status, output def driver_inserted(): @@ -168,7 +173,7 @@ def driver_inserted(): 'modprobe i2c_dev', 'modprobe i2c_i801', 'modprobe i2c_ismt', -'modprobe i2c_mux_pca954x', +'modprobe i2c_mux_pca954x force_deselect_on_exit=1', 'modprobe ym2651y', 'modprobe x86_64_accton_as4630_54pe_cpld', 'modprobe x86_64_accton_as4630_54pe_leds', @@ -285,6 +290,44 @@ def system_ready(): return False return True +PLATFORM_ROOT_PATH = '/usr/share/sonic/device' +PLATFORM_API2_WHL_FILE_PY3 ='sonic_platform-1.0-py3-none-any.whl' +def do_sonic_platform_install(): + device_path = "{}{}{}{}".format(PLATFORM_ROOT_PATH, '/x86_64-accton_', PROJECT_NAME, '-r0') + SONIC_PLATFORM_BSP_WHL_PKG_PY3 = "/".join([device_path, PLATFORM_API2_WHL_FILE_PY3]) + + #Check API2.0 on py whl file + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) + if status: + print ("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + +def do_sonic_platform_clean(): + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY2)) + + else: + status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) + if status: + print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + def do_install(): if driver_inserted() == False: status = driver_install() @@ -292,25 +335,28 @@ def do_install(): if FORCE == 0: return status else: - print((PROJECT_NAME.upper()+" drivers detected....")) + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): status = device_install() if status: if FORCE == 0: return status else: - print((PROJECT_NAME.upper()+" devices detected....")) + print(PROJECT_NAME.upper()+" devices detected....") for i in range(len(cpld_set)): status, output = log_os_system(cpld_set[i], 1) if status: if FORCE == 0: return status + + do_sonic_platform_install() + return def do_uninstall(): if not device_exist(): - print((PROJECT_NAME.upper()+" has no device installed....")) + print(PROJECT_NAME.upper()+" has no device installed....") else: print("Removing device....") status = device_uninstall() @@ -319,7 +365,7 @@ def do_uninstall(): return status if driver_inserted()== False : - print((PROJECT_NAME.upper()+" has no driver installed....")) + print(PROJECT_NAME.upper()+" has no driver installed....") else: print("Removing installed driver....") status = driver_uninstall() @@ -327,6 +373,8 @@ def do_uninstall(): if FORCE == 0: return status + do_sonic_platform_clean() + return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/handle_mgmt_interface.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/handle_mgmt_interface.sh new file mode 100755 index 000000000000..e1acd16a0161 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/handle_mgmt_interface.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +#Due to the hardware design, as4630-54pe use "eth2" instead of "eth0" as management interface. +#Rename netdev "eth0" and "eth2" to swap original "eth2" to "eth0". + +ifconfig eth0 down +ip link set eth0 name eth3 +ip link set eth2 name eth0 +ifconfig eth0 up diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py index e60236c9c781..b8b4820f9e4a 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py @@ -104,7 +104,7 @@ def _get_fan_node_val(self, fan_num, node_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -135,7 +135,7 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -224,14 +224,3 @@ def get_fan_status(self, fan_num): return True -#def main(): -# fan = FanUtil() -# -# print 'get_size_node_map : %d' % fan.get_size_node_map() -# print 'get_size_path_map : %d' % fan.get_size_path_map() -# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): -# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): -# print fan.get_fan_to_device_path(x, y) -# -#if __name__ == '__main__': -# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/thermalutil.py index ceb9ab464026..4e8ef9adcbe7 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/thermalutil.py @@ -22,7 +22,6 @@ # ------------------------------------------------------------------ try: - import os import time import logging import glob @@ -34,7 +33,7 @@ class ThermalUtil(object): """Platform-specific ThermalUtil class""" THERMAL_NUM_MAX = 4 - THERMAL_NUM_1_IDX = 1 # 1_ON_CPU_BROAD. LM75 + THERMAL_NUM_1_IDX = 1 # 1_ON_CPU_BROAD. LM75 THERMAL_NUM_2_IDX = 2 # 2_ON_MAIN_BROAD. LM75 THERMAL_NUM_3_IDX = 3 # 3_ON_MAIN_BROAD. LM75 THERMAL_NUM_4_IDX = 4 # 4_ON_MAIN_BROAD. LM75 @@ -42,88 +41,52 @@ class ThermalUtil(object): """ Dictionary where key1 = thermal id index (integer) starting from 1 value = path to fan device file (string) """ - #_thermal_to_device_path_mapping = {} - - _thermal_to_device_node_mapping = { - THERMAL_NUM_1_IDX: ['18', '4b'], - THERMAL_NUM_2_IDX: ['19', '4c'], - THERMAL_NUM_3_IDX: ['20', '49'], - THERMAL_NUM_4_IDX: ['21', '4a'], - } + thermal_sysfspath ={ - THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/18-004b/hwmon/hwmon3/temp1_input"], - THERMAL_NUM_2_IDX: ["/sys/bus/i2c/devices/19-004c/hwmon/hwmon4/temp1_input"], - THERMAL_NUM_3_IDX: ["/sys/bus/i2c/devices/20-0049/hwmon/hwmon5/temp1_input"], - THERMAL_NUM_4_IDX: ["/sys/bus/i2c/devices/21-004a/hwmon/hwmon6/temp1_input"], + THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/18-004b/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_2_IDX: ["/sys/bus/i2c/devices/19-004c/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_3_IDX: ["/sys/bus/i2c/devices/20-0049/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_4_IDX: ["/sys/bus/i2c/devices/21-004a/hwmon/hwmon*/temp1_input"], } - #def __init__(self): - def _get_thermal_val(self, thermal_num): + def get_thermal_val(self, thermal_num): if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_MAX: logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) return None - device_path = self.get_thermal_to_device_path(thermal_num) - if(os.path.isfile(device_path)): - for filename in glob.glob(device_path): - try: - val_file = open(filename, 'r') - except IOError as e: - logging.error('GET. unable to open file: %s', str(e)) - return None + device_path = self.get_thermal_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None content = val_file.readline().rstrip() if content == '': logging.debug('GET. content is NULL. device_path:%s', device_path) return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None return int(content) - - else: - print("No such device_path=%s"%device_path) - return 0 + + return 0 def get_num_thermals(self): return self.THERMAL_NUM_MAX - - def get_idx_thermal_start(self): - return self.THERMAL_NUM_1_IDX - - def get_size_node_map(self): - return len(self._thermal_to_device_node_mapping) - - def get_size_path_map(self): - return len(self.thermal_sysfspath) - - def get_thermal_to_device_path(self, thermal_num): + + def get_thermal_path(self, thermal_num): return self.thermal_sysfspath[thermal_num][0] - def get_thermal_1_val(self): - return self._get_thermal_val(self.THERMAL_NUM_1_IDX) - - def get_thermal_2_val(self): - return self._get_thermal_val(self.THERMAL_NUM_2_IDX) - - def get_thermal_3_val(self): - return self._get_thermal_val(self.THERMAL_NUM_3_IDX) - - def get_thermal_temp(self): - return (self._get_thermal_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_val(self.THERMAL_NUM_3_IDX)) - def main(): thermal = ThermalUtil() - print("termal1=%d" %thermal._get_thermal_val(1)) - print("termal2=%d" %thermal._get_thermal_val(2)) - print("termal3=%d" %thermal._get_thermal_val(3)) - print("termal4=%d" %thermal._get_thermal_val(4)) -# -# print 'get_size_node_map : %d' % thermal.get_size_node_map() -# print 'get_size_path_map : %d' % thermal.get_size_path_map() -# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): -# print thermal.get_thermal_to_device_path(x) -# + logging.basicConfig(level=logging.DEBUG) + logging.debug('thermal1=%d', thermal.get_thermal_val(1)) + logging.debug('thermal2=%d', thermal.get_thermal_val(2)) + logging.debug('thermal3=%d', thermal.get_thermal_val(3)) + logging.debug('thermal4=%d', thermal.get_thermal_val(4)) + if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py index e3b3fe742db9..49a12cd51ece 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py @@ -91,11 +91,11 @@ def manage_fans(self): thermal = ThermalUtil() fan = FanUtil() - temp2 = thermal.get_thermal_2_val() + temp2 = thermal.get_thermal_val(2) if temp2 is None: return False - temp3 = thermal.get_thermal_3_val() + temp3 = thermal.get_thermal_val(3) if temp3 is None: return False diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py index 79b1e730ee9e..5292d1ec3b18 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py @@ -48,8 +48,8 @@ if DEBUG == True: - print((sys.argv[0])) - print(("ARGV :", sys.argv[1:])) + print(sys.argv[0]) + print("ARGV :", sys.argv[1:]) def main(): @@ -67,7 +67,7 @@ def main(): if DEBUG == True: print(options) print(args) - print((len(sys.argv))) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -96,13 +96,13 @@ def main(): return 0 def show_help(): - print((__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]})) + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def my_log(txt): if DEBUG == True: - print(("[Debug]"+txt)) + print("[Debug]"+txt) return def log_os_system(cmd, show): @@ -113,7 +113,7 @@ def log_os_system(cmd, show): if status: logging.info('Failed :'+cmd) if show: - print(('Failed :'+cmd)) + print('Failed :'+cmd) return status, output def driver_check(): @@ -295,6 +295,10 @@ def device_install(): for i in range(49, 55): #Set qsfp port to normal state log_os_system("echo 0 > /sys/bus/i2c/devices/3-0062/module_reset_" + str(i), 1) + for i in range(1, 39): #Set disable tx_disable to sfp port + log_os_system("echo 0 > /sys/bus/i2c/devices/3-0061/module_tx_disable_" + str(i), 1) + for i in range(39, 49): #Set disable tx_disable to sfp port + log_os_system("echo 0 > /sys/bus/i2c/devices/3-0062/module_tx_disable_" + str(i), 1) for i in range(0,len(sfp_map)): if i < qsfp_start: @@ -358,31 +362,29 @@ def do_sonic_platform_install(): if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) if status: - print(("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3) )) + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3) ) return status else: - print(("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3) )) + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3) ) else: - print(('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3))) + print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) else: - print(('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3))) + print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) return def do_sonic_platform_clean(): status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) if status: - print(('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3))) + print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) else: status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) if status: - print(('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3))) + print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) return status else: - print(('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3))) - - return + print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) def do_install(): print("Checking system....") @@ -393,7 +395,7 @@ def do_install(): if FORCE == 0: return status else: - print((PROJECT_NAME.upper()+" drivers detected....")) + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): print("No device, installing....") status = device_install() @@ -401,7 +403,7 @@ def do_install(): if FORCE == 0: return status else: - print((PROJECT_NAME.upper()+" devices detected....")) + print(PROJECT_NAME.upper()+" devices detected....") do_sonic_platform_install() @@ -410,7 +412,7 @@ def do_install(): def do_uninstall(): print("Checking system....") if not device_exist(): - print((PROJECT_NAME.upper() +" has no device installed....")) + print(PROJECT_NAME.upper() +" has no device installed....") else: print("Removing device....") status = device_uninstall() @@ -419,7 +421,7 @@ def do_uninstall(): return status if driver_check()== False : - print((PROJECT_NAME.upper() +" has no driver installed....")) + print(PROJECT_NAME.upper() +" has no driver installed....") else: print("Removing installed driver....") status = driver_uninstall() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py index affed9ad804d..7c994864318c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py @@ -112,7 +112,7 @@ def _get_fan_node_val(self, fan_num, node_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -143,7 +143,7 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c index ed98daf2011a..035f9ad82ec8 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c @@ -146,7 +146,7 @@ static int accton_getLedReg(enum led_type type, u8 *reg) int i; for (i = 0; i < ARRAY_SIZE(led_reg_map); i++) { - if(led_reg_map[i].types ==type) { + if (led_reg_map[i].types ==type) { *reg = led_reg_map[i].reg_addr; return 0; } diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-56x-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-56x-pddf-platform-monitor.service deleted file mode 100644 index 03351824b7b4..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-56x-pddf-platform-monitor.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Accton AS7326-56X Platform Monitoring service -Before=pmon.service -After=pddf-platform-init.service -DefaultDependencies=no - -[Service] -ExecStart=/usr/local/bin/accton_as7326_pddf_monitor.py -KillSignal=SIGKILL -SuccessExitStatus=SIGKILL - -# Resource Limitations -LimitCORE=infinity - -[Install] -WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-handle_mac.service b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-handle_mac.service index ac196c219b91..3d03ec4f1540 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-handle_mac.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-handle_mac.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7326-56X Platform MAC handle service -Before=opennsl-modules.service pddf-platform-init.service +Before=opennsl-modules.service After=local-fs.target [Service] diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/pddf-platform-init.service deleted file mode 120000 index 0fd9f25b6c5e..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/pddf-platform-init.service +++ /dev/null @@ -1 +0,0 @@ -../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform_setup.py index 22bd354ea686..15806d24fff0 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform_setup.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform_setup.py @@ -1,5 +1,8 @@ from setuptools import setup +DEVICE_NAME = 'accton' +HW_SKU = 'x86_64-accton_as7326_56x-r0' + setup( name='sonic-platform', version='1.0', @@ -8,7 +11,11 @@ author='SONiC Team', author_email='linuxnetdev@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - packages=['sonic_platform'], + packages=[ + 'sonic_platform' + ], + package_dir={ + 'sonic_platform': '../../../../device/{}/{}/sonic_platform'.format(DEVICE_NAME, HW_SKU)}, classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: Plugins', diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py index 56f1bd585428..ec3a4c133cdd 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py @@ -166,14 +166,14 @@ def manage_fans(self): thermal = ThermalUtil() fan = FanUtil() - fan_dir=fan.get_fan_dir(1) - if fan_dir > 1: - fan_dri=1 #something wrong, set fan_dir to default val - if fan_dir < 0: - fan_dri=1 #something wrong, set fan_dir to default val + #fan_dir=fan.get_fan_dir(1) + #if fan_dir > 1: + # fan_dri=1 #something wrong, set fan_dir to default val + #if fan_dir < 0: + # fan_dri=1 #something wrong, set fan_dir to default val ori_pwm=fan.get_fan_duty_cycle() new_pwm=0 - logging.debug('fan_dir=%d, ori_pwm=%d', fan_dir, ori_pwm) + #logging.debug('fan_dir=%d, ori_pwm=%d', fan_dir, ori_pwm) logging.debug('test_temp=%d', test_temp) if test_temp==0: temp1 = thermal._get_thermal_val(1) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py index 997f8a64359d..c3e1c50366b7 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2016 Accton Networks, Inc. # @@ -14,15 +14,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# -# -# Description: -# Due to adoption of optoe drivers, sideband signals of SFPs are moved -# into cpld drivers. Add a new dict, cpld_of_module, for mapping this -# attributes to corresponding cpld nodes. -# - - """ Usage: %(scriptName)s [options] command object @@ -34,18 +25,14 @@ command: install : install drivers and generate related sysfs nodes clean : uninstall drivers and remove related sysfs nodes - show : show all systen status - sff : dump SFP eeprom - set : change board setting with fan|led|sfp """ - import subprocess import getopt import sys import logging import re import time - +import os @@ -96,41 +83,21 @@ def main(): for arg in args: if arg == 'install': do_install() + elif arg == 'api': + do_sonic_platform_install() + elif arg == 'api_clean': + do_sonic_platform_clean() elif arg == 'clean': do_uninstall() - elif arg == 'show': - device_traversal() - elif arg == 'sff': - if len(args)!=2: - show_eeprom_help() - elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: - show_eeprom_help() - else: - show_eeprom(args[1]) - return - elif arg == 'set': - if len(args)<3: - show_set_help() - else: - set_device(args[1:]) - return else: show_help() - - return 0 def show_help(): print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) -def show_set_help(): - cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print(cmd +" [led|sfp|fan]") - print(" use \""+ cmd + " led 0-4 \" to set led color") - print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") - print(" use \""+ cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable") - sys.exit(0) + def dis_i2c_ir3570a(addr): cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr @@ -156,11 +123,6 @@ def ir3570_check(): return ret -def show_eeprom_help(): - cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print(" use \""+ cmd + " 1-56 \" to dump sfp# eeprom") - sys.exit(0) - def my_log(txt): if DEBUG == True: print("[ROY]"+txt) @@ -174,7 +136,7 @@ def log_os_system(cmd, show): if status: logging.info('Failed :'+cmd) if show: - print(('Failed :'+cmd)) + print('Failed :'+cmd) return status, output def driver_check(): @@ -189,7 +151,7 @@ def driver_check(): kos = [ 'modprobe i2c_dev', -'modprobe i2c_mux_pca954x force_deselect_on_exit=1', +'modprobe i2c_mux_pca954x', 'modprobe accton_i2c_cpld' , 'modprobe ym2651y' , 'modprobe accton_as7326_56x_fan' , @@ -207,6 +169,8 @@ def driver_install(): if status: if FORCE == 0: return status + print("Done driver_install") + return 0 def driver_uninstall(): @@ -224,12 +188,8 @@ def driver_uninstall(): return status return 0 -led_prefix ='/sys/class/leds/accton_'+PROJECT_NAME+'_led::' -hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} -hwmon_nodes = {'led': ['brightness'] } -hwmon_prefix ={'led': led_prefix} - i2c_prefix = '/sys/bus/i2c/devices/' +''' i2c_bus = {'fan': ['11-0066'] , 'thermal': ['15-0048','15-0049', '15-004a', '15-004b'] , 'psu': ['17-0051','13-0053'], @@ -238,7 +198,7 @@ def driver_uninstall(): 'thermal': ['hwmon/hwmon*/temp1_input'] , 'psu': ['psu_present ', 'psu_power_good'] , 'sfp': ['module_present_', 'module_tx_disable_']} - +''' sfp_map = [ 42,41,44,43,47,45,46,50, 48,49,52,51,53,56,55,54, @@ -268,7 +228,6 @@ def driver_uninstall(): 'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-36/new_device', 'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-37/new_device', 'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-38/new_device', -'echo 24c04 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', 'echo as7326_56x_fan 0x66 > /sys/bus/i2c/devices/i2c-11/new_device ', 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-15/new_device', @@ -286,12 +245,22 @@ def driver_uninstall(): mknod2 =[ ] +#EERPOM +eeprom_mknod =[ +'echo 24c04 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device' +] def i2c_order_check(): # This project has only 1 i2c bus. return 0 +def eeprom_check(): + cmd = "i2cget -y -f 0 0x56" + status, output = subprocess.getstatusoutput(cmd) + return status + def device_install(): global FORCE @@ -320,6 +289,30 @@ def device_install(): print(output) if FORCE == 0: return status + + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + # initiate IDPROM + # Close 0x77 mux to make sure if the I2C address of IDPROM is 0x56 or 0x57 + log_os_system("i2cset -f -y 0 0x77 0 ", 1) + ret=eeprom_check() + if ret==0: + log_os_system(eeprom_mknod[0], 1) #old board, 0x56 eeprom + time.sleep(0.2) + exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') + if (exists is False): + subprocess.call('echo 0x56 > /sys/bus/i2c/devices/i2c-0/delete_device', shell=True) + log_os_system(eeprom_mknod[1], 1) + else: + log_os_system(eeprom_mknod[1], 1) #new board, 0x57 eeprom + + for i in range(0,len(sfp_map)): if i < qsfp_start or i >= qsfp_end: status, output =log_os_system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) @@ -329,6 +322,7 @@ def device_install(): print(output) if FORCE == 0: return status + print("Done device_install") return def device_uninstall(): @@ -364,6 +358,23 @@ def device_uninstall(): if FORCE == 0: return status + #Deal with for del 0x56 or 0x57 sysfs device + exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') + + if (exists is True): + target = eeprom_mknod[0] #0x56 + else: + target = eeprom_mknod[1] #0x57 + + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print(output) + if FORCE == 0: + return status + return def system_ready(): @@ -372,6 +383,44 @@ def system_ready(): if not device_exist(): return False return True +PLATFORM_ROOT_PATH = '/usr/share/sonic/device' +PLATFORM_API2_WHL_FILE_PY3 ='sonic_platform-1.0-py3-none-any.whl' +def do_sonic_platform_install(): + device_path = "{}{}{}{}".format(PLATFORM_ROOT_PATH, '/x86_64-accton_', PROJECT_NAME, '-r0') + SONIC_PLATFORM_BSP_WHL_PKG_PY3 = "/".join([device_path, PLATFORM_API2_WHL_FILE_PY3]) + + #Check API2.0 on py whl file + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) + if status: + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + +def do_sonic_platform_clean(): + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) + + else: + status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) + if status: + print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + + + return def do_install(): print("Checking system....") @@ -394,6 +443,9 @@ def do_install(): return status else: print(PROJECT_NAME.upper()+" devices detected....") + + do_sonic_platform_install() + return def do_uninstall(): @@ -416,185 +468,8 @@ def do_uninstall(): if FORCE == 0: return status - return - -def devices_info(): - global DEVICE_NO - global ALL_DEVICE - global i2c_bus, hwmon_types - for key in DEVICE_NO: - ALL_DEVICE[key]= {} - for i in range(0,DEVICE_NO[key]): - ALL_DEVICE[key][key+str(i+1)] = [] - - for key in i2c_bus: - buses = i2c_bus[key] - nodes = i2c_nodes[key] - for i in range(0,len(buses)): - for j in range(0,len(nodes)): - if 'fan' == key: - for k in range(0,DEVICE_NO[key]): - node = key+str(k+1) - path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] - my_log(node+": "+ path) - ALL_DEVICE[key][node].append(path) - elif 'sfp' == key: - for k in range(0,DEVICE_NO[key]): - for lk in cpld_of_module: - if k in cpld_of_module[lk]: - cpld_str = lk - node = key+str(k+1) - path = i2c_prefix+ lk + "/"+ nodes[j] + str(k+1) - my_log(node+": "+ path) - ALL_DEVICE[key][node].append(path) - else: - node = key+str(i+1) - path = i2c_prefix+ buses[i]+"/"+ nodes[j] - my_log(node+": "+ path) - ALL_DEVICE[key][node].append(path) - - for key in hwmon_types: - itypes = hwmon_types[key] - nodes = hwmon_nodes[key] - for i in range(0,len(itypes)): - for j in range(0,len(nodes)): - node = key+"_"+itypes[i] - path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] - my_log(node+": "+ path) - ALL_DEVICE[key][ key+str(i+1)].append(path) - - #show dict all in the order - if DEBUG == True: - for i in sorted(ALL_DEVICE.keys()): - print((i+": ")) - for j in sorted(ALL_DEVICE[i].keys()): - print((" "+j)) - for k in (ALL_DEVICE[i][j]): - print((" "+" "+k)) - return - -def show_eeprom(index): - if system_ready()==False: - print("System's not ready.") - print("Please install first!") - return - - if len(ALL_DEVICE)==0: - devices_info() - node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] - node = node.replace(node.split("/")[-1], 'eeprom') - # check if got hexdump command in current environment - ret, log = log_os_system("which hexdump", 0) - ret, log2 = log_os_system("which busybox hexdump", 0) - if len(log): - hex_cmd = 'hexdump' - elif len(log2): - hex_cmd = ' busybox hexdump' - else: - log = 'Failed : no hexdump cmd!!' - logging.info(log) - print(log) - return 1 - - print(node + ":") - ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) - if ret==0: - print(log) - else: - print("**********device no found**********") - return - -def set_device(args): - global DEVICE_NO - global ALL_DEVICE - if system_ready()==False: - print("System's not ready.") - print("Please install first!") - return - - if len(ALL_DEVICE)==0: - devices_info() - - if args[0]=='led': - if int(args[1])>4: - show_set_help() - return - #print ALL_DEVICE['led'] - for i in range(0,len(ALL_DEVICE['led'])): - for k in (ALL_DEVICE['led']['led'+str(i+1)]): - ret, log = log_os_system("echo "+args[1]+" >"+k, 1) - if ret: - return ret - elif args[0]=='fan': - if int(args[1])>100: - show_set_help() - return - #print ALL_DEVICE['fan'] - #fan1~6 is all fine, all fan share same setting - node = ALL_DEVICE['fan'] ['fan1'][0] - node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') - ret, log = log_os_system("cat "+ node, 1) - if ret==0: - print(("Previous fan duty: " + log.strip() +"%")) - ret, log = log_os_system("echo "+args[1]+" >"+node, 1) - if ret==0: - print(("Current fan duty: " + args[1] +"%")) - return ret - elif args[0]=='sfp': - if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: - show_set_help() - return - if len(args)<2: - show_set_help() - return - - if int(args[2])>1: - show_set_help() - return - - #print ALL_DEVICE[args[0]] - for i in range(0,len(ALL_DEVICE[args[0]])): - for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: - if j.find('tx_disable')!= -1: - ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) - if ret: - return ret - return + do_sonic_platform_clean() -#get digits inside a string. -#Ex: 31 for "sfp31" -def get_value(input): - digit = re.findall('\d+', input) - return int(digit[0]) - -def device_traversal(): - if system_ready()==False: - print("System's not ready.") - print("Please install first!") - return - - if len(ALL_DEVICE)==0: - devices_info() - for i in sorted(ALL_DEVICE.keys()): - print("============================================") - print((i.upper()+": ")) - print("============================================") - - for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): - print(" "+j+":", end=' ') - for k in (ALL_DEVICE[i][j]): - ret, log = log_os_system("cat "+k, 0) - func = k.split("/")[-1].strip() - func = re.sub(j+'_','',func,1) - func = re.sub(i.lower()+'_','',func,1) - if ret==0: - print(func+"="+log+" ", end=' ') - else: - print(func+"="+"X"+" ", end=' ') - print() - print("----------------------------------------------------------------") - - print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py index f4807487bf38..519aaa76749d 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py @@ -104,7 +104,7 @@ def _get_fan_node_val(self, fan_num, node_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -135,7 +135,7 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py index 65e872c6beb8..2a4afca9b7e0 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py @@ -81,11 +81,11 @@ def _get_thermal_node_val(self, thermal_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None - + return int(content) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-init.service new file mode 100644 index 000000000000..7f3b7d87f99f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-init.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS7816-64X Platform initialization service +Before=pmon.service determine-reboot-cause.service +After=sysinit.target +DefaultDependencies=no + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/local/bin/accton_as7816_64x_util.py install +ExecStop=/usr/local/bin/accton_as7816_64x_util.py clean + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service similarity index 64% rename from platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-pddf-platform-monitor.service rename to platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service index 7b6db7ddac01..f361642e69fc 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-pddf-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service @@ -1,11 +1,12 @@ [Unit] Description=Accton AS7816-64X Platform Monitoring service Before=pmon.service -After=pddf-platform-init.service +After=as7816-64x-platform-init.service +Requires=as7816-64x-platform-init.service DefaultDependencies=no [Service] -ExecStart=/usr/local/bin/accton_as7816_pddf_monitor.py +ExecStart=/usr/local/bin/accton_as7816_64x_monitor.py KillSignal=SIGKILL SuccessExitStatus=SIGKILL diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service deleted file mode 100755 index 486ed74f8243..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Accton AS7816-64X Platform initialization service -Before=pmon.service -After=sysinit.target -DefaultDependencies=no - -[Service] -ExecStartPre=/usr/local/bin/accton_as7816_util.py install -ExecStart=/usr/local/bin/accton_as7816_monitor.py -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/pddf-platform-init.service deleted file mode 120000 index 0fd9f25b6c5e..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/pddf-platform-init.service +++ /dev/null @@ -1 +0,0 @@ -../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform_setup.py index 22bd354ea686..607a9ef78dd9 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform_setup.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform_setup.py @@ -1,5 +1,8 @@ from setuptools import setup +DEVICE_NAME = 'accton' +HW_SKU = 'x86_64-accton_as7816_64x-r0' + setup( name='sonic-platform', version='1.0', @@ -8,7 +11,13 @@ author='SONiC Team', author_email='linuxnetdev@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - packages=['sonic_platform'], + maintainer='Jostar Yang', + maintainer_email='jostar_yang@edge-core.com', + packages=[ + 'sonic_platform', + ], + package_dir={ + 'sonic_platform': '../../../../device/{}/{}/sonic_platform'.format(DEVICE_NAME, HW_SKU)}, classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: Plugins', diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_monitor.py similarity index 99% rename from platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py rename to platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_monitor.py index d98cec58d2e5..f3ed87398bc1 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_monitor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2017 Accton Technology Corporation # diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py similarity index 80% rename from platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py rename to platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py index 525f2786647e..1e9314fb824e 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py @@ -48,8 +48,8 @@ if DEBUG == True: - print((sys.argv[0])) - print(('ARGV :', sys.argv[1:] )) + print(sys.argv[0]) + print('ARGV :', sys.argv[1:] ) def main(): @@ -67,7 +67,7 @@ def main(): if DEBUG == True: print(options) print(args) - print((len(sys.argv))) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -81,9 +81,14 @@ def main(): logging.info('no option') for arg in args: if arg == 'install': - do_install() + do_install() elif arg == 'clean': - do_uninstall() + do_uninstall() + elif arg == 'api': + do_sonic_platform_install() + elif arg == 'api_clean': + do_sonic_platform_clean() + else: show_help() @@ -91,7 +96,7 @@ def main(): return 0 def show_help(): - print(( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]})) + print( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) @@ -114,13 +119,13 @@ def ir3570_check(): else: ret = 0 except Exception as e: - print(("Error on ir3570_check() e:" + str(e))) + print("Error on ir3570_check() e:" + str(e)) return -1 return ret def my_log(txt): if DEBUG == True: - print(("[ROY]"+txt)) + print("[ROY]"+txt) return def log_os_system(cmd, show): @@ -131,7 +136,7 @@ def log_os_system(cmd, show): if status: logging.info('Failed :'+cmd) if show: - print(('Failed :'+cmd)) + print('Failed :'+cmd) return status, output def driver_check(): @@ -298,7 +303,44 @@ def system_ready(): if not device_exist(): return False return True - + +PLATFORM_ROOT_PATH = '/usr/share/sonic/device' +PLATFORM_API2_WHL_FILE_PY3 ='sonic_platform-1.0-py3-none-any.whl' +def do_sonic_platform_install(): + device_path = "{}{}{}{}".format(PLATFORM_ROOT_PATH, '/x86_64-accton_', PROJECT_NAME, '-r0') + SONIC_PLATFORM_BSP_WHL_PKG_PY3 = "/".join([device_path, PLATFORM_API2_WHL_FILE_PY3]) + + #Check API2.0 on py whl file + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) + if status: + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + +def do_sonic_platform_clean(): + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) + + else: + status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) + if status: + print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return def do_install(): print("Checking system....") if driver_check() == False: @@ -308,7 +350,7 @@ def do_install(): if FORCE == 0: return status else: - print((PROJECT_NAME.upper()+" drivers detected....")) + print(PROJECT_NAME.upper()+" drivers detected....") ir3570_check() @@ -319,13 +361,15 @@ def do_install(): if FORCE == 0: return status else: - print((PROJECT_NAME.upper()+" devices detected....")) + print(PROJECT_NAME.upper()+" devices detected....") + do_sonic_platform_install() + return def do_uninstall(): print("Checking system....") if not device_exist(): - print((PROJECT_NAME.upper() +" has no device installed....")) + print(PROJECT_NAME.upper() +" has no device installed....") else: print("Removing device....") status = device_uninstall() @@ -334,7 +378,7 @@ def do_uninstall(): return status if driver_check()== False : - print((PROJECT_NAME.upper() +" has no driver installed....")) + print(PROJECT_NAME.upper() +" has no driver installed....") else: print("Removing installed driver....") status = driver_uninstall() @@ -342,6 +386,8 @@ def do_uninstall(): if FORCE == 0: return status + do_sonic_platform_clean() + return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c index 5834b1d4ef8b..20cef5d61a38 100755 --- a/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c @@ -42,7 +42,8 @@ enum chips { YM2651, YM2401, YM2851, - YPEB1200AM + YM1401A, + YPEB1200AM }; /* Each client has this additional data @@ -66,8 +67,9 @@ struct ym2651y_data { u16 fan_duty_cycle[2]; /* Register value */ u8 fan_dir[4]; /* Register value */ u8 pmbus_revision; /* Register value */ + u8 mfr_serial[21]; /* Register value */ u8 mfr_id[10]; /* Register value */ - u8 mfr_model[10]; /* Register value */ + u8 mfr_model[16]; /* Register value */ u8 mfr_revsion[3]; /* Register value */ u16 mfr_vin_min; /* Register value */ u16 mfr_vin_max; /* Register value */ @@ -113,9 +115,11 @@ enum ym2651y_sysfs_attributes { PSU_FAN1_SPEED, PSU_FAN1_DUTY_CYCLE, PSU_PMBUS_REVISION, + PSU_SERIAL_NUM, PSU_MFR_ID, PSU_MFR_MODEL, PSU_MFR_REVISION, + PSU_MFR_SERIAL, PSU_MFR_VIN_MIN, PSU_MFR_VIN_MAX, PSU_MFR_VOUT_MIN, @@ -141,9 +145,11 @@ static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FA static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); static SENSOR_DEVICE_ATTR(psu_pmbus_revision, S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_serial_num, S_IRUGO, show_ascii, NULL, PSU_SERIAL_NUM); static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, S_IRUGO, show_ascii, NULL, PSU_MFR_SERIAL); static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MIN); @@ -175,9 +181,11 @@ static struct attribute *ym2651y_attributes[] = { &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, &sensor_dev_attr_psu_fan_dir.dev_attr.attr, &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_serial_num.dev_attr.attr, &sensor_dev_attr_psu_mfr_id.dev_attr.attr, &sensor_dev_attr_psu_mfr_model.dev_attr.attr, &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, @@ -362,14 +370,17 @@ static ssize_t show_ascii(struct device *dev, struct device_attribute *da, } ptr = data->fan_dir; break; + case PSU_MFR_SERIAL: /* psu_mfr_serial */ + ptr = data->mfr_serial+1; /* The first byte is the count byte of string. */ + break; case PSU_MFR_ID: /* psu_mfr_id */ - ptr = data->mfr_id; + ptr = data->mfr_id+1; /* The first byte is the count byte of string. */ break; case PSU_MFR_MODEL: /* psu_mfr_model */ - ptr = data->mfr_model; + ptr = data->mfr_model+1; /* The first byte is the count byte of string. */ break; case PSU_MFR_REVISION: /* psu_mfr_revision */ - ptr = data->mfr_revsion; + ptr = data->mfr_revsion+1; break; default: return 0; @@ -415,7 +426,7 @@ static ssize_t show_vout(struct device *dev, struct device_attribute *da, struct i2c_client *client = to_i2c_client(dev); struct ym2651y_data *data = i2c_get_clientdata(client); - if (data->chip == YM2401) { + if (data->chip == YM2401 || data->chip==YM1401A) { return show_vout_by_mode(dev, da, buf); } else { @@ -493,6 +504,7 @@ static const struct i2c_device_id ym2651y_id[] = { { "ym2651", YM2651 }, { "ym2401", YM2401 }, { "ym2851", YM2851 }, + { "ym1401a",YM1401A}, { "ype1200am", YPEB1200AM }, {} }; @@ -561,8 +573,8 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) { - int i, status; - u8 command; + int i, status, length; + u8 command, buf; u8 fan_dir[5] = {0}; struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, {0x20, &data->vout_mode}, @@ -599,6 +611,7 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) dev_dbg(&client->dev, "reg %d, err %d\n", regs_byte[i].reg, status); *(regs_byte[i].value) = 0; + goto exit; } else { *(regs_byte[i].value) = status; @@ -614,6 +627,7 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) dev_dbg(&client->dev, "reg %d, err %d\n", regs_word[i].reg, status); *(regs_word[i].value) = 0; + goto exit; } else { *(regs_word[i].value) = status; @@ -626,6 +640,7 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; } strncpy(data->fan_dir, fan_dir+1, ARRAY_SIZE(data->fan_dir)-1); @@ -642,12 +657,61 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) /* Read mfr_model */ command = 0x9a; - status = ym2651y_read_block(client, command, data->mfr_model, - ARRAY_SIZE(data->mfr_model)-1); - data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; + length = 1; + /* Read first byte to determine the length of data */ + status = ym2651y_read_block(client, command, &buf, length); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + status = ym2651y_read_block(client, command, data->mfr_model, buf+1); + + if ((buf+1) >= (ARRAY_SIZE(data->mfr_model)-1)) + { + data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; + } + else + data->mfr_model[buf+1] = '\0'; if (status < 0) + { dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + /*YM-1401A PSU doens't support to get serial_num, so ignore it. + *It's vout doesn't support linear, so let it use show_vout_by_mode(). + */ + if(!strncmp("YM-1401A", data->mfr_model+1, strlen("YM-1401A"))) + { + data->chip=YM1401A; + } + else + { + /* Read mfr_serial */ + command = 0x9e; + length = 1; + /* Read first byte to determine the length of data */ + status = ym2651y_read_block(client, command, &buf, length); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + status = ym2651y_read_block(client, command, data->mfr_serial, buf+1); + + if ((buf+1) >= (ARRAY_SIZE(data->mfr_serial)-1)) + { + data->mfr_serial[ARRAY_SIZE(data->mfr_serial)-1] = '\0'; + } + else + data->mfr_serial[buf+1] = '\0'; + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + } /* Read mfr_revsion */ command = 0x9b; @@ -656,12 +720,16 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; if (status < 0) + { dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } data->last_updated = jiffies; data->valid = 1; } + exit: mutex_unlock(&data->update_lock); return data; diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install index 4ba26bed2625..a87ebb5b046a 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install @@ -1 +1 @@ -as4630-54pe/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as4630_54pe-r0/pddf +as4630-54pe/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as4630_54pe-r0 diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst deleted file mode 100644 index 23bebd3b295c..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst +++ /dev/null @@ -1,8 +0,0 @@ -# Special arrangement to make PDDF mode default -# Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) -# Enable pddf-platform-monitor -depmod -a -systemctl enable pddf-platform-init.service -systemctl start pddf-platform-init.service -systemctl enable as4630-54pe-pddf-platform-monitor.service -systemctl start as4630-54pe-pddf-platform-monitor.service diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.install index 1d9885d22d27..a6b7094e0e03 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.install +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.install @@ -1 +1,2 @@ -as7326-56x/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf +as7326-56x/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as7326_56x-r0 + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.install index 01b33cc19e54..8f214208a6b8 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.install +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.install @@ -1 +1,2 @@ -as7816-64x/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf +as7816-64x/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as7816_64x-r0 + From d3f2da867952a429d29d115ca259249d0df8e6c1 Mon Sep 17 00:00:00 2001 From: FuzailBrcm <51665572+FuzailBrcm@users.noreply.github.com> Date: Fri, 18 Mar 2022 23:44:10 +0530 Subject: [PATCH 45/54] [pddf]: Adding support for fan_drawer class in PDDF common platform APIs (#10213) Why I did it fan_drawer support was missing in PDDF common platform APIs. This resulted in 'thermalctld' not working and 'show platform fan' and 'show platfomr temperature' commands not working. _thermal_list array inside PSU class was not initialized. Made changes to attach the PSU related thermal sensors in the PSU instance. How I did it Added a common class pddf_fan_drawer.py. This class uses the PDDF JSON to fetch the platform specific data. A platform which uses PDDF would follow the below hierarchy. fan_drawer_base.py ---> pddf_fan_drawer.py ---> fan_drawer.py How to verify it Run the 'show platform fan' and 'show platform temperature' commands and check the o/p. o/p on AS7326: root@sonic:/home/admin# show platform fan s Drawer LED FAN Speed Direction Presence Status Timestamp -------- ----- ---------- ------- ----------- ---------- -------- ----------------- Fantray1 green Fantray1_1 38% EXHAUST Present OK 20220311 04:15:03 Fantray1 green Fantray1_2 38% EXHAUST Present OK 20220311 04:15:03 Fantray2 green Fantray2_1 38% EXHAUST Present OK 20220311 04:15:03 Fantray2 green Fantray2_2 38% EXHAUST Present OK 20220311 04:15:03 Fantray3 green Fantray3_1 38% EXHAUST Present OK 20220311 04:15:03 Fantray3 green Fantray3_2 38% EXHAUST Present OK 20220311 04:15:03 Fantray4 green Fantray4_1 38% EXHAUST Present OK 20220311 04:15:03 Fantray4 green Fantray4_2 38% EXHAUST Present OK 20220311 04:15:03 Fantray5 green Fantray5_1 38% EXHAUST Present OK 20220311 04:15:03 Fantray5 green Fantray5_2 38% EXHAUST Present OK 20220311 04:15:03 Fantray6 green Fantray6_1 38% EXHAUST Present OK 20220311 04:15:03 Fantray6 green Fantray6_2 38% EXHAUST Present OK 20220311 04:15:03 N/A off PSU1_FAN1 0% Present Not OK 20220311 04:15:05 N/A green PSU2_FAN1 34% EXHAUST Present OK 20220311 04:15:05 hroot@sonic:/home/admin# show platform temperature Sensor Temperature High TH Low TH Crit High TH Crit Low TH Warning Timestamp ---------- ------------- --------- -------- -------------- ------------- --------- ----------------- PSU1_TEMP1 0 N/A N/A N/A N/A False 20220311 04:15:05 PSU2_TEMP1 37 N/A N/A N/A N/A False 20220311 04:15:05 TEMP1 37 80.0 N/A N/A N/A False 20220311 04:15:05 TEMP2 27 80.0 N/A N/A N/A False 20220311 04:15:05 TEMP3 28.5 80.0 N/A N/A N/A False 20220311 04:15:05 TEMP4 30.5 80.0 N/A N/A N/A False 20220311 04:15:05 root@sonic:/home/admin# root@sonic:/home/admin# root@sonic:/home/admin# o/p on AS7726: root@as7726-32x-2:~# show platform fan Drawer LED FAN Speed Direction Presence Status Timestamp -------- ----- ---------- ------- ----------- ---------- -------- ----------------- Fantray1 green Fantray1_1 38% EXHAUST Present OK 20220311 08:13:04 Fantray1 green Fantray1_2 38% EXHAUST Present OK 20220311 08:13:04 Fantray2 green Fantray2_1 38% EXHAUST Present OK 20220311 08:13:04 Fantray2 green Fantray2_2 38% EXHAUST Present OK 20220311 08:13:04 Fantray3 green Fantray3_1 38% EXHAUST Present OK 20220311 08:13:04 Fantray3 green Fantray3_2 38% EXHAUST Present OK 20220311 08:13:04 Fantray4 green Fantray4_1 38% EXHAUST Present OK 20220311 08:13:04 Fantray4 green Fantray4_2 38% EXHAUST Present OK 20220311 08:13:04 Fantray5 green Fantray5_1 38% EXHAUST Present OK 20220311 08:13:04 Fantray5 green Fantray5_2 38% EXHAUST Present OK 20220311 08:13:04 Fantray6 green Fantray6_1 38% EXHAUST Present OK 20220311 08:13:04 Fantray6 green Fantray6_2 38% EXHAUST Present OK 20220311 08:13:04 N/A green PSU1_FAN1 23% EXHAUST Present OK 20220311 08:13:04 N/A green PSU2_FAN1 22% EXHAUST Present OK 20220311 08:13:04 root@as7726-32x-2:~# show platform temp Sensor Temperature High TH Low TH Crit High TH Crit Low TH Warning Timestamp ---------- ------------- --------- -------- -------------- ------------- --------- ----------------- PSU1_TEMP1 28 N/A N/A N/A N/A False 20220311 08:13:04 PSU2_TEMP1 25 N/A N/A N/A N/A False 20220311 08:13:04 TEMP1 23.5 80.0 N/A N/A N/A False 20220311 08:13:04 TEMP2 27 80.0 N/A N/A N/A False 20220311 08:13:04 TEMP3 24 80.0 N/A N/A N/A False 20220311 08:13:04 TEMP4 27 80.0 N/A N/A N/A False 20220311 08:13:04 TEMP5 24 80.0 N/A N/A N/A False 20220311 08:13:04 --- .../sonic_platform_pddf_base/pddf_chassis.py | 8 +- .../sonic_platform_pddf_base/pddf_fan.py | 2 +- .../pddf_fan_drawer.py | 110 ++++++++++ .../sonic_platform_pddf_base/pddf_psu.py | 6 + .../sonic_platform_pddf_base/pddf_thermal.py | 198 +++++++++++------- 5 files changed, 248 insertions(+), 76 deletions(-) create mode 100755 platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py index 0ba2e8902c9c..d90949184d5b 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py @@ -10,7 +10,7 @@ from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.sfp import Sfp from sonic_platform.psu import Psu - from sonic_platform.fan import Fan + from sonic_platform.fan_drawer import FanDrawer from sonic_platform.thermal import Thermal from sonic_platform.eeprom import Eeprom except ImportError as e: @@ -52,9 +52,9 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): # FANs for i in range(self.platform_inventory['num_fantrays']): - for j in range(self.platform_inventory['num_fans_pertray']): - fan = Fan(i, j, self.pddf_obj, self.plugin_data) - self._fan_list.append(fan) + fandrawer = FanDrawer(i, self.pddf_obj, self.plugin_data) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) # PSUs for i in range(self.platform_inventory['num_psus']): diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py index d272d40e61a4..2a8ef46085c5 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py @@ -153,7 +153,7 @@ def get_speed(self): speed = int(output['status']) max_speed = int(self.plugin_data['PSU']['PSU_FAN_MAX_SPEED']) - speed_percentage = (speed*100)/max_speed + speed_percentage = round((speed*100)/max_speed) return speed_percentage else: # TODO This calculation should change based on MAX FAN SPEED diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py new file mode 100755 index 000000000000..f88e833408dd --- /dev/null +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py @@ -0,0 +1,110 @@ +############################################################################# +# PDDF +# +# PDDF fan_drawer base class inherited from the common base class fan_drawer.py +# +############################################################################# + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PddfFanDrawer(FanDrawerBase): + """PDDF generic Fan Drawer class""" + + pddf_obj = {} + plugin_data = {} + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + FanDrawerBase.__init__(self) + if not pddf_data or not pddf_plugin_data: + raise ValueError('PDDF JSON data error') + + self.pddf_obj = pddf_data + self.plugin_data = pddf_plugin_data + self.platform = self.pddf_obj.get_platform() + + if tray_idx < 0 or tray_idx >= self.platform['num_fantrays']: + print("Invalid fantray index %d\n" % tray_idx) + return + + self.fantray_index = tray_idx+1 + for j in range(self.platform['num_fans_pertray']): + # Fan index is 0-based for the init call + self._fan_list.append(Fan(tray_idx, j, self.pddf_obj, self.plugin_data)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: String containing fan-drawer name + """ + return "Fantray{0}".format(self.fantray_index) + + def get_presence(self): + status = False + # Usually if a tray is removed, all the fans inside it are absent + if self._fan_list: + status = self._fan_list[0].get_presence() + + return status + + def get_status(self): + status = False + # if all the fans are working fine, then tray status should be okay + if self._fan_list: + status = all(fan.get_status() == True for fan in self._fan_list) + + return status + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + # Usually Fantrays are replaceable + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.fantray_index + + def get_status_led(self): + led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" + + if led_device_name not in self.pddf_obj.data.keys(): + # Implement a generic status_led color scheme + if self.get_status(): + return self.STATUS_LED_COLOR_GREEN + else: + return self.STATUS_LED_COLOR_OFF + + device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] + self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) + self.pddf_obj.create_attr('index', str(self.fantray_index-1), self.pddf_obj.get_led_path()) + self.pddf_obj.create_attr('dev_ops', 'get_status', self.pddf_obj.get_led_path()) + color = self.pddf_obj.get_led_color() + return (color) + + def set_status_led(self, color): + result = False + led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" + result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color) + if result == False: + print(msg) + return (False) + + device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] + self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) + self.pddf_obj.create_attr('index', str(self.fantray_index-1), self.pddf_obj.get_led_path()) + self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path()) + self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path()) + return (True) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py index 912333df8b57..bbe7dc0a1a44 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py @@ -20,6 +20,7 @@ try: from sonic_platform_base.psu_base import PsuBase from sonic_platform.fan import Fan + from sonic_platform.thermal import Thermal except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -45,6 +46,11 @@ def __init__(self, index, pddf_data=None, pddf_plugin_data=None): psu_fan = Fan(0, psu_fan_idx, pddf_data, pddf_plugin_data, True, self.psu_index) self._fan_list.append(psu_fan) + self.num_psu_thermals = 1 # Fixing it 1 for now + for psu_thermal_idx in range(self.num_psu_thermals): + psu_thermal = Thermal(psu_thermal_idx, pddf_data, pddf_plugin_data, True, self.psu_index) + self._thermal_list.append(psu_thermal) + def get_num_fans(self): """ Retrieves the number of fan modules available on this PSU diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py index 644292eb17e5..a0fe6a28bf44 100644 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py @@ -22,7 +22,7 @@ class PddfThermal(ThermalBase): pddf_obj = {} plugin_data = {} - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): if not pddf_data or not pddf_plugin_data: raise ValueError('PDDF JSON data error') @@ -35,78 +35,129 @@ def __init__(self, index, pddf_data=None, pddf_plugin_data=None): self.thermal_obj_name = "TEMP{}".format(self.thermal_index) self.thermal_obj = self.pddf_obj.data[self.thermal_obj_name] + self.is_psu_thermal = is_psu_thermal + if self.is_psu_thermal: + self.thermals_psu_index = psu_index + def get_name(self): - if 'dev_attr' in self.thermal_obj.keys(): - if 'display_name' in self.thermal_obj['dev_attr']: - return str(self.thermal_obj['dev_attr']['display_name']) - # In case of errors - return (self.thermal_obj_name) + if self.is_psu_thermal: + return "PSU{}_TEMP{}".format(self.thermals_psu_index, self.thermal_index) + else: + if 'dev_attr' in self.thermal_obj.keys(): + if 'display_name' in self.thermal_obj['dev_attr']: + return str(self.thermal_obj['dev_attr']['display_name']) + # In case of errors + return (self.thermal_obj_name) + + def get_presence(self): + if self.is_psu_thermal: + # Temp sensor on the PSU + device = "PSU{}".format(self.thermals_psu_index) + output = self.pddf_obj.get_attr_name_output(device, "psu_present") + if not output: + return False + + mode = output['mode'] + status = output['status'] + + vmap = self.plugin_data['PSU']['psu_present'][mode]['valmap'] + + if status.rstrip('\n') in vmap: + return vmap[status.rstrip('\n')] + else: + return False + else: + # Temp sensor on the board + return True def get_temperature(self): - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_input") - if not output: - return None + if self.is_psu_thermal: + device = "PSU{}".format(self.thermals_psu_index) + output = self.pddf_obj.get_attr_name_output(device, "psu_temp1_input") + if not output: + return None - if output['status'].isalpha(): - attr_value = None + temp1 = output['status'] + # temperature returned is in milli celcius + return float(temp1)/1000 else: - attr_value = float(output['status']) + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_input") + if not output: + return None - if output['mode'] == 'bmc': - return attr_value - else: - return (attr_value/float(1000)) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) + + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) def get_high_threshold(self): - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_high_threshold") - if not output: - return None + if not self.is_psu_thermal: + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_high_threshold") + if not output: + return None - if output['status'].isalpha(): - attr_value = None - else: - attr_value = float(output['status']) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) - if output['mode'] == 'bmc': - return attr_value + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) else: - return (attr_value/float(1000)) + raise NotImplementedError + def get_low_threshold(self): - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_low_threshold") - if not output: - return None + if not self.is_psu_thermal: + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_low_threshold") + if not output: + return None - if output['status'].isalpha(): - attr_value = None - else: - attr_value = float(output['status']) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) - if output['mode'] == 'bmc': - return attr_value + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) else: - return (attr_value/float(1000)) + raise NotImplementedError def set_high_threshold(self, temperature): - node = self.pddf_obj.get_path(self.thermal_obj_name, "temp1_high_threshold") - if node is None: - print("ERROR %s does not exist" % node) - return None + if not self.is_psu_thermal: + node = self.pddf_obj.get_path(self.thermal_obj_name, "temp1_high_threshold") + if node is None: + print("ERROR %s does not exist" % node) + return None - cmd = "echo '%d' > %s" % (temperature * 1000, node) - os.system(cmd) + cmd = "echo '%d' > %s" % (temperature * 1000, node) + os.system(cmd) - return (True) + return (True) + else: + raise NotImplementedError def set_low_threshold(self, temperature): - node = self.pddf_obj.get_path(self.thermal_obj_name, "temp1_low_threshold") - if node is None: - print("ERROR %s does not exist" % node) - return None - cmd = "echo '%d' > %s" % (temperature * 1000, node) - os.system(cmd) + if not self.is_psu_thermal: + node = self.pddf_obj.get_path(self.thermal_obj_name, "temp1_low_threshold") + if node is None: + print("ERROR %s does not exist" % node) + return None + cmd = "echo '%d' > %s" % (temperature * 1000, node) + os.system(cmd) - return (True) + return (True) + else: + raise NotImplementedError def get_high_critical_threshold(self): """ @@ -116,19 +167,22 @@ def get_high_critical_threshold(self): A float number, the high critical threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_high_crit_threshold") - if not output: - return None + if not self.is_psu_thermal: + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_high_crit_threshold") + if not output: + return None - if output['status'].isalpha(): - attr_value = None - else: - attr_value = float(output['status']) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) - if output['mode'] == 'bmc': - return attr_value + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) else: - return (attr_value/float(1000)) + raise NotImplementedError def get_low_critical_threshold(self): """ @@ -138,22 +192,24 @@ def get_low_critical_threshold(self): A float number, the low critical threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_low_crit_threshold") - if not output: - return None + if not self.is_psu_thermal: + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_low_crit_threshold") + if not output: + return None - if output['status'].isalpha(): - attr_value = None - else: - attr_value = float(output['status']) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) - if output['mode'] == 'bmc': - return attr_value + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) else: - return (attr_value/float(1000)) + raise NotImplementedError # Helper Functions - def get_temp_label(self): if 'bmc' in self.pddf_obj.data[self.thermal_obj_name].keys(): return None From 64822d80b1e12319639f302e7b29df18d1f38b41 Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Fri, 18 Mar 2022 11:31:38 -0700 Subject: [PATCH 46/54] [sonic-linkmgrd][master] submodule update (#10271) f00efef Longxiang Lyu Wed Mar 16 09:12:46 2022 +0800 Add a command line option to store logs into a separate file (#41) ff2e67d Longxiang Lyu Tue Mar 15 09:10:59 2022 +0800 Add default port cable type (#39) ebbb4d8 Jing Zhang Mon Mar 14 15:41:11 2022 -0700 Prevent switching MUX to "Unknown" (#36) c779b8f Longxiang Lyu Thu Mar 10 21:35:11 2022 +0800 [nonfunctional] Use LinkProberStateMachineBase (#38) b9fedd0 Longxiang Lyu Wed Mar 9 13:03:58 2022 +0800 [NONFUNCTIONAL] Add LinkProberStateMachineBase (#37) bedd42b Longxiang Lyu Wed Mar 9 10:03:00 2022 +0800 Add .clang-format file to format code (#28) 9fe4fc6 Guohan Lu Thu Mar 3 17:51:43 2022 -0800 [doc]: add lgtm badge in README.md c1249d9 Longxiang Lyu Wed Mar 2 18:05:18 2022 +0800 Enable lgtm (#33) b8514c6 Longxiang Lyu Wed Mar 2 13:34:39 2022 +0800 Collect port cable type to use corresponding state machine (#31) 9b59ef9 Longxiang Lyu Wed Mar 2 07:19:33 2022 +0800 Improve make clean (#32) --- src/linkmgrd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linkmgrd b/src/linkmgrd index ce72b0d2b8bb..f00efefd3099 160000 --- a/src/linkmgrd +++ b/src/linkmgrd @@ -1 +1 @@ -Subproject commit ce72b0d2b8bb10c8734d841cf27614c2e3b197c8 +Subproject commit f00efefd30995de447fd6932369cb5be250ddf90 From 3a4ed995930ae0991797ff29ed92bb40e2090475 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 18 Mar 2022 12:10:30 -0700 Subject: [PATCH 47/54] [Arista] Update driver submodules (#10267) - Fix i2c bus on crow cpu - Fix exception handling in logs - Improve linecard mgmt interface configuration - Add new PSU models for chassis - Misc fixes --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 516ece8126ed..da8370423b07 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 516ece8126ed8ad35b23c40782ec75dc836b4850 +Subproject commit da8370423b07c9271fad515c9ef1fd6149abbeed diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 516ece8126ed..da8370423b07 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 516ece8126ed8ad35b23c40782ec75dc836b4850 +Subproject commit da8370423b07c9271fad515c9ef1fd6149abbeed From 9d2078c446d2b56a49a55bee7e16c128ab8a6e5d Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sat, 19 Mar 2022 03:11:13 +0800 Subject: [PATCH 48/54] [Mellanox] Update Mellanox SN2201 device specific files (#10275) Update device-specific files for new platform SN2201, including: device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_objects.j2 device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/hwsku.json device/mellanox/x86_64-nvidia_sn2201-r0/default_sku device/mellanox/x86_64-nvidia_sn2201-r0/pcie.yaml device/mellanox/x86_64-nvidia_sn2201-r0/platform.json device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf Signed-off-by: Kebo Liu Co-authored-by: Stephen Sun --- .../ACS-SN2201/buffers_defaults_objects.j2 | 1 + .../ACS-SN2201/hwsku.json | 144 ++++++++++++------ .../x86_64-nvidia_sn2201-r0/default_sku | 2 +- .../x86_64-nvidia_sn2201-r0/pcie.yaml | 130 +++++++--------- .../x86_64-nvidia_sn2201-r0/platform.json | 134 +++++++++------- .../platform_components.json | 12 ++ .../x86_64-nvidia_sn2201-r0/sensors.conf | 133 ++++++++++++++-- 7 files changed, 373 insertions(+), 183 deletions(-) create mode 120000 device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_objects.j2 create mode 100644 device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_objects.j2 b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/hwsku.json b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/hwsku.json index fcd6343ca905..435135cef434 100644 --- a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/hwsku.json +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/hwsku.json @@ -1,148 +1,196 @@ { "interfaces": { "Ethernet0": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet1": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet2": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet3": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet4": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet5": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet6": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet7": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet8": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet9": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet10": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet11": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet12": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet13": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet14": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet15": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet16": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet17": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet18": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet19": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet20": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet21": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet22": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet23": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet24": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet25": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet26": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet27": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet28": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet29": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet30": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet31": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet32": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet33": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet34": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet35": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet36": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet37": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet38": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet39": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet40": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet41": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet42": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet43": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet44": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet45": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet46": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet47": { - "default_brkout_mode": "1x1G[100]" + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" }, "Ethernet48": { "default_brkout_mode": "1x100G[50G,40G,25G,10G]" diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/default_sku b/device/mellanox/x86_64-nvidia_sn2201-r0/default_sku index 46029c3e83e3..2ef2c5dd0d32 100644 --- a/device/mellanox/x86_64-nvidia_sn2201-r0/default_sku +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/default_sku @@ -1 +1 @@ -ACS-MSN2201 t1 +ACS-SN2201 t1 diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/pcie.yaml b/device/mellanox/x86_64-nvidia_sn2201-r0/pcie.yaml index 49de6829aa70..51ffd949d54a 100644 --- a/device/mellanox/x86_64-nvidia_sn2201-r0/pcie.yaml +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/pcie.yaml @@ -19,107 +19,114 @@ dev: '00' fn: '0' id: '1980' - name: 'Host bridge: Intel Corporation Device (rev 11)' + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev + 11)' - bus: '00' dev: '04' fn: '0' - id: '19a1' - name: 'Host bridge: Intel Corporation Device (rev 11)' + id: 19a1 + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers + (rev 11)' - bus: '00' dev: '05' fn: '0' - id: '19a2' - name: 'Generic system peripheral: Intel Corporation Device (rev 11)' + id: 19a2 + name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000 + Series Root Complex Event Collector (rev 11)' - bus: '00' dev: '06' fn: '0' - id: '19a3' - name: 'PCI bridge: Intel Corporation Device (rev 11)' + id: 19a3 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT + Root Port (rev 11)' - bus: '00' - dev: '09' + dev: 09 fn: '0' - id: '19a4' - name: 'PCI bridge: Intel Corporation Device (rev 11)' + id: 19a4 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #0 (rev 11)' - bus: '00' - dev: '0b' + dev: 0b fn: '0' - id: '19a6' - name: 'PCI bridge: Intel Corporation Device (rev 11)' + id: 19a6 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #2 (rev 11)' - bus: '00' - dev: '0f' + dev: 0f fn: '0' - id: '19a9' - name: 'PCI bridge: Intel Corporation Device (rev 11)' + id: 19a9 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #5 (rev 11)' - bus: '00' dev: '10' fn: '0' - id: '19aa' - name: 'PCI bridge: Intel Corporation Device (rev 11)' + id: 19aa + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #6 (rev 11)' - bus: '00' - dev: 11 + dev: '11' fn: '0' - id: '19ab' - name: 'PCI bridge: Intel Corporation Device (rev 11)' + id: 19ab + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #7 (rev 11)' - bus: '00' - dev: 12 + dev: '12' fn: '0' id: 19ac - name: 'System peripheral: Intel Corporation DNV SMBus Contoller - Host (rev 11)' + name: 'System peripheral: Intel Corporation Atom Processor C3000 Series SMBus Contoller + - Host (rev 11)' - bus: '00' - dev: 15 + dev: '15' fn: '0' id: 19d0 - name: 'USB controller: Intel Corporation Device (rev 11)' + name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI + Controller (rev 11)' - bus: '00' - dev: 16 + dev: '18' fn: '0' - id: 19d1 - name: 'PCI bridge: Intel Corporation Device (rev 11)' -- bus: '00' - dev: 17 - fn: '0' - id: 19d2 - name: 'PCI bridge: Intel Corporation Device (rev 11)' -- bus: '00' - dev: 18 - fn: '0' - id: 1973 - name: 'Communication controller: Intel Corporation Device (rev 11)' + id: 19d3 + name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME + HECI 1 (rev 11)' - bus: '00' dev: 1c fn: '0' id: 19db - name: 'SD Host controller: Intel Corporation Device (rev 11)' + name: 'SD Host controller: Intel Corporation Device 19db (rev 11)' - bus: '00' dev: 1f fn: '0' id: 19dc - name: 'ISA bridge: Intel Corporation DNV LPC or eSPI (rev 11)' + name: 'ISA bridge: Intel Corporation Atom Processor C3000 Series LPC or eSPI (rev + 11)' - bus: '00' dev: 1f fn: '2' - id: 197e - name: 'Memory controller: Intel Corporation Device (rev 11)' + id: 19de + name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management + Controller (rev 11)' - bus: '00' - dev: '1f' + dev: 1f fn: '4' id: 19df - name: 'SMBus: Intel Corporation DNV SMBus controller (rev 11)' + name: 'SMBus: Intel Corporation Atom Processor C3000 Series SMBus controller (rev + 11)' - bus: '00' - dev: '1f' + dev: 1f fn: '5' id: 19e0 - name: 'Serial bus controller: Intel Corporation DNV SPI Controller (rev 11)' + name: 'Serial bus controller [0c80]: Intel Corporation Atom Processor C3000 Series + SPI Controller (rev 11)' - bus: '01' dev: '00' fn: '0' id: 19e2 - name: 'Co-processor: Intel Corporation Device (rev 11)' + name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology + (rev 11)' - bus: '02' dev: '00' fn: '0' - id: 0026 - name: 'Non-Volatile memory controller: Device (rev 03)' + id: '0026' + name: 'Non-Volatile memory controller: Device 1dd4:0026 (rev 03)' - bus: '03' dev: '00' fn: '0' @@ -128,25 +135,6 @@ - bus: '06' dev: '00' fn: '0' - id: 1533 - name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)' -- bus: '07' - dev: '00' - fn: '0' - id: 15c3 - name: 'Ethernet controller: Intel Corporation Device (rev 11)' -- bus: '07' - dev: '00' - fn: '1' - id: 15c3 - name: 'Ethernet controller: Intel Corporation Device (rev 11)' -- bus: '08' - dev: '00' - fn: '0' - id: 15c3 - name: 'Ethernet controller: Intel Corporation Device (rev 11)' -- bus: '08' - dev: '00' - fn: '1' - id: 15c3 - name: 'Ethernet controller: Intel Corporation Device (rev 11)' + id: '1533' + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/platform.json b/device/mellanox/x86_64-nvidia_sn2201-r0/platform.json index d98a191d0ad7..f600f26293ce 100644 --- a/device/mellanox/x86_64-nvidia_sn2201-r0/platform.json +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/platform.json @@ -17,17 +17,39 @@ "name": "CPLD2" } ], - "fans": [{ - "name": "fan1" + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + } + ] }, { - "name": "fan2" + "name": "drawer2", + "fans": [ + { + "name": "fan2" + } + ] }, { - "name": "fan3" + "name": "drawer3", + "fans": [ + { + "name": "fan3" + } + ] }, { - "name": "fan4" + "name": "drawer4", + "fans": [ + { + "name": "fan4" + } + ] } ], "psus": [ @@ -65,6 +87,12 @@ { "name": "Ambient Fan Side Temp" }, + { + "name": "Ambient CPU Board Temp" + }, + { + "name": "Ambient Switch Board Temp" + }, { "name": "CPU Pack Temp" }, @@ -109,56 +137,56 @@ "index": "1", "lanes": "0", "breakout_modes": { - "1x1G[100]": ["etp1"] + "1x1000[100,10]": ["etp1"] } }, "Ethernet1": { "index": "2", "lanes": "4", "breakout_modes": { - "1x1G[100]": ["etp2"] + "1x1000[100,10]": ["etp2"] } }, "Ethernet2": { "index": "3", "lanes": "8", "breakout_modes": { - "1x1G[100]": ["etp3"] + "1x1000[100,10]": ["etp3"] } }, "Ethernet3": { "index": "4", "lanes": "12", "breakout_modes": { - "1x1G[100]": ["etp4"] + "1x1000[100,10]": ["etp4"] } }, "Ethernet4": { "index": "5", "lanes": "16", "breakout_modes": { - "1x1G[100]": ["etp5"] + "1x1000[100,10]": ["etp5"] } }, "Ethernet5": { "index": "6", "lanes": "20", "breakout_modes": { - "1x1G[100]": ["etp6"] + "1x1000[100,10]": ["etp6"] } }, "Ethernet6": { "index": "7", "lanes": "24", "breakout_modes": { - "1x1G[100]": ["etp7"] + "1x1000[100,10]": ["etp7"] } }, "Ethernet7": { "index": "8", "lanes": "28", "breakout_modes": { - "1x1G[100]": ["etp8"] + "1x1000[100,10]": ["etp8"] } }, @@ -166,56 +194,56 @@ "index": "9", "lanes": "32", "breakout_modes": { - "1x1G[100]": ["etp9"] + "1x1000[100,10]": ["etp9"] } }, "Ethernet9": { "index": "10", "lanes": "36", "breakout_modes": { - "1x1G[100]": ["etp10"] + "1x1000[100,10]": ["etp10"] } }, "Ethernet10": { "index": "11", "lanes": "40", "breakout_modes": { - "1x1G[100]": ["etp11"] + "1x1000[100,10]": ["etp11"] } }, "Ethernet11": { "index": "12", "lanes": "44", "breakout_modes": { - "1x1G[100]": ["etp12"] + "1x1000[100,10]": ["etp12"] } }, "Ethernet12": { "index": "13", "lanes": "48", "breakout_modes": { - "1x1G[100]": ["etp13"] + "1x1000[100,10]": ["etp13"] } }, "Ethernet13": { "index": "14", "lanes": "52", "breakout_modes": { - "1x1G[100]": ["etp14"] + "1x1000[100,10]": ["etp14"] } }, "Ethernet14": { "index": "15", "lanes": "56", "breakout_modes": { - "1x1G[100]": ["etp15"] + "1x1000[100,10]": ["etp15"] } }, "Ethernet15": { "index": "16", "lanes": "60", "breakout_modes": { - "1x1G[100]": ["etp16"] + "1x1000[100,10]": ["etp16"] } }, @@ -223,224 +251,224 @@ "index": "17", "lanes": "64", "breakout_modes": { - "1x1G[100]": ["etp17"] + "1x1000[100,10]": ["etp17"] } }, "Ethernet17": { "index": "18", "lanes": "68", "breakout_modes": { - "1x1G[100]": ["etp18"] + "1x1000[100,10]": ["etp18"] } }, "Ethernet18": { "index": "19", "lanes": "72", "breakout_modes": { - "1x1G[100]": ["etp19"] + "1x1000[100,10]": ["etp19"] } }, "Ethernet19": { "index": "20", "lanes": "76", "breakout_modes": { - "1x1G[100]": ["etp20"] + "1x1000[100,10]": ["etp20"] } }, "Ethernet20": { "index": "21", "lanes": "80", "breakout_modes": { - "1x1G[100]": ["etp21"] + "1x1000[100,10]": ["etp21"] } }, "Ethernet21": { "index": "22", "lanes": "84", "breakout_modes": { - "1x1G[100]": ["etp22"] + "1x1000[100,10]": ["etp22"] } }, "Ethernet22": { "index": "23", "lanes": "88", "breakout_modes": { - "1x1G[100]": ["etp23"] + "1x1000[100,10]": ["etp23"] } }, "Ethernet23": { "index": "24", "lanes": "92", "breakout_modes": { - "1x1G[100]": ["etp24"] + "1x1000[100,10]": ["etp24"] } }, "Ethernet24": { "index": "25", "lanes": "96", "breakout_modes": { - "1x1G[100]": ["etp25"] + "1x1000[100,10]": ["etp25"] } }, "Ethernet25": { "index": "26", "lanes": "100", "breakout_modes": { - "1x1G[100]": ["etp26"] + "1x1000[100,10]": ["etp26"] } }, "Ethernet26": { "index": "27", "lanes": "104", "breakout_modes": { - "1x1G[100]": ["etp27"] + "1x1000[100,10]": ["etp27"] } }, "Ethernet27": { "index": "28", "lanes": "108", "breakout_modes": { - "1x1G[100]": ["etp28"] + "1x1000[100,10]": ["etp28"] } }, "Ethernet28": { "index": "29", "lanes": "112", "breakout_modes": { - "1x1G[100]": ["etp29"] + "1x1000[100,10]": ["etp29"] } }, "Ethernet29": { "index": "30", "lanes": "116", "breakout_modes": { - "1x1G[100]": ["etp30"] + "1x1000[100,10]": ["etp30"] } }, "Ethernet30": { "index": "31", "lanes": "120", "breakout_modes": { - "1x1G[100]": ["etp31"] + "1x1000[100,10]": ["etp31"] } }, "Ethernet31": { "index": "32", "lanes": "124", "breakout_modes": { - "1x1G[100]": ["etp32"] + "1x1000[100,10]": ["etp32"] } }, "Ethernet32": { "index": "33", "lanes": "128", "breakout_modes": { - "1x1G[100]": ["etp33"] + "1x1000[100,10]": ["etp33"] } }, "Ethernet33": { "index": "34", "lanes": "132", "breakout_modes": { - "1x1G[100]": ["etp34"] + "1x1000[100,10]": ["etp34"] } }, "Ethernet34": { "index": "35", "lanes": "136", "breakout_modes": { - "1x1G[100]": ["etp35"] + "1x1000[100,10]": ["etp35"] } }, "Ethernet35": { "index": "36", "lanes": "140", "breakout_modes": { - "1x1G[100]": ["etp36"] + "1x1000[100,10]": ["etp36"] } }, "Ethernet36": { "index": "37", "lanes": "144", "breakout_modes": { - "1x1G[100]": ["etp37"] + "1x1000[100,10]": ["etp37"] } }, "Ethernet37": { "index": "38", "lanes": "148", "breakout_modes": { - "1x1G[100]": ["etp38"] + "1x1000[100,10]": ["etp38"] } }, "Ethernet38": { "index": "39", "lanes": "152", "breakout_modes": { - "1x1G[100]": ["etp39"] + "1x1000[100,10]": ["etp39"] } }, "Ethernet39": { "index": "40", "lanes": "156", "breakout_modes": { - "1x1G[100]": ["etp40"] + "1x1000[100,10]": ["etp40"] } }, "Ethernet40": { "index": "41", "lanes": "160", "breakout_modes": { - "1x1G[100]": ["etp41"] + "1x1000[100,10]": ["etp41"] } }, "Ethernet41": { "index": "42", "lanes": "164", "breakout_modes": { - "1x1G[100]": ["etp42"] + "1x1000[100,10]": ["etp42"] } }, "Ethernet42": { "index": "43", "lanes": "168", "breakout_modes": { - "1x1G[100]": ["etp43"] + "1x1000[100,10]": ["etp43"] } }, "Ethernet43": { "index": "44", "lanes": "172", "breakout_modes": { - "1x1G[100]": ["etp44"] + "1x1000[100,10]": ["etp44"] } }, "Ethernet44": { "index": "45", "lanes": "176", "breakout_modes": { - "1x1G[100]": ["etp45"] + "1x1000[100,10]": ["etp45"] } }, "Ethernet45": { "index": "46", "lanes": "180", "breakout_modes": { - "1x1G[100]": ["etp46"] + "1x1000[100,10]": ["etp46"] } }, "Ethernet46": { "index": "47", "lanes": "184", "breakout_modes": { - "1x1G[100]": ["etp47"] + "1x1000[100,10]": ["etp47"] } }, "Ethernet47": { "index": "48", "lanes": "188", "breakout_modes": { - "1x1G[100]": ["etp48"] + "1x1000[100,10]": ["etp48"] } }, "Ethernet48": { diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json new file mode 100644 index 000000000000..e28c19087875 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json @@ -0,0 +1,12 @@ +{ + "chassis": { + "SN2201": { + "component": { + "ONIE": { }, + "SSD": { }, + "CPLD1": { }, + "CPLD2": { } + } + } + } +} diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf b/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf index 176502c4731a..1c29cfd2d7b3 100644 --- a/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf @@ -6,7 +6,11 @@ # Fan Controller emc2305. bus "i2c-7" "i2c-1-mux (chan_id 5)" - chip "emc2305-i2c-7-4d" + chip "emc2305-i2c-7-4d" + label fan1 "Chassis Fan Drawer-1" + label fan2 "Chassis Fan Drawer-2" + label fan3 "Chassis Fan Drawer-3" + label fan4 "Chassis Fan Drawer-4" ignore fan5 # Temperature sensors @@ -14,6 +18,59 @@ chip "coretemp-isa-0000" label temp8 "Core 0" label temp14 "Core 1" +bus "i2c-2" "i2c-1-mux (chan_id 4)" + chip "mlxsw-i2c-*-48" + label temp1 "Ambient ASIC Temp" + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore temp7 + ignore temp8 + ignore temp9 + ignore temp10 + ignore temp11 + ignore temp12 + ignore temp13 + ignore temp14 + ignore temp15 + ignore temp16 + ignore temp17 + ignore temp18 + ignore temp19 + ignore temp20 + ignore temp21 + ignore temp22 + ignore temp23 + ignore temp24 + ignore temp25 + ignore temp26 + ignore temp26 + ignore temp27 + ignore temp28 + ignore temp29 + ignore temp30 + ignore temp31 + ignore temp32 + ignore temp33 + ignore temp34 + ignore temp35 + ignore temp36 + ignore temp37 + ignore temp38 + ignore temp39 + ignore temp40 + ignore temp41 + ignore temp42 + ignore temp43 + ignore temp44 + ignore temp45 + ignore temp46 + ignore temp47 + ignore temp48 + ignore temp49 + bus "i2c-2" "i2c-1-mux (chan_id 0)" chip "lm75-i2c-*-4a" label temp1 "Ambient Switch Board Temp" @@ -33,15 +90,71 @@ bus "i2c-8" "i2c-1-mux (chan_id 6)" # Power controllers bus "i2c-9" "i2c-1-mux (chan_id 7)" chip "pmbus-i2c-*-40" - ignore curr3 - ignore in3 - ignore power3 + label curr1 "VR IC PSU 12V Rail Curr(in)" + label curr2 "ASIC 0.9V VCORE Rail Curr(out)" + label in1 "VR IC PSU 12V Rail" + label in2 "VR IC ASIC 0.9V VCORE Rail" + label power1 "VR IC PSU 12V Rail Pwr(in)" + label power2 "ASIC 0.9V VCORE Rail Pwr(out)" + ignore curr3 + ignore in3 + ignore power3 + label temp1 "VR IC Temp1" bus "i2c-2" "i2c-1-mux (chan_id 0)" chip "ads1015-i2c-*-49" - ignore in1 - ignore in2 - ignore in4 - ignore in5 - ignore in6 - ignore in7 + label in0 "ASIC 1.8V Rail" + label in3 "MONITOR MB 12V" + compute in3 (7.2)*@, @/(7.2) + ignore in1 + ignore in2 + ignore in4 + ignore in5 + ignore in6 + ignore in7 + +bus "i2c-8" "i2c-1-mux (chan_id 6)" + chip "powr1014-i2c-8-37" + label in0 "MONITOR CPU Board V3P3" + label in1 "MONITOR CPU Board VR_VCC_1V15" + label in2 "MONITOR CPU Board VR_VNN_1V05" + label in3 "MONITOR CPU Board VR_VCCRAM_1V15" + label in4 "MONITOR CPU Board VR_VDDQ_1V20" + label in5 "MONITOR CPU Board V1P05" + label in6 "MONITOR CPU Board P2V5_VPP" + label in7 "MONITOR CPU Board P0V6_VTT_DIMM" + label in8 "MONITOR CPU Board V1P8" + label in9 "MONITOR CPU Board V1P24" + +# PSU PMBus sensors +bus "i2c-3" "i2c-1-mux (chan_id 1)" + chip "pmbus-i2c-3-58" + label in1 "PSU-1 220V Rail(in)" + label in2 "PSU-1 12V Rail(out)" + ignore in3 + label fan1 "PSU-1 Fan1" + label temp1 "PSU-1 Temp1" + label temp2 "PSU-1 Temp2" + label temp3 "PSU-1 Temp3" + label curr1 "PSU-1 220V Rail Curr(in)" + label curr2 "PSU-1 12V Rail Curr(out)" + ignore curr3 + label power1 "PSU-1 220V Rail Pwr(in)" + label power2 "PSU-1 12V Rail Pwr(out)" + ignore power3 + +bus "i2c-4" "i2c-1-mux (chan_id 2)" + chip "pmbus-i2c-4-58" + label in1 "PSU-2 220V Rail(in)" + label in2 "PSU-2 12V Rail(out)" + ignore in3 + label fan1 "PSU-2 Fan1" + label temp1 "PSU-2 Temp1" + label temp2 "PSU-2 Temp2" + label temp3 "PSU-2 Temp3" + label curr1 "PSU-2 220V Rail Curr(in)" + label curr2 "PSU-2 12V Rail Curr(out)" + ignore curr3 + label power1 "PSU-2 220V Rail Pwr(in)" + label power2 "PSU-2 12V Rail Pwr(out)" + ignore power3 From fb7f046143bfe0356237352a412ac6cb52a4e341 Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Sat, 19 Mar 2022 08:27:02 +0800 Subject: [PATCH 49/54] [yang] Update YANG model for mirror session to support decimal value for GRE type (#10140) #### Why I did it PR https://github.com/Azure/sonic-utilities/pull/1825 added validation for the input of `config mirror session add`, and only decimal value is accepted. An issue https://github.com/Azure/sonic-buildimage/issues/10096 was raised to suggest accepting HEX value as well, and the suggestion makes sense to me. To accept HEX value for GRE type, and keep backward compatibility as well, I updated the YANG model to support both decimal and hexadecimal input for GRE type. #### How I did it Update the regex for GRE type. #### How to verify it Verified by UT ``` platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0 rootdir: /sonic/src/sonic-yang-models plugins: pyfakefs-4.5.4, cov-2.10.1 collected 3 items tests/test_sonic_yang_models.py .. [ 66%] tests/yang_model_tests/test_yang_model.py . [100%] ========================================================================================== 3 passed in 2.53s ========================================================================================== ``` #### Description for the changelog Update YANG model for mirror session to support decimal value for GRE type. --- .../tests/mirror_session.json | 24 ++++- .../tests_config/mirror_session.json | 100 +++++++++++++++++- .../yang-models/sonic-mirror-session.yang | 2 +- 3 files changed, 121 insertions(+), 5 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json b/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json index 6d53b0e9cffb..c54ca3d9595a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json @@ -1,6 +1,18 @@ { - "MIRROR_ERSPAN_ENTRY_WITH_VALID_VALUES": { - "desc": "Configuring ERSPAN entry with valid values." + "MIRROR_ERSPAN_ENTRY_WITH_VALID_HEX_VALUES": { + "desc": "Configuring ERSPAN entry with valid heximal values." + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_HEX_VALUES_1": { + "desc": "Configuring ERSPAN entry with valid heximal values." + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES": { + "desc": "Configuring ERSPAN entry with valid decimal values." + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_1": { + "desc": "Configuring ERSPAN entry with valid decimal values." + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_2": { + "desc": "Configuring ERSPAN entry with valid decimal values." }, "MIRROR_ERSPAN_ENTRY_WRONG_TYPE": { "desc": "Configuring ERSPAN entry with invalid type", @@ -26,6 +38,14 @@ "desc": "Configuring ERSPAN entry with invalid GRE type", "eStrKey" : "Pattern" }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE_1": { + "desc": "Configuring ERSPAN entry with invalid GRE type", + "eStrKey" : "Pattern" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE_2": { + "desc": "Configuring ERSPAN entry with invalid GRE type", + "eStrKey" : "Pattern" + }, "MIRROR_ERSPAN_ENTRY_GRE_WRONG_TYPE": { "desc": "Configuring ERSPAN entry with invalid GRE type", "eStrKey" : "When" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json index ddf956c79f83..5e820b5f5fdf 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json @@ -1,5 +1,5 @@ { - "MIRROR_ERSPAN_ENTRY_WITH_VALID_VALUES": { + "MIRROR_ERSPAN_ENTRY_WITH_VALID_HEX_VALUES": { "sonic-mirror-session:sonic-mirror-session": { "MIRROR_SESSION": { "MIRROR_SESSION_LIST": [ @@ -15,6 +15,70 @@ } } }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_HEX_VALUES_1": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x0", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_1": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "65535", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_2": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0", + "dscp": "10" + } + ] + } + } + }, "MIRROR_ERSPAN_ENTRY_WRONG_TYPE": { "sonic-mirror-session:sonic-mirror-session": { "MIRROR_SESSION": { @@ -104,7 +168,39 @@ "type": "ERSPAN", "dst_ip": "11.1.1.1", "src_ip": "10.1.1.1", - "gre_type": "0", + "gre_type": "100000", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE_1": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "-1", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE_2": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "65536", "dscp": "10" } ] diff --git a/src/sonic-yang-models/yang-models/sonic-mirror-session.yang b/src/sonic-yang-models/yang-models/sonic-mirror-session.yang index ba8a1e13c7d6..9ea1954d7a37 100644 --- a/src/sonic-yang-models/yang-models/sonic-mirror-session.yang +++ b/src/sonic-yang-models/yang-models/sonic-mirror-session.yang @@ -99,7 +99,7 @@ module sonic-mirror-session { leaf gre_type { when "current()/../type = 'ERSPAN'"; type string { - pattern "0[xX][0-9a-fA-F]*"; + pattern "0[xX][0-9a-fA-F]*|([0-9]|[1-5]?[0-9]{2,4}|6[1-4][0-9]{3}|65[1-4][0-9]{2}|655[1-2][0-9]|6553[0-5])"; length 1..6 { error-message "Invalid GRE type"; error-app-tag gre-type-invalid; From ed4f19fb28142a2221c9c5c27aede3ecdb9b83c8 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Sat, 19 Mar 2022 21:48:27 +0800 Subject: [PATCH 50/54] [Build][Bug]: fix the warning message not printed as expected issue (#10278) Fix the warning message not printed as expected issue --- src/sonic-build-hooks/hooks/apt-get | 4 ++-- src/sonic-build-hooks/scripts/buildinfo_base.sh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sonic-build-hooks/hooks/apt-get b/src/sonic-build-hooks/hooks/apt-get index f1f789542b7a..625b06843610 100755 --- a/src/sonic-build-hooks/hooks/apt-get +++ b/src/sonic-build-hooks/hooks/apt-get @@ -10,10 +10,10 @@ if [ -z "$REAL_COMMAND" ]; then exit 1 fi -INSTALL=$(check_apt_install) +INSTALL=$(check_apt_install "$@") COMMAND_INFO="Locked by command: $REAL_COMMAND $@" if [ "$INSTALL" == y ]; then - check_apt_version + check_apt_version "$@" lock_result=$(acquire_apt_installation_lock "$COMMAND_INFO" ) $REAL_COMMAND "$@" command_result=$? diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index 22ab3da4e9ae..3873d1362926 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -213,6 +213,10 @@ check_apt_version() continue fi + if [ "$para" == "install" ]; then + continue + fi + if [[ "$para" == *=* ]]; then continue else From dc04d64219cc1d207fc32eb3bf23841d358deb99 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Sun, 20 Mar 2022 16:34:04 +0800 Subject: [PATCH 51/54] [Mellanox] Fix issue: psu might use wrong voltage sysfs which causes invalid voltage value (#10231) - Why I did it Fix issue: psu might use wrong voltage sysfs which causes invalid voltage value. The flow is like: 1. User power off a PSU 2. All sysfs files related to this PSU are removed 3. User did a reboot/config reload 4. PSU will use wrong sysfs as voltage node - How I did it Always try find an existing sysfs. - How to verify it Manual test --- .../mlnx-platform-api/sonic_platform/psu.py | 57 +++++++++++++++---- .../mlnx-platform-api/tests/test_psu.py | 6 ++ 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 160fd8bd7469..64aa0166086f 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -200,16 +200,10 @@ class Psu(FixedPsu): def __init__(self, psu_index): super(Psu, self).__init__(psu_index) - psu_voltage_out2 = os.path.join(PSU_PATH, "power/psu{}_volt_out2".format(self.index)) - psu_voltage = os.path.join(PSU_PATH, "power/psu{}_volt".format(self.index)) - # Workaround for psu voltage sysfs file as the file name differs among platforms - if os.path.exists(psu_voltage_out2): - self.psu_voltage = psu_voltage_out2 - else: - self.psu_voltage = psu_voltage - self.psu_voltage_min = self.psu_voltage + "_min" - self.psu_voltage_max = self.psu_voltage + "_max" - self.psu_voltage_capability = self.psu_voltage + "_capability" + self._psu_voltage = None + self._psu_voltage_min = None + self._psu_voltage_max = None + self._psu_voltage_capability = None self.psu_current = os.path.join(PSU_PATH, self.PSU_CURRENT.format(self.index)) self.psu_power = os.path.join(PSU_PATH, self.PSU_POWER.format(self.index)) @@ -228,6 +222,47 @@ def __init__(self, psu_index): from .thermal import initialize_psu_thermal self._thermal_list = initialize_psu_thermal(psu_index, self.get_power_available_status) + @property + def psu_voltage(self): + if not self._psu_voltage: + psu_voltage_out = os.path.join(PSU_PATH, "power/psu{}_volt_out2".format(self.index)) + if os.path.exists(psu_voltage_out): + self._psu_voltage = psu_voltage_out + else: + psu_voltage_out = os.path.join(PSU_PATH, "power/psu{}_volt".format(self.index)) + if os.path.exists(psu_voltage_out): + self._psu_voltage = psu_voltage_out + + return self._psu_voltage + + @property + def psu_voltage_min(self): + if not self._psu_voltage_min: + psu_voltage = self.psu_voltage + if psu_voltage: + self._psu_voltage_min = psu_voltage + "_min" + + return self._psu_voltage_min + + @property + def psu_voltage_max(self): + if not self._psu_voltage_max: + psu_voltage = self.psu_voltage + if psu_voltage: + self._psu_voltage_max = psu_voltage + "_max" + + return self._psu_voltage_max + + @property + def psu_voltage_capability(self): + if not self._psu_voltage_capability: + psu_voltage = self.psu_voltage + if psu_voltage: + self._psu_voltage_capability = psu_voltage + "_capability" + + return self._psu_voltage_capability + + def get_model(self): """ Retrieves the model number (or part number) of the device @@ -272,7 +307,7 @@ def get_voltage(self): A float number, the output voltage in volts, e.g. 12.1 """ - if self.get_powergood_status(): + if self.get_powergood_status() and self.psu_voltage: # TODO: should we put log_func=None here? If not do this, when a PSU is back to power, some PSU related # sysfs may not ready, read_int_from_file would encounter exception and log an error. voltage = utils.read_int_from_file(self.psu_voltage, log_func=logger.log_info) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_psu.py b/platform/mellanox/mlnx-platform-api/tests/test_psu.py index 6de042e7bd8b..34fa70c7beca 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_psu.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_psu.py @@ -50,6 +50,7 @@ def test_fixed_psu(self): assert psu.get_temperature() is None assert psu.get_temperature_high_threshold() is None + @mock.patch('os.path.exists', mock.MagicMock(return_value=True)) def test_psu(self): psu = Psu(0) assert len(psu._fan_list) == 1 @@ -58,6 +59,8 @@ def test_psu(self): psu.psu_presence: 1, psu.psu_oper_status: 1, psu.psu_voltage: 10234, + psu.psu_voltage_min: 9000, + psu.psu_voltage_max: 12000, psu.psu_current: 20345, psu.psu_power: 30456, psu.psu_temp: 40567, @@ -68,6 +71,7 @@ def mock_read_int_from_file(file_path, **kwargs): return mock_sysfs_content[file_path] utils.read_int_from_file = mock_read_int_from_file + utils.read_str_from_file = mock.MagicMock(return_value='min max') assert psu.get_presence() is True mock_sysfs_content[psu.psu_presence] = 0 assert psu.get_presence() is False @@ -84,6 +88,8 @@ def mock_read_int_from_file(file_path, **kwargs): mock_sysfs_content[psu.psu_oper_status] = 1 assert psu.get_voltage() == 10.234 + assert psu.get_voltage_high_threshold() == 12.0 + assert psu.get_voltage_low_threshold() == 9.0 assert psu.get_current() == 20.345 assert psu.get_power() == 0.030456 assert psu.get_temperature() == 40.567 From 4659f8b8e807aa80defd6c521b2b9a62a1d8b3d8 Mon Sep 17 00:00:00 2001 From: liuh-80 <58683130+liuh-80@users.noreply.github.com> Date: Mon, 21 Mar 2022 08:33:12 +0800 Subject: [PATCH 52/54] [Submodule] Update src/sonic-utilities (#10272) Updating sonic-utilities sub module with the following commits b00b870 [build] stop vstest in the Azure pipeline 2c56e92 [GCU] Marking fields under BGP_PEER_RANGE, BGP_MONITORS as create-only 6289987 Fix sonic-installer failure due to missing import 45e6ac1 [show] add support for hwstatus in show muxcable status 93384ed Try get port operational speed from STATE DB 483fc6e [techsupport] Added a lock to avoid running techsupport in parallel 398da58 Validation check correction while adding a member to PortChannel a8a7edb [generate_dump] exclude mft and mlx folders from /etc 1cf1d03 Fix UT failed cause by change pycommon to use swsscommon --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 47c243eb7e9c..a2e68a05a8e6 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 47c243eb7e9cbe6ebd3479290a98183071cf2124 +Subproject commit a2e68a05a8e6ab296978a59bf107971beb899546 From 49ac9f9005cafbea419819598fbc4b0768464344 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Mon, 21 Mar 2022 10:27:24 +0800 Subject: [PATCH 53/54] [Build]: Support to set jobFilters (#10280) [Build]: Support to set jobFilters --- .../azure-pipelines-UpgrateVersion.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml index 5cd85ab5520b..0c7f7f966297 100644 --- a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml +++ b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml @@ -20,6 +20,20 @@ schedules: pool: sonicbld +parameters: +- name: 'jobFilters' + type: object + default: + - vs + - barefoot + - broadcom + - centec + - centec-arm64 + - generic + - innovium + - marvell-armhf + - mellanox + stages: - stage: Build variables: @@ -28,6 +42,7 @@ stages: jobs: - template: azure-pipelines-build.yml parameters: + jobFilters: ${{ parameters.jobFilters }} buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y' preSteps: - script: | From 87af5659c55bd1774aeb1d117a8a8f5336ed14a9 Mon Sep 17 00:00:00 2001 From: liuh-80 <58683130+liuh-80@users.noreply.github.com> Date: Mon, 21 Mar 2022 13:04:22 +0800 Subject: [PATCH 54/54] Update submodule sonic-snmpagent (#10277) Updating sonic-snmpagent submodule with the following commits dae8146 [ci]: Support code diff coverage 6bd51c4 Fix: LAG counters, if LAG don't have L3 interface 2654f4a Fix snmp agent Initialize config DB multiple times issue #### Why I did it When change pycommon to use swsscommon UT failed in sonic-snmpagent, need submodule update with UT issue fix. #### How I did it #### How to verify it #### Which release branch to backport (provide reason below if selected) #### Description for the changelog [ci]: Support code diff coverage Fix: LAG counters, if LAG don't have L3 interface Fix snmp agent Initialize config DB multiple times issue #### A picture of a cute animal (not mandatory but encouraged) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 4ee573cddc4e..2654f4a66794 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 4ee573cddc4e356b589bcf29c19cedc4562a8b34 +Subproject commit 2654f4a667941296d4e56a16e8e1a7d1d5fca7b6