* Added message-id attributes in error and hello replies

* See [namespace prefix nc is not supported in full #154](https://github.com/clicon/clixon/issues/154)
* Removed mandatory loading of clixon_restconf.yang
This commit is contained in:
Olof hagsand 2020-12-01 12:13:46 +01:00
parent 26a4b14060
commit c32950c8a9
20 changed files with 119 additions and 56 deletions

View file

@ -29,7 +29,6 @@ module clixon-example {
import ietf-datastores {
prefix ds;
}
/* Example interface type for tests, local callbacks, etc */
identity eth {
base if:interface-type;
@ -90,7 +89,6 @@ module clixon-example {
ex:e4 arg1{
uses bar;
}
/* Example notification as used in RFC 5277 and RFC 8040 */
notification event {
description "Example notification event.";

View file

@ -297,14 +297,21 @@ example_rpc(clicon_handle h, /* Clicon handle */
{
int retval = -1;
cxobj *x = NULL;
cxobj *xp;
char *namespace;
char *msgid;
/* get namespace from rpc name, return back in each output parameter */
if ((namespace = xml_find_type_value(xe, NULL, "xmlns", CX_ATTR)) == NULL){
clicon_err(OE_XML, ENOENT, "No namespace given in rpc %s", xml_name(xe));
goto done;
}
cprintf(cbret, "<rpc-reply xmlns=\"%s\">", NETCONF_BASE_NAMESPACE);
cprintf(cbret, "<rpc-reply xmlns=\"%s\"", NETCONF_BASE_NAMESPACE);
if ((xp = xml_parent(xe)) != NULL &&
(msgid = xml_find_value(xp, "message-id"))){
cprintf(cbret, " message-id=\"%s\">", msgid);
}
cprintf(cbret, ">");
if (!xml_child_nr_type(xe, CX_ELMNT))
cprintf(cbret, "<ok/>");
else while ((x = xml_child_each(xe, x, CX_ELMNT)) != NULL) {

View file

@ -101,7 +101,7 @@ example_client_rpc(clicon_handle h,
cva = cvec_find(cvv, "a"); /* get a cligen variable from vector */
/* Create XML for example netconf RPC */
if (clixon_xml_parse_va(YB_NONE, NULL, &xtop, NULL,
"<rpc message-id=\"101\" xmlns=\"%s\" username=\"%s\">"
"<rpc xmlns=\"%s\" username=\"%s\" message-id=\"101\">"
"<example xmlns=\"urn:example:clixon\"><x>%s</x></example></rpc>",
NETCONF_BASE_NAMESPACE,
clicon_username_get(h),