Skip to content

Commit

Permalink
Some fixex on list pagination remaining attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Aug 20, 2024
1 parent 7cbc0a8 commit 7cc94b3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions apps/backend/backend_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ get_list_pagination(clixon_handle h,
int i;
int j;
int ret;
#ifdef LIST_PAGINATION_REMAINING
cxobj *xcache;
uint32_t total;
uint32_t remaining = 0;
#endif

if (cbret == NULL){
clixon_err(OE_PLUGIN, EINVAL, "cbret is NULL");
Expand Down
2 changes: 1 addition & 1 deletion include/clixon_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

/*! 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

Expand Down
11 changes: 7 additions & 4 deletions test/test_pagination_draft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ cfg=$dir/conf.xml
fexample=$dir/example-social.yang
fstate=$dir/mystate.xml

# Set to true if LIST_PAGINATION_REMAINING is enabled
REMAINING=false

# Common example-module spec (fexample must be set)
. ./example_social.sh

Expand Down Expand Up @@ -285,13 +288,13 @@ function testlimit()
if [ $i = 0 ]; then
# Note: if REMAINING is enabled:
# if [ $limit == 0 ]; then
if true; then
el="<uint8-numbers>$li</uint8-numbers>"
el2="<uint8-numbers xmlns=\"https://example.com/ns/example-social\">$li</uint8-numbers>"
else
if ${REMAINING}; then
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>"
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
jsonlist="$li"
else
Expand Down

0 comments on commit 7cc94b3

Please sign in to comment.