* RESTCONF "insert" and "point" query parameters supported

* Yang Netconf leaf/leaf-list insert support
  * For "ordered-by user" leafs and leaf-lists, the insert and value/key attributes are supported according to RFC7950 Sections 7.7.9 and 7.8.6

* Fixed RESTCONF api-path leaf-list selection was not made properly
This commit is contained in:
Olof hagsand 2019-07-31 14:04:27 +02:00
parent d7a8cf5b0c
commit 2d9d204f69
20 changed files with 740 additions and 105 deletions

View file

@ -51,7 +51,7 @@
* Types
*/
/* Netconf operation type */
enum operation_type{ /* edit-configo */
enum operation_type{ /* edit-config operation */
OP_MERGE, /* merge config-data */
OP_REPLACE,/* replace or create config-data */
OP_CREATE, /* create config data, error if exist */
@ -60,6 +60,14 @@ enum operation_type{ /* edit-configo */
OP_NONE
};
/* Netconf insert type (see RFC7950 Sec 7.8.6) */
enum insert_type{ /* edit-config insert */
INS_FIRST,
INS_LAST,
INS_BEFORE,
INS_AFTER,
};
enum cxobj_type {CX_ERROR=-1,
CX_ELMNT,
CX_ATTR,
@ -115,6 +123,7 @@ int xml_child_nr_notype(cxobj *xn, enum cxobj_type type);
cxobj *xml_child_i(cxobj *xn, int i);
cxobj *xml_child_i_type(cxobj *xn, int i, enum cxobj_type type);
cxobj *xml_child_i_set(cxobj *xt, int i, cxobj *xc);
int xml_child_order(cxobj *xn, cxobj *xc);
cxobj *xml_child_each(cxobj *xparent, cxobj *xprev, enum cxobj_type type);
int xml_child_insert_pos(cxobj *x, cxobj *xc, int i);
@ -178,6 +187,7 @@ int xml_body_int32(cxobj *xb, int32_t *val);
int xml_body_uint32(cxobj *xb, uint32_t *val);
int xml_operation(char *opstr, enum operation_type *op);
char *xml_operation2str(enum operation_type op);
int xml_attr_insert2val(char *instr, enum insert_type *ins);
#if defined(__GNUC__) && __GNUC__ >= 3
int clicon_log_xml(int level, cxobj *x, char *format, ...) __attribute__ ((format (printf, 3, 4)));
#else

View file

@ -56,7 +56,6 @@ int xml_yang_validate_all(clicon_handle h, cxobj *xt, cxobj **xret);
int xml_yang_validate_all_top(clicon_handle h, cxobj *xt, cxobj **xret);
int xml2cvec(cxobj *xt, yang_stmt *ys, cvec **cvv0);
int cvec2xml_1(cvec *cvv, char *toptag, cxobj *xp, cxobj **xt0);
int xml_diff(yang_stmt *yspec, cxobj *x0, cxobj *x1,
cxobj ***first, size_t *firstlen,
cxobj ***second, size_t *secondlen,

View file

@ -42,7 +42,7 @@
int xml_child_spec(cxobj *x, cxobj *xp, yang_stmt *yspec, yang_stmt **yp);
int xml_cmp(cxobj *x1, cxobj *x2, int enm);
int xml_sort(cxobj *x0, void *arg);
int xml_insert(cxobj *xp, cxobj *xc);
int xml_insert(cxobj *xp, cxobj *xc, enum insert_type ins, char *key_val);
int xml_sort_verify(cxobj *x, void *arg);
int match_base_child(cxobj *x0, cxobj *x1c, yang_stmt *yc, cxobj **x0cp);

View file

@ -62,7 +62,7 @@ enum rfc_6020{
Y_BELONGS_TO,
Y_BIT,
Y_CASE,
Y_CHOICE,
Y_CHOICE, /* 10 */
Y_CONFIG,
Y_CONTACT,
Y_CONTAINER,
@ -72,7 +72,7 @@ enum rfc_6020{
Y_DEVIATION,
Y_ENUM,
Y_ERROR_APP_TAG,
Y_ERROR_MESSAGE,
Y_ERROR_MESSAGE, /* 20 */
Y_EXTENSION,
Y_FEATURE,
Y_FRACTION_DIGITS,
@ -82,17 +82,17 @@ enum rfc_6020{
Y_IMPORT,
Y_INCLUDE,
Y_INPUT,
Y_KEY,
Y_KEY, /* 30 */
Y_LEAF,
Y_LEAF_LIST,
Y_LENGTH,
Y_LIST,
Y_LIST,
Y_MANDATORY,
Y_MAX_ELEMENTS,
Y_MIN_ELEMENTS,
Y_MODIFIER,
Y_MODULE,
Y_MUST,
Y_MUST, /* 40 */
Y_NAMESPACE,
Y_NOTIFICATION,
Y_ORDERED_BY,
@ -102,7 +102,7 @@ enum rfc_6020{
Y_PATTERN,
Y_POSITION,
Y_PREFIX,
Y_PRESENCE,
Y_PRESENCE, /* 50 */
Y_RANGE,
Y_REFERENCE,
Y_REFINE,
@ -112,7 +112,7 @@ enum rfc_6020{
Y_RPC,
Y_STATUS,
Y_SUBMODULE,
Y_TYPE,
Y_TYPE, /* 60 */
Y_TYPEDEF,
Y_UNIQUE,
Y_UNITS,