Skip to content

Commit

Permalink
Fixed: [Invalid api-path errors thrown when displayin qfx family devi…
Browse files Browse the repository at this point in the history
…ce conf in CLI](clicon/clixon-controller#126)
  • Loading branch information
olofhagsand committed Jun 19, 2024
1 parent 0234ed9 commit 43325ca
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Developers may need to change their code

### Corrected Bugs

* Fixed: [Invalid api-path errors thrown when displayin qfx family device conf in CLI](https://github.com/clicon/clixon-controller/issues/126)
* Fixed: [Error message from CLI if terminal is modified](https://github.com/clicon/clixon-controller/issues/122)
* Fixed: backend exit when receiving invalid NETCONF get select XPath
* Added XML encoding to XPaths in `select` attribute
Expand Down
46 changes: 28 additions & 18 deletions lib/src/clixon_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,22 +822,13 @@ api_path2xpath_cvv(cvec *api_path,
goto done;
if (ret == 1){
y1 = NULL;
if (nsc){
cvec_free(nsc);
nsc = NULL;
}
if (xml_nsctx_yangspec(yspec, &nsc) < 0)
goto done;
/* cf xml_bind_yang0_opt/xml_yang_mount_get */
if (yang_mount_get(y, cbuf_get(xpath), &y1) < 0)
goto done;
if (y1 != NULL){
y = y1;
yspec = y1;
root = 1;
}
}
if ((ymtpoint = yang_schema_mount_point(y)) < 0)
goto done;
if (ymtpoint){
if (yang_mount_get_yspec_any(y, &yspec) < 0)
goto done;
}
/* Get XML/xpath prefix given namespace.
* note different from api-path prefix
Expand All @@ -857,6 +848,25 @@ api_path2xpath_cvv(cvec *api_path,
if (xprefix)
cprintf(xpath, "%s:", xprefix);
cprintf(xpath, "%s", name);
if (ret == 1) {
if (yang_mount_get(y, cbuf_get(xpath), &y1) < 0)
goto done;
if (y1 != NULL){
y = y1;
yspec = y1;
root = 1;
}
}
/* y may have changed to new */
if ((ymtpoint = yang_schema_mount_point(y)) < 0)
goto done;
if (ymtpoint){
/* If we cant find a specific mountpoint, we just assign the first.
* XXX: note that maybe this may cause later errors?
*/
if (yang_mount_get_yspec_any(y, &yspec) < 0)
goto done;
}
/* Check if has value, means '=' */
if (cv_type_get(cv) == CGV_STRING){
/* val is uri percent encoded, eg x%2Cy,z */
Expand Down Expand Up @@ -960,11 +970,11 @@ api_path2xpath_cvv(cvec *api_path,
* @see api_path2xml For api-path to xml translation (maybe could be combined?)
*/
int
api_path2xpath(char *api_path,
yang_stmt *yspec,
char **xpathp,
cvec **nsc,
cxobj **xerr)
api_path2xpath(char *api_path,
yang_stmt *yspec,
char **xpathp,
cvec **nsc,
cxobj **xerr)
{
int retval = -1;
cvec *cvv = NULL; /* api-path vector */
Expand Down

0 comments on commit 43325ca

Please sign in to comment.