diff --git a/CHANGELOG.md b/CHANGELOG.md index 4584002e..0637ab66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -191,6 +191,7 @@ ### 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 * JSON parse and print improvements * Integrated parsing with namespace translation and yang spec lookup diff --git a/README.md b/README.md index 13778966..ab733a48 100644 --- a/README.md +++ b/README.md @@ -149,23 +149,22 @@ The standards covered include: Not supported: - !DOCTYPE (ie DTD) -Historically, Clixon has not until 3.9 made strict namespace -enforcing. For example, the following non-strict netconf was -previously accepted: -``` - -``` -In 3.9, the same statement should be, for example: -``` - -``` -Note that base netconf syntax is still not enforced but recommended: +The following xpath axes are supported: +- CHILD, DESCENDANT, DESCENDANT_OR_SELF, SELF, and PARENT + +The following xpath axes are _not_ supported: +- PRECEEDING, PRECEEDING_SIBLING, NAMESPACE, FOLLOWING_SIBLING, FOLLOWING, ANCESTOR,ANCESTOR_OR_SELF, ATTRIBUTE + +Note that base netconf namespace syntax is not enforced but recommended, which means that the following two expressions are treated equivalently: ``` + + + ``` - +All other namespaces are enforced. ## Netconf diff --git a/configure.ac b/configure.ac index 4fcbe5d6..13885d43 100644 --- a/configure.ac +++ b/configure.ac @@ -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 # (the files in in yang/clixon) -# Each application designer may need to place CLIXON_YANG_DIR in their config: -# $YANG_INSTALLDIR +# Each application designer may need to place YANG_INSTALLDIR in their config: +# $YANG_INSTALLDIR AC_ARG_WITH(yang-installdir, [ --with-yang-installdir=DIR Install Clixon yang files here (default: ${prefix}/share/clixon) ], [YANG_INSTALLDIR="$withval"], diff --git a/lib/src/clixon_options.c b/lib/src/clixon_options.c index ac04ffb3..a909dfce 100644 --- a/lib/src/clixon_options.c +++ b/lib/src/clixon_options.c @@ -90,6 +90,7 @@ static const map_str2int startup_mode_map[] = { * @param[in] dbglevel Debug level * @retval 0 OK * @retval -1 Error + * @note CLICON_FEATURE and CLICON_YANG_DIR are treated specially since they are lists */ int clicon_option_dump(clicon_handle h, @@ -102,6 +103,7 @@ clicon_option_dump(clicon_handle h, void *val; size_t klen; size_t vlen; + cxobj *x = NULL; if (hash_keys(hash, &keys, &klen) < 0) goto done; @@ -116,7 +118,22 @@ clicon_option_dump(clicon_handle h, else clicon_debug(dbglevel, "%s = NULL", keys[i]); } - retval = 0; + /* 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; done: if (keys) free(keys); diff --git a/test/test_rpc.sh b/test/test_rpc.sh index e39b6847..64ed55c3 100755 --- a/test/test_rpc.sh +++ b/test/test_rpc.sh @@ -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 '0' http://localhost/restconf/operations/clixon-example:example)" 0 '042 ' +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 '0' http://localhost/restconf/operations/clixon-example:example)" 0 "rpcmalformed-messageerror on line 1: syntax error at or before: '<' " + + +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 'rpcmalformed-messageerrorxml_parse: line 0: syntax error: at or before: " ' + new "netconf example rpc" expecteof "$clixon_netconf -qf $cfg" 0 '0]]>]]>' '^042]]>]]>$'