- Updated code to clixon 5.2 status

- Added LIST_PAGINATION clixon_custom constant
- Fix: leafs added as augments on rpc input/output lacked cv:s
This commit is contained in:
Olof hagsand 2021-07-21 14:40:58 +02:00
parent 2485bec483
commit 77bacc93bb
13 changed files with 87 additions and 33 deletions

View file

@ -1335,6 +1335,7 @@ from_client_kill_session(clicon_handle h,
return retval;
}
#ifdef LIST_PAGINATION
/*! Help function for parsing restconf query parameter and setting netconf attribute
*
* If not "unbounded", parse and set a numeric value
@ -1660,6 +1661,7 @@ from_client_get_pageable_list(clicon_handle h,
xml_free(xret);
return retval;
}
#endif /* LIST_PAGINATION */
/*! Create a notification subscription
* @param[in] h Clicon handle
@ -2286,10 +2288,12 @@ backend_rpc_init(clicon_handle h)
if (rpc_callback_register(h, from_client_validate, NULL,
NETCONF_BASE_NAMESPACE, "validate") < 0)
goto done;
#ifdef LIST_PAGINATION
/* draft-ietf-netconf-restconf-collection-00 */
if (rpc_callback_register(h, from_client_get_pageable_list, NULL,
NETCONF_COLLECTION_NAMESPACE, "get-pageable-list") < 0)
goto done;
#endif
/* In backend_client.? RPC from RFC 5277 */
if (rpc_callback_register(h, from_client_create_subscription, NULL,
EVENT_RFC5277_NAMESPACE, "create-subscription") < 0)

View file

@ -1312,6 +1312,7 @@ cli_help(clicon_handle h, cvec *vars, cvec *argv)
return cligen_help(ch, stdout, pt);
}
#ifdef LIST_PAGINATION
/*! Show pagination/collection
* XXX: This is hardcoded only for test_pagination.sh
* @param[in] h Clicon handle
@ -1383,4 +1384,12 @@ cli_pagination(clicon_handle h, cvec *vars, cvec *argv)
cbuf_free(cb);
return retval;
}
#else
int
cli_pagination(clicon_handle h, cvec *vars, cvec *argv)
{
fprintf(stderr, "Not yet implemented\n");
return 0;
}
#endif /* LIST_PAGINATION */

View file

@ -309,6 +309,8 @@ api_return_err(clicon_handle h,
}
break;
default: /* Just ignore the body so that there is a reply */
clicon_err(OE_YANG, EINVAL, "Invalid media type %d", media);
goto done;
break;
} /* switch media */
assert(cbuf_len(cb));

View file

@ -311,6 +311,7 @@ api_data_get2(clicon_handle h,
return retval;
}
#ifdef LIST_PAGINATION
/*! GET Collection
* According to restconf collection draft. Lists, work in progress
* @param[in] h Clixon handle
@ -528,6 +529,7 @@ api_data_collection(clicon_handle h,
free(xvec);
return retval;
}
#endif /* LIST_PAGINATION */
/*! REST HEAD method
* @param[in] h Clixon handle
@ -605,8 +607,13 @@ api_data_get(clicon_handle h,
break;
case YANG_COLLECTION_XML:
case YANG_COLLECTION_JSON:
#ifdef LIST_PAGINATION
if (api_data_collection(h, req, api_path, pcvec, pi, qvec, pretty, media_out) < 0)
goto done;
#else
if (restconf_notimplemented(h, req, pretty, media_out) < 0)
goto done;
#endif
break;
default:
break;