* Tests: use YANG_STANDARD_DIR from ./configure --with-yang-standard-dir=DIR instead of YANGMODELS from site.sh

This commit is contained in:
Olof hagsand 2021-12-16 20:45:56 +01:00
parent f8f34e3571
commit 4fbad467df
14 changed files with 41 additions and 66 deletions

View file

@ -2,7 +2,7 @@
# Parse "all" IETF yangmodels from https://github.com/YangModels/yang/standard/ieee and experimental/ieee
# Notes:
# - Only a simple smoketest (CLI check) is made, essentially YANG parsing. A full system may not work
# - Env variable YANGMODELS should point to checkout place. (define it in site.sh for example)
# - Env variable YANG_STANDARD_DIR should point to yangmodels/standard
# - Some FEATURES are set to make it work
# - Some YANGmodels are broken, therefore CLICON_YANG_AUGMENT_ACCEPT_BROKEN is true
@ -14,12 +14,6 @@ APPNAME=example
cfg=$dir/conf_yang.xml
if [ ! -d "$YANGMODELS" ]; then
# err "Hmm Yangmodels dir does not seem to exist, try git clone https://github.com/YangModels/yang?"
echo "...skipped: YANGMODELS not set"
if [ "$s" = $0 ]; then exit 0; else return 0; fi
fi
cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
@ -31,8 +25,8 @@ cat <<EOF > $cfg
<CLICON_FEATURE>ietf-te-topology:te-topology-hierarchy</CLICON_FEATURE>
<CLICON_FEATURE>ietf-te-types:path-optimization-metric</CLICON_FEATURE>
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$YANGMODELS/standard/ieee/published/802.1</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$YANGMODELS/standard/ietf/RFC</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${YANG_STANDARD_DIR}/ieee/published/802.1</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${YANG_STANDARD_DIR}/ietf/RFC</CLICON_YANG_DIR>
<CLICON_YANG_AUGMENT_ACCEPT_BROKEN>true</CLICON_YANG_AUGMENT_ACCEPT_BROKEN>
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
@ -44,11 +38,11 @@ cat <<EOF > $cfg
EOF
# Standard IETF
files=$(find $YANGMODELS/standard/ietf/RFC -name "*.yang")
files=$(find ${YANG_STANDARD_DIR}/ietf/RFC -name "*.yang")
for f in $files; do
if [ -n "$(head -1 $f|grep '^module')" ]; then
# Mask old revision
if [ $f != $YANGMODELS/standard/ietf/RFC/ietf-yang-types@2010-09-24.yang ]; then
if [ $f != ${YANG_STANDARD_DIR}/ietf/RFC/ietf-yang-types@2010-09-24.yang ]; then
new "$clixon_cli -D $DBG -1f $cfg -y $f show version"
expectpart "$($clixon_cli -D $DBG -1f $cfg -y $f show version)" 0 "${CLIXON_VERSION}"
fi