* Added SM_RUNNING_STARTUP to translation table
* Fixed https://github.com/clicon/clixon/issues/224 yet again by addressing a mixed xml and yang namespace xpath case
This commit is contained in:
parent
e0c3f5467c
commit
965cce5e5d
4 changed files with 15 additions and 25 deletions
|
|
@ -96,9 +96,10 @@ static const map_str2int cli_genmodel_map[] = {
|
|||
see clixon-config.yang type startup_mode */
|
||||
static const map_str2int startup_mode_map[] = {
|
||||
{"none", SM_NONE},
|
||||
{"init", SM_INIT},
|
||||
{"running", SM_RUNNING},
|
||||
{"startup", SM_STARTUP},
|
||||
{"init", SM_INIT},
|
||||
{"startup", SM_RUNNING_STARTUP},
|
||||
{NULL, -1}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1212,8 +1212,11 @@ xml_yang_validate_all(clicon_handle h,
|
|||
continue;
|
||||
xpath = yang_argument_get(yc); /* "must" has xpath argument */
|
||||
/* the context node is the node in the accessible tree for
|
||||
* which the "must" statement is defined. */
|
||||
nsc = NULL;
|
||||
* which the "must" statement is defined.
|
||||
* The set of namespace declarations is the set of all "import" statements'
|
||||
*/
|
||||
if (xml_nsctx_yang(yc, &nsc) < 0)
|
||||
goto done;
|
||||
if ((nr = xpath_vec_bool(xt, nsc, "%s", xpath)) < 0)
|
||||
goto done;
|
||||
if (!nr){
|
||||
|
|
|
|||
|
|
@ -151,6 +151,13 @@ nodetest_eval_node(cxobj *x,
|
|||
nsxpath = xml_nsctx_get(nsc, prefix2);
|
||||
if (nsxml != NULL && nsxpath != NULL)
|
||||
retval = (strcmp(nsxml, nsxpath) == 0);
|
||||
else if (nsxpath == NULL){
|
||||
/* We have a namespace from xml, but none in yang.
|
||||
* This can happen in eg augments and ../foo, where foo is
|
||||
* augmented from another namespace
|
||||
*/
|
||||
retval = 1;
|
||||
}
|
||||
else
|
||||
retval = (nsxml == nsxpath); /* True only if both are NULL */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,27 +144,6 @@ if [ $BE -ne 0 ]; then
|
|||
wait_backend
|
||||
fi
|
||||
|
||||
# Test top-level, default prefix, wring leafref prefix and typedef path
|
||||
XML=$(cat <<EOF
|
||||
<sender xmlns="urn:example:example">
|
||||
<name>x</name>
|
||||
</sender>
|
||||
<sender xmlns="urn:example:example">
|
||||
<name>y</name>
|
||||
<ref>x</ref>
|
||||
</sender>
|
||||
EOF
|
||||
)
|
||||
|
||||
new "leafref augment+leafref config top-level"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config>$XML</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "leafref augment+leafref validate top-level wrong prefix"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag><error-info><bad-element>x</bad-element></error-info><error-severity>error</error-severity><error-message>Leafref validation failed: No leaf x matching path /ex:sender/ex:name</error-message></rpc-error></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
# Test top-level, default prefix, correct leafref and typedef path
|
||||
XML=$(cat <<EOF
|
||||
<sender xmlns="urn:example:example">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue