Pagination updated
* Pagination is updated to new drafts: * [https://datatracker.ietf.org/doc/html/draft-wwlh-netconf-list-pagination-00>] * [https://datatracker.ietf.org/doc/html/draft-wwlh-netconf-list-pagination-nc-02] * [https://datatracker.ietf.org/doc/html/draft-wwlh-netconf-list-pagination-rc-02] * See also updated [https://clixon-docs.readthedocs.io/en/latest/pagination.html] * Added IETF RFC:s (included by pagination): * ietf-netconf-nmda@2019-01-07.yang * ietf-origin@2018-02-14.yang * ietf-netconf-with-defaults@2011-06-01.yang * Dropped pcvec parameter to many restconf api functions
This commit is contained in:
parent
baa6e821a8
commit
a4b4dc97ce
28 changed files with 1011 additions and 527 deletions
|
|
@ -54,18 +54,18 @@
|
|||
*/
|
||||
#define NETCONF_INPUT_CONFIG "config"
|
||||
|
||||
/* Collections namespace from draft-ietf-netconf-restconf-collection-00.txt
|
||||
* XXX: Obsolete but may come back in style
|
||||
/* List pagination namespaces
|
||||
*/
|
||||
#define NETCONF_COLLECTION_NAMESPACE "urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination"
|
||||
|
||||
/* Collections namespace for Clixon
|
||||
/* draft-wwlh-netconf-list-pagination-00.txt
|
||||
* ietf-list-pagination@2021-10-25.yang
|
||||
*/
|
||||
#define CLIXON_PAGINATON_NAMESPACE "http://clicon.org/clixon-netconf-list-pagination"
|
||||
#define IETF_PAGINATON_NAMESPACE "urn:ietf:params:xml:ns:yang:ietf-list-pagination"
|
||||
|
||||
/* Collections namespace for restconf
|
||||
/* draft-wwlh-netconf-list-pagination-nc-02.txt
|
||||
* ietf-list-pagination-nc@2021-10-25.yang
|
||||
*/
|
||||
#define RESTCONF_PAGINATON_NAMESPACE "urn:ietf:params:xml:ns:yang:ietf-restconf-list-pagination"
|
||||
#define IETF_PAGINATON_NC_NAMESPACE "urn:ietf:params:xml:ns:yang:ietf-list-pagination-nc"
|
||||
|
||||
/* Output symbol for netconf get/get-config
|
||||
* ietf-netconf.yang defines it as output:
|
||||
|
|
|
|||
|
|
@ -1039,7 +1039,8 @@ xml2json1_cbuf(cbuf *cb,
|
|||
* goto err;
|
||||
* cbuf_free(cb);
|
||||
* @endcode
|
||||
* @see clicon_xml2cbuf
|
||||
* @see clicon_xml2cbuf XML corresponding function
|
||||
* @see xml2json_cbuf_vec Top symbol is list
|
||||
*/
|
||||
int
|
||||
xml2json_cbuf(cbuf *cb,
|
||||
|
|
@ -1082,7 +1083,7 @@ xml2json_cbuf(cbuf *cb,
|
|||
* @retval -1 Error
|
||||
* @note This only works if the vector is uniform, ie same object name.
|
||||
* Example: <b/><c/> --> <a><b/><c/></a> --> {"b" : null,"c" : null}
|
||||
* @see xml2json1_cbuf
|
||||
* @see xml2json_cbuf
|
||||
*/
|
||||
int
|
||||
xml2json_cbuf_vec(cbuf *cb,
|
||||
|
|
|
|||
|
|
@ -1530,11 +1530,11 @@ netconf_module_load(clicon_handle h)
|
|||
if (clicon_option_bool(h, "CLICON_NETCONF_MESSAGE_ID_OPTIONAL") == 1)
|
||||
xml_bind_netconf_message_id_optional(1);
|
||||
#endif
|
||||
/* Load clixon netconf list pagination */
|
||||
if (yang_spec_parse_module(h, "clixon-netconf-list-pagination", NULL, yspec)< 0)
|
||||
/* Load ietf list pagination */
|
||||
if (yang_spec_parse_module(h, "ietf-list-pagination", NULL, yspec)< 0)
|
||||
goto done;
|
||||
/* Load restconf list pagination */
|
||||
if (yang_spec_parse_module(h, "ietf-restconf-list-pagination", NULL, yspec)< 0)
|
||||
/* Load ietf list pagination netconf */
|
||||
if (yang_spec_parse_module(h, "ietf-list-pagination-nc", NULL, yspec)< 0)
|
||||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
|
|||
|
|
@ -944,8 +944,7 @@ clicon_rpc_get_pageable_list(clicon_handle h,
|
|||
/* Clixon extension, depth=<level> */
|
||||
if (depth != -1)
|
||||
cprintf(cb, " depth=\"%d\"", depth);
|
||||
/* declare cp prefix in get, so sub-elements dont need to */
|
||||
cprintf(cb, " xmlns:cp=\"%s\"", CLIXON_PAGINATON_NAMESPACE);
|
||||
/* declare lp prefix in get, so sub-elements dont need to */
|
||||
cprintf(cb, ">"); /* get */
|
||||
/* If xpath, add a filter */
|
||||
if (xpath && strlen(xpath)) {
|
||||
|
|
@ -957,17 +956,18 @@ clicon_rpc_get_pageable_list(clicon_handle h,
|
|||
cprintf(cb, "/>");
|
||||
}
|
||||
/* Explicit use of list-pagination */
|
||||
cprintf(cb, "<cp:list-pagination>true</cp:list-pagination>");
|
||||
cprintf(cb, "<list-pagination xmlns=\"%s\">", IETF_PAGINATON_NC_NAMESPACE);
|
||||
if (offset != 0)
|
||||
cprintf(cb, "<cp:offset>%u</cp:offset>", offset);
|
||||
cprintf(cb, "<offset>%u</offset>", offset);
|
||||
if (limit != 0)
|
||||
cprintf(cb, "<cp:limit>%u</cp:limit>", limit);
|
||||
cprintf(cb, "<limit>%u</limit>", limit);
|
||||
if (direction)
|
||||
cprintf(cb, "<cp:direction>%s</cp:direction>", direction);
|
||||
cprintf(cb, "<direction>%s</direction>", direction);
|
||||
if (sort)
|
||||
cprintf(cb, "<cp:sort>%s</cp:sort>", sort);
|
||||
cprintf(cb, "<sort>%s</sort>", sort);
|
||||
if (where)
|
||||
cprintf(cb, "<cp:where>%s</cp:where>", where);
|
||||
cprintf(cb, "<where>%s</where>", where);
|
||||
cprintf(cb, "</list-pagination>");
|
||||
cprintf(cb, "</get>");
|
||||
cprintf(cb, "</rpc>");
|
||||
if ((msg = clicon_msg_encode(session_id, "%s", cbuf_get(cb))) == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue