#!/usr/bin/env bash # Test for RFC6022 YANG Module for NETCONF Monitoring for multiple schemas # Clixon supports multiple schemas only in the case of specific upgrade scenarios # The following is made to check multipel schemas: # 1. Two revisions of clixon-example.yang in MAIN_DIR # 2. MODSTATE and CHECKOLD is true and STARTUP enabled # Magic line must be first in script (see README.md) s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi APPNAME=example cfg=$dir/conf_yang.xml cat < $cfg $cfg ietf-netconf:startup ${YANG_INSTALLDIR} $dir false /usr/local/lib/$APPNAME/clispec /usr/local/lib/$APPNAME/cli $APPNAME /usr/local/var/$APPNAME/$APPNAME.sock /usr/local/lib/$APPNAME/backend /usr/local/var/$APPNAME/$APPNAME.pidfile $dir true true true EOF # Double yang specs to get two revisions cat < $dir/clixon-example@2000-01-01.yang module clixon-example{ yang-version 1.1; namespace "urn:example:clixon"; prefix ex; revision 2000-01-01; } EOF cat < $dir/clixon-example@2022-01-01.yang module clixon-example{ yang-version 1.1; namespace "urn:example:clixon"; prefix ex; revision 2022-01-01; } EOF # Just to get multi cat < $dir/startup_db <${DATASTORE_TOP}> default 42 clixon-example 2000-01-01 urn:example:clixon EOF new "test params: -f $cfg" if [ $BE -ne 0 ]; then new "kill old backend" sudo clixon_backend -zf $cfg if [ $? -ne 0 ]; then err fi new "start backend -s startup -f $cfg" start_backend -s startup -f $cfg fi new "wait backend" wait_backend new "get-schema: multiple schemas, fail" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "clixon-example" "applicationoperation-faileddata-not-uniqueerror" new "get-schema: multiple schemas 2000-01-01" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "clixon-example2000-01-01" "module clixon-example{" new "get-schema: multiple schemas 2022-01-01" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "clixon-example2022-01-01" "module clixon-example{" if [ $BE -ne 0 ]; then new "Kill backend" # Check if premature kill pid=$(pgrep -u root -f clixon_backend) if [ -z "$pid" ]; then err "backend already dead" fi # kill backend stop_backend -f $cfg fi rm -rf $dir new "endtest" endtest