* Fixed: [restconf patch method adds redundant namespaces #235](https://github.com/clicon/clixon/issues/235)
This commit is contained in:
parent
7d59ec1a3a
commit
a122efceff
7 changed files with 43 additions and 40 deletions
|
|
@ -8,5 +8,6 @@ branches:
|
||||||
script: ./configure --with-restconf=fcgi && make && sudo make install && make test
|
script: ./configure --with-restconf=fcgi && make && sudo make install && make test
|
||||||
before_script:
|
before_script:
|
||||||
- sudo apt-get install -y libfcgi-dev
|
- sudo apt-get install -y libfcgi-dev
|
||||||
- echo "$DOCKERPASSWD" | docker login -u "$DOCKERUSER" --password-stdin
|
|
||||||
|
- if [[ -n "${DOCKERUSER}" ]]; then echo "$DOCKERPASSWD" | docker login -u "$DOCKERUSER" --password-stdin; fi
|
||||||
- ./test/travis/before_script.sh
|
- ./test/travis/before_script.sh
|
||||||
|
|
|
||||||
21
CHANGELOG.md
21
CHANGELOG.md
|
|
@ -34,12 +34,11 @@ Expected: June 2021
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
|
||||||
* HTTP/2 support using nghttp2
|
* Restconf native HTTP/2 support using nghttp2
|
||||||
* --with-restconf=fcgi not affected, only for --with-restconf=native
|
* Enable using: `--with-restconf=native --enable-nghttp2`
|
||||||
* Added autoconf config for --with-restconf=native:
|
* FCGI/nginx not affected only for `--with-restconf=native`
|
||||||
* `--disable-evhtp` disabling http/1
|
* HTTP/1 co-exists, unless `--disable-evhtp` which results in http/2 only
|
||||||
* `--enable-nghttp2` enabling http/2
|
* TLS ALPN upgrade works but http (non SSL) http/1->http/2 upgrade is not yet implemented
|
||||||
* Remaining work: http (non ALPN) h1->h2 upgrade
|
|
||||||
* YANG when statement in conjunction with grouping/uses/augment
|
* YANG when statement in conjunction with grouping/uses/augment
|
||||||
* Several cases were not implemented fully according to RFC 7950:
|
* Several cases were not implemented fully according to RFC 7950:
|
||||||
* Do not extend default values if when statements evaluate to false
|
* Do not extend default values if when statements evaluate to false
|
||||||
|
|
@ -76,15 +75,8 @@ Users may have to change how they access the system
|
||||||
* Previous meaning (wrong): Return all `a` elements.
|
* Previous meaning (wrong): Return all `a` elements.
|
||||||
* New meaning (correct): Return the `a` instance with empty key string: "".
|
* New meaning (correct): Return the `a` instance with empty key string: "".
|
||||||
|
|
||||||
### C/CLI-API changes on existing features
|
|
||||||
|
|
||||||
Developers may need to change their code
|
|
||||||
|
|
||||||
*
|
|
||||||
|
|
||||||
### Minor features
|
### Minor features
|
||||||
|
|
||||||
* Restconf: ensure HEAD method works everywhere GET does.
|
|
||||||
* Added new startup-mode: `running-startup`: First try running db, if it is empty try startup db.
|
* Added new startup-mode: `running-startup`: First try running db, if it is empty try startup db.
|
||||||
* See [Can startup mode to be extended to support running-startup mode? #234](https://github.com/clicon/clixon/issues/234)
|
* See [Can startup mode to be extended to support running-startup mode? #234](https://github.com/clicon/clixon/issues/234)
|
||||||
* Restconf: added inline configuration using `-R <xml>` command line as an alternative to making advanced restconf configuration
|
* Restconf: added inline configuration using `-R <xml>` command line as an alternative to making advanced restconf configuration
|
||||||
|
|
@ -97,8 +89,11 @@ Developers may need to change their code
|
||||||
|
|
||||||
### Corrected Bugs
|
### Corrected Bugs
|
||||||
|
|
||||||
|
* Fixed: [restconf patch method adds redundant namespaces #235](https://github.com/clicon/clixon/issues/235)
|
||||||
|
* Fixed: Restconf HEAD did not work everywhere GET did, such as well-known and exact root.
|
||||||
* Fixed: [JSON parsing error for a specific input. #236](https://github.com/clicon/clixon/issues/236)
|
* Fixed: [JSON parsing error for a specific input. #236](https://github.com/clicon/clixon/issues/236)
|
||||||
* JSON empty list parse problems, eg `a:[]`
|
* JSON empty list parse problems, eg `a:[]`
|
||||||
|
* May also have fixed: [Json parser not work properly with empry array \[\] #228](https://github.com/clicon/clixon/issues/228)
|
||||||
* Fixed: [restconf patch method unable to chage value to empty string #229](https://github.com/clicon/clixon/issues/229)
|
* Fixed: [restconf patch method unable to chage value to empty string #229](https://github.com/clicon/clixon/issues/229)
|
||||||
* Fixed: [when condition error under augment in restconf #227](https://github.com/clicon/clixon/issues/227)
|
* Fixed: [when condition error under augment in restconf #227](https://github.com/clicon/clixon/issues/227)
|
||||||
* Fixed: [Using YANG union with decimal64 and string leads to regexp match fail #226](https://github.com/clicon/clixon/issues/226)
|
* Fixed: [Using YANG union with decimal64 and string leads to regexp match fail #226](https://github.com/clicon/clixon/issues/226)
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ int xml_sanity(cxobj *x, void *arg);
|
||||||
int xml_non_config_data(cxobj *xt, cxobj **xerr);
|
int xml_non_config_data(cxobj *xt, cxobj **xerr);
|
||||||
int xml2xpath(cxobj *x, char **xpath);
|
int xml2xpath(cxobj *x, char **xpath);
|
||||||
int assign_namespace_element(cxobj *x0, cxobj *x1, cxobj *x1p);
|
int assign_namespace_element(cxobj *x0, cxobj *x1, cxobj *x1p);
|
||||||
int assign_namespace_body(cxobj *x0, char *x0bstr, cxobj *x1);
|
int assign_namespace_body(cxobj *x0, cxobj *x1);
|
||||||
int xml_merge(cxobj *x0, cxobj *x1, yang_stmt *yspec, char **reason);
|
int xml_merge(cxobj *x0, cxobj *x1, yang_stmt *yspec, char **reason);
|
||||||
int yang_enum_int_value(cxobj *node, int32_t *val);
|
int yang_enum_int_value(cxobj *node, int32_t *val);
|
||||||
int xml_copy_marked(cxobj *x0, cxobj *x1);
|
int xml_copy_marked(cxobj *x0, cxobj *x1);
|
||||||
|
|
|
||||||
|
|
@ -487,7 +487,6 @@ text_modify(clicon_handle h,
|
||||||
if (strcmp(restype, "enumeration") == 0 ||
|
if (strcmp(restype, "enumeration") == 0 ||
|
||||||
strcmp(restype, "bits") == 0)
|
strcmp(restype, "bits") == 0)
|
||||||
x1bstr = clixon_trim2(x1bstr, " \t\n");
|
x1bstr = clixon_trim2(x1bstr, " \t\n");
|
||||||
|
|
||||||
/* If origin body has namespace definitions, copy them. The reason is that
|
/* If origin body has namespace definitions, copy them. The reason is that
|
||||||
* some bodies rely on namespace prefixes, such as NACM path, but there is
|
* some bodies rely on namespace prefixes, such as NACM path, but there is
|
||||||
* no way we can know this here.
|
* no way we can know this here.
|
||||||
|
|
@ -496,7 +495,7 @@ text_modify(clicon_handle h,
|
||||||
* is for element symbols)
|
* is for element symbols)
|
||||||
* Oh well.
|
* Oh well.
|
||||||
*/
|
*/
|
||||||
if (assign_namespace_body(x1, x1bstr, x0) < 0)
|
if (assign_namespace_body(x1, x0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if ((x0b = xml_body_get(x0)) != NULL){
|
if ((x0b = xml_body_get(x0)) != NULL){
|
||||||
|
|
|
||||||
|
|
@ -933,7 +933,6 @@ add_namespace(cxobj *x,
|
||||||
if (xml_value_set(xa, namespace) < 0)
|
if (xml_value_set(xa, namespace) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
xml_sort(xp); /* Ensure attr is first / XXX xml_insert? */
|
xml_sort(xp); /* Ensure attr is first / XXX xml_insert? */
|
||||||
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
return retval;
|
return retval;
|
||||||
|
|
@ -1798,47 +1797,53 @@ assign_namespace_element(cxobj *x0, /* source */
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If origin body has namespace definitions, copy them. The reason is that
|
/*! Copy namespace declarations from source to target
|
||||||
|
*
|
||||||
|
* If origin body has namespace definitions, copy them. The reason is that
|
||||||
* some bodies rely on namespace prefixes, such as NACM path, but there is
|
* some bodies rely on namespace prefixes, such as NACM path, but there is
|
||||||
* no way we can now this here.
|
* no way we can now this here.
|
||||||
* However, this may lead to namespace collisions if these prefixes are not
|
* However, this may lead to namespace collisions if these prefixes are not
|
||||||
* canonical, and may collide with the assign_namespace_element() above (but that
|
* canonical, and may collide with the assign_namespace_element() above (but that
|
||||||
* is for element sysmbols)
|
* is for element symbols)
|
||||||
|
*
|
||||||
|
* @param[in] x0 Source XML
|
||||||
|
* @param[in] x1 Destination XML
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
assign_namespace_body(cxobj *x0, /* source */
|
assign_namespace_body(cxobj *x0, /* source */
|
||||||
char *x0bstr,
|
|
||||||
cxobj *x1) /* target */
|
cxobj *x1) /* target */
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
char *namespace = NULL;
|
char *namespace = NULL;
|
||||||
|
char *namespace1;
|
||||||
char *name;
|
char *name;
|
||||||
char *prefix;
|
char *prefix0;
|
||||||
char *prefix0 = NULL;;
|
char *prefix1 = NULL;
|
||||||
char *pexisting = NULL;;
|
|
||||||
cxobj *xa;
|
cxobj *xa;
|
||||||
|
|
||||||
xa = NULL;
|
xa = NULL;
|
||||||
while ((xa = xml_child_each(x0, xa, CX_ATTR)) != NULL) {
|
while ((xa = xml_child_each(x0, xa, CX_ATTR)) != NULL) {
|
||||||
prefix = xml_prefix(xa);
|
prefix0 = xml_prefix(xa);
|
||||||
name = xml_name(xa);
|
name = xml_name(xa);
|
||||||
namespace = xml_value(xa);
|
namespace = xml_value(xa);
|
||||||
if ((strcmp(name, "xmlns")==0 && prefix==NULL) ||
|
if ((strcmp(name, "xmlns")==0 && prefix0==NULL) ||
|
||||||
(prefix != NULL && strcmp(prefix, "xmlns")==0)){
|
(prefix0 != NULL && strcmp(prefix0, "xmlns")==0)){
|
||||||
if (prefix == NULL)
|
if (prefix0 == NULL)
|
||||||
prefix0 = NULL;
|
prefix1 = NULL;
|
||||||
else
|
else
|
||||||
prefix0 = name;
|
prefix1 = name;
|
||||||
|
/* prefix1 contains actual prefix or NULL, prefix0 can be xmlns */
|
||||||
if (strcmp(namespace, NETCONF_BASE_NAMESPACE) ==0 ||
|
if (strcmp(namespace, NETCONF_BASE_NAMESPACE) ==0 ||
|
||||||
strcmp(namespace, YANG_XML_NAMESPACE) ==0)
|
strcmp(namespace, YANG_XML_NAMESPACE) ==0)
|
||||||
continue;
|
continue;
|
||||||
/* Detect if prefix:namespace is declared already? */
|
/* Detect if prefix:namespace is declared already? */
|
||||||
if (xml2prefix(x1, namespace, &pexisting) == 1){
|
if (xml2ns(x1, prefix1, &namespace1) == 1)
|
||||||
/* Yes, and it has prefix pexist */
|
continue;
|
||||||
if (clicon_strcmp(pexisting, prefix0) ==0)
|
/* Does prefix already point at right namespace? */
|
||||||
continue;
|
if (namespace1 && strcmp(namespace, namespace1)==0)
|
||||||
}
|
continue;
|
||||||
if (add_namespace(x1, x1, prefix0, namespace) < 0)
|
/* No, add entry */
|
||||||
|
if (add_namespace(x1, x1, prefix1, namespace) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ xml_nsctx_get_prefix(cvec *cvv,
|
||||||
/*! Set or replace namespace in namespace context
|
/*! Set or replace namespace in namespace context
|
||||||
* @param[in] cvv Namespace context
|
* @param[in] cvv Namespace context
|
||||||
* @param[in] prefix Namespace prefix, or NULL for default
|
* @param[in] prefix Namespace prefix, or NULL for default
|
||||||
* @param[in] ns Cached namespace to set (assume non-null?)
|
* @param[in] ns Cached namespace to set (assume non-null?)
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
* @retval -1 Error
|
* @retval -1 Error
|
||||||
*/
|
*/
|
||||||
|
|
@ -604,6 +604,8 @@ xmlns_set(cxobj *x,
|
||||||
* @retval -1 Error
|
* @retval -1 Error
|
||||||
* @retval 0 No namespace found
|
* @retval 0 No namespace found
|
||||||
* @retval 1 Namespace found, prefix returned in prefixp
|
* @retval 1 Namespace found, prefix returned in prefixp
|
||||||
|
* @note a namespace can have two or more prefixes, this just returns the first
|
||||||
|
* @see xml2prefixexists to check a specific pair
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml2prefix(cxobj *xn,
|
xml2prefix(cxobj *xn,
|
||||||
|
|
@ -660,3 +662,4 @@ xml2prefix(cxobj *xn,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ if [ $BE -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg"
|
new "start backend -s init -f $cfg"
|
||||||
start_backend -s init -f $cfg
|
start_backend -s init -f $cfg
|
||||||
|
|
||||||
new "waiting"
|
|
||||||
wait_backend
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
new "wait backend"
|
||||||
|
wait_backend
|
||||||
|
|
||||||
new "cli configure top"
|
new "cli configure top"
|
||||||
expectpart "$($clixon_cli -1 -f $cfg set interfaces)" 0 "^$"
|
expectpart "$($clixon_cli -1 -f $cfg set interfaces)" 0 "^$"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue