Print CLICON_YANG_DIR and CLICON_FEATURE lists on startup with debug flag
This commit is contained in:
parent
98cc62eace
commit
daa01b3a5e
5 changed files with 39 additions and 15 deletions
|
|
@ -191,6 +191,7 @@
|
||||||
|
|
||||||
### Minor changes
|
### Minor changes
|
||||||
|
|
||||||
|
* Print CLICON_YANG_DIR and CLICON_FEATURE lists on startup with debug flag
|
||||||
* Extended `util/clixon_util_xml` with yang and validate functionality so it can be used as a stand-alone utility for validating XML/JSON files
|
* Extended `util/clixon_util_xml` with yang and validate functionality so it can be used as a stand-alone utility for validating XML/JSON files
|
||||||
* JSON parse and print improvements
|
* JSON parse and print improvements
|
||||||
* Integrated parsing with namespace translation and yang spec lookup
|
* Integrated parsing with namespace translation and yang spec lookup
|
||||||
|
|
|
||||||
23
README.md
23
README.md
|
|
@ -149,23 +149,22 @@ The standards covered include:
|
||||||
Not supported:
|
Not supported:
|
||||||
- !DOCTYPE (ie DTD)
|
- !DOCTYPE (ie DTD)
|
||||||
|
|
||||||
Historically, Clixon has not until 3.9 made strict namespace
|
The following xpath axes are supported:
|
||||||
enforcing. For example, the following non-strict netconf was
|
- CHILD, DESCENDANT, DESCENDANT_OR_SELF, SELF, and PARENT
|
||||||
previously accepted:
|
|
||||||
```
|
The following xpath axes are _not_ supported:
|
||||||
<rpc><my-own-method/></rpc>
|
- PRECEEDING, PRECEEDING_SIBLING, NAMESPACE, FOLLOWING_SIBLING, FOLLOWING, ANCESTOR,ANCESTOR_OR_SELF, ATTRIBUTE
|
||||||
```
|
|
||||||
In 3.9, the same statement should be, for example:
|
Note that base netconf namespace syntax is not enforced but recommended, which means that the following two expressions are treated equivalently:
|
||||||
```
|
|
||||||
<rpc><my-own-method xmlns="urn:example:my-own"/></rpc>
|
|
||||||
```
|
|
||||||
Note that base netconf syntax is still not enforced but recommended:
|
|
||||||
```
|
```
|
||||||
|
<rpc>
|
||||||
|
<my-own-method xmlns="urn:example:my-own"/>
|
||||||
|
</rpc>
|
||||||
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
|
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
|
||||||
<my-own-method xmlns="urn:example:my-own"/>
|
<my-own-method xmlns="urn:example:my-own"/>
|
||||||
</rpc>
|
</rpc>
|
||||||
```
|
```
|
||||||
|
All other namespaces are enforced.
|
||||||
|
|
||||||
## Netconf
|
## Netconf
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,8 +233,8 @@ AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versi
|
||||||
|
|
||||||
# YANG_INSTALLDIR is where clixon installs the Clixon yang files
|
# YANG_INSTALLDIR is where clixon installs the Clixon yang files
|
||||||
# (the files in in yang/clixon)
|
# (the files in in yang/clixon)
|
||||||
# Each application designer may need to place CLIXON_YANG_DIR in their config:
|
# Each application designer may need to place YANG_INSTALLDIR in their config:
|
||||||
# <CLIXON-YANG-DIR>$YANG_INSTALLDIR</CLIXON-YANG_DIR>
|
# <CLICON_YANG_DIR>$YANG_INSTALLDIR</CLICON_YANG_DIR>
|
||||||
AC_ARG_WITH(yang-installdir,
|
AC_ARG_WITH(yang-installdir,
|
||||||
[ --with-yang-installdir=DIR Install Clixon yang files here (default: ${prefix}/share/clixon) ],
|
[ --with-yang-installdir=DIR Install Clixon yang files here (default: ${prefix}/share/clixon) ],
|
||||||
[YANG_INSTALLDIR="$withval"],
|
[YANG_INSTALLDIR="$withval"],
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ static const map_str2int startup_mode_map[] = {
|
||||||
* @param[in] dbglevel Debug level
|
* @param[in] dbglevel Debug level
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
* @retval -1 Error
|
* @retval -1 Error
|
||||||
|
* @note CLICON_FEATURE and CLICON_YANG_DIR are treated specially since they are lists
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clicon_option_dump(clicon_handle h,
|
clicon_option_dump(clicon_handle h,
|
||||||
|
|
@ -102,6 +103,7 @@ clicon_option_dump(clicon_handle h,
|
||||||
void *val;
|
void *val;
|
||||||
size_t klen;
|
size_t klen;
|
||||||
size_t vlen;
|
size_t vlen;
|
||||||
|
cxobj *x = NULL;
|
||||||
|
|
||||||
if (hash_keys(hash, &keys, &klen) < 0)
|
if (hash_keys(hash, &keys, &klen) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -116,6 +118,21 @@ clicon_option_dump(clicon_handle h,
|
||||||
else
|
else
|
||||||
clicon_debug(dbglevel, "%s = NULL", keys[i]);
|
clicon_debug(dbglevel, "%s = NULL", keys[i]);
|
||||||
}
|
}
|
||||||
|
/* Next print CLICON_FEATURE and CLICON_YANG_DIR from config tree
|
||||||
|
* Since they are lists they are placed in the config tree.
|
||||||
|
*/
|
||||||
|
x = NULL;
|
||||||
|
while ((x = xml_child_each(clicon_conf_xml(h), x, CX_ELMNT)) != NULL) {
|
||||||
|
if (strcmp(xml_name(x), "CLICON_YANG_DIR") != 0)
|
||||||
|
continue;
|
||||||
|
clicon_debug(dbglevel, "%s =\t \"%s\"", xml_name(x), xml_body(x));
|
||||||
|
}
|
||||||
|
x = NULL;
|
||||||
|
while ((x = xml_child_each(clicon_conf_xml(h), x, CX_ELMNT)) != NULL) {
|
||||||
|
if (strcmp(xml_name(x), "CLICON_FEATURE") != 0)
|
||||||
|
continue;
|
||||||
|
clicon_debug(dbglevel, "%s =\t \"%s\"", xml_name(x), xml_body(x));
|
||||||
|
}
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
if (keys)
|
if (keys)
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,13 @@ new "restconf example rpc xml/xml"
|
||||||
expecteq "$(curl -s -X POST -H 'Content-Type: application/yang-data+xml' -H 'Accept: application/yang-data+xml' -d '<input xmlns="urn:example:clixon"><x>0</x></input>' http://localhost/restconf/operations/clixon-example:example)" 0 '<output xmlns="urn:example:clixon"><x>0</x><y>42</y></output>
|
expecteq "$(curl -s -X POST -H 'Content-Type: application/yang-data+xml' -H 'Accept: application/yang-data+xml' -d '<input xmlns="urn:example:clixon"><x>0</x></input>' http://localhost/restconf/operations/clixon-example:example)" 0 '<output xmlns="urn:example:clixon"><x>0</x><y>42</y></output>
|
||||||
'
|
'
|
||||||
|
|
||||||
|
new "restconf example rpc xml in w json encoding (expect fail)"
|
||||||
|
expecteq "$(curl -s -X POST -H 'Content-Type: application/yang-data+json' -H 'Accept: application/yang-data+xml' -d '<input xmlns="urn:example:clixon"><x>0</x></input>' http://localhost/restconf/operations/clixon-example:example)" 0 "<errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\"><error><error-type>rpc</error-type><error-tag>malformed-message</error-tag><error-severity>error</error-severity><error-message> on line 1: syntax error at or before: '<'</error-message></error></errors>
"
|
||||||
|
|
||||||
|
|
||||||
|
new "restconf example rpc json in xml encoding (expect fail)"
|
||||||
|
expecteq "$(curl -s -X POST -H 'Content-Type: application/yang-data+xml' -H 'Accept: application/yang-data+xml' -d '{"clixon-example:input":{"x":"0"}}' http://localhost/restconf/operations/clixon-example:example)" 0 '<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"><error><error-type>rpc</error-type><error-tag>malformed-message</error-tag><error-severity>error</error-severity><error-message>xml_parse: line 0: syntax error: at or before: "</error-message></error></errors>
'
|
||||||
|
|
||||||
new "netconf example rpc"
|
new "netconf example rpc"
|
||||||
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><example xmlns="urn:example:clixon"><x>0</x></example></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><x xmlns="urn:example:clixon">0</x><y xmlns="urn:example:clixon">42</y></rpc-reply>]]>]]>$'
|
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><example xmlns="urn:example:clixon"><x>0</x></example></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><x xmlns="urn:example:clixon">0</x><y xmlns="urn:example:clixon">42</y></rpc-reply>]]>]]>$'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue