* Ensured you can add multiple callbacks for any RPC, including basic ones.

* Extra RPC:s will be called _after_ the basic ones.
  * One specific usecase is hook for `copy-config` (see [doc/ROADMAP.md] that can be implemented thus way.
* `rpc_callback_register` added a namespace parameter. Example:
   ```
     rpc_callback_register(h, empty_rpc, NULL, "urn:example:clixon", "empty");
   ```
This commit is contained in:
Olof hagsand 2019-03-10 17:27:52 +01:00
parent 748c7282ea
commit b1c74b5f1f
18 changed files with 755 additions and 514 deletions

View file

@ -1034,7 +1034,10 @@ netconf_module_load(clicon_handle h)
goto done;
if (xml_parse_string("<CLICON_FEATURE>ietf-netconf:xpath</CLICON_FEATURE>", yspec, &xc) < 0)
goto done;
#ifdef NYI
if (xml_parse_string("<CLICON_FEATURE>ietf-netconf:confirmed-commit</CLICON_FEATURE>", yspec, &xc) < 0)
goto done;
#endif
/* Load yang spec */
if (yang_spec_parse_module(h, "ietf-netconf", NULL, yspec)< 0)
goto done;
@ -1044,3 +1047,35 @@ netconf_module_load(clicon_handle h)
done:
return retval;
}
/*! Find some sub-child in netconf/xm request.
* Actually, find a child with a certain name and return its body
* @param[in] xn
* @param[in] name
* @retval db Name of database
* @retval NULL Not found
* The following code returns "source"
* @code
* cxobj *xt = NULL;
* char *db;
* xml_parse_string("<x><target>source</target></x>", NULL, &xt);
* db = netconf_db_find(xt, "target");
* @endcode
*/
char*
netconf_db_find(cxobj *xn,
char *name)
{
cxobj *xs; /* source */
cxobj *xi;
char *db = NULL;
if ((xs = xml_find(xn, name)) == NULL)
goto done;
if ((xi = xml_child_i(xs, 0)) == NULL)
goto done;
db = xml_name(xi);
done:
return db;
}