* [Delete and show config are oblivious to the leaf value #157](https://github.com/clicon/clixon/issues/157)
* Added equality of values necessary condition in edit-config delete/remove of leafs
This commit is contained in:
parent
8bc81a8e42
commit
2b820e153a
7 changed files with 38 additions and 16 deletions
|
|
@ -89,6 +89,8 @@ Developers may need to change their code
|
||||||
|
|
||||||
### Corrected Bugs
|
### Corrected Bugs
|
||||||
|
|
||||||
|
* [Delete and show config are oblivious to the leaf value #157](https://github.com/clicon/clixon/issues/157)
|
||||||
|
* Added equality of values necessary condition in edit-config delete/remove of leafs
|
||||||
* Fixed error memory in RESTCONF PATCH/PUT when accessing top-level data node.
|
* Fixed error memory in RESTCONF PATCH/PUT when accessing top-level data node.
|
||||||
* Fixed: [ Calling copy-config RPC from restconf #158](https://github.com/clicon/clixon/issues/158)
|
* Fixed: [ Calling copy-config RPC from restconf #158](https://github.com/clicon/clixon/issues/158)
|
||||||
* Fixed: [namespace prefix nc is not supported in full #154](https://github.com/clicon/clixon/issues/154)
|
* Fixed: [namespace prefix nc is not supported in full #154](https://github.com/clicon/clixon/issues/154)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,6 @@ See [CHANGELOG.md](CHANGELOG.md) release history.
|
||||||
|
|
||||||
Clixon interaction is best done posting issues, pull requests, or joining the
|
Clixon interaction is best done posting issues, pull requests, or joining the
|
||||||
[slack channel](https://clixondev.slack.com).
|
[slack channel](https://clixondev.slack.com).
|
||||||
[Slack invite](https://join.slack.com/t/clixondev/shared_invite/zt-hw9lofnk-C1iDFJ~E_CTiwtyGZi8fdQ)
|
[Slack invite](https://join.slack.com/t/clixondev/shared_invite/zt-jysz1bbp-Pua0_67fMWdPgG3GPbTIZA)
|
||||||
|
|
||||||
Clixon is sponsored by [Rubicon Communications LLC(Netgate)](https://www.netgate.com/)
|
Clixon is sponsored by [Rubicon Communications LLC(Netgate)](https://www.netgate.com/)
|
||||||
|
|
|
||||||
|
|
@ -465,9 +465,21 @@ text_modify(clicon_handle h,
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
x0bstr = xml_body(x0);
|
||||||
|
/* Purge if x1 value is NULL(match-all) or both values are equal */
|
||||||
|
if ((x1bstr == NULL) ||
|
||||||
|
((x0bstr=xml_body(x0)) != NULL && strcmp(x0bstr, x1bstr)==0)){
|
||||||
if (xml_purge(x0) < 0)
|
if (xml_purge(x0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (op == OP_DELETE){
|
||||||
|
if (netconf_data_missing(cbret, NULL, "Data does not exist; cannot delete resource") < 0)
|
||||||
|
goto done;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -540,7 +552,7 @@ text_modify(clicon_handle h,
|
||||||
} /* OP_MERGE & insert */
|
} /* OP_MERGE & insert */
|
||||||
case OP_NONE: /* fall thru */
|
case OP_NONE: /* fall thru */
|
||||||
/* Special case: anyxml, just replace tree,
|
/* Special case: anyxml, just replace tree,
|
||||||
See rfc6020 7.10.3:n
|
See rfc6020 7.10.3
|
||||||
An anyxml node is treated as an opaque chunk of data. This data
|
An anyxml node is treated as an opaque chunk of data. This data
|
||||||
can be modified in its entirety only.
|
can be modified in its entirety only.
|
||||||
Any "operation" attributes present on subelements of an anyxml
|
Any "operation" attributes present on subelements of an anyxml
|
||||||
|
|
|
||||||
|
|
@ -1135,6 +1135,7 @@ xml_sort_verify(cxobj *x0,
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
* @retval -1 Error
|
* @retval -1 Error
|
||||||
* @note only handles first match
|
* @note only handles first match
|
||||||
|
* @see xml_cmp regarding what "match" means in this context (model-match not value-match)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
match_base_child(cxobj *x0,
|
match_base_child(cxobj *x0,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Backend and cli basic functionality
|
# Auto-cli test using modes up and down and table/parameter configs
|
||||||
# Start backend server
|
|
||||||
# Add an ethernet interface and an address
|
|
||||||
# Show configuration
|
|
||||||
# Validate without a mandatory type
|
|
||||||
# Set the mandatory type
|
|
||||||
# Commit
|
|
||||||
|
|
||||||
# Magic line must be first in script (see README.md)
|
# Magic line must be first in script (see README.md)
|
||||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||||
|
|
@ -224,7 +218,7 @@ expectpart "$(cat $fin | $clixon_cli -f $cfg 2>&1)" 0 "/clixon-example:table/par
|
||||||
|
|
||||||
cat <<EOF > $fin
|
cat <<EOF > $fin
|
||||||
edit table parameter b
|
edit table parameter b
|
||||||
delete value 17
|
delete value 71
|
||||||
show config xml
|
show config xml
|
||||||
EOF
|
EOF
|
||||||
new "delete value 71"
|
new "delete value 71"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Tests for using the generated cli.
|
# Tests for using the auto cli.
|
||||||
# In particular setting a config, displaying as cli commands and reconfigure it
|
# In particular setting a config, displaying as cli commands and reconfigure it
|
||||||
# Tests:
|
# Tests:
|
||||||
# Make a config in CLI. Show output as CLI, save it and ensure it is the same
|
# Make a config in CLI. Show output as CLI, save it and ensure it is the same
|
||||||
|
# Try the different GENMODEL settings
|
||||||
|
# NOTE this uses the "Old" autocli (eg cli_set()), see test_cli_auto.sh for "new" autocli using the cli_auto_*() API
|
||||||
|
|
||||||
# Magic line must be first in script (see README.md)
|
# Magic line must be first in script (see README.md)
|
||||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||||
|
|
@ -130,7 +132,6 @@ testrun()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "set a"
|
new "set a"
|
||||||
echo "$clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg"
|
|
||||||
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg set$table parameter$name a value x)" 0 ""
|
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg set$table parameter$name a value x)" 0 ""
|
||||||
|
|
||||||
new "set b"
|
new "set b"
|
||||||
|
|
@ -147,11 +148,23 @@ SAVED=$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg show config)
|
||||||
new "show match a & b xml"
|
new "show match a & b xml"
|
||||||
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg show xml)" 0 "<table xmlns=\"urn:example:clixon\">" "<parameter>" "<name>a</name>" "<value>x</value>" "</parameter>" "<parameter>" "<name>b</name>" "<value>z</value>" "</parameter>" "</table>"
|
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg show xml)" 0 "<table xmlns=\"urn:example:clixon\">" "<parameter>" "<name>a</name>" "<value>x</value>" "</parameter>" "<parameter>" "<name>b</name>" "<value>z</value>" "</parameter>" "</table>"
|
||||||
|
|
||||||
|
# https://github.com/clicon/clixon/issues/157
|
||||||
|
new "delete a y expect fail"
|
||||||
|
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg delete$table parameter$name a value y 2>&1)" 0 ""
|
||||||
|
|
||||||
|
new "show match a & b xml" # Expect same
|
||||||
|
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg show xml)" 0 "<table xmlns=\"urn:example:clixon\">" "<parameter>" "<name>a</name>" "<value>x</value>" "</parameter>" "<parameter>" "<name>b</name>" "<value>z</value>" "</parameter>" "</table>"
|
||||||
|
|
||||||
|
new "delete a x"
|
||||||
|
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg delete$table parameter$name a value x)" 0 ""
|
||||||
|
|
||||||
|
new "show match a & b xml"
|
||||||
|
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg show xml)" 0 "<table xmlns=\"urn:example:clixon\">" "<parameter>" "<name>a</name>" "</parameter>" "<parameter>" "<name>b</name>" "<value>z</value>" "</parameter>" "</table>" --not-- "<value>x</value>"
|
||||||
|
|
||||||
new "delete a"
|
new "delete a"
|
||||||
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg delete$table parameter$name a)" 0 ""
|
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg delete$table parameter$name a)" 0 ""
|
||||||
|
|
||||||
new "show match b"
|
new "show match b"
|
||||||
echo "$clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg show config"
|
|
||||||
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg show config)" 0 "$table parameter$name b" "$table parameter$name b value z" --not-- "$table parameter$name a" "$table parameter$name a value x" "$table parameter$name b value y"
|
expectpart "$($clixon_cli -1 -o CLICON_CLI_GENMODEL_TYPE=$mode -f $cfg show config)" 0 "$table parameter$name b" "$table parameter$name b value z" --not-- "$table parameter$name a" "$table parameter$name a value x" "$table parameter$name b value y"
|
||||||
|
|
||||||
new "discard"
|
new "discard"
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Tests for generating clispec from a yang subtree
|
# Tests for generating clispec from a yang subtree, ie not the whole yang
|
||||||
|
|
||||||
# Magic line must be first in script (see README.md)
|
# Magic line must be first in script (see README.md)
|
||||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue