diff --git a/doc/startup.md b/doc/startup.md index 43b80ec4..67bc44df 100644 --- a/doc/startup.md +++ b/doc/startup.md @@ -204,12 +204,38 @@ An example upgrade callback: void *arg, cbuf *cbret) { - return 1; + int retval = -1; + yang_spec *yspec; + yang_stmt *ym; + cxobj **vec = NULL; + cxobj *xc; + size_t vlen; + int i; + + /* Get Yang module for this namespace. Note it may not exist */ + yspec = clicon_dbspec_yang(h); + if ((ym = yang_find_module_by_namespace(yspec, ns)) == NULL) + goto ok; /* shouldnt happen */ + /* Get all XML nodes with that namespace */ + if (xml_namespace_vec(h, xt, ns, &vec, &vlen) < 0) + goto done; + for (i=0; i - - urn:example:a + + + urn:example:b 2017-12-01 2017-12-20 - - 0001 - create - /a:system/a:y - - - 0002 - delete - /a:system/a:x - - + ... + + ``` +Each changelog consists of set of (orderered) steps: +``` + + 1 + insert + /a:system + <y>created</y> + + + 2 + delete + /a:system/a:x + +``` +Each step has an (atomic) operation: +* rename - Rename an XML tag +* replace - Replace the content of an XML node +* insert - Insert a new XML node +* delete - Delete and existing node +* move - Move a node to a new place + +Step have the following mandatory arguments: +* where - An XPath node-vector pointing at a set of target nodes. In most operations, the vector denotes the target node themselves, but for some operations (such as insert) the vector points to parent nodes. +* when - A boolean XPath determining if the step should be evaluated for that (target) node. + +Extended arguments: +* string - XPath string argument (rename) +* xml - XML expression for a new or transformed node (replace, insert) +* node - XPath node expression (move) + +Step summary: +* rename(where:targets, when:bool, tag:string) +* replace(where:targets, when:bool, new:xml) +* insert(where:parents, when:bool, new:xml) +* delete(where:parents, when:bool) +* move(where:parents, when:bool, to:node) ## Flowcharts