xmlns sanity check

This commit is contained in:
Olof hagsand 2018-06-05 16:43:43 +02:00
parent 849e46191e
commit 0ad6703663
4 changed files with 23 additions and 8 deletions

View file

@ -40,6 +40,10 @@
* Added cli returna value also for single commands (eg -1) * Added cli returna value also for single commands (eg -1)
* Fixed JSON unbalanced braces resulting in assert. * Fixed JSON unbalanced braces resulting in assert.
### Known issues
* Namespace name relabeling is not supported.
* Eg: if "des" is defined as prefix for an imported module, then a relabeling using xmlfns is not supported, such as: <crypto xmlns:x="urn:example:des">x:des3</crypto>
## 3.6.1 (29 May 2018) ## 3.6.1 (29 May 2018)
### Corrected Bugs ### Corrected Bugs

View file

@ -6,8 +6,6 @@ CLICON_PLUGIN="example_cli";
# Translate variable "value" by incrementing its characters # Translate variable "value" by incrementing its characters
translate value (<value:string translate:incstr()>),cli_set("/translate/value"); translate value (<value:string translate:incstr()>),cli_set("/translate/value");
# Note, when switching to PT, change datamodel to only @datamodel # Note, when switching to PT, change datamodel to only @datamodel
set @datamodel:example, cli_set(); set @datamodel:example, cli_set();
merge @datamodel:example, cli_merge(); merge @datamodel:example, cli_merge();
@ -41,11 +39,18 @@ show("Show a particular state of the system"){
text("Show comparison in text"), compare_dbs((int32)1); text("Show comparison in text"), compare_dbs((int32)1);
} }
configuration("Show configuration"), cli_show_config("candidate", "text", "/");{ configuration("Show configuration"), cli_show_config("candidate", "text", "/");{
xml("Show configuration as XML"), cli_show_config("candidate", "xml", "/"); xml("Show configuration as XML"), cli_show_config("candidate", "xml", "/");{
netconf("Show configuration as netconf edit-config operation"), cli_show_config("candidate", "netconf", "/"); @datamodel:example, cli_show_auto("candidate", "text");
text("Show configuration as text"), cli_show_config("candidate","text","/"); }
cli("Show configuration as cli commands"), cli_show_config("candidate", "cli", "/"); netconf("Show configuration as netconf edit-config operation"), cli_show_config("candidate", "netconf", "/");{
json("Show configuration as cli commands"), cli_show_config("candidate", "json", "/"); @datamodel:example, cli_show_auto("candidate", "netconf");
}
text("Show configuration as text"), cli_show_config("candidate","text","/");{
@datamodel:example, cli_show_auto("candidate", "text");
}
json("Show configuration as cli commands"), cli_show_config("candidate", "json", "/");{
@datamodel:example, cli_show_auto("candidate", "json");
}
} }
} }

View file

@ -80,6 +80,9 @@ typedef int (xml_applyfn_t)(cxobj *x, void *arg);
#define XML_FLAG_CHANGE 0x08 /* Node is changed (commits) or child changed rec */ #define XML_FLAG_CHANGE 0x08 /* Node is changed (commits) or child changed rec */
#define XML_FLAG_NONE 0x10 /* Node is added as NONE */ #define XML_FLAG_NONE 0x10 /* Node is added as NONE */
/* Full xmlns validation check is made only if XML has associated YANG spec */
#define XMLNS_YANG_ONLY 1
/* Sort and binary search of XML children /* Sort and binary search of XML children
* Experimental * Experimental
*/ */

View file

@ -253,9 +253,12 @@ xml_namespace_check(cxobj *xn,
return 0; return 0;
xn = xp; xn = xp;
} }
#ifdef XMLNS_YANG_ONLY
if (ys == NULL) if (ys == NULL)
return 0; /* If no yang spec */ return 0; /* If no yang spec */
else{ else
#endif
{
/* Check if my namespace */ /* Check if my namespace */
if ((n = yang_find_myprefix(ys)) != NULL && strcmp(nsn,n)==0) if ((n = yang_find_myprefix(ys)) != NULL && strcmp(nsn,n)==0)
return 0; return 0;