* 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

@ -38,7 +38,7 @@ Planned: January, 2022
### New features
* Changed auto-cli design
* Replaced separet autocli trees with a single `@basemodel` tree by using filter labels
* Replaced separate autocli trees with a single `@basemodel` tree by using filter labels
* Filter labels are added to the fill tree and then filtered out using `@remove:<label>`
* Labels include: termfirstkeys, termlist, termleaf, leafvar, nonconfig,
* For detailed docs see yang2cli_post()
@ -53,6 +53,7 @@ Planned: January, 2022
### Minor features
* Tests: use `YANG_STANDARD_DIR` from `./configure --with-yang-standard-dir=DIR` instead of `YANGMODELS` from site.sh
* New `clixon-dev` development container (Work-in-progress)
* New `clixon-clispec.yang` for controlling auto-cli (Work-in-progress)
* Changed typo `configure --with-yang-standard-installdir` to `configure --with-yang-standard-dir`

View file

@ -66,7 +66,7 @@ WORKDIR /clixon/clixon
COPY clixon .
# Configure, build and install clixon
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --without-restconf
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --without-restconf --with-yang-standard-dir=/usr/local/share/yang/standard
RUN make
RUN make install

View file

@ -70,7 +70,7 @@ RUN adduser -D -H -G www-data www-data
RUN apk add --update nginx
# Configure, build and install clixon
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=fcgi
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=fcgi --with-yang-standard-dir=/usr/local/share/yang/standard
RUN make
RUN make install

View file

@ -94,7 +94,7 @@ WORKDIR /clixon/clixon
COPY clixon .
# Configure, build and install clixon
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-evhtp
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-evhtp --with-yang-standard-dir=/usr/local/share/yang/standard
RUN make
RUN make install

View file

@ -62,7 +62,6 @@ cat <<EOF > /usr/local/bin/test/site.sh
# Add your local site specific env variables (or tests) here.
SKIPLIST="test_api.sh test_c++.sh test_install.sh test_privileges.sh test_augment.sh test_choice.sh test_identity.sh test_nacm_datanode_read.sh test_nacm_datanode.sh test_nacm_datanode_write.sh test_nacm_default.sh test_nacm_ext.sh test_nacm_module_read.sh test_nacm_module_write.sh test_nacm_protocol.sh test_nacm.sh test_nacm_recovery.sh test_perf.sh test_perf_state_only.sh test_perf_state.sh test_restconf2.sh test_restconf_err.sh test_restconf_jukebox.sh test_restconf_listkey.sh test_restconf_patch.sh test_restconf.sh test_restconf_startup.sh test_rpc.sh test_ssl_certs.sh test_stream.sh test_submodule.sh test_upgrade_auto.sh test_upgrade_interfaces.sh test_upgrade_repair.sh test_yang_namespace.sh"
# Parse yangmodels from https://github.com/YangModels/yang
YANGMODELS=/usr/local/share/yang
EOF
# Patch yang syntax errors

View file

@ -91,7 +91,6 @@ cat <<EOF > /usr/local/bin/test/site.sh
SKIPLIST="test_api.sh test_client.sh test_c++.sh test_install.sh test_privileges.sh"
RCPROTO=http # Because nginx
# Parse yangmodels from https://github.com/YangModels/yang
YANGMODELS=/usr/local/share/yang
EOF
# Patch yang syntax errors

View file

@ -59,8 +59,6 @@ echo "$STORE" > /usr/local/var/example/running_db
cat <<EOF > /usr/local/bin/test/site.sh
# Add your local site specific env variables (or tests) here.
SKIPLIST="test_api.sh test_client.sh test_c++.sh test_install.sh test_privileges.sh"
# Parse yangmodels from https://github.com/YangModels/yang
YANGMODELS=/usr/local/share/yang
EOF
# Patch yang syntax errors

View file

@ -7,9 +7,8 @@ automatically run as part of the all.sh, sum.sh tests etc. The scripts
need to follow some rules to work properly, please look at one or two
to get the idea.
Note that some IETF yangs need to be available, by default these are
available in https://github.com/YangModels/yang. Just ensure the YANGMODELS in site.sh points
to a locally checked out dir.
Note that some IETF yangs need to be available, by default these are in `/usr/local//share/yang/standard`. You can change this location with configure option `--with-yang-standard-dir=DIR`
See also the [site.sh](#site-sh) for example for skipping tests or setting some site-specific variables.
@ -89,10 +88,6 @@ You may add your site-specific modifications in a `site.sh` file. Example:
SKIPLIST="test_openconfig.sh test_yangmodels.sh"
# Parse yang openconfig models from https://github.com/openconfig/public
OPENCONFIG=/usr/local/share/openconfig/public
# Parse yangmodels from https://github.com/YangModels/yang
YANGMODELS=/usr/local/share/yangmodels
# Standard IETF RFC yang files.
IETFRFC=$YANGMODELS/standard/ietf/RFC
```
For example, in FreeBSD, add:

View file

@ -177,8 +177,8 @@ if [ -f ./site.sh ]; then
fi
# Standard IETF RFC yang files.
if [ ! -z ${YANGMODELS} ]; then
: ${IETFRFC=$YANGMODELS/standard/ietf/RFC}
if [ ! -z ${YANG_STANDARD_DIR} ]; then
: ${IETFRFC=$YANG_STANDARD_DIR/ietf/RFC}
fi
# Check sanity between --with-restconf setting and if nginx is started by systemd or not

View file

@ -14,12 +14,6 @@
# Parse yang openconfig models from https://github.com/openconfig/public
OPENCONFIG=/usr/local/share/openconfig/public
#
# Parse yangmodels from https://github.com/YangModels/yang
YANGMODELS=/usr/local/share/yang
#
# Specify alternative directory for the standard IETF RFC yang files.
#IETFRFC=$YANGMODELS/standard/ietf/RFC
# Some restconf tests can run IPv6, but its complicated because:
# - docker by default does not run IPv6
IPv6=true

View file

@ -5,7 +5,7 @@
# - A simple smoketest (CLI check) is made, essentially YANG parsing.
# - A full system is worked on
# - Env-var OPENCONFIG should point to checkout place. (define it in site.sh for example)
# - Env variable YANGMODELS should point to checkout place. (define it in site.sh for example)
# - Env variable IETFRFC should point to checkout place, derived from YANG_STANDARD_DIR config option
# - Some DIFFs are necessary in yangmodels
# release/models/wifi/openconfig-ap-interfaces.yang

View file

@ -2,7 +2,7 @@
# Parse "all" IEEE yangmodels from https://github.com/YangModels/yang/standard/ietf/RFC
# 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 DIFFs are necessary in yangmodels
# - standard/ieee/published/802.3/ieee802-ethernet-pon.yang:
@ -18,23 +18,16 @@ 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
# Experimental IEEE
cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
<CLICON_FEATURE>ni-ieee1588-ptp:cmlds</CLICON_FEATURE>
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$YANGMODELS/standard/ietf/RFC</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$YANGMODELS/standard/ieee/draft/802.1/Qcr</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$YANGMODELS/standard/ieee/draft/802</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$YANGMODELS/standard/ieee/published/802.1</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$YANGMODELS/standard/ieee/published/802</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${YANG_STANDARD_DIR}/ietf/RFC</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${YANG_STANDARD_DIR}/ieee/draft/802.1/Qcr</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${YANG_STANDARD_DIR}/ieee/draft/802</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${YANG_STANDARD_DIR}/ieee/published/802.1</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${YANG_STANDARD_DIR}/ieee/published/802</CLICON_YANG_DIR>
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
@ -46,34 +39,36 @@ EOF
new "yangmodels parse: -f $cfg"
new "yangmodel Experimental IEEE 802.1: $YANGMODELS/experimental/ieee/802.1"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/experimental/ieee/802.1 -p $YANGMODELS/experimental/ieee/1588 show version)" 0 "${CLIXON_VERSION}"
if false; then # Only standard since ${YANG_STANDARD_DIR} points to that
new "yangmodel Experimental IEEE 802.1: $YANGMODELS/experimental/ieee/802.1"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/experimental/ieee/802.1 -p $YANGMODELS/experimental/ieee/1588 show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Experimental IEEE 1588: $YANGMODELS/experimental/ieee/1588"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/experimental/ieee/1588 show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Experimental IEEE 1588: $YANGMODELS/experimental/ieee/1588"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/experimental/ieee/1588 show version)" 0 "${CLIXON_VERSION}"
fi
# Standard IEEE
new "yangmodel Standard IEEE 802.1: $YANGMODELS/standard/ieee/draft/802.1/ABcu"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/standard/ieee/draft/802.1/ABcu show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: ${YANG_STANDARD_DIR}/ieee/draft/802.1/ABcu"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=${YANG_STANDARD_DIR}/ieee/draft/802.1/ABcu show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: $YANGMODELS/standard/ieee/draft/802.1/Qcr"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/standard/ieee/draft/802.1/Qcr show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: ${YANG_STANDARD_DIR}/ieee/draft/802.1/Qcr"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=${YANG_STANDARD_DIR}/ieee/draft/802.1/Qcr show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: $YANGMODELS/standard/ieee/draft/802.1/Qcw"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/standard/ieee/draft/802.1/Qcw show version)" 0 "${CLIXON_VERSION}"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=${YANG_STANDARD_DIR}/ieee/draft/802.1/Qcw show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: $YANGMODELS/standard/ieee/draft/802.1/Qcx"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/standard/ieee/draft/802.1/Qcx -p $YANGMODELS/standard/ieee/draft/802.1/ABcu show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: ${YANG_STANDARD_DIR}/ieee/draft/802.1/Qcx"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=${YANG_STANDARD_DIR}/ieee/draft/802.1/Qcx -p $YANGMODELS/standard/ieee/draft/802.1/ABcu show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: $YANGMODELS/standard/ieee/draft/802.1/x"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/standard/ieee/draft/802.1/x show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: ${YANG_STANDARD_DIR}/ieee/draft/802.1/x"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=${YANG_STANDARD_DIR}/ieee/draft/802.1/x show version)" 0 "${CLIXON_VERSION}"
# Published
new "yangmodel Standard IEEE 802.1: $YANGMODELS/standard/ieee/published/802.1"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/standard/ieee/published/802.1 show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: ${YANG_STANDARD_DIR}/ieee/published/802.1"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=${YANG_STANDARD_DIR}/ieee/published/802.1 show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: $YANGMODELS/standard/ieee/published/802.3"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=$YANGMODELS/standard/ieee/published/802.3 show version)" 0 "${CLIXON_VERSION}"
new "yangmodel Standard IEEE 802.1: ${YANG_STANDARD_DIR}/ieee/published/802.3"
expectpart "$($clixon_cli -D $DBG -1f $cfg -o CLICON_YANG_MAIN_DIR=${YANG_STANDARD_DIR}/ieee/published/802.3 show version)" 0 "${CLIXON_VERSION}"
rm -rf $dir

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

View file

@ -83,4 +83,4 @@ if [ $release = "freebsd" ]; then
echo "make=gmake" >> ./site.sh
fi
echo "OPENCONFIG=/usr/local/share/openconfig/public" >> ./site.sh
echo "YANGMODELS=/usr/local/share/yang" >> ./site.sh