diff --git a/apps/netconf/netconf_rpc.c b/apps/netconf/netconf_rpc.c
index 436d719a..8ad952cf 100644
--- a/apps/netconf/netconf_rpc.c
+++ b/apps/netconf/netconf_rpc.c
@@ -176,31 +176,30 @@ netconf_get_config(clicon_handle h,
}
/* ie ... */
- if ((xfilter = xpath_first(xn, nsc, "%s%sfilter", prefix ? prefix : "", prefix ? ":" : "")) != NULL)
- ftype = xml_find_value(xfilter, "type");
- if (xfilter == NULL || ftype == NULL || strcmp(ftype, "xpath")==0){
- if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
- goto done;
- }
- else if (strcmp(ftype, "subtree")==0){
- /* Get whole config first, then filter. This is suboptimal
- */
- if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
- goto done;
- /* Now filter on whole tree */
- if (netconf_get_config_subtree(h, xfilter, xret) < 0)
- goto done;
- }
- else{
- clixon_xml_parse_va(YB_NONE, NULL, xret, NULL, ""
- "operation-failed"
- "applicatio"
- "error"
- "filter type not supported"
- "type"
- "",
- NETCONF_BASE_NAMESPACE);
- }
+ if ((xfilter = xpath_first(xn, nsc, "%s%sfilter", prefix ? prefix : "", prefix ? ":" : "")) != NULL)
+ ftype = xml_find_value(xfilter, "type");
+ if (xfilter == NULL || ftype == NULL || strcmp(ftype, "subtree") == 0) {
+ /* Get whole config first, then filter. This is suboptimal
+ */
+ if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
+ goto done;
+ /* Now filter on whole tree */
+ if (netconf_get_config_subtree(h, xfilter, xret) < 0)
+ goto done;
+ } else if (strcmp(ftype, "xpath") == 0) {
+ if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0) {
+ goto done;
+ }
+ } else {
+ clixon_xml_parse_va(YB_NONE, NULL, xret, NULL, ""
+ "operation-failed"
+ "applicatio"
+ "error"
+ "filter type not supported"
+ "type"
+ "",
+ NETCONF_BASE_NAMESPACE);
+ }
retval = 0;
done:
if (nsc)
@@ -388,31 +387,29 @@ netconf_get(clicon_handle h,
}
/* ie ... */
- if ((xfilter = xpath_first(xn, nsc, "%s%sfilter", prefix ? prefix : "", prefix ? ":" : "")) != NULL)
- ftype = xml_find_value(xfilter, "type");
- if (xfilter == NULL || ftype == NULL || strcmp(ftype, "xpath")==0){
- if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
- goto done;
- }
- else if (strcmp(ftype, "subtree")==0){
- /* Get whole config + state first, then filter. This is suboptimal
- */
- if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
- goto done;
- /* Now filter on whole tree */
- if (netconf_get_config_subtree(h, xfilter, xret) < 0)
- goto done;
- }
- else{
- clixon_xml_parse_va(YB_NONE, NULL, xret, NULL, ""
- "operation-failed"
- "applicatio"
- "error"
- "filter type not supported"
- "type"
- "",
- NETCONF_BASE_NAMESPACE);
- }
+ if ((xfilter = xpath_first(xn, nsc, "%s%sfilter", prefix ? prefix : "", prefix ? ":" : "")) != NULL)
+ ftype = xml_find_value(xfilter, "type");
+ if (xfilter == NULL || ftype == NULL || strcmp(ftype, "subtree") == 0) {
+ /* Get whole config + state first, then filter. This is suboptimal
+ */
+ if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
+ goto done;
+ /* Now filter on whole tree */
+ if (netconf_get_config_subtree(h, xfilter, xret) < 0)
+ goto done;
+ } else if (strcmp(ftype, "xpath") == 0) {
+ if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
+ goto done;
+ } else {
+ clixon_xml_parse_va(YB_NONE, NULL, xret, NULL, ""
+ "operation-failed"
+ "applicatio"
+ "error"
+ "filter type not supported"
+ "type"
+ "",
+ NETCONF_BASE_NAMESPACE);
+ }
retval = 0;
done:
if(nsc)
diff --git a/lib/src/clixon_xml_parse.y b/lib/src/clixon_xml_parse.y
index 9bfd6d00..65a3cd49 100644
--- a/lib/src/clixon_xml_parse.y
+++ b/lib/src/clixon_xml_parse.y
@@ -65,6 +65,7 @@
#include
#include
#include
+#include
#include
#include
@@ -196,7 +197,7 @@ static int
xml_parse_encoding(clixon_xml_yacc *xy,
char *enc)
{
- if(strcmp(enc, "UTF-8")){
+ if(strcasecmp(enc, "UTF-8")){
clicon_err(OE_XML, XMLPARSE_ERRNO, "Unsupported XML encoding: %s expected UTF-8", enc);
free(enc);
return -1;
diff --git a/test/test_netconf_filter.sh b/test/test_netconf_filter.sh
index 73b5e4f6..ec7a9fcf 100755
--- a/test/test_netconf_filter.sh
+++ b/test/test_netconf_filter.sh
@@ -68,6 +68,12 @@ expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO
new "wrong filter type"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1]]>]]>" "^operation-failedapplicatioerrorfilter type not supportedtype]]>]]>$"
+new "get-config subtree one (subtree implicit)"
+expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1]]>]]>" "^11]]>]]>$"
+
+new "get subtree one (subtree implicit)"
+expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1]]>]]>" "^11]]>]]>$"
+
new "get-config subtree one"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1]]>]]>" "^11]]>]]>$"
diff --git a/test/test_netconf_hello.sh b/test/test_netconf_hello.sh
index 7460efbe..a0b23ac5 100755
--- a/test/test_netconf_hello.sh
+++ b/test/test_netconf_hello.sh
@@ -58,6 +58,10 @@ wait_backend
new "Netconf snd hello with xmldecl"
expecteof "$clixon_netconf -qf $cfg" 0 "urn:ietf:params:netconf:base:1.1]]>]]>" '^$' '^$'
+# Hello, lowercase encoding
+new "Netconf snd hello with xmldecl (lowercase encoding)"
+expecteof "$clixon_netconf -qf $cfg" 0 "urn:ietf:params:netconf:base:1.1]]>]]>" '^$' '^$'
+
new "Netconf snd hello without xmldecl"
expecteof "$clixon_netconf -qf $cfg" 0 "urn:ietf:params:netconf:base:1.1]]>]]>" '^$' '^$'
diff --git a/test/vagrant/vagrant.sh b/test/vagrant/vagrant.sh
index efadf216..b68ff8d9 100755
--- a/test/vagrant/vagrant.sh
+++ b/test/vagrant/vagrant.sh
@@ -169,7 +169,7 @@ case $release in
native)
$sshcmd sudo yum install -y libevent openssl
$sshcmd sudo yum install -y libevent-devel openssl-devel
- $sshcmd sudo dnf config-manager --set-enabled powertools
+ $sshcmd sudo yum-config-manager --enable powertools
$sshcmd sudo yum install -y libnghttp2-devel
;;
esac
@@ -215,9 +215,13 @@ case $release in
;;
native)
# $sshcmd sudo apt install -y libevent-2.1
+<<<<<<< HEAD
$sshcmd sudo apt install -y libssl-dev
$sshcmd sudo apt install -y libevent-dev # evhtp
$sshcmd sudo apt install -y libnghttp2-dev # nghttp2
+=======
+ $sshcmd sudo apt install -y libevent-dev libssl-dev libnghttp2-dev
+>>>>>>> Testing dependency fixes, Netconf XML declaration and filter logic fix
;;
esac
;;