diff --git a/lib/src/clixon_datastore_read.c b/lib/src/clixon_datastore_read.c
index 780db2a9..12923fd3 100644
--- a/lib/src/clixon_datastore_read.c
+++ b/lib/src/clixon_datastore_read.c
@@ -859,10 +859,6 @@ xmldb_get_nocache(clixon_handle h,
if (disable_nacm_on_empty(xt, yspec) < 0)
goto done;
}
-#if 0 /* debug */
- if (xml_apply0(xt, -1, xml_sort_verify, NULL) < 0)
- clixon_log(h, LOG_NOTICE, "%s: sort verify failed #2", __FUNCTION__);
-#endif
if (clixon_debug_get()>1)
if (clixon_xml2file(stderr, xt, 0, 1, NULL, fprintf, 0, 0) < 0)
goto done;
@@ -1007,8 +1003,10 @@ xmldb_get_cache(clixon_handle h,
goto done;
}
/* Original tree: Remove global defaults and empty non-presence containers */
+#if 0
if (xml_defaults_nopresence(x0t, 2) < 0)
goto done;
+#endif
switch (wdef){
case WITHDEFAULTS_REPORT_ALL:
break;
@@ -1016,8 +1014,7 @@ xmldb_get_cache(clixon_handle h,
/* Mark and remove nodes having schema default values */
if (xml_apply(x1t, CX_ELMNT, (xml_applyfn_t*) xml_flag_default_value, (void*) XML_FLAG_MARK) < 0)
goto done;
- if (xml_tree_prune_flags(x1t, XML_FLAG_MARK, XML_FLAG_MARK)
- < 0)
+ if (xml_tree_prune_flags(x1t, XML_FLAG_MARK, XML_FLAG_MARK) < 0)
goto done;
if (xml_defaults_nopresence(x1t, 1) < 0)
goto done;
diff --git a/lib/src/clixon_datastore_write.c b/lib/src/clixon_datastore_write.c
index 0bbd27d2..92a9cd4d 100644
--- a/lib/src/clixon_datastore_write.c
+++ b/lib/src/clixon_datastore_write.c
@@ -145,70 +145,6 @@ attr_ns_value(cxobj *x,
goto done;
}
-/*! Add creator data to metadata xml object on the form name:xpath*
- *
- * Callback function type for xml_apply
- * @param[in] x XML node
- * @param[in] arg General-purpose argument
- * @retval -1 Error, aborted at first error encounter, return -1 to end user
- * @retval 0 OK, continue
- * @retval 1 Abort, dont continue with others, return 1 to end user
- * @retval 2 Locally abort this subtree, continue with others
- * On the form:
- *
- * testA[name='foo']
- * ...
- * ...
- *
- * @see xml_creator_metadata_read
- */
-static int
-xml_creator_metadata_write(cxobj *x,
- void *arg)
-{
- int retval = -1;
- cxobj *xmeta = (cxobj*)arg;
- cxobj *xmc;
- cvec *cvv;
- cg_var *cv;
- char *val;
- cvec *nsc = NULL;
- char *xpath = NULL;
-
- if ((cvv = xml_creator_get(x)) == NULL){
- retval = 0;
- goto done;
- }
- /* Note this requires x to have YANG spec */
- if (xml2xpath(x, nsc, 0, 0, &xpath) < 0)
- goto done;
- cv = NULL;
- while ((cv = cvec_each(cvv, cv)) != NULL){
- val = cv_name_get(cv);
- /* Find existing entry where name is val */
- xmc = NULL;
- while ((xmc = xml_child_each(xmeta, xmc, CX_ELMNT)) != NULL){
- if (strcmp(xml_find_body(xmc, "name"), val) == 0)
- break;
- }
- if (xmc != NULL){
- if (clixon_xml_parse_va(YB_NONE, NULL, &xmc, NULL, "%s", xpath) < 0)
- goto done;
- }
- else {
- if (clixon_xml_parse_va(YB_NONE, NULL, &xmeta, NULL,
- "%s%s",
- val, xpath) < 0)
- goto done;
- }
- }
- retval = 2;
- done:
- if (xpath)
- free(xpath);
- return retval;
-}
-
/*! When new body is added, some needs type lookup is made and namespace checked
*
* This includes identityrefs, paths
@@ -1416,13 +1352,12 @@ xmldb_put(clixon_handle h,
goto done;
}
pretty = clicon_option_bool(h, "CLICON_XMLDB_PRETTY");
- /* Add creator attribute */
+ /* Add creator attributes to datastore */
if (clicon_option_bool(h, "CLICON_NETCONF_CREATOR_ATTR")){
- if ((xmeta = xml_new("creators", x0, CX_ELMNT)) == NULL)
+ /* @see xml_creator_metadata_read */
+ if (xml_creator_tree(x0, &xmeta) < 0)
goto done;
- if (xmlns_set(xmeta, NULL, CLIXON_LIB_NS) < 0)
- goto done;
- if (xml_apply(x0, CX_ELMNT, xml_creator_metadata_write, xmeta) < 0)
+ if (xml_addsub(x0, xmeta) < 0)
goto done;
if (xml_child_nr_type(xmeta, CX_ELMNT) == 0){
xml_purge(xmeta);
diff --git a/test/test_yang_with_defaults.sh b/test/test_yang_with_defaults.sh
index 43c1a250..d7e0a5f8 100755
--- a/test/test_yang_with_defaults.sh
+++ b/test/test_yang_with_defaults.sh
@@ -174,7 +174,6 @@ cat < $fstate
EOF
-
db=startup
if [ $db = startup ]; then
sudo echo "<${DATASTORE_TOP}>$XML${DATASTORE_TOP}>" > $dir/startup_db
@@ -334,7 +333,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \
"\
\
eth13000\
-none " \
+none" \
"" \
""