diff --git a/CHANGELOG.md b/CHANGELOG.md
index bfc3df90..b99fb1a5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -69,6 +69,7 @@ Developers may need to change their code
* [Code formatting: Change indentation style to space](https://github.com/clicon/clixon/issues/379)
* Applies to all c/h/y/l/sh files and .editorconfig
* C API changes
+ * Added `expanddefault` parameter to `xml_yang_validate_rpc()`
* Added `defaults` parameter to `clicon_rpc_get_pageable_list()`
* `clicon_rpc_commit()` and `cli_commit`
* Added `confirmed`, `cancel`, `timeout`, `persist-id`, and `persist-id-val` parameters to
@@ -79,6 +80,7 @@ Developers may need to change their code
### Minor features
+* List-pagination: Adhere to ietf-draft: Removed list-pagination "presence"
* Main example: Removed dependency of external IETF RFCs
* See [Can't initiate clixon_backend](https://github.com/clicon/clixon/issues/382)
* Added warning if modstate is not present in datastore if `CLICON_XMLDB_MODSTATE` is set.
diff --git a/apps/backend/backend_client.c b/apps/backend/backend_client.c
index d434ffc6..6c78e968 100644
--- a/apps/backend/backend_client.c
+++ b/apps/backend/backend_client.c
@@ -1388,7 +1388,7 @@ from_client_msg(clicon_handle h,
goto reply;
}
ce->ce_id = id;
- if ((ret = xml_yang_validate_rpc(h, x, &xret)) < 0)
+ if ((ret = xml_yang_validate_rpc(h, x, 1, &xret)) < 0)
goto done;
if (ret == 0){
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
diff --git a/apps/backend/backend_get.c b/apps/backend/backend_get.c
index c2996bc3..4f6476a3 100644
--- a/apps/backend/backend_get.c
+++ b/apps/backend/backend_get.c
@@ -385,11 +385,11 @@ get_nacm_and_reply(clicon_handle h,
* @param[in] h Clixon handle
* @param[in] name Name of attribute
* @param[in] defaultstr Default string which is accepted and sets value to 0
- * @param[in,out] cbret Output buffer for internal RPC message if invalid
+ * @param[in,out] cbret Output buffer for internal bad-element RPC message if invalid
* @param[out] value Value
* @retval -1 Error
- * @retval 0 Invalid, cbret set
- * @retval 1 OK
+ * @retval 0 Invalid, netconf bad-element error cbret set
+ * @retval 1 OK (or not found)
*/
static int
element2value(clicon_handle h,
@@ -545,6 +545,36 @@ with_defaults(cxobj *xe,
return retval;
}
+/*! Extract offset and limit from get/list-pagination
+ *
+ * @param[in] h Clicon handle
+ * @param[in] xe Request:
+ * @param[out] offset Number of entries in the working result-set that should be skipped
+ * @param[out] limit Limits the number of entries returned from the working result-set
+ * @param[out] cbret Return xml tree, eg ..., 0 &&
- (ret = xml_yang_validate_rpc(h, xrpc, &xret)) < 0)
+ (ret = xml_yang_validate_rpc(h, xrpc, 0, &xret)) < 0)
goto done;
if (ret == 0){
if (netconf_add_request_attr(xrpc, xret) < 0)
diff --git a/apps/restconf/restconf_methods_post.c b/apps/restconf/restconf_methods_post.c
index efad6236..b0926351 100644
--- a/apps/restconf/restconf_methods_post.c
+++ b/apps/restconf/restconf_methods_post.c
@@ -806,7 +806,7 @@ api_operations_post(clicon_handle h,
goto done;
goto ok;
}
- if ((ret = xml_yang_validate_rpc(h, xtop, &xerr)) < 0)
+ if ((ret = xml_yang_validate_rpc(h, xtop, 0, &xerr)) < 0)
goto done;
if (ret == 0){
if (api_return_err0(h, req, xerr, pretty, media_out, 0) < 0)
diff --git a/lib/clixon/clixon_validate.h b/lib/clixon/clixon_validate.h
index 3ef67280..0f6483cc 100644
--- a/lib/clixon/clixon_validate.h
+++ b/lib/clixon/clixon_validate.h
@@ -43,7 +43,7 @@
/*
* Prototypes
*/
-int xml_yang_validate_rpc(clicon_handle h, cxobj *xrpc, cxobj **xret);
+int xml_yang_validate_rpc(clicon_handle h, cxobj *xrpc, int expanddefault, cxobj **xret);
int xml_yang_validate_rpc_reply(clicon_handle h, cxobj *xrpc, cxobj **xret);
int xml_yang_validate_add(clicon_handle h, cxobj *xt, cxobj **xret);
int xml_yang_validate_list_key_only(cxobj *xt, cxobj **xret);
diff --git a/lib/src/clixon_validate.c b/lib/src/clixon_validate.c
index fec8bcbf..f30c6a51 100644
--- a/lib/src/clixon_validate.c
+++ b/lib/src/clixon_validate.c
@@ -324,6 +324,7 @@ validate_identityref(cxobj *xt,
/*! Validate an RPC node
* @param[in] h Clicon handle
* @param[in] xrpc XML node to be validated
+ * @param[in] expanddefault
* @param[out] xret Error XML tree. Free with xml_free after use
* @retval 1 Validation OK
* @retval 0 Validation failed
@@ -366,6 +367,7 @@ validate_identityref(cxobj *xt,
int
xml_yang_validate_rpc(clicon_handle h,
cxobj *xrpc,
+ int expanddefault,
cxobj **xret)
{
int retval = -1;
@@ -403,7 +405,7 @@ xml_yang_validate_rpc(clicon_handle h,
goto done; /* error or validation fail */
if (ret == 0)
goto fail;
- if (xml_default_recurse(xn, 0) < 0)
+ if (expanddefault && xml_default_recurse(xn, 0) < 0)
goto done;
}
// ok: /* pass validation */
diff --git a/test/test_pagination_draft.sh b/test/test_pagination_draft.sh
index ba18114a..f83cac9a 100755
--- a/test/test_pagination_draft.sh
+++ b/test/test_pagination_draft.sh
@@ -379,6 +379,9 @@ fi
new "wait restconf"
wait_restconf
+new "Baseline: no pagination"
+expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "alice";
- description
- "This module augments the , , and
+ description
+ "This module augments the , , and
'rpc' statements to support list pagination.
Copyright (c) 2021 IETF Trust and the persons identified
@@ -53,48 +53,47 @@ module ietf-list-pagination-nc {
(RFC 8174) when, and only when, they appear in all
capitals, as shown here.";
- revision 2022-07-24 {
- description
- "Initial revision.";
- reference
- "RFC XXXX: NETCONF Extensions to Support List Pagination";
- }
+ revision 2022-07-24 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: NETCONF Extensions to Support List Pagination";
+ }
- grouping pagination-parameters {
- description "A grouping for list pagination parameters.";
- container list-pagination {
- description "List pagination parameters.";
- presence "Flag that request contains pagination parameters";
- uses lp:where-param-grouping;
- uses lp:sort-by-param-grouping;
- uses lp:direction-param-grouping;
- uses lp:offset-param-grouping;
- uses lp:limit-param-grouping;
- uses lp:sublist-limit-param-grouping;
- }
+ grouping pagination-parameters {
+ description "A grouping for list pagination parameters.";
+ container list-pagination {
+ description "List pagination parameters.";
+ uses lp:where-param-grouping;
+ uses lp:sort-by-param-grouping;
+ uses lp:direction-param-grouping;
+ uses lp:offset-param-grouping;
+ uses lp:limit-param-grouping;
+ uses lp:sublist-limit-param-grouping;
}
+ }
- augment "/nc:get/nc:input" {
- description
- "Allow the 'get' operation to use content filter
+ augment "/nc:get/nc:input" {
+ description
+ "Allow the 'get' operation to use content filter
parameter for specifying the YANG list or leaf-list
that is to be retrieved";
- uses pagination-parameters;
- }
+ uses pagination-parameters;
+ }
- augment "/nc:get-config/nc:input" {
- description
- "Allow the 'get-config' operation to use content filter
+ augment "/nc:get-config/nc:input" {
+ description
+ "Allow the 'get-config' operation to use content filter
parameter for specifying the YANG list or leaf-list
that is to be retrieved";
- uses pagination-parameters;
- }
+ uses pagination-parameters;
+ }
- augment "/ncds:get-data/ncds:input" {
- description
- "Allow the 'get-data' operation to use content filter
+ augment "/ncds:get-data/ncds:input" {
+ description
+ "Allow the 'get-data' operation to use content filter
parameter for specifying the YANG list or leaf-list
that is to be retrieved";
- uses pagination-parameters;
- }
+ uses pagination-parameters;
+ }
}