From 0225488c394effba0ae2050d0bad9253985bd083 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Thu, 6 May 2021 16:23:50 +0200 Subject: [PATCH] - Moved deviation actions to include grouped/uses statements. See https://github.com/clicon/clixon/issues/211 --- apps/restconf/restconf_api_native.c | 8 +++++++- lib/src/clixon_yang.c | 1 + lib/src/clixon_yang_parse_lib.c | 23 +++++++++++------------ test/test_yang_deviation.sh | 12 +++++++++--- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/apps/restconf/restconf_api_native.c b/apps/restconf/restconf_api_native.c index e27cde9f..76d10c2c 100644 --- a/apps/restconf/restconf_api_native.c +++ b/apps/restconf/restconf_api_native.c @@ -207,7 +207,13 @@ restconf_reply_send(void *req0, clicon_err(OE_DAEMON, EFAULT, "evhtp_request_get_connection"); goto done; } - /* If body, add a content-length header */ + /* If body, add a content-length header + * A server MUST NOT send a Content-Length header field in any response + * with a status code of 1xx (Informational) or 204 (No Content). A + * server MUST NOT send a Content-Length header field in any 2xx + * (Successful) response to a CONNECT request (Section 4.3.6 of + * [RFC7231]). + */ if (cb != NULL && cbuf_len(cb)){ cprintf(cb, "\r\n"); if (restconf_reply_header(req, "Content-Length", "%d", cbuf_len(cb)) < 0) diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c index 55a3fd42..38575a89 100644 --- a/lib/src/clixon_yang.c +++ b/lib/src/clixon_yang.c @@ -1627,6 +1627,7 @@ yang_deviation(yang_stmt *ys, if (yang_abs_schema_nodeid(ys, nodeid, &ytarget) < 0) goto done; if (ytarget == NULL){ + clicon_log(LOG_WARNING, "deviation %s: target not found", nodeid); goto ok; /* The RFC does not explicitly say the target node MUST exist clicon_err(OE_YANG, 0, "schemanode sanity check of %s", nodeid); diff --git a/lib/src/clixon_yang_parse_lib.c b/lib/src/clixon_yang_parse_lib.c index 553b3a47..ad85b9ac 100644 --- a/lib/src/clixon_yang_parse_lib.c +++ b/lib/src/clixon_yang_parse_lib.c @@ -1323,21 +1323,13 @@ yang_parse_post(clicon_handle h, if (yang_features(h, yang_child_i(yspec, i)) < 0) goto done; - /* 4: Check deviations: not-supported add/delete/replace statements - * done after if-features since they may affect deviations but before populate since target yang statements - * may be removed or changed - */ - for (i=modmin; i