Bugfix: multiple key cli bug, ambiguous commands in expand_dbvar
This commit is contained in:
parent
6d5df4e1ba
commit
df9e4734f9
7 changed files with 113 additions and 34 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
[](https://travis-ci.org/clicon/clixon)
|
[](https://travis-ci.org/clicon/clixon) [](https://clixon-docs.readthedocs.io/en/latest/?badge=latest)
|
||||||
|
|
||||||
# Clixon
|
# Clixon
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,13 +144,14 @@ expand_dbvar(void *h,
|
||||||
}
|
}
|
||||||
api_path_fmt = cv_string_get(cv);
|
api_path_fmt = cv_string_get(cv);
|
||||||
/* api_path_fmt = /interface/%s/address/%s
|
/* api_path_fmt = /interface/%s/address/%s
|
||||||
api_path: --> /interface/eth0/address/.*
|
* api_path: --> /interface/eth0/address/.*
|
||||||
xpath: --> /interface/[name="eth0"]/address
|
* xpath: --> /interface/[name="eth0"]/address
|
||||||
*/
|
*/
|
||||||
if (api_path_fmt2api_path(api_path_fmt, cvv, &api_path) < 0)
|
if (api_path_fmt2api_path(api_path_fmt, cvv, &api_path) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (api_path2xpath(api_path, yspec, &xpath, &namespace) < 0)
|
if (api_path2xpath(api_path, yspec, &xpath, &namespace) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* Get configuration */
|
/* Get configuration */
|
||||||
if (clicon_rpc_get_config(h, dbstr, xpath, namespace, &xt) < 0) /* XXX */
|
if (clicon_rpc_get_config(h, dbstr, xpath, namespace, &xt) < 0) /* XXX */
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -215,6 +216,7 @@ expand_dbvar(void *h,
|
||||||
continue; /* duplicate, assume sorted */
|
continue; /* duplicate, assume sorted */
|
||||||
/* RFC3986 decode */
|
/* RFC3986 decode */
|
||||||
cvec_add_string(commands, NULL, bodystr);
|
cvec_add_string(commands, NULL, bodystr);
|
||||||
|
bodystr0 = bodystr;
|
||||||
}
|
}
|
||||||
ok:
|
ok:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,11 @@
|
||||||
# Clixon roadmap
|
# Clixon roadmap
|
||||||
|
|
||||||
## High prio
|
|
||||||
- Special handling of the initial startup transaction to avoid exit at startup
|
|
||||||
- Possibly - draft-wu-netconf-restconf-factory-restore-03
|
|
||||||
- See (startup.md)
|
|
||||||
- Handle revisions to data model.
|
|
||||||
- Possibly draft-wang-netmod-module-revision-management-01
|
|
||||||
- See (startup.md)
|
|
||||||
|
|
||||||
## Medium prio:
|
|
||||||
- [Sanity checks](https://github.com/clicon/clixon/issues/47)
|
|
||||||
|
|
||||||
## Low prio:
|
|
||||||
- Provide a client library to access netconf APIs provided by system services.
|
|
||||||
- Netconf backend (Clixon acts as netconf controller)
|
|
||||||
- Support for restconf call-home (RFC 8071)
|
- Support for restconf call-home (RFC 8071)
|
||||||
|
|
||||||
Not prioritized:
|
|
||||||
- Support for restconf PATCH method
|
- Support for restconf PATCH method
|
||||||
- NETCONF
|
- NETCONF
|
||||||
- Support for additional Netconf [edit-config modes](https://github.com/clicon/clixon/issues/53)
|
- Support for additional Netconf [edit-config modes](https://github.com/clicon/clixon/issues/53)
|
||||||
- Netconf [framing](https://github.com/clicon/clixon/issues/50)
|
- Netconf [framing](https://github.com/clicon/clixon/issues/50)
|
||||||
- [Child ordering](https://github.com/clicon/clixon/issues/22)
|
- [Child ordering](https://github.com/clicon/clixon/issues/22)
|
||||||
- Restconf
|
|
||||||
- Query parameters
|
|
||||||
- Streams (netconf and restconf)
|
|
||||||
- Extend native stream mode with external persistent timeseries database, eg influxdb.
|
|
||||||
- (DONE)Jenkins/Travis CI/CD and webhooks
|
|
||||||
- YANG
|
|
||||||
- RFC 6022 [NETCONF monitoring](https://github.com/clicon/clixon/issues/39)
|
|
||||||
- Deviation, min/max-elements, action, unique
|
|
||||||
- Containers
|
|
||||||
- (DONE)[Docker improvements](https://github.com/clicon/clixon/issues/44)
|
|
||||||
- Kubernetes Helm chart definition
|
|
||||||
- [gRPC](https://github.com/clicon/clixon/issues/43)
|
- [gRPC](https://github.com/clicon/clixon/issues/43)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
theme: jekyll-theme-minimal
|
|
||||||
|
|
@ -30,7 +30,6 @@ cat <<EOF > $cfg
|
||||||
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||||
<CLICON_CLI_GENMODEL_COMPLETION>1</CLICON_CLI_GENMODEL_COMPLETION>
|
|
||||||
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
||||||
</clixon-config>
|
</clixon-config>
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
107
test/test_cli_multikey.sh
Executable file
107
test/test_cli_multikey.sh
Executable file
|
|
@ -0,0 +1,107 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# CLI test for multi-key lists
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# include err() and new() functions and creates $dir
|
||||||
|
|
||||||
|
cfg=$dir/conf_yang.xml
|
||||||
|
fyang=$dir/$APPNAME.yang
|
||||||
|
|
||||||
|
# Use yang in example
|
||||||
|
|
||||||
|
cat <<EOF > $cfg
|
||||||
|
<clixon-config xmlns="http://clicon.org/config">
|
||||||
|
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
||||||
|
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
||||||
|
<CLICON_YANG_DIR>$dir</CLICON_YANG_DIR>
|
||||||
|
<CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
|
||||||
|
<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>
|
||||||
|
<!-- ALL or VARS -->
|
||||||
|
<CLICON_CLI_GENMODEL_TYPE>ALL</CLICON_CLI_GENMODEL_TYPE>
|
||||||
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
|
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||||
|
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
||||||
|
</clixon-config>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF > $fyang
|
||||||
|
module $APPNAME{
|
||||||
|
yang-version 1.1;
|
||||||
|
prefix ex;
|
||||||
|
namespace "urn:example:clixon";
|
||||||
|
container ex {
|
||||||
|
list x{
|
||||||
|
key "a b" ;
|
||||||
|
leaf a {
|
||||||
|
type string;
|
||||||
|
}
|
||||||
|
leaf b {
|
||||||
|
type enumeration{
|
||||||
|
enum v1;
|
||||||
|
enum v2;
|
||||||
|
enum v3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
new "test params: -f $cfg"
|
||||||
|
if [ $BE -ne 0 ]; then
|
||||||
|
new "kill old backend"
|
||||||
|
sudo clixon_backend -z -f $cfg
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
err
|
||||||
|
fi
|
||||||
|
new "start backend -s init -f $cfg"
|
||||||
|
start_backend -s init -f $cfg
|
||||||
|
|
||||||
|
new "waiting"
|
||||||
|
wait_backend
|
||||||
|
fi
|
||||||
|
|
||||||
|
new "set 1 v1"
|
||||||
|
expectfn "$clixon_cli -1 -f $cfg set ex x a 1 b v1" 0 ""
|
||||||
|
|
||||||
|
new "set 1 v2"
|
||||||
|
expectfn "$clixon_cli -1 -f $cfg set ex x a 1 b v2" 0 ""
|
||||||
|
|
||||||
|
new "set 1 v3"
|
||||||
|
expectfn "$clixon_cli -1 -f $cfg set ex x a 1 b v3" 0 ""
|
||||||
|
|
||||||
|
new "set 2 v1"
|
||||||
|
expectfn "$clixon_cli -1 -f $cfg set ex x a 2 b v1" 0 ""
|
||||||
|
|
||||||
|
new "set 2 v2"
|
||||||
|
expectfn "$clixon_cli -1 -f $cfg set ex x a 2 b v2" 0 ""
|
||||||
|
|
||||||
|
new "set 2 v3"
|
||||||
|
expectfn "$clixon_cli -1 -f $cfg set ex x a 2 b v3" 0 ""
|
||||||
|
|
||||||
|
new "set 1 v2 again"
|
||||||
|
expectfn "$clixon_cli -1 -f $cfg set ex x a 1 b v2" 0 ""
|
||||||
|
|
||||||
|
new "show conf"
|
||||||
|
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>' '^<rpc-reply><data><ex xmlns="urn:example:clixon"><x><a>1</a><b>v1</b></x><x><a>1</a><b>v2</b></x><x><a>1</a><b>v3</b></x><x><a>2</a><b>v1</b></x><x><a>2</a><b>v2</b></x><x><a>2</a><b>v3</b></x></ex></data></rpc-reply>]]>]]>$'
|
||||||
|
|
||||||
|
if [ $BE -eq 0 ]; then
|
||||||
|
exit # BE
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
rm -rf $dir
|
||||||
|
|
@ -23,7 +23,6 @@ cat <<EOF > $cfg
|
||||||
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||||
<CLICON_CLI_GENMODEL_COMPLETION>1</CLICON_CLI_GENMODEL_COMPLETION>
|
|
||||||
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
||||||
<CLICON_MODULE_LIBRARY_RFC7895>true</CLICON_MODULE_LIBRARY_RFC7895>
|
<CLICON_MODULE_LIBRARY_RFC7895>true</CLICON_MODULE_LIBRARY_RFC7895>
|
||||||
</clixon-config>
|
</clixon-config>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue