Experimental: Added CLICON_TRANSACTION_MOD configurqation option. If set,

modifications in validation and commit callbacks are written back
  into the datastore.
This commit is contained in:
Olof hagsand 2018-03-07 22:33:47 +01:00
parent 695aef2cb6
commit 11e2b91a05
3 changed files with 21 additions and 1 deletions

View file

@ -5,6 +5,9 @@
### Major changes: ### Major changes:
### Minor changes: ### Minor changes:
* Experimental: Added CLICON_TRANSACTION_MOD configurqation option. If set,
modifications in validation and commit callbacks are written back
into the datastore.
* Invalid key to api_path2xml gives warning instead of error and quit. * Invalid key to api_path2xml gives warning instead of error and quit.
* Added restconf/operations get, see RFC8040 Sec 3.3.2: * Added restconf/operations get, see RFC8040 Sec 3.3.2:
* yang_find_topnode() and api_path2xml() schemanode parameter replaced with yang_class. Replace as follows: 0 -> YC_DATANODE, 1 -> YC_SCHEMANODE * yang_find_topnode() and api_path2xml() schemanode parameter replaced with yang_class. Replace as follows: 0 -> YC_DATANODE, 1 -> YC_SCHEMANODE

View file

@ -239,13 +239,20 @@ candidate_commit(clicon_handle h,
if (plugin_transaction_commit(h, td) < 0) if (plugin_transaction_commit(h, td) < 0)
goto done; goto done;
/* 8. Success: Copy candidate to running */ /* Optionally write (potentially modified) tree back to candidate */
if (clicon_option_bool(h, "CLICON_TRANSACTION_MOD"))
if (xmldb_put(h, candidate, OP_REPLACE, td->td_target) < 0)
goto done;
/* 8. Success: Copy candidate to running
*/
if (xmldb_copy(h, candidate, "running") < 0) if (xmldb_copy(h, candidate, "running") < 0)
goto done; goto done;
/* 9. Call plugin transaction end callbacks */ /* 9. Call plugin transaction end callbacks */
plugin_transaction_end(h, td); plugin_transaction_end(h, td);
/* 8. Copy running back to candidate in case end functions updated running */ /* 8. Copy running back to candidate in case end functions updated running */
if (xmldb_copy(h, "running", candidate) < 0){ if (xmldb_copy(h, "running", candidate) < 0){
/* ignore errors or signal major setback ? */ /* ignore errors or signal major setback ? */
@ -392,6 +399,10 @@ from_client_validate(clicon_handle h,
clicon_err_reason); clicon_err_reason);
goto ok; goto ok;
} }
/* Optionally write (potentially modified) tree back to candidate */
if (clicon_option_bool(h, "CLICON_TRANSACTION_MOD"))
if (xmldb_put(h, "candidate", OP_REPLACE, td->td_target) < 0)
goto done;
cprintf(cbret, "<rpc-reply><ok/></rpc-reply>"); cprintf(cbret, "<rpc-reply><ok/></rpc-reply>");
ok: ok:
retval = 0; retval = 0;

View file

@ -300,5 +300,11 @@ module clixon-config {
type startup_mode; type startup_mode;
description "Which method to boot/start clicon backend"; description "Which method to boot/start clicon backend";
} }
leaf CLICON_TRANSACTION_MOD {
type boolean;
default false;
description "If set, modifications in validation and commit
callbacks will be saved into running";
}
} }
} }