Merge branch 'develop' of https://github.com/clicon/clixon into develop
This commit is contained in:
commit
f1f0dafcbc
22 changed files with 29 additions and 1333 deletions
18
CHANGELOG.md
18
CHANGELOG.md
|
|
@ -1,5 +1,23 @@
|
|||
# Clixon Changelog
|
||||
|
||||
## 3.8.0 (Upcoming)
|
||||
|
||||
### Major New features
|
||||
|
||||
### API changes on existing features (you may need to change your code)
|
||||
|
||||
### Minor changes
|
||||
* Obsoleted COMPAT_CLIV and COMPAT_XSL that were optional in 3.7
|
||||
|
||||
### Corrected Bugs
|
||||
|
||||
### Known issues
|
||||
* Namespace name relabeling is not supported.
|
||||
* Eg: if "des" is defined as prefix for an imported module, then a relabeling using xmlfns is not supported, such as:
|
||||
```
|
||||
<crypto xmlns:x="urn:example:des">x:des3</crypto>
|
||||
```
|
||||
|
||||
## 3.7.0 (22 July 2018)
|
||||
|
||||
### Major New features
|
||||
|
|
|
|||
|
|
@ -987,13 +987,7 @@ nacm_access(clicon_handle h,
|
|||
if (username == NULL)
|
||||
goto step10;
|
||||
/* User's group */
|
||||
if (xpath_vec(xacm,
|
||||
#ifdef COMPAT_XSL
|
||||
"groups/group[user-name=%s]",
|
||||
#else
|
||||
"groups/group[user-name='%s']",
|
||||
#endif
|
||||
&gvec, &glen, username) < 0)
|
||||
if (xpath_vec(xacm, "groups/group[user-name='%s']", &gvec, &glen, username) < 0)
|
||||
goto done;
|
||||
/* 5. If no groups are found, continue with step 10. */
|
||||
if (glen == 0)
|
||||
|
|
@ -1010,13 +1004,7 @@ nacm_access(clicon_handle h,
|
|||
for (j=0; j<glen; j++){
|
||||
char *gname;
|
||||
gname = xml_find_body(gvec[j], "name");
|
||||
if (xpath_first(xrlist,
|
||||
#ifdef COMPAT_XSL
|
||||
".[group=%s]",
|
||||
#else
|
||||
".[group='%s']",
|
||||
#endif
|
||||
gname)!=NULL)
|
||||
if (xpath_first(xrlist, ".[group='%s']", gname)!=NULL)
|
||||
break; /* found */
|
||||
}
|
||||
if (j==glen) /* not found */
|
||||
|
|
|
|||
|
|
@ -1038,79 +1038,6 @@ cli_notify(clicon_handle h,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/* Backward compatible Set if you want to enable "v" cli callback functions,
|
||||
* such as cli_setv()
|
||||
* This was obsoleted in 3.7.
|
||||
* @see include/clixon_custom.h
|
||||
*/
|
||||
#ifdef COMPAT_CLIV
|
||||
int cli_setv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_set(h, vars, argv);
|
||||
}
|
||||
int cli_mergev(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_merge(h, vars, argv);
|
||||
}
|
||||
int cli_delv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_del(h, vars, argv);
|
||||
}
|
||||
int cli_debug_cliv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_debug_cli(h, vars, argv);
|
||||
}
|
||||
int cli_debug_backendv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_debug_backend(h, vars, argv);
|
||||
}
|
||||
int cli_set_modev(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_set_mode(h, vars, argv);
|
||||
}
|
||||
int cli_start_shellv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_start_shell(h, vars, argv);
|
||||
}
|
||||
int cli_quitv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_quit(h, vars, argv);
|
||||
}
|
||||
int cli_commitv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_commit(h, vars, argv);
|
||||
}
|
||||
int cli_validatev(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_validate(h, vars, argv);
|
||||
|
||||
}
|
||||
int compare_dbsv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return compare_dbs(h, vars, argv);
|
||||
}
|
||||
int load_config_filev(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return load_config_file(h, vars, argv);
|
||||
}
|
||||
int save_config_filev(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return save_config_file(h, vars, argv);
|
||||
}
|
||||
int delete_allv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return delete_all(h, vars, argv);
|
||||
}
|
||||
int discard_changesv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return discard_changes(h, vars, argv);
|
||||
}
|
||||
int cli_notifyv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return cli_notify(h, vars, argv);
|
||||
}
|
||||
#endif /* COMPAT_CLIV */
|
||||
|
||||
/*! Lock database
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
|
|
@ -1249,23 +1176,6 @@ cli_copy_config(clicon_handle h,
|
|||
for (i=0; i<strlen(xpath); i++){
|
||||
if (xpath[i] == '%')
|
||||
j++;
|
||||
#ifdef COMPAT_XSL
|
||||
/* This is a horrible kludge due to:
|
||||
* (1) old xpath implementation wrongly did: a[b=x] instead of a[b='x']
|
||||
* (2) cli_copy_config has as 2nd argument such an xpath provided by user.
|
||||
*/
|
||||
if (j==2){
|
||||
int k;
|
||||
if ((xpath[i-1] == '\'' || xpath[i-1] == '\"') &&
|
||||
(xpath[i+2] == '\'' || xpath[i+2] == '\"')){
|
||||
for (k=i-1;k<i+2;k++)
|
||||
xpath[k] = xpath[k+1];
|
||||
for (k=i+1;k<strlen(xpath)+1;k++)
|
||||
xpath[k] = xpath[k+2];
|
||||
i-=1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (j != 2){
|
||||
clicon_err(OE_PLUGIN, 0, "xpath '%s' does not have two '%%'", xpath);
|
||||
|
|
|
|||
|
|
@ -686,13 +686,4 @@ cli_show_auto(clicon_handle h,
|
|||
return retval;
|
||||
}
|
||||
|
||||
#ifdef COMPAT_CLIV
|
||||
int show_yangv(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return show_yang(h, vars, argv);
|
||||
}
|
||||
int show_confv_xpath(clicon_handle h, cvec *vars, cvec *argv)
|
||||
{
|
||||
return show_conf_xpath(h, vars, argv);
|
||||
}
|
||||
#endif /* COMPAT_CLIV */
|
||||
|
||||
|
|
|
|||
|
|
@ -144,25 +144,4 @@ int cli_show_config(clicon_handle h, cvec *cvv, cvec *argv);
|
|||
|
||||
int cli_show_auto(clicon_handle h, cvec *cvv, cvec *argv);
|
||||
|
||||
#ifdef COMPAT_CLIV
|
||||
int cli_setv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_mergev(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_delv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_debug_cliv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_debug_backendv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_set_modev(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_start_shellv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_quitv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_commitv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_validatev(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int compare_dbsv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int load_config_filev(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int save_config_filev(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int delete_allv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int discard_changesv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int cli_notifyv(clicon_handle h, cvec *cvv, cvec *argv);
|
||||
int show_yangv(clicon_handle h, cvec *vars, cvec *argv);
|
||||
int show_confv_xpath(clicon_handle h, cvec *cvv, cvec *argv);
|
||||
#endif /* COMPAT_CLIV */
|
||||
|
||||
#endif /* _CLIXON_CLI_API_H_ */
|
||||
|
|
|
|||
4
configure
vendored
4
configure
vendored
|
|
@ -2155,9 +2155,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||
: ${INSTALLFLAGS="-s"}
|
||||
|
||||
CLIXON_VERSION_MAJOR="3"
|
||||
CLIXON_VERSION_MINOR="7"
|
||||
CLIXON_VERSION_MINOR="8"
|
||||
CLIXON_VERSION_PATCH="0"
|
||||
CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}\""
|
||||
CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}.PRE\""
|
||||
|
||||
# Fix to specific CLIgen version (eg 3.5) or head (3)
|
||||
CLIGEN_VERSION="3"
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ AC_INIT(lib/clixon/clixon.h.in)
|
|||
: ${INSTALLFLAGS="-s"}
|
||||
|
||||
CLIXON_VERSION_MAJOR="3"
|
||||
CLIXON_VERSION_MINOR="7"
|
||||
CLIXON_VERSION_MINOR="8"
|
||||
CLIXON_VERSION_PATCH="0"
|
||||
CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}\""
|
||||
CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}.PRE\""
|
||||
|
||||
# Fix to specific CLIgen version (eg 3.5) or head (3)
|
||||
CLIGEN_VERSION="3"
|
||||
|
|
|
|||
|
|
@ -68,11 +68,7 @@ mycallback(clicon_handle h, cvec *cvv, cvec *argv)
|
|||
|
||||
/* Show eth0 interfaces config using XPATH */
|
||||
if (clicon_rpc_get_config(h, "running",
|
||||
#ifdef COMPAT_XSL
|
||||
"/interfaces/interface[name=eth0]",
|
||||
#else
|
||||
"/interfaces/interface[name='eth0']",
|
||||
#endif
|
||||
&xret) < 0)
|
||||
goto done;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,6 @@
|
|||
int strverscmp (__const char *__s1, __const char *__s2);
|
||||
#endif
|
||||
|
||||
/* Set if you want to enable "v" cli callback functions, such as cli_setv()
|
||||
* This was obsoleted in 3.7
|
||||
*/
|
||||
#undef COMPAT_CLIV
|
||||
|
||||
/* Set if you want to assert that all rpc messages have set username
|
||||
*/
|
||||
#undef RPC_USERNAME_ASSERT
|
||||
|
|
@ -56,13 +51,3 @@ int strverscmp (__const char *__s1, __const char *__s2);
|
|||
*/
|
||||
#define XMLNS_YANG_ONLY 1
|
||||
|
||||
/* Set if you want to enable old xpath functions in clixon_xsl.* instead of the
|
||||
* the new xpath functions in clixon_xpath.*
|
||||
* Note that when changing from old xpath code to new, calls on the form
|
||||
* `x[a=str]` where `str` is a string (not a number or XML symbol),
|
||||
* must be changed to: `x[a='str'] or x[a="str"]`
|
||||
* Enabling COMPAT_XSL may make sense if you have written a lot of user code that
|
||||
* relieson the error above. Or if a bug appears in the newimplementation.
|
||||
* @see test/lib.sh
|
||||
*/
|
||||
#undef COMPAT_XSL
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@
|
|||
#include <clixon/clixon_options.h>
|
||||
#include <clixon/clixon_xml_map.h>
|
||||
#include <clixon/clixon_xml_db.h>
|
||||
#include <clixon/clixon_xsl.h>
|
||||
#include <clixon/clixon_xpath_ctx.h>
|
||||
#include <clixon/clixon_xpath.h>
|
||||
#include <clixon/clixon_json.h>
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright (C) 2009-2018 Olof Hagsand and Benny Holmgren
|
||||
|
||||
This file is part of CLIXON.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 3 or later (the "GPL"),
|
||||
in which case the provisions of the GPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of the GPL, and not to allow others to
|
||||
use your version of this file under the terms of Apache License version 2,
|
||||
indicate your decision by deleting the provisions above and replace them with
|
||||
the notice and other provisions required by the GPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the Apache License version 2 or the GPL.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
|
||||
* XML XPATH and XSLT functions.
|
||||
*/
|
||||
#ifndef _CLIXON_XSL_H
|
||||
#define _CLIXON_XSL_H
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int xpath_vec_xsl(cxobj *cxtop, char *xpath, cxobj ***vec, size_t *veclen);
|
||||
int xpath_vec_flag_xsl(cxobj *cxtop, char *xpath, uint16_t flags,
|
||||
cxobj ***vec, size_t *veclen);
|
||||
cxobj *xpath_first_xsl(cxobj *cxtop, char *xpath);
|
||||
#ifdef COMPAT_XSL
|
||||
cxobj *xpath_each(cxobj *xn_top, char *xpath, cxobj *prev);
|
||||
#endif
|
||||
|
||||
#endif /* _CLIXON_XSL_H */
|
||||
|
|
@ -72,7 +72,7 @@ SRC = clixon_sig.c clixon_log.c clixon_err.c clixon_event.c \
|
|||
clixon_json.c clixon_yang.c clixon_yang_type.c \
|
||||
clixon_hash.c clixon_options.c clixon_plugin.c \
|
||||
clixon_proto.c clixon_proto_client.c \
|
||||
clixon_xsl.c clixon_xpath.c clixon_xpath_ctx.c clixon_sha1.c \
|
||||
clixon_xpath.c clixon_xpath_ctx.c clixon_sha1.c \
|
||||
clixon_xml_db.c clixon_netconf_lib.c
|
||||
|
||||
YACCOBJS := lex.clixon_xml_parse.o clixon_xml_parse.tab.o \
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@
|
|||
#include "clixon_options.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_plugin.h"
|
||||
#include "clixon_xsl.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
#include "clixon_xml_map.h"
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@
|
|||
#include "clixon_yang.h"
|
||||
#include "clixon_sig.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xsl.h"
|
||||
#include "clixon_proto.h"
|
||||
|
||||
static int _atomicio_sig = 0;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@
|
|||
#include "clixon_options.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_plugin.h"
|
||||
#include "clixon_xsl.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@
|
|||
#include "clixon_plugin.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
#include "clixon_xsl.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
|
|
@ -1088,13 +1087,7 @@ api_path_fmt2xpath(char *api_path_fmt,
|
|||
clicon_err(OE_UNIX, errno, "cv2str_dup");
|
||||
goto done;
|
||||
}
|
||||
cprintf(cb,
|
||||
#ifdef COMPAT_XSL
|
||||
"[%s=%s]",
|
||||
#else
|
||||
"[%s='%s']",
|
||||
#endif
|
||||
cv_name_get(cv), str);
|
||||
cprintf(cb, "[%s='%s']", cv_name_get(cv), str);
|
||||
free(str);
|
||||
}
|
||||
}
|
||||
|
|
@ -1511,13 +1504,7 @@ api_path2xpath_cvv(yang_spec *yspec,
|
|||
cprintf(xpath, "/%s", name);
|
||||
v = val;
|
||||
while ((cvi = cvec_each(cvk, cvi)) != NULL){
|
||||
cprintf(xpath,
|
||||
#ifdef COMPAT_XSL
|
||||
"[%s=%s]",
|
||||
#else
|
||||
"[%s='%s']",
|
||||
#endif
|
||||
cv_string_get(cvi), v);
|
||||
cprintf(xpath, "[%s='%s']", cv_string_get(cvi), v);
|
||||
v += strlen(v)+1;
|
||||
}
|
||||
if (val)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@
|
|||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xsl.h"
|
||||
#include "clixon_xpath_parse.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
|
|
@ -1142,16 +1141,11 @@ xpath_first(cxobj *xcur,
|
|||
goto done;
|
||||
}
|
||||
va_end(ap);
|
||||
#ifdef COMPAT_XSL
|
||||
if ((cx = xpath_first_xsl(xcur, xpath)) == NULL)
|
||||
goto done;
|
||||
#else
|
||||
if (xpath_vec_ctx(xcur, xpath, &xr) < 0)
|
||||
goto done;
|
||||
|
||||
if (xr && xr->xc_type == XT_NODESET && xr->xc_size)
|
||||
cx = xr->xc_nodeset[0];
|
||||
#endif
|
||||
done:
|
||||
if (xr)
|
||||
ctx_free(xr);
|
||||
|
|
@ -1211,10 +1205,6 @@ xpath_vec(cxobj *xcur,
|
|||
va_end(ap);
|
||||
*vec=NULL;
|
||||
*veclen = 0;
|
||||
#ifdef COMPAT_XSL
|
||||
if (xpath_vec_xsl(xcur, xpath, vec, veclen) < 0)
|
||||
goto done;
|
||||
#else
|
||||
if (xpath_vec_ctx(xcur, xpath, &xr) < 0)
|
||||
goto done;
|
||||
if (xr && xr->xc_type == XT_NODESET){
|
||||
|
|
@ -1222,7 +1212,6 @@ xpath_vec(cxobj *xcur,
|
|||
xr->xc_nodeset = NULL;
|
||||
*veclen = xr->xc_size;
|
||||
}
|
||||
#endif
|
||||
retval = 0;
|
||||
done:
|
||||
if (xr)
|
||||
|
|
@ -1268,10 +1257,8 @@ xpath_vec_flag(cxobj *xcur,
|
|||
size_t len;
|
||||
char *xpath = NULL;
|
||||
xp_ctx *xr = NULL;
|
||||
#ifndef COMPAT_XSL
|
||||
int i;
|
||||
cxobj *x;
|
||||
#endif
|
||||
|
||||
va_start(ap, veclen);
|
||||
len = vsnprintf(NULL, 0, format, ap);
|
||||
|
|
@ -1291,10 +1278,6 @@ xpath_vec_flag(cxobj *xcur,
|
|||
va_end(ap);
|
||||
*vec=NULL;
|
||||
*veclen = 0;
|
||||
#ifdef COMPAT_XSL
|
||||
if (xpath_vec_flag_xsl(xcur, xpath, flags, vec, veclen) < 0)
|
||||
goto done;
|
||||
#else
|
||||
if (xpath_vec_ctx(xcur, xpath, &xr) < 0)
|
||||
goto done;
|
||||
if (xr && xr->xc_type == XT_NODESET){
|
||||
|
|
@ -1305,8 +1288,6 @@ xpath_vec_flag(cxobj *xcur,
|
|||
goto done;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
retval = 0;
|
||||
done:
|
||||
if (xr)
|
||||
|
|
|
|||
1041
lib/src/clixon_xsl.c
1041
lib/src/clixon_xsl.c
File diff suppressed because it is too large
Load diff
|
|
@ -5,10 +5,6 @@
|
|||
testnr=0
|
||||
testname=
|
||||
|
||||
# Set to 1 to enable old XSL implementation. Set to nothing, or comment if new.
|
||||
# @see include/clixon_custom.h
|
||||
#COMPAT_XSL=1
|
||||
|
||||
# For memcheck
|
||||
#clixon_cli="valgrind --leak-check=full --show-leak-kinds=all clixon_cli"
|
||||
clixon_cli=clixon_cli
|
||||
|
|
|
|||
|
|
@ -94,15 +94,10 @@ new "Add subtree eth/0/0 using none and create which should add eth/0/0"
|
|||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 '<rpc><edit-config><target><candidate/></target><config><interfaces><interface operation="create"><name>eth/0/0</name><type>ex:eth</type></interface></interfaces></config><default-operation>none</default-operation> </edit-config></rpc>]]>]]>' "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
# Too many quotes, (single inside double inside single) need to fool bash
|
||||
if [ -z "$COMPAT_XSL" ]; then
|
||||
cat <<EOF > $tmp # new
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface[name='eth/0/0']"/></get-config></rpc>]]>]]>
|
||||
EOF
|
||||
else # old
|
||||
cat <<EOF > $tmp
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface[name=eth/0/0]"/></get-config></rpc>]]>]]>
|
||||
EOF
|
||||
fi
|
||||
|
||||
new "Check eth/0/0 added using xpath"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "$(cat $tmp)" "^<rpc-reply><data><interfaces><interface><name>eth/0/0</name><type>ex:eth</type><enabled>true</enabled></interface></interfaces></data></rpc-reply>]]>]]>$"
|
||||
|
||||
|
|
@ -122,29 +117,17 @@ new "netconf edit config"
|
|||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><edit-config><target><candidate/></target><config><interfaces><interface><name>eth/0/0</name></interface><interface><name>eth1</name><enabled>true</enabled><ipv4><address><ip>9.2.3.4</ip><prefix-length>24</prefix-length></address></ipv4></interface></interfaces></config></edit-config></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
# Too many quotes
|
||||
if [ -z "$COMPAT_XSL" ]; then
|
||||
cat <<EOF > $tmp # new
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface[name='eth1']/enabled"/></get-config></rpc>]]>]]>
|
||||
EOF
|
||||
else
|
||||
cat <<EOF > $tmp # old
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface[name=eth1]/enabled"/></get-config></rpc>]]>]]>
|
||||
EOF
|
||||
fi
|
||||
|
||||
new "netconf get config xpath"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "$(cat $tmp)" "^<rpc-reply><data><interfaces><interface><name>eth1</name><enabled>true</enabled></interface></interfaces></data></rpc-reply>]]>]]>$"
|
||||
|
||||
# Too many quotes
|
||||
if [ -z "$COMPAT_XSL" ]; then
|
||||
cat <<EOF > $tmp # new
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface[name='eth1']/enabled/../.."/></get-config></rpc>]]>]]>
|
||||
EOF
|
||||
else
|
||||
cat <<EOF > $tmp # old
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface[name=eth1]/enabled/../.."/></get-config></rpc>]]>]]>
|
||||
EOF
|
||||
fi
|
||||
|
||||
new "netconf get config xpath parent"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "$(cat $tmp)" "^<rpc-reply><data><interfaces><interface><name>eth/0/0</name><enabled>true</enabled></interface><interface><name>eth1</name><enabled>true</enabled><ipv4><enabled>true</enabled><forwarding>false</forwarding><address><ip>9.2.3.4</ip><prefix-length>24</prefix-length></address></ipv4></interface></interfaces></data></rpc-reply>]]>]]>$"
|
||||
|
|
|
|||
|
|
@ -121,8 +121,6 @@ fi
|
|||
new "verify running from start, should be: l,c,y0,y1,y2,y3; y1 and y3 sorted. Note this fails if XML_SORT set to false"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>" "^<rpc-reply><data><c><d>hej</d></c><l>hopp</l><y0>d</y0><y0>b</y0><y0>c</y0><y0>a</y0><y1>a</y1><y1>b</y1><y1>c</y1><y1>d</y1><y2><k>d</k><a>bar</a></y2><y2><k>a</k><a>bar</a></y2><y2><k>c</k><a>bar</a></y2><y2><k>b</k><a>bar</a></y2><y3><k>a</k><a>bar</a></y3><y3><k>b</k><a>bar</a></y3><y3><k>c</k><a>bar</a></y3><y3><k>d</k><a>bar</a></y3></data></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ -z "$COMPAT_XSL" ]; then #new
|
||||
|
||||
new "get each ordered-by user leaf-list"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><running/></source><filter type=\"xpath\" select=\"/y2[k='a']\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><y2><k>a</k><a>bar</a></y2></data></rpc-reply>]]>]]>$"
|
||||
|
||||
|
|
@ -135,22 +133,6 @@ expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><runn
|
|||
new "get each ordered-by user leaf-list"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><running/></source><filter type=\"xpath\" select=\"/y3[k='b']\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><y3><k>b</k><a>bar</a></y3></data></rpc-reply>]]>]]>$"
|
||||
|
||||
else # old
|
||||
|
||||
new "get each ordered-by user leaf-list"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><running/></source><filter type=\"xpath\" select=\"/y2[k=a]\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><y2><k>a</k><a>bar</a></y2></data></rpc-reply>]]>]]>$"
|
||||
|
||||
new "get each ordered-by user leaf-list"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><running/></source><filter type=\"xpath\" select=\"/y3[k=a]\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><y3><k>a</k><a>bar</a></y3></data></rpc-reply>]]>]]>$"
|
||||
|
||||
new "get each ordered-by user leaf-list"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><running/></source><filter type=\"xpath\" select=\"/y2[k=b]\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><y2><k>b</k><a>bar</a></y2></data></rpc-reply>]]>]]>$"
|
||||
|
||||
new "get each ordered-by user leaf-list"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><running/></source><filter type=\"xpath\" select=\"/y3[k=b]\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><y3><k>b</k><a>bar</a></y3></data></rpc-reply>]]>]]>$"
|
||||
|
||||
fi
|
||||
|
||||
new "delete candidate"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc><delete-config><target><candidate/></target></delete-config></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
|
|
|
|||
|
|
@ -136,13 +136,8 @@ expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><edit-config><target><can
|
|||
new "netconf get leaf-list"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/x/f/e\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><x><f><e>hej</e><e>hopp</e></f></x></data></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ -z "$COMPAT_XSL" ]; then # new
|
||||
new "netconf get leaf-list path"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/x/f[e='hej']\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><x><f><e>hej</e><e>hopp</e></f></x></data></rpc-reply>]]>]]>$"
|
||||
else # old
|
||||
new "netconf get leaf-list path"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/x/f[e=hej]\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><x><f><e>hej</e><e>hopp</e></f></x></data></rpc-reply>]]>]]>$"
|
||||
fi
|
||||
|
||||
new "netconf get (should be some)"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get><filter type=\"xpath\" select=\"/\"/></get></rpc>]]>]]>" "^<rpc-reply><data><x><y><a>1</a><b>2</b><c>5</c><val>one</val></y><d/></x></data></rpc-reply>]]>]]>$"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue