From f6fb72b7b69283a205c5e4ab32569cf71ca1321f Mon Sep 17 00:00:00 2001 From: Santhosh Kumar T <53558409+santhosh-kt@users.noreply.github.com> Date: Wed, 10 Mar 2021 05:19:24 +0530 Subject: [PATCH 001/169] [Dell] S6100 S6000 - Show techsupport enhancement (#6410) - Why I did it To collect platform based logs along with "show techsupport" on S6000 and S6100 plaforms. - How I did it On branch dell_techsupport_dump Changes to be committed: (use "git reset HEAD ..." to unstage) new file: platform/broadcom/sonic-platform-modules-dell/common/actions.sh modified: platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install modified: platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install new file: platform/broadcom/sonic-platform-modules-dell/s6000/scripts/hw-management-generate-dump.sh new file: platform/broadcom/sonic-platform-modules-dell/s6100/scripts/hw-management-generate-dump.sh - How to verify it hw-mgmt-dump.tar.gz will be found in sonic_dump__< YYYYMMDD_HHMMSS>.tar.gz. --- .../common/actions.sh | 21 ++++++ .../debian/platform-modules-s6000.install | 2 + .../debian/platform-modules-s6100.install | 2 + .../scripts/hw-management-generate-dump.sh | 38 +++++++++++ .../scripts/hw-management-generate-dump.sh | 66 +++++++++++++++++++ 5 files changed, 129 insertions(+) create mode 100755 platform/broadcom/sonic-platform-modules-dell/common/actions.sh create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6000/scripts/hw-management-generate-dump.sh create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/hw-management-generate-dump.sh diff --git a/platform/broadcom/sonic-platform-modules-dell/common/actions.sh b/platform/broadcom/sonic-platform-modules-dell/common/actions.sh new file mode 100755 index 00000000000..ba353f8b021 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/common/actions.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +platform="$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)" +TMP_DIR="/tmp/hw-mgmt-dump" +rm -rf $TMP_DIR +mkdir $TMP_DIR + +save_cmd(){ + TOUT=$1 + CMD=$2 + CMD_NAME=$3 + + echo "##### $CMD_NAME #####">> $TMP_DIR/hw-mgmt-dump.txt + eval timeout $TOUT $CMD >> $TMP_DIR/hw-mgmt-dump.txt +} + +tar_file(){ + tar czf /tmp/hw-mgmt-dump.tar.gz -C $TMP_DIR . + rm -rf $TMP_DIR +} + diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install index e67a5948513..2311ea0b578 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install @@ -2,9 +2,11 @@ s6000/scripts/s6000_platform.sh usr/local/bin s6000/scripts/reset-qsfp usr/local/bin s6000/scripts/set-fan-speed usr/local/bin s6000/scripts/fancontrol.sh usr/local/bin +s6000/scripts/hw-management-generate-dump.sh usr/bin s6000/systemd/platform-modules-s6000.service etc/systemd/system s6000/systemd/fancontrol.service etc/systemd/system common/io_rd_wr.py usr/local/bin +common/actions.sh usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 s6000/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 s6000/scripts/platform_update_reboot_cause usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 s6000/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index a9eb63eeea4..4299aa60c71 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -13,7 +13,9 @@ s6100/scripts/warm-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538- s6100/scripts/ssd-fw-upgrade usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d common/dell_lpc_mon.sh usr/local/bin +common/actions.sh usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/platform_sensors.py usr/local/bin +s6100/scripts/hw-management-generate-dump.sh usr/bin s6100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/platform_watchdog_enable.sh usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/hw-management-generate-dump.sh b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/hw-management-generate-dump.sh new file mode 100755 index 00000000000..25e907a0a09 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/hw-management-generate-dump.sh @@ -0,0 +1,38 @@ +#!/bin/bash +platform="$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)" +source /usr/share/sonic/device/$platform/actions.sh + +I2C_ADAPTER="/sys/class/i2c-adapter" + +save_cmd "10" "hexdump -C /dev/nvram" "NVRAM dump" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-10/10-0053/eeprom" "System EEPROM" +save_cmd "10" "grep -H '' /sys/devices/platform/dell-s6000-cpld.0/*" "CPLD" + +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-0029/*" "FAN" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-0029/hwmon/hwmon*/*" "FAN" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-002a/*" "FAN" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-002a/hwmon/hwmon*/*" "FAN" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-0042/hwmon/hwmon*/*" "PSU" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-0040/hwmon/hwmon*/*" "PSU" + +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-004c/*" "TMP75" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-004c/hwmon/hwmon*/*" "TMP75" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-004d/*" "TMP75" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-004d/hwmon/hwmon*/*" "TMP75" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-004e/*" "TMP75" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-11/11-004e/hwmon/hwmon*/*" "TMP75" + +INDEX=20 +while [ $INDEX -lt 52 ]; do + save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-$INDEX/$INDEX-0050/eeprom" "SFP ports" + save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-$INDEX/$INDEX-0050/name $I2C_ADAPTER/i2c-$INDEX/$INDEX-0050/modalias" "SFP ports" + let INDEX=$INDEX+1 +done + +save_cmd "10" "smartctl -a /dev/sda" "SSD" +save_cmd "10" "sgdisk -p /dev/sda" "SSD Partitions" + +save_cmd "10" "cat /host/reboot-cause/reboot-cause.txt" "Reboot Reason" +save_cmd "10" "show reboot-cause" "Reboot cause" + +tar_file diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/hw-management-generate-dump.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/hw-management-generate-dump.sh new file mode 100755 index 00000000000..a49638e2b64 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/hw-management-generate-dump.sh @@ -0,0 +1,66 @@ +#!/bin/bash +platform="$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)" +source /usr/share/sonic/device/$platform/actions.sh + +I2C_ADAPTER="/sys/class/i2c-adapter" + +save_cmd "10" "hexdump -C /dev/port" "SMF dump" +save_cmd "10" "hexdump -C /dev/nvram" "NVRAM dump" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-2/2-0050/eeprom" "System EEPROM" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-14/14-0050/eeprom" "IOM 1 EEPROM" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-16/16-0050/eeprom" "IOM 2 EEPROM" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-15/15-0050/eeprom" "IOM 3 EEPROM" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-17/17-0050/eeprom" "IOM 4 EEPROM" + +save_cmd "10" "pcisysfs.py --get --offset 0x108 --res /sys/devices/pci0000\:00/0000\:00\:13.0/resource0 " "ISMT MCTRL" +save_cmd "10" "pcisysfs.py --get --offset 0x10c --res /sys/devices/pci0000\:00/0000\:00\:13.0/resource0 " "ISMT MSTS" +save_cmd "10" "pcisysfs.py --get --offset 0x38c --res /sys/devices/pci0000\:00/0000\:00\:13.0/resource0 " "ISMT DBSTS" +save_cmd "10" "pcisysfs.py --get --offset 0x300 --res /sys/devices/pci0000\:00/0000\:00\:13.0/resource0 " "ISMT SPGT" + +IOM_INDEX=66 +CURRENT_IOM=1 +while [ $CURRENT_IOM -lt 5 ]; do + let CHANNEL=$CURRENT_IOM+3 + let I2C_SWITCH=$CURRENT_IOM+5 + let PORT_INDEX=$IOM_INDEX + SECOND_CHANNEL=0 + while [ $SECOND_CHANNEL -lt 8 ]; do + save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-0/0-0070/channel-$CHANNEL/$I2C_SWITCH-0071/channel-$SECOND_CHANNEL/$PORT_INDEX-0050/eeprom" "First 8 ports of IOM $CURRENT_IOM PORT $PORT_INDEX" + let PORT_INDEX=$PORT_INDEX+1 + let SECOND_CHANNEL=$SECOND_CHANNEL+1 + done + SECOND_CHANNEL=0 + while [ $SECOND_CHANNEL -lt 8 ]; do + save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-0/0-0070/channel-$CHANNEL/$I2C_SWITCH-0072/channel-$SECOND_CHANNEL/$PORT_INDEX-0050/eeprom" "Second 8 ports of IOM $CURRENT_IOM PORT $PORT_INDEX" + let PORT_INDEX=$PORT_INDEX+1 + let SECOND_CHANNEL=$SECOND_CHANNEL+1 + done + let IOM_INDEX=$IOM_INDEX-16 + let CURRENT_IOM=$CURRENT_IOM+1 +done + +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-0/0-0070/channel-2/4-0071/channel-4/14-003e/modalias" "IOM 1 CPLD MUX" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-0/0-0070/channel-2/4-0071/channel-6/16-003e/modalias" "IOM 2 CPLD MUX" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-0/0-0070/channel-2/4-0071/channel-5/15-003e/modalias" "IOM 3 CPLD MUX" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-0/0-0070/channel-2/4-0071/channel-7/17-003e/modalias" "IOM 4 CPLD MUX" + +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-0/0-0070/channel-2/4-0071/channel-1/11-0050/eeprom" "SFP ports" +save_cmd "10" "hexdump -C $I2C_ADAPTER/i2c-0/0-0070/channel-2/4-0071/channel-2/12-0050/eeprom" "SFP ports" + +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-14/14-003e/*" "IOM1" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-16/16-003e/*" "IOM2" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-15/15-003e/*" "IOM3" +save_cmd "10" "grep -H '' $I2C_ADAPTER/i2c-17/17-003e/*" "IOM4" + +save_cmd "30" "grep -H '' /sys/devices/platform/SMF.512/hwmon/hwmon*/*" "SMF DIR" +save_cmd "10" "i2cdetect -l" "I2C trees" + +save_cmd "10" "smartctl -a /dev/sda" "SSD" +save_cmd "10" "sgdisk -p /dev/sda" "SSD partitions" + +save_cmd "10" "cat /host/reboot-cause/platform/reset_reason" "Reset Reason" +save_cmd "10" "cat /host/reboot-cause/platform/reboot_reason" "Reboot Reason" +save_cmd "10" "cat /host/reboot-cause/platform/bios_minor_version" "BIOS Version" +save_cmd "10" "show reboot-cause" "Reboot cause" + +tar_file From 4e4f76c7cee91a95b6c120baa0a2bfd12d148e25 Mon Sep 17 00:00:00 2001 From: trzhang-msft Date: Tue, 9 Mar 2021 18:12:44 -0800 Subject: [PATCH 002/169] dhcp for dual tor: include all vlan intf into downstream intf (#6990) * include all vlan intf into downstream intf * add a comment --- src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch b/src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch index e918cc61910..0f7495f49e7 100644 --- a/src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch +++ b/src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch @@ -238,7 +238,7 @@ index e158efe..055d97f 100644 (flags & INTERFACE_UPSTREAM ? 'Y' : 'N'), (flags & INTERFACE_DOWNSTREAM ? 'Y' : 'N')); -+ if (flags & INTERFACE_DOWNSTREAM) { ++ if (flags & INTERFACE_DOWNSTREAM || flags & INTERFACE_UPSTREAM) { /* include all vlan intf in downstream_intf_list */ + ci = ((struct downstream_intf_list *)dmalloc(sizeof *ci, MDL)); + if (!ci) + log_fatal("no memory for downstream interface pointer.\n"); From 38d973b834e0c4fc205092c63802cfdf8cd095d5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 9 Mar 2021 18:15:16 -0800 Subject: [PATCH 003/169] [build]: Fix get-pip 2.7 url according to upstream announcement (#6999) ref: https://bootstrap.pypa.io/2.7/get-pip.py The URL you are using to fetch this script has changed, and this one will no longer work. Please use get-pip.py from the following URL instead: https://bootstrap.pypa.io/pip/2.7/get-pip.py --- dockers/docker-ptf/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 43eefcd9eef..eba818da9fc 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -78,7 +78,7 @@ RUN rm -rf /debs \ && apt-get -y autoclean \ && apt-get -y autoremove \ && rm -rf /var/lib/apt/lists/* \ - && wget --https-only https://bootstrap.pypa.io/2.7/get-pip.py \ + && wget --https-only https://bootstrap.pypa.io/pip/2.7/get-pip.py \ && python get-pip.py \ && rm -f get-pip.py \ && pip install setuptools \ From 41af024d14cbf76680c23d5ea4ce3d424099c66d Mon Sep 17 00:00:00 2001 From: Praveen Chaudhary Date: Tue, 9 Mar 2021 18:48:35 -0800 Subject: [PATCH 004/169] [sonic-yang-models]: Test to Validate yang models with SONiC config. (#6637) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: — Remove unnecessary file libyang-python-tests/sample_config_db.json — Keep only config in format of sonic_yang.json in yang_model_tests/yangTest.json. — Keep config in format of config_db.json in file tests/files/sample_config_db.json — Add a test case to validate yang models. **- Why I did it** As per discussion in sonic Yang workgroup, arranging files better so that Yang model can be in force for new config, also adding a test case to validate young models upto some extent. **- How I did it** Changes: — Remove unnecessary file libyang-python-tests/sample_config_db.json — Keep only config in format of sonic_yang.json in yang_model_tests/yangTest.json. — Keep config in format of config_db.json in file tests/files/sample_config_db.json — Add a test case to validate yang models. **- How to verify it** Build PKGs----Building----- --- src/sonic-yang-mgmt/sonic_yang_ext.py | 17 +- .../sample_config_db.json | 648 -------------- .../libyang-python-tests/test_sonic_yang.py | 46 +- .../tests/files/sample_config_db.json | 693 +++++++++++++++ .../tests/yang_model_tests/yangTest.json | 828 ++---------------- 5 files changed, 801 insertions(+), 1431 deletions(-) delete mode 100644 src/sonic-yang-mgmt/tests/libyang-python-tests/sample_config_db.json create mode 100644 src/sonic-yang-models/tests/files/sample_config_db.json diff --git a/src/sonic-yang-mgmt/sonic_yang_ext.py b/src/sonic-yang-mgmt/sonic_yang_ext.py index e85cdb42ff0..fbfcd6e0d13 100644 --- a/src/sonic-yang-mgmt/sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/sonic_yang_ext.py @@ -678,11 +678,16 @@ def _findXpathList(self, xpath, list, keys): """ load_data: load Config DB, crop, xlate and create data tree from it. (Public) input: data + debug Flag returns: True - success False - failed """ - def loadData(self, configdbJson): + def loadData(self, configdbJson, debug=False): try: + # write Translated config in file if debug enabled + xlateFile = None + if debug: + xlateFile = "xlateConfig.json" self.jIn = configdbJson # reset xlate and tablesWithOutYang self.xlateJson = dict() @@ -690,7 +695,7 @@ def loadData(self, configdbJson): # self.jIn will be cropped self._cropConfigDB() # xlated result will be in self.xlateJson - self._xlateConfigDB() + self._xlateConfigDB(xlateFile=xlateFile) #print(self.xlateJson) self.sysLog(msg="Try to load Data in the tree") self.root = self.ctx.parse_data_mem(dumps(self.xlateJson), \ @@ -706,14 +711,18 @@ def loadData(self, configdbJson): """ Get data from Data tree, data tree will be assigned in self.xlateJson. (Public) """ - def getData(self): + def getData(self, debug=False): try: + # write reverse Translated config in file if debug enabled + revXlateFile = None + if debug: + revXlateFile = "revXlateConfig.json" self.xlateJson = loads(self._print_data_mem('JSON')) # reset reverse xlate self.revXlateJson = dict() # result will be stored self.revXlateJson - self._revXlateConfigDB() + self._revXlateConfigDB(revXlateFile=revXlateFile) except Exception as e: print("Get Data Tree Failed") diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample_config_db.json b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample_config_db.json deleted file mode 100644 index a37639fb4b7..00000000000 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample_config_db.json +++ /dev/null @@ -1,648 +0,0 @@ -{ - "VLAN_INTERFACE": { - "Vlan111|2a04:5555:45:6709::1/64": { - "scope": "global", - "family": "IPv6" - }, - "Vlan111|10.222.10.65/26": { - "scope": "global", - "family": "IPv4" - }, - "Vlan111|fe80::1/10": { - "scope": "local", - "family": "IPv6" - }, - "Vlan777|2a04:5555:41:4e9::1/64": { - "scope": "global", - "family": "IPv6" - }, - "Vlan777|10.111.58.65/26": { - "scope": "global", - "family": "IPv4" - }, - "Vlan777|fe80::1/10": { - "scope": "local", - "family": "IPv6" - } - }, - "ACL_RULE": { - "V4-ACL-TABLE|DEFAULT_DENY": { - "PACKET_ACTION": "DROP", - "IP_TYPE": "IPv4ANY", - "PRIORITY": "0" - }, - "V4-ACL-TABLE|Rule_20": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.72.0/26", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777780", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_40": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.72.64/26", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777760", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_60": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.80.0/26", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777740", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_80": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.80.64/26", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777720", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_111": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.152.17.52/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777700", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_120": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.252.208.41/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777880", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_140": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.148.128.245/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777860", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_160": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.1.245/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777840", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_180": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.252.222.21/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777820", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_9000": { - "PACKET_ACTION": "DROP", - "DST_IP": "0.0.0.0/0", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "991110", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_11100": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "0.0.0.0/0", - "SRC_IP": "0.0.0.0/0", - "PRIORITY": "990000", - "IP_TYPE": "IPv4ANY" - }, - "V6-ACL-TBLE|DEFAULT_DENY": { - "PACKET_ACTION": "DROP", - "IP_TYPE": "IPv6ANY", - "PRIORITY": "0" - }, - "V6-ACL-TBLE|Rule_20": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777780", - "DST_IPV6": "2a04:5555:43:320::/64" - }, - "V6-ACL-TBLE|Rule_40": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777760", - "DST_IPV6": "2a04:5555:43:321::/64" - }, - "V6-ACL-TBLE|Rule_60": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777740", - "DST_IPV6": "2a04:5555:43:340::/64" - }, - "V6-ACL-TBLE|Rule_80": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777720", - "DST_IPV6": "2a04:5555:43:341::/64" - }, - "V6-ACL-TBLE|Rule_111": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777700", - "DST_IPV6": "2a04:5555:32:12::/64" - }, - "V6-ACL-TBLE|Rule_9000": { - "PACKET_ACTION": "DROP", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "991110", - "DST_IPV6": "::/0" - }, - "V6-ACL-TBLE|Rule_11100": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "::/0", - "PRIORITY": "990000", - "DST_IPV6": "::/0" - } - }, - "DEVICE_METADATA": { - "localhost": { - "mg_type": "ToR", - "mac": "00:11:22:33:dd:5a", - "hostname": "asw.dc", - "bgp_asn": "64850", - "hwsku": "Stone" - } - }, - "VLAN": { - "Vlan111": { - "description": "svlan", - "dhcp_servers": [ - "10.222.72.116" - ], - "vlanid": "111", - "mtu": "9216", - "admin_status": "up", - "members": [ - "Ethernet8", - "Ethernet3", - "Ethernet0", - "Ethernet1", - "Ethernet6", - "Ethernet4", - "Ethernet5", - "Ethernet9", - "Ethernet2", - "Ethernet7", - "Ethernet32", - "Ethernet30", - "Ethernet31", - "Ethernet36", - "Ethernet34", - "Ethernet33", - "Ethernet35", - "Ethernet29", - "Ethernet21", - "Ethernet20", - "Ethernet23", - "Ethernet22", - "Ethernet27", - "Ethernet26", - "Ethernet18", - "Ethernet19", - "Ethernet14", - "Ethernet15", - "Ethernet16", - "Ethernet17", - "Ethernet10", - "Ethernet11", - "Ethernet12", - "Ethernet13", - "Ethernet28" - ] - }, - "Vlan777": { - "description": "pvlan", - "dhcp_servers": [ - "10.222.72.116" - ], - "vlanid": "777", - "mtu": "9216", - "admin_status": "up", - "members": [ - "Ethernet9", - "Ethernet2", - "Ethernet8", - "Ethernet27", - "Ethernet14", - "Ethernet35" - ] - } - }, - "DEVICE_NEIGHBOR": { - "Ethernet112": { - "name": "dccsw01.nw", - "port": "Eth18" - }, - "Ethernet114": { - "name": "dccsw02.nw", - "port": "Eth18" - }, - "Ethernet116": { - "name": "dccsw03.nw", - "port": "Eth18" - }, - "Ethernet118": { - "name": "dccsw04.nw", - "port": "Eth18" - } - }, - "PORT": { - "Ethernet0": { - "alias": "Eth1/1", - "lanes": "65", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet1": { - "alias": "Eth1/2", - "lanes": "66", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet2": { - "alias": "Eth1/3", - "lanes": "67", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet3": { - "alias": "Eth1/4", - "lanes": "68", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet4": { - "alias": "Eth2/1", - "lanes": "69", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet5": { - "alias": "Eth2/2", - "lanes": "70", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet6": { - "alias": "Eth2/3", - "lanes": "71", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet7": { - "alias": "Eth2/4", - "lanes": "72", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet8": { - "alias": "Eth3/1", - "lanes": "73", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet9": { - "alias": "Eth3/2", - "lanes": "74", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet10": { - "alias": "Eth3/3", - "lanes": "75", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet11": { - "alias": "Eth3/4", - "lanes": "76", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet12": { - "alias": "Eth4/1", - "lanes": "77", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet13": { - "alias": "Eth4/2", - "lanes": "78", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet14": { - "alias": "Eth4/3", - "lanes": "79", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet15": { - "alias": "Eth4/4", - "lanes": "80", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet16": { - "alias": "Eth5/1", - "lanes": "33", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet17": { - "alias": "Eth5/2", - "lanes": "34", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet18": { - "alias": "Eth5/3", - "lanes": "35", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet19": { - "alias": "Eth5/4", - "lanes": "36", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet20": { - "alias": "Eth6/1", - "lanes": "37", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet21": { - "alias": "Eth6/2", - "lanes": "38", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet22": { - "alias": "Eth6/3", - "lanes": "39", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet23": { - "alias": "Eth6/4", - "lanes": "40", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet24": { - "alias": "Eth7/1", - "lanes": "41", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet25": { - "alias": "Eth7/2", - "lanes": "42", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet26": { - "alias": "Eth7/3", - "lanes": "43", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet27": { - "alias": "Eth7/4", - "lanes": "44", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet28": { - "alias": "Eth8/1", - "lanes": "45", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet29": { - "alias": "Eth8/2", - "lanes": "46", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet30": { - "alias": "Eth8/3", - "lanes": "47", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet31": { - "alias": "Eth8/4", - "lanes": "48", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet32": { - "alias": "Eth9/1", - "lanes": "49", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet33": { - "alias": "Eth9/2", - "lanes": "50", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet34": { - "alias": "Eth9/3", - "lanes": "51", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet35": { - "alias": "Eth9/4", - "lanes": "52", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet36": { - "alias": "Eth10/1", - "lanes": "53", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet112": { - "alias": "Eth29/1", - "lanes": "113,114", - "description": "50G|dccsw01.nw|Eth18", - "fec": "fc", - "admin_status": "up" - } - }, - "ACL_TABLE": { - "V4-ACL-TABLE": { - "type": "L3", - "policy_desc": "V4-ACL-TABLE", - "ports": [ - "Ethernet26", - "Ethernet27", - "Ethernet24" - ] - }, - "V6-ACL-TBLE": { - "type": "L3V6", - "policy_desc": "V6-ACL-TBLE", - "ports": [ - "Ethernet14", - "Ethernet15", - "Ethernet23", - "Ethernet30", - "Ethernet31", - "Ethernet18", - "Ethernet19", - "Ethernet25", - "Ethernet24" - ] - } - }, - "INTERFACE": { - "Ethernet112|2a04:5555:40:a709::2/126": { - "scope": "global", - "family": "IPv6" - }, - "Ethernet112|10.184.228.211/31": { - "scope": "global", - "family": "IPv4" - }, - "Ethernet14|2a04:5555:40:a749::2/126": { - "scope": "global", - "family": "IPv6" - }, - "Ethernet14|10.184.229.211/31": { - "scope": "global", - "family": "IPv4" - }, - "Ethernet16|2a04:5555:40:a789::2/126": { - "scope": "global", - "family": "IPv6" - }, - "Ethernet16|10.184.230.211/31": { - "scope": "global", - "family": "IPv4" - }, - "Ethernet18|2a04:5555:40:a7c9::2/126": { - "scope": "global", - "family": "IPv6" - }, - "Ethernet18|10.184.231.211/31": { - "scope": "global", - "family": "IPv4" - } - }, - "VLAN_MEMBER": { - "Vlan111|Ethernet0": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet1": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet2": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet3": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet4": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet5": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet6": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet29": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet30": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet31": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet32": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet33": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet34": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet35": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet36": { - "tagging_mode": "untagged" - } - }, - "LOOPBACK_INTERFACE": { - "Loopback0|2a04:5555:40:4::4e9/128": { - "scope": "global", - "family": "IPv6" - }, - "Loopback0|10.184.8.233/32": { - "scope": "global", - "family": "IPv4" - } - }, - "CRM": { - "Config": { - "polling_interval": "0" - } - } -} diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py index b761cd994c1..b517ff9ca5c 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py @@ -269,7 +269,7 @@ def test_get_leafref_type_schema(self, yang_s, data): @pytest.fixture(autouse=True, scope='class') def sonic_yang_data(self): sonic_yang_dir = "../sonic-yang-models/yang-models/" - sonic_yang_test_file = "../sonic-yang-models/tests/yang_model_tests/yangTest.json" + sonic_yang_test_file = "../sonic-yang-models/tests/files/sample_config_db.json" syc = sy.SonicYang(sonic_yang_dir) syc.loadYangModel() @@ -281,6 +281,44 @@ def sonic_yang_data(self): return sonic_yang_data + def test_validate_yang_models(self, sonic_yang_data): + ''' + In this test, we validate yang models + a.) by converting the config as per RFC 7951 using YANG Models, + b.) by creating data tree using new YANG models and + c.) by validating config against YANG models. + Successful execution of these steps can be treated as + validation of new Yang models. + ''' + test_file = sonic_yang_data['test_file'] + syc = sonic_yang_data['syc'] + # Currently only 2 YANG files are not directly related to config + # which are: sonic-extension.yang and sonic-types.yang. Hard coding + # it right now. + # If any more such helper yang files are added, we need to update here. + NON_CONFIG_YANG_FILES = 2 + # read config + jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_JSON') + jIn = json.loads(jIn) + numTables = len(jIn) + # load config and create Data tree + syc.loadData(jIn, debug=True) + # check all tables are loaded and config related to all Yang Models is + # loaded in Data tree. + assert len(syc.jIn) == numTables + print("{}:{}".format(len(syc.xlateJson), len(syc.yangFiles))) + assert len(syc.xlateJson) == len(syc.yangFiles) - NON_CONFIG_YANG_FILES + # Validate data tree + validTree = False + try: + syc.validate_data_tree() + validTree = True + except Exception as e: + pass + assert validTree == True + + return + def test_xlate_rev_xlate(self, sonic_yang_data): # In this test, xlation and revXlation is tested with latest Sonic # YANG model. @@ -291,12 +329,12 @@ def test_xlate_rev_xlate(self, sonic_yang_data): jIn = json.loads(jIn) numTables = len(jIn) - syc.loadData(jIn) + syc.loadData(jIn, debug=True) # check all tables are loaded and no tables is without Yang Models assert len(syc.jIn) == numTables assert len(syc.tablesWithOutYang) == 0 - syc.getData() + syc.getData(debug=True) if syc.jIn and syc.jIn == syc.revXlateJson: print("Xlate and Rev Xlate Passed") @@ -313,7 +351,7 @@ def test_table_with_no_yang(self, sonic_yang_data): test_file = sonic_yang_data['test_file'] syc = sonic_yang_data['syc'] - jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_JSON_1') + jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_UNKNOWN') syc.loadData(json.loads(jIn)) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json new file mode 100644 index 00000000000..3e833b1617e --- /dev/null +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -0,0 +1,693 @@ +{ + "SAMPLE_CONFIG_DB_JSON": { + "PORTCHANNEL": { + "PortChannel0003": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet1" + ], + "mtu": "9100" + }, + "PortChannel0004": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet2" + ], + "mtu": "9100" + } + }, + "VLAN_INTERFACE": { + "Vlan111": {}, + "Vlan777": {}, + "Vlan111|2a04:5555:45:6709::1/64": { + "scope": "global", + "family": "IPv6" + }, + "Vlan111|10.222.10.65/26": { + "scope": "global", + "family": "IPv4" + }, + "Vlan111|fe80::1/10": { + "scope": "local", + "family": "IPv6" + }, + "Vlan777|2a04:5555:41:4e9::1/64": { + "scope": "global", + "family": "IPv6" + }, + "Vlan777|10.111.58.65/26": { + "scope": "global", + "family": "IPv4" + }, + "Vlan777|fe80::1/10": { + "scope": "local", + "family": "IPv6" + } + }, + "ACL_RULE": { + "V4-ACL-TABLE|DEFAULT_DENY": { + "PACKET_ACTION": "DROP", + "IP_TYPE": "IPv4ANY", + "PRIORITY": "0" + }, + "V4-ACL-TABLE|Rule_20": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.222.72.0/26", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777780", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_40": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.222.72.64/26", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777760", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_60": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.222.80.0/26", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777740", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_80": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.222.80.64/26", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777720", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_111": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.152.17.52/32", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777700", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_120": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.252.208.41/32", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777880", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_140": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.148.128.245/32", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777860", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_160": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.222.1.245/32", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777840", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_180": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "10.252.222.21/32", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "777820", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_9000": { + "PACKET_ACTION": "DROP", + "DST_IP": "0.0.0.0/0", + "SRC_IP": "10.222.0.0/15", + "PRIORITY": "991110", + "IP_TYPE": "IPv4ANY" + }, + "V4-ACL-TABLE|Rule_11100": { + "PACKET_ACTION": "FORWARD", + "DST_IP": "0.0.0.0/0", + "SRC_IP": "0.0.0.0/0", + "PRIORITY": "990000", + "IP_TYPE": "IPv4ANY" + }, + "V6-ACL-TBLE|DEFAULT_DENY": { + "PACKET_ACTION": "DROP", + "IP_TYPE": "IPv6ANY", + "PRIORITY": "0" + }, + "V6-ACL-TBLE|Rule_20": { + "PACKET_ACTION": "FORWARD", + "IP_TYPE": "IPv6ANY", + "SRC_IPV6": "2a04:5555:41::/48", + "PRIORITY": "777780", + "DST_IPV6": "2a04:5555:43:320::/64" + }, + "V6-ACL-TBLE|Rule_40": { + "PACKET_ACTION": "FORWARD", + "IP_TYPE": "IPv6ANY", + "SRC_IPV6": "2a04:5555:41::/48", + "PRIORITY": "777760", + "DST_IPV6": "2a04:5555:43:321::/64" + }, + "V6-ACL-TBLE|Rule_60": { + "PACKET_ACTION": "FORWARD", + "IP_TYPE": "IPv6ANY", + "SRC_IPV6": "2a04:5555:41::/48", + "PRIORITY": "777740", + "DST_IPV6": "2a04:5555:43:340::/64" + }, + "V6-ACL-TBLE|Rule_80": { + "PACKET_ACTION": "FORWARD", + "IP_TYPE": "IPv6ANY", + "SRC_IPV6": "2a04:5555:41::/48", + "PRIORITY": "777720", + "DST_IPV6": "2a04:5555:43:341::/64" + }, + "V6-ACL-TBLE|Rule_111": { + "PACKET_ACTION": "FORWARD", + "IP_TYPE": "IPv6ANY", + "SRC_IPV6": "2a04:5555:41::/48", + "PRIORITY": "777700", + "DST_IPV6": "2a04:5555:32:12::/64" + }, + "V6-ACL-TBLE|Rule_9000": { + "PACKET_ACTION": "DROP", + "IP_TYPE": "IPv6ANY", + "SRC_IPV6": "2a04:5555:41::/48", + "PRIORITY": "991110", + "DST_IPV6": "::/0" + }, + "V6-ACL-TBLE|Rule_11100": { + "PACKET_ACTION": "FORWARD", + "IP_TYPE": "IPv6ANY", + "SRC_IPV6": "::/0", + "PRIORITY": "990000", + "DST_IPV6": "::/0" + } + }, + "DEVICE_METADATA": { + "localhost": { + "type": "ToRRouter", + "mac": "00:11:22:33:dd:5a", + "hostname": "asw.dc", + "bgp_asn": "64850", + "hwsku": "Stone" + } + }, + "VLAN": { + "Vlan111": { + "description": "svlan", + "dhcp_servers": [ + "10.222.72.116" + ], + "vlanid": "111", + "mtu": "9216", + "admin_status": "up" + }, + "Vlan777": { + "description": "pvlan", + "dhcp_servers": [ + "10.222.72.116" + ], + "vlanid": "777", + "mtu": "9216", + "admin_status": "up" + } + }, + "DEVICE_NEIGHBOR": { + "Ethernet112": { + "name": "dccsw01.nw", + "port": "Eth18" + }, + "Ethernet114": { + "name": "dccsw02.nw", + "port": "Eth18" + }, + "Ethernet116": { + "name": "dccsw03.nw", + "port": "Eth18" + }, + "Ethernet118": { + "name": "dccsw04.nw", + "port": "Eth18" + } + }, + "PORT": { + "Ethernet0": { + "alias": "Eth1/1", + "lanes": "65", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet1": { + "alias": "Eth1/2", + "lanes": "66", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet2": { + "alias": "Eth1/3", + "lanes": "67", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet3": { + "alias": "Eth1/4", + "lanes": "68", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet4": { + "alias": "Eth2/1", + "lanes": "69", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet5": { + "alias": "Eth2/2", + "lanes": "70", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet6": { + "alias": "Eth2/3", + "lanes": "71", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet7": { + "alias": "Eth2/4", + "lanes": "72", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet8": { + "alias": "Eth3/1", + "lanes": "73", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet9": { + "alias": "Eth3/2", + "lanes": "74", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet10": { + "alias": "Eth3/3", + "lanes": "75", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet11": { + "alias": "Eth3/4", + "lanes": "76", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet12": { + "alias": "Eth4/1", + "lanes": "77", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet13": { + "alias": "Eth4/2", + "lanes": "78", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet14": { + "alias": "Eth4/3", + "lanes": "79", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet15": { + "alias": "Eth4/4", + "lanes": "80", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet16": { + "alias": "Eth5/1", + "lanes": "33", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet17": { + "alias": "Eth5/2", + "lanes": "34", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet18": { + "alias": "Eth5/3", + "lanes": "35", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet19": { + "alias": "Eth5/4", + "lanes": "36", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet20": { + "alias": "Eth6/1", + "lanes": "37", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet21": { + "alias": "Eth6/2", + "lanes": "38", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet22": { + "alias": "Eth6/3", + "lanes": "39", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet23": { + "alias": "Eth6/4", + "lanes": "40", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet24": { + "alias": "Eth7/1", + "lanes": "41", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet25": { + "alias": "Eth7/2", + "lanes": "42", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet26": { + "alias": "Eth7/3", + "lanes": "43", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet27": { + "alias": "Eth7/4", + "lanes": "44", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet28": { + "alias": "Eth8/1", + "lanes": "45", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet29": { + "alias": "Eth8/2", + "lanes": "46", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet30": { + "alias": "Eth8/3", + "lanes": "47", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet31": { + "alias": "Eth8/4", + "lanes": "48", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet32": { + "alias": "Eth9/1", + "lanes": "49", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet33": { + "alias": "Eth9/2", + "lanes": "50", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet34": { + "alias": "Eth9/3", + "lanes": "51", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet35": { + "alias": "Eth9/4", + "lanes": "52", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet36": { + "alias": "Eth10/1", + "lanes": "53", + "description": "", + "speed": "11100", + "admin_status": "up" + }, + "Ethernet112": { + "alias": "Eth29/1", + "lanes": "113,114", + "description": "50G|dccsw01.nw|Eth18", + "fec": "fc", + "speed": "11100", + "admin_status": "up" + } + }, + "ACL_TABLE": { + "V4-ACL-TABLE": { + "type": "L3", + "policy_desc": "V4-ACL-TABLE", + "ports": [ + "Ethernet26", + "Ethernet27", + "Ethernet24" + ], + "stage": "INGRESS", + "services": ["SNMP", "SSH"] + }, + "V6-ACL-TBLE": { + "type": "L3V6", + "policy_desc": "V6-ACL-TBLE", + "ports": [ + "Ethernet14", + "Ethernet15", + "Ethernet23", + "Ethernet30", + "Ethernet31", + "Ethernet18", + "Ethernet19", + "Ethernet25", + "Ethernet24" + ] + } + }, + "INTERFACE": { + "Ethernet112": {}, + "Ethernet14": {}, + "Ethernet16": {}, + "Ethernet18": {}, + "Ethernet112|2a04:5555:40:a709::2/126": { + "scope": "global", + "family": "IPv6" + }, + "Ethernet112|10.184.228.211/31": { + "scope": "global", + "family": "IPv4" + }, + "Ethernet14|2a04:5555:40:a749::2/126": { + "scope": "global", + "family": "IPv6" + }, + "Ethernet14|10.184.229.211/31": { + "scope": "global", + "family": "IPv4" + }, + "Ethernet16|2a04:5555:40:a789::2/126": { + "scope": "global", + "family": "IPv6" + }, + "Ethernet16|10.184.230.211/31": { + "scope": "global", + "family": "IPv4" + }, + "Ethernet18|2a04:5555:40:a7c9::2/126": { + "scope": "global", + "family": "IPv6" + }, + "Ethernet18|10.184.231.211/31": { + "scope": "global", + "family": "IPv4" + } + }, + "VLAN_MEMBER": { + "Vlan111|Ethernet0": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet1": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet2": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet3": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet4": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet5": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet6": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet29": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet30": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet31": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet32": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet33": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet34": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet35": { + "tagging_mode": "untagged" + }, + "Vlan111|Ethernet36": { + "tagging_mode": "untagged" + } + }, + "LOOPBACK_INTERFACE": { + "Loopback0": {}, + "Loopback0|2a04:5555:40:4::4e9/128": { + "scope": "global", + "family": "IPv6" + }, + "Loopback0|10.184.8.233/32": { + "scope": "global", + "family": "IPv4" + } + }, + "BREAKOUT_CFG": { + "Ethernet0": { + "brkout_mode": "1x100G[40G]" + }, + "Ethernet4": { + "brkout_mode": "4x25G[10G]" + }, + "Ethernet8": { + "brkout_mode": "1x100G[40G]" + } + }, + "VERSIONS": { + "DATABASE": { + "VERSION": "version_1_0_3" + } + }, + "FLEX_COUNTER_TABLE": { + "PFCWD": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PG_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT_RATES": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT_BUFFER_DROP": { + "FLEX_COUNTER_STATUS": "enable" + }, + "BUFFER_POOL_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable" + }, + "DEBUG_COUNTER": { + "FLEX_COUNTER_STATUS": "enable" + } + }, + "CRM": { + "Config": { + "acl_counter_high_threshold": "85", + "acl_counter_low_threshold": "70", + "acl_counter_threshold_type": "percentage", + "ipv6_neighbor_high_threshold": "67", + "ipv6_neighbor_low_threshold": "56", + "ipv6_neighbor_threshold_type": "percentage", + "nexthop_group_high_threshold": "67", + "nexthop_group_low_threshold": "56", + "nexthop_group_threshold_type": "percentage", + "polling_interval": "0" + } + } + }, + + "SAMPLE_CONFIG_DB_UNKNOWN": { + "UNKNOWN_TABLE": { + "Error": "This Table is for testing, This Table does not have YANG models." + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/yangTest.json b/src/sonic-yang-models/tests/yang_model_tests/yangTest.json index 44e74c1f2cc..ec3869ca5da 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/yangTest.json +++ b/src/sonic-yang-models/tests/yang_model_tests/yangTest.json @@ -1263,784 +1263,62 @@ } }, - "SAMPLE_CONFIG_DB_JSON": { - "PORTCHANNEL": { - "PortChannel0003": { - "admin_status": "up", - "min_links": "1", - "members": [ - "Ethernet1" - ], - "mtu": "9100" - }, - "PortChannel0004": { - "admin_status": "up", - "min_links": "1", - "members": [ - "Ethernet2" - ], - "mtu": "9100" - } - }, - "VLAN_INTERFACE": { - "Vlan111": {}, - "Vlan777": {}, - "Vlan111|2a04:5555:45:6709::1/64": { - "scope": "global", - "family": "IPv6" - }, - "Vlan111|10.222.10.65/26": { - "scope": "global", - "family": "IPv4" - }, - "Vlan111|fe80::1/10": { - "scope": "local", - "family": "IPv6" - }, - "Vlan777|2a04:5555:41:4e9::1/64": { - "scope": "global", - "family": "IPv6" - }, - "Vlan777|10.111.58.65/26": { - "scope": "global", - "family": "IPv4" - }, - "Vlan777|fe80::1/10": { - "scope": "local", - "family": "IPv6" - } - }, - "ACL_RULE": { - "V4-ACL-TABLE|DEFAULT_DENY": { - "PACKET_ACTION": "DROP", - "IP_TYPE": "IPv4ANY", - "PRIORITY": "0" - }, - "V4-ACL-TABLE|Rule_20": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.72.0/26", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777780", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_40": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.72.64/26", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777760", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_60": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.80.0/26", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777740", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_80": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.80.64/26", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777720", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_111": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.152.17.52/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777700", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_120": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.252.208.41/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777880", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_140": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.148.128.245/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777860", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_160": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.222.1.245/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777840", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_180": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.252.222.21/32", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "777820", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_9000": { - "PACKET_ACTION": "DROP", - "DST_IP": "0.0.0.0/0", - "SRC_IP": "10.222.0.0/15", - "PRIORITY": "991110", - "IP_TYPE": "IPv4ANY" - }, - "V4-ACL-TABLE|Rule_11100": { - "PACKET_ACTION": "FORWARD", - "DST_IP": "0.0.0.0/0", - "SRC_IP": "0.0.0.0/0", - "PRIORITY": "990000", - "IP_TYPE": "IPv4ANY" - }, - "V6-ACL-TBLE|DEFAULT_DENY": { - "PACKET_ACTION": "DROP", - "IP_TYPE": "IPv6ANY", - "PRIORITY": "0" - }, - "V6-ACL-TBLE|Rule_20": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777780", - "DST_IPV6": "2a04:5555:43:320::/64" - }, - "V6-ACL-TBLE|Rule_40": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777760", - "DST_IPV6": "2a04:5555:43:321::/64" - }, - "V6-ACL-TBLE|Rule_60": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777740", - "DST_IPV6": "2a04:5555:43:340::/64" - }, - "V6-ACL-TBLE|Rule_80": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777720", - "DST_IPV6": "2a04:5555:43:341::/64" - }, - "V6-ACL-TBLE|Rule_111": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "777700", - "DST_IPV6": "2a04:5555:32:12::/64" - }, - "V6-ACL-TBLE|Rule_9000": { - "PACKET_ACTION": "DROP", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "2a04:5555:41::/48", - "PRIORITY": "991110", - "DST_IPV6": "::/0" - }, - "V6-ACL-TBLE|Rule_11100": { - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IPv6ANY", - "SRC_IPV6": "::/0", - "PRIORITY": "990000", - "DST_IPV6": "::/0" - } - }, - "DEVICE_METADATA": { - "localhost": { - "type": "ToRRouter", - "mac": "00:11:22:33:dd:5a", - "hostname": "asw.dc", - "bgp_asn": "64850", - "hwsku": "Stone" - } - }, - "VLAN": { - "Vlan111": { - "description": "svlan", - "dhcp_servers": [ - "10.222.72.116" - ], - "vlanid": "111", - "mtu": "9216", - "admin_status": "up" - }, - "Vlan777": { - "description": "pvlan", - "dhcp_servers": [ - "10.222.72.116" - ], - "vlanid": "777", - "mtu": "9216", - "admin_status": "up" - } - }, - "DEVICE_NEIGHBOR": { - "Ethernet112": { - "name": "dccsw01.nw", - "port": "Eth18" - }, - "Ethernet114": { - "name": "dccsw02.nw", - "port": "Eth18" - }, - "Ethernet116": { - "name": "dccsw03.nw", - "port": "Eth18" - }, - "Ethernet118": { - "name": "dccsw04.nw", - "port": "Eth18" - } - }, - "PORT": { - "Ethernet0": { - "alias": "Eth1/1", - "lanes": "65", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet1": { - "alias": "Eth1/2", - "lanes": "66", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet2": { - "alias": "Eth1/3", - "lanes": "67", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet3": { - "alias": "Eth1/4", - "lanes": "68", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet4": { - "alias": "Eth2/1", - "lanes": "69", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet5": { - "alias": "Eth2/2", - "lanes": "70", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet6": { - "alias": "Eth2/3", - "lanes": "71", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet7": { - "alias": "Eth2/4", - "lanes": "72", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet8": { - "alias": "Eth3/1", - "lanes": "73", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet9": { - "alias": "Eth3/2", - "lanes": "74", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet10": { - "alias": "Eth3/3", - "lanes": "75", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet11": { - "alias": "Eth3/4", - "lanes": "76", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet12": { - "alias": "Eth4/1", - "lanes": "77", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet13": { - "alias": "Eth4/2", - "lanes": "78", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet14": { - "alias": "Eth4/3", - "lanes": "79", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet15": { - "alias": "Eth4/4", - "lanes": "80", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet16": { - "alias": "Eth5/1", - "lanes": "33", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet17": { - "alias": "Eth5/2", - "lanes": "34", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet18": { - "alias": "Eth5/3", - "lanes": "35", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet19": { - "alias": "Eth5/4", - "lanes": "36", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet20": { - "alias": "Eth6/1", - "lanes": "37", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet21": { - "alias": "Eth6/2", - "lanes": "38", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet22": { - "alias": "Eth6/3", - "lanes": "39", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet23": { - "alias": "Eth6/4", - "lanes": "40", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet24": { - "alias": "Eth7/1", - "lanes": "41", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet25": { - "alias": "Eth7/2", - "lanes": "42", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet26": { - "alias": "Eth7/3", - "lanes": "43", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet27": { - "alias": "Eth7/4", - "lanes": "44", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet28": { - "alias": "Eth8/1", - "lanes": "45", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet29": { - "alias": "Eth8/2", - "lanes": "46", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet30": { - "alias": "Eth8/3", - "lanes": "47", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet31": { - "alias": "Eth8/4", - "lanes": "48", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet32": { - "alias": "Eth9/1", - "lanes": "49", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet33": { - "alias": "Eth9/2", - "lanes": "50", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet34": { - "alias": "Eth9/3", - "lanes": "51", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet35": { - "alias": "Eth9/4", - "lanes": "52", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet36": { - "alias": "Eth10/1", - "lanes": "53", - "description": "", - "speed": "11100", - "admin_status": "up" - }, - "Ethernet112": { - "alias": "Eth29/1", - "lanes": "113,114", - "description": "50G|dccsw01.nw|Eth18", - "fec": "fc", - "speed": "11100", - "admin_status": "up" - } - }, - "ACL_TABLE": { - "V4-ACL-TABLE": { - "type": "L3", - "policy_desc": "V4-ACL-TABLE", - "ports": [ - "Ethernet26", - "Ethernet27", - "Ethernet24" - ], - "stage": "INGRESS", - "services": ["SNMP", "SSH"] - }, - "V6-ACL-TBLE": { - "type": "L3V6", - "policy_desc": "V6-ACL-TBLE", - "ports": [ - "Ethernet14", - "Ethernet15", - "Ethernet23", - "Ethernet30", - "Ethernet31", - "Ethernet18", - "Ethernet19", - "Ethernet25", - "Ethernet24" - ] - } - }, - "INTERFACE": { - "Ethernet112": {}, - "Ethernet14": {}, - "Ethernet16": {}, - "Ethernet18": {}, - "Ethernet112|2a04:5555:40:a709::2/126": { - "scope": "global", - "family": "IPv6" - }, - "Ethernet112|10.184.228.211/31": { - "scope": "global", - "family": "IPv4" - }, - "Ethernet14|2a04:5555:40:a749::2/126": { - "scope": "global", - "family": "IPv6" - }, - "Ethernet14|10.184.229.211/31": { - "scope": "global", - "family": "IPv4" - }, - "Ethernet16|2a04:5555:40:a789::2/126": { - "scope": "global", - "family": "IPv6" - }, - "Ethernet16|10.184.230.211/31": { - "scope": "global", - "family": "IPv4" - }, - "Ethernet18|2a04:5555:40:a7c9::2/126": { - "scope": "global", - "family": "IPv6" - }, - "Ethernet18|10.184.231.211/31": { - "scope": "global", - "family": "IPv4" - } - }, - "VLAN_MEMBER": { - "Vlan111|Ethernet0": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet1": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet2": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet3": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet4": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet5": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet6": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet29": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet30": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet31": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet32": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet33": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet34": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet35": { - "tagging_mode": "untagged" - }, - "Vlan111|Ethernet36": { - "tagging_mode": "untagged" - } - }, - "LOOPBACK_INTERFACE": { - "Loopback0": {}, - "Loopback0|2a04:5555:40:4::4e9/128": { - "scope": "global", - "family": "IPv6" - }, - "Loopback0|10.184.8.233/32": { - "scope": "global", - "family": "IPv4" - } - }, - "BREAKOUT_CFG": { - "Ethernet0": { - "brkout_mode": "1x100G[40G]" - }, - "Ethernet4": { - "brkout_mode": "4x25G[10G]" - }, - "Ethernet8": { - "brkout_mode": "1x100G[40G]" - } - }, - "VERSIONS": { - "DATABASE": { - "VERSION": "version_1_0_3" - } - }, - "FLEX_COUNTER_TABLE": { - "PFCWD": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PG_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT_RATES": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT_BUFFER_DROP": { - "FLEX_COUNTER_STATUS": "enable" - }, - "BUFFER_POOL_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" - }, - "QUEUE_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "DEBUG_COUNTER": { - "FLEX_COUNTER_STATUS": "enable" - } - }, - "CRM": { - "Config": { - "acl_counter_high_threshold": "85", - "acl_counter_low_threshold": "70", - "acl_counter_threshold_type": "percentage", - "ipv6_neighbor_high_threshold": "67", - "ipv6_neighbor_low_threshold": "56", - "ipv6_neighbor_threshold_type": "percentage", - "nexthop_group_high_threshold": "67", - "nexthop_group_low_threshold": "56", - "nexthop_group_threshold_type": "percentage", - "snat_entry_threshold_type": "percentage", - "snat_entry_low_threshold": "70", - "snat_entry_high_threshold": "85", - "dnat_entry_threshold_type": "percentage", - "dnat_entry_low_threshold": "70", - "dnat_entry_high_threshold": "85", - "ipmc_entry_threshold_type": "percentage", - "ipmc_entry_low_threshold": "70", - "ipmc_entry_high_threshold": "85", - "polling_interval": "0" + "BREAKOUT_CFG_CORRECT_MODES": { + "sonic-breakout_cfg:sonic-breakout_cfg": { + "sonic-breakout_cfg:BREAKOUT_CFG": { + "BREAKOUT_CFG_LIST": [ + { + "brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]", + "port": "Ethernet0" + }, + { + "brkout_mode": "2x100G[50G,40G,25G,10G,1G]", + "port": "Ethernet8" + }, + { + "brkout_mode": "4x50G[40G,25G,10G,1G]", + "port": "Ethernet4" + }, + { + "brkout_mode": "1x25G[10G]", + "port": "Ethernet12" + }, + { + "brkout_mode": "1x100G[50G,40G,25G,10G]", + "port": "Ethernet16" + }, + { + "brkout_mode": "2x50G[40G,25G,10G]", + "port": "Ethernet20" + }, + { + "brkout_mode": "1x400G[200G,100G,50G,40G,25G,10G,1G]", + "port": "Ethernet24" + } + ] } } }, - "SAMPLE_CONFIG_DB_JSON_1": { - "FLEX_COUNTER_TABLE": { - "PFCWD": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PG_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT": { - "FLEX_COUNTER_STATUS": "enable" - }, - "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" - }, - "QUEUE_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - } - }, - "CRM": { - "Config": { - "acl_counter_high_threshold": "85", - "acl_counter_low_threshold": "70", - "acl_counter_threshold_type": "percentage", - "polling_interval": "0" + + "BREAKOUT_CFG_INCORRECT_MODES": { + "sonic-breakout_cfg:sonic-breakout_cfg": { + "sonic-breakout_cfg:BREAKOUT_CFG": { + "BREAKOUT_CFG_LIST": [ + { + "brkout_mode": "1x500G[100G,50G,40G,25G,10G,1G]", + "port": "Ethernet0" + }, + { + "brkout_mode": "2x300G[50G,40G,25G,1G]", + "port": "Ethernet8" + }, + { + "brkout_mode": "5x50G[40G,25G]", + "port": "Ethernet4" + } + ] } - }, - "UNKNOWN_TABLE": { - "Error": "This Table is for testing, This Table does not have YANG models." } - }, - "BREAKOUT_CFG_CORRECT_MODES": { - "sonic-breakout_cfg:sonic-breakout_cfg": { - "sonic-breakout_cfg:BREAKOUT_CFG": { - "BREAKOUT_CFG_LIST": [ - { - "brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]", - "port": "Ethernet0" - }, - { - "brkout_mode": "2x100G[50G,40G,25G,10G,1G]", - "port": "Ethernet8" - }, - { - "brkout_mode": "4x50G[40G,25G,10G,1G]", - "port": "Ethernet4" - }, - { - "brkout_mode": "1x25G[10G]", - "port": "Ethernet12" - }, - { - "brkout_mode": "1x100G[50G,40G,25G,10G]", - "port": "Ethernet16" - }, - { - "brkout_mode": "2x50G[40G,25G,10G]", - "port": "Ethernet20" - }, - { - "brkout_mode": "1x400G[200G,100G,50G,40G,25G,10G,1G]", - "port": "Ethernet24" - } - ] - } - } - }, - "BREAKOUT_CFG_INCORRECT_MODES": { - "sonic-breakout_cfg:sonic-breakout_cfg": { - "sonic-breakout_cfg:BREAKOUT_CFG": { - "BREAKOUT_CFG_LIST": [ - { - "brkout_mode": "1x500G[100G,50G,40G,25G,10G,1G]", - "port": "Ethernet0" - }, - { - "brkout_mode": "2x300G[50G,40G,25G,1G]", - "port": "Ethernet8" - }, - { - "brkout_mode": "5x50G[40G,25G]", - "port": "Ethernet4" - } - ] - } - } - } + } } + From 6f7cd8d772b48c1317876af720ba73717aade2b4 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Tue, 9 Mar 2021 19:49:54 -0800 Subject: [PATCH 005/169] Copy dummy flannel.conf to get around absence of CNI Network (#6985) Why I did it We skip install of CNI plugin, as we don't need. But this leaves node in "not ready" state, upon joining master. To fix, we copy this dummy .conf file in /etc/cni/net.d How I did it Keep this file in /usr/share/sonic/templates and copy to /etc/cni/net.d upon joining k8s master. How to verify it Upon configuring master-IP and enable join, watch node join and move to ready state. You may verify using kubectl get nodes command --- .../build_templates/sonic_debian_extension.j2 | 4 +++ src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py | 6 ++-- src/sonic-ctrmgrd/ctrmgr/kube_commands.py | 19 ++++++++----- src/sonic-ctrmgrd/tests/kube_commands_test.py | 28 ++++++++++++++----- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 54c428b8ee9..6145bb986f9 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -404,6 +404,10 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install azure- sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install watchdog==0.10.3 {% if include_kubernetes == "y" %} +# Copy Flannel conf file into sonic-templates +# +sudo cp $BUILD_TEMPLATES/kube_cni.10-flannel.conflist $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ + # Install remote Container mgmt package # Required even if include_kubernetes != y, as it contains the # the container wrapper for docker start/stop/wait commands. diff --git a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py index ba4f0057bd0..49c11d27817 100755 --- a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py +++ b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py @@ -201,7 +201,7 @@ def mod_db_entry(self, db_name, table_name, key, data): """ Modify entry for given table|key with given dict type data """ conn = self.db_connectors[db_name] tbl = swsscommon.Table(conn, table_name) - print("mod_db_entry: db={} tbl={} key={} data={}".format(db_name, table_name, key, str(data))) + log_debug("mod_db_entry: db={} tbl={} key={} data={}".format(db_name, table_name, key, str(data))) tbl.set(key, list(data.items())) @@ -242,7 +242,7 @@ def run(self): if not UNIT_TESTING: raise Exception("Received error from select") else: - print("Skipped Exception; Received error from select") + log_debug("Skipped Exception; Received error from select") return for subscriber in self.subscribers: @@ -588,7 +588,7 @@ def main(): FeatureTransitionHandler(server) LabelsPendingHandler(server) server.run() - print("ctrmgrd.py main called") + log_debug("ctrmgrd.py main called") return 0 diff --git a/src/sonic-ctrmgrd/ctrmgr/kube_commands.py b/src/sonic-ctrmgrd/ctrmgr/kube_commands.py index 1ebfa606f07..db8cb348fcb 100755 --- a/src/sonic-ctrmgrd/ctrmgr/kube_commands.py +++ b/src/sonic-ctrmgrd/ctrmgr/kube_commands.py @@ -22,6 +22,8 @@ KUBELET_YAML = "/var/lib/kubelet/config.yaml" SERVER_ADMIN_URL = "https://{}/admin.conf" LOCK_FILE = "/var/lock/kube_join.lock" +FLANNEL_CONF_FILE = "/usr/share/sonic/templates/kube_cni.10-flannel.conflist" +CNI_DIR = "/etc/cni/net.d" # kubectl --kubeconfig label nodes #