Remove sanity check for insert/search which does not hold for NETCONF attributes
This commit is contained in:
Olof hagsand 2024-01-06 18:27:21 +01:00
parent 9e54f0602f
commit cb3e74971d

View file

@ -1011,12 +1011,21 @@ xml_insert2(cxobj *xp,
} }
xc = xml_child_i(xp, mid); xc = xml_child_i(xp, mid);
if ((yc = xml_spec(xc)) == NULL){ if ((yc = xml_spec(xc)) == NULL){
if (xml_type(xc) != CX_ELMNT) #if 1
clixon_err(OE_XML, 0, "No spec found %s (wrong xml type:%s)", cmp = 1;
xml_name(xc), xml_type2str(xml_type(xc))); #else
/* Strict checks for config, but one may want to merge XMLs with attributes as well,
such as NETCONF messages */
if (xml_type(xc) == CX_ATTR)
clixon_err(OE_XML, 0, "Internal sort error: Unexpected attribute: \"%s:%s\"",
xml_prefix(xc), xml_name(xc));
else if (xml_type(xc) == CX_ELMNT)
clixon_err(OE_XML, 0, "Internal sort error, \"%s:%s\": unexpected node type: %s",
xml_prefix(xc), xml_name(xc), xml_type2str(xml_type(xc)));
else else
clixon_err(OE_XML, 0, "No spec found %s", xml_name(xc)); clixon_err(OE_XML, 0, "Internal sort error, \"%s:%s\": No yang spec found", xml_prefix(xc), xml_name(xc));
goto done; goto done;
#endif
} }
if (yc == yn){ /* Same yang */ if (yc == yn){ /* Same yang */
if (userorder){ /* append: increment linearly until no longer equal */ if (userorder){ /* append: increment linearly until no longer equal */