Skip to content

Commit

Permalink
Fixed: changed module-set to domain in yang-library
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Sep 13, 2024
1 parent 46af54f commit 697ee0d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/controller_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ schema_list2yang_library(clixon_handle h,
*/
int
xdev2yang_library(cxobj *xmodset,
char *domain,
cxobj **xyanglib)
{
int retval = -1;
Expand All @@ -391,13 +392,17 @@ xdev2yang_library(cxobj *xmodset,
char *revision;
char *namespace;

if (domain == NULL){
clixon_err(OE_YANG, 0, "domain is NULL");
goto done;
}
if ((cb = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
cprintf(cb, "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">");
cprintf(cb, "<module-set>");
cprintf(cb, "<name>mount</name>");
cprintf(cb, "<name>%s</name>", domain);
x = NULL;
while ((x = xml_child_each(xmodset, x, CX_ELMNT)) != NULL) {
if (strcmp(xml_name(x), "module") != 0)
Expand Down
2 changes: 1 addition & 1 deletion src/controller_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ char *actions_type_int2str(actions_type t);
actions_type actions_type_str2int(char *str);
int controller_yang_library_bind(clixon_handle h, cxobj *yanglib);
int schema_list2yang_library(clixon_handle h, cxobj *xschemas, char *domain, cxobj **xyanglib);
int xdev2yang_library(cxobj *xdev, cxobj **xyanglib);
int xdev2yang_library(cxobj *xdev, char *domain, cxobj **xyanglib);
int controller_mount_xpath_get(char *devname, cbuf **cbxpath);
int controller_mount_yspec_get(clixon_handle h, char *devname, yang_stmt **yspec1);
int controller_mount_yspec_set(clixon_handle h, char *devname, yang_stmt *yspec1);
Expand Down
7 changes: 4 additions & 3 deletions src/controller_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ controller_connect(clixon_handle h,
cxobj *xmod = NULL;
cxobj *xyanglib = NULL;
int ssh_stricthostkey = 1;
char *domain = NULL;

clixon_debug(CLIXON_DBG_CTRL, "");
if ((name = xml_find_body(xn, "name")) == NULL)
Expand Down Expand Up @@ -212,14 +213,14 @@ controller_connect(clixon_handle h,
if (xdevprofile)
xb = xml_find_type(xdevprofile, NULL, "device-domain", CX_ELMNT);
}
if (xb && (str = xml_body(xb)) != NULL)
if (device_handle_domain_set(dh, str) < 0)
if (xb && (domain = xml_body(xb)) != NULL)
if (device_handle_domain_set(dh, domain) < 0)
goto done;
/* Parse and save local methods into RFC 8525 yang-lib module-set/module */
if ((xmod = xml_find_type(xn, NULL, "module-set", CX_ELMNT)) == NULL)
xmod = xml_find_type(xdevprofile, NULL, "module-set", CX_ELMNT);
if (xmod){
if (xdev2yang_library(xmod, &xyanglib) < 0)
if (xdev2yang_library(xmod, domain, &xyanglib) < 0)
goto done;
if (xyanglib){
if (xml_rootchild(xyanglib, 0, &xyanglib) < 0)
Expand Down
2 changes: 1 addition & 1 deletion test/test-lock-devices.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cat<<EOF > $CFG
<CLICON_YANG_DIR>${DATADIR}/controller/common</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${DATADIR}/controller/main</CLICON_YANG_DIR>
<CLICON_YANG_MAIN_DIR>${DATADIR}/controller/main</CLICON_YANG_MAIN_DIR>
<CLICON_YANG_DOMAIN_DIR>${DATADIR}/controller/main</CLICON_YANG_DOMAIN_DIR>
<CLICON_YANG_DOMAIN_DIR>${DATADIR}/controller/mounts</CLICON_YANG_DOMAIN_DIR>
<CLICON_CLI_MODE>operation</CLICON_CLI_MODE>
<CLICON_CLI_DIR>${LIBDIR}/controller/cli</CLICON_CLI_DIR>
<CLICON_CLISPEC_DIR>${dir}</CLICON_CLISPEC_DIR>
Expand Down

0 comments on commit 697ee0d

Please sign in to comment.