Example: added cli pipe

This commit is contained in:
Olof hagsand 2024-04-09 14:20:45 +02:00
parent 826a4c3fb3
commit f9faf1039a
8 changed files with 72 additions and 28 deletions

View file

@ -50,6 +50,7 @@ cat <<EOF > $cfg
<CLICON_STREAM_DISCOVERY_RFC8040>true</CLICON_STREAM_DISCOVERY_RFC8040>
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
<CLICON_CLI_OUTPUT_FORMAT>cli</CLICON_CLI_OUTPUT_FORMAT>
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
<CLICON_VALIDATE_STATE_XML>$validatexml</CLICON_VALIDATE_STATE_XML>
</clixon-config>

View file

@ -28,7 +28,7 @@ set timeout 15
spawn {*}$clixon_cli -f $cfg
send "show pagination xpath $xpath cli\n"
send "show pagination xpath $xpath\n"
expect {
timeout { send_user "\n$line1 not received.\n"; exit 1}

View file

@ -45,6 +45,7 @@ cat <<EOF > $cfg
<CLICON_STREAM_DISCOVERY_RFC8040>true</CLICON_STREAM_DISCOVERY_RFC8040>
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
<CLICON_CLI_OUTPUT_FORMAT>cli</CLICON_CLI_OUTPUT_FORMAT>
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
<CLICON_VALIDATE_STATE_XML>$validatexml</CLICON_VALIDATE_STATE_XML>
</clixon-config>

View file

@ -179,7 +179,7 @@ done } 2>&1 | awk '/real/ {print $2}'
# CLI get
cat <<EOF >> $fin
edit interfaces a foo b interface e1
show state xml
show state
EOF
new "cli get test single req"
expectpart "$($clixon_cli -F $fin -f $cfg)" 0 "<name>e1</name>" "<type>eth</type>" "<status>up</status>$"
@ -187,7 +187,7 @@ expectpart "$($clixon_cli -F $fin -f $cfg)" 0 "<name>e1</name>" "<type>eth</type
new "cli get $perfreq single reqs"
{ time -p for (( i=0; i<$perfreq; i++ )); do
rnd=$(( ( RANDOM % $perfnr ) ))
$clixon_cli -1 -f $cfg show state xml interfaces a b interface e$rnd > /dev/null
$clixon_cli -1 -f $cfg show state interfaces a b interface e$rnd > /dev/null
done } 2>&1 | awk '/real/ {print $2}'
# Get config in one large get
@ -199,7 +199,7 @@ new "restconf get large config"
$TIMEFN curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:interfaces/a=foo/b 2>&1 | awk '/real/ {print $2}'
new "cli get large config"
$TIMEFN $clixon_cli -1f $cfg show state xml interfaces a foo b 2>&1 | awk '/real/ {print $2}'
$TIMEFN $clixon_cli -1f $cfg show state interfaces a foo b 2>&1 | awk '/real/ {print $2}'
# mem test needs sleep here
new "wait restconf"