diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f553a042f9a..269863f04e2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -63,10 +63,10 @@ # yang /src/sonic-yang-models/ @praveen-li @dgsudharsan @rathnasabapathyv @venkatmahalingam @qiluo-msft -/src/sonic-yang-mgmt/ @sonet-net/sonic-management +/src/sonic-yang-mgmt/ @sonic-net/sonic-management /src/libyang/ @sonic-net/sonic-management -/src/libyang1/ @sonic-net/sonic-management -/src/libyang2/ @sonic-net/sonic-management +/src/libyang3/ @sonic-net/sonic-management +/src/libyang3-py3/ @sonic-net/sonic-management # bgpcfgd /src/sonic-bgpcfgd/ @StormLiangMS diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 45438bd6b82..3770b331bae 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -7,10 +7,10 @@ DOCKER_FPM_FRR_DBG = $(DOCKER_FPM_FRR_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM) $(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD) $(SONIC_FRR_MGMT_FRAMEWORK) -$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG2) +$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG3) $(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BOOKWORM)_DBG_DEPENDS) $(DOCKER_FPM_FRR)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) \ - $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG2_DBG) + $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG3_DBG) $(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BOOKWORM)_DBG_IMAGE_PACKAGES) diff --git a/rules/frr.mk b/rules/frr.mk index fca8cd22568..45797f018e8 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -8,9 +8,8 @@ export FRR_VERSION FRR_SUBVERSION FRR_BRANCH FRR_TAG FRR = frr_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_$(CONFIGURED_ARCH).deb -$(FRR)_DEPENDS += $(LIBSNMP_DEV) $(LIBYANG2) $(LIBYANG2_DEV) -$(FRR)_RDEPENDS += $(LIBYANG2) -$(FRR)_UNINSTALLS = $(LIBYANG2_DEV) $(LIBYANG2) +$(FRR)_DEPENDS += $(LIBSNMP_DEV) $(LIBYANG3_DEV) +$(FRR)_RDEPENDS += $(LIBYANG3) $(FRR)_SRC_PATH = $(SRC_PATH)/sonic-frr SONIC_MAKE_DEBS += $(FRR) diff --git a/rules/libyang.mk b/rules/libyang.mk index a8e6734459e..0819b0a5431 100644 --- a/rules/libyang.mk +++ b/rules/libyang.mk @@ -29,7 +29,7 @@ LIBYANG_PY3 = python3-yang_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb $(LIBYANG_PY3)_DEPENDS += $(LIBYANG) $(LIBYANG_CPP) $(eval $(call add_derived_package,$(LIBYANG),$(LIBYANG_PY3))) -$(eval $(call add_conflict_package,$(LIBYANG),$(LIBYANG1),$(LIBYANG2))) -$(eval $(call add_conflict_package,$(LIBYANG_DEV),$(LIBYANG1_DEV),$(LIBYANG2_DEV))) +#$(eval $(call add_conflict_package,$(LIBYANG),$(LIBYANG3))) +$(eval $(call add_conflict_package,$(LIBYANG_DEV),$(LIBYANG3_DEV))) export LIBYANG LIBYANG_DBGSYM LIBYANG_DEV LIBYANG_CPP LIBYANG_PY3 diff --git a/rules/libyang1.dep b/rules/libyang1.dep deleted file mode 100644 index 343b06cf961..00000000000 --- a/rules/libyang1.dep +++ /dev/null @@ -1,10 +0,0 @@ - -SPATH := $($(LIBYANG1)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/libyang1.mk rules/libyang1.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(shell git ls-files $(SPATH)) - -$(LIBYANG1)_CACHE_MODE := GIT_CONTENT_SHA -$(LIBYANG1)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(LIBYANG1)_DEP_FILES := $(DEP_FILES) - diff --git a/rules/libyang1.mk b/rules/libyang1.mk deleted file mode 100644 index 6d24e3fc5a4..00000000000 --- a/rules/libyang1.mk +++ /dev/null @@ -1,43 +0,0 @@ -# libyang1 - -LIBYANG1_VERSION_BASE = 1.0 -LIBYANG1_VERSION = $(LIBYANG1_VERSION_BASE).184 -LIBYANG1_SUBVERSION = 2 -LIBYANG1_FULLVERSION = $(LIBYANG1_VERSION)-$(LIBYANG1_SUBVERSION) - -export LIBYANG1_VERSION_BASE -export LIBYANG1_VERSION -export LIBYANG1_SUBVERSION -export LIBYANG1_FULLVERSION - -LIBYANG1 = libyang1_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(LIBYANG1)_SRC_PATH = $(SRC_PATH)/libyang1 -SONIC_MAKE_DEBS += $(LIBYANG1) - -LIBYANG1_DEV = libyang-dev_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_DEV))) - -LIBYANG1_DBG = libyang1-dbgsym_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_DBG))) - -LIBYANG1_CPP = libyang-cpp1_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(LIBYANG1_CPP)_DEPENDS += $(LIBYANG1) -$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_CPP))) - -LIBYANG1_CPP_DEV = libyang-cpp-dev_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_CPP_DEV))) - -LIBYANG1_CPP_DBG = libyang-cpp1-dbgsym_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_CPP_DBG))) - -YANG_TOOLS = yang-tools_$(LIBYANG1_FULLVERSION)_all.deb -$(YANG_TOOLS)_DEPENDS += $(LIBYANG1) -$(eval $(call add_derived_package,$(LIBYANG1),$(YANG_TOOLS))) - -LIBYANG1_TOOLS = libyang-tools_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_TOOLS))) - -LIBYANG1_TOOLS_DBG = libyang-tools-dbgsym_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_TOOLS_DBG))) - -export LIBYANG1 LIBYANG1_DBG LIBYANG1_DEV LIBYANG1_CPP LIBYANG1_CPP_DEV LIBYANG1_CPP_DBG YANG_TOOLS LIBYANG1_TOOLS LIBYANG1_TOOLS_DBG diff --git a/rules/libyang2.dep b/rules/libyang2.dep deleted file mode 100644 index a1b3977f2d8..00000000000 --- a/rules/libyang2.dep +++ /dev/null @@ -1,10 +0,0 @@ - -SPATH := $($(LIBYANG2)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/libyang2.mk rules/libyang2.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(shell git ls-files $(SPATH)) - -$(LIBYANG2)_CACHE_MODE := GIT_CONTENT_SHA -$(LIBYANG2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(LIBYANG2)_DEP_FILES := $(DEP_FILES) - diff --git a/rules/libyang2.mk b/rules/libyang2.mk deleted file mode 100644 index e683ff05eb1..00000000000 --- a/rules/libyang2.mk +++ /dev/null @@ -1,31 +0,0 @@ -# libyang2 - -LIBYANG2_VERSION_BASE = 2.1 -LIBYANG2_VERSION = $(LIBYANG2_VERSION_BASE).148 -LIBYANG2_SUBVERSION = 0.2 -LIBYANG2_FULLVERSION = $(LIBYANG2_VERSION)-$(LIBYANG2_SUBVERSION) - -export LIBYANG2_VERSION_BASE -export LIBYANG2_VERSION -export LIBYANG2_SUBVERSION -export LIBYANG2_FULLVERSION - -LIBYANG2 = libyang2t64_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(LIBYANG2)_SRC_PATH = $(SRC_PATH)/libyang2 -SONIC_MAKE_DEBS += $(LIBYANG2) - -LIBYANG2_DEV = libyang2-dev_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_DEV))) - -LIBYANG2_DBG = libyang2t64-dbgsym_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_DBG))) - - -LIBYANG2_TOOLS = libyang2-tools_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_TOOLS))) - -LIBYANG2_TOOLS_DBG = libyang2-tools-dbgsym_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_TOOLS_DBG))) - -export LIBYANG2 LIBYANG2_DBG LIBYANG2_DEV LIBYANG2_TOOLS LIBYANG2_TOOLS_DBG - diff --git a/rules/libyang3-py3.dep b/rules/libyang3-py3.dep new file mode 100644 index 00000000000..117f59c641d --- /dev/null +++ b/rules/libyang3-py3.dep @@ -0,0 +1,11 @@ + +SPATH := $($(LIBYANG3_PY3)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/libyang3-py3.mk rules/libyang3-py3.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && find . -type f -exec sh -c 'git ls-files --error-unmatch "$0" >/dev/null 2>&1' {} \; -printf '%P\n')) + +$(LIBYANG3_PY3)_CACHE_MODE := GIT_CONTENT_SHA +$(LIBYANG3_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(LIBYANG3_PY3)_DEP_FILES := $(DEP_FILES) +$(LIBYANG3_PY3)_SMDEP_FILES := $(SMDEP_FILES) +$(LIBYANG3_PY3)_SMDEP_PATHS := $(SPATH) diff --git a/rules/libyang3-py3.mk b/rules/libyang3-py3.mk new file mode 100644 index 00000000000..7bac62e012e --- /dev/null +++ b/rules/libyang3-py3.mk @@ -0,0 +1,18 @@ +# libyang3 python3 deb package + +LIBYANG3_PY3_VERSION = 3.1.0 +LIBYANG3_PY3_SUBVERSION = 1 +LIBYANG3_PY3_FULLVERSION = $(LIBYANG3_PY3_VERSION)-$(LIBYANG3_PY3_SUBVERSION) + +export LIBYANG3_PY3_VERSION +export LIBYANG3_PY3_SUBVERSION +export LIBYANG3_PY3_FULLVERSION + +LIBYANG3_PY3 = python3-libyang_$(LIBYANG3_PY3_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(LIBYANG3_PY3)_SRC_PATH = $(SRC_PATH)/libyang3-py3 +$(LIBYANG3_PY3)_DEPENDS += $(LIBYANG3) $(LIBYANG3_DEV) +$(LIBYANG3_PY3)_RDEPENDS += $(LIBYANG3) +SONIC_MAKE_DEBS += $(LIBYANG3_PY3) + +export LIBYANG3_PY3 + diff --git a/rules/libyang3.dep b/rules/libyang3.dep new file mode 100644 index 00000000000..a49a6900ac8 --- /dev/null +++ b/rules/libyang3.dep @@ -0,0 +1,10 @@ + +SPATH := $($(LIBYANG3)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/libyang3.mk rules/libyang3.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) + +$(LIBYANG3)_CACHE_MODE := GIT_CONTENT_SHA +$(LIBYANG3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(LIBYANG3)_DEP_FILES := $(DEP_FILES) + diff --git a/rules/libyang3.mk b/rules/libyang3.mk new file mode 100644 index 00000000000..ab13dcef109 --- /dev/null +++ b/rules/libyang3.mk @@ -0,0 +1,28 @@ +# libyang3 + +LIBYANG3_VERSION = 3.12.2 +LIBYANG3_SUBVERSION = 1 +LIBYANG3_FULLVERSION = $(LIBYANG3_VERSION)-$(LIBYANG3_SUBVERSION) + +export LIBYANG3_VERSION +export LIBYANG3_SUBVERSION +export LIBYANG3_FULLVERSION + +LIBYANG3 = libyang3_$(LIBYANG3_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(LIBYANG3)_SRC_PATH = $(SRC_PATH)/libyang3 +SONIC_MAKE_DEBS += $(LIBYANG3) + +LIBYANG3_DEV = libyang-dev_$(LIBYANG3_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG3),$(LIBYANG3_DEV))) + +LIBYANG3_TOOLS = libyang3-tools_$(LIBYANG3_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG3),$(LIBYANG3_TOOLS))) + +LIBYANG3_DBG = libyang3-dbgsym_$(LIBYANG3_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG3),$(LIBYANG3_DBG))) + +LIBYANG3_TOOLS_DBG = libyang3-tools-dbgsym_$(LIBYANG3_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG3),$(LIBYANG3_TOOLS_DBG))) + +export LIBYANG3 LIBYANG3_DBG LIBYANG3_DEV LIBYANG3_TOOLS LIBYANG3_TOOLS_DBG + diff --git a/rules/sonic-yang-models-py3.mk b/rules/sonic-yang-models-py3.mk index f5a606c28c3..d5e64ac0758 100644 --- a/rules/sonic-yang-models-py3.mk +++ b/rules/sonic-yang-models-py3.mk @@ -2,7 +2,9 @@ SONIC_YANG_MODELS_PY3 = sonic_yang_models-1.0-py3-none-any.whl $(SONIC_YANG_MODELS_PY3)_SRC_PATH = $(SRC_PATH)/sonic-yang-models $(SONIC_YANG_MODELS_PY3)_PYTHON_VERSION = 3 $(SONIC_YANG_MODELS_PY3)_DEBS_DEPENDS = $(LIBYANG) $(LIBYANG_CPP) \ - $(LIBYANG_PY3) + $(LIBYANG_PY3) \ + $(LIBYANG3) \ + $(LIBYANG3_PY3) SONIC_PYTHON_WHEELS += $(SONIC_YANG_MODELS_PY3) export SONIC_YANG_MODELS_PY3 diff --git a/slave.mk b/slave.mk index 29e1c870023..25c2f4de8dc 100644 --- a/slave.mk +++ b/slave.mk @@ -1759,4 +1759,4 @@ jessie : $$(addprefix $(TARGET_PATH)/,$$(JESSIE_DOCKER_IMAGES)) \ ## To build some commonly used libs. Some submodules depend on these libs. ## It is used in component pipelines. For example: swss needs libnl, libyang -lib-packages: $(addprefix $(DEBS_PATH)/,$(LIBNL3) $(LIBYANG) $(PROTOBUF) $(LIB_SONIC_DASH_API)) +lib-packages: $(addprefix $(DEBS_PATH)/,$(LIBNL3) $(LIBYANG) $(LIBYANG3) $(PROTOBUF) $(LIB_SONIC_DASH_API)) diff --git a/sonic-slave-bookworm/Dockerfile.j2 b/sonic-slave-bookworm/Dockerfile.j2 index 13849f5f33a..2ca450d298d 100644 --- a/sonic-slave-bookworm/Dockerfile.j2 +++ b/sonic-slave-bookworm/Dockerfile.j2 @@ -281,7 +281,7 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install debhelper \ autotools-dev \ libbsd-dev \ - pkg-config \ + pkgconf \ check \ # For bmp librdkafka-dev \ @@ -370,6 +370,11 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install libevent-dev \ # For libyang swig \ + pkgconf \ + tcl-expect \ + libxxhash-dev \ +# For libyang3-py3 + python3-cffi \ # For build dtb device-tree-compiler \ # For sonic-mgmt-framework @@ -424,7 +429,6 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install libdbus-1-dev \ libgirepository1.0-dev \ libsystemd-dev \ - pkg-config \ # For sonic-utilities build python3-cryptography \ # For audisp-tacplus @@ -717,7 +721,7 @@ RUN eatmydata apt-get install -y \ libxtables12:$arch \ libatm1-dev:$arch \ libbpf-dev:$arch \ - libdb-dev:$arch pkg-config:$arch \ + libdb-dev:$arch pkgconf:$arch \ libnghttp2-14:$arch \ librtmp1:$arch \ libssh2-1:$arch \ diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index b6f97fa1700..b9ca2103502 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -283,7 +283,7 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install debhelper \ autotools-dev \ libbsd-dev \ - pkg-config \ + pkgconf \ check \ # For mpdecimal docutils-common \ @@ -363,6 +363,11 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install libevent-dev \ # For libyang swig \ + pkgconf \ + tcl-expect \ + libxxhash-dev \ +# For libyang3-py3 + python3-cffi \ # For build dtb device-tree-compiler \ # For sonic-mgmt-framework @@ -416,7 +421,7 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install libdbus-1-dev \ libgirepository1.0-dev \ libsystemd-dev \ - pkg-config \ + pkgconf \ # For sonic-swss-common build libhiredis-dev \ # For audisp-tacplus @@ -457,7 +462,7 @@ RUN eatmydata apt install -y \ python3-ply \ python3-scapy \ python3-thrift \ - libabsl20200923 libc-ares2 python3-six libboost-thread1.74.0 libboost-dev libboost-system-dev libboost-thread-dev libboost-filesystem1.74.0 libboost-program-options1.74.0 libboost-thread1.74.0 libnanomsg5 libpcap0.8 libthrift-0.13.0 libboost-dev libboost-filesystem-dev libboost-program-options-dev libgmp-dev libnanomsg-dev libpcap-dev libtool pkg-config libthrift-dev python3-thrift thrift-compiler libboost-iostreams1.74.0 libgc1 cpp libboost-dev libboost-all-dev libboost-graph-dev libboost-iostreams-dev libfl-dev libgc-dev libgmp-dev libbpf-dev tcpdump libelf-dev llvm clang python3-pyroute2 python3-ply python3-scapy python3-setuptools python3-thrift libthrift-0.13.0 + libabsl20200923 libc-ares2 python3-six libboost-thread1.74.0 libboost-dev libboost-system-dev libboost-thread-dev libboost-filesystem1.74.0 libboost-program-options1.74.0 libboost-thread1.74.0 libnanomsg5 libpcap0.8 libthrift-0.13.0 libboost-dev libboost-filesystem-dev libboost-program-options-dev libgmp-dev libnanomsg-dev libpcap-dev libtool pkgconf libthrift-dev python3-thrift thrift-compiler libboost-iostreams1.74.0 libgc1 cpp libboost-dev libboost-all-dev libboost-graph-dev libboost-iostreams-dev libfl-dev libgc-dev libgmp-dev libbpf-dev tcpdump libelf-dev llvm clang python3-pyroute2 python3-ply python3-scapy python3-setuptools python3-thrift libthrift-0.13.0 {%- endif %} {%- if CONFIGURED_ARCH == "amd64" %} @@ -680,7 +685,7 @@ RUN eatmydata apt-get install -y nodejs {%- if CROSS_BUILD_ENVIRON == "y" %} RUN eatmydata apt-get install -y rsync dh-python -RUN eatmydata apt-get install -y libelf-dev:$arch libdw-dev:$arch libbz2-dev:$arch liblzo2-dev:$arch libedit-dev:$arch libevent-dev:$arch libopts25-dev:$arch libssl-dev:$arch pps-tools:$arch libpam-cap:$arch libcap-dev:$arch libpam0g-dev:$arch libaudit-dev:$arch libgtk-3-dev:$arch libkrb5-dev:$arch libsystemd-dev:$arch libwrap0-dev:$arch libkrb5-dev:$arch libboost1.74-dev:$arch libboost-dev:$arch libzmq5:$arch libzmq3-dev:$arch libdaemon-dev:$arch libjansson-dev:$arch libmnl-dev:$arch libsensors5:$arch libsensors4-dev:$arch libperl-dev:$arch libmariadb-dev:$arch libmariadb-dev-compat:$arch libpci-dev:$arch libjson-c-dev:$arch libreadline-dev:$arch librtr-dev:$arch librrd-dev:$arch libnetfilter-conntrack-dev:$arch libnetfilter-conntrack3:$arch libnfnetlink-dev:$arch libnftnl-dev:$arch libldap2-dev:$arch libbind-export-dev:$arch check:$arch libboost-atomic-dev:$arch libboost-test-dev:$arch libglib2.0-dev:$arch libexplain-dev:$arch libc-ares-dev:$arch libiptc0:$arch libxtables12:$arch libatm1-dev:$arch libbpf-dev:$arch libdb-dev:$arch pkg-config:$arch libnghttp2-14:$arch librtmp1:$arch libssh2-1:$arch libcjson1:$arch libcjson-dev:$arch libcurl4-openssl-dev:$arch libboost-thread1.74-dev:$arch libboost-thread-dev:$arch libboost-system1.74-dev:$arch libboost-system-dev:$arch libgtest-dev:$arch libgmock-dev:$arch libfido2-dev:$arch libcunit1:$arch libcunit1-dev:$arch libauparse-dev:$arch libnetsnmptrapd40:$arch qtbase5-dev:$arch libboost-log-dev:$arch libboost-filesystem-dev:$arch libboost-program-options-dev:$arch +RUN eatmydata apt-get install -y libelf-dev:$arch libdw-dev:$arch libbz2-dev:$arch liblzo2-dev:$arch libedit-dev:$arch libevent-dev:$arch libopts25-dev:$arch libssl-dev:$arch pps-tools:$arch libpam-cap:$arch libcap-dev:$arch libpam0g-dev:$arch libaudit-dev:$arch libgtk-3-dev:$arch libkrb5-dev:$arch libsystemd-dev:$arch libwrap0-dev:$arch libkrb5-dev:$arch libboost1.74-dev:$arch libboost-dev:$arch libzmq5:$arch libzmq3-dev:$arch libdaemon-dev:$arch libjansson-dev:$arch libmnl-dev:$arch libsensors5:$arch libsensors4-dev:$arch libperl-dev:$arch libmariadb-dev:$arch libmariadb-dev-compat:$arch libpci-dev:$arch libjson-c-dev:$arch libreadline-dev:$arch librtr-dev:$arch librrd-dev:$arch libnetfilter-conntrack-dev:$arch libnetfilter-conntrack3:$arch libnfnetlink-dev:$arch libnftnl-dev:$arch libldap2-dev:$arch libbind-export-dev:$arch check:$arch libboost-atomic-dev:$arch libboost-test-dev:$arch libglib2.0-dev:$arch libexplain-dev:$arch libc-ares-dev:$arch libiptc0:$arch libxtables12:$arch libatm1-dev:$arch libbpf-dev:$arch libdb-dev:$arch pkgconf:$arch libnghttp2-14:$arch librtmp1:$arch libssh2-1:$arch libcjson1:$arch libcjson-dev:$arch libcurl4-openssl-dev:$arch libboost-thread1.74-dev:$arch libboost-thread-dev:$arch libboost-system1.74-dev:$arch libboost-system-dev:$arch libgtest-dev:$arch libgmock-dev:$arch libfido2-dev:$arch libcunit1:$arch libcunit1-dev:$arch libauparse-dev:$arch libnetsnmptrapd40:$arch qtbase5-dev:$arch libboost-log-dev:$arch libboost-filesystem-dev:$arch libboost-program-options-dev:$arch RUN apt-get download libgirepository1.0-dev:$arch && eatmydata dpkg --force-all -i libgirepository1.0-dev* RUN PATH=/python_virtualenv/env3/bin/:$PATH pip3 install pycairo diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 2aa36d1b9c4..fab448a0f64 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -278,7 +278,7 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install debhelper \ autotools-dev \ libbsd-dev \ - pkg-config \ + pkgconf \ check \ # For mpdecimal docutils-common \ @@ -358,6 +358,12 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install libevent-dev \ # For libyang swig \ + pkgconf \ + tcl-expect \ +# xxhash on buster is too old for libyang3, causes build issues, skip +# libxxhash-dev \ +# For libyang3-py3 + python3-cffi \ # For build dtb device-tree-compiler \ # For sonic-mgmt-framework @@ -416,7 +422,7 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install libdbus-1-dev \ libgirepository1.0-dev \ libsystemd-dev \ - pkg-config \ + pkgconf \ # For sonic-swss-common build libhiredis-dev \ # For audisp-tacplus @@ -647,7 +653,7 @@ RUN eatmydata apt-get install -y nodejs {%- if CROSS_BUILD_ENVIRON == "y" %} RUN eatmydata apt-get install -y rsync dh-python -RUN eatmydata apt-get install -y libelf-dev:$arch libdw-dev:$arch libbz2-dev:$arch liblzo2-dev:$arch libedit-dev:$arch libevent-dev:$arch libopts25-dev:$arch libssl-dev:$arch pps-tools:$arch libpam-cap:$arch libcap-dev:$arch libpam0g-dev:$arch libaudit-dev:$arch libgtk-3-dev:$arch libkrb5-dev:$arch libsystemd-dev:$arch libwrap0-dev:$arch libkrb5-dev:$arch libboost1.67-dev:$arch libboost-dev:$arch libzmq5:$arch libzmq3-dev:$arch libdaemon-dev:$arch libjansson-dev:$arch libmnl-dev:$arch libsensors5:$arch libsensors4-dev:$arch libperl-dev:$arch libmariadb-dev:$arch libmariadb-dev-compat:$arch libpci-dev:$arch libjson-c3:$arch libjson-c-dev:$arch libreadline-dev:$arch librtr-dev:$arch librrd-dev:$arch libnetfilter-conntrack-dev:$arch libnetfilter-conntrack3:$arch libnfnetlink-dev:$arch libnftnl-dev:$arch libldap2-dev:$arch libbind-export-dev:$arch check:$arch libboost-atomic-dev:$arch libboost-test-dev:$arch libglib2.0-dev:$arch qt5-default:$arch libexplain-dev:$arch libc-ares-dev:$arch libip4tc0:$arch libip6tc0:$arch libiptc0:$arch libxtables12:$arch iptables-dev:$arch libatm1-dev:$arch libdb-dev:$arch pkg-config:$arch libnghttp2-14:$arch librtmp1:$arch libssh2-1:$arch libcjson1:$arch libcjson-dev:$arch libcurl4-openssl-dev:$arch libboost-thread1.67-dev:$arch libboost-thread-dev:$arch libboost-system1.67-dev:$arch libboost-system-dev:$arch libgtest-dev:$arch libgmock-dev:$arch +RUN eatmydata apt-get install -y libelf-dev:$arch libdw-dev:$arch libbz2-dev:$arch liblzo2-dev:$arch libedit-dev:$arch libevent-dev:$arch libopts25-dev:$arch libssl-dev:$arch pps-tools:$arch libpam-cap:$arch libcap-dev:$arch libpam0g-dev:$arch libaudit-dev:$arch libgtk-3-dev:$arch libkrb5-dev:$arch libsystemd-dev:$arch libwrap0-dev:$arch libkrb5-dev:$arch libboost1.67-dev:$arch libboost-dev:$arch libzmq5:$arch libzmq3-dev:$arch libdaemon-dev:$arch libjansson-dev:$arch libmnl-dev:$arch libsensors5:$arch libsensors4-dev:$arch libperl-dev:$arch libmariadb-dev:$arch libmariadb-dev-compat:$arch libpci-dev:$arch libjson-c3:$arch libjson-c-dev:$arch libreadline-dev:$arch librtr-dev:$arch librrd-dev:$arch libnetfilter-conntrack-dev:$arch libnetfilter-conntrack3:$arch libnfnetlink-dev:$arch libnftnl-dev:$arch libldap2-dev:$arch libbind-export-dev:$arch check:$arch libboost-atomic-dev:$arch libboost-test-dev:$arch libglib2.0-dev:$arch qt5-default:$arch libexplain-dev:$arch libc-ares-dev:$arch libip4tc0:$arch libip6tc0:$arch libiptc0:$arch libxtables12:$arch iptables-dev:$arch libatm1-dev:$arch libdb-dev:$arch pkgconf:$arch libnghttp2-14:$arch librtmp1:$arch libssh2-1:$arch libcjson1:$arch libcjson-dev:$arch libcurl4-openssl-dev:$arch libboost-thread1.67-dev:$arch libboost-thread-dev:$arch libboost-system1.67-dev:$arch libboost-system-dev:$arch libgtest-dev:$arch libgmock-dev:$arch RUN eatmydata apt-get install -y -t buster-backports \ libbpf-dev:$arch diff --git a/sonic-slave-trixie/Dockerfile.j2 b/sonic-slave-trixie/Dockerfile.j2 index c9f604c5f24..1aa3ce5e79c 100644 --- a/sonic-slave-trixie/Dockerfile.j2 +++ b/sonic-slave-trixie/Dockerfile.j2 @@ -363,6 +363,11 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install libevent-dev \ # For libyang swig \ + pkgconf \ + tcl-expect \ + libxxhash-dev \ +# For libyang3-py3 + python3-cffi \ # For build dtb device-tree-compiler \ # For sonic-mgmt-framework diff --git a/src/libyang1/Makefile b/src/libyang1/Makefile deleted file mode 100644 index a87f03bf638..00000000000 --- a/src/libyang1/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -.ONESHELL: -SHELL = /bin/bash -.SHELLFLAGS += -e - -LIBYANG_URL = https://sonicstorage.blob.core.windows.net/debian/pool/main/liby/libyang - -DSC_FILE = libyang_$(LIBYANG1_FULLVERSION).dsc -ORIG_FILE = libyang_$(LIBYANG1_VERSION).orig.tar.gz -DEBIAN_FILE = libyang_$(LIBYANG1_FULLVERSION).debian.tar.xz - -DSC_FILE_URL = $(LIBYANG_URL)/$(DSC_FILE) -ORIG_FILE_URL = $(LIBYANG_URL)/$(ORIG_FILE) -DEBIAN_FILE_URL = $(LIBYANG_URL)/$(DEBIAN_FILE) - -MAIN_TARGET = $(LIBYANG1) -DERIVED_TARGETS = $(LIBYANG1_DEV) $(LIBYANG1_DBG) $(LIBYANG1_CPP) $(LIBYANG1_CPP_DEV) $(LIBYANG1_CPP_DBG) $(YANG_TOOLS) $(LIBYANG1_TOOLS) $(LIBYANG1_TOOLS_DBG) - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - # Obtaining the libyang - rm -fr ./libyang-$(LIBYANG1_VERSION) - - # download debian libyang - wget -NO "$(DSC_FILE)" $(DSC_FILE_URL) - wget -NO "$(ORIG_FILE)" $(ORIG_FILE_URL) - wget -NO "$(DEBIAN_FILE)" $(DEBIAN_FILE_URL) - dpkg-source -x libyang_$(LIBYANG1_FULLVERSION).dsc - - pushd libyang-$(LIBYANG1_VERSION) - sed -i 's/set(LIBYANG_MAJOR_SOVERSION 1)/set(LIBYANG_MAJOR_SOVERSION 2)/' CMakeLists.txt - sed -i 's/libyang1/libyang2/' debian/libyang1.install - # Enable large file support for 32-bit arch - echo 'add_definitions(-D_FILE_OFFSET_BITS=64)' >> CMakeLists.txt - -ifeq ($(CROSS_BUILD_ENVIRON), y) - dpkg-buildpackage -rfakeroot -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) -else - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) -endif - popd - - # Move the newly-built .deb packages to the destination directory - mv $* $(DERIVED_TARGETS) $(DEST)/ - -$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/libyang2/.gitignore b/src/libyang2/.gitignore deleted file mode 100644 index a0991ff4402..00000000000 --- a/src/libyang2/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.gitignore -!Makefile diff --git a/src/libyang2/Makefile b/src/libyang2/Makefile deleted file mode 100644 index 16d80587573..00000000000 --- a/src/libyang2/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -.ONESHELL: -SHELL = /bin/bash -.SHELLFLAGS += -e - -LIBYANG_URL = https://sonicstorage.blob.core.windows.net/debian/pool/main/liby/libyang - -DSC_FILE = libyang2_$(LIBYANG2_FULLVERSION).dsc -ORIG_FILE = libyang2_$(LIBYANG2_VERSION).orig.tar.xz -DEBIAN_FILE = libyang2_$(LIBYANG2_FULLVERSION).debian.tar.xz - -DSC_FILE_URL = $(LIBYANG_URL)/$(DSC_FILE) -ORIG_FILE_URL = $(LIBYANG_URL)/$(ORIG_FILE) -DEBIAN_FILE_URL = $(LIBYANG_URL)/$(DEBIAN_FILE) - -MAIN_TARGET = $(LIBYANG2) -DERIVED_TARGETS = $(LIBYANG2_DEV) $(LIBYANG2_DBG) $(LIBYANG2_TOOLS) $(LIBYANG2_TOOLS_DBG) - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - # Obtaining the libyang - rm -fr ./libyang2-$(LIBYANG2_VERSION) - - # download debian libyang - wget -NO "$(DSC_FILE)" $(DSC_FILE_URL) - wget -NO "$(ORIG_FILE)" $(ORIG_FILE_URL) - wget -NO "$(DEBIAN_FILE)" $(DEBIAN_FILE_URL) - dpkg-source -x libyang2_$(LIBYANG2_FULLVERSION).dsc - - pushd libyang2-$(LIBYANG2_VERSION) - #The package libyang2.1.148 is taken from debian trixie, which only has dpkg-dev version 1.21.22 - #The bullseye package has dpkg-dev version 1.20.13 - #The VS package has dpkg-dev version 1.19.8 - sed -i 's/dpkg-dev (>= 1.22.5)/dpkg-dev (>= 1.19.8)/' debian/control - #sed -i 's/set(LIBYANG_MAJOR_SOVERSION 1)/set(LIBYANG_MAJOR_SOVERSION 2)/' CMakeLists.txt - #sed -i 's/libyang2/libyang2/' debian/libyang2.install - # Enable large file support for 32-bit arch - echo 'add_definitions(-D_FILE_OFFSET_BITS=64)' >> CMakeLists.txt - -ifeq ($(CROSS_BUILD_ENVIRON), y) - dpkg-buildpackage -rfakeroot -d -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) -else - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) -endif - - popd - - # Move the newly-built .deb packages to the destination directory - mv $* $(DERIVED_TARGETS) $(DEST)/ - -$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/libyang3-py3/Makefile b/src/libyang3-py3/Makefile new file mode 100644 index 00000000000..95fcf4ccd07 --- /dev/null +++ b/src/libyang3-py3/Makefile @@ -0,0 +1,24 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + +MAIN_TARGET = $(LIBYANG3_PY3) + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf ./libyang-python + # Obtain libyang-python + git clone --depth 1 -b v3.1.0 https://github.com/CESNET/libyang-python.git libyang-python + pushd ./libyang-python + + # Apply patch series + QUILT_PATCHES=../patch quilt push -a + + # Build package +ifeq ($(CROSS_BUILD_ENVIRON), y) + dpkg-buildpackage -rfakeroot -d -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) +else + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) +endif + popd + + mv $* $(DEST)/ diff --git a/src/libyang3-py3/patch/0001-debian.patch b/src/libyang3-py3/patch/0001-debian.patch new file mode 100644 index 00000000000..2167d2b43aa --- /dev/null +++ b/src/libyang3-py3/patch/0001-debian.patch @@ -0,0 +1,60 @@ +diff -ruN libyang-python.orig/debian/changelog libyang-python.new/debian/changelog +--- libyang-python.orig/debian/changelog 1970-01-01 00:00:00.000000000 +0000 ++++ libyang-python.new/debian/changelog 2025-02-09 12:45:51.113010546 +0000 +@@ -0,0 +1,5 @@ ++libyang-python (3.1.0-1) unstable; urgency=low ++ ++ * source package automatically created by stdeb 0.10.0 ++ ++ -- None Sat, 08 Feb 2025 20:55:02 +0000 +diff -ruN libyang-python.orig/debian/compat libyang-python.new/debian/compat +--- libyang-python.orig/debian/compat 1970-01-01 00:00:00.000000000 +0000 ++++ libyang-python.new/debian/compat 2025-02-09 12:45:51.113010546 +0000 +@@ -0,0 +1 @@ ++13 +diff -ruN libyang-python.orig/debian/control libyang-python.new/debian/control +--- libyang-python.orig/debian/control 1970-01-01 00:00:00.000000000 +0000 ++++ libyang-python.new/debian/control 2025-02-09 12:45:51.113010546 +0000 +@@ -0,0 +1,15 @@ ++Source: libyang-python ++Maintainer: None ++Section: python ++Priority: optional ++Build-Depends: dh-python, python3-setuptools, python3-all-dev, python3-cffi, debhelper (>= 13), libyang-dev ( >= 3.12.2) ++Standards-Version: 3.9.6 ++Homepage: https://github.com/CESNET/libyang-python ++ ++Package: python3-libyang ++Architecture: any ++Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends} ++Description: CFFI bindings to libyang ++ Python CFFI bindings to libyang ++ https://github.com/CESNET/libyang/ ++ +diff -ruN libyang-python.orig/debian/rules libyang-python.new/debian/rules +--- libyang-python.orig/debian/rules 1970-01-01 00:00:00.000000000 +0000 ++++ libyang-python.new/debian/rules 2025-02-09 12:45:51.113010546 +0000 +@@ -0,0 +1,9 @@ ++#!/usr/bin/make -f ++ ++# This file was automatically generated by stdeb 0.10.0 at ++# Sat, 08 Feb 2025 20:55:02 +0000 ++export PYBUILD_NAME=libyang ++ ++%: ++ dh $@ --with python3 --buildsystem=pybuild ++ +diff -ruN libyang-python.orig/debian/source/format libyang-python.new/debian/source/format +--- libyang-python.orig/debian/source/format 1970-01-01 00:00:00.000000000 +0000 ++++ libyang-python.new/debian/source/format 2025-02-09 12:45:51.113010546 +0000 +@@ -0,0 +1 @@ ++3.0 (quilt) +diff -ruN libyang-python.orig/debian/watch libyang-python.new/debian/watch +--- libyang-python.orig/debian/watch 1970-01-01 00:00:00.000000000 +0000 ++++ libyang-python.new/debian/watch 2025-02-09 12:45:51.113010546 +0000 +@@ -0,0 +1,4 @@ ++# please also check http://pypi.debian.net/libyang/watch ++version=3 ++opts=uversionmangle=s/(rc|a|b|c)/~$1/ \ ++http://pypi.debian.net/libyang/libyang-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) +\ No newline at end of file diff --git a/src/libyang3-py3/patch/0002-pr134-json-string-datatypes.patch b/src/libyang3-py3/patch/0002-pr134-json-string-datatypes.patch new file mode 100644 index 00000000000..d6e734616db --- /dev/null +++ b/src/libyang3-py3/patch/0002-pr134-json-string-datatypes.patch @@ -0,0 +1,101 @@ +From a5a26989d440d4e43c4dcd62ab7610c647adb110 Mon Sep 17 00:00:00 2001 +From: Brad House +Date: Sun, 16 Feb 2025 10:18:20 -0500 +Subject: [PATCH] data: option to allow json int/bool as strings + +Depends on https://github.com/CESNET/libyang/pull/2344 + +Add support for new option to python bindings. + +Signed-off-by: Brad House +--- + cffi/cdefs.h | 1 + + libyang/context.py | 6 ++++++ + libyang/data.py | 3 +++ + 3 files changed, 10 insertions(+) + +diff --git a/cffi/cdefs.h b/cffi/cdefs.h +index aa75004..de05f4a 100644 +--- a/cffi/cdefs.h ++++ b/cffi/cdefs.h +@@ -321,6 +321,7 @@ LY_ERR lyd_print_all(struct ly_out *, const struct lyd_node *, LYD_FORMAT, uint3 + #define LYD_PARSE_OPTS_MASK ... + #define LYD_PARSE_ORDERED ... + #define LYD_PARSE_STRICT ... ++#define LYD_PARSE_JSON_STRING_DATATYPES ... + + #define LYD_VALIDATE_NO_STATE ... + #define LYD_VALIDATE_PRESENT ... +diff --git a/libyang/context.py b/libyang/context.py +index f9bd5a5..b50600d 100644 +--- a/libyang/context.py ++++ b/libyang/context.py +@@ -533,6 +533,7 @@ def parse_data( + validate_multi_error: bool = False, + store_only: bool = False, + json_null: bool = False, ++ json_string_datatypes: bool = False, + ) -> Optional[DNode]: + if self.cdata is None: + raise RuntimeError("context already destroyed") +@@ -545,6 +546,7 @@ def parse_data( + strict=strict, + store_only=store_only, + json_null=json_null, ++ json_string_datatypes=json_string_datatypes, + ) + validation_flgs = validation_flags( + no_state=no_state, +@@ -604,6 +606,7 @@ def parse_data_mem( + validate_multi_error: bool = False, + store_only: bool = False, + json_null: bool = False, ++ json_string_datatypes: bool = False, + ) -> Optional[DNode]: + return self.parse_data( + fmt, +@@ -620,6 +623,7 @@ def parse_data_mem( + validate_multi_error=validate_multi_error, + store_only=store_only, + json_null=json_null, ++ json_string_datatypes=json_string_datatypes, + ) + + def parse_data_file( +@@ -637,6 +641,7 @@ def parse_data_file( + validate_multi_error: bool = False, + store_only: bool = False, + json_null: bool = False, ++ json_string_datatypes: bool = False, + ) -> Optional[DNode]: + return self.parse_data( + fmt, +@@ -653,6 +658,7 @@ def parse_data_file( + validate_multi_error=validate_multi_error, + store_only=store_only, + json_null=json_null, ++ json_string_datatypes=json_string_datatypes, + ) + + def __iter__(self) -> Iterator[Module]: +diff --git a/libyang/data.py b/libyang/data.py +index 0d63d3c..0d6f6cf 100644 +--- a/libyang/data.py ++++ b/libyang/data.py +@@ -117,6 +117,7 @@ def parser_flags( + strict: bool = False, + store_only: bool = False, + json_null: bool = False, ++ json_string_datatypes: bool = False, + ) -> int: + flags = 0 + if lyb_mod_update: +@@ -135,6 +136,8 @@ def parser_flags( + flags |= lib.LYD_PARSE_STORE_ONLY + if json_null: + flags |= lib.LYD_PARSE_JSON_NULL ++ if json_string_datatypes: ++ flags |= lib.LYD_PARSE_JSON_STRING_DATATYPES + return flags + + diff --git a/src/libyang3-py3/patch/0003-pr132-backlinks.patch b/src/libyang3-py3/patch/0003-pr132-backlinks.patch new file mode 100644 index 00000000000..395c640e7c6 --- /dev/null +++ b/src/libyang3-py3/patch/0003-pr132-backlinks.patch @@ -0,0 +1,331 @@ +From b5bdeb951239b6fe4a9774c280711fa2a503e260 Mon Sep 17 00:00:00 2001 +From: Brad House +Date: Sun, 16 Feb 2025 11:04:50 -0500 +Subject: [PATCH] schema/context: restore some backlinks support + +In libyang v1 the schema nodes had a backlinks member to be able to +look up dependents of the node. SONiC depends on this to provide +functionality it uses and it needs to be exposed via the python +module. + +In theory, exposing the 'dfs' functions could make this work, but +it would likely be cost prohibitive since walking the tree would +be expensive to create a python node for evaluation in native +python. + +Instead this PR depends on the this libyang PR: +https://github.com/CESNET/libyang/pull/2352 +And adds thin wrappers. + +This implementation provides 2 python functions: + * Context.find_backlinks_paths() - This function can + take the path of the base node and find all dependents. If + no path is specified, then it will return all nodes that contain + a leafref reference. + * Context.find_leafref_path_target_paths() - This function takes + an xpath, then returns all target nodes the xpath may reference. + Typically only one will be returned, but multiples may be in the + case of a union. + +A user can build a cache by combining Context.find_backlinks_paths() +with no path set and building a reverse table using +Context.find_leafref_path_target_paths() + +Signed-off-by: Brad House +--- + cffi/cdefs.h | 2 + + libyang/context.py | 100 +++++++++++++++++- + tests/test_schema.py | 58 ++++++++++ + .../yang/yolo/yolo-leafref-search-extmod.yang | 39 +++++++ + tests/yang/yolo/yolo-leafref-search.yang | 36 +++++++ + 5 files changed, 234 insertions(+), 1 deletion(-) + create mode 100644 tests/yang/yolo/yolo-leafref-search-extmod.yang + create mode 100644 tests/yang/yolo/yolo-leafref-search.yang + +diff --git a/cffi/cdefs.h b/cffi/cdefs.h +index aa75004..e7dc978 100644 +--- a/cffi/cdefs.h ++++ b/cffi/cdefs.h +@@ -861,6 +861,8 @@ const struct lysc_node* lys_find_child(const struct lysc_node *, const struct ly + const struct lysc_node* lysc_node_child(const struct lysc_node *); + const struct lysc_node_action* lysc_node_actions(const struct lysc_node *); + const struct lysc_node_notif* lysc_node_notifs(const struct lysc_node *); ++LY_ERR lysc_node_lref_targets(const struct lysc_node *, struct ly_set **); ++LY_ERR lysc_node_lref_backlinks(const struct ly_ctx *, const struct lysc_node *, ly_bool, struct ly_set **); + + typedef enum { + LYD_PATH_STD, +diff --git a/libyang/context.py b/libyang/context.py +index f9bd5a5..68b3f40 100644 +--- a/libyang/context.py ++++ b/libyang/context.py +@@ -4,7 +4,7 @@ + # SPDX-License-Identifier: MIT + + import os +-from typing import IO, Any, Callable, Iterator, Optional, Sequence, Tuple, Union ++from typing import IO, Any, Callable, Iterator, Optional, Sequence, Tuple, Union, List + + from _libyang import ffi, lib + from .data import ( +@@ -655,6 +655,104 @@ def parse_data_file( + json_null=json_null, + ) + ++ def find_leafref_path_target_paths(self, leafref_path: str) -> List[str]: ++ """ ++ Fetch all leafref targets of the specified path ++ ++ This is an enhanced version of lysc_node_lref_target() which will return ++ a set of leafref target paths retrieved from the specified schema path. ++ While lysc_node_lref_target() will only work on nodetype of LYS_LEAF and ++ LYS_LEAFLIST this function will also evaluate other datatypes that may ++ contain leafrefs such as LYS_UNION. This does not, however, search for ++ children with leafref targets. ++ ++ :arg self ++ This instance on context ++ :arg leafref_path: ++ Path to node to search for leafref targets ++ :returns List of target paths that the leafrefs of the specified node ++ point to. ++ """ ++ if self.cdata is None: ++ raise RuntimeError("context already destroyed") ++ if leafref_path is None: ++ raise RuntimeError("leafref_path must be defined") ++ ++ out = [] ++ ++ node = lib.lys_find_path(self.cdata, ffi.NULL, str2c(leafref_path), 0) ++ if node == ffi.NULL: ++ raise self.error("leafref_path not found") ++ ++ node_set = ffi.new("struct ly_set **") ++ if (lib.lysc_node_lref_targets(node, node_set) != lib.LY_SUCCESS or ++ node_set[0] == ffi.NULL or node_set[0].count == 0): ++ raise self.error("leafref_path does not contain any leafref targets") ++ ++ node_set = node_set[0] ++ for i in range(node_set.count): ++ path = lib.lysc_path(node_set.snodes[i], lib.LYSC_PATH_DATA, ffi.NULL, 0); ++ out.append(c2str(path)) ++ lib.free(path) ++ ++ lib.ly_set_free(node_set, ffi.NULL) ++ ++ return out ++ ++ ++ def find_backlinks_paths(self, match_path: str = None, match_ancestors: bool = False) -> List[str]: ++ """ ++ Search entire schema for nodes that contain leafrefs and return as a ++ list of schema node paths. ++ ++ Perform a complete scan of the schema tree looking for nodes that ++ contain leafref entries. When a node contains a leafref entry, and ++ match_path is specified, determine if reference points to match_path, ++ if so add the node's path to returned list. If no match_path is ++ specified, the node containing the leafref is always added to the ++ returned set. When match_ancestors is true, will evaluate if match_path ++ is self or an ansestor of self. ++ ++ This does not return the leafref targets, but the actual node that ++ contains a leafref. ++ ++ :arg self ++ This instance on context ++ :arg match_path: ++ Target path to use for matching ++ :arg match_ancestors: ++ Whether match_path is a base ancestor or an exact node ++ :returns List of paths. Exception of match_path is not found or if no ++ backlinks are found. ++ """ ++ if self.cdata is None: ++ raise RuntimeError("context already destroyed") ++ out = [] ++ ++ match_node = ffi.NULL ++ if match_path is not None and match_path == "/" or match_path == "": ++ match_path = None ++ ++ if match_path: ++ match_node = lib.lys_find_path(self.cdata, ffi.NULL, str2c(match_path), 0) ++ if match_node == ffi.NULL: ++ raise self.error("match_path not found") ++ ++ node_set = ffi.new("struct ly_set **") ++ if (lib.lysc_node_lref_backlinks(self.cdata, match_node, match_ancestors, node_set) ++ != lib.LY_SUCCESS or node_set[0] == ffi.NULL or node_set[0].count == 0): ++ raise self.error("backlinks not found") ++ ++ node_set = node_set[0] ++ for i in range(node_set.count): ++ path = lib.lysc_path(node_set.snodes[i], lib.LYSC_PATH_DATA, ffi.NULL, 0); ++ out.append(c2str(path)) ++ lib.free(path) ++ ++ lib.ly_set_free(node_set, ffi.NULL) ++ ++ return out ++ + def __iter__(self) -> Iterator[Module]: + """ + Return an iterator that yields all implemented modules from the context +diff --git a/tests/test_schema.py b/tests/test_schema.py +index a310aad..4aae73a 100644 +--- a/tests/test_schema.py ++++ b/tests/test_schema.py +@@ -801,6 +801,64 @@ def test_leaf_list_parsed(self): + self.assertFalse(pnode.ordered()) + + ++# ------------------------------------------------------------------------------------- ++class BacklinksTest(unittest.TestCase): ++ def setUp(self): ++ self.ctx = Context(YANG_DIR) ++ self.ctx.load_module("yolo-leafref-search") ++ self.ctx.load_module("yolo-leafref-search-extmod") ++ def tearDown(self): ++ self.ctx.destroy() ++ self.ctx = None ++ def test_backlinks_all_nodes(self): ++ expected = [ ++ "/yolo-leafref-search-extmod:my_extref_list/my_extref", ++ "/yolo-leafref-search:refstr", ++ "/yolo-leafref-search:refnum", ++ "/yolo-leafref-search-extmod:my_extref_list/my_extref_union" ++ ] ++ refs = self.ctx.find_backlinks_paths() ++ expected.sort() ++ refs.sort() ++ self.assertEqual(expected, refs) ++ def test_backlinks_one(self): ++ expected = [ ++ "/yolo-leafref-search-extmod:my_extref_list/my_extref", ++ "/yolo-leafref-search:refstr", ++ "/yolo-leafref-search-extmod:my_extref_list/my_extref_union" ++ ] ++ refs = self.ctx.find_backlinks_paths( ++ match_path="/yolo-leafref-search:my_list/my_leaf_string" ++ ) ++ expected.sort() ++ refs.sort() ++ self.assertEqual(expected, refs) ++ def test_backlinks_children(self): ++ expected = [ ++ "/yolo-leafref-search-extmod:my_extref_list/my_extref", ++ "/yolo-leafref-search:refstr", ++ "/yolo-leafref-search:refnum", ++ "/yolo-leafref-search-extmod:my_extref_list/my_extref_union" ++ ] ++ refs = self.ctx.find_backlinks_paths( ++ match_path="/yolo-leafref-search:my_list", ++ match_ancestors=True ++ ) ++ expected.sort() ++ refs.sort() ++ self.assertEqual(expected, refs) ++ def test_backlinks_leafref_target_paths(self): ++ expected = [ ++ "/yolo-leafref-search:my_list/my_leaf_string" ++ ] ++ refs = self.ctx.find_leafref_path_target_paths( ++ "/yolo-leafref-search-extmod:my_extref_list/my_extref" ++ ) ++ expected.sort() ++ refs.sort() ++ self.assertEqual(expected, refs) ++ ++ + # ------------------------------------------------------------------------------------- + class ChoiceTest(unittest.TestCase): + def setUp(self): +diff --git a/tests/yang/yolo/yolo-leafref-search-extmod.yang b/tests/yang/yolo/yolo-leafref-search-extmod.yang +new file mode 100644 +index 0000000..046ceec +--- /dev/null ++++ b/tests/yang/yolo/yolo-leafref-search-extmod.yang +@@ -0,0 +1,39 @@ ++module yolo-leafref-search-extmod { ++ yang-version 1.1; ++ namespace "urn:yang:yolo:leafref-search-extmod"; ++ prefix leafref-search-extmod; ++ ++ import wtf-types { prefix types; } ++ ++ import yolo-leafref-search { ++ prefix leafref-search; ++ } ++ ++ revision 2025-02-11 { ++ description ++ "Initial version."; ++ } ++ ++ list my_extref_list { ++ key my_leaf_string; ++ leaf my_leaf_string { ++ type string; ++ } ++ leaf my_extref { ++ type leafref { ++ path "/leafref-search:my_list/leafref-search:my_leaf_string"; ++ } ++ } ++ leaf my_extref_union { ++ type union { ++ type leafref { ++ path "/leafref-search:my_list/leafref-search:my_leaf_string"; ++ } ++ type leafref { ++ path "/leafref-search:my_list/leafref-search:my_leaf_number"; ++ } ++ type types:number; ++ } ++ } ++ } ++} +diff --git a/tests/yang/yolo/yolo-leafref-search.yang b/tests/yang/yolo/yolo-leafref-search.yang +new file mode 100644 +index 0000000..5f4af48 +--- /dev/null ++++ b/tests/yang/yolo/yolo-leafref-search.yang +@@ -0,0 +1,36 @@ ++module yolo-leafref-search { ++ yang-version 1.1; ++ namespace "urn:yang:yolo:leafref-search"; ++ prefix leafref-search; ++ ++ import wtf-types { prefix types; } ++ ++ revision 2025-02-11 { ++ description ++ "Initial version."; ++ } ++ ++ list my_list { ++ key my_leaf_string; ++ leaf my_leaf_string { ++ type string; ++ } ++ leaf my_leaf_number { ++ description ++ "A number."; ++ type types:number; ++ } ++ } ++ ++ leaf refstr { ++ type leafref { ++ path "../my_list/my_leaf_string"; ++ } ++ } ++ ++ leaf refnum { ++ type leafref { ++ path "../my_list/my_leaf_number"; ++ } ++ } ++} diff --git a/src/libyang3-py3/patch/series b/src/libyang3-py3/patch/series new file mode 100644 index 00000000000..f7757dabfd5 --- /dev/null +++ b/src/libyang3-py3/patch/series @@ -0,0 +1,3 @@ +0001-debian.patch +0002-pr134-json-string-datatypes.patch +0003-pr132-backlinks.patch diff --git a/src/libyang1/.gitignore b/src/libyang3/.gitignore similarity index 58% rename from src/libyang1/.gitignore rename to src/libyang3/.gitignore index a0991ff4402..644cdde57ba 100644 --- a/src/libyang1/.gitignore +++ b/src/libyang3/.gitignore @@ -1,3 +1,5 @@ * !.gitignore !Makefile +!patch +!patch/** diff --git a/src/libyang3/Makefile b/src/libyang3/Makefile new file mode 100644 index 00000000000..0c54fd5c478 --- /dev/null +++ b/src/libyang3/Makefile @@ -0,0 +1,44 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +LIBYANG_URL = http://debian-archive.trafficmanager.net/debian/pool/main/liby/libyang + +MAIN_TARGET = $(LIBYANG3) +DERIVED_TARGETS = $(LIBYANG3_DEV) $(LIBYANG3_DBG) $(LIBYANG3_TOOLS) $(LIBYANG3_TOOLS_DBG) + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtaining the libyang + rm -fr ./libyang-$(LIBYANG3_VERSION) + + # download debian libyang + dget -u $(LIBYANG_URL)/libyang_$(LIBYANG3_FULLVERSION).dsc + + pushd libyang-$(LIBYANG3_VERSION) + # The package libyang3.12.2 is taken from debian trixie + + # Enable large file support for 32-bit arch + echo 'add_definitions(-D_FILE_OFFSET_BITS=64)' >> CMakeLists.txt + + # Apply patch series + patch -p1 < ../patch/0001-pr2362-lyd_validate_noextdeps.patch + + # Debian buster and below do not have new enough versions of xxhash and + # build fails. xxhash is an optimization, not a real dependency. + if [ "`lsb_release -r | awk '{ print $$2 }'`" -le "10" ] ; then \ + sed -i -e '/.*libxxhash.*/d' debian/control; \ + sed -i -e 's/^find_package(XXHash)/#find_package(XXHash)/' CMakeLists.txt; \ + fi + +ifeq ($(CROSS_BUILD_ENVIRON), y) + dpkg-buildpackage -rfakeroot -d -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) +else + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) +endif + + popd + + # Move the newly-built .deb packages to the destination directory + mv $* $(DERIVED_TARGETS) $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/libyang3/patch/0001-pr2362-lyd_validate_noextdeps.patch b/src/libyang3/patch/0001-pr2362-lyd_validate_noextdeps.patch new file mode 100644 index 00000000000..ddbb968650d --- /dev/null +++ b/src/libyang3/patch/0001-pr2362-lyd_validate_noextdeps.patch @@ -0,0 +1,345 @@ +From cfc94cc0d66524f453ccd781e9d252e8fc3ae711 Mon Sep 17 00:00:00 2001 +From: Brad House +Date: Sun, 23 Feb 2025 12:25:04 -0500 +Subject: [PATCH] validation: Add LYD_VALIDATE_NOEXTDEPS to bypass + leafref/when/must + +In libyang v1, there was an LYD_OPT_NOEXTDEPS flag. This was +removed, and this patch re-adds a flag with similar functionality. +--- + src/parser_data.h | 3 +- + src/validation.c | 85 ++++++++++++++++++++++++++--------------------- + 2 files changed, 49 insertions(+), 39 deletions(-) + +diff --git a/src/parser_data.h b/src/parser_data.h +index ddb22781e..292eda86f 100644 +--- a/src/parser_data.h ++++ b/src/parser_data.h +@@ -222,7 +222,8 @@ struct ly_in; + #define LYD_VALIDATE_NOT_FINAL 0x0020 /**< Skip final validation tasks that require for all the data nodes to + either exist or not, based on the YANG constraints. Once the data + satisfy this requirement, the final validation should be performed. */ +- ++#define LYD_VALIDATE_NOEXTDEPS 0x0040 /**< Allow external dependencies (external leafrefs, instance-identifiers, ++ must, and when) to not be resolved/satisfied during validation. */ + #define LYD_VALIDATE_OPTS_MASK 0x0000FFFF /**< Mask for all the LYD_VALIDATE_* options. */ + + /** @} datavalidationoptions */ +diff --git a/src/validation.c b/src/validation.c +index a436816fe..ac1822ae9 100644 +--- a/src/validation.c ++++ b/src/validation.c +@@ -41,18 +41,22 @@ + #include "xpath.h" + + /** +- * @brief Check validation error taking into account multi-error validation. ++ * @brief Check validation error taking into account multi-error validation and ++ * possible skipping of external dependency validation. + * + * @param[in] r Local return value. + * @param[in] err_cmd Command to perform on any error. ++ * @param[in] err_item Optional, may be NULL. Full error to evaluate. + * @param[in] val_opts Validation options. + * @param[in] label Label to go to on fatal error. + */ +-#define LY_VAL_ERR_GOTO(r, err_cmd, val_opts, label) \ ++#define LY_VAL_ERR_GOTO(r, err_cmd, err_item, val_opts, label) \ + if (r) { \ +- err_cmd; \ +- if ((r != LY_EVALID) || !(val_opts & LYD_VALIDATE_MULTI_ERROR)) { \ +- goto label; \ ++ if (!(val_opts & LYD_VALIDATE_NOEXTDEPS) || (r != LY_EVALID) || ((err_item) == NULL) || ((err_item)->apptag == NULL) || (strcmp((err_item)->apptag, "instance-required") != 0)) { \ ++ err_cmd; \ ++ if ((r != LY_EVALID) || !(val_opts & LYD_VALIDATE_MULTI_ERROR)) { \ ++ goto label; \ ++ } \ + } \ + } + +@@ -412,7 +416,7 @@ lyd_validate_unres_when(struct lyd_node **tree, const struct lys_module *mod, st + /* invalid data */ + LOGVAL(LYD_CTX(node), LY_VCODE_NOWHEN, disabled->cond->expr); + r = LY_EVALID; +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, error); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(node)), val_opts, error); + } + } else { + /* when true */ +@@ -423,7 +427,7 @@ lyd_validate_unres_when(struct lyd_node **tree, const struct lys_module *mod, st + ly_set_rm_index_ordered(node_when, i, NULL); + } else if (r != LY_EINCOMPLETE) { + /* error */ +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, error); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(node)), val_opts, error); + } + + LOG_LOCBACK(1, 1); +@@ -454,7 +458,7 @@ lyd_validate_unres(struct lyd_node **tree, const struct lys_module *mod, enum ly + + /* validate extension data */ + r = ext_v->ext->def->plugin->validate(ext_v->ext, ext_v->sibling, *tree, data_type, val_opts, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*tree)), val_opts, cleanup); + + /* remove this item from the set */ + ly_set_rm_index(ext_val, i, free); +@@ -471,21 +475,21 @@ lyd_validate_unres(struct lyd_node **tree, const struct lys_module *mod, enum ly + + /* validate the node */ + r = ext_n->ext->def->plugin->node(ext_n->ext, ext_n->node, val_opts); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*tree)), val_opts, cleanup); + + /* remove this item from the set */ + ly_set_rm_index(ext_node, i, free); + } while (i); + } + +- if (node_when) { ++ if (node_when && !(val_opts & LYD_VALIDATE_NOEXTDEPS)) { + /* evaluate all when conditions */ + uint32_t prev_count; + + do { + prev_count = node_when->count; + r = lyd_validate_unres_when(tree, mod, node_when, val_opts, when_xp_opts, node_types, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*tree)), val_opts, cleanup); + + /* there must have been some when conditions resolved */ + } while (prev_count > node_when->count); +@@ -513,7 +517,7 @@ lyd_validate_unres(struct lyd_node **tree, const struct lys_module *mod, enum ly + LOG_LOCSET(NULL, &node->node); + r = lyd_value_validate_incomplete(LYD_CTX(node), type, &node->value, &node->node, *tree); + LOG_LOCBACK(0, 1); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(node)), val_opts, cleanup); + + /* remove this node from the set */ + ly_set_rm_index(node_types, i, NULL); +@@ -532,7 +536,7 @@ lyd_validate_unres(struct lyd_node **tree, const struct lys_module *mod, enum ly + /* validate and store the value of the metadata */ + lyplg_ext_get_storage(meta->annotation, LY_STMT_TYPE, sizeof type, (const void **)&type); + r = lyd_value_validate_incomplete(LYD_CTX(meta->parent), type, &meta->value, meta->parent, *tree); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(meta->parent)), val_opts, cleanup); + + /* remove this attr from the set */ + ly_set_rm_index(meta_types, i, NULL); +@@ -926,11 +930,11 @@ lyd_validate_choice_r(struct lyd_node **first, const struct lysc_node *sparent, + for (i = 0; *first && choices[i]; ++i) { + /* check case duplicites */ + r = lyd_validate_cases(first, mod, (struct lysc_node_choice *)choices[i], diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*first)), val_opts, cleanup); + + /* check for nested choice */ + r = lyd_validate_choice_r(first, choices[i], mod, ext, val_opts, int_opts, getnext_ht, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*first)), val_opts, cleanup); + } + + cleanup: +@@ -950,7 +954,7 @@ lyd_validate_new(struct lyd_node **first, const struct lysc_node *sparent, const + + /* validate choices */ + r = lyd_validate_choice_r(first, sparent, mod, ext, val_opts, int_opts, getnext_ht, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*first)), val_opts, cleanup); + + node = *first; + while (node) { +@@ -982,7 +986,7 @@ lyd_validate_new(struct lyd_node **first, const struct lysc_node *sparent, const + if (node->flags & LYD_NEW) { + /* then check new node instance duplicities */ + r = lyd_validate_duplicates(*first, node, val_opts); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*first)), val_opts, cleanup); + + /* this node is valid */ + node->flags &= ~LYD_NEW; +@@ -1100,7 +1104,7 @@ lyd_validate_mandatory(const struct lyd_node *first, const struct lyd_node *pare + } + + disabled = NULL; +- if (lysc_has_when(snode)) { ++ if (lysc_has_when(snode) && !(val_opts & LYD_VALIDATE_NOEXTDEPS)) { + /* if there are any when conditions, they must be true for a validation error */ + LY_CHECK_RET(lyd_validate_dummy_when(first, parent, snode, &disabled)); + } +@@ -1177,7 +1181,7 @@ lyd_validate_minmax(const struct lyd_node *first, const struct lyd_node *parent, + assert(count < min); + + disabled = NULL; +- if (lysc_has_when(snode)) { ++ if (lysc_has_when(snode) && !(val_opts & LYD_VALIDATE_NOEXTDEPS)) { + /* if there are any when conditions, they must be true for a validation error */ + LY_CHECK_RET(lyd_validate_dummy_when(first, parent, snode, &disabled)); + } +@@ -1553,7 +1557,7 @@ lyd_validate_siblings_schema_r(const struct lyd_node *first, const struct lyd_no + if (snode->flags & LYS_MAND_TRUE) { + /* check generic mandatory existence */ + r = lyd_validate_mandatory(first, parent, snode, val_opts); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(first)), val_opts, cleanup); + } + + /* find the existing case, if any */ +@@ -1561,7 +1565,7 @@ lyd_validate_siblings_schema_r(const struct lyd_node *first, const struct lyd_no + if (lys_getnext_data(NULL, first, NULL, scase, NULL)) { + /* validate only this case */ + r = lyd_validate_siblings_schema_r(first, parent, scase, mod, ext, val_opts, int_opts, getnext_ht); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(first)), val_opts, cleanup); + break; + } + } +@@ -1580,25 +1584,25 @@ lyd_validate_siblings_schema_r(const struct lyd_node *first, const struct lyd_no + slist = (struct lysc_node_list *)snode; + if (slist->min || (slist->max < UINT32_MAX)) { + r = lyd_validate_minmax(first, parent, snode, slist->min, slist->max, val_opts); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(first)), val_opts, cleanup); + } + + /* check unique */ + if (slist->uniques) { + r = lyd_validate_unique(first, snode, (const struct lysc_node_leaf ***)slist->uniques, val_opts); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(first)), val_opts, cleanup); + } + } else if (snode->nodetype == LYS_LEAFLIST) { + sllist = (struct lysc_node_leaflist *)snode; + if (sllist->min || (sllist->max < UINT32_MAX)) { + r = lyd_validate_minmax(first, parent, snode, sllist->min, sllist->max, val_opts); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(first)), val_opts, cleanup); + } + + } else if (snode->flags & LYS_MAND_TRUE) { + /* check generic mandatory existence */ + r = lyd_validate_mandatory(first, parent, snode, val_opts); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(first)), val_opts, cleanup); + } + } + +@@ -1649,6 +1653,11 @@ lyd_validate_must(const struct lyd_node *node, uint32_t val_opts, uint32_t int_o + const char *emsg, *eapptag; + LY_ARRAY_COUNT_TYPE u; + ++ /* Must validation has been bypassed */ ++ if (val_opts & LYD_VALIDATE_NOEXTDEPS) { ++ return LY_SUCCESS; ++ } ++ + assert((int_opts & (LYD_INTOPT_RPC | LYD_INTOPT_REPLY)) != (LYD_INTOPT_RPC | LYD_INTOPT_REPLY)); + assert((int_opts & (LYD_INTOPT_ACTION | LYD_INTOPT_REPLY)) != (LYD_INTOPT_ACTION | LYD_INTOPT_REPLY)); + +@@ -1710,7 +1719,7 @@ lyd_validate_must(const struct lyd_node *node, uint32_t val_opts, uint32_t int_o + } + LOG_LOCBACK(0, 1); + r = LY_EVALID; +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(node)), val_opts, cleanup); + } + } + } +@@ -1794,12 +1803,12 @@ lyd_validate_final_r(struct lyd_node *first, const struct lyd_node *parent, cons + /* node value was checked by plugins */ + + next_iter: +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(node)), val_opts, cleanup); + } + + /* validate schema-based restrictions */ + r = lyd_validate_siblings_schema_r(first, parent, sparent, mod, ext, val_opts, int_opts, getnext_ht); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(first)), val_opts, cleanup); + + LY_LIST_FOR(first, node) { + if (!node->schema || (!node->parent && mod && (lyd_owner_module(node) != mod))) { +@@ -1810,7 +1819,7 @@ lyd_validate_final_r(struct lyd_node *first, const struct lyd_node *parent, cons + /* validate all children recursively */ + r = lyd_validate_final_r(lyd_child(node), node, node->schema, NULL, NULL, val_opts, int_opts, must_xp_opts, + getnext_ht); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(node)), val_opts, cleanup); + + /* set default for containers */ + lyd_np_cont_dflt_set(node); +@@ -1947,7 +1956,7 @@ lyd_validate_subtree(struct lyd_node *root, struct ly_set *node_when, struct ly_ + } else if (node->schema->nodetype & LYD_NODE_INNER) { + /* new node validation, autodelete */ + r = lyd_validate_new(lyd_node_child_p(node), node->schema, NULL, NULL, val_opts, int_opts, getnext_ht, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(root)), val_opts, cleanup); + + /* add nested defaults */ + impl_opts = 0; +@@ -2027,7 +2036,7 @@ lyd_validate(struct lyd_node **tree, const struct lys_module *module, const stru + /* validate new top-level nodes of this module, autodelete */ + r = lyd_validate_new(first2, *first2 ? lysc_data_parent((*first2)->schema) : NULL, mod, NULL, val_opts, 0, + getnext_ht, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(ctx), val_opts, cleanup); + + /* add all top-level defaults for this module, if going to validate subtree, do not add into unres sets + * (lyd_validate_subtree() adds all the nodes in that case) */ +@@ -2066,19 +2075,19 @@ lyd_validate(struct lyd_node **tree, const struct lys_module *module, const stru + + r = lyd_validate_subtree(iter, node_when_p, node_types_p, meta_types_p, ext_node_p, ext_val_p, + val_opts, 0, getnext_ht, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(ctx), val_opts, cleanup); + } + } + + /* finish incompletely validated terminal values/attributes and when conditions */ + r = lyd_validate_unres(first2, mod, LYD_TYPE_DATA_YANG, node_when_p, 0, node_types_p, meta_types_p, + ext_node_p, ext_val_p, val_opts, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(ctx), val_opts, cleanup); + + if (!(val_opts & LYD_VALIDATE_NOT_FINAL)) { + /* perform final validation that assumes the data tree is final */ + r = lyd_validate_final_r(*first2, NULL, NULL, mod, NULL, val_opts, 0, 0, getnext_ht); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(ctx), val_opts, cleanup); + } + + /* free the getnext hash table */ +@@ -2127,19 +2136,19 @@ lyd_validate_ext(struct lyd_node **tree, const struct lysc_ext_instance *ext, ui + LY_LIST_FOR(*tree, iter) { + r = lyd_validate_subtree(iter, node_when_p, node_types_p, meta_types_p, ext_node_p, ext_val_p, + val_opts, 0, getnext_ht, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(iter)), val_opts, cleanup); + } + } + + /* finish incompletely validated terminal values/attributes and when conditions */ + r = lyd_validate_unres(tree, NULL, LYD_TYPE_DATA_YANG, node_when_p, 0, node_types_p, meta_types_p, + ext_node_p, ext_val_p, val_opts, diff); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*tree)), val_opts, cleanup); + + if (!(val_opts & LYD_VALIDATE_NOT_FINAL)) { + /* perform final validation that assumes the data tree is final */ + r = lyd_validate_final_r(*tree, NULL, NULL, NULL, ext, val_opts, 0, 0, getnext_ht); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(*tree)), val_opts, cleanup); + } + + cleanup: +@@ -2201,7 +2210,7 @@ lyd_validate_module_final(struct lyd_node *tree, const struct lys_module *module + + /* perform final validation that assumes the data tree is final */ + r = lyd_validate_final_r(first, NULL, NULL, mod, NULL, val_opts, 0, 0, getnext_ht); +- LY_VAL_ERR_GOTO(r, rc = r, val_opts, cleanup); ++ LY_VAL_ERR_GOTO(r, rc = r, ly_err_last(LYD_CTX(tree)), val_opts, cleanup); + + cleanup: + lyd_val_getnext_ht_free(getnext_ht); diff --git a/src/libyang3/patch/series b/src/libyang3/patch/series new file mode 100644 index 00000000000..98ff40e2c27 --- /dev/null +++ b/src/libyang3/patch/series @@ -0,0 +1 @@ +0001-pr2362-lyd_validate_noextdeps.patch diff --git a/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py b/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py index ac6a4236cd2..f13a0643527 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py +++ b/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py @@ -39,18 +39,28 @@ class Test_yang_models: def initTest(self): self.defaultYANGFailure = { 'Must': ['Must condition', 'not satisfied'], - 'InvalidValue': ['Invalid value'], - 'LeafRef': ['Leafref', 'non-existing'], + 'InvalidValue': ['Invalid value'], # libyang3: ['Invalid', 'value', 'Data path'] + 'LeafRef': ['Leafref', 'non-existing'], #libyang3: ['Invalid leafref', 'no target instance'] 'When': ['When condition', 'not satisfied'], - 'Pattern': ['pattern', 'does not satisfy'], - 'Mandatory': ['required element', 'Missing'], + 'Pattern': ['pattern', 'does not satisfy'], #libyang3: ['pattern', 'Unsatisfied pattern'] + 'Mandatory': ['required element', 'Missing'], #libyang3: ['Mandatory node', 'does not exist'] 'Verify': ['verified'], - 'Range': ['does not satisfy', 'range'], + 'Range': ['does not satisfy', 'range'], #libyang3: ['Unsatisfied range'] 'MinElements': ['Too few'], 'MaxElements': ['Too many'], 'UnknownElement': ['Unknown element'], 'Missing': ['Missing required element'], - 'None': [] + 'None': [], +# New keys are needed for libyang3's messages which are different. Go +# ahead and add them now with the libyang1 values (which are duplicates +# of the above). This will make migrating to libyang3 easier with less +# code review. + 'Length': ['does not satisfy', 'range'], # libyang3: ['Unsatisfied length'] + 'DecimalFractionExceed': ['Invalid value'], # libyang3: ['Value', 'exceeds defined number', 'fraction digits'] + 'Bounds': ['Invalid value'], #libyang3 ['Value', 'out of type', 'min/max bounds'], + 'ListKey': ['Missing required element'], #libyang3 ['List instance is missing its key'] + 'DateTime': ['pattern', 'does not satisfy'], #libyang3: ['Invalid date-and-time'] + 'IPv4': ['pattern', 'does not satisfy'], #libyang3 ['Failed to convert IPv4 address'], } self.ExceptionTests = { } 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 0cca8eb2cc8..720b3f1ab86 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 @@ -195,7 +195,7 @@ }, "ACL_INNERSRCMACREWRITE_INVALID_TUNNEL_VNI": { "desc": "Configure INNERSRCMACREWRITE ACL with invalid VNI ID", - "eStrKey": "Pattern" + "eStrKey": "Range" }, "ACL_RULE_WITH_TUNNEL_VNI":{ "desc": "Configure a ACL rule with VNI ID" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/asic-sensors.json b/src/sonic-yang-models/tests/yang_model_tests/tests/asic-sensors.json index 227904f4008..d94587f6ac7 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/asic-sensors.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/asic-sensors.json @@ -4,7 +4,7 @@ }, "ASIC_SENSORS_INVALID_POLLER_INTERVAL": { "desc": "Configure an invalid ASIC Sensors polling interval", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "ASIC_SENSORS_INVALID_POLLER_ADMIN_STATUS": { "desc": "Configure an invalid ASIC Sensors polling admin status", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/auto_techsupport.json b/src/sonic-yang-models/tests/yang_model_tests/tests/auto_techsupport.json index a335dcfd389..dc6af878a9e 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/auto_techsupport.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/auto_techsupport.json @@ -12,14 +12,14 @@ }, "AUTO_TECHSUPPORT_OUT_OF_RANGE_DECIMAL": { "desc" : "Configure a value for core-uage outside the range [0, 100)", - "eStr": "Value \"100.00\" does not satisfy the constraint \"0..99.99\" (range, length, or pattern)." + "eStrKey": "Range" }, "AUTO_TECHSUPPORT_VALID_DECIMAL_VALUE": { "desc" : "Configure a value for max_techsupport_size inside the range [0, 100)" }, "AUTO_TECHSUPPORT_INVALID_FRACTION_DIGITS": { "desc" : "Configure a value for max_techsupport_size inside the range [0, 100) but with 3 fractional digits", - "eStrKey": "InvalidValue" + "eStrKey": "DecimalFractionExceed" }, "AUTO_TECHSUPPORT_RATE_LIMIT_INTERVAL_TEST": { "desc" : "Configure and test the valid configuration" @@ -29,13 +29,13 @@ }, "AUTO_TECHSUPPORT_INVALID_AVAILABLE_MEM_THRESHOLD": { "desc" : "Configure a value for available_mem_threshold inside the range [0, 100) but with 3 fractional digits", - "eStrKey": "InvalidValue" + "eStrKey": "DecimalFractionExceed" }, "AUTO_TECHSUPPORT_GLOBAL_MEM_THRESHOLD_VALID": { "desc" : "Configure and test the valid configuration" }, "AUTO_TECHSUPPORT_GLOBAL_MEM_THRESHOLD_INVALID_THRESHOLD": { "desc" : "Configure a value for available_mem_threshold inside the range [0, 100) but with 3 fractional digits", - "eStrKey": "InvalidValue" + "eStrKey": "DecimalFractionExceed" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json index 476c9c2d47c..0118a5f1b1a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json @@ -51,8 +51,7 @@ }, "BGP_NEIGHBOR_NEG_INVALID_NAME": { "desc": "Incorrect neighbor name.", - "eStrKey": "InvalidValue", - "eStr": ["neighbor"] + "eStrKey": "InvalidValue" }, "BGP_NEIGHBOR_NEG_INVALID_ASN": { "desc": "Invalid local AS number.", @@ -78,7 +77,7 @@ }, "BGP_NEIGHBOR_AF_NEG_INVALID_MAXTHRESHOLD": { "desc": "Invalid maximum prefix warning threshold in neighbor AF.", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "BGP_NEIGHBOR_AF_NEG_INVALID_SOFT_RECFG_IN": { "desc": "Invalid boolean value for soft reconfiguration-in in neighbor AF.", @@ -118,11 +117,11 @@ }, "BGP_PEERGROUP_INVALID_HOPS": { "desc": "Invalid TTL hops for peergroup.", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "BGP_PEERGROUP_AF_INVALID_MAXTHRESHOLD": { "desc": "Invalid maximum prefix warning threshold in peergroup AF.", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "BGP_PEERGROUP_AF_INVALID_SOFT_RECFG_IN": { "desc": "Invalid boolean value for soft reconfiguration-in in peergroup AF.", @@ -157,7 +156,7 @@ }, "BGP_NEIGHBOR_NEG_INVALID_HOPS": { "desc": "Invalid TTL hops for unnumbered interface neigbhor.", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "BGP_MONITORS_ALL_VALID": { "desc": "Configure BGP monitor table." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json index ff35fc7357d..f8557fb2503 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json @@ -48,7 +48,7 @@ }, "BUFFER_POOL_WRONG_PERCENTAGE_NEGATIVE_VALUE": { "desc": "BUFFER_POOL_WRONG_PERCENTAGE_NEGATIVE_VALUE pattern failure.", - "eStr": "Invalid value" + "eStrKey": "Bounds" }, "BUFFER_POOL_WRONG_PERCENTAGE_NOT_A_NUMBER_VALUE": { "desc": "BUFFER_POOL_WRONG_PERCENTAGE_NOT_A_NUMBER_VALUE pattern failure.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/debug_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests/debug_counter.json index 17332ecbc43..a4309f212f7 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/debug_counter.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/debug_counter.json @@ -11,7 +11,7 @@ }, "DEBUG_COUNTER_MISSING_COUNTER_TYPE": { "desc": "One debug counter with missing type", - "eStrKey": "Missing" + "eStrKey": "Mandatory" }, "NONEXIST_DEBUG_COUNTER_FOR_DROP_REASON": { "desc": "Add a drop reason for a non-existent counter", 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 62960cf2b3d..2542f7dee19 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 @@ -98,7 +98,7 @@ }, "DEVICE_METADATA_INCORRECT_BUFFER_MODEL_PATTERN": { "desc": "DEVICE_METADATA wrong value for BUFFER_MODEL field.", - "eStr": ["pattern", "does not satisfy"] + "eStrKey": "Pattern" }, "DEVICE_METADATA_FRR_MGMT_FWK_CONFIG": { "desc": "Verifying FRR MGMT framework configuration." @@ -142,7 +142,7 @@ }, "DEVICE_METADATA_INVALID_PEER_SWITCH": { "desc": "Verifying test fails with hostname that is too long", - "eStrKey": "Range" + "eStrKey": "Length" }, "DEVICE_METADATA_VALID_STORAGE_DEVICE": { "desc": "Verifying valid storage device value" @@ -193,7 +193,7 @@ }, "DEVICE_METADATA_INVALID_TIMEZONE": { "desc": "Verifying invalid timezone value", - "eStrKey": "Range" + "eStrKey": "Length" }, "DEVICE_METADATA_VALID_CREATE_ONLY_CONFIG_DB_BUFFERS": { "desc": "Verifying the create_only_config_db_buffers value" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server_ipv4.json b/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server_ipv4.json index 3e7829b41b0..0f99827112a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server_ipv4.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server_ipv4.json @@ -12,7 +12,7 @@ }, "DHCP_SERVER_IPV4_INCORRECT_NETMASK": { "desc": "Add netmask which is not in correct ip-prefix format.", - "eStrKey": "Pattern" + "eStrKey": "IPv4" }, "DHCP_SERVER_IPV4_STATE_WRONG_VALUE": { "desc": "Configure wrong value for state.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/fine-grained-ecmp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/fine-grained-ecmp.json index 3ee44daea74..a024983d27c 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/fine-grained-ecmp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/fine-grained-ecmp.json @@ -38,15 +38,15 @@ }, "FG_NHG_MEMBER_TEST_MISSING_FG_NHG_REF": { "desc": "Fine-grained ECMP next-hop member configuration with missing FG_NHG reference in FG_NHG_MEMBER_LIST table.", - "eStr": "Missing required element \"FG_NHG\" in \"FG_NHG_MEMBER_LIST\". " + "eStrKey": "Mandatory" }, "FG_NHG_PREFIX_TEST_MISSING_FG_NHG_REF": { "desc": "Fine-grained ECMP prefix configuration with missing FG_NHG reference in FG_NHG_PREFIX_LIST table.", - "eStr": "Missing required element \"FG_NHG\" in \"FG_NHG_PREFIX_LIST\". " + "eStrKey": "Mandatory" }, "FG_NHG_MEMBER_TEST_MISSING_BANK": { "desc": "Fine-grained ECMP next-hop member configuration with missing bank in FG_NHG_MEMBER_LIST table.", - "eStr": "Missing required element \"bank\"" + "eStrKey": "Mandatory" }, "FG_NHG_PREFIX_TEST_DUPLICATE_ENTRY": { "desc": "Fine-grained ECMP prefix configuration with duplicate entry in FG_NHG_PREFIX_LIST table.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json index a508400f26d..ea3e7ded392 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json @@ -4,16 +4,14 @@ }, "FLEX_COUNTER_TABLE_WITH_INVALID_POLL_INTERVAL": { "desc": "Out of range poll interval.", - "eStrKey": "Range", - "eStr": "100..4294967295" + "eStrKey": "Range" }, "FLEX_COUNTER_TABLE_WITH_VALID_BULK_CHUNK_SIZE": { "desc": "FLEX_COUNTER_TABLE_WITH_VALID_BULK_CHUNK_SIZE no failure." }, "FLEX_COUNTER_TABLE_WITH_INVALID_BULK_CHUNK_SIZE": { "desc": "Out of range bulk chunk size.", - "eStrKey": "Range", - "eStr": "1..4294967295" + "eStrKey": "Range" }, "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_VRF": { "desc": "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_VRF no failure." @@ -23,7 +21,6 @@ }, "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_INVALID_MAX_MATCH_COUNT": { "desc": "Out of range max_match_count.", - "eStrKey": "Range", - "eStr": "1..50" + "eStrKey": "Range" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/kdump.json b/src/sonic-yang-models/tests/yang_model_tests/tests/kdump.json index 9f9525c2231..8f065dc4f25 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/kdump.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/kdump.json @@ -10,11 +10,11 @@ }, "KDUMP_WITH_INVALID_NUM_DUMPS": { "desc": "Configuring kdump config with a invalid number of allowed kdumps.", - "eStr": ["pattern", "does not satisfy"] + "eStrKey": "Range" }, "KDUMP_WITH_INVALID_MEMORY": { "desc": "Configuring kdump config with invalid memory config.", - "eStr": ["pattern", "does not satisfy"] + "eStrKey": "Pattern" }, "KDUMP_WITH_VALID_REMOTE_VALUES": { "desc": "Configuring the kdump with valid remote ssh values." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/kubernetes_master.json b/src/sonic-yang-models/tests/yang_model_tests/tests/kubernetes_master.json index 6518f425da1..832798db21b 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/kubernetes_master.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/kubernetes_master.json @@ -12,7 +12,7 @@ }, "KUBERNETES_MASTER_INVALID_PORT": { "desc": "Configure invalid PORT in kubernetes_master.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "KUBERNETES_MASTER_INVALID_IP" : { "desc": "Configure invalid IP in kubernetes_master.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/memory_statistics.json b/src/sonic-yang-models/tests/yang_model_tests/tests/memory_statistics.json index e466e9cf92c..2faaa4d4a4e 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/memory_statistics.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/memory_statistics.json @@ -4,15 +4,13 @@ }, "MEMORY_STATISTICS_WITH_INVALID_SAMPLING_INTERVAL": { "desc": "Configuring memory statistics with an invalid sampling_interval ( out of acceptable range).", - "eStrKey": "Range", - "eStr": "3..15" + "eStrKey": "Range" }, "MEMORY_STATISTICS_WITH_INVALID_RETENTION_PERIOD": { "desc": "Configuring memory statistics with an invalid retention_period (out of acceptable range).", - "eStrKey": "Range", - "eStr": "1..30" + "eStrKey": "Range" }, "MEMORY_STATISTICS_WITH_ENABLE_FEATURE": { "desc": "Enabling memory statistics feature with valid values." } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/mgmt_port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/mgmt_port.json index 3530c7754b5..e279875b62b 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/mgmt_port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/mgmt_port.json @@ -15,13 +15,11 @@ }, "MGMT_PORT_INVALID_SPEED": { "desc": "INVALID SPEED", - "eStrKey": "Range", - "eStr": ["10|100|1000"] + "eStrKey": "Range" }, "MGMT_PORT_INVALID_MTU": { "desc": "INVALID MTU", - "eStrKey": "Range", - "eStr": "1500..9216" + "eStrKey": "Range" }, "MGMT_PORT_DEFAULT_MTU": { "desc": "VALIDATE DEFAULT MTU", 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 5bc6b54a044..239b6a72437 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 @@ -60,7 +60,7 @@ }, "MIRROR_ERSPAN_ENTRY_WRONG_TTL": { "desc": "Configuring ERSPAN entry with invalid ttl", - "eStr": "Invalid ttl value" + "eStrKey": "Bounds" }, "MIRROR_ERSPAN_ENTRY_WRONG_TTL_TYPE": { "desc": "Configuring ERSPAN entry with invalid ttl", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/nat.json b/src/sonic-yang-models/tests/yang_model_tests/tests/nat.json index 2d69dacb737..9b211c110c3 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/nat.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/nat.json @@ -13,8 +13,7 @@ }, "STATIC_NAPT_ENTRY_WRONG_GLOBAL_L4_PORT": { "desc": "Configuring a wrong global l4 port in Static NAPT table.", - "eStrKey": "InvalidValue", - "eStr": ["global_l4_port"] + "eStrKey": "Bounds" }, "STATIC_NAPT_ENTRY_WITHOUT_LOCAL_IP": { "desc": "Configuring a Static NAPT table without local ip.", @@ -26,7 +25,7 @@ }, "STATIC_NAPT_ENTRY_INVALID_TWICE_NAT_ID": { "desc": "Configuring a invalid twice nat id in Static NAPT table.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "STATIC_NAT_ENTRY_WITH_VALID_VALUES": { "desc": "Configuring the Static NAT table with valid values." @@ -41,7 +40,7 @@ }, "STATIC_NAT_ENTRY_INVALID_TWICE_NAT_ID": { "desc": "Configuring a invalid twice nat id in Static NAT table.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "NAT_GLOBAL_WITH_VALID_VALUES": { "desc": "Configuring a NAT Global table with valid values." @@ -92,7 +91,7 @@ }, "NAT_BINDING_WITH_INVALID_TWICE_NAT_ID": { "desc": "Configuring a invalid twice nat id in NAT Binding table.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "NAT_BINDING_WITHOUT_ACL_TABLE": { "desc": "Configuring a NAT Binding table without acl." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/neigh.json b/src/sonic-yang-models/tests/yang_model_tests/tests/neigh.json index 6ed1e7aa299..be32b47adf2 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/neigh.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/neigh.json @@ -5,7 +5,7 @@ "NEIGH_MISSING_IP": { "desc": "Load NEIGH missing IP address", - "eStr": ["Invalid JSON data"] + "eStrKey": "ListKey" }, "NEIGH_INVALID_VLAN": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/ntp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/ntp.json index f380162b83d..1be07b0225f 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/ntp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/ntp.json @@ -122,7 +122,7 @@ }, "NTP_KEY_ID_INVALID": { "desc": "NTP authentication keys invalid key id", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "NTP_KEY_TRUSTED_INVALID": { "desc": "NTP authentication keys invalid trustiness", @@ -134,6 +134,6 @@ }, "NTP_KEY_VALUE_INVALID": { "desc": "NTP authentication keys bad key value", - "eStrKey": "Range" + "eStrKey": "Length" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/nvgre.json b/src/sonic-yang-models/tests/yang_model_tests/tests/nvgre.json index e776b0d9064..a1eccae226a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/nvgre.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/nvgre.json @@ -15,11 +15,11 @@ "NVGRE_TUNNEL_MAP_INVALID_VLAN_ID": { "desc": "Invalid VLAN ID", - "eStrKey": "Pattern" + "eStrKey": "Range" }, "NVGRE_TUNNEL_MAP_INVALID_VSID": { "desc": "INVALID VSID value for NVGRE_TUNNEL_MAP", - "eStrKey": "Pattern" + "eStrKey": "Range" } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/password_hardening.json b/src/sonic-yang-models/tests/yang_model_tests/tests/password_hardening.json index 4bcde92849f..fe5d9ea88b3 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/password_hardening.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/password_hardening.json @@ -15,18 +15,18 @@ }, "PASSWORD_BAD_HISTORY_CNT": { "desc": "Configure password history_cnt with out of range value", - "eStrKey" : "InvalidValue" + "eStrKey" : "Bounds" }, "PASSWORD_BAD_LEN_MIN": { "desc": "Configure password len-min with out of range value", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "PASSWORD_BAD_EXPIRATION": { "desc": "Configure password expiration with out of range value", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "PASSWORD_BAD_EXPIRATION_WARN": { "desc": "Configure password expiration-warning with out of range value", - "eStrKey" : "Pattern" + "eStrKey" : "Range" } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/pbh.json b/src/sonic-yang-models/tests/yang_model_tests/tests/pbh.json index cb3a0a99fae..51c2982d2d2 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/pbh.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/pbh.json @@ -12,7 +12,7 @@ }, "PBH_TABLE_INVALID_DESCRIPTION": { "desc": "Configure invalid DESCRIPTION in PBH_TABLE.", - "eStrKey": "Range" + "eStrKey": "Length" }, "PBH_RULE_INVALID_TABLE": { "desc": "Configure non-existing PBH_TABLE in PBH_RULE.", @@ -20,7 +20,7 @@ }, "PBH_RULE_INVALID_PRIORITY": { "desc": "Configure invalid PRIORITY in PBH_RULE.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "PBH_RULE_INVALID_GRE_KEY": { "desc": "Configure invalid GRE_KEY in PBH_RULE.", @@ -102,6 +102,6 @@ }, "PBH_HASH_FIELD_INVALID_SEQUENCE_ID": { "desc": "Configure invalid SEQUENCE_ID in PBH_HASH_FIELD.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/peer-switch.json b/src/sonic-yang-models/tests/yang_model_tests/tests/peer-switch.json index b8ee10dbdf9..a4df44f176e 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/peer-switch.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/peer-switch.json @@ -4,7 +4,7 @@ }, "PEER_SWITCH_MISSING_DEVICE__NAME": { "desc": "Load PEER_SWITCH missing PEER Device name.", - "eStrKey": "Mandatory" + "eStrKey": "ListKey" }, "PEER_SWITCH_INVALID_IP_ADDRESS": { "desc": "Load PEER_SWITCH with invalid IPv4 Address.", 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 3c0d59cc247..db68bd865b6 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 @@ -36,15 +36,14 @@ }, "PORT_INVALID_AUTONEG_TEST": { "desc": "PORT_INVALID_AUTONEG_TEST must condition failure.", - "eStrKey" : "Pattern", - "eStr": ["on|off"] + "eStrKey" : "Pattern" }, "PORT_VALID_SPEEDS_TEST_1": { "desc": "PORT_VALID_SPEEDS_TEST_1 no failure." }, "PORT_INVALID_SPEEDS_TEST_1": { "desc": "PORT_INVALID_SPEEDS_TEST_1 InvalidValue condition failure.", - "eStr": ["pattern", "does not satisfy"] + "eStrKey": "Range" }, "PORT_VALID_ADVSPEEDS_TEST_1": { "desc": "PORT_VALID_ADVSPEEDS_TEST_1 no failure." @@ -117,8 +116,7 @@ }, "PORT_INVALID_LINK_TRAINING_TEST": { "desc": "PORT_INVALID_LINK_TRAINING_TEST must condition failure.", - "eStrKey" : "Pattern", - "eStr": ["on|off"] + "eStrKey" : "Pattern" }, "PORT_INVALID_TPID_TEST": { "desc": "PORT_INVALID_TPID_TEST invalid tpid value failure.", @@ -144,24 +142,21 @@ }, "PORT_INVALID_SUBPORT_NUMBER": { "desc": "Out of range subport number", - "eStrKey": "Range", - "eStr": "0..8" + "eStrKey": "Range" }, "PORT_VALID_DOM_POLLING": { "desc": "PORT_VALID_DOM_POLLING no failure." }, "PORT_INVALID_DOM_POLLING": { "desc": "PORT_INVALID_DOM_POLLING invalid condition failure.", - "eStrKey" : "InvalidValue", - "eStr": ["dom_polling"] + "eStrKey" : "InvalidValue" }, "PORT_AUTO_FEC_TEST": { "desc": "PORT_AUTO_FEC_TEST validate auto mode in fec." }, "PORT_NO_LANES_NEGATIVE_TEST": { "desc": "PORT_NO_LANES_NEGATIVE_TEST no lanes.", - "eStrKey": "Mandatory", - "eStr": ["Missing"] + "eStrKey": "Mandatory" }, "PORT_VOQ_CHASSIS_WITH_NO_LANES": { "desc": "PORT_VOQ_CHASSIS_WITH_NO_LANES no failure." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json b/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json index d5420e445b9..e1b504ddb77 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json @@ -7,7 +7,7 @@ }, "PORT_CHANNEL_OUT_OF_RANGE_MIN_LINKS": { "desc": "Configure PortChannel with greater than maximum valid value of min-links.", - "eStr": ["Value", "does not satisfy the constraint"] + "eStrKey": "Range" }, "PORT_CHANNEL_WRONG_PATTERN": { "desc": "INCORRECT PORTCHANNEL_NAME IN PORT_CHANNEL TABLE.", @@ -59,13 +59,11 @@ }, "PORTCHANNEL_INTERFACE_LIST_VRF_TEST_ON_NON_EXIST_PO": { "desc": "Configure vrf name on a non existent PortChannel.", - "eStrKey": "LeafRef", - "eStr": ["sonic-portchannel:name"] + "eStrKey": "LeafRef" }, "PORTCHANNEL_INTERFACE_LIST_NON_EXIST_VRF_TEST": { "desc": "Configure a non existent Vrf in PORTCHANNEL_INTERFACE table.", - "eStrKey": "LeafRef", - "eStr": ["sonic-vrf:name"] + "eStrKey": "LeafRef" }, "PORTCHANNEL_INTERFACE_WRONG_NAT_ZONE_RANGE": { "desc": "Configure wrong value for nat zone.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json b/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json index 3b019910647..c4319089844 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json @@ -11,7 +11,7 @@ "SCHEDULER_INVALID_WEIGHT": { "desc": "Configure outof range weight in SCHEDULER table.", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "SCHEDULER_INVALID_METER_TYPE": { @@ -49,7 +49,7 @@ "WRED_PROFILE_INVALID_DROP_PROBABILITY": { "desc": "Configure invalid drop probability in WRED profile.", - "eStrKey" : "Pattern" + "eStrKey" : "Range" }, "WRED_PROFILE_INVALID_GREEN_THRESHOLD": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json b/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json index 42ce64ba330..22f44f211cf 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json @@ -1,11 +1,11 @@ { "RESTAPI_TABLE_WITH_INCORRECT_CERT": { "desc": "RESTAPI TABLE_WITH_INCORRECT_CERT failure.", - "eStr": ["Value", "does not satisfy the constraint"] + "eStrKey": "Pattern" }, "RESTAPI_TABLE_WITH_INCORRECT_CLIENT": { "desc": "RESTAPI TABLE_WITH_INCORRECT_CLIENT failure.", - "eStr": ["Value", "does not satisfy the constraint"] + "eStrKey": "Pattern" }, "RESTAPI_TABLE_WITH_VALID_CONFIG": { "desc": "RESTAPI TABLE WITH VALID CONFIG." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/route_filter.json b/src/sonic-yang-models/tests/yang_model_tests/tests/route_filter.json index 220bc703ad7..abadbbdf824 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/route_filter.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/route_filter.json @@ -20,8 +20,7 @@ }, "ROUTE_MAP_INVALID_STMT": { "desc": "Configure route map table with wrong value for stmt_name.", - "eStrKey": "InvalidValue", - "eStr": ["stmt_name"] + "eStrKey": "Bounds" }, "ROUTE_MAP_INVALID_OPERATION_TYPE": { "desc": "Configure route map table with invalid route operation type.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/serial_console.json b/src/sonic-yang-models/tests/yang_model_tests/tests/serial_console.json index 76e39bb1794..c4634a8320f 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/serial_console.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/serial_console.json @@ -4,7 +4,7 @@ }, "SERIAL_CONSOLE_INVALID_INACTIVITY_TIMEOUT": { "desc": "SERIAL_CONSOLE attribute 'inactivity_timeout' set to invalid value (out of allowed range of [0, 35000] minutes).", - "eStr": "does not satisfy the constraint \"0..35000\"" + "eStrKey": "Range" }, "SERIAL_CONSOLE_INVALID_SYSRQ" : { "desc": "SERIAL_CONSOLE attribute 'sysrq' set to invalid value", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json index b98cc85fd39..598906e0388 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json @@ -4,7 +4,7 @@ }, "SFLOW_COLLECTOR_WRONG_NAME_TEST": { "desc": "Configure a collector with incorrect name in SFLOW_COLLECTOR table.", - "eStr" : ["not", "satisfy", "the", "constraint", "1..64"] + "eStrKey" : "Length" }, "SFLOW_TEST_WITHOUT_COLLECTOR_IP": { "desc": "Configure a collector without collector IP attribute in SFLOW_COLLECTOR table.", @@ -12,7 +12,7 @@ }, "SFLOW_TEST_EXCEEDING_MAX_ELEMENTS": { "desc": "Configure collectors above the specified limit in SFLOW_COLLECTOR table.", - "eStr": ["Too many \"SFLOW_COLLECTOR_LIST\" elements"] + "eStrKey": "MaxElements" }, "SFLOW_TEST_WITH_COLLECTOR_DEFAULT_VRF": { "desc": "Configure a collector in SFLOW_COLLECTOR table with default VRF." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/snmp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/snmp.json index 95e9b7ba9f8..b00e48e71f9 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/snmp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/snmp.json @@ -4,22 +4,22 @@ }, "SNMP_SYSTEM_CONTACT_NEG_TEST": { "desc": "Load SNMP sysContact with empty string", - "eStrKey": "Range" + "eStrKey": "Length" }, "SNMP_SYSTEM_LOCATION_NEG_TEST": { "desc": "Load SNMP sysContact with empty string", - "eStrKey": "Range" + "eStrKey": "Length" }, "SNMP_COMMUNITY_TEST": { "desc": "Load SNMP community string." }, "SNMP_COMMUNITY_MIN_NEG_TEST": { "desc": "Load SNMP community string of length < 3.", - "eStrKey": "Range" + "eStrKey": "Length" }, "SNMP_COMMUNITY_MAX_NEG_TEST": { "desc": "Load SNMP community string of lenth > 32.", - "eStrKey": "Range" + "eStrKey": "Length" }, "SNMP_COMMUNITY_WRONG_TYPE_TEST": { "desc": "Load SNMP community string with un supported type.", @@ -33,7 +33,7 @@ }, "SNMP_USER_NAME_MIN_NEG_TEST": { "desc": "Load SNMP user with name < 4", - "eStrKey": "Range" + "eStrKey": "Length" }, "SNMP_USER_NAME_INVALID_NEG_TEST": { "desc": "Load SNMP user with invalid value", @@ -112,7 +112,7 @@ }, "SNMP_USER_PRIV_LONG_ENCRYPT_PASS_NEG_TEST": { "desc": "Load SNMP user with user type Priv with long encryption password", - "eStrKey": "Range" + "eStrKey": "Length" }, "SNMP_AGENT_ADDRESS_CONFIG": { "desc": "Load SNMP agent address config" @@ -128,11 +128,11 @@ }, "SNMP_AGENT_ADDRESS_CONFIG_NO_VRF": { "desc": "Load SNMP agent address config with no vrf", - "eStr": ["Missing required element"] + "eStrKey": "ListKey" }, "SNMP_AGENT_ADDRESS_CONFIG_INVALID_PORT": { "desc": "Load SNMP agent address config with invalid port", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "SNMP_AGENT_ADDRESS_CONFIG_DUPLICATE_IP_PORT": { "desc": "Load two SNMP agent address config same ip and port", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json index 6749860b2f7..edf2e74264a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json @@ -9,7 +9,7 @@ }, "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_TIMESTAMP": { "desc": "BGP_STATE_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_BGP_BGP_STATE_VALID": { "desc": "VALID BGP STATE EVENT." @@ -32,14 +32,14 @@ }, "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_TIMESTAMP": { "desc": "BGP_NOTIFICATION_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_BGP_NOTIFICATION_VALID": { "desc": "VALID BGP NOTIFICATION." }, "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_INCORRECT_TIMESTAMP": { "desc": "ZEBRA_NO_BUFF_EVENT_INCORRECT_TIMESTAMP.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_VALID": { "desc": "VALID ZEBRA_NO_BUFF EVENT." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json index a4f17ae9e84..8ed60f46b7a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json @@ -5,7 +5,7 @@ }, "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_TIMESTAMP": { "desc": "DHCP_RELAY_DISCARD_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_VALID": { "desc": "VALID DHCP_RELAY_DISCARD EVENT." @@ -20,7 +20,7 @@ }, "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_TIMESTAMP": { "desc": "DHCP_RELAY_DISPARITY_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_VALID": { "desc": "VALID DHCP_RELAY_DISPARITY EVENT." @@ -35,7 +35,7 @@ }, "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TIMESTAMP": { "desc": "DHCP_RELAY_BIND_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_VALID": { "desc": "VALID DHCP_RELAY_BIND_FAILURE EVENT." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json index b26d8e68a53..ad18f6cc1c5 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json @@ -9,7 +9,7 @@ }, "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_TIMESTAMP": { "desc": "DISK_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_DISK_USAGE_VALID": { "desc": "VALID DISK_USAGE EVENT." @@ -24,7 +24,7 @@ }, "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_TIMESTAMP": { "desc": "MEMORY_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_MEMORY_USAGE_VALID": { "desc": "VALID MEMORY_USAGE EVENT." @@ -39,14 +39,14 @@ }, "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_TIMESTAMP": { "desc": "CPU_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_CPU_USAGE_VALID": { "desc": "VALID CPU_USAGE EVENT." }, "SONIC_EVENTS_HOST_EVENT_SSHD_INCORRECT_TIMESTAMP": { "desc": "EVENT_SSHD_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_EVENT_SSHD_VALID": { "desc": "VALID EVENT_SSHD EVENT." @@ -57,7 +57,7 @@ }, "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_TIMESTAMP": { "desc": "EVENT_DISK_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_EVENT_DISK_VALID": { "desc": "VALID EVENT_DISK EVENT." @@ -68,21 +68,21 @@ }, "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_TIMESTAMP": { "desc": "EVENT_KERNEL_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_EVENT_KERNEL_VALID": { "desc": "VALID EVENT_KERNEL EVENT." }, "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_INCORRECT_TIMESTAMP": { "desc": "EVENT_DOWN_CTR_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_VALID": { "desc": "VALID EVENT_DOWN_CTR EVENT." }, "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_INCORRECT_TIMESTAMP": { "desc": "EVENT_STOPPED_CTR_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_VALID": { "desc": "VALID EVENT_STOPPED_CTR EVENT." @@ -93,21 +93,21 @@ }, "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_TIMESTAMP": { "desc": "WATCHDOG_TIMEOUT_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_VALID": { "desc": "VALID WATCHDOG_TIMEOUT EVENT." }, "SONIC_EVENTS_HOST_EVENT_SEU_INCORRECT_TIMESTAMP": { "desc": "EVENT_SEU_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_EVENT_SEU_VALID": { "desc": "VALID EVENT_SEU EVENT." }, "SONIC_EVENTS_HOST_INVALID_FREELIST_INCORRECT_TIMESTAMP": { "desc": "INVALID_FREELIST_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_INVALID_FREELIST_VALID": { "desc": "VALID INVALID_FREELIST EVENT." @@ -132,7 +132,7 @@ }, "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_TIMESTAMP": { "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_VALID": { "desc": "VALID MEM_THRESHOLD_EXCEEDED EVENT." @@ -155,7 +155,7 @@ }, "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_TIMESTAMP": { "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_VALID": { "desc": "VALID_PROCESS_EXITED_UNEXPECTEDLY EVENT." @@ -178,7 +178,7 @@ }, "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_TIMESTAMP": { "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_VALID": { "desc": "VALID_PROCESS_NOT_RUNNING EVENT." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json index a6c3d9332c0..693789ceb52 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json @@ -9,7 +9,7 @@ }, "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_TIMESTAMP": { "desc": "IF_STATE_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_SWSS_IF_STATE_VALID": { "desc": "VALID IF_STATE EVENT." @@ -32,7 +32,7 @@ }, "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_TIMESTAMP": { "desc": "PFC_STORM_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_SWSS_PFC_STORM_VALID": { "desc": "VALID IF_STATE EVENT." @@ -65,7 +65,7 @@ }, "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_TIMESTAMP": { "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_VALID": { "desc": "VALID CHK_CRM_THRESHOLD EVENT." @@ -88,7 +88,7 @@ }, "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_TIMESTAMP": { "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_VALID": { "desc": "VALID SELECT_OPERATION_FAILURE EVENT." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json index daa50cc1a08..d72750766af 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json @@ -5,7 +5,7 @@ }, "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_TIMESTAMP": { "desc": "SYNCD_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_VALID": { "desc": "VALID SYNCD_FAILURE EVENT." @@ -20,7 +20,7 @@ }, "SONIC_EVENTS_SYNCD_ALPM_PARITY_ERROR_INCORRECT_TIMESTAMP": { "desc": "ALPM_PARITY_ERROR_EVENT_INCORRECT_TIMESTAMP failure.", - "eStrKey": "Pattern" + "eStrKey": "DateTime" }, "SONIC_EVENTS_SYNCD_ALPM_PARITY_ERROR_VALID": { "desc": "VALID ALPM_PARITY_ERROR_EVENT." diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/ssh-server.json b/src/sonic-yang-models/tests/yang_model_tests/tests/ssh-server.json index e7bc0af10ac..b67c7b66edb 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/ssh-server.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/ssh-server.json @@ -7,13 +7,11 @@ }, "SSH_SERVER_INVALID_AUTH_RETRIES": { "desc": "Configure invalid number of authentication retries in SSH_SERVER.", - "eStrKey" : "Pattern", - "eStr": ["1..100"] + "eStrKey" : "Range" }, "SSH_SERVER_INVALID_LOGIN_TIMEOUT": { "desc": "Configure invalid login timeout value in SSH_SERVER.", - "eStrKey" : "Pattern", - "eStr": ["1..600"] + "eStrKey" : "Range" }, "SSH_SERVER_INVALID_PORTS_1": { "desc": "Configure invalid port value in SSH_SERVER.", @@ -25,10 +23,10 @@ }, "SSH_SERVER_INVALID_INACTIVITY_TIMEOUT": { "desc": "Configure invalid inactivity_timeout value in SSH_SERVER.", - "eStr": "does not satisfy the constraint \"0..35000\"" + "eStrKey": "Range" }, "SSH_SERVER_INVALID_MAX_SESSIONS": { "desc": "Configure invalid max_sessions value in SSH_SERVER.", - "eStr": "does not satisfy the constraint \"0..100\"" + "eStrKey": "Range" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/stormond.json b/src/sonic-yang-models/tests/yang_model_tests/tests/stormond.json index de8c699c49d..ac73bedfcfb 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/stormond.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/stormond.json @@ -4,7 +4,7 @@ }, "STORMOND_INVALID_POLLING_INTERVAL": { "desc": "Configure an invalid daemon polling interval", - "eStrKey" : "InvalidValue" + "eStrKey" : "Bounds" }, "STORMOND_INVALID_SYNC_INTERVAL": { "desc": "Configure an invalid fsstats file sync interval", @@ -26,4 +26,4 @@ "desc": "Configure an empty file sync interval", "eStrKey" : "InvalidValue" } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/suppress_asic_sdk_health_event.json b/src/sonic-yang-models/tests/yang_model_tests/tests/suppress_asic_sdk_health_event.json index a96a95deb28..2f2c0d468e9 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/suppress_asic_sdk_health_event.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/suppress_asic_sdk_health_event.json @@ -14,7 +14,7 @@ }, "SUPPRESS_ASIC_SDK_HEALTH_EVENT_LIST_NEGATIVE_MAX_EVENTS": { "desc": "Load suppress ASIC/SDK health event list missing name.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "SUPPRESS_ASIC_SDK_HEALTH_EVENT_LIST_INVALID_MAX_EVENTS": { "desc": "Load suppress ASIC/SDK health event list missing name.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/syslog.json b/src/sonic-yang-models/tests/yang_model_tests/tests/syslog.json index 4b2eb0ae1da..eff13fca7ce 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/syslog.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/syslog.json @@ -12,7 +12,7 @@ }, "SYSLOG_SERVER_INVALID_PORT": { "desc": "Configure invalid PORT in SYSLOG_SERVER.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "SYSLOG_SERVER_INVALID_VRF": { "desc": "Configure invalid VRF in SYSLOG_SERVER.", @@ -38,11 +38,11 @@ }, "SYSLOG_CONFIG_INVALID_INTERVAL": { "desc": "Configure invalid rate limit interval in SYSLOG_CONFIG.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "SYSLOG_CONFIG_INVALID_BURST": { "desc": "Configure invalid rate limit burst in SYSLOG_CONFIG.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "SYSLOG_CONFIG_FEATURE_VALID": { "desc": "Configure SYSLOG_CONFIG_FEATURE." @@ -53,11 +53,11 @@ }, "SYSLOG_CONFIG_FEATURE_INVALID_INTERVAL": { "desc": "Configure invalid rate_limit_interval in SYSLOG_CONFIG_FEATURE.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "SYSLOG_CONFIG_FEATURE_INVALID_BURST": { "desc": "Configure invalid rate_limit_burst in SYSLOG_CONFIG_FEATURE.", - "eStrKey": "InvalidValue" + "eStrKey": "Bounds" }, "SYSLOG_SERVER_HOSTNAME": { "desc": "Load syslog server table with hostname" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/system_port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/system_port.json index 727373ade25..43e40666f23 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/system_port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/system_port.json @@ -4,6 +4,6 @@ }, "SYSTEM_PORT_WRONG_SPEED_PATTERN": { "desc": "Configure SYSTEM_PORT wrong speed.", - "eStr": ["pattern", "does not satisfy"] + "eStrKey": "Range" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/tunnel.json b/src/sonic-yang-models/tests/yang_model_tests/tests/tunnel.json index b414b639aa3..268aea1aae1 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/tunnel.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/tunnel.json @@ -4,15 +4,15 @@ }, "TUNNEL_INVALID_ADDR": { "desc": "Load TUNNEL with invalid IPv4 Address.", - "eStr": ["does not satisfy the constraint"] + "eStrKey": "Pattern" }, "TUNNEL_SRC_IP_NOT_PEER_SWITCH": { "desc": "Load TUNNEL with wrong IPv4 Address.", - "eStr": ["points to a non-existing leaf."] + "eStrKey": "LeafRef" }, "TUNNEL_MISSING_MUX_TUNNEL": { "desc": "Load MUX_TUNNEL missing name.", - "eStr": ["Missing required element"] + "eStrKey": "ListKey" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/vnet.json b/src/sonic-yang-models/tests/yang_model_tests/tests/vnet.json index 0c31e6a6e18..10d3676def3 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/vnet.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/vnet.json @@ -7,23 +7,23 @@ }, "VNET_INVALID_VALUE_TEST1": { "desc": "Invalid values in parameters.", - "eStr": [ "Invalid VRF name" ] + "eStr": "Invalid VRF name" }, "VNET_INVALID_VALUE_TEST2": { "desc": "Invalid values in parameters.", - "eStr": [ "Invalid value" ] + "eStrKey": "Bounds" }, "VNET_INVALID_VALUE_TEST3": { "desc": "Invalid values in parameters.", - "eStr": [ "does not satisfy the constraint" ] + "eStrKey": "Pattern" }, "VNET_INVALID_VALUE_TEST4": { "desc": "Invalid values in parameters.", - "eStr": [ "does not satisfy the constraint" ] + "eStrKey": "Pattern" }, "VNET_INVALID_VXLAN_VTEP": { "desc": "Missing Vxlan_TUNNEL configuration", - "eStr" : [ "points to a non-existing leaf" ] + "eStrKey" : "LeafRef" }, "VNET_ROUTE_TUNNEL_MIN_TEST": { "desc": "Basic VNET route tunnel configuration with minimal required field - endpoint in VNET_ROUTE_TUNNEL_LIST table." @@ -44,36 +44,36 @@ "VNET_ROUTE_TUNNEL_TEST_INVALID_ENDPOINT": { "desc": "VNET route tunnel configuration with invalid endpoint IP value (256.256.256.256) in VNET_ROUTE_TUNNEL_LIST table.", - "eStr": "Value \"256.256.256.256\" does not satisfy the constraint" + "eStrKey": "Pattern" }, "VNET_ROUTE_TUNNEL_TEST_INVALID_MAC": { "desc": "VNET route tunnel configuration with invalid MAC address format (non-hexadecimal characters) in VNET_ROUTE_TUNNEL_LIST table.", - "eStr": "Value \"GG:HH:II:JJ:KK:LL\" does not satisfy the constraint \"[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}\"" + "eStrKey": "Pattern" }, "VNET_ROUTE_TUNNEL_TEST_INVALID_VNI": { "desc": "VNET route tunnel configuration with invalid VXLAN ID (exceeding max value of 16777215) in VNET_ROUTE_TUNNEL_LIST table.", - "eStr": "Value \"16777216\" does not satisfy the constraint \"1..16777215\"" + "eStrKey": "Range" }, "VNET_ROUTE_TUNNEL_TEST_INVALID_NAME_FORMAT": { "desc": "VNET route tunnel configuration with invalid name format (missing prefix) in VNET_ROUTE_TUNNEL_LIST table.", - "eStr": "Missing required element \"prefix\" in \"VNET_ROUTE_TUNNEL_LIST\"" + "eStrKey": "ListKey" }, "VNET_ROUTE_TUNNEL_TEST_INVALID_PREFIX": { "desc": "VNET route tunnel configuration with invalid prefix format (300.168.1.0/24) in name field.", - "eStr": "Value \"300.168.1.0/24\" does not satisfy the constraint \"((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2])))\" (range, length, or pattern)\"" + "eStrKey": "Pattern" }, "VNET_ROUTE_TUNNEL_TEST_MISSING_ENDPOINT": { "desc": "VNET route tunnel configuration with missing mandatory attribute (endpoint) in VNET_ROUTE_TUNNEL_LIST table.", - "eStr": "Missing required element \"endpoint\" in \"VNET_ROUTE_TUNNEL_LIST\"." + "eStrKey": "Mandatory" }, "VNET_ROUTE_TUNNEL_TEST_NONEXISTENT_VNET": { "desc": "VNET route tunnel configuration referencing a non-existent VNET name, violating the must condition.", - "eStr": "Leafref \"/sonic-vnet:sonic-vnet/sonic-vnet:VNET/sonic-vnet:VNET_LIST/sonic-vnet:name\" of value \"NonexistentVnet\" points to a non-existing leaf" + "eStrKey" : "LeafRef" } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/neigh.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/neigh.json index b2d532e71d4..abcfccb96f2 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/neigh.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/neigh.json @@ -28,7 +28,7 @@ } }, - "NEIGH_MISSING_IPV4": { + "NEIGH_MISSING_IP": { "sonic-vlan:sonic-vlan": { "sonic-vlan:VLAN": { "VLAN_LIST": [ 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 005961c1daa..fb49b38e8fb 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 @@ -180,7 +180,7 @@ "lanes": "65", "speed": 25000, "tpid": "0x8100", - "autoneg": 0, + "autoneg": "invalid", "mode":"trunk" } ] @@ -583,7 +583,7 @@ "lanes": "65", "speed": 25000, "tpid": "0x8100", - "link_training": 0 + "link_training": "invalid" } ] }