- Changed master to 5.2.0.PRE

- Modified Makefiles for static linkage and coverage
- test namespace abstractions
This commit is contained in:
Olof hagsand 2021-04-17 14:52:42 +02:00
parent f9f533834b
commit 7ebb538ebf
18 changed files with 112 additions and 109 deletions

View file

@ -69,7 +69,7 @@ DATASTORE_TOP="config"
# clixon yang revisions occuring in tests
CLIXON_LIB_REV="2021-03-08"
CLIXON_CONFIG_REV="2021-03-08"
CLIXON_RESTCONF_REV="2020-12-30"
CLIXON_RESTCONF_REV="2021-03-08"
CLIXON_EXAMPLE_REV="2020-12-01"
# Length of TSL RSA key

View file

@ -75,6 +75,9 @@ testname=
# Namespace: netconf base
BASENS='urn:ietf:params:xml:ns:netconf:base:1.0'
# Namespace: Clixon config
CONFNS='xmlns="http://clicon.org/config"'
# Namespace: Clixon lib
LIBNS='xmlns="http://clicon.org/lib"'
@ -315,12 +318,12 @@ function stop_backend(){
# Wait for restconf to stop sending 502 Bad Gateway
function wait_backend(){
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><ping xmlns="http://clicon.org/lib"/></rpc>]]>]]>' | $clixon_netconf -qef $cfg 2> /dev/null)
reply=$(echo "<rpc $DEFAULTNS><ping $LIBNS/></rpc>]]>]]>" | $clixon_netconf -qef $cfg 2> /dev/null)
let i=0;
while [[ $reply != "<rpc-reply"* ]]; do
# echo "sleep $DEMSLEEP"
sleep $DEMSLEEP
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101" xmlns="http://clicon.org/lib"><ping/></rpc>]]>]]>' | clixon_netconf -qef $cfg 2> /dev/null)
reply=$(echo "<rpc $ÐEFAULTSNS $LIBNS><ping/></rpc>]]>]]>" | clixon_netconf -qef $cfg 2> /dev/null)
# echo "reply:$reply"
let i++;
# echo "wait_backend $i"

View file

@ -28,7 +28,7 @@ else
EXTRACONF=""
fi
cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
<clixon-config $CONFNS>
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>
<CLICON_FEATURE>clixon-restconf:allow-auth-none</CLICON_FEATURE> <!-- Use auth-type=none -->
@ -81,7 +81,7 @@ function rpcstatus()
ret=$($clixon_netconf -qf $cfg<<EOF
$DEFAULTHELLO
<rpc $DEFAULTNS>
<process-control xmlns="http://clicon.org/lib">
<process-control $LIBNS>
<name>restconf</name>
<operation>status</operation>
</process-control>
@ -89,7 +89,7 @@ $DEFAULTHELLO
EOF
)
# Check pid
expect="<pid xmlns=\"http://clicon.org/lib\">[0-9]*</pid>"
expect="<pid $LIBNS>[0-9]*</pid>"
match=$(echo "$ret" | grep --null -Go "$expect")
if [ -z "$match" ]; then
pid=0
@ -120,7 +120,7 @@ function rpcoperation()
sleep $DEMSLEEP
new "send rpc $operation"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><process-control xmlns=\"http://clicon.org/lib\"><name>restconf</name><operation>$operation</operation></process-control></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok xmlns=\"http://clicon.org/lib\"/></rpc-reply>]]>]]>$"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>$operation</operation></process-control></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok $LIBNS/></rpc-reply>]]>]]>$"
sleep $DEMSLEEP
}

View file

@ -41,7 +41,7 @@ else
fi
cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
<clixon-config $CONFNS>
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>
<CLICON_FEATURE>clixon-restconf:allow-auth-none</CLICON_FEATURE> <!-- Use auth-type=none -->
@ -95,7 +95,7 @@ function rpcstatus()
ret=$($clixon_netconf -qf $cfg<<EOF
$DEFAULTHELLO
<rpc $DEFAULTNS>
<process-control xmlns="http://clicon.org/lib">
<process-control $LIBNS>
<name>restconf</name>
<operation>status</operation>
</process-control>
@ -103,7 +103,7 @@ $DEFAULTHELLO
EOF
)
# Check pid
expect="<pid xmlns=\"http://clicon.org/lib\">[0-9]*</pid>"
expect="<pid $LIBNS>[0-9]*</pid>"
match=$(echo "$ret" | grep --null -Go "$expect")
if [ -z "$match" ]; then
pid=0

View file

@ -38,7 +38,7 @@ module trans{
EOF
cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
<clixon-config $CONFNS>
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
<CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
@ -115,7 +115,7 @@ xml="<table xmlns=\"urn:example:clixon\"><parameter><name>0</name></parameter></
checklog "$nr nacm_end add: $xml" $line
new "Send restart nacm plugin"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><restart-plugin xmlns=\"http://clicon.org/lib\"><plugin>example_backend_nacm</plugin></restart-plugin></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><restart-plugin $LIBNS><plugin>example_backend_nacm</plugin></restart-plugin></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>"
# Now analyze log:
# all transactions come from nacm plugin only.
@ -129,7 +129,7 @@ done
# Negative test: restart a plugin that does not exist
new "Send restart to nonexistatn plugin expect fail"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><restart-plugin xmlns=\"http://clicon.org/lib\"><plugin>xxx</plugin></restart-plugin></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag><error-info><bad-element>plugin</bad-element></error-info><error-severity>error</error-severity><error-message>No such plugin</error-message></rpc-error></rpc-reply>]]>]]>$"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><restart-plugin $LIBNS><plugin>xxx</plugin></restart-plugin></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag><error-info><bad-element>plugin</bad-element></error-info><error-severity>error</error-severity><error-message>No such plugin</error-message></rpc-error></rpc-reply>]]>]]>$"
if [ $BE -ne 0 ]; then
new "Kill backend"