Some fixex on list pagination remaining attribute

This commit is contained in:
Olof hagsand 2024-08-20 10:06:34 +02:00
parent 7cbc0a8dc3
commit 7cc94b3ac5
3 changed files with 13 additions and 5 deletions

View file

@ -641,6 +641,11 @@ get_list_pagination(clixon_handle h,
int i; int i;
int j; int j;
int ret; int ret;
#ifdef LIST_PAGINATION_REMAINING
cxobj *xcache;
uint32_t total;
uint32_t remaining = 0;
#endif
if (cbret == NULL){ if (cbret == NULL){
clixon_err(OE_PLUGIN, EINVAL, "cbret is NULL"); clixon_err(OE_PLUGIN, EINVAL, "cbret is NULL");

View file

@ -109,7 +109,7 @@
/*! Enable "remaining" attribute (sub-feature of list pagination) /*! Enable "remaining" attribute (sub-feature of list pagination)
* *
* As defined in draft-wwlh-netconf-list-pagination-00 using Yang metadata value [RFC7952] * See "remaining" annotation defined in module ietf-list-pagination.yang
*/ */
#undef LIST_PAGINATION_REMAINING #undef LIST_PAGINATION_REMAINING

View file

@ -12,6 +12,9 @@ cfg=$dir/conf.xml
fexample=$dir/example-social.yang fexample=$dir/example-social.yang
fstate=$dir/mystate.xml fstate=$dir/mystate.xml
# Set to true if LIST_PAGINATION_REMAINING is enabled
REMAINING=false
# Common example-module spec (fexample must be set) # Common example-module spec (fexample must be set)
. ./example_social.sh . ./example_social.sh
@ -285,13 +288,13 @@ function testlimit()
if [ $i = 0 ]; then if [ $i = 0 ]; then
# Note: if REMAINING is enabled: # Note: if REMAINING is enabled:
# if [ $limit == 0 ]; then # if [ $limit == 0 ]; then
if true; then if ${REMAINING}; then
el="<uint8-numbers>$li</uint8-numbers>"
el2="<uint8-numbers xmlns=\"https://example.com/ns/example-social\">$li</uint8-numbers>"
else
el="<uint8-numbers lp:remaining=\"$remaining\" xmlns:lp=\"urn:ietf:params:xml:ns:yang:ietf-list-pagination\">$li</uint8-numbers>" el="<uint8-numbers lp:remaining=\"$remaining\" xmlns:lp=\"urn:ietf:params:xml:ns:yang:ietf-list-pagination\">$li</uint8-numbers>"
el2="<uint8-numbers lp:remaining=\"$remaining\" xmlns:lp=\"urn:ietf:params:xml:ns:yang:ietf-list-pagination\" xmlns=\"https://example.com/ns/example-social\">$li</uint8-numbers>" el2="<uint8-numbers lp:remaining=\"$remaining\" xmlns:lp=\"urn:ietf:params:xml:ns:yang:ietf-list-pagination\" xmlns=\"https://example.com/ns/example-social\">$li</uint8-numbers>"
jsonmeta=",\"@example-social:uint8-numbers\":\[{\"ietf-list-pagination:remaining\":$remaining}\]" jsonmeta=",\"@example-social:uint8-numbers\":\[{\"ietf-list-pagination:remaining\":$remaining}\]"
else
el="<uint8-numbers>$li</uint8-numbers>"
el2="<uint8-numbers xmlns=\"https://example.com/ns/example-social\">$li</uint8-numbers>"
fi fi
jsonlist="$li" jsonlist="$li"
else else